aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2014-02-07 14:27:30 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2014-02-07 14:27:30 -0500
commita3b072cd180c12e8fe0ece9487b9065808327640 (patch)
tree62b982041be84748852d77cdf6ca5639ef40858f /arch
parent75a1ba5b2c529db60ca49626bcaf0bddf4548438 (diff)
parent081cd62a010f97b5bc1d2b0cd123c5abc692b68a (diff)
Merge tag 'efi-urgent' into x86/urgent
* Avoid WARN_ON() when mapping BGRT on Baytrail (EFI 32-bit). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig12
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/ptrace.h5
-rw-r--r--arch/alpha/include/asm/thread_info.h2
-rw-r--r--arch/alpha/include/uapi/asm/socket.h2
-rw-r--r--arch/alpha/kernel/Makefile1
-rw-r--r--arch/alpha/kernel/audit.c60
-rw-r--r--arch/alpha/kernel/entry.S6
-rw-r--r--arch/alpha/kernel/pci-sysfs.c4
-rw-r--r--arch/alpha/kernel/pci_iommu.c2
-rw-r--r--arch/alpha/kernel/ptrace.c4
-rw-r--r--arch/alpha/lib/csum_partial_copy.c9
-rw-r--r--arch/arc/Kconfig15
-rw-r--r--arch/arc/include/asm/Kbuild1
-rw-r--r--arch/arc/include/asm/linkage.h2
-rw-r--r--arch/arc/include/asm/smp.h8
-rw-r--r--arch/arc/kernel/head.S26
-rw-r--r--arch/arc/kernel/setup.c48
-rw-r--r--arch/arc/kernel/smp.c124
-rw-r--r--arch/arc/plat-arcfpga/smp.c12
-rw-r--r--arch/arm/Kconfig86
-rw-r--r--arch/arm/Kconfig.debug58
-rw-r--r--arch/arm/Makefile8
-rw-r--r--arch/arm/boot/compressed/Makefile17
-rw-r--r--arch/arm/boot/dts/Makefile38
-rw-r--r--arch/arm/boot/dts/am33xx-clocks.dtsi664
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi28
-rw-r--r--arch/arm/boot/dts/am3517-evm.dts29
-rw-r--r--arch/arm/boot/dts/am3517.dtsi3
-rw-r--r--arch/arm/boot/dts/am35xx-clocks.dtsi128
-rw-r--r--arch/arm/boot/dts/am4372.dtsi28
-rw-r--r--arch/arm/boot/dts/am43xx-clocks.dtsi656
-rw-r--r--arch/arm/boot/dts/animeo_ip.dts31
-rw-r--r--arch/arm/boot/dts/armada-370-mirabox.dts25
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn102.dts125
-rw-r--r--arch/arm/boot/dts/armada-370-netgear-rn104.dts131
-rw-r--r--arch/arm/boot/dts/armada-370-rd.dts21
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi167
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi74
-rw-r--r--arch/arm/boot/dts/armada-xp-gp.dts8
-rw-r--r--arch/arm/boot/dts/armada-xp-netgear-rn2120.dts327
-rw-r--r--arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts3
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi100
-rw-r--r--arch/arm/boot/dts/armv7-m.dtsi18
-rw-r--r--arch/arm/boot/dts/at91-cosino.dtsi122
-rw-r--r--arch/arm/boot/dts/at91-cosino_mega2560.dts84
-rw-r--r--arch/arm/boot/dts/at91-qil_a9260.dts185
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi4
-rw-r--r--arch/arm/boot/dts/at91rm9200ek.dts57
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi5
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi51
-rw-r--r--arch/arm/boot/dts/at91sam9263ek.dts30
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi81
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts54
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi14
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi14
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi26
-rw-r--r--arch/arm/boot/dts/bcm11351-brt.dts6
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi174
-rw-r--r--arch/arm/boot/dts/bcm28155-ap.dts32
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi-b.dts9
-rw-r--r--arch/arm/boot/dts/bcm2835.dtsi6
-rw-r--r--arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts29
-rw-r--r--arch/arm/boot/dts/berlin2.dtsi227
-rw-r--r--arch/arm/boot/dts/berlin2cd-google-chromecast.dts29
-rw-r--r--arch/arm/boot/dts/berlin2cd.dtsi210
-rw-r--r--arch/arm/boot/dts/da850-evm.dts3
-rw-r--r--arch/arm/boot/dts/da850.dtsi14
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts2
-rw-r--r--arch/arm/boot/dts/dove.dtsi498
-rw-r--r--arch/arm/boot/dts/dra7.dtsi41
-rw-r--r--arch/arm/boot/dts/dra7xx-clocks.dtsi2015
-rw-r--r--arch/arm/boot/dts/efm32gg-dk3750.dts86
-rw-r--r--arch/arm/boot/dts/efm32gg.dtsi172
-rw-r--r--arch/arm/boot/dts/emev2-kzm9d.dts42
-rw-r--r--arch/arm/boot/dts/emev2.dtsi116
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos4210-origen.dts2
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi23
-rw-r--r--arch/arm/boot/dts/exynos4212.dtsi24
-rw-r--r--arch/arm/boot/dts/exynos4412-odroidx.dts6
-rw-r--r--arch/arm/boot/dts/exynos4412-origen.dts7
-rw-r--r--arch/arm/boot/dts/exynos4412-tiny4412.dts93
-rw-r--r--arch/arm/boot/dts/exynos4412-trats2.dts21
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi35
-rw-r--r--arch/arm/boot/dts/exynos4x12.dtsi33
-rw-r--r--arch/arm/boot/dts/exynos5.dtsi25
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts64
-rw-r--r--arch/arm/boot/dts/exynos5250-cros-common.dtsi (renamed from arch/arm/boot/dts/cros5250-common.dtsi)35
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts62
-rw-r--r--arch/arm/boot/dts/exynos5250-snow.dts16
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi62
-rw-r--r--arch/arm/boot/dts/exynos5420-arndale-octa.dts66
-rw-r--r--arch/arm/boot/dts/exynos5420-pinctrl.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos5420-smdk5420.dts33
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi350
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi2
-rw-r--r--arch/arm/boot/dts/hi3620-hi4511.dts649
-rw-r--r--arch/arm/boot/dts/hi3620.dtsi565
-rw-r--r--arch/arm/boot/dts/imx23.dtsi4
-rw-r--r--arch/arm/boot/dts/imx28.dtsi3
-rw-r--r--arch/arm/boot/dts/imx6dl-cubox-i.dts12
-rw-r--r--arch/arm/boot/dts/imx6dl-hummingboard.dts167
-rw-r--r--arch/arm/boot/dts/imx6q-cubox-i.dts16
-rw-r--r--arch/arm/boot/dts/imx6qdl-cubox-i.dtsi143
-rw-r--r--arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi62
-rw-r--r--arch/arm/boot/dts/imx6qdl-microsom.dtsi33
-rw-r--r--arch/arm/boot/dts/integrator.dtsi5
-rw-r--r--arch/arm/boot/dts/integratorcp.dts3
-rw-r--r--arch/arm/boot/dts/k2hk-evm.dts63
-rw-r--r--arch/arm/boot/dts/keystone-clocks.dtsi36
-rw-r--r--arch/arm/boot/dts/keystone.dtsi (renamed from arch/arm/boot/dts/keystone.dts)35
-rw-r--r--arch/arm/boot/dts/kirkwood-6192.dtsi107
-rw-r--r--arch/arm/boot/dts/kirkwood-6281.dtsi4
-rw-r--r--arch/arm/boot/dts/kirkwood-6282.dtsi39
-rw-r--r--arch/arm/boot/dts/kirkwood-cloudbox.dts11
-rw-r--r--arch/arm/boot/dts/kirkwood-db.dtsi5
-rw-r--r--arch/arm/boot/dts/kirkwood-dns320.dts12
-rw-r--r--arch/arm/boot/dts/kirkwood-dns325.dts12
-rw-r--r--arch/arm/boot/dts/kirkwood-dnskw.dtsi19
-rw-r--r--arch/arm/boot/dts/kirkwood-dockstar.dts7
-rw-r--r--arch/arm/boot/dts/kirkwood-dreamplug.dts8
-rw-r--r--arch/arm/boot/dts/kirkwood-goflexnet.dts25
-rw-r--r--arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts14
-rw-r--r--arch/arm/boot/dts/kirkwood-ib62x0.dts19
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts29
-rw-r--r--arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts23
-rw-r--r--arch/arm/boot/dts/kirkwood-km_kirkwood.dts5
-rw-r--r--arch/arm/boot/dts/kirkwood-laplug.dts175
-rw-r--r--arch/arm/boot/dts/kirkwood-lsxl.dtsi32
-rw-r--r--arch/arm/boot/dts/kirkwood-mplcec4.dts16
-rw-r--r--arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts14
-rw-r--r--arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts112
-rw-r--r--arch/arm/boot/dts/kirkwood-netgear_readynas_nv+_v2.dts268
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2-common.dtsi9
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2lite.dts4
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2max.dts10
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2mini.dts10
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310-common.dtsi4
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310.dts32
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310a.dts30
-rw-r--r--arch/arm/boot/dts/kirkwood-openblocks_a6.dts11
-rw-r--r--arch/arm/boot/dts/kirkwood-openblocks_a7.dts12
-rw-r--r--arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi3
-rw-r--r--arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts8
-rw-r--r--arch/arm/boot/dts/kirkwood-sheevaplug.dts8
-rw-r--r--arch/arm/boot/dts/kirkwood-topkick.dts11
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6281.dts8
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6282.dts8
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219.dtsi1
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi162
-rw-r--r--arch/arm/boot/dts/kizbox.dts6
-rw-r--r--arch/arm/boot/dts/moxart-uc7112lx.dts117
-rw-r--r--arch/arm/boot/dts/moxart.dtsi148
-rw-r--r--arch/arm/boot/dts/omap2.dtsi2
-rw-r--r--arch/arm/boot/dts/omap2420-n800.dts8
-rw-r--r--arch/arm/boot/dts/omap2420-n810-wimax.dts8
-rw-r--r--arch/arm/boot/dts/omap2420-n810.dts8
-rw-r--r--arch/arm/boot/dts/omap2420-n8x0-common.dtsi99
-rw-r--r--arch/arm/boot/dts/omap2430-sdp.dts49
-rw-r--r--arch/arm/boot/dts/omap3-beagle-xm.dts40
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts40
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3730.dts104
-rw-r--r--arch/arm/boot/dts/omap3-cm-t3x30.dtsi95
-rw-r--r--arch/arm/boot/dts/omap3-igep.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3-igep0020.dts52
-rw-r--r--arch/arm/boot/dts/omap3-igep0030.dts10
-rw-r--r--arch/arm/boot/dts/omap3-ldp.dts231
-rw-r--r--arch/arm/boot/dts/omap3-sb-t35.dtsi40
-rw-r--r--arch/arm/boot/dts/omap3-sbc-t3730.dts30
-rw-r--r--arch/arm/boot/dts/omap3-zoom3.dts23
-rw-r--r--arch/arm/boot/dts/omap3.dtsi43
-rw-r--r--arch/arm/boot/dts/omap3430es1-clocks.dtsi208
-rw-r--r--arch/arm/boot/dts/omap34xx-omap36xx-clocks.dtsi268
-rw-r--r--arch/arm/boot/dts/omap34xx.dtsi17
-rw-r--r--arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi242
-rw-r--r--arch/arm/boot/dts/omap36xx-clocks.dtsi90
-rw-r--r--arch/arm/boot/dts/omap36xx-omap3430es2plus-clocks.dtsi198
-rw-r--r--arch/arm/boot/dts/omap36xx.dtsi16
-rw-r--r--arch/arm/boot/dts/omap3xxx-clocks.dtsi1660
-rw-r--r--arch/arm/boot/dts/omap4-cpu-thermal.dtsi41
-rw-r--r--arch/arm/boot/dts/omap4.dtsi54
-rw-r--r--arch/arm/boot/dts/omap443x-clocks.dtsi18
-rw-r--r--arch/arm/boot/dts/omap443x.dtsi25
-rw-r--r--arch/arm/boot/dts/omap4460.dtsi31
-rw-r--r--arch/arm/boot/dts/omap446x-clocks.dtsi27
-rw-r--r--arch/arm/boot/dts/omap44xx-clocks.dtsi1651
-rw-r--r--arch/arm/boot/dts/omap5-core-thermal.dtsi28
-rw-r--r--arch/arm/boot/dts/omap5-gpu-thermal.dtsi28
-rw-r--r--arch/arm/boot/dts/omap5.dtsi68
-rw-r--r--arch/arm/boot/dts/omap54xx-clocks.dtsi1399
-rw-r--r--arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts1
-rw-r--r--arch/arm/boot/dts/orion5x.dtsi107
-rw-r--r--arch/arm/boot/dts/prima2.dtsi41
-rw-r--r--arch/arm/boot/dts/pxa27x.dtsi24
-rw-r--r--arch/arm/boot/dts/qcom-apq8074-dragonboard.dts6
-rw-r--r--arch/arm/boot/dts/qcom-msm8660-surf.dts15
-rw-r--r--arch/arm/boot/dts/qcom-msm8960-cdp.dts20
-rw-r--r--arch/arm/boot/dts/qcom-msm8974.dtsi121
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai-reference.dts31
-rw-r--r--arch/arm/boot/dts/r7s72100-genmai.dts2
-rw-r--r--arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts15
-rw-r--r--arch/arm/boot/dts/r8a73a4-ape6evm.dts10
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi184
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts90
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva.dts2
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi144
-rw-r--r--arch/arm/boot/dts/r8a7778-bockw-reference.dts57
-rw-r--r--arch/arm/boot/dts/r8a7778-bockw.dts2
-rw-r--r--arch/arm/boot/dts/r8a7778.dtsi172
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen-reference.dts36
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen.dts2
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi114
-rw-r--r--arch/arm/boot/dts/r8a7790-lager-reference.dts45
-rw-r--r--arch/arm/boot/dts/r8a7790-lager.dts64
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi413
-rw-r--r--arch/arm/boot/dts/r8a7791-koelsch-reference.dts115
-rw-r--r--arch/arm/boot/dts/r8a7791-koelsch.dts35
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi467
-rw-r--r--arch/arm/boot/dts/sama5d3.dtsi428
-rw-r--r--arch/arm/boot/dts/sama5d36.dtsi20
-rw-r--r--arch/arm/boot/dts/sama5d36ek.dts53
-rw-r--r--arch/arm/boot/dts/sama5d3_can.dtsi20
-rw-r--r--arch/arm/boot/dts/sama5d3_emac.dtsi11
-rw-r--r--arch/arm/boot/dts/sama5d3_gmac.dtsi11
-rw-r--r--arch/arm/boot/dts/sama5d3_lcd.dtsi17
-rw-r--r--arch/arm/boot/dts/sama5d3_mci2.dtsi12
-rw-r--r--arch/arm/boot/dts/sama5d3_tcb1.dtsi12
-rw-r--r--arch/arm/boot/dts/sama5d3_uart.dtsi26
-rw-r--r--arch/arm/boot/dts/sama5d3xcm.dtsi17
-rw-r--r--arch/arm/boot/dts/sama5d3xdm.dtsi1
-rw-r--r--arch/arm/boot/dts/sh7372-mackerel.dts2
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts103
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g.dts2
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi168
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi4
-rw-r--r--arch/arm/boot/dts/st-pincfg.h2
-rw-r--r--arch/arm/boot/dts/ste-dbx5x0.dtsi32
-rw-r--r--arch/arm/boot/dts/ste-href-family-pinctrl.dtsi745
-rw-r--r--arch/arm/boot/dts/ste-href-stuib.dtsi41
-rw-r--r--arch/arm/boot/dts/ste-href-tvk1281618.dtsi90
-rw-r--r--arch/arm/boot/dts/ste-href.dtsi80
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60.dtsi78
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus.dtsi251
-rw-r--r--arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi80
-rw-r--r--arch/arm/boot/dts/ste-nomadik-s8815.dts4
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi4
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts231
-rw-r--r--arch/arm/boot/dts/ste-u300.dts6
-rw-r--r--arch/arm/boot/dts/stih415-pinctrl.dtsi36
-rw-r--r--arch/arm/boot/dts/stih415.dtsi53
-rw-r--r--arch/arm/boot/dts/stih416-pinctrl.dtsi35
-rw-r--r--arch/arm/boot/dts/stih416.dtsi53
-rw-r--r--arch/arm/boot/dts/stih41x-b2000.dtsi9
-rw-r--r--arch/arm/boot/dts/stih41x-b2020.dtsi22
-rw-r--r--arch/arm/boot/dts/sun4i-a10-a1000.dts4
-rw-r--r--arch/arm/boot/dts/sun4i-a10-cubieboard.dts9
-rw-r--r--arch/arm/boot/dts/sun4i-a10-hackberry.dts4
-rw-r--r--arch/arm/boot/dts/sun4i-a10-mini-xplus.dts4
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi164
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi132
-rw-r--r--arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts68
-rw-r--r--arch/arm/boot/dts/sun5i-a13-olinuxino.dts4
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi128
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi34
-rw-r--r--arch/arm/boot/dts/sun7i-a20-cubietruck.dts18
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi222
-rw-r--r--arch/arm/boot/dts/tegra114-dalmore.dts630
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi295
-rw-r--r--arch/arm/boot/dts/tegra124-venice2.dts1064
-rw-r--r--arch/arm/boot/dts/tegra124.dtsi418
-rw-r--r--arch/arm/boot/dts/tegra20-colibri-512.dtsi209
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts316
-rw-r--r--arch/arm/boot/dts/tegra20-iris-512.dts30
-rw-r--r--arch/arm/boot/dts/tegra20-medcom-wide.dts2
-rw-r--r--arch/arm/boot/dts/tegra20-paz00.dts52
-rw-r--r--arch/arm/boot/dts/tegra20-plutux.dts4
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts353
-rw-r--r--arch/arm/boot/dts/tegra20-tamonten.dtsi47
-rw-r--r--arch/arm/boot/dts/tegra20-tec.dts6
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts54
-rw-r--r--arch/arm/boot/dts/tegra20-ventana.dts62
-rw-r--r--arch/arm/boot/dts/tegra20-whistler.dts84
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi191
-rw-r--r--arch/arm/boot/dts/tegra30-beaver.dts126
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu-a02.dts14
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu-a04.dts14
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi104
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi247
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi59
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts9
-rw-r--r--arch/arm/boot/dts/zynq-zc706.dts9
-rw-r--r--arch/arm/boot/dts/zynq-zed.dts9
-rw-r--r--arch/arm/common/it8152.c4
-rw-r--r--arch/arm/common/mcpm_entry.c7
-rw-r--r--arch/arm/common/timer-sp.c4
-rw-r--r--arch/arm/configs/ape6evm_defconfig2
-rw-r--r--arch/arm/configs/armadillo800eva_defconfig5
-rw-r--r--arch/arm/configs/at91_dt_defconfig1
-rw-r--r--arch/arm/configs/at91rm9200_defconfig1
-rw-r--r--arch/arm/configs/at91sam9260_9g20_defconfig2
-rw-r--r--arch/arm/configs/at91sam9261_9g10_defconfig1
-rw-r--r--arch/arm/configs/at91sam9g45_defconfig1
-rw-r--r--arch/arm/configs/at91sam9rl_defconfig1
-rw-r--r--arch/arm/configs/bcm2835_defconfig37
-rw-r--r--arch/arm/configs/bcm_defconfig7
-rw-r--r--arch/arm/configs/bockw_defconfig12
-rw-r--r--arch/arm/configs/efm32_defconfig102
-rw-r--r--arch/arm/configs/exynos_defconfig3
-rw-r--r--arch/arm/configs/genmai_defconfig116
-rw-r--r--arch/arm/configs/hi3xxx_defconfig56
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig2
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig13
-rw-r--r--arch/arm/configs/keystone_defconfig21
-rw-r--r--arch/arm/configs/kirkwood_defconfig1
-rw-r--r--arch/arm/configs/koelsch_defconfig27
-rw-r--r--arch/arm/configs/kzm9d_defconfig3
-rw-r--r--arch/arm/configs/kzm9g_defconfig2
-rw-r--r--arch/arm/configs/lager_defconfig5
-rw-r--r--arch/arm/configs/mackerel_defconfig2
-rw-r--r--arch/arm/configs/marzen_defconfig12
-rw-r--r--arch/arm/configs/moxart_defconfig149
-rw-r--r--arch/arm/configs/msm_defconfig18
-rw-r--r--arch/arm/configs/multi_v7_defconfig159
-rw-r--r--arch/arm/configs/mvebu_defconfig3
-rw-r--r--arch/arm/configs/omap2plus_defconfig3
-rw-r--r--arch/arm/configs/sama5_defconfig1
-rw-r--r--arch/arm/configs/tegra_defconfig28
-rw-r--r--arch/arm/configs/u8500_defconfig1
-rw-r--r--arch/arm/configs/versatile_defconfig26
-rw-r--r--arch/arm/firmware/Kconfig28
-rw-r--r--arch/arm/firmware/Makefile1
-rw-r--r--arch/arm/firmware/trusted_foundations.c81
-rw-r--r--arch/arm/include/asm/Kbuild1
-rw-r--r--arch/arm/include/asm/bitops.h54
-rw-r--r--arch/arm/include/asm/cacheflush.h5
-rw-r--r--arch/arm/include/asm/checksum.h34
-rw-r--r--arch/arm/include/asm/clkdev.h2
-rw-r--r--arch/arm/include/asm/dma.h4
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h1
-rw-r--r--arch/arm/include/asm/io.h6
-rw-r--r--arch/arm/include/asm/kvm_host.h3
-rw-r--r--arch/arm/include/asm/kvm_mmu.h1
-rw-r--r--arch/arm/include/asm/mach/map.h27
-rw-r--r--arch/arm/include/asm/pci.h5
-rw-r--r--arch/arm/include/asm/pgtable-2level.h1
-rw-r--r--arch/arm/include/asm/pgtable-3level.h1
-rw-r--r--arch/arm/include/asm/pgtable.h2
-rw-r--r--arch/arm/include/asm/trusted_foundations.h67
-rw-r--r--arch/arm/include/asm/word-at-a-time.h18
-rw-r--r--arch/arm/include/asm/xen/page.h3
-rw-r--r--arch/arm/include/debug/imx-uart.h10
-rw-r--r--arch/arm/include/debug/tegra.S34
-rw-r--r--arch/arm/include/uapi/asm/kvm.h28
-rw-r--r--arch/arm/kernel/armksyms.c4
-rw-r--r--arch/arm/kernel/devtree.c2
-rw-r--r--arch/arm/kernel/entry-armv.S2
-rw-r--r--arch/arm/kernel/entry-v7m.S2
-rw-r--r--arch/arm/kernel/etm.c6
-rw-r--r--arch/arm/kernel/head.S3
-rw-r--r--arch/arm/kernel/io.c35
-rw-r--r--arch/arm/kernel/setup.c59
-rw-r--r--arch/arm/kernel/smp.c6
-rw-r--r--arch/arm/kernel/tcm.c4
-rw-r--r--arch/arm/kernel/topology.c12
-rw-r--r--arch/arm/kernel/traps.c2
-rw-r--r--arch/arm/kvm/arm.c79
-rw-r--r--arch/arm/kvm/guest.c92
-rw-r--r--arch/arm/kvm/handle_exit.c2
-rw-r--r--arch/arm/kvm/mmu.c24
-rw-r--r--arch/arm/kvm/psci.c11
-rw-r--r--arch/arm/lib/Makefile2
-rw-r--r--arch/arm/lib/backtrace.S20
-rw-r--r--arch/arm/lib/bswapsdi2.S36
-rw-r--r--arch/arm/mach-at91/Kconfig52
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt14
-rw-r--r--arch/arm/mach-at91/Makefile3
-rw-r--r--arch/arm/mach-at91/at91rm9200.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/at91sam9263.c2
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c14
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c2
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c2
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c2
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c10
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c266
-rw-r--r--arch/arm/mach-at91/clock.c13
-rw-r--r--arch/arm/mach-at91/generic.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h190
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h3
-rw-r--r--arch/arm/mach-at91/pm.c5
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S2
-rw-r--r--arch/arm/mach-at91/sam9_smc.c2
-rw-r--r--arch/arm/mach-at91/sama5d3.c344
-rw-r--r--arch/arm/mach-at91/setup.c14
-rw-r--r--arch/arm/mach-bcm/Kconfig1
-rw-r--r--arch/arm/mach-bcm2835/Kconfig2
-rw-r--r--arch/arm/mach-berlin/Kconfig29
-rw-r--r--arch/arm/mach-berlin/Makefile1
-rw-r--r--arch/arm/mach-berlin/berlin.c39
-rw-r--r--arch/arm/mach-clps711x/common.c4
-rw-r--r--arch/arm/mach-clps711x/devices.c21
-rw-r--r--arch/arm/mach-davinci/clock.c2
-rw-r--r--arch/arm/mach-davinci/da830.c3
-rw-r--r--arch/arm/mach-davinci/da850.c3
-rw-r--r--arch/arm/mach-davinci/da8xx-dt.c2
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c4
-rw-r--r--arch/arm/mach-davinci/devices.c2
-rw-r--r--arch/arm/mach-davinci/dm355.c3
-rw-r--r--arch/arm/mach-davinci/dm365.c3
-rw-r--r--arch/arm/mach-davinci/dm644x.c3
-rw-r--r--arch/arm/mach-davinci/dm646x.c3
-rw-r--r--arch/arm/mach-davinci/time.c4
-rw-r--r--arch/arm/mach-dove/common.c15
-rw-r--r--arch/arm/mach-efm32/Makefile1
-rw-r--r--arch/arm/mach-efm32/Makefile.boot3
-rw-r--r--arch/arm/mach-efm32/dtmachine.c15
-rw-r--r--arch/arm/mach-efm32/include/mach/entry-macro.S4
-rw-r--r--arch/arm/mach-efm32/include/mach/timex.h3
-rw-r--r--arch/arm/mach-ep93xx/Kconfig1
-rw-r--r--arch/arm/mach-ep93xx/core.c110
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h3
-rw-r--r--arch/arm/mach-exynos/Kconfig4
-rw-r--r--arch/arm/mach-exynos/common.c13
-rw-r--r--arch/arm/mach-exynos/common.h7
-rw-r--r--arch/arm/mach-exynos/cpuidle.c33
-rw-r--r--arch/arm/mach-exynos/hotplug.c2
-rw-r--r--arch/arm/mach-exynos/include/mach/pm-core.h5
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-clock.h372
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-irq.h19
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c1
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c3
-rw-r--r--arch/arm/mach-exynos/platsmp.c6
-rw-r--r--arch/arm/mach-exynos/pm.c33
-rw-r--r--arch/arm/mach-exynos/pm_domains.c9
-rw-r--r--arch/arm/mach-exynos/pmu.c17
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h (renamed from arch/arm/mach-exynos/include/mach/regs-pmu.h)53
-rw-r--r--arch/arm/mach-footbridge/Kconfig1
-rw-r--r--arch/arm/mach-footbridge/common.c5
-rw-r--r--arch/arm/mach-footbridge/common.h2
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c39
-rw-r--r--arch/arm/mach-footbridge/ebsa285.c18
-rw-r--r--arch/arm/mach-footbridge/include/mach/hardware.h6
-rw-r--r--arch/arm/mach-hisi/Kconfig16
-rw-r--r--arch/arm/mach-hisi/Makefile7
-rw-r--r--arch/arm/mach-hisi/core.h15
-rw-r--r--arch/arm/mach-hisi/hisilicon.c90
-rw-r--r--arch/arm/mach-hisi/hotplug.c200
-rw-r--r--arch/arm/mach-hisi/platsmp.c89
-rw-r--r--arch/arm/mach-imx/Kconfig36
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/avic.c25
-rw-r--r--arch/arm/mach-imx/clk-gate2.c2
-rw-r--r--arch/arm/mach-imx/clk-imx35.c14
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c804
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c5
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c11
-rw-r--r--arch/arm/mach-imx/clk-pfd.c11
-rw-r--r--arch/arm/mach-imx/clk-pllv1.c23
-rw-r--r--arch/arm/mach-imx/clk-vf610.c5
-rw-r--r--arch/arm/mach-imx/common.h1
-rw-r--r--arch/arm/mach-imx/imx31-dt.c2
-rw-r--r--arch/arm/mach-imx/imx35-dt.c50
-rw-r--r--arch/arm/mach-imx/imx51-dt.c2
-rw-r--r--arch/arm/mach-imx/irq-common.h1
-rw-r--r--arch/arm/mach-imx/mach-cpuimx35.c2
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c2
-rw-r--r--arch/arm/mach-imx/mach-imx50.c38
-rw-r--r--arch/arm/mach-imx/mach-imx53.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c67
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c10
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c16
-rw-r--r--arch/arm/mach-imx/mach-pca100.c2
-rw-r--r--arch/arm/mach-imx/mach-vf610.c2
-rw-r--r--arch/arm/mach-imx/mm-imx5.c8
-rw-r--r--arch/arm/mach-imx/platsmp.c3
-rw-r--r--arch/arm/mach-imx/pm-imx6q.c16
-rw-r--r--arch/arm/mach-imx/time.c4
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c64
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c8
-rw-r--r--arch/arm/mach-iop32x/em7210.c32
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c6
-rw-r--r--arch/arm/mach-ixp4xx/common.c6
-rw-r--r--arch/arm/mach-keystone/Kconfig3
-rw-r--r--arch/arm/mach-keystone/keystone.c4
-rw-r--r--arch/arm/mach-keystone/keystone.h1
-rw-r--r--arch/arm/mach-keystone/pm_domain.c2
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c40
-rw-r--r--arch/arm/mach-kirkwood/pm.c4
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio.h19
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h50
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c2
-rw-r--r--arch/arm/mach-mmp/Kconfig3
-rw-r--r--arch/arm/mach-mmp/Makefile3
-rw-r--r--arch/arm/mach-mmp/time.c4
-rw-r--r--arch/arm/mach-moxart/Kconfig31
-rw-r--r--arch/arm/mach-moxart/Makefile3
-rw-r--r--arch/arm/mach-moxart/moxart.c15
-rw-r--r--arch/arm/mach-msm/Kconfig74
-rw-r--r--arch/arm/mach-msm/Makefile4
-rw-r--r--arch/arm/mach-msm/board-dt.c9
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c35
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c35
-rw-r--r--arch/arm/mach-msm/board-trout.c12
-rw-r--r--arch/arm/mach-msm/platsmp.c3
-rw-r--r--arch/arm/mach-msm/timer.c4
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/gpio.h9
-rw-r--r--arch/arm/mach-mvebu/Makefile2
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.c32
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.h4
-rw-r--r--arch/arm/mach-mvebu/coherency.c1
-rw-r--r--arch/arm/mach-mvebu/coherency.h4
-rw-r--r--arch/arm/mach-mvebu/common.h10
-rw-r--r--arch/arm/mach-mvebu/hotplug.c1
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.c119
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.h32
-rw-r--r--arch/arm/mach-mvebu/platsmp.c4
-rw-r--r--arch/arm/mach-mvebu/pmsu.c3
-rw-r--r--arch/arm/mach-mvebu/system-controller.c5
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c32
-rw-r--r--arch/arm/mach-omap1/include/mach/usb.h38
-rw-r--r--arch/arm/mach-omap1/time.c4
-rw-r--r--arch/arm/mach-omap2/Kconfig31
-rw-r--r--arch/arm/mach-omap2/Makefile11
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c273
-rw-r--r--arch/arm/mach-omap2/board-generic.c7
-rw-r--r--arch/arm/mach-omap2/board-h4.c365
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c234
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c7
-rw-r--r--arch/arm/mach-omap2/cclock33xx_data.c1064
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c1735
-rw-r--r--arch/arm/mach-omap2/clkt_clksel.c10
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c6
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c20
-rw-r--r--arch/arm/mach-omap2/clock.c57
-rw-r--r--arch/arm/mach-omap2/clock.h179
-rw-r--r--arch/arm/mach-omap2/clock36xx.c7
-rw-r--r--arch/arm/mach-omap2/clock3xxx.h3
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h1
-rw-r--r--arch/arm/mach-omap2/common.h10
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c26
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c37
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c12
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c50
-rw-r--r--arch/arm/mach-omap2/io.c49
-rw-r--r--arch/arm/mach-omap2/msdi.c69
-rw-r--r--arch/arm/mach-omap2/mux.h2
-rw-r--r--arch/arm/mach-omap2/mux2420.c690
-rw-r--r--arch/arm/mach-omap2/mux2420.h282
-rw-r--r--arch/arm/mach-omap2/mux2430.c793
-rw-r--r--arch/arm/mach-omap2/mux2430.h370
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c3
-rw-r--r--arch/arm/mach-omap2/omap-smp.c6
-rw-r--r--arch/arm/mach-omap2/omap4-common.c8
-rw-r--r--arch/arm/mach-omap2/omap_device.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c137
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c266
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c165
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c72
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h5
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c138
-rw-r--r--arch/arm/mach-omap2/pm44xx.c15
-rw-r--r--arch/arm/mach-omap2/prm.h1
-rw-r--r--arch/arm/mach-omap2/prm_common.c66
-rw-r--r--arch/arm/mach-omap2/timer.c10
-rw-r--r--arch/arm/mach-orion5x/board-dt.c2
-rw-r--r--arch/arm/mach-orion5x/common.c7
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c2
-rw-r--r--arch/arm/mach-orion5x/irq.c1
-rw-r--r--arch/arm/mach-orion5x/pci.c4
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c2
-rw-r--r--arch/arm/mach-orion5x/terastation_pro2-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c2
-rw-r--r--arch/arm/mach-prima2/platsmp.c3
-rw-r--r--arch/arm/mach-pxa/am200epd.c3
-rw-r--r--arch/arm/mach-pxa/am300epd.c3
-rw-r--r--arch/arm/mach-pxa/em-x270.c3
-rw-r--r--arch/arm/mach-pxa/irq.c4
-rw-r--r--arch/arm/mach-pxa/magician.c2
-rw-r--r--arch/arm/mach-pxa/mainstone.c2
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c2
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c8
-rw-r--r--arch/arm/mach-pxa/time.c6
-rw-r--r--arch/arm/mach-pxa/trizeps4.c3
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig21
-rw-r--r--arch/arm/mach-s3c24xx/common-smdk.c2
-rw-r--r--arch/arm/mach-s3c24xx/dma.c2
-rw-r--r--arch/arm/mach-s3c24xx/h1940-bluetooth.c2
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h (renamed from arch/arm/mach-s3c24xx/include/mach/gpio.h)26
-rw-r--r--arch/arm/mach-s3c24xx/mach-amlm5900.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-at2440evb.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-bast.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-gta02.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-n30.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris-dvs.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-qt2410.c1
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c2
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx3715.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-vr1000.c1
-rw-r--r--arch/arm/mach-s3c24xx/pm-s3c2410.c2
-rw-r--r--arch/arm/mach-s3c24xx/pm.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2416.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2440.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2442.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2443.c1
-rw-r--r--arch/arm/mach-s3c24xx/setup-i2c.c1
-rw-r--r--arch/arm/mach-s3c24xx/setup-sdhci-gpio.c1
-rw-r--r--arch/arm/mach-s3c24xx/setup-ts.c2
-rw-r--r--arch/arm/mach-s3c24xx/simtec-usb.c4
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig10
-rw-r--r--arch/arm/mach-s3c64xx/Makefile2
-rw-r--r--arch/arm/mach-s3c64xx/common.c1
-rw-r--r--arch/arm/mach-s3c64xx/common.h5
-rw-r--r--arch/arm/mach-s3c64xx/crag6410.h2
-rw-r--r--arch/arm/mach-s3c64xx/dev-audio.c1
-rw-r--r--arch/arm/mach-s3c64xx/dma.c762
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/dma.h144
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h (renamed from arch/arm/mach-s3c64xx/include/mach/gpio.h)9
-rw-r--r--arch/arm/mach-s3c64xx/mach-anw6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-hmt.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c11
-rw-r--r--arch/arm/mach-s3c64xx/mach-real6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq.c3
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq5.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq7.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6400.c1
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c1
-rw-r--r--arch/arm/mach-s3c64xx/pl080.c244
-rw-r--r--arch/arm/mach-s3c64xx/pm.c1
-rw-r--r--arch/arm/mach-s3c64xx/setup-fb-24bpp.c1
-rw-r--r--arch/arm/mach-s3c64xx/setup-i2c0.c1
-rw-r--r--arch/arm/mach-s3c64xx/setup-i2c1.c1
-rw-r--r--arch/arm/mach-s3c64xx/setup-ide.c1
-rw-r--r--arch/arm/mach-s3c64xx/setup-keypad.c1
-rw-r--r--arch/arm/mach-s3c64xx/setup-sdhci-gpio.c1
-rw-r--r--arch/arm/mach-s3c64xx/setup-spi.c1
-rw-r--r--arch/arm/mach-sa1100/assabet.c145
-rw-r--r--arch/arm/mach-sa1100/clock.c7
-rw-r--r--arch/arm/mach-sa1100/collie.c35
-rw-r--r--arch/arm/mach-sa1100/h3100.c54
-rw-r--r--arch/arm/mach-sa1100/h3600.c74
-rw-r--r--arch/arm/mach-sa1100/include/mach/assabet.h6
-rw-r--r--arch/arm/mach-sa1100/time.c4
-rw-r--r--arch/arm/mach-shmobile/Kconfig87
-rw-r--r--arch/arm/mach-shmobile/Makefile6
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot5
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c6
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c7
-rw-r--r--arch/arm/mach-shmobile/board-bockw-reference.c32
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c18
-rw-r--r--arch/arm/mach-shmobile/board-genmai-reference.c49
-rw-r--r--arch/arm/mach-shmobile/board-koelsch-reference.c79
-rw-r--r--arch/arm/mach-shmobile/board-koelsch.c190
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d.c92
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c37
-rw-r--r--arch/arm/mach-shmobile/board-lager.c153
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c21
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c27
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c11
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c10
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c9
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c31
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c11
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c76
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c17
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c9
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c23
-rw-r--r--arch/arm/mach-shmobile/include/mach/emev2.h5
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7778.h39
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h7
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7791.h1
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c163
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c82
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c68
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c195
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c166
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c185
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c148
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c188
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c29
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c160
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c207
-rw-r--r--arch/arm/mach-shmobile/sh-gpio.h19
-rw-r--r--arch/arm/mach-sti/platsmp.c3
-rw-r--r--arch/arm/mach-sunxi/Kconfig3
-rw-r--r--arch/arm/mach-sunxi/Makefile1
-rw-r--r--arch/arm/mach-sunxi/common.h19
-rw-r--r--arch/arm/mach-sunxi/headsmp.S9
-rw-r--r--arch/arm/mach-sunxi/platsmp.c124
-rw-r--r--arch/arm/mach-sunxi/sunxi.c14
-rw-r--r--arch/arm/mach-tegra/Kconfig4
-rw-r--r--arch/arm/mach-tegra/board-paz00.c11
-rw-r--r--arch/arm/mach-tegra/fuse.c41
-rw-r--r--arch/arm/mach-tegra/iomap.h14
-rw-r--r--arch/arm/mach-tegra/powergate.c203
-rw-r--r--arch/arm/mach-tegra/reset.c40
-rw-r--r--arch/arm/mach-tegra/tegra.c6
-rw-r--r--arch/arm/mach-u300/regulator.c4
-rw-r--r--arch/arm/mach-u300/timer.c42
-rw-r--r--arch/arm/mach-ux500/Makefile6
-rw-r--r--arch/arm/mach-ux500/board-mop500-audio.c11
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c804
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c14
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.h1
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500.c78
-rw-r--r--arch/arm/mach-ux500/board-mop500.h1
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c26
-rw-r--r--arch/arm/mach-ux500/cpu.c23
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c28
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h19
-rw-r--r--arch/arm/mach-ux500/devices.c26
-rw-r--r--arch/arm/mach-ux500/devices.h15
-rw-r--r--arch/arm/mach-ux500/platsmp.c3
-rw-r--r--arch/arm/mach-ux500/pm.c27
-rw-r--r--arch/arm/mach-ux500/setup.h8
-rw-r--r--arch/arm/mach-ux500/timer.c76
-rw-r--r--arch/arm/mach-versatile/core.c16
-rw-r--r--arch/arm/mach-versatile/versatile_pb.c21
-rw-r--r--arch/arm/mach-zynq/common.c16
-rw-r--r--arch/arm/mach-zynq/common.h2
-rw-r--r--arch/arm/mach-zynq/headsmp.S6
-rw-r--r--arch/arm/mach-zynq/platsmp.c25
-rw-r--r--arch/arm/mm/Makefile1
-rw-r--r--arch/arm/mm/cache-l2x0.c48
-rw-r--r--arch/arm/mm/cache-tauros3.h41
-rw-r--r--arch/arm/mm/cache-v7.S14
-rw-r--r--arch/arm/mm/context.c41
-rw-r--r--arch/arm/mm/dma-mapping.c6
-rw-r--r--arch/arm/mm/dump.c345
-rw-r--r--arch/arm/mm/init.c70
-rw-r--r--arch/arm/mm/ioremap.c4
-rw-r--r--arch/arm/mm/mmu.c126
-rw-r--r--arch/arm/mm/pgd.c2
-rw-r--r--arch/arm/plat-iop/time.c4
-rw-r--r--arch/arm/plat-omap/counter_32k.c4
-rw-r--r--arch/arm/plat-orion/common.c9
-rw-r--r--arch/arm/plat-orion/irq.c47
-rw-r--r--arch/arm/plat-orion/time.c7
-rw-r--r--arch/arm/plat-pxa/dma.c2
-rw-r--r--arch/arm/plat-samsung/Kconfig8
-rw-r--r--arch/arm/plat-samsung/devs.c10
-rw-r--r--arch/arm/plat-samsung/dma-ops.c8
-rw-r--r--arch/arm/plat-samsung/include/plat/fiq.h13
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-ata.h56
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-nand.h123
-rw-r--r--arch/arm/plat-samsung/include/plat/uncompress.h2
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c4
-rw-r--r--arch/arm/plat-samsung/pm.c6
-rw-r--r--arch/arm/plat-samsung/s5p-irq-eint.c4
-rw-r--r--arch/arm/plat-samsung/s5p-irq-pm.c3
-rw-r--r--arch/arm/plat-samsung/setup-camif.c1
-rw-r--r--arch/arm/plat-versatile/platsmp.c3
-rw-r--r--arch/arm/plat-versatile/sched-clock.c4
-rw-r--r--arch/arm/xen/enlighten.c82
-rw-r--r--arch/arm64/Kconfig27
-rw-r--r--arch/arm64/boot/dts/foundation-v8.dts2
-rw-r--r--arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi6
-rw-r--r--arch/arm64/include/asm/Kbuild2
-rw-r--r--arch/arm64/include/asm/cmpxchg.h28
-rw-r--r--arch/arm64/include/asm/cpu_ops.h6
-rw-r--r--arch/arm64/include/asm/cputype.h28
-rw-r--r--arch/arm64/include/asm/debug-monitors.h21
-rw-r--r--arch/arm64/include/asm/dma-contiguous.h28
-rw-r--r--arch/arm64/include/asm/futex.h1
-rw-r--r--arch/arm64/include/asm/hardirq.h2
-rw-r--r--arch/arm64/include/asm/insn.h108
-rw-r--r--arch/arm64/include/asm/jump_label.h52
-rw-r--r--arch/arm64/include/asm/kvm_host.h7
-rw-r--r--arch/arm64/include/asm/kvm_mmu.h1
-rw-r--r--arch/arm64/include/asm/memory.h3
-rw-r--r--arch/arm64/include/asm/percpu.h41
-rw-r--r--arch/arm64/include/asm/pgtable.h93
-rw-r--r--arch/arm64/include/asm/proc-fns.h3
-rw-r--r--arch/arm64/include/asm/smp_plat.h13
-rw-r--r--arch/arm64/include/asm/suspend.h27
-rw-r--r--arch/arm64/include/asm/uaccess.h25
-rw-r--r--arch/arm64/include/asm/word-at-a-time.h94
-rw-r--r--arch/arm64/include/uapi/asm/hwcap.h6
-rw-r--r--arch/arm64/include/uapi/asm/kvm.h21
-rw-r--r--arch/arm64/kernel/Makefile4
-rw-r--r--arch/arm64/kernel/arm64ksyms.c5
-rw-r--r--arch/arm64/kernel/asm-offsets.c11
-rw-r--r--arch/arm64/kernel/debug-monitors.c88
-rw-r--r--arch/arm64/kernel/entry.S4
-rw-r--r--arch/arm64/kernel/fpsimd.c36
-rw-r--r--arch/arm64/kernel/head.S10
-rw-r--r--arch/arm64/kernel/hw_breakpoint.c203
-rw-r--r--arch/arm64/kernel/insn.c304
-rw-r--r--arch/arm64/kernel/jump_label.c58
-rw-r--r--arch/arm64/kernel/module.c157
-rw-r--r--arch/arm64/kernel/perf_event.c108
-rw-r--r--arch/arm64/kernel/process.c20
-rw-r--r--arch/arm64/kernel/setup.c122
-rw-r--r--arch/arm64/kernel/sleep.S184
-rw-r--r--arch/arm64/kernel/smp.c25
-rw-r--r--arch/arm64/kernel/stacktrace.c2
-rw-r--r--arch/arm64/kernel/suspend.c140
-rw-r--r--arch/arm64/kernel/vmlinux.lds.S3
-rw-r--r--arch/arm64/kvm/Kconfig11
-rw-r--r--arch/arm64/kvm/guest.c32
-rw-r--r--arch/arm64/kvm/handle_exit.c5
-rw-r--r--arch/arm64/kvm/sys_regs_generic_v8.c3
-rw-r--r--arch/arm64/lib/Makefile8
-rw-r--r--arch/arm64/lib/strncpy_from_user.S50
-rw-r--r--arch/arm64/lib/strnlen_user.S47
-rw-r--r--arch/arm64/mm/cache.S2
-rw-r--r--arch/arm64/mm/dma-mapping.c35
-rw-r--r--arch/arm64/mm/init.c3
-rw-r--r--arch/arm64/mm/proc-macros.S3
-rw-r--r--arch/arm64/mm/proc.S71
-rw-r--r--arch/avr32/include/asm/Kbuild1
-rw-r--r--arch/avr32/include/uapi/asm/socket.h2
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig1
-rw-r--r--arch/blackfin/configs/BF538-EZKIT_defconfig1
-rw-r--r--arch/blackfin/configs/BF561-ACVILON_defconfig1
-rw-r--r--arch/blackfin/configs/BlackStamp_defconfig1
-rw-r--r--arch/blackfin/configs/CM-BF533_defconfig1
-rw-r--r--arch/blackfin/configs/CM-BF548_defconfig1
-rw-r--r--arch/blackfin/configs/CM-BF561_defconfig1
-rw-r--r--arch/blackfin/configs/DNP5370_defconfig1
-rw-r--r--arch/blackfin/configs/H8606_defconfig1
-rw-r--r--arch/blackfin/configs/IP0X_defconfig1
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig1
-rw-r--r--arch/blackfin/configs/SRV1_defconfig1
-rw-r--r--arch/blackfin/configs/TCM-BF518_defconfig1
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/clkdev.h2
-rw-r--r--arch/blackfin/include/asm/def_LPBlackfin.h1
-rw-r--r--arch/blackfin/include/uapi/asm/byteorder.h5
-rw-r--r--arch/blackfin/include/uapi/asm/cachectl.h6
-rw-r--r--arch/blackfin/include/uapi/asm/fcntl.h6
-rw-r--r--arch/blackfin/include/uapi/asm/ioctls.h6
-rw-r--r--arch/blackfin/include/uapi/asm/poll.h6
-rw-r--r--arch/blackfin/include/uapi/asm/posix_types.h6
-rw-r--r--arch/blackfin/include/uapi/asm/sigcontext.h6
-rw-r--r--arch/blackfin/include/uapi/asm/siginfo.h6
-rw-r--r--arch/blackfin/include/uapi/asm/signal.h6
-rw-r--r--arch/blackfin/include/uapi/asm/stat.h6
-rw-r--r--arch/blackfin/include/uapi/asm/swab.h6
-rw-r--r--arch/blackfin/kernel/setup.c2
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c47
-rw-r--r--arch/blackfin/mach-bf609/Kconfig6
-rw-r--r--arch/blackfin/mach-bf609/boards/ezkit.c6
-rw-r--r--arch/blackfin/mach-bf609/clock.c3
-rw-r--r--arch/blackfin/mach-bf609/include/mach/anomaly.h54
-rw-r--r--arch/blackfin/mach-common/cache-c.c11
-rw-r--r--arch/blackfin/mach-common/clocks-init.c1
-rw-r--r--arch/blackfin/mach-common/ints-priority.c41
-rw-r--r--arch/blackfin/mach-common/scb-init.c1
-rw-r--r--arch/blackfin/mach-common/smp.c6
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/cris/Kconfig6
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c4
-rw-r--r--arch/cris/arch-v10/drivers/sync_serial.c8
-rw-r--r--arch/cris/arch-v10/kernel/Makefile1
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c7
-rw-r--r--arch/cris/arch-v10/kernel/entry.S184
-rw-r--r--arch/cris/arch-v10/kernel/head.S127
-rw-r--r--arch/cris/arch-v10/kernel/irq.c18
-rw-r--r--arch/cris/arch-v10/kernel/process.c4
-rw-r--r--arch/cris/arch-v10/kernel/time.c98
-rw-r--r--arch/cris/arch-v10/lib/dram_init.S40
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c2
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c2
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c4
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c4
-rw-r--r--arch/cris/arch-v32/kernel/entry.S34
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c2
-rw-r--r--arch/cris/arch-v32/kernel/irq.c10
-rw-r--r--arch/cris/arch-v32/kernel/smp.c2
-rw-r--r--arch/cris/arch-v32/kernel/time.c6
-rw-r--r--arch/cris/arch-v32/mach-a3/arbiter.c4
-rw-r--r--arch/cris/arch-v32/mach-fs/arbiter.c2
-rw-r--r--arch/cris/boot/rescue/kimagerescue.S2
-rw-r--r--arch/cris/include/arch-v10/arch/io.h29
-rw-r--r--arch/cris/include/arch-v10/arch/irq.h6
-rw-r--r--arch/cris/include/arch-v32/arch/irq.h6
-rw-r--r--arch/cris/include/asm/Kbuild1
-rw-r--r--arch/cris/include/asm/io.h4
-rw-r--r--arch/cris/include/asm/unistd.h2
-rw-r--r--arch/cris/include/uapi/asm/socket.h2
-rw-r--r--arch/cris/include/uapi/asm/unistd.h16
-rw-r--r--arch/cris/kernel/irq.c3
-rw-r--r--arch/frv/Makefile7
-rw-r--r--arch/frv/include/asm/Kbuild1
-rw-r--r--arch/frv/include/uapi/asm/socket.h2
-rw-r--r--arch/hexagon/include/asm/Kbuild1
-rw-r--r--arch/hexagon/include/asm/fixmap.h40
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/hp/common/aml_nfw.c3
-rw-r--r--arch/ia64/hp/common/sba_iommu.c2
-rw-r--r--arch/ia64/include/asm/Kbuild3
-rw-r--r--arch/ia64/include/asm/dmi.h8
-rw-r--r--arch/ia64/include/asm/processor.h1
-rw-r--r--arch/ia64/include/uapi/asm/socket.h2
-rw-r--r--arch/ia64/kernel/acpi.c1
-rw-r--r--arch/ia64/kvm/kvm-ia64.c2
-rw-r--r--arch/ia64/mm/contig.c68
-rw-r--r--arch/ia64/mm/discontig.c63
-rw-r--r--arch/ia64/mm/init.c48
-rw-r--r--arch/ia64/sn/pci/pci_dma.c24
-rw-r--r--arch/m32r/Kconfig8
-rw-r--r--arch/m32r/include/asm/Kbuild1
-rw-r--r--arch/m32r/include/uapi/asm/socket.h2
-rw-r--r--arch/m68k/emu/nfblock.c13
-rw-r--r--arch/m68k/include/asm/Kbuild1
-rw-r--r--arch/metag/include/asm/Kbuild1
-rw-r--r--arch/metag/include/asm/fixmap.h32
-rw-r--r--arch/metag/mm/init.c3
-rw-r--r--arch/metag/mm/numa.c3
-rw-r--r--arch/microblaze/Kconfig3
-rw-r--r--arch/microblaze/Makefile2
-rw-r--r--arch/microblaze/include/asm/Kbuild1
-rw-r--r--arch/microblaze/include/asm/cpuinfo.h9
-rw-r--r--arch/microblaze/include/asm/fixmap.h44
-rw-r--r--arch/microblaze/include/asm/io.h8
-rw-r--r--arch/microblaze/include/asm/sections.h1
-rw-r--r--arch/microblaze/include/uapi/asm/Kbuild3
-rw-r--r--arch/microblaze/include/uapi/asm/types.h1
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c3
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-static.c2
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo.c24
-rw-r--r--arch/microblaze/kernel/head.S4
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S49
-rw-r--r--arch/microblaze/kernel/setup.c10
-rw-r--r--arch/microblaze/kernel/timer.c51
-rw-r--r--arch/microblaze/kernel/vmlinux.lds.S1
-rw-r--r--arch/microblaze/mm/init.c3
-rw-r--r--arch/microblaze/platform/generic/system.dts1
-rw-r--r--arch/mips/Kconfig232
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/alchemy/common/power.c1
-rw-r--r--arch/mips/ar7/time.c1
-rw-r--r--arch/mips/ath79/common.h1
-rw-r--r--arch/mips/bcm47xx/Kconfig4
-rw-r--r--arch/mips/bcm47xx/Makefile3
-rw-r--r--arch/mips/bcm47xx/bcm47xx_private.h12
-rw-r--r--arch/mips/bcm47xx/board.c34
-rw-r--r--arch/mips/bcm47xx/buttons.c531
-rw-r--r--arch/mips/bcm47xx/irq.c25
-rw-r--r--arch/mips/bcm47xx/leds.c542
-rw-r--r--arch/mips/bcm47xx/nvram.c3
-rw-r--r--arch/mips/bcm47xx/prom.c127
-rw-r--r--arch/mips/bcm47xx/serial.c6
-rw-r--r--arch/mips/bcm47xx/setup.c45
-rw-r--r--arch/mips/bcm47xx/sprom.c18
-rw-r--r--arch/mips/bcm47xx/wgt634u.c174
-rw-r--r--arch/mips/bcm63xx/Kconfig8
-rw-r--r--arch/mips/bcm63xx/Makefile4
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c3
-rw-r--r--arch/mips/bcm63xx/clk.c42
-rw-r--r--arch/mips/bcm63xx/cpu.c6
-rw-r--r--arch/mips/bcm63xx/dev-hsspi.c47
-rw-r--r--arch/mips/bcm63xx/early_printk.c3
-rw-r--r--arch/mips/bcm63xx/prom.c14
-rw-r--r--arch/mips/boot/compressed/Makefile4
-rw-r--r--arch/mips/boot/compressed/dbg.c1
-rw-r--r--arch/mips/boot/compressed/decompress.c22
-rw-r--r--arch/mips/boot/compressed/string.c28
-rw-r--r--arch/mips/boot/compressed/uart-16550.c5
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c1
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-board.c27
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-util.c4
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper.c10
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-pko.c3
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-spi.c1
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c38
-rw-r--r--arch/mips/cavium-octeon/octeon_3xxx.dts19
-rw-r--r--arch/mips/cavium-octeon/smp.c1
-rw-r--r--arch/mips/configs/ar7_defconfig1
-rw-r--r--arch/mips/configs/bcm47xx_defconfig623
-rw-r--r--arch/mips/configs/bcm63xx_defconfig1
-rw-r--r--arch/mips/configs/cobalt_defconfig1
-rw-r--r--arch/mips/configs/gpr_defconfig1
-rw-r--r--arch/mips/configs/jmr3927_defconfig1
-rw-r--r--arch/mips/configs/lasat_defconfig1
-rw-r--r--arch/mips/configs/maltasmvp_defconfig3
-rw-r--r--arch/mips/configs/markeins_defconfig1
-rw-r--r--arch/mips/configs/mtx1_defconfig1
-rw-r--r--arch/mips/configs/pnx8335_stb225_defconfig1
-rw-r--r--arch/mips/configs/qi_lb60_defconfig188
-rw-r--r--arch/mips/configs/rb532_defconfig1
-rw-r--r--arch/mips/configs/rbtx49xx_defconfig1
-rw-r--r--arch/mips/fw/arc/file.c1
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/amon.h15
-rw-r--r--arch/mips/include/asm/asmmacro-32.h42
-rw-r--r--arch/mips/include/asm/asmmacro-64.h96
-rw-r--r--arch/mips/include/asm/asmmacro.h107
-rw-r--r--arch/mips/include/asm/bmips.h29
-rw-r--r--arch/mips/include/asm/clkdev.h2
-rw-r--r--arch/mips/include/asm/cpu-features.h7
-rw-r--r--arch/mips/include/asm/cpu-info.h3
-rw-r--r--arch/mips/include/asm/cpu-type.h15
-rw-r--r--arch/mips/include/asm/cpu.h12
-rw-r--r--arch/mips/include/asm/dma-coherence.h9
-rw-r--r--arch/mips/include/asm/elf.h31
-rw-r--r--arch/mips/include/asm/fixmap.h33
-rw-r--r--arch/mips/include/asm/fpu.h104
-rw-r--r--arch/mips/include/asm/highmem.h1
-rw-r--r--arch/mips/include/asm/kvm_host.h7
-rw-r--r--arch/mips/include/asm/mach-ath79/ar71xx_regs.h1
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx.h2
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h1
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h82
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h18
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h8
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h120
-rw-r--r--arch/mips/include/asm/mach-generic/dma-coherence.h4
-rw-r--r--arch/mips/include/asm/mach-generic/floppy.h1
-rw-r--r--arch/mips/include/asm/mach-generic/ide.h6
-rw-r--r--arch/mips/include/asm/mach-jazz/floppy.h1
-rw-r--r--arch/mips/include/asm/mach-jz4740/platform.h1
-rw-r--r--arch/mips/include/asm/mach-netlogic/irq.h3
-rw-r--r--arch/mips/include/asm/mach-netlogic/multi-node.h33
-rw-r--r--arch/mips/include/asm/mach-netlogic/topology.h20
-rw-r--r--arch/mips/include/asm/mips-boards/piix4.h7
-rw-r--r--arch/mips/include/asm/mipsregs.h85
-rw-r--r--arch/mips/include/asm/netlogic/common.h24
-rw-r--r--arch/mips/include/asm/netlogic/mips-extns.h7
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/bridge.h69
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/iomap.h48
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/pcibus.h41
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/pic.h77
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/sys.h18
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/uart.h3
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h38
-rw-r--r--arch/mips/include/asm/netlogic/xlr/xlr.h5
-rw-r--r--arch/mips/include/asm/octeon/cvmx-helper-board.h9
-rw-r--r--arch/mips/include/asm/page.h25
-rw-r--r--arch/mips/include/asm/rtlx.h49
-rw-r--r--arch/mips/include/asm/switch_to.h16
-rw-r--r--arch/mips/include/asm/syscall.h2
-rw-r--r--arch/mips/include/asm/thread_info.h4
-rw-r--r--arch/mips/include/asm/tlb.h4
-rw-r--r--arch/mips/include/asm/vpe.h133
-rw-r--r--arch/mips/include/uapi/asm/inst.h7
-rw-r--r--arch/mips/include/uapi/asm/socket.h2
-rw-r--r--arch/mips/jz4740/board-qi_lb60.c1
-rw-r--r--arch/mips/jz4740/platform.c41
-rw-r--r--arch/mips/kernel/Makefile5
-rw-r--r--arch/mips/kernel/binfmt_elfo32.c14
-rw-r--r--arch/mips/kernel/bmips_vec.S56
-rw-r--r--arch/mips/kernel/cpu-probe.c103
-rw-r--r--arch/mips/kernel/crash.c1
-rw-r--r--arch/mips/kernel/genex.S1
-rw-r--r--arch/mips/kernel/idle.c2
-rw-r--r--arch/mips/kernel/proc.c48
-rw-r--r--arch/mips/kernel/process.c6
-rw-r--r--arch/mips/kernel/ptrace.c60
-rw-r--r--arch/mips/kernel/ptrace32.c53
-rw-r--r--arch/mips/kernel/r4k_fpu.S74
-rw-r--r--arch/mips/kernel/r4k_switch.S45
-rw-r--r--arch/mips/kernel/rtlx-cmp.c116
-rw-r--r--arch/mips/kernel/rtlx-mt.c148
-rw-r--r--arch/mips/kernel/rtlx.c273
-rw-r--r--arch/mips/kernel/segment.c110
-rw-r--r--arch/mips/kernel/signal.c10
-rw-r--r--arch/mips/kernel/signal32.c10
-rw-r--r--arch/mips/kernel/smp-bmips.c312
-rw-r--r--arch/mips/kernel/smp-cmp.c3
-rw-r--r--arch/mips/kernel/smp-mt.c28
-rw-r--r--arch/mips/kernel/spram.c3
-rw-r--r--arch/mips/kernel/sync-r4k.c1
-rw-r--r--arch/mips/kernel/traps.c71
-rw-r--r--arch/mips/kernel/vpe-cmp.c180
-rw-r--r--arch/mips/kernel/vpe-mt.c523
-rw-r--r--arch/mips/kernel/vpe.c910
-rw-r--r--arch/mips/kvm/kvm_mips.c1
-rw-r--r--arch/mips/kvm/kvm_tlb.c135
-rw-r--r--arch/mips/lantiq/xway/clk.c1
-rw-r--r--arch/mips/lantiq/xway/dma.c4
-rw-r--r--arch/mips/lasat/at93c.c1
-rw-r--r--arch/mips/lasat/picvue.c1
-rw-r--r--arch/mips/lib/uncached.c1
-rw-r--r--arch/mips/loongson/lemote-2f/clock.c1
-rw-r--r--arch/mips/math-emu/cp1emu.c42
-rw-r--r--arch/mips/math-emu/kernel_linkage.c6
-rw-r--r--arch/mips/mm/c-octeon.c1
-rw-r--r--arch/mips/mm/c-r3k.c1
-rw-r--r--arch/mips/mm/c-r4k.c26
-rw-r--r--arch/mips/mm/cache.c1
-rw-r--r--arch/mips/mm/cex-sb1.S1
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/mm/hugetlbpage.c1
-rw-r--r--arch/mips/mm/init.c2
-rw-r--r--arch/mips/mm/page.c1
-rw-r--r--arch/mips/mm/sc-mips.c2
-rw-r--r--arch/mips/mm/sc-rm7k.c1
-rw-r--r--arch/mips/mm/tlb-r3k.c1
-rw-r--r--arch/mips/mm/tlb-r4k.c48
-rw-r--r--arch/mips/mm/tlb-r8k.c1
-rw-r--r--arch/mips/mm/tlbex.c2
-rw-r--r--arch/mips/mm/uasm-micromips.c1
-rw-r--r--arch/mips/mm/uasm-mips.c1
-rw-r--r--arch/mips/mti-malta/Makefile2
-rw-r--r--arch/mips/mti-malta/malta-amon.c49
-rw-r--r--arch/mips/mti-malta/malta-console.c47
-rw-r--r--arch/mips/mti-malta/malta-init.c58
-rw-r--r--arch/mips/mti-malta/malta-int.c127
-rw-r--r--arch/mips/mti-malta/malta-platform.c2
-rw-r--r--arch/mips/mti-malta/malta-time.c16
-rw-r--r--arch/mips/mti-sead3/Makefile2
-rw-r--r--arch/mips/mti-sead3/sead3-pic32-bus.c1
-rw-r--r--arch/mips/mti-sead3/sead3-setup.c84
-rw-r--r--arch/mips/mti-sead3/sead3-time.c4
-rw-r--r--arch/mips/mti-sead3/sead3.dts4
-rw-r--r--arch/mips/netlogic/Kconfig9
-rw-r--r--arch/mips/netlogic/common/earlycons.c2
-rw-r--r--arch/mips/netlogic/common/irq.c72
-rw-r--r--arch/mips/netlogic/common/reset.S63
-rw-r--r--arch/mips/netlogic/common/smp.c8
-rw-r--r--arch/mips/netlogic/common/smpboot.S4
-rw-r--r--arch/mips/netlogic/dts/Makefile1
-rw-r--r--arch/mips/netlogic/dts/xlp_gvp.dts76
-rw-r--r--arch/mips/netlogic/xlp/dt.c7
-rw-r--r--arch/mips/netlogic/xlp/nlm_hal.c71
-rw-r--r--arch/mips/netlogic/xlp/setup.c25
-rw-r--r--arch/mips/netlogic/xlp/usb-init-xlp2.c88
-rw-r--r--arch/mips/netlogic/xlp/wakeup.c92
-rw-r--r--arch/mips/netlogic/xlr/platform.c4
-rw-r--r--arch/mips/netlogic/xlr/setup.c20
-rw-r--r--arch/mips/netlogic/xlr/wakeup.c3
-rw-r--r--arch/mips/oprofile/common.c2
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c8
-rw-r--r--arch/mips/pci/Makefile1
-rw-r--r--arch/mips/pci/fixup-malta.c11
-rw-r--r--arch/mips/pci/fixup-rc32434.c1
-rw-r--r--arch/mips/pci/fixup-sb1250.c1
-rw-r--r--arch/mips/pci/msi-xlp.c494
-rw-r--r--arch/mips/pci/ops-bcm63xx.c1
-rw-r--r--arch/mips/pci/ops-bonito64.c1
-rw-r--r--arch/mips/pci/ops-lantiq.c1
-rw-r--r--arch/mips/pci/ops-loongson2.c1
-rw-r--r--arch/mips/pci/ops-mace.c1
-rw-r--r--arch/mips/pci/ops-msc.c1
-rw-r--r--arch/mips/pci/ops-nile4.c1
-rw-r--r--arch/mips/pci/ops-rc32434.c1
-rw-r--r--arch/mips/pci/pci-ip27.c1
-rw-r--r--arch/mips/pci/pci-malta.c6
-rw-r--r--arch/mips/pci/pci-rt3883.c3
-rw-r--r--arch/mips/pci/pci-xlp.c110
-rw-r--r--arch/mips/pmcs-msp71xx/Kconfig1
-rw-r--r--arch/mips/ralink/Kconfig1
-rw-r--r--arch/mips/ralink/cevt-rt3352.c2
-rw-r--r--arch/mips/ralink/timer.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-console.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-irq-pci.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-klconfig.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-xtalk.c1
-rw-r--r--arch/mn10300/Kconfig8
-rw-r--r--arch/mn10300/Makefile8
-rw-r--r--arch/mn10300/include/asm/Kbuild1
-rw-r--r--arch/mn10300/include/uapi/asm/socket.h2
-rw-r--r--arch/openrisc/include/asm/Kbuild1
-rw-r--r--arch/openrisc/kernel/entry.S59
-rw-r--r--arch/openrisc/kernel/signal.c233
-rw-r--r--arch/parisc/Kconfig8
-rw-r--r--arch/parisc/include/asm/Kbuild1
-rw-r--r--arch/parisc/include/asm/cacheflush.h2
-rw-r--r--arch/parisc/include/asm/elf.h4
-rw-r--r--arch/parisc/include/asm/page.h3
-rw-r--r--arch/parisc/include/asm/pgtable.h1
-rw-r--r--arch/parisc/include/asm/processor.h2
-rw-r--r--arch/parisc/include/asm/thread_info.h10
-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/include/uapi/asm/stat.h40
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h4
-rw-r--r--arch/parisc/kernel/cache.c14
-rw-r--r--arch/parisc/kernel/drivers.c22
-rw-r--r--arch/parisc/kernel/process.c21
-rw-r--r--arch/parisc/kernel/sys_parisc.c238
-rw-r--r--arch/parisc/kernel/syscall_table.S2
-rw-r--r--arch/parisc/mm/init.c59
-rw-r--r--arch/powerpc/Kconfig28
-rw-r--r--arch/powerpc/boot/.gitignore1
-rw-r--r--arch/powerpc/boot/Makefile7
-rw-r--r--arch/powerpc/boot/dts/ac14xx.dts7
-rw-r--r--arch/powerpc/boot/dts/adder875-redboot.dts2
-rw-r--r--arch/powerpc/boot/dts/adder875-uboot.dts2
-rw-r--r--arch/powerpc/boot/dts/asp834x-redboot.dts2
-rw-r--r--arch/powerpc/boot/dts/c2k.dts5
-rw-r--r--arch/powerpc/boot/dts/ep8248e.dts3
-rw-r--r--arch/powerpc/boot/dts/ep88xc.dts2
-rw-r--r--arch/powerpc/boot/dts/fsl/elo3-dma-2.dtsi82
-rw-r--r--arch/powerpc/boot/dts/fsl/p1020si-post.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1021si-post.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1022si-post.dtsi3
-rw-r--r--arch/powerpc/boot/dts/fsl/p1023si-post.dtsi3
-rw-r--r--arch/powerpc/boot/dts/gef_ppc9a.dts2
-rw-r--r--arch/powerpc/boot/dts/gef_sbc310.dts2
-rw-r--r--arch/powerpc/boot/dts/gef_sbc610.dts2
-rw-r--r--arch/powerpc/boot/dts/holly.dts1
-rw-r--r--arch/powerpc/boot/dts/kilauea.dts2
-rw-r--r--arch/powerpc/boot/dts/ksi8560.dts3
-rw-r--r--arch/powerpc/boot/dts/mpc5121.dtsi113
-rw-r--r--arch/powerpc/boot/dts/mpc5125twr.dts53
-rw-r--r--arch/powerpc/boot/dts/mpc7448hpc2.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8272ads.dts3
-rw-r--r--arch/powerpc/boot/dts/mpc8308_p1m.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8308rdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8313erdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc832x_rdb.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitxgp.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc836x_rdk.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8377_rdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8377_wlan.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8378_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8378_rdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8379_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8379_rdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dtsi2
-rw-r--r--arch/powerpc/boot/dts/mpc8540ads.dts3
-rw-r--r--arch/powerpc/boot/dts/mpc8541cds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dtsi2
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds.dtsi4
-rw-r--r--arch/powerpc/boot/dts/mpc8555cds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8569mds.dts6
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc866ads.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc885ads.dts3
-rw-r--r--arch/powerpc/boot/dts/mvme5100.dts185
-rw-r--r--arch/powerpc/boot/dts/p1010rdb-pa.dts23
-rw-r--r--arch/powerpc/boot/dts/p1010rdb-pa.dtsi85
-rw-r--r--arch/powerpc/boot/dts/p1010rdb-pa_36b.dts (renamed from arch/powerpc/boot/dts/p1010rdb_36b.dts)47
-rw-r--r--arch/powerpc/boot/dts/p1010rdb-pb.dts35
-rw-r--r--arch/powerpc/boot/dts/p1010rdb-pb_36b.dts58
-rw-r--r--arch/powerpc/boot/dts/p1010rdb.dts66
-rw-r--r--arch/powerpc/boot/dts/p1010rdb.dtsi43
-rw-r--r--arch/powerpc/boot/dts/p1010rdb_32b.dtsi79
-rw-r--r--arch/powerpc/boot/dts/p1010rdb_36b.dtsi79
-rw-r--r--arch/powerpc/boot/dts/p1021mds.dts2
-rw-r--r--arch/powerpc/boot/dts/p1022ds.dtsi3
-rw-r--r--arch/powerpc/boot/dts/p1025rdb_32b.dts2
-rw-r--r--arch/powerpc/boot/dts/p1025twr.dts95
-rw-r--r--arch/powerpc/boot/dts/p1025twr.dtsi280
-rw-r--r--arch/powerpc/boot/dts/ppa8548.dts2
-rw-r--r--arch/powerpc/boot/dts/pq2fads.dts3
-rw-r--r--arch/powerpc/boot/dts/prpmc2800.dts5
-rw-r--r--arch/powerpc/boot/dts/sbc8349.dts2
-rw-r--r--arch/powerpc/boot/dts/sbc8548-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/sbc8641d.dts4
-rw-r--r--arch/powerpc/boot/dts/stx_gp3_8560.dts2
-rw-r--r--arch/powerpc/boot/dts/stxssa8555.dts2
-rw-r--r--arch/powerpc/boot/dts/tqm8540.dts3
-rw-r--r--arch/powerpc/boot/dts/tqm8541.dts3
-rw-r--r--arch/powerpc/boot/dts/tqm8548-bigflash.dts5
-rw-r--r--arch/powerpc/boot/dts/tqm8548.dts5
-rw-r--r--arch/powerpc/boot/dts/tqm8555.dts3
-rw-r--r--arch/powerpc/boot/dts/tqm8560.dts3
-rw-r--r--arch/powerpc/boot/dts/tqm8xx.dts1
-rw-r--r--arch/powerpc/boot/dts/virtex440-ml507.dts2
-rw-r--r--arch/powerpc/boot/mvme5100.c27
-rwxr-xr-xarch/powerpc/boot/wrapper4
-rw-r--r--arch/powerpc/configs/85xx/p1023_defconfig188
-rw-r--r--arch/powerpc/configs/adder875_defconfig1
-rw-r--r--arch/powerpc/configs/ep88xc_defconfig1
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig3
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig3
-rw-r--r--arch/powerpc/configs/mpc866_ads_defconfig1
-rw-r--r--arch/powerpc/configs/mpc885_ads_defconfig1
-rw-r--r--arch/powerpc/configs/mvme5100_defconfig144
-rw-r--r--arch/powerpc/configs/ppc64_defconfig1
-rw-r--r--arch/powerpc/configs/tqm8xx_defconfig1
-rw-r--r--arch/powerpc/include/asm/Kbuild3
-rw-r--r--arch/powerpc/include/asm/bitops.h5
-rw-r--r--arch/powerpc/include/asm/cache.h14
-rw-r--r--arch/powerpc/include/asm/clk_interface.h20
-rw-r--r--arch/powerpc/include/asm/cmpxchg.h1
-rw-r--r--arch/powerpc/include/asm/code-patching.h7
-rw-r--r--arch/powerpc/include/asm/cputable.h12
-rw-r--r--arch/powerpc/include/asm/eeh.h14
-rw-r--r--arch/powerpc/include/asm/epapr_hcalls.h111
-rw-r--r--arch/powerpc/include/asm/exception-64s.h21
-rw-r--r--arch/powerpc/include/asm/fixmap.h44
-rw-r--r--arch/powerpc/include/asm/fsl_lbc.h2
-rw-r--r--arch/powerpc/include/asm/hardirq.h3
-rw-r--r--arch/powerpc/include/asm/io.h16
-rw-r--r--arch/powerpc/include/asm/iommu.h54
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h4
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h27
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h1
-rw-r--r--arch/powerpc/include/asm/kvm_booke.h6
-rw-r--r--arch/powerpc/include/asm/kvm_host.h61
-rw-r--r--arch/powerpc/include/asm/kvm_para.h80
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h13
-rw-r--r--arch/powerpc/include/asm/lppaca.h2
-rw-r--r--arch/powerpc/include/asm/mce.h197
-rw-r--r--arch/powerpc/include/asm/mmu-book3e.h13
-rw-r--r--arch/powerpc/include/asm/mmu.h21
-rw-r--r--arch/powerpc/include/asm/mpc5121.h7
-rw-r--r--arch/powerpc/include/asm/opal.h108
-rw-r--r--arch/powerpc/include/asm/paca.h16
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h14
-rw-r--r--arch/powerpc/include/asm/pgtable.h87
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h14
-rw-r--r--arch/powerpc/include/asm/processor.h15
-rw-r--r--arch/powerpc/include/asm/ps3.h1
-rw-r--r--arch/powerpc/include/asm/pte-hash64.h8
-rw-r--r--arch/powerpc/include/asm/reg.h45
-rw-r--r--arch/powerpc/include/asm/reg_booke.h10
-rw-r--r--arch/powerpc/include/asm/spinlock.h12
-rw-r--r--arch/powerpc/include/asm/switch_to.h2
-rw-r--r--arch/powerpc/include/asm/systbl.h2
-rw-r--r--arch/powerpc/include/asm/thread_info.h9
-rw-r--r--arch/powerpc/include/asm/tm.h1
-rw-r--r--arch/powerpc/include/asm/topology.h10
-rw-r--r--arch/powerpc/include/asm/unistd.h2
-rw-r--r--arch/powerpc/include/asm/vio.h1
-rw-r--r--arch/powerpc/include/uapi/asm/kvm.h3
-rw-r--r--arch/powerpc/include/uapi/asm/socket.h2
-rw-r--r--arch/powerpc/include/uapi/asm/tm.h2
-rw-r--r--arch/powerpc/include/uapi/asm/unistd.h3
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/asm-offsets.c63
-rw-r--r--arch/powerpc/kernel/cacheinfo.c4
-rw-r--r--arch/powerpc/kernel/clock.c82
-rw-r--r--arch/powerpc/kernel/cpu_setup_fsl_booke.S54
-rw-r--r--arch/powerpc/kernel/cpu_setup_power.S38
-rw-r--r--arch/powerpc/kernel/cputable.c16
-rw-r--r--arch/powerpc/kernel/crash.c1
-rw-r--r--arch/powerpc/kernel/dma-iommu.c4
-rw-r--r--arch/powerpc/kernel/eeh.c17
-rw-r--r--arch/powerpc/kernel/eeh_driver.c181
-rw-r--r--arch/powerpc/kernel/eeh_pe.c4
-rw-r--r--arch/powerpc/kernel/entry_64.S12
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S27
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S242
-rw-r--r--arch/powerpc/kernel/fpu.S16
-rw-r--r--arch/powerpc/kernel/fsl_booke_entry_mapping.S2
-rw-r--r--arch/powerpc/kernel/head_64.S1
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S266
-rw-r--r--arch/powerpc/kernel/hw_breakpoint.c1
-rw-r--r--arch/powerpc/kernel/idle_power7.S1
-rw-r--r--arch/powerpc/kernel/iomap.c1
-rw-r--r--arch/powerpc/kernel/iommu.c145
-rw-r--r--arch/powerpc/kernel/irq.c12
-rw-r--r--arch/powerpc/kernel/kgdb.c1
-rw-r--r--arch/powerpc/kernel/kvm.c41
-rw-r--r--arch/powerpc/kernel/mce.c352
-rw-r--r--arch/powerpc/kernel/mce_power.c284
-rw-r--r--arch/powerpc/kernel/misc_32.S4
-rw-r--r--arch/powerpc/kernel/misc_64.S6
-rw-r--r--arch/powerpc/kernel/paca.c37
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c4
-rw-r--r--arch/powerpc/kernel/process.c179
-rw-r--r--arch/powerpc/kernel/prom.c41
-rw-r--r--arch/powerpc/kernel/setup_64.c47
-rw-r--r--arch/powerpc/kernel/signal.c3
-rw-r--r--arch/powerpc/kernel/signal_32.c40
-rw-r--r--arch/powerpc/kernel/signal_64.c14
-rw-r--r--arch/powerpc/kernel/smp-tbsync.c1
-rw-r--r--arch/powerpc/kernel/smp.c9
-rw-r--r--arch/powerpc/kernel/swsusp_booke.S32
-rw-r--r--arch/powerpc/kernel/syscalls.c1
-rw-r--r--arch/powerpc/kernel/sysfs.c390
-rw-r--r--arch/powerpc/kernel/time.c14
-rw-r--r--arch/powerpc/kernel/traps.c72
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32_wrapper.S1
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64_wrapper.S1
-rw-r--r--arch/powerpc/kernel/vector.S10
-rw-r--r--arch/powerpc/kernel/vio.c31
-rw-r--r--arch/powerpc/kvm/44x.c4
-rw-r--r--arch/powerpc/kvm/book3s.c46
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c5
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c4
-rw-r--r--arch/powerpc/kvm/book3s_exports.c4
-rw-r--r--arch/powerpc/kvm/book3s_hv.c321
-rw-r--r--arch/powerpc/kvm/book3s_hv_interrupts.S8
-rw-r--r--arch/powerpc/kvm/book3s_hv_ras.c50
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c8
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S1191
-rw-r--r--arch/powerpc/kvm/book3s_paired_singles.c169
-rw-r--r--arch/powerpc/kvm/book3s_pr.c155
-rw-r--r--arch/powerpc/kvm/book3s_rmhandlers.S47
-rw-r--r--arch/powerpc/kvm/book3s_segment.S2
-rw-r--r--arch/powerpc/kvm/book3s_xics.c4
-rw-r--r--arch/powerpc/kvm/booke.c44
-rw-r--r--arch/powerpc/kvm/booke.h5
-rw-r--r--arch/powerpc/kvm/bookehv_interrupts.S13
-rw-r--r--arch/powerpc/kvm/e500.c4
-rw-r--r--arch/powerpc/kvm/e500.h8
-rw-r--r--arch/powerpc/kvm/e500_mmu.c2
-rw-r--r--arch/powerpc/kvm/e500_mmu_host.c59
-rw-r--r--arch/powerpc/kvm/e500mc.c4
-rw-r--r--arch/powerpc/kvm/emulate.c1
-rw-r--r--arch/powerpc/kvm/mpic.c1
-rw-r--r--arch/powerpc/kvm/powerpc.c58
-rw-r--r--arch/powerpc/lib/code-patching.c15
-rw-r--r--arch/powerpc/lib/crtsavres.S186
-rw-r--r--arch/powerpc/math-emu/math_efp.c316
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c80
-rw-r--r--arch/powerpc/mm/hash_low_64.S15
-rw-r--r--arch/powerpc/mm/hash_utils_64.c7
-rw-r--r--arch/powerpc/mm/hugepage-hash64.c6
-rw-r--r--arch/powerpc/mm/hugetlbpage-book3e.c54
-rw-r--r--arch/powerpc/mm/hugetlbpage-hash64.c4
-rw-r--r--arch/powerpc/mm/hugetlbpage.c4
-rw-r--r--arch/powerpc/mm/mem.c10
-rw-r--r--arch/powerpc/mm/mmu_decl.h2
-rw-r--r--arch/powerpc/mm/numa.c106
-rw-r--r--arch/powerpc/mm/pgtable.c3
-rw-r--r--arch/powerpc/mm/pgtable_32.c1
-rw-r--r--arch/powerpc/mm/pgtable_64.c15
-rw-r--r--arch/powerpc/mm/slice.c2
-rw-r--r--arch/powerpc/mm/tlb_hash64.c1
-rw-r--r--arch/powerpc/mm/tlb_low_64e.S175
-rw-r--r--arch/powerpc/mm/tlb_nohash.c114
-rw-r--r--arch/powerpc/mm/tlb_nohash_low.S4
-rw-r--r--arch/powerpc/oprofile/op_model_7450.c1
-rw-r--r--arch/powerpc/oprofile/op_model_cell.c1
-rw-r--r--arch/powerpc/oprofile/op_model_fsl_emb.c1
-rw-r--r--arch/powerpc/oprofile/op_model_pa6t.c1
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c1
-rw-r--r--arch/powerpc/oprofile/op_model_rs64.c1
-rw-r--r--arch/powerpc/platforms/512x/Kconfig2
-rw-r--r--arch/powerpc/platforms/512x/Makefile3
-rw-r--r--arch/powerpc/platforms/512x/clock-commonclk.c1221
-rw-r--r--arch/powerpc/platforms/512x/clock.c754
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c169
-rw-r--r--arch/powerpc/platforms/52xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c2
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c1
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c1
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig6
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/common.c38
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx.h6
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c29
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c25
-rw-r--r--arch/powerpc/platforms/85xx/sgy_cts1000.c1
-rw-r--r--arch/powerpc/platforms/85xx/smp.c17
-rw-r--r--arch/powerpc/platforms/85xx/twr_p102x.c147
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype1
-rw-r--r--arch/powerpc/platforms/cell/beat_htab.c4
-rw-r--r--arch/powerpc/platforms/cell/iommu.c14
-rw-r--r--arch/powerpc/platforms/chrp/smp.c1
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig13
-rw-r--r--arch/powerpc/platforms/embedded6xx/Makefile1
-rw-r--r--arch/powerpc/platforms/embedded6xx/hlwd-pic.c1
-rw-r--r--arch/powerpc/platforms/embedded6xx/mvme5100.c221
-rw-r--r--arch/powerpc/platforms/pasemi/dma_lib.c1
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c5
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_core.c1
-rw-r--r--arch/powerpc/platforms/powernv/Kconfig5
-rw-r--r--arch/powerpc/platforms/powernv/Makefile1
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c223
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c24
-rw-r--r--arch/powerpc/platforms/powernv/opal-flash.c39
-rw-r--r--arch/powerpc/platforms/powernv/opal-memory-errors.c146
-rw-r--r--arch/powerpc/platforms/powernv/opal-rtc.c6
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S3
-rw-r--r--arch/powerpc/platforms/powernv/opal.c267
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c11
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c2
-rw-r--r--arch/powerpc/platforms/powernv/pci.c230
-rw-r--r--arch/powerpc/platforms/powernv/pci.h3
-rw-r--r--arch/powerpc/platforms/powernv/setup.c19
-rw-r--r--arch/powerpc/platforms/ps3/spu.c2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig11
-rw-r--r--arch/powerpc/platforms/pseries/Makefile1
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c1
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c1
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c4
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c167
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c5
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c364
-rw-r--r--arch/powerpc/platforms/pseries/setup.c4
-rw-r--r--arch/powerpc/platforms/wsp/wsp_pci.c11
-rw-r--r--arch/powerpc/sysdev/Kconfig2
-rw-r--r--arch/powerpc/sysdev/axonram.c21
-rw-r--r--arch/powerpc/sysdev/cpm2_pic.c1
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c1
-rw-r--r--arch/powerpc/sysdev/fsl_ifc.c1
-rw-r--r--arch/powerpc/sysdev/fsl_lbc.c31
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c5
-rw-r--r--arch/powerpc/sysdev/ge/ge_pic.h1
-rw-r--r--arch/powerpc/sysdev/i8259.c1
-rw-r--r--arch/powerpc/sysdev/indirect_pci.c6
-rw-r--r--arch/powerpc/sysdev/mpc8xx_pic.c1
-rw-r--r--arch/powerpc/sysdev/mpic_timer.c10
-rw-r--r--arch/powerpc/sysdev/mv64x60_dev.c2
-rw-r--r--arch/powerpc/sysdev/mv64x60_udbg.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_io.c1
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc.c1
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_fast.c1
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_slow.c1
-rw-r--r--arch/powerpc/sysdev/udbg_memcons.c1
-rw-r--r--arch/powerpc/sysdev/xics/icp-hv.c1
-rw-r--r--arch/powerpc/xmon/xmon.c4
-rw-r--r--arch/s390/Kconfig6
-rw-r--r--arch/s390/crypto/des_s390.c6
-rw-r--r--arch/s390/hypfs/Makefile2
-rw-r--r--arch/s390/hypfs/hypfs.h7
-rw-r--r--arch/s390/hypfs/hypfs_dbfs.c16
-rw-r--r--arch/s390/hypfs/hypfs_sprp.c141
-rw-r--r--arch/s390/hypfs/inode.c15
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/cmpxchg.h5
-rw-r--r--arch/s390/include/asm/kvm_host.h15
-rw-r--r--arch/s390/include/asm/sclp.h1
-rw-r--r--arch/s390/include/asm/sigp.h2
-rw-r--r--arch/s390/include/uapi/asm/hypfs.h25
-rw-r--r--arch/s390/include/uapi/asm/socket.h2
-rw-r--r--arch/s390/include/uapi/asm/statfs.h10
-rw-r--r--arch/s390/include/uapi/asm/unistd.h2
-rw-r--r--arch/s390/kernel/compat_linux.c4
-rw-r--r--arch/s390/kernel/compat_wrapper.S11
-rw-r--r--arch/s390/kernel/syscalls.S2
-rw-r--r--arch/s390/kvm/diag.c4
-rw-r--r--arch/s390/kvm/intercept.c11
-rw-r--r--arch/s390/kvm/kvm-s390.c72
-rw-r--r--arch/s390/kvm/kvm-s390.h16
-rw-r--r--arch/s390/kvm/priv.c4
-rw-r--r--arch/s390/kvm/sigp.c120
-rw-r--r--arch/s390/kvm/trace.h1
-rw-r--r--arch/s390/lib/uaccess.h9
-rw-r--r--arch/s390/lib/uaccess_pt.c14
-rw-r--r--arch/s390/pci/pci.c4
-rw-r--r--arch/score/Kconfig1
-rw-r--r--arch/score/include/asm/Kbuild2
-rw-r--r--arch/score/lib/checksum.S2
-rw-r--r--arch/sh/Kconfig8
-rw-r--r--arch/sh/boards/Kconfig1
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c2
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/clkdev.h2
-rw-r--r--arch/sh/include/asm/fixmap.h39
-rw-r--r--arch/sh/kernel/cpu/sh2/setup-sh7619.c30
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-mxg.c10
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7201.c80
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7203.c40
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7206.c40
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7264.c104
-rw-r--r--arch/sh/kernel/cpu/sh2a/setup-sh7269.c104
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7705.c20
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh770x.c30
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7710.c20
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7720.c20
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh4-202.c16
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c20
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7760.c62
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7343.c40
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c10
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c30
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c63
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c63
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7734.c72
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c30
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7763.c30
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7770.c100
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7780.c22
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c60
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c88
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-shx3.c48
-rw-r--r--arch/sh/kernel/cpu/sh5/setup-sh5.c12
-rw-r--r--arch/sh/kernel/dwarf.c18
-rw-r--r--arch/sh/kernel/kgdb.c1
-rw-r--r--arch/sh/kernel/setup.c4
-rw-r--r--arch/sparc/Kconfig5
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/uapi/asm/socket.h2
-rw-r--r--arch/sparc/include/uapi/asm/unistd.h4
-rw-r--r--arch/sparc/kernel/cpumap.c1
-rw-r--r--arch/sparc/kernel/ebus.c1
-rw-r--r--arch/sparc/kernel/hvtramp.S1
-rw-r--r--arch/sparc/kernel/of_device_common.c1
-rw-r--r--arch/sparc/kernel/pci.c9
-rw-r--r--arch/sparc/kernel/pci_common.c1
-rw-r--r--arch/sparc/kernel/process_32.c1
-rw-r--r--arch/sparc/kernel/sparc_ksyms_32.c1
-rw-r--r--arch/sparc/kernel/sparc_ksyms_64.c1
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/sparc/kernel/trampoline_32.S1
-rw-r--r--arch/sparc/kernel/trampoline_64.S1
-rw-r--r--arch/sparc/mm/hugetlbpage.c1
-rw-r--r--arch/sparc/mm/init_64.c5
-rw-r--r--arch/sparc/mm/tlb.c1
-rw-r--r--arch/sparc/prom/p1275.c1
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/compat.h1
-rw-r--r--arch/tile/include/asm/fixmap.h33
-rw-r--r--arch/um/include/asm/Kbuild2
-rw-r--r--arch/um/include/asm/fixmap.h40
-rw-r--r--arch/um/include/asm/processor-generic.h3
-rw-r--r--arch/unicore32/Kconfig1
-rw-r--r--arch/unicore32/include/asm/Kbuild1
-rw-r--r--arch/unicore32/kernel/early_printk.c8
-rw-r--r--arch/unicore32/mm/init.c3
-rw-r--r--arch/x86/Kconfig12
-rw-r--r--arch/x86/Makefile22
-rw-r--r--arch/x86/boot/Makefile15
-rw-r--r--arch/x86/boot/cpuflags.c25
-rw-r--r--arch/x86/boot/video.h2
-rw-r--r--arch/x86/crypto/Makefile1
-rw-r--r--arch/x86/crypto/aesni-intel_avx-x86_64.S2811
-rw-r--r--arch/x86/crypto/aesni-intel_glue.c147
-rw-r--r--arch/x86/include/asm/dmi.h6
-rw-r--r--arch/x86/include/asm/fixmap.h59
-rw-r--r--arch/x86/include/asm/hash.h7
-rw-r--r--arch/x86/include/asm/kvm_host.h3
-rw-r--r--arch/x86/include/asm/kvm_para.h33
-rw-r--r--arch/x86/include/asm/paravirt.h2
-rw-r--r--arch/x86/include/asm/paravirt_types.h9
-rw-r--r--arch/x86/include/asm/pci.h3
-rw-r--r--arch/x86/include/asm/pgtable_types.h3
-rw-r--r--arch/x86/include/asm/thread_info.h8
-rw-r--r--arch/x86/include/asm/uv/uv.h2
-rw-r--r--arch/x86/include/asm/vmx.h1
-rw-r--r--arch/x86/include/asm/x86_init.h2
-rw-r--r--arch/x86/include/asm/xen/page.h13
-rw-r--r--arch/x86/include/uapi/asm/hyperv.h13
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h1
-rw-r--r--arch/x86/include/uapi/asm/sembuf.h10
-rw-r--r--arch/x86/kernel/acpi/boot.c7
-rw-r--r--arch/x86/kernel/apic/apic_flat_64.c4
-rw-r--r--arch/x86/kernel/apic/io_apic.c3
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c1
-rw-r--r--arch/x86/kernel/check.c2
-rw-r--r--arch/x86/kernel/cpu/microcode/amd.c2
-rw-r--r--arch/x86/kernel/cpu/microcode/intel.c2
-rw-r--r--arch/x86/kernel/e820.c2
-rw-r--r--arch/x86/kernel/kvm.c34
-rw-r--r--arch/x86/kernel/tsc.c2
-rw-r--r--arch/x86/kernel/vsmp_64.c8
-rw-r--r--arch/x86/kernel/x86_init.c4
-rw-r--r--arch/x86/kvm/Kconfig2
-rw-r--r--arch/x86/kvm/cpuid.h8
-rw-r--r--arch/x86/kvm/i8254.c18
-rw-r--r--arch/x86/kvm/lapic.c9
-rw-r--r--arch/x86/kvm/lapic.h2
-rw-r--r--arch/x86/kvm/mmu.c12
-rw-r--r--arch/x86/kvm/paging_tmpl.h8
-rw-r--r--arch/x86/kvm/svm.c15
-rw-r--r--arch/x86/kvm/vmx.c332
-rw-r--r--arch/x86/kvm/x86.c140
-rw-r--r--arch/x86/kvm/x86.h2
-rw-r--r--arch/x86/lguest/boot.c12
-rw-r--r--arch/x86/lib/Makefile2
-rw-r--r--arch/x86/lib/hash.c88
-rw-r--r--arch/x86/math-emu/errors.c5
-rw-r--r--arch/x86/mm/gup.c8
-rw-r--r--arch/x86/mm/init_32.c2
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/mm/memtest.c2
-rw-r--r--arch/x86/mm/numa.c52
-rw-r--r--arch/x86/mm/srat.c5
-rw-r--r--arch/x86/pci/mmconfig-shared.c1
-rw-r--r--arch/x86/pci/mmconfig_32.c1
-rw-r--r--arch/x86/pci/xen.c2
-rw-r--r--arch/x86/platform/efi/efi-bgrt.c10
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_ipc.h5
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_msic.h4
-rw-r--r--arch/x86/platform/intel-mid/intel_mid_weak_decls.h6
-rw-r--r--arch/x86/platform/intel-mid/mfld.c6
-rw-r--r--arch/x86/platform/intel-mid/mrfl.c2
-rw-r--r--arch/x86/platform/olpc/olpc-xo15-sci.c3
-rw-r--r--arch/x86/platform/uv/uv_nmi.c65
-rw-r--r--arch/x86/realmode/rm/Makefile17
-rw-r--r--arch/x86/tools/relocs.c30
-rw-r--r--arch/x86/tools/relocs.h7
-rw-r--r--arch/x86/tools/relocs_common.c16
-rw-r--r--arch/x86/xen/Kconfig4
-rw-r--r--arch/x86/xen/enlighten.c126
-rw-r--r--arch/x86/xen/grant-table.c64
-rw-r--r--arch/x86/xen/irq.c13
-rw-r--r--arch/x86/xen/mmu.c182
-rw-r--r--arch/x86/xen/p2m.c32
-rw-r--r--arch/x86/xen/platform-pci-unplug.c79
-rw-r--r--arch/x86/xen/setup.c44
-rw-r--r--arch/x86/xen/smp.c49
-rw-r--r--arch/x86/xen/spinlock.c2
-rw-r--r--arch/x86/xen/time.c1
-rw-r--r--arch/x86/xen/xen-head.S25
-rw-r--r--arch/x86/xen/xen-ops.h1
-rw-r--r--arch/xtensa/Kconfig58
-rw-r--r--arch/xtensa/boot/dts/lx60.dts2
-rw-r--r--arch/xtensa/boot/dts/ml605.dts2
-rw-r--r--arch/xtensa/boot/dts/xtfpga.dtsi6
-rw-r--r--arch/xtensa/include/asm/Kbuild2
-rw-r--r--arch/xtensa/include/asm/barrier.h4
-rw-r--r--arch/xtensa/include/asm/bitops.h8
-rw-r--r--arch/xtensa/include/asm/cacheflush.h40
-rw-r--r--arch/xtensa/include/asm/delay.h52
-rw-r--r--arch/xtensa/include/asm/ftrace.h2
-rw-r--r--arch/xtensa/include/asm/futex.h147
-rw-r--r--arch/xtensa/include/asm/initialize_mmu.h13
-rw-r--r--arch/xtensa/include/asm/io.h16
-rw-r--r--arch/xtensa/include/asm/irq.h9
-rw-r--r--arch/xtensa/include/asm/mmu.h10
-rw-r--r--arch/xtensa/include/asm/mmu_context.h106
-rw-r--r--arch/xtensa/include/asm/mxregs.h46
-rw-r--r--arch/xtensa/include/asm/perf_event.h4
-rw-r--r--arch/xtensa/include/asm/processor.h20
-rw-r--r--arch/xtensa/include/asm/ptrace.h8
-rw-r--r--arch/xtensa/include/asm/smp.h38
-rw-r--r--arch/xtensa/include/asm/spinlock.h31
-rw-r--r--arch/xtensa/include/asm/spinlock_types.h20
-rw-r--r--arch/xtensa/include/asm/timex.h14
-rw-r--r--arch/xtensa/include/asm/tlbflush.h42
-rw-r--r--arch/xtensa/include/asm/traps.h1
-rw-r--r--arch/xtensa/include/asm/vectors.h23
-rw-r--r--arch/xtensa/include/uapi/asm/socket.h2
-rw-r--r--arch/xtensa/kernel/Makefile1
-rw-r--r--arch/xtensa/kernel/head.S181
-rw-r--r--arch/xtensa/kernel/irq.c207
-rw-r--r--arch/xtensa/kernel/mxhead.S85
-rw-r--r--arch/xtensa/kernel/setup.c131
-rw-r--r--arch/xtensa/kernel/smp.c592
-rw-r--r--arch/xtensa/kernel/time.c61
-rw-r--r--arch/xtensa/kernel/traps.c56
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S26
-rw-r--r--arch/xtensa/mm/cache.c7
-rw-r--r--arch/xtensa/mm/fault.c2
-rw-r--r--arch/xtensa/mm/misc.S4
-rw-r--r--arch/xtensa/mm/mmu.c20
-rw-r--r--arch/xtensa/mm/tlb.c37
-rw-r--r--arch/xtensa/platforms/iss/network.c301
-rw-r--r--arch/xtensa/platforms/iss/simdisk.c14
-rw-r--r--arch/xtensa/platforms/xtfpga/include/platform/hardware.h6
-rw-r--r--arch/xtensa/platforms/xtfpga/setup.c14
-rw-r--r--arch/xtensa/variants/s6000/include/variant/irq.h1
1753 files changed, 59393 insertions, 27077 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index d39dc9b95a2c..f6c6b345388c 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -2,6 +2,7 @@ config ALPHA
2 bool 2 bool
3 default y 3 default y
4 select ARCH_MIGHT_HAVE_PC_PARPORT 4 select ARCH_MIGHT_HAVE_PC_PARPORT
5 select ARCH_MIGHT_HAVE_PC_SERIO
5 select HAVE_AOUT 6 select HAVE_AOUT
6 select HAVE_IDE 7 select HAVE_IDE
7 select HAVE_OPROFILE 8 select HAVE_OPROFILE
@@ -16,6 +17,7 @@ config ALPHA
16 select ARCH_WANT_IPC_PARSE_VERSION 17 select ARCH_WANT_IPC_PARSE_VERSION
17 select ARCH_HAVE_NMI_SAFE_CMPXCHG 18 select ARCH_HAVE_NMI_SAFE_CMPXCHG
18 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 19 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
20 select AUDIT_ARCH
19 select GENERIC_CLOCKEVENTS 21 select GENERIC_CLOCKEVENTS
20 select GENERIC_SMP_IDLE_THREAD 22 select GENERIC_SMP_IDLE_THREAD
21 select GENERIC_STRNCPY_FROM_USER 23 select GENERIC_STRNCPY_FROM_USER
@@ -76,6 +78,8 @@ config GENERIC_ISA_DMA
76source "init/Kconfig" 78source "init/Kconfig"
77source "kernel/Kconfig.freezer" 79source "kernel/Kconfig.freezer"
78 80
81config AUDIT_ARCH
82 bool
79 83
80menu "System setup" 84menu "System setup"
81 85
@@ -539,13 +543,13 @@ config SMP
539 depends on ALPHA_SABLE || ALPHA_LYNX || ALPHA_RAWHIDE || ALPHA_DP264 || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_GENERIC || ALPHA_SHARK || ALPHA_MARVEL 543 depends on ALPHA_SABLE || ALPHA_LYNX || ALPHA_RAWHIDE || ALPHA_DP264 || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_GENERIC || ALPHA_SHARK || ALPHA_MARVEL
540 ---help--- 544 ---help---
541 This enables support for systems with more than one CPU. If you have 545 This enables support for systems with more than one CPU. If you have
542 a system with only one CPU, like most personal computers, say N. If 546 a system with only one CPU, say N. If you have a system with more
543 you have a system with more than one CPU, say Y. 547 than one CPU, say Y.
544 548
545 If you say N here, the kernel will run on single and multiprocessor 549 If you say N here, the kernel will run on uni- and multiprocessor
546 machines, but will use only one CPU of a multiprocessor machine. If 550 machines, but will use only one CPU of a multiprocessor machine. If
547 you say Y here, the kernel will run on many, but not all, 551 you say Y here, the kernel will run on many, but not all,
548 singleprocessor machines. On a singleprocessor machine, the kernel 552 uniprocessor machines. On a uniprocessor machine, the kernel
549 will run faster if you say N here. 553 will run faster if you say N here.
550 554
551 See also the SMP-HOWTO available at 555 See also the SMP-HOWTO available at
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index f01fb505ad52..a73a8e208a4a 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -4,3 +4,4 @@ generic-y += clkdev.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += trace_clock.h 5generic-y += trace_clock.h
6generic-y += preempt.h 6generic-y += preempt.h
7generic-y += hash.h
diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h
index 21128505ddbe..9047c2fe8f23 100644
--- a/arch/alpha/include/asm/ptrace.h
+++ b/arch/alpha/include/asm/ptrace.h
@@ -19,4 +19,9 @@
19 19
20#define force_successful_syscall_return() (current_pt_regs()->r0 = 0) 20#define force_successful_syscall_return() (current_pt_regs()->r0 = 0)
21 21
22static inline unsigned long regs_return_value(struct pt_regs *regs)
23{
24 return regs->r0;
25}
26
22#endif 27#endif
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h
index 453597b91f3a..3d6ce6d56fc9 100644
--- a/arch/alpha/include/asm/thread_info.h
+++ b/arch/alpha/include/asm/thread_info.h
@@ -70,6 +70,7 @@ register struct thread_info *__current_thread_info __asm__("$8");
70#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ 70#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
71#define TIF_SIGPENDING 2 /* signal pending */ 71#define TIF_SIGPENDING 2 /* signal pending */
72#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 72#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
73#define TIF_SYSCALL_AUDIT 4 /* syscall audit active */
73#define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */ 74#define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */
74#define TIF_MEMDIE 13 /* is terminating due to OOM killer */ 75#define TIF_MEMDIE 13 /* is terminating due to OOM killer */
75 76
@@ -77,6 +78,7 @@ register struct thread_info *__current_thread_info __asm__("$8");
77#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 78#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
78#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 79#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
79#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 80#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
81#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
80 82
81/* Work to do on interrupt/exception return. */ 83/* Work to do on interrupt/exception return. */
82#define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 84#define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
index e3a1491d5073..3de1394bcab8 100644
--- a/arch/alpha/include/uapi/asm/socket.h
+++ b/arch/alpha/include/uapi/asm/socket.h
@@ -85,4 +85,6 @@
85 85
86#define SO_MAX_PACING_RATE 47 86#define SO_MAX_PACING_RATE 47
87 87
88#define SO_BPF_EXTENSIONS 48
89
88#endif /* _UAPI_ASM_SOCKET_H */ 90#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index 0d54650e78fc..3ecac0106c8a 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_SRM_ENV) += srm_env.o
17obj-$(CONFIG_MODULES) += module.o 17obj-$(CONFIG_MODULES) += module.o
18obj-$(CONFIG_PERF_EVENTS) += perf_event.o 18obj-$(CONFIG_PERF_EVENTS) += perf_event.o
19obj-$(CONFIG_RTC_DRV_ALPHA) += rtc.o 19obj-$(CONFIG_RTC_DRV_ALPHA) += rtc.o
20obj-$(CONFIG_AUDIT) += audit.o
20 21
21ifdef CONFIG_ALPHA_GENERIC 22ifdef CONFIG_ALPHA_GENERIC
22 23
diff --git a/arch/alpha/kernel/audit.c b/arch/alpha/kernel/audit.c
new file mode 100644
index 000000000000..96a9d18ff4c4
--- /dev/null
+++ b/arch/alpha/kernel/audit.c
@@ -0,0 +1,60 @@
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 return 0;
34}
35
36int audit_classify_syscall(int abi, unsigned syscall)
37{
38 switch(syscall) {
39 case __NR_open:
40 return 2;
41 case __NR_openat:
42 return 3;
43 case __NR_execve:
44 return 5;
45 default:
46 return 0;
47 }
48}
49
50static int __init audit_classes_init(void)
51{
52 audit_register_class(AUDIT_CLASS_WRITE, write_class);
53 audit_register_class(AUDIT_CLASS_READ, read_class);
54 audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
55 audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
56 audit_register_class(AUDIT_CLASS_SIGNAL, signal_class);
57 return 0;
58}
59
60__initcall(audit_classes_init);
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index a969b95ee5ac..98703d99b565 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -465,7 +465,11 @@ entSys:
465 .cfi_rel_offset $16, SP_OFF+24 465 .cfi_rel_offset $16, SP_OFF+24
466 .cfi_rel_offset $17, SP_OFF+32 466 .cfi_rel_offset $17, SP_OFF+32
467 .cfi_rel_offset $18, SP_OFF+40 467 .cfi_rel_offset $18, SP_OFF+40
468 blbs $3, strace 468#ifdef CONFIG_AUDITSYSCALL
469 lda $6, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
470 and $3, $6, $3
471#endif
472 bne $3, strace
469 beq $4, 1f 473 beq $4, 1f
470 ldq $27, 0($5) 474 ldq $27, 0($5)
4711: jsr $26, ($27), alpha_ni_syscall 4751: jsr $26, ($27), alpha_ni_syscall
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
index 2b183b0d3207..99e8d4796c96 100644
--- a/arch/alpha/kernel/pci-sysfs.c
+++ b/arch/alpha/kernel/pci-sysfs.c
@@ -83,7 +83,7 @@ static int pci_mmap_resource(struct kobject *kobj,
83 if (iomem_is_exclusive(res->start)) 83 if (iomem_is_exclusive(res->start))
84 return -EINVAL; 84 return -EINVAL;
85 85
86 pcibios_resource_to_bus(pdev, &bar, res); 86 pcibios_resource_to_bus(pdev->bus, &bar, res);
87 vma->vm_pgoff += bar.start >> (PAGE_SHIFT - (sparse ? 5 : 0)); 87 vma->vm_pgoff += bar.start >> (PAGE_SHIFT - (sparse ? 5 : 0));
88 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; 88 mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
89 89
@@ -139,7 +139,7 @@ static int sparse_mem_mmap_fits(struct pci_dev *pdev, int num)
139 long dense_offset; 139 long dense_offset;
140 unsigned long sparse_size; 140 unsigned long sparse_size;
141 141
142 pcibios_resource_to_bus(pdev, &bar, &pdev->resource[num]); 142 pcibios_resource_to_bus(pdev->bus, &bar, &pdev->resource[num]);
143 143
144 /* All core logic chips have 4G sparse address space, except 144 /* All core logic chips have 4G sparse address space, except
145 CIA which has 16G (see xxx_SPARSE_MEM and xxx_DENSE_MEM 145 CIA which has 16G (see xxx_SPARSE_MEM and xxx_DENSE_MEM
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index a21d0ab3b19e..eddee7720343 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -325,7 +325,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
325/* Helper for generic DMA-mapping functions. */ 325/* Helper for generic DMA-mapping functions. */
326static struct pci_dev *alpha_gendev_to_pci(struct device *dev) 326static struct pci_dev *alpha_gendev_to_pci(struct device *dev)
327{ 327{
328 if (dev && dev->bus == &pci_bus_type) 328 if (dev && dev_is_pci(dev))
329 return to_pci_dev(dev); 329 return to_pci_dev(dev);
330 330
331 /* Assume that non-PCI devices asking for DMA are either ISA or EISA, 331 /* Assume that non-PCI devices asking for DMA are either ISA or EISA,
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index 2a4a80ff4a20..86d835157b54 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -14,6 +14,7 @@
14#include <linux/security.h> 14#include <linux/security.h>
15#include <linux/signal.h> 15#include <linux/signal.h>
16#include <linux/tracehook.h> 16#include <linux/tracehook.h>
17#include <linux/audit.h>
17 18
18#include <asm/uaccess.h> 19#include <asm/uaccess.h>
19#include <asm/pgtable.h> 20#include <asm/pgtable.h>
@@ -316,15 +317,18 @@ long arch_ptrace(struct task_struct *child, long request,
316asmlinkage unsigned long syscall_trace_enter(void) 317asmlinkage unsigned long syscall_trace_enter(void)
317{ 318{
318 unsigned long ret = 0; 319 unsigned long ret = 0;
320 struct pt_regs *regs = current_pt_regs();
319 if (test_thread_flag(TIF_SYSCALL_TRACE) && 321 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
320 tracehook_report_syscall_entry(current_pt_regs())) 322 tracehook_report_syscall_entry(current_pt_regs()))
321 ret = -1UL; 323 ret = -1UL;
324 audit_syscall_entry(AUDIT_ARCH_ALPHA, regs->r0, regs->r16, regs->r17, regs->r18, regs->r19);
322 return ret ?: current_pt_regs()->r0; 325 return ret ?: current_pt_regs()->r0;
323} 326}
324 327
325asmlinkage void 328asmlinkage void
326syscall_trace_leave(void) 329syscall_trace_leave(void)
327{ 330{
331 audit_syscall_exit(current_pt_regs());
328 if (test_thread_flag(TIF_SYSCALL_TRACE)) 332 if (test_thread_flag(TIF_SYSCALL_TRACE))
329 tracehook_report_syscall_exit(current_pt_regs(), 0); 333 tracehook_report_syscall_exit(current_pt_regs(), 0);
330} 334}
diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
index ff3c10721caf..5675dca8dbb1 100644
--- a/arch/alpha/lib/csum_partial_copy.c
+++ b/arch/alpha/lib/csum_partial_copy.c
@@ -378,6 +378,11 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len,
378__wsum 378__wsum
379csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) 379csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
380{ 380{
381 return csum_partial_copy_from_user((__force const void __user *)src, 381 __wsum checksum;
382 dst, len, sum, NULL); 382 mm_segment_t oldfs = get_fs();
383 set_fs(KERNEL_DS);
384 checksum = csum_partial_copy_from_user((__force const void __user *)src,
385 dst, len, sum, NULL);
386 set_fs(oldfs);
387 return checksum;
383} 388}
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 9063ae6553cc..9be30c8cb0c2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -128,8 +128,8 @@ config SMP
128 default n 128 default n
129 help 129 help
130 This enables support for systems with more than one CPU. If you have 130 This enables support for systems with more than one CPU. If you have
131 a system with only one CPU, like most personal computers, say N. If 131 a system with only one CPU, say N. If you have a system with more
132 you have a system with more than one CPU, say Y. 132 than one CPU, say Y.
133 133
134if SMP 134if SMP
135 135
@@ -409,17 +409,6 @@ config ARC_DBG_TLB_MISS_COUNT
409 Counts number of I and D TLB Misses and exports them via Debugfs 409 Counts number of I and D TLB Misses and exports them via Debugfs
410 The counters can be cleared via Debugfs as well 410 The counters can be cleared via Debugfs as well
411 411
412config CMDLINE_UBOOT
413 bool "Support U-boot kernel command line passing"
414 default n
415 help
416 If you are using U-boot (www.denx.de) and wish to pass the kernel
417 command line from the U-boot environment to the Linux kernel then
418 switch this option on.
419 ARC U-boot will setup the cmdline in RAM/flash and set r2 to point
420 to it. kernel startup code will append this to DeviceTree
421 /bootargs provided cmdline args.
422
423config ARC_BUILTIN_DTB_NAME 412config ARC_BUILTIN_DTB_NAME
424 string "Built in DTB" 413 string "Built in DTB"
425 help 414 help
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 9ae21c198007..0d3362991c31 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -12,6 +12,7 @@ generic-y += fcntl.h
12generic-y += fb.h 12generic-y += fb.h
13generic-y += ftrace.h 13generic-y += ftrace.h
14generic-y += hardirq.h 14generic-y += hardirq.h
15generic-y += hash.h
15generic-y += hw_irq.h 16generic-y += hw_irq.h
16generic-y += ioctl.h 17generic-y += ioctl.h
17generic-y += ioctls.h 18generic-y += ioctls.h
diff --git a/arch/arc/include/asm/linkage.h b/arch/arc/include/asm/linkage.h
index 0283e9e44e0d..66ee5527aefc 100644
--- a/arch/arc/include/asm/linkage.h
+++ b/arch/arc/include/asm/linkage.h
@@ -11,6 +11,8 @@
11 11
12#ifdef __ASSEMBLY__ 12#ifdef __ASSEMBLY__
13 13
14#define ASM_NL ` /* use '`' to mark new line in macro */
15
14/* Can't use the ENTRY macro in linux/linkage.h 16/* Can't use the ENTRY macro in linux/linkage.h
15 * gas considers ';' as comment vs. newline 17 * gas considers ';' as comment vs. newline
16 */ 18 */
diff --git a/arch/arc/include/asm/smp.h b/arch/arc/include/asm/smp.h
index eefc29f08cdb..5d06eee43ea9 100644
--- a/arch/arc/include/asm/smp.h
+++ b/arch/arc/include/asm/smp.h
@@ -46,14 +46,14 @@ extern int smp_ipi_irq_setup(int cpu, int irq);
46 * 46 *
47 * @info: SoC SMP specific info for /proc/cpuinfo etc 47 * @info: SoC SMP specific info for /proc/cpuinfo etc
48 * @cpu_kick: For Master to kickstart a cpu (optionally at a PC) 48 * @cpu_kick: For Master to kickstart a cpu (optionally at a PC)
49 * @ipi_send: To send IPI to a @cpumask 49 * @ipi_send: To send IPI to a @cpu
50 * @ips_clear: To clear IPI received by @cpu at @irq 50 * @ips_clear: To clear IPI received at @irq
51 */ 51 */
52struct plat_smp_ops { 52struct plat_smp_ops {
53 const char *info; 53 const char *info;
54 void (*cpu_kick)(int cpu, unsigned long pc); 54 void (*cpu_kick)(int cpu, unsigned long pc);
55 void (*ipi_send)(void *callmap); 55 void (*ipi_send)(int cpu);
56 void (*ipi_clear)(int cpu, int irq); 56 void (*ipi_clear)(int irq);
57}; 57};
58 58
59/* TBD: stop exporting it for direct population by platform */ 59/* TBD: stop exporting it for direct population by platform */
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 2c878e964a64..991997269d02 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -49,25 +49,13 @@ stext:
49 st.ab 0, [r5,4] 49 st.ab 0, [r5,4]
50 brlt r5, r6, 1b 50 brlt r5, r6, 1b
51 51
52#ifdef CONFIG_CMDLINE_UBOOT 52 ; Uboot - kernel ABI
53 ; support for bootloader provided cmdline 53 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2
54 ; If cmdline passed by u-boot, then 54 ; r1 = magic number (board identity, unused as of now
55 ; r0 = 1 (because ATAGS parsing, now retired, used to use 0) 55 ; r2 = pointer to uboot provided cmdline or external DTB in mem
56 ; r1 = magic number (board identity) 56 ; These are handled later in setup_arch()
57 ; r2 = addr of cmdline string (somewhere in memory/flash) 57 st r0, [@uboot_tag]
58 58 st r2, [@uboot_arg]
59 brne r0, 1, .Lother_bootup_chores ; u-boot didn't pass cmdline
60 breq r2, 0, .Lother_bootup_chores ; or cmdline is NULL
61
62 mov r5, @command_line
631:
64 ldb.ab r6, [r2, 1]
65 breq r6, 0, .Lother_bootup_chores
66 b.d 1b
67 stb.ab r6, [r5, 1]
68#endif
69
70.Lother_bootup_chores:
71 59
72 ; Identify if running on ISS vs Silicon 60 ; Identify if running on ISS vs Silicon
73 ; IDENTITY Reg [ 3 2 1 0 ] 61 ; IDENTITY Reg [ 3 2 1 0 ]
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 643eae4436e0..119dddb752b2 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -29,7 +29,10 @@
29 29
30int running_on_hw = 1; /* vs. on ISS */ 30int running_on_hw = 1; /* vs. on ISS */
31 31
32char __initdata command_line[COMMAND_LINE_SIZE]; 32/* Part of U-boot ABI: see head.S */
33int __initdata uboot_tag;
34char __initdata *uboot_arg;
35
33const struct machine_desc *machine_desc; 36const struct machine_desc *machine_desc;
34 37
35struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 38struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
@@ -311,19 +314,40 @@ void setup_processor(void)
311 arc_chk_fpu(); 314 arc_chk_fpu();
312} 315}
313 316
317static inline int is_kernel(unsigned long addr)
318{
319 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
320 return 1;
321 return 0;
322}
323
314void __init setup_arch(char **cmdline_p) 324void __init setup_arch(char **cmdline_p)
315{ 325{
316 /* This also populates @boot_command_line from /bootargs */ 326 /* make sure that uboot passed pointer to cmdline/dtb is valid */
317 machine_desc = setup_machine_fdt(__dtb_start); 327 if (uboot_tag && is_kernel((unsigned long)uboot_arg))
318 if (!machine_desc) 328 panic("Invalid uboot arg\n");
319 panic("Embedded DT invalid\n"); 329
320 330 /* See if u-boot passed an external Device Tree blob */
321 /* Append any u-boot provided cmdline */ 331 machine_desc = setup_machine_fdt(uboot_arg); /* uboot_tag == 2 */
322#ifdef CONFIG_CMDLINE_UBOOT 332 if (!machine_desc) {
323 /* Add a whitespace seperator between the 2 cmdlines */ 333 /* No, so try the embedded one */
324 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); 334 machine_desc = setup_machine_fdt(__dtb_start);
325 strlcat(boot_command_line, command_line, COMMAND_LINE_SIZE); 335 if (!machine_desc)
326#endif 336 panic("Embedded DT invalid\n");
337
338 /*
339 * If we are here, it is established that @uboot_arg didn't
340 * point to DT blob. Instead if u-boot says it is cmdline,
341 * Appent to embedded DT cmdline.
342 * setup_machine_fdt() would have populated @boot_command_line
343 */
344 if (uboot_tag == 1) {
345 /* Ensure a whitespace between the 2 cmdlines */
346 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
347 strlcat(boot_command_line, uboot_arg,
348 COMMAND_LINE_SIZE);
349 }
350 }
327 351
328 /* Save unparsed command line copy for /proc/cmdline */ 352 /* Save unparsed command line copy for /proc/cmdline */
329 *cmdline_p = boot_command_line; 353 *cmdline_p = boot_command_line;
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index c2f9ebbc38f6..40859e5619f9 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -197,51 +197,65 @@ int __init setup_profiling_timer(unsigned int multiplier)
197/* Inter Processor Interrupt Handling */ 197/* Inter Processor Interrupt Handling */
198/*****************************************************************************/ 198/*****************************************************************************/
199 199
200/*
201 * structures for inter-processor calls
202 * A Collection of single bit ipi messages
203 *
204 */
205
206/*
207 * TODO_rajesh investigate tlb message types.
208 * IPI Timer not needed because each ARC has an individual Interrupting Timer
209 */
210enum ipi_msg_type { 200enum ipi_msg_type {
211 IPI_NOP = 0, 201 IPI_EMPTY = 0,
212 IPI_RESCHEDULE = 1, 202 IPI_RESCHEDULE = 1,
213 IPI_CALL_FUNC, 203 IPI_CALL_FUNC,
214 IPI_CPU_STOP 204 IPI_CPU_STOP,
215}; 205};
216 206
217struct ipi_data { 207/*
218 unsigned long bits; 208 * In arches with IRQ for each msg type (above), receiver can use IRQ-id to
219}; 209 * figure out what msg was sent. For those which don't (ARC has dedicated IPI
210 * IRQ), the msg-type needs to be conveyed via per-cpu data
211 */
220 212
221static DEFINE_PER_CPU(struct ipi_data, ipi_data); 213static DEFINE_PER_CPU(unsigned long, ipi_data);
222 214
223static void ipi_send_msg(const struct cpumask *callmap, enum ipi_msg_type msg) 215static void ipi_send_msg_one(int cpu, enum ipi_msg_type msg)
224{ 216{
217 unsigned long __percpu *ipi_data_ptr = per_cpu_ptr(&ipi_data, cpu);
218 unsigned long old, new;
225 unsigned long flags; 219 unsigned long flags;
226 unsigned int cpu; 220
221 pr_debug("%d Sending msg [%d] to %d\n", smp_processor_id(), msg, cpu);
227 222
228 local_irq_save(flags); 223 local_irq_save(flags);
229 224
230 for_each_cpu(cpu, callmap) { 225 /*
231 struct ipi_data *ipi = &per_cpu(ipi_data, cpu); 226 * Atomically write new msg bit (in case others are writing too),
232 set_bit(msg, &ipi->bits); 227 * and read back old value
233 } 228 */
229 do {
230 new = old = *ipi_data_ptr;
231 new |= 1U << msg;
232 } while (cmpxchg(ipi_data_ptr, old, new) != old);
234 233
235 /* Call the platform specific cross-CPU call function */ 234 /*
236 if (plat_smp_ops.ipi_send) 235 * Call the platform specific IPI kick function, but avoid if possible:
237 plat_smp_ops.ipi_send((void *)callmap); 236 * Only do so if there's no pending msg from other concurrent sender(s).
237 * Otherwise, recevier will see this msg as well when it takes the
238 * IPI corresponding to that msg. This is true, even if it is already in
239 * IPI handler, because !@old means it has not yet dequeued the msg(s)
240 * so @new msg can be a free-loader
241 */
242 if (plat_smp_ops.ipi_send && !old)
243 plat_smp_ops.ipi_send(cpu);
238 244
239 local_irq_restore(flags); 245 local_irq_restore(flags);
240} 246}
241 247
248static void ipi_send_msg(const struct cpumask *callmap, enum ipi_msg_type msg)
249{
250 unsigned int cpu;
251
252 for_each_cpu(cpu, callmap)
253 ipi_send_msg_one(cpu, msg);
254}
255
242void smp_send_reschedule(int cpu) 256void smp_send_reschedule(int cpu)
243{ 257{
244 ipi_send_msg(cpumask_of(cpu), IPI_RESCHEDULE); 258 ipi_send_msg_one(cpu, IPI_RESCHEDULE);
245} 259}
246 260
247void smp_send_stop(void) 261void smp_send_stop(void)
@@ -254,7 +268,7 @@ void smp_send_stop(void)
254 268
255void arch_send_call_function_single_ipi(int cpu) 269void arch_send_call_function_single_ipi(int cpu)
256{ 270{
257 ipi_send_msg(cpumask_of(cpu), IPI_CALL_FUNC); 271 ipi_send_msg_one(cpu, IPI_CALL_FUNC);
258} 272}
259 273
260void arch_send_call_function_ipi_mask(const struct cpumask *mask) 274void arch_send_call_function_ipi_mask(const struct cpumask *mask)
@@ -265,33 +279,29 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
265/* 279/*
266 * ipi_cpu_stop - handle IPI from smp_send_stop() 280 * ipi_cpu_stop - handle IPI from smp_send_stop()
267 */ 281 */
268static void ipi_cpu_stop(unsigned int cpu) 282static void ipi_cpu_stop(void)
269{ 283{
270 machine_halt(); 284 machine_halt();
271} 285}
272 286
273static inline void __do_IPI(unsigned long *ops, struct ipi_data *ipi, int cpu) 287static inline void __do_IPI(unsigned long msg)
274{ 288{
275 unsigned long msg = 0; 289 switch (msg) {
290 case IPI_RESCHEDULE:
291 scheduler_ipi();
292 break;
276 293
277 do { 294 case IPI_CALL_FUNC:
278 msg = find_next_bit(ops, BITS_PER_LONG, msg+1); 295 generic_smp_call_function_interrupt();
296 break;
279 297
280 switch (msg) { 298 case IPI_CPU_STOP:
281 case IPI_RESCHEDULE: 299 ipi_cpu_stop();
282 scheduler_ipi(); 300 break;
283 break;
284
285 case IPI_CALL_FUNC:
286 generic_smp_call_function_interrupt();
287 break;
288
289 case IPI_CPU_STOP:
290 ipi_cpu_stop(cpu);
291 break;
292 }
293 } while (msg < BITS_PER_LONG);
294 301
302 default:
303 pr_warn("IPI with unexpected msg %ld\n", msg);
304 }
295} 305}
296 306
297/* 307/*
@@ -300,19 +310,25 @@ static inline void __do_IPI(unsigned long *ops, struct ipi_data *ipi, int cpu)
300 */ 310 */
301irqreturn_t do_IPI(int irq, void *dev_id) 311irqreturn_t do_IPI(int irq, void *dev_id)
302{ 312{
303 int cpu = smp_processor_id(); 313 unsigned long pending;
304 struct ipi_data *ipi = &per_cpu(ipi_data, cpu); 314
305 unsigned long ops; 315 pr_debug("IPI [%ld] received on cpu %d\n",
316 *this_cpu_ptr(&ipi_data), smp_processor_id());
306 317
307 if (plat_smp_ops.ipi_clear) 318 if (plat_smp_ops.ipi_clear)
308 plat_smp_ops.ipi_clear(cpu, irq); 319 plat_smp_ops.ipi_clear(irq);
309 320
310 /* 321 /*
311 * XXX: is this loop really needed 322 * "dequeue" the msg corresponding to this IPI (and possibly other
312 * And do we need to move ipi_clean inside 323 * piggybacked msg from elided IPIs: see ipi_send_msg_one() above)
313 */ 324 */
314 while ((ops = xchg(&ipi->bits, 0)) != 0) 325 pending = xchg(this_cpu_ptr(&ipi_data), 0);
315 __do_IPI(&ops, ipi, cpu); 326
327 do {
328 unsigned long msg = __ffs(pending);
329 __do_IPI(msg);
330 pending &= ~(1U << msg);
331 } while (pending);
316 332
317 return IRQ_HANDLED; 333 return IRQ_HANDLED;
318} 334}
diff --git a/arch/arc/plat-arcfpga/smp.c b/arch/arc/plat-arcfpga/smp.c
index 91b55349a5f8..8a12741f5f7a 100644
--- a/arch/arc/plat-arcfpga/smp.c
+++ b/arch/arc/plat-arcfpga/smp.c
@@ -88,18 +88,14 @@ void iss_model_init_smp(unsigned int cpu)
88 smp_ipi_irq_setup(cpu, IDU_INTERRUPT_0 + cpu); 88 smp_ipi_irq_setup(cpu, IDU_INTERRUPT_0 + cpu);
89} 89}
90 90
91static void iss_model_ipi_send(void *arg) 91static void iss_model_ipi_send(int cpu)
92{ 92{
93 struct cpumask *callmap = arg; 93 idu_irq_assert(cpu);
94 unsigned int cpu;
95
96 for_each_cpu(cpu, callmap)
97 idu_irq_assert(cpu);
98} 94}
99 95
100static void iss_model_ipi_clear(int cpu, int irq) 96static void iss_model_ipi_clear(int irq)
101{ 97{
102 idu_irq_clear(IDU_INTERRUPT_0 + cpu); 98 idu_irq_clear(IDU_INTERRUPT_0 + smp_processor_id());
103} 99}
104 100
105void iss_model_init_early_smp(void) 101void iss_model_init_early_smp(void)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9c909fc29272..e25419817791 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -6,12 +6,13 @@ 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_BUILTIN_BSWAP
9 select ARCH_USE_CMPXCHG_LOCKREF 10 select ARCH_USE_CMPXCHG_LOCKREF
10 select ARCH_WANT_IPC_PARSE_VERSION 11 select ARCH_WANT_IPC_PARSE_VERSION
11 select BUILDTIME_EXTABLE_SORT if MMU 12 select BUILDTIME_EXTABLE_SORT if MMU
12 select CLONE_BACKWARDS 13 select CLONE_BACKWARDS
13 select CPU_PM if (SUSPEND || CPU_IDLE) 14 select CPU_PM if (SUSPEND || CPU_IDLE)
14 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU 15 select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
15 select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI) 16 select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI)
16 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 17 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
17 select GENERIC_IDLE_POLL_SETUP 18 select GENERIC_IDLE_POLL_SETUP
@@ -36,6 +37,7 @@ config ARM
36 select HAVE_DMA_ATTRS 37 select HAVE_DMA_ATTRS
37 select HAVE_DMA_CONTIGUOUS if MMU 38 select HAVE_DMA_CONTIGUOUS if MMU
38 select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL) 39 select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
40 select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU
39 select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) 41 select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
40 select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL) 42 select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
41 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) 43 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
@@ -63,6 +65,7 @@ config ARM
63 select IRQ_FORCED_THREADING 65 select IRQ_FORCED_THREADING
64 select KTIME_SCALAR 66 select KTIME_SCALAR
65 select MODULES_USE_ELF_REL 67 select MODULES_USE_ELF_REL
68 select NO_BOOTMEM
66 select OLD_SIGACTION 69 select OLD_SIGACTION
67 select OLD_SIGSUSPEND3 70 select OLD_SIGSUSPEND3
68 select PERF_USE_VMALLOC 71 select PERF_USE_VMALLOC
@@ -314,6 +317,8 @@ config ARCH_INTEGRATOR
314 bool "ARM Ltd. Integrator family" 317 bool "ARM Ltd. Integrator family"
315 select ARCH_HAS_CPUFREQ 318 select ARCH_HAS_CPUFREQ
316 select ARM_AMBA 319 select ARM_AMBA
320 select ARM_PATCH_PHYS_VIRT
321 select AUTO_ZRELADDR
317 select COMMON_CLK 322 select COMMON_CLK
318 select COMMON_CLK_VERSATILE 323 select COMMON_CLK_VERSATILE
319 select GENERIC_CLOCKEVENTS 324 select GENERIC_CLOCKEVENTS
@@ -411,6 +416,26 @@ config ARCH_EBSA110
411 Ethernet interface, two PCMCIA sockets, two serial ports and a 416 Ethernet interface, two PCMCIA sockets, two serial ports and a
412 parallel port. 417 parallel port.
413 418
419config ARCH_EFM32
420 bool "Energy Micro efm32"
421 depends on !MMU
422 select ARCH_REQUIRE_GPIOLIB
423 select ARM_NVIC
424 # CLKSRC_MMIO is wrong here, but needed until a proper fix is merged,
425 # i.e. CLKSRC_EFM32 selecting CLKSRC_MMIO
426 select CLKSRC_MMIO
427 select CLKSRC_OF
428 select COMMON_CLK
429 select CPU_V7M
430 select GENERIC_CLOCKEVENTS
431 select NO_DMA
432 select NO_IOPORT
433 select SPARSE_IRQ
434 select USE_OF
435 help
436 Support for Energy Micro's (now Silicon Labs) efm32 Giant Gecko
437 processors.
438
414config ARCH_EP93XX 439config ARCH_EP93XX
415 bool "EP93xx-based" 440 bool "EP93xx-based"
416 select ARCH_HAS_HOLES_MEMORYMODEL 441 select ARCH_HAS_HOLES_MEMORYMODEL
@@ -632,10 +657,10 @@ config ARCH_PXA
632 help 657 help
633 Support for Intel/Marvell's PXA2xx/PXA3xx processor line. 658 Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
634 659
635config ARCH_MSM 660config ARCH_MSM_NODT
636 bool "Qualcomm MSM" 661 bool "Qualcomm MSM"
662 select ARCH_MSM
637 select ARCH_REQUIRE_GPIOLIB 663 select ARCH_REQUIRE_GPIOLIB
638 select CLKSRC_OF if OF
639 select COMMON_CLK 664 select COMMON_CLK
640 select GENERIC_CLOCKEVENTS 665 select GENERIC_CLOCKEVENTS
641 help 666 help
@@ -645,8 +670,9 @@ config ARCH_MSM
645 stack and controls some vital subsystems 670 stack and controls some vital subsystems
646 (clock and power control, etc). 671 (clock and power control, etc).
647 672
648config ARCH_SHMOBILE 673config ARCH_SHMOBILE_LEGACY
649 bool "Renesas SH-Mobile / R-Mobile" 674 bool "Renesas ARM SoCs (non-multiplatform)"
675 select ARCH_SHMOBILE
650 select ARM_PATCH_PHYS_VIRT 676 select ARM_PATCH_PHYS_VIRT
651 select CLKDEV_LOOKUP 677 select CLKDEV_LOOKUP
652 select GENERIC_CLOCKEVENTS 678 select GENERIC_CLOCKEVENTS
@@ -661,7 +687,9 @@ config ARCH_SHMOBILE
661 select PM_GENERIC_DOMAINS if PM 687 select PM_GENERIC_DOMAINS if PM
662 select SPARSE_IRQ 688 select SPARSE_IRQ
663 help 689 help
664 Support for Renesas's SH-Mobile and R-Mobile ARM platforms. 690 Support for Renesas ARM SoC platforms using a non-multiplatform
691 kernel. This includes the SH-Mobile, R-Mobile, EMMA-Mobile, R-Car
692 and RZ families.
665 693
666config ARCH_RPC 694config ARCH_RPC
667 bool "RiscPC" 695 bool "RiscPC"
@@ -711,7 +739,6 @@ config ARCH_S3C24XX
711 select HAVE_S3C2410_WATCHDOG if WATCHDOG 739 select HAVE_S3C2410_WATCHDOG if WATCHDOG
712 select HAVE_S3C_RTC if RTC_CLASS 740 select HAVE_S3C_RTC if RTC_CLASS
713 select MULTI_IRQ_HANDLER 741 select MULTI_IRQ_HANDLER
714 select NEED_MACH_GPIO_H
715 select NEED_MACH_IO_H 742 select NEED_MACH_IO_H
716 select SAMSUNG_ATAGS 743 select SAMSUNG_ATAGS
717 help 744 help
@@ -724,24 +751,23 @@ config ARCH_S3C64XX
724 bool "Samsung S3C64XX" 751 bool "Samsung S3C64XX"
725 select ARCH_HAS_CPUFREQ 752 select ARCH_HAS_CPUFREQ
726 select ARCH_REQUIRE_GPIOLIB 753 select ARCH_REQUIRE_GPIOLIB
754 select ARM_AMBA
727 select ARM_VIC 755 select ARM_VIC
728 select CLKDEV_LOOKUP 756 select CLKDEV_LOOKUP
729 select CLKSRC_SAMSUNG_PWM 757 select CLKSRC_SAMSUNG_PWM
730 select COMMON_CLK 758 select COMMON_CLK
731 select CPU_V6 759 select CPU_V6K
732 select GENERIC_CLOCKEVENTS 760 select GENERIC_CLOCKEVENTS
733 select GPIO_SAMSUNG 761 select GPIO_SAMSUNG
734 select HAVE_S3C2410_I2C if I2C 762 select HAVE_S3C2410_I2C if I2C
735 select HAVE_S3C2410_WATCHDOG if WATCHDOG 763 select HAVE_S3C2410_WATCHDOG if WATCHDOG
736 select HAVE_TCM 764 select HAVE_TCM
737 select NEED_MACH_GPIO_H
738 select NO_IOPORT 765 select NO_IOPORT
739 select PLAT_SAMSUNG 766 select PLAT_SAMSUNG
740 select PM_GENERIC_DOMAINS 767 select PM_GENERIC_DOMAINS
741 select S3C_DEV_NAND 768 select S3C_DEV_NAND
742 select S3C_GPIO_TRACK 769 select S3C_GPIO_TRACK
743 select SAMSUNG_ATAGS 770 select SAMSUNG_ATAGS
744 select SAMSUNG_GPIOLIB_4BIT
745 select SAMSUNG_WAKEMASK 771 select SAMSUNG_WAKEMASK
746 select SAMSUNG_WDT_RESET 772 select SAMSUNG_WDT_RESET
747 select USB_ARCH_HAS_OHCI 773 select USB_ARCH_HAS_OHCI
@@ -912,6 +938,8 @@ source "arch/arm/mach-bcm/Kconfig"
912 938
913source "arch/arm/mach-bcm2835/Kconfig" 939source "arch/arm/mach-bcm2835/Kconfig"
914 940
941source "arch/arm/mach-berlin/Kconfig"
942
915source "arch/arm/mach-clps711x/Kconfig" 943source "arch/arm/mach-clps711x/Kconfig"
916 944
917source "arch/arm/mach-cns3xxx/Kconfig" 945source "arch/arm/mach-cns3xxx/Kconfig"
@@ -928,6 +956,8 @@ source "arch/arm/mach-gemini/Kconfig"
928 956
929source "arch/arm/mach-highbank/Kconfig" 957source "arch/arm/mach-highbank/Kconfig"
930 958
959source "arch/arm/mach-hisi/Kconfig"
960
931source "arch/arm/mach-integrator/Kconfig" 961source "arch/arm/mach-integrator/Kconfig"
932 962
933source "arch/arm/mach-iop32x/Kconfig" 963source "arch/arm/mach-iop32x/Kconfig"
@@ -946,6 +976,8 @@ source "arch/arm/mach-ks8695/Kconfig"
946 976
947source "arch/arm/mach-msm/Kconfig" 977source "arch/arm/mach-msm/Kconfig"
948 978
979source "arch/arm/mach-moxart/Kconfig"
980
949source "arch/arm/mach-mv78xx0/Kconfig" 981source "arch/arm/mach-mv78xx0/Kconfig"
950 982
951source "arch/arm/mach-imx/Kconfig" 983source "arch/arm/mach-imx/Kconfig"
@@ -1054,6 +1086,8 @@ config ARM_TIMER_SP804
1054 select CLKSRC_MMIO 1086 select CLKSRC_MMIO
1055 select CLKSRC_OF if OF 1087 select CLKSRC_OF if OF
1056 1088
1089source "arch/arm/firmware/Kconfig"
1090
1057source arch/arm/mm/Kconfig 1091source arch/arm/mm/Kconfig
1058 1092
1059config ARM_NR_BANKS 1093config ARM_NR_BANKS
@@ -1436,14 +1470,14 @@ config SMP
1436 depends on MMU || ARM_MPU 1470 depends on MMU || ARM_MPU
1437 help 1471 help
1438 This enables support for systems with more than one CPU. If you have 1472 This enables support for systems with more than one CPU. If you have
1439 a system with only one CPU, like most personal computers, say N. If 1473 a system with only one CPU, say N. If you have a system with more
1440 you have a system with more than one CPU, say Y. 1474 than one CPU, say Y.
1441 1475
1442 If you say N here, the kernel will run on single and multiprocessor 1476 If you say N here, the kernel will run on uni- and multiprocessor
1443 machines, but will use only one CPU of a multiprocessor machine. If 1477 machines, but will use only one CPU of a multiprocessor machine. If
1444 you say Y here, the kernel will run on many, but not all, single 1478 you say Y here, the kernel will run on many, but not all,
1445 processor machines. On a single processor machine, the kernel will 1479 uniprocessor machines. On a uniprocessor machine, the kernel
1446 run faster if you say N here. 1480 will run faster if you say N here.
1447 1481
1448 See also <file:Documentation/x86/i386/IO-APIC.txt>, 1482 See also <file:Documentation/x86/i386/IO-APIC.txt>,
1449 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 1483 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
@@ -1594,7 +1628,7 @@ config ARM_PSCI
1594config ARCH_NR_GPIO 1628config ARCH_NR_GPIO
1595 int 1629 int
1596 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA 1630 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
1597 default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || SOC_DRA7XX 1631 default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX
1598 default 392 if ARCH_U8500 1632 default 392 if ARCH_U8500
1599 default 352 if ARCH_VT8500 1633 default 352 if ARCH_VT8500
1600 default 288 if ARCH_SUNXI 1634 default 288 if ARCH_SUNXI
@@ -1612,7 +1646,7 @@ config HZ_FIXED
1612 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \ 1646 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \
1613 ARCH_S5PV210 || ARCH_EXYNOS4 1647 ARCH_S5PV210 || ARCH_EXYNOS4
1614 default AT91_TIMER_HZ if ARCH_AT91 1648 default AT91_TIMER_HZ if ARCH_AT91
1615 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE 1649 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE_LEGACY
1616 default 0 1650 default 0
1617 1651
1618choice 1652choice
@@ -1652,9 +1686,6 @@ config HZ
1652config SCHED_HRTICK 1686config SCHED_HRTICK
1653 def_bool HIGH_RES_TIMERS 1687 def_bool HIGH_RES_TIMERS
1654 1688
1655config SCHED_HRTICK
1656 def_bool HIGH_RES_TIMERS
1657
1658config THUMB2_KERNEL 1689config THUMB2_KERNEL
1659 bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY 1690 bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY
1660 depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K 1691 depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
@@ -1797,10 +1828,10 @@ config ARCH_WANT_GENERAL_HUGETLB
1797source "mm/Kconfig" 1828source "mm/Kconfig"
1798 1829
1799config FORCE_MAX_ZONEORDER 1830config FORCE_MAX_ZONEORDER
1800 int "Maximum zone order" if ARCH_SHMOBILE 1831 int "Maximum zone order" if ARCH_SHMOBILE_LEGACY
1801 range 11 64 if ARCH_SHMOBILE 1832 range 11 64 if ARCH_SHMOBILE_LEGACY
1802 default "12" if SOC_AM33XX 1833 default "12" if SOC_AM33XX
1803 default "9" if SA1111 1834 default "9" if SA1111 || ARCH_EFM32
1804 default "11" 1835 default "11"
1805 help 1836 help
1806 The kernel memory allocator divides physically contiguous memory 1837 The kernel memory allocator divides physically contiguous memory
@@ -1874,6 +1905,7 @@ config XEN
1874 depends on !GENERIC_ATOMIC64 1905 depends on !GENERIC_ATOMIC64
1875 select ARM_PSCI 1906 select ARM_PSCI
1876 select SWIOTLB_XEN 1907 select SWIOTLB_XEN
1908 select ARCH_DMA_ADDR_T_64BIT
1877 help 1909 help
1878 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. 1910 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM.
1879 1911
@@ -1935,6 +1967,7 @@ config ZBOOT_ROM_BSS
1935config ZBOOT_ROM 1967config ZBOOT_ROM
1936 bool "Compressed boot loader in ROM/flash" 1968 bool "Compressed boot loader in ROM/flash"
1937 depends on ZBOOT_ROM_TEXT != ZBOOT_ROM_BSS 1969 depends on ZBOOT_ROM_TEXT != ZBOOT_ROM_BSS
1970 depends on !ARM_APPENDED_DTB && !XIP_KERNEL && !AUTO_ZRELADDR
1938 help 1971 help
1939 Say Y here if you intend to execute your compressed kernel image 1972 Say Y here if you intend to execute your compressed kernel image
1940 (zImage) directly from ROM or flash. If unsure, say N. 1973 (zImage) directly from ROM or flash. If unsure, say N.
@@ -1970,7 +2003,7 @@ endchoice
1970 2003
1971config ARM_APPENDED_DTB 2004config ARM_APPENDED_DTB
1972 bool "Use appended device tree blob to zImage (EXPERIMENTAL)" 2005 bool "Use appended device tree blob to zImage (EXPERIMENTAL)"
1973 depends on OF && !ZBOOT_ROM 2006 depends on OF
1974 help 2007 help
1975 With this option, the boot code will look for a device tree binary 2008 With this option, the boot code will look for a device tree binary
1976 (DTB) appended to zImage 2009 (DTB) appended to zImage
@@ -2058,7 +2091,7 @@ endchoice
2058 2091
2059config XIP_KERNEL 2092config XIP_KERNEL
2060 bool "Kernel Execute-In-Place from ROM" 2093 bool "Kernel Execute-In-Place from ROM"
2061 depends on !ZBOOT_ROM && !ARM_LPAE && !ARCH_MULTIPLATFORM 2094 depends on !ARM_LPAE && !ARCH_MULTIPLATFORM
2062 help 2095 help
2063 Execute-In-Place allows the kernel to run from non-volatile storage 2096 Execute-In-Place allows the kernel to run from non-volatile storage
2064 directly addressable by the CPU, such as NOR flash. This saves RAM 2097 directly addressable by the CPU, such as NOR flash. This saves RAM
@@ -2121,7 +2154,6 @@ config CRASH_DUMP
2121 2154
2122config AUTO_ZRELADDR 2155config AUTO_ZRELADDR
2123 bool "Auto calculation of the decompressed kernel image address" 2156 bool "Auto calculation of the decompressed kernel image address"
2124 depends on !ZBOOT_ROM
2125 help 2157 help
2126 ZRELADDR is the physical address where the decompressed kernel 2158 ZRELADDR is the physical address where the decompressed kernel
2127 image will be placed. If AUTO_ZRELADDR is selected, the address 2159 image will be placed. If AUTO_ZRELADDR is selected, the address
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 5765abf5ce84..0531da8e5216 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -2,6 +2,18 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config ARM_PTDUMP
6 bool "Export kernel pagetable layout to userspace via debugfs"
7 depends on DEBUG_KERNEL
8 select DEBUG_FS
9 ---help---
10 Say Y here if you want to show the kernel pagetable layout in a
11 debugfs file. This information is only useful for kernel developers
12 who are working in architecture specific areas of the kernel.
13 It is probably not a good idea to enable this feature in a production
14 kernel.
15 If in doubt, say "N"
16
5config STRICT_DEVMEM 17config STRICT_DEVMEM
6 bool "Filter access to /dev/mem" 18 bool "Filter access to /dev/mem"
7 depends on MMU 19 depends on MMU
@@ -94,6 +106,25 @@ choice
94 depends on ARCH_BCM2835 106 depends on ARCH_BCM2835
95 select DEBUG_UART_PL01X 107 select DEBUG_UART_PL01X
96 108
109 config DEBUG_BCM_KONA_UART
110 bool "Kernel low-level debugging messages via BCM KONA UART"
111 depends on ARCH_BCM
112 select DEBUG_UART_8250
113 help
114 Say Y here if you want kernel low-level debugging support
115 on Broadcom SoC platforms.
116 This low level debug works for Broadcom
117 mobile SoCs in the Kona family of chips (e.g. bcm28155,
118 bcm11351, etc...)
119
120 config DEBUG_BERLIN_UART
121 bool "Marvell Berlin SoC Debug UART"
122 depends on ARCH_BERLIN
123 select DEBUG_UART_8250
124 help
125 Say Y here if you want kernel low-level debugging support
126 on Marvell Berlin SoC based platforms.
127
97 config DEBUG_CLPS711X_UART1 128 config DEBUG_CLPS711X_UART1
98 bool "Kernel low-level debugging messages via UART1" 129 bool "Kernel low-level debugging messages via UART1"
99 depends on ARCH_CLPS711X 130 depends on ARCH_CLPS711X
@@ -255,6 +286,13 @@ choice
255 Say Y here if you want kernel low-level debugging support 286 Say Y here if you want kernel low-level debugging support
256 on i.MX35. 287 on i.MX35.
257 288
289 config DEBUG_IMX50_UART
290 bool "i.MX50 Debug UART"
291 depends on SOC_IMX50
292 help
293 Say Y here if you want kernel low-level debugging support
294 on i.MX50.
295
258 config DEBUG_IMX51_UART 296 config DEBUG_IMX51_UART
259 bool "i.MX51 Debug UART" 297 bool "i.MX51 Debug UART"
260 depends on SOC_IMX51 298 depends on SOC_IMX51
@@ -897,6 +935,7 @@ config DEBUG_IMX_UART_PORT
897 DEBUG_IMX21_IMX27_UART || \ 935 DEBUG_IMX21_IMX27_UART || \
898 DEBUG_IMX31_UART || \ 936 DEBUG_IMX31_UART || \
899 DEBUG_IMX35_UART || \ 937 DEBUG_IMX35_UART || \
938 DEBUG_IMX50_UART || \
900 DEBUG_IMX51_UART || \ 939 DEBUG_IMX51_UART || \
901 DEBUG_IMX53_UART || \ 940 DEBUG_IMX53_UART || \
902 DEBUG_IMX6Q_UART || \ 941 DEBUG_IMX6Q_UART || \
@@ -931,6 +970,7 @@ config DEBUG_LL_INCLUDE
931 DEBUG_IMX21_IMX27_UART || \ 970 DEBUG_IMX21_IMX27_UART || \
932 DEBUG_IMX31_UART || \ 971 DEBUG_IMX31_UART || \
933 DEBUG_IMX35_UART || \ 972 DEBUG_IMX35_UART || \
973 DEBUG_IMX50_UART || \
934 DEBUG_IMX51_UART || \ 974 DEBUG_IMX51_UART || \
935 DEBUG_IMX53_UART ||\ 975 DEBUG_IMX53_UART ||\
936 DEBUG_IMX6Q_UART || \ 976 DEBUG_IMX6Q_UART || \
@@ -988,6 +1028,7 @@ config DEBUG_UART_PHYS
988 default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2 1028 default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
989 default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3 1029 default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3
990 default 0x20201000 if DEBUG_BCM2835 1030 default 0x20201000 if DEBUG_BCM2835
1031 default 0x3e000000 if DEBUG_BCM_KONA_UART
991 default 0x4000e400 if DEBUG_LL_UART_EFM32 1032 default 0x4000e400 if DEBUG_LL_UART_EFM32
992 default 0x40090000 if ARCH_LPC32XX 1033 default 0x40090000 if ARCH_LPC32XX
993 default 0x40100000 if DEBUG_PXA_UART1 1034 default 0x40100000 if DEBUG_PXA_UART1
@@ -1011,6 +1052,7 @@ config DEBUG_UART_PHYS
1011 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE 1052 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
1012 default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \ 1053 default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \
1013 ARCH_ORION5X 1054 ARCH_ORION5X
1055 default 0xf7fc9000 if DEBUG_BERLIN_UART
1014 default 0xf8b00000 if DEBUG_HI3716_UART 1056 default 0xf8b00000 if DEBUG_HI3716_UART
1015 default 0xfcb00000 if DEBUG_HI3620_UART 1057 default 0xfcb00000 if DEBUG_HI3620_UART
1016 default 0xfe800000 if ARCH_IOP32X 1058 default 0xfe800000 if ARCH_IOP32X
@@ -1036,6 +1078,7 @@ config DEBUG_UART_VIRT
1036 default 0xf2100000 if DEBUG_PXA_UART1 1078 default 0xf2100000 if DEBUG_PXA_UART1
1037 default 0xf4090000 if ARCH_LPC32XX 1079 default 0xf4090000 if ARCH_LPC32XX
1038 default 0xf4200000 if ARCH_GEMINI 1080 default 0xf4200000 if ARCH_GEMINI
1081 default 0xf7fc9000 if DEBUG_BERLIN_UART
1039 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9 1082 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
1040 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1 1083 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1
1041 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT 1084 default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
@@ -1049,6 +1092,7 @@ config DEBUG_UART_VIRT
1049 default 0xfe018000 if DEBUG_MMP_UART3 1092 default 0xfe018000 if DEBUG_MMP_UART3
1050 default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART 1093 default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART
1051 default 0xfe230000 if DEBUG_PICOXCELL_UART 1094 default 0xfe230000 if DEBUG_PICOXCELL_UART
1095 default 0xfe300000 if DEBUG_BCM_KONA_UART
1052 default 0xfe800000 if ARCH_IOP32X 1096 default 0xfe800000 if ARCH_IOP32X
1053 default 0xfeb00000 if DEBUG_HI3620_UART || DEBUG_HI3716_UART 1097 default 0xfeb00000 if DEBUG_HI3620_UART || DEBUG_HI3716_UART
1054 default 0xfeb24000 if DEBUG_RK3X_UART0 1098 default 0xfeb24000 if DEBUG_RK3X_UART0
@@ -1091,7 +1135,8 @@ config DEBUG_UART_8250_WORD
1091 default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \ 1135 default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
1092 ARCH_KEYSTONE || \ 1136 ARCH_KEYSTONE || \
1093 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \ 1137 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
1094 DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_DAVINCI_TNETV107X_UART1 1138 DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_DAVINCI_TNETV107X_UART1 || \
1139 DEBUG_BCM_KONA_UART
1095 1140
1096config DEBUG_UART_8250_FLOW_CONTROL 1141config DEBUG_UART_8250_FLOW_CONTROL
1097 bool "Enable flow control for 8250 UART" 1142 bool "Enable flow control for 8250 UART"
@@ -1150,4 +1195,15 @@ config PID_IN_CONTEXTIDR
1150 additional instructions during context switch. Say Y here only if you 1195 additional instructions during context switch. Say Y here only if you
1151 are planning to use hardware trace tools with this kernel. 1196 are planning to use hardware trace tools with this kernel.
1152 1197
1198config DEBUG_SET_MODULE_RONX
1199 bool "Set loadable kernel module data as NX and text as RO"
1200 depends on MODULES
1201 ---help---
1202 This option helps catch unintended modifications to loadable
1203 kernel module's text and read-only data. It also prevents execution
1204 of module data. Such protection may interfere with run-time code
1205 patching and dynamic kernel tracing - and they might also protect
1206 against certain classes of kernel exploits.
1207 If in doubt, say "N".
1208
1153endmenu 1209endmenu
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 55b4255ad6ed..08a9ef58d9c3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -96,7 +96,7 @@ tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
96tune-y := $(tune-y) 96tune-y := $(tune-y)
97 97
98ifeq ($(CONFIG_AEABI),y) 98ifeq ($(CONFIG_AEABI),y)
99CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork 99CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
100else 100else
101CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) 101CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
102endif 102endif
@@ -144,15 +144,18 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
144machine-$(CONFIG_ARCH_AT91) += at91 144machine-$(CONFIG_ARCH_AT91) += at91
145machine-$(CONFIG_ARCH_BCM) += bcm 145machine-$(CONFIG_ARCH_BCM) += bcm
146machine-$(CONFIG_ARCH_BCM2835) += bcm2835 146machine-$(CONFIG_ARCH_BCM2835) += bcm2835
147machine-$(CONFIG_ARCH_BERLIN) += berlin
147machine-$(CONFIG_ARCH_CLPS711X) += clps711x 148machine-$(CONFIG_ARCH_CLPS711X) += clps711x
148machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx 149machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
149machine-$(CONFIG_ARCH_DAVINCI) += davinci 150machine-$(CONFIG_ARCH_DAVINCI) += davinci
150machine-$(CONFIG_ARCH_DOVE) += dove 151machine-$(CONFIG_ARCH_DOVE) += dove
151machine-$(CONFIG_ARCH_EBSA110) += ebsa110 152machine-$(CONFIG_ARCH_EBSA110) += ebsa110
153machine-$(CONFIG_ARCH_EFM32) += efm32
152machine-$(CONFIG_ARCH_EP93XX) += ep93xx 154machine-$(CONFIG_ARCH_EP93XX) += ep93xx
153machine-$(CONFIG_ARCH_EXYNOS) += exynos 155machine-$(CONFIG_ARCH_EXYNOS) += exynos
154machine-$(CONFIG_ARCH_GEMINI) += gemini 156machine-$(CONFIG_ARCH_GEMINI) += gemini
155machine-$(CONFIG_ARCH_HIGHBANK) += highbank 157machine-$(CONFIG_ARCH_HIGHBANK) += highbank
158machine-$(CONFIG_ARCH_HI3xxx) += hisi
156machine-$(CONFIG_ARCH_INTEGRATOR) += integrator 159machine-$(CONFIG_ARCH_INTEGRATOR) += integrator
157machine-$(CONFIG_ARCH_IOP13XX) += iop13xx 160machine-$(CONFIG_ARCH_IOP13XX) += iop13xx
158machine-$(CONFIG_ARCH_IOP32X) += iop32x 161machine-$(CONFIG_ARCH_IOP32X) += iop32x
@@ -163,6 +166,7 @@ machine-$(CONFIG_ARCH_KIRKWOOD) += kirkwood
163machine-$(CONFIG_ARCH_KS8695) += ks8695 166machine-$(CONFIG_ARCH_KS8695) += ks8695
164machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx 167machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx
165machine-$(CONFIG_ARCH_MMP) += mmp 168machine-$(CONFIG_ARCH_MMP) += mmp
169machine-$(CONFIG_ARCH_MOXART) += moxart
166machine-$(CONFIG_ARCH_MSM) += msm 170machine-$(CONFIG_ARCH_MSM) += msm
167machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0 171machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0
168machine-$(CONFIG_ARCH_MVEBU) += mvebu 172machine-$(CONFIG_ARCH_MVEBU) += mvebu
@@ -186,7 +190,6 @@ machine-$(CONFIG_ARCH_S5PC100) += s5pc100
186machine-$(CONFIG_ARCH_S5PV210) += s5pv210 190machine-$(CONFIG_ARCH_S5PV210) += s5pv210
187machine-$(CONFIG_ARCH_SA1100) += sa1100 191machine-$(CONFIG_ARCH_SA1100) += sa1100
188machine-$(CONFIG_ARCH_SHMOBILE) += shmobile 192machine-$(CONFIG_ARCH_SHMOBILE) += shmobile
189machine-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile
190machine-$(CONFIG_ARCH_SIRF) += prima2 193machine-$(CONFIG_ARCH_SIRF) += prima2
191machine-$(CONFIG_ARCH_SOCFPGA) += socfpga 194machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
192machine-$(CONFIG_ARCH_STI) += sti 195machine-$(CONFIG_ARCH_STI) += sti
@@ -264,6 +267,7 @@ core-$(CONFIG_KVM_ARM_HOST) += arch/arm/kvm/
264core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ 267core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
265core-y += arch/arm/net/ 268core-y += arch/arm/net/
266core-y += arch/arm/crypto/ 269core-y += arch/arm/crypto/
270core-y += arch/arm/firmware/
267core-y += $(machdirs) $(platdirs) 271core-y += $(machdirs) $(platdirs)
268 272
269drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ 273drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index e7190bb5998e..68c918362b79 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -64,7 +64,7 @@ else
64endif 64endif
65endif 65endif
66 66
67ifeq ($(CONFIG_ARCH_SHMOBILE),y) 67ifeq ($(CONFIG_ARCH_SHMOBILE_LEGACY),y)
68OBJS += head-shmobile.o 68OBJS += head-shmobile.o
69endif 69endif
70 70
@@ -108,12 +108,12 @@ endif
108 108
109targets := vmlinux vmlinux.lds \ 109targets := vmlinux vmlinux.lds \
110 piggy.$(suffix_y) piggy.$(suffix_y).o \ 110 piggy.$(suffix_y) piggy.$(suffix_y).o \
111 lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \ 111 lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S bswapsdi2.o \
112 font.o font.c head.o misc.o $(OBJS) 112 bswapsdi2.S font.o font.c head.o misc.o $(OBJS)
113 113
114# Make sure files are removed during clean 114# Make sure files are removed during clean
115extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \ 115extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
116 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \ 116 lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \
117 hyp-stub.S 117 hyp-stub.S
118 118
119ifeq ($(CONFIG_FUNCTION_TRACER),y) 119ifeq ($(CONFIG_FUNCTION_TRACER),y)
@@ -156,6 +156,12 @@ ashldi3 = $(obj)/ashldi3.o
156$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S 156$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
157 $(call cmd,shipped) 157 $(call cmd,shipped)
158 158
159# For __bswapsi2, __bswapdi2
160bswapsdi2 = $(obj)/bswapsdi2.o
161
162$(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S
163 $(call cmd,shipped)
164
159# We need to prevent any GOTOFF relocs being used with references 165# We need to prevent any GOTOFF relocs being used with references
160# to symbols in the .bss section since we cannot relocate them 166# to symbols in the .bss section since we cannot relocate them
161# independently from the rest at run time. This can be achieved by 167# independently from the rest at run time. This can be achieved by
@@ -177,7 +183,8 @@ if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
177fi 183fi
178 184
179$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 185$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
180 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE 186 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \
187 $(bswapsdi2) FORCE
181 @$(check_for_multiple_zreladdr) 188 @$(check_for_multiple_zreladdr)
182 $(call if_changed,ld) 189 $(call if_changed,ld)
183 @$(check_for_bad_syms) 190 @$(check_for_bad_syms)
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index d57c1a65b24f..b9d6a8b485e0 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb
6dtb-$(CONFIG_ARCH_AT91) += mpa1600.dtb 6dtb-$(CONFIG_ARCH_AT91) += mpa1600.dtb
7# sam9260 7# sam9260
8dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb 8dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb
9dtb-$(CONFIG_ARCH_AT91) += at91-qil_a9260.dtb
9dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb 10dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb
10dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb 11dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb
11dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb 12dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb
@@ -30,6 +31,7 @@ dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb
30dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb 31dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb
31# sam9x5 32# sam9x5
32dtb-$(CONFIG_ARCH_AT91) += at91-ariag25.dtb 33dtb-$(CONFIG_ARCH_AT91) += at91-ariag25.dtb
34dtb-$(CONFIG_ARCH_AT91) += at91-cosino_mega2560.dtb
33dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb 35dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb
34dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb 36dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb
35dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb 37dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb
@@ -40,11 +42,16 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb
40dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb 42dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
41dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb 43dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
42dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb 44dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
45dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb
46
43dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb 47dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
44dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 48dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
45dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm11351-brt.dtb \ 49dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm11351-brt.dtb \
46 bcm28155-ap.dtb 50 bcm28155-ap.dtb
47dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 51dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
52dtb-$(CONFIG_ARCH_BERLIN) += \
53 berlin2-sony-nsz-gs7.dtb \
54 berlin2cd-google-chromecast.dtb
48dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ 55dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
49 da850-evm.dtb 56 da850-evm.dtb
50dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ 57dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
@@ -52,6 +59,7 @@ dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
52 dove-d2plug.dtb \ 59 dove-d2plug.dtb \
53 dove-d3plug.dtb \ 60 dove-d3plug.dtb \
54 dove-dove-db.dtb 61 dove-dove-db.dtb
62dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb
55dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ 63dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
56 exynos4210-smdkv310.dtb \ 64 exynos4210-smdkv310.dtb \
57 exynos4210-trats.dtb \ 65 exynos4210-trats.dtb \
@@ -59,13 +67,16 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
59 exynos4412-odroidx.dtb \ 67 exynos4412-odroidx.dtb \
60 exynos4412-origen.dtb \ 68 exynos4412-origen.dtb \
61 exynos4412-smdk4412.dtb \ 69 exynos4412-smdk4412.dtb \
70 exynos4412-tiny4412.dtb \
62 exynos4412-trats2.dtb \ 71 exynos4412-trats2.dtb \
63 exynos5250-arndale.dtb \ 72 exynos5250-arndale.dtb \
64 exynos5250-smdk5250.dtb \ 73 exynos5250-smdk5250.dtb \
65 exynos5250-snow.dtb \ 74 exynos5250-snow.dtb \
75 exynos5420-arndale-octa.dtb \
66 exynos5420-smdk5420.dtb \ 76 exynos5420-smdk5420.dtb \
67 exynos5440-sd5v1.dtb \ 77 exynos5440-sd5v1.dtb \
68 exynos5440-ssdk5440.dtb 78 exynos5440-ssdk5440.dtb
79dtb-$(CONFIG_ARCH_HI3xxx) += hi3620-hi4511.dtb
69dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ 80dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
70 ecx-2000.dtb 81 ecx-2000.dtb
71dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ 82dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
@@ -85,11 +96,13 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
85 kirkwood-iomega_ix2_200.dtb \ 96 kirkwood-iomega_ix2_200.dtb \
86 kirkwood-is2.dtb \ 97 kirkwood-is2.dtb \
87 kirkwood-km_kirkwood.dtb \ 98 kirkwood-km_kirkwood.dtb \
99 kirkwood-laplug.dtb \
88 kirkwood-lschlv2.dtb \ 100 kirkwood-lschlv2.dtb \
89 kirkwood-lsxhl.dtb \ 101 kirkwood-lsxhl.dtb \
90 kirkwood-mplcec4.dtb \ 102 kirkwood-mplcec4.dtb \
91 kirkwood-mv88f6281gtw-ge.dtb \ 103 kirkwood-mv88f6281gtw-ge.dtb \
92 kirkwood-netgear_readynas_duo_v2.dtb \ 104 kirkwood-netgear_readynas_duo_v2.dtb \
105 kirkwood-netgear_readynas_nv+_v2.dtb \
93 kirkwood-ns2.dtb \ 106 kirkwood-ns2.dtb \
94 kirkwood-ns2lite.dtb \ 107 kirkwood-ns2lite.dtb \
95 kirkwood-ns2max.dtb \ 108 kirkwood-ns2max.dtb \
@@ -104,8 +117,10 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
104 kirkwood-ts219-6281.dtb \ 117 kirkwood-ts219-6281.dtb \
105 kirkwood-ts219-6282.dtb 118 kirkwood-ts219-6282.dtb
106dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb 119dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
120dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb
107dtb-$(CONFIG_ARCH_MSM) += qcom-msm8660-surf.dtb \ 121dtb-$(CONFIG_ARCH_MSM) += qcom-msm8660-surf.dtb \
108 qcom-msm8960-cdp.dtb 122 qcom-msm8960-cdp.dtb \
123 qcom-apq8074-dragonboard.dtb
109dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \ 124dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
110 armada-370-mirabox.dtb \ 125 armada-370-mirabox.dtb \
111 armada-370-netgear-rn102.dtb \ 126 armada-370-netgear-rn102.dtb \
@@ -114,6 +129,7 @@ dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
114 armada-xp-axpwifiap.dtb \ 129 armada-xp-axpwifiap.dtb \
115 armada-xp-db.dtb \ 130 armada-xp-db.dtb \
116 armada-xp-gp.dtb \ 131 armada-xp-gp.dtb \
132 armada-xp-netgear-rn2120.dtb \
117 armada-xp-matrix.dtb \ 133 armada-xp-matrix.dtb \
118 armada-xp-openblocks-ax3-4.dtb 134 armada-xp-openblocks-ax3-4.dtb
119dtb-$(CONFIG_ARCH_MXC) += \ 135dtb-$(CONFIG_ARCH_MXC) += \
@@ -136,10 +152,13 @@ dtb-$(CONFIG_ARCH_MXC) += \
136 imx53-mba53.dtb \ 152 imx53-mba53.dtb \
137 imx53-qsb.dtb \ 153 imx53-qsb.dtb \
138 imx53-smd.dtb \ 154 imx53-smd.dtb \
155 imx6dl-cubox-i.dtb \
156 imx6dl-hummingboard.dtb \
139 imx6dl-sabreauto.dtb \ 157 imx6dl-sabreauto.dtb \
140 imx6dl-sabresd.dtb \ 158 imx6dl-sabresd.dtb \
141 imx6dl-wandboard.dtb \ 159 imx6dl-wandboard.dtb \
142 imx6q-arm2.dtb \ 160 imx6q-arm2.dtb \
161 imx6q-cubox-i.dtb \
143 imx6q-phytec-pbab01.dtb \ 162 imx6q-phytec-pbab01.dtb \
144 imx6q-sabreauto.dtb \ 163 imx6q-sabreauto.dtb \
145 imx6q-sabrelite.dtb \ 164 imx6q-sabrelite.dtb \
@@ -173,12 +192,19 @@ dtb-$(CONFIG_ARCH_NSPIRE) += nspire-cx.dtb \
173 nspire-tp.dtb \ 192 nspire-tp.dtb \
174 nspire-clp.dtb 193 nspire-clp.dtb
175dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \ 194dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
195 omap2430-sdp.dtb \
196 omap2420-n800.dtb \
197 omap2420-n810.dtb \
198 omap2420-n810-wimax.dtb \
176 omap3430-sdp.dtb \ 199 omap3430-sdp.dtb \
177 omap3-beagle.dtb \ 200 omap3-beagle.dtb \
201 omap3-cm-t3730.dtb \
202 omap3-sbc-t3730.dtb \
178 omap3-devkit8000.dtb \ 203 omap3-devkit8000.dtb \
179 omap3-beagle-xm.dtb \ 204 omap3-beagle-xm.dtb \
180 omap3-evm.dtb \ 205 omap3-evm.dtb \
181 omap3-evm-37xx.dtb \ 206 omap3-evm-37xx.dtb \
207 omap3-ldp.dtb \
182 omap3-n900.dtb \ 208 omap3-n900.dtb \
183 omap3-n9.dtb \ 209 omap3-n9.dtb \
184 omap3-n950.dtb \ 210 omap3-n950.dtb \
@@ -216,8 +242,9 @@ dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
216dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb 242dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
217dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \ 243dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
218 s3c6410-smdk6410.dtb 244 s3c6410-smdk6410.dtb
219dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ 245dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += emev2-kzm9d.dtb \
220 r7s72100-genmai.dtb \ 246 r7s72100-genmai.dtb \
247 r7s72100-genmai-reference.dtb \
221 r8a7740-armadillo800eva.dtb \ 248 r8a7740-armadillo800eva.dtb \
222 r8a7778-bockw.dtb \ 249 r8a7778-bockw.dtb \
223 r8a7778-bockw-reference.dtb \ 250 r8a7778-bockw-reference.dtb \
@@ -226,13 +253,15 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
226 r8a7779-marzen-reference.dtb \ 253 r8a7779-marzen-reference.dtb \
227 r8a7791-koelsch.dtb \ 254 r8a7791-koelsch.dtb \
228 r8a7790-lager.dtb \ 255 r8a7790-lager.dtb \
229 r8a7790-lager-reference.dtb \
230 sh73a0-kzm9g.dtb \ 256 sh73a0-kzm9g.dtb \
231 sh73a0-kzm9g-reference.dtb \ 257 sh73a0-kzm9g-reference.dtb \
232 r8a73a4-ape6evm.dtb \ 258 r8a73a4-ape6evm.dtb \
233 r8a73a4-ape6evm-reference.dtb \ 259 r8a73a4-ape6evm-reference.dtb \
234 sh7372-mackerel.dtb 260 sh7372-mackerel.dtb
235dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb 261dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
262 r7s72100-genmai-reference.dtb \
263 r8a7791-koelsch.dtb \
264 r8a7790-lager.dtb
236dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \ 265dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
237 socfpga_cyclone5_socdk.dtb \ 266 socfpga_cyclone5_socdk.dtb \
238 socfpga_cyclone5_sockit.dtb \ 267 socfpga_cyclone5_sockit.dtb \
@@ -255,6 +284,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += \
255 sun4i-a10-hackberry.dtb \ 284 sun4i-a10-hackberry.dtb \
256 sun5i-a10s-olinuxino-micro.dtb \ 285 sun5i-a10s-olinuxino-micro.dtb \
257 sun5i-a13-olinuxino.dtb \ 286 sun5i-a13-olinuxino.dtb \
287 sun5i-a13-olinuxino-micro.dtb \
258 sun6i-a31-colombus.dtb \ 288 sun6i-a31-colombus.dtb \
259 sun7i-a20-cubieboard2.dtb \ 289 sun7i-a20-cubieboard2.dtb \
260 sun7i-a20-cubietruck.dtb \ 290 sun7i-a20-cubietruck.dtb \
diff --git a/arch/arm/boot/dts/am33xx-clocks.dtsi b/arch/arm/boot/dts/am33xx-clocks.dtsi
new file mode 100644
index 000000000000..9ccfe508dea2
--- /dev/null
+++ b/arch/arm/boot/dts/am33xx-clocks.dtsi
@@ -0,0 +1,664 @@
1/*
2 * Device Tree Source for AM33xx clock data
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&scrm_clocks {
11 sys_clkin_ck: sys_clkin_ck {
12 #clock-cells = <0>;
13 compatible = "ti,mux-clock";
14 clocks = <&virt_19200000_ck>, <&virt_24000000_ck>, <&virt_25000000_ck>, <&virt_26000000_ck>;
15 ti,bit-shift = <22>;
16 reg = <0x0040>;
17 };
18
19 adc_tsc_fck: adc_tsc_fck {
20 #clock-cells = <0>;
21 compatible = "fixed-factor-clock";
22 clocks = <&sys_clkin_ck>;
23 clock-mult = <1>;
24 clock-div = <1>;
25 };
26
27 dcan0_fck: dcan0_fck {
28 #clock-cells = <0>;
29 compatible = "fixed-factor-clock";
30 clocks = <&sys_clkin_ck>;
31 clock-mult = <1>;
32 clock-div = <1>;
33 };
34
35 dcan1_fck: dcan1_fck {
36 #clock-cells = <0>;
37 compatible = "fixed-factor-clock";
38 clocks = <&sys_clkin_ck>;
39 clock-mult = <1>;
40 clock-div = <1>;
41 };
42
43 mcasp0_fck: mcasp0_fck {
44 #clock-cells = <0>;
45 compatible = "fixed-factor-clock";
46 clocks = <&sys_clkin_ck>;
47 clock-mult = <1>;
48 clock-div = <1>;
49 };
50
51 mcasp1_fck: mcasp1_fck {
52 #clock-cells = <0>;
53 compatible = "fixed-factor-clock";
54 clocks = <&sys_clkin_ck>;
55 clock-mult = <1>;
56 clock-div = <1>;
57 };
58
59 smartreflex0_fck: smartreflex0_fck {
60 #clock-cells = <0>;
61 compatible = "fixed-factor-clock";
62 clocks = <&sys_clkin_ck>;
63 clock-mult = <1>;
64 clock-div = <1>;
65 };
66
67 smartreflex1_fck: smartreflex1_fck {
68 #clock-cells = <0>;
69 compatible = "fixed-factor-clock";
70 clocks = <&sys_clkin_ck>;
71 clock-mult = <1>;
72 clock-div = <1>;
73 };
74
75 sha0_fck: sha0_fck {
76 #clock-cells = <0>;
77 compatible = "fixed-factor-clock";
78 clocks = <&sys_clkin_ck>;
79 clock-mult = <1>;
80 clock-div = <1>;
81 };
82
83 aes0_fck: aes0_fck {
84 #clock-cells = <0>;
85 compatible = "fixed-factor-clock";
86 clocks = <&sys_clkin_ck>;
87 clock-mult = <1>;
88 clock-div = <1>;
89 };
90
91 rng_fck: rng_fck {
92 #clock-cells = <0>;
93 compatible = "fixed-factor-clock";
94 clocks = <&sys_clkin_ck>;
95 clock-mult = <1>;
96 clock-div = <1>;
97 };
98
99 ehrpwm0_gate_tbclk: ehrpwm0_gate_tbclk {
100 #clock-cells = <0>;
101 compatible = "ti,composite-no-wait-gate-clock";
102 clocks = <&dpll_per_m2_ck>;
103 ti,bit-shift = <0>;
104 reg = <0x0664>;
105 };
106
107 ehrpwm0_tbclk: ehrpwm0_tbclk {
108 #clock-cells = <0>;
109 compatible = "ti,composite-clock";
110 clocks = <&ehrpwm0_gate_tbclk>;
111 };
112
113 ehrpwm1_gate_tbclk: ehrpwm1_gate_tbclk {
114 #clock-cells = <0>;
115 compatible = "ti,composite-no-wait-gate-clock";
116 clocks = <&dpll_per_m2_ck>;
117 ti,bit-shift = <1>;
118 reg = <0x0664>;
119 };
120
121 ehrpwm1_tbclk: ehrpwm1_tbclk {
122 #clock-cells = <0>;
123 compatible = "ti,composite-clock";
124 clocks = <&ehrpwm1_gate_tbclk>;
125 };
126
127 ehrpwm2_gate_tbclk: ehrpwm2_gate_tbclk {
128 #clock-cells = <0>;
129 compatible = "ti,composite-no-wait-gate-clock";
130 clocks = <&dpll_per_m2_ck>;
131 ti,bit-shift = <2>;
132 reg = <0x0664>;
133 };
134
135 ehrpwm2_tbclk: ehrpwm2_tbclk {
136 #clock-cells = <0>;
137 compatible = "ti,composite-clock";
138 clocks = <&ehrpwm2_gate_tbclk>;
139 };
140};
141&prcm_clocks {
142 clk_32768_ck: clk_32768_ck {
143 #clock-cells = <0>;
144 compatible = "fixed-clock";
145 clock-frequency = <32768>;
146 };
147
148 clk_rc32k_ck: clk_rc32k_ck {
149 #clock-cells = <0>;
150 compatible = "fixed-clock";
151 clock-frequency = <32000>;
152 };
153
154 virt_19200000_ck: virt_19200000_ck {
155 #clock-cells = <0>;
156 compatible = "fixed-clock";
157 clock-frequency = <19200000>;
158 };
159
160 virt_24000000_ck: virt_24000000_ck {
161 #clock-cells = <0>;
162 compatible = "fixed-clock";
163 clock-frequency = <24000000>;
164 };
165
166 virt_25000000_ck: virt_25000000_ck {
167 #clock-cells = <0>;
168 compatible = "fixed-clock";
169 clock-frequency = <25000000>;
170 };
171
172 virt_26000000_ck: virt_26000000_ck {
173 #clock-cells = <0>;
174 compatible = "fixed-clock";
175 clock-frequency = <26000000>;
176 };
177
178 tclkin_ck: tclkin_ck {
179 #clock-cells = <0>;
180 compatible = "fixed-clock";
181 clock-frequency = <12000000>;
182 };
183
184 dpll_core_ck: dpll_core_ck {
185 #clock-cells = <0>;
186 compatible = "ti,am3-dpll-core-clock";
187 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
188 reg = <0x0490>, <0x045c>, <0x0468>;
189 };
190
191 dpll_core_x2_ck: dpll_core_x2_ck {
192 #clock-cells = <0>;
193 compatible = "ti,am3-dpll-x2-clock";
194 clocks = <&dpll_core_ck>;
195 };
196
197 dpll_core_m4_ck: dpll_core_m4_ck {
198 #clock-cells = <0>;
199 compatible = "ti,divider-clock";
200 clocks = <&dpll_core_x2_ck>;
201 ti,max-div = <31>;
202 reg = <0x0480>;
203 ti,index-starts-at-one;
204 };
205
206 dpll_core_m5_ck: dpll_core_m5_ck {
207 #clock-cells = <0>;
208 compatible = "ti,divider-clock";
209 clocks = <&dpll_core_x2_ck>;
210 ti,max-div = <31>;
211 reg = <0x0484>;
212 ti,index-starts-at-one;
213 };
214
215 dpll_core_m6_ck: dpll_core_m6_ck {
216 #clock-cells = <0>;
217 compatible = "ti,divider-clock";
218 clocks = <&dpll_core_x2_ck>;
219 ti,max-div = <31>;
220 reg = <0x04d8>;
221 ti,index-starts-at-one;
222 };
223
224 dpll_mpu_ck: dpll_mpu_ck {
225 #clock-cells = <0>;
226 compatible = "ti,am3-dpll-clock";
227 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
228 reg = <0x0488>, <0x0420>, <0x042c>;
229 };
230
231 dpll_mpu_m2_ck: dpll_mpu_m2_ck {
232 #clock-cells = <0>;
233 compatible = "ti,divider-clock";
234 clocks = <&dpll_mpu_ck>;
235 ti,max-div = <31>;
236 reg = <0x04a8>;
237 ti,index-starts-at-one;
238 };
239
240 dpll_ddr_ck: dpll_ddr_ck {
241 #clock-cells = <0>;
242 compatible = "ti,am3-dpll-no-gate-clock";
243 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
244 reg = <0x0494>, <0x0434>, <0x0440>;
245 };
246
247 dpll_ddr_m2_ck: dpll_ddr_m2_ck {
248 #clock-cells = <0>;
249 compatible = "ti,divider-clock";
250 clocks = <&dpll_ddr_ck>;
251 ti,max-div = <31>;
252 reg = <0x04a0>;
253 ti,index-starts-at-one;
254 };
255
256 dpll_ddr_m2_div2_ck: dpll_ddr_m2_div2_ck {
257 #clock-cells = <0>;
258 compatible = "fixed-factor-clock";
259 clocks = <&dpll_ddr_m2_ck>;
260 clock-mult = <1>;
261 clock-div = <2>;
262 };
263
264 dpll_disp_ck: dpll_disp_ck {
265 #clock-cells = <0>;
266 compatible = "ti,am3-dpll-no-gate-clock";
267 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
268 reg = <0x0498>, <0x0448>, <0x0454>;
269 };
270
271 dpll_disp_m2_ck: dpll_disp_m2_ck {
272 #clock-cells = <0>;
273 compatible = "ti,divider-clock";
274 clocks = <&dpll_disp_ck>;
275 ti,max-div = <31>;
276 reg = <0x04a4>;
277 ti,index-starts-at-one;
278 ti,set-rate-parent;
279 };
280
281 dpll_per_ck: dpll_per_ck {
282 #clock-cells = <0>;
283 compatible = "ti,am3-dpll-no-gate-j-type-clock";
284 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
285 reg = <0x048c>, <0x0470>, <0x049c>;
286 };
287
288 dpll_per_m2_ck: dpll_per_m2_ck {
289 #clock-cells = <0>;
290 compatible = "ti,divider-clock";
291 clocks = <&dpll_per_ck>;
292 ti,max-div = <31>;
293 reg = <0x04ac>;
294 ti,index-starts-at-one;
295 };
296
297 dpll_per_m2_div4_wkupdm_ck: dpll_per_m2_div4_wkupdm_ck {
298 #clock-cells = <0>;
299 compatible = "fixed-factor-clock";
300 clocks = <&dpll_per_m2_ck>;
301 clock-mult = <1>;
302 clock-div = <4>;
303 };
304
305 dpll_per_m2_div4_ck: dpll_per_m2_div4_ck {
306 #clock-cells = <0>;
307 compatible = "fixed-factor-clock";
308 clocks = <&dpll_per_m2_ck>;
309 clock-mult = <1>;
310 clock-div = <4>;
311 };
312
313 cefuse_fck: cefuse_fck {
314 #clock-cells = <0>;
315 compatible = "ti,gate-clock";
316 clocks = <&sys_clkin_ck>;
317 ti,bit-shift = <1>;
318 reg = <0x0a20>;
319 };
320
321 clk_24mhz: clk_24mhz {
322 #clock-cells = <0>;
323 compatible = "fixed-factor-clock";
324 clocks = <&dpll_per_m2_ck>;
325 clock-mult = <1>;
326 clock-div = <8>;
327 };
328
329 clkdiv32k_ck: clkdiv32k_ck {
330 #clock-cells = <0>;
331 compatible = "fixed-factor-clock";
332 clocks = <&clk_24mhz>;
333 clock-mult = <1>;
334 clock-div = <732>;
335 };
336
337 clkdiv32k_ick: clkdiv32k_ick {
338 #clock-cells = <0>;
339 compatible = "ti,gate-clock";
340 clocks = <&clkdiv32k_ck>;
341 ti,bit-shift = <1>;
342 reg = <0x014c>;
343 };
344
345 l3_gclk: l3_gclk {
346 #clock-cells = <0>;
347 compatible = "fixed-factor-clock";
348 clocks = <&dpll_core_m4_ck>;
349 clock-mult = <1>;
350 clock-div = <1>;
351 };
352
353 pruss_ocp_gclk: pruss_ocp_gclk {
354 #clock-cells = <0>;
355 compatible = "ti,mux-clock";
356 clocks = <&l3_gclk>, <&dpll_disp_m2_ck>;
357 reg = <0x0530>;
358 };
359
360 mmu_fck: mmu_fck {
361 #clock-cells = <0>;
362 compatible = "ti,gate-clock";
363 clocks = <&dpll_core_m4_ck>;
364 ti,bit-shift = <1>;
365 reg = <0x0914>;
366 };
367
368 timer1_fck: timer1_fck {
369 #clock-cells = <0>;
370 compatible = "ti,mux-clock";
371 clocks = <&sys_clkin_ck>, <&clkdiv32k_ick>, <&tclkin_ck>, <&clk_rc32k_ck>, <&clk_32768_ck>;
372 reg = <0x0528>;
373 };
374
375 timer2_fck: timer2_fck {
376 #clock-cells = <0>;
377 compatible = "ti,mux-clock";
378 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
379 reg = <0x0508>;
380 };
381
382 timer3_fck: timer3_fck {
383 #clock-cells = <0>;
384 compatible = "ti,mux-clock";
385 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
386 reg = <0x050c>;
387 };
388
389 timer4_fck: timer4_fck {
390 #clock-cells = <0>;
391 compatible = "ti,mux-clock";
392 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
393 reg = <0x0510>;
394 };
395
396 timer5_fck: timer5_fck {
397 #clock-cells = <0>;
398 compatible = "ti,mux-clock";
399 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
400 reg = <0x0518>;
401 };
402
403 timer6_fck: timer6_fck {
404 #clock-cells = <0>;
405 compatible = "ti,mux-clock";
406 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
407 reg = <0x051c>;
408 };
409
410 timer7_fck: timer7_fck {
411 #clock-cells = <0>;
412 compatible = "ti,mux-clock";
413 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
414 reg = <0x0504>;
415 };
416
417 usbotg_fck: usbotg_fck {
418 #clock-cells = <0>;
419 compatible = "ti,gate-clock";
420 clocks = <&dpll_per_ck>;
421 ti,bit-shift = <8>;
422 reg = <0x047c>;
423 };
424
425 dpll_core_m4_div2_ck: dpll_core_m4_div2_ck {
426 #clock-cells = <0>;
427 compatible = "fixed-factor-clock";
428 clocks = <&dpll_core_m4_ck>;
429 clock-mult = <1>;
430 clock-div = <2>;
431 };
432
433 ieee5000_fck: ieee5000_fck {
434 #clock-cells = <0>;
435 compatible = "ti,gate-clock";
436 clocks = <&dpll_core_m4_div2_ck>;
437 ti,bit-shift = <1>;
438 reg = <0x00e4>;
439 };
440
441 wdt1_fck: wdt1_fck {
442 #clock-cells = <0>;
443 compatible = "ti,mux-clock";
444 clocks = <&clk_rc32k_ck>, <&clkdiv32k_ick>;
445 reg = <0x0538>;
446 };
447
448 l4_rtc_gclk: l4_rtc_gclk {
449 #clock-cells = <0>;
450 compatible = "fixed-factor-clock";
451 clocks = <&dpll_core_m4_ck>;
452 clock-mult = <1>;
453 clock-div = <2>;
454 };
455
456 l4hs_gclk: l4hs_gclk {
457 #clock-cells = <0>;
458 compatible = "fixed-factor-clock";
459 clocks = <&dpll_core_m4_ck>;
460 clock-mult = <1>;
461 clock-div = <1>;
462 };
463
464 l3s_gclk: l3s_gclk {
465 #clock-cells = <0>;
466 compatible = "fixed-factor-clock";
467 clocks = <&dpll_core_m4_div2_ck>;
468 clock-mult = <1>;
469 clock-div = <1>;
470 };
471
472 l4fw_gclk: l4fw_gclk {
473 #clock-cells = <0>;
474 compatible = "fixed-factor-clock";
475 clocks = <&dpll_core_m4_div2_ck>;
476 clock-mult = <1>;
477 clock-div = <1>;
478 };
479
480 l4ls_gclk: l4ls_gclk {
481 #clock-cells = <0>;
482 compatible = "fixed-factor-clock";
483 clocks = <&dpll_core_m4_div2_ck>;
484 clock-mult = <1>;
485 clock-div = <1>;
486 };
487
488 sysclk_div_ck: sysclk_div_ck {
489 #clock-cells = <0>;
490 compatible = "fixed-factor-clock";
491 clocks = <&dpll_core_m4_ck>;
492 clock-mult = <1>;
493 clock-div = <1>;
494 };
495
496 cpsw_125mhz_gclk: cpsw_125mhz_gclk {
497 #clock-cells = <0>;
498 compatible = "fixed-factor-clock";
499 clocks = <&dpll_core_m5_ck>;
500 clock-mult = <1>;
501 clock-div = <2>;
502 };
503
504 cpsw_cpts_rft_clk: cpsw_cpts_rft_clk {
505 #clock-cells = <0>;
506 compatible = "ti,mux-clock";
507 clocks = <&dpll_core_m5_ck>, <&dpll_core_m4_ck>;
508 reg = <0x0520>;
509 };
510
511 gpio0_dbclk_mux_ck: gpio0_dbclk_mux_ck {
512 #clock-cells = <0>;
513 compatible = "ti,mux-clock";
514 clocks = <&clk_rc32k_ck>, <&clk_32768_ck>, <&clkdiv32k_ick>;
515 reg = <0x053c>;
516 };
517
518 gpio0_dbclk: gpio0_dbclk {
519 #clock-cells = <0>;
520 compatible = "ti,gate-clock";
521 clocks = <&gpio0_dbclk_mux_ck>;
522 ti,bit-shift = <18>;
523 reg = <0x0408>;
524 };
525
526 gpio1_dbclk: gpio1_dbclk {
527 #clock-cells = <0>;
528 compatible = "ti,gate-clock";
529 clocks = <&clkdiv32k_ick>;
530 ti,bit-shift = <18>;
531 reg = <0x00ac>;
532 };
533
534 gpio2_dbclk: gpio2_dbclk {
535 #clock-cells = <0>;
536 compatible = "ti,gate-clock";
537 clocks = <&clkdiv32k_ick>;
538 ti,bit-shift = <18>;
539 reg = <0x00b0>;
540 };
541
542 gpio3_dbclk: gpio3_dbclk {
543 #clock-cells = <0>;
544 compatible = "ti,gate-clock";
545 clocks = <&clkdiv32k_ick>;
546 ti,bit-shift = <18>;
547 reg = <0x00b4>;
548 };
549
550 lcd_gclk: lcd_gclk {
551 #clock-cells = <0>;
552 compatible = "ti,mux-clock";
553 clocks = <&dpll_disp_m2_ck>, <&dpll_core_m5_ck>, <&dpll_per_m2_ck>;
554 reg = <0x0534>;
555 ti,set-rate-parent;
556 };
557
558 mmc_clk: mmc_clk {
559 #clock-cells = <0>;
560 compatible = "fixed-factor-clock";
561 clocks = <&dpll_per_m2_ck>;
562 clock-mult = <1>;
563 clock-div = <2>;
564 };
565
566 gfx_fclk_clksel_ck: gfx_fclk_clksel_ck {
567 #clock-cells = <0>;
568 compatible = "ti,mux-clock";
569 clocks = <&dpll_core_m4_ck>, <&dpll_per_m2_ck>;
570 ti,bit-shift = <1>;
571 reg = <0x052c>;
572 };
573
574 gfx_fck_div_ck: gfx_fck_div_ck {
575 #clock-cells = <0>;
576 compatible = "ti,divider-clock";
577 clocks = <&gfx_fclk_clksel_ck>;
578 reg = <0x052c>;
579 ti,max-div = <2>;
580 };
581
582 sysclkout_pre_ck: sysclkout_pre_ck {
583 #clock-cells = <0>;
584 compatible = "ti,mux-clock";
585 clocks = <&clk_32768_ck>, <&l3_gclk>, <&dpll_ddr_m2_ck>, <&dpll_per_m2_ck>, <&lcd_gclk>;
586 reg = <0x0700>;
587 };
588
589 clkout2_div_ck: clkout2_div_ck {
590 #clock-cells = <0>;
591 compatible = "ti,divider-clock";
592 clocks = <&sysclkout_pre_ck>;
593 ti,bit-shift = <3>;
594 ti,max-div = <8>;
595 reg = <0x0700>;
596 };
597
598 dbg_sysclk_ck: dbg_sysclk_ck {
599 #clock-cells = <0>;
600 compatible = "ti,gate-clock";
601 clocks = <&sys_clkin_ck>;
602 ti,bit-shift = <19>;
603 reg = <0x0414>;
604 };
605
606 dbg_clka_ck: dbg_clka_ck {
607 #clock-cells = <0>;
608 compatible = "ti,gate-clock";
609 clocks = <&dpll_core_m4_ck>;
610 ti,bit-shift = <30>;
611 reg = <0x0414>;
612 };
613
614 stm_pmd_clock_mux_ck: stm_pmd_clock_mux_ck {
615 #clock-cells = <0>;
616 compatible = "ti,mux-clock";
617 clocks = <&dbg_sysclk_ck>, <&dbg_clka_ck>;
618 ti,bit-shift = <22>;
619 reg = <0x0414>;
620 };
621
622 trace_pmd_clk_mux_ck: trace_pmd_clk_mux_ck {
623 #clock-cells = <0>;
624 compatible = "ti,mux-clock";
625 clocks = <&dbg_sysclk_ck>, <&dbg_clka_ck>;
626 ti,bit-shift = <20>;
627 reg = <0x0414>;
628 };
629
630 stm_clk_div_ck: stm_clk_div_ck {
631 #clock-cells = <0>;
632 compatible = "ti,divider-clock";
633 clocks = <&stm_pmd_clock_mux_ck>;
634 ti,bit-shift = <27>;
635 ti,max-div = <64>;
636 reg = <0x0414>;
637 ti,index-power-of-two;
638 };
639
640 trace_clk_div_ck: trace_clk_div_ck {
641 #clock-cells = <0>;
642 compatible = "ti,divider-clock";
643 clocks = <&trace_pmd_clk_mux_ck>;
644 ti,bit-shift = <24>;
645 ti,max-div = <64>;
646 reg = <0x0414>;
647 ti,index-power-of-two;
648 };
649
650 clkout2_ck: clkout2_ck {
651 #clock-cells = <0>;
652 compatible = "ti,gate-clock";
653 clocks = <&clkout2_div_ck>;
654 ti,bit-shift = <7>;
655 reg = <0x0700>;
656 };
657};
658
659&prcm_clockdomains {
660 clk_24mhz_clkdm: clk_24mhz_clkdm {
661 compatible = "ti,clockdomain";
662 clocks = <&clkdiv32k_ick>;
663 };
664};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index f6d8ffe98d0b..6d95d3df33c7 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -102,6 +102,32 @@
102 ranges; 102 ranges;
103 ti,hwmods = "l3_main"; 103 ti,hwmods = "l3_main";
104 104
105 prcm: prcm@44e00000 {
106 compatible = "ti,am3-prcm";
107 reg = <0x44e00000 0x4000>;
108
109 prcm_clocks: clocks {
110 #address-cells = <1>;
111 #size-cells = <0>;
112 };
113
114 prcm_clockdomains: clockdomains {
115 };
116 };
117
118 scrm: scrm@44e10000 {
119 compatible = "ti,am3-scrm";
120 reg = <0x44e10000 0x2000>;
121
122 scrm_clocks: clocks {
123 #address-cells = <1>;
124 #size-cells = <0>;
125 };
126
127 scrm_clockdomains: clockdomains {
128 };
129 };
130
105 intc: interrupt-controller@48200000 { 131 intc: interrupt-controller@48200000 {
106 compatible = "ti,omap2-intc"; 132 compatible = "ti,omap2-intc";
107 interrupt-controller; 133 interrupt-controller;
@@ -794,3 +820,5 @@
794 }; 820 };
795 }; 821 };
796}; 822};
823
824/include/ "am33xx-clocks.dtsi"
diff --git a/arch/arm/boot/dts/am3517-evm.dts b/arch/arm/boot/dts/am3517-evm.dts
index 03fcbf0a88a8..b4127c6493a2 100644
--- a/arch/arm/boot/dts/am3517-evm.dts
+++ b/arch/arm/boot/dts/am3517-evm.dts
@@ -17,6 +17,21 @@
17 device_type = "memory"; 17 device_type = "memory";
18 reg = <0x80000000 0x10000000>; /* 256 MB */ 18 reg = <0x80000000 0x10000000>; /* 256 MB */
19 }; 19 };
20
21 vmmc_fixed: vmmc {
22 compatible = "regulator-fixed";
23 regulator-name = "vmmc_fixed";
24 regulator-min-microvolt = <3300000>;
25 regulator-max-microvolt = <3300000>;
26 };
27};
28
29&davinci_emac {
30 status = "okay";
31};
32
33&davinci_mdio {
34 status = "okay";
20}; 35};
21 36
22&i2c1 { 37&i2c1 {
@@ -30,3 +45,17 @@
30&i2c3 { 45&i2c3 {
31 clock-frequency = <400000>; 46 clock-frequency = <400000>;
32}; 47};
48
49&mmc1 {
50 vmmc-supply = <&vmmc_fixed>;
51 bus-width = <4>;
52};
53
54&mmc2 {
55 status = "disabled";
56};
57
58&mmc3 {
59 status = "disabled";
60};
61
diff --git a/arch/arm/boot/dts/am3517.dtsi b/arch/arm/boot/dts/am3517.dtsi
index 2fbe02faa8b1..788391f91684 100644
--- a/arch/arm/boot/dts/am3517.dtsi
+++ b/arch/arm/boot/dts/am3517.dtsi
@@ -61,3 +61,6 @@
61 }; 61 };
62 }; 62 };
63}; 63};
64
65/include/ "am35xx-clocks.dtsi"
66/include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
diff --git a/arch/arm/boot/dts/am35xx-clocks.dtsi b/arch/arm/boot/dts/am35xx-clocks.dtsi
new file mode 100644
index 000000000000..df489d310b50
--- /dev/null
+++ b/arch/arm/boot/dts/am35xx-clocks.dtsi
@@ -0,0 +1,128 @@
1/*
2 * Device Tree Source for OMAP3 clock data
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&scrm_clocks {
11 emac_ick: emac_ick {
12 #clock-cells = <0>;
13 compatible = "ti,am35xx-gate-clock";
14 clocks = <&ipss_ick>;
15 reg = <0x059c>;
16 ti,bit-shift = <1>;
17 };
18
19 emac_fck: emac_fck {
20 #clock-cells = <0>;
21 compatible = "ti,gate-clock";
22 clocks = <&rmii_ck>;
23 reg = <0x059c>;
24 ti,bit-shift = <9>;
25 };
26
27 vpfe_ick: vpfe_ick {
28 #clock-cells = <0>;
29 compatible = "ti,am35xx-gate-clock";
30 clocks = <&ipss_ick>;
31 reg = <0x059c>;
32 ti,bit-shift = <2>;
33 };
34
35 vpfe_fck: vpfe_fck {
36 #clock-cells = <0>;
37 compatible = "ti,gate-clock";
38 clocks = <&pclk_ck>;
39 reg = <0x059c>;
40 ti,bit-shift = <10>;
41 };
42
43 hsotgusb_ick_am35xx: hsotgusb_ick_am35xx {
44 #clock-cells = <0>;
45 compatible = "ti,am35xx-gate-clock";
46 clocks = <&ipss_ick>;
47 reg = <0x059c>;
48 ti,bit-shift = <0>;
49 };
50
51 hsotgusb_fck_am35xx: hsotgusb_fck_am35xx {
52 #clock-cells = <0>;
53 compatible = "ti,gate-clock";
54 clocks = <&sys_ck>;
55 reg = <0x059c>;
56 ti,bit-shift = <8>;
57 };
58
59 hecc_ck: hecc_ck {
60 #clock-cells = <0>;
61 compatible = "ti,am35xx-gate-clock";
62 clocks = <&sys_ck>;
63 reg = <0x059c>;
64 ti,bit-shift = <3>;
65 };
66};
67&cm_clocks {
68 ipss_ick: ipss_ick {
69 #clock-cells = <0>;
70 compatible = "ti,am35xx-interface-clock";
71 clocks = <&core_l3_ick>;
72 reg = <0x0a10>;
73 ti,bit-shift = <4>;
74 };
75
76 rmii_ck: rmii_ck {
77 #clock-cells = <0>;
78 compatible = "fixed-clock";
79 clock-frequency = <50000000>;
80 };
81
82 pclk_ck: pclk_ck {
83 #clock-cells = <0>;
84 compatible = "fixed-clock";
85 clock-frequency = <27000000>;
86 };
87
88 uart4_ick_am35xx: uart4_ick_am35xx {
89 #clock-cells = <0>;
90 compatible = "ti,omap3-interface-clock";
91 clocks = <&core_l4_ick>;
92 reg = <0x0a10>;
93 ti,bit-shift = <23>;
94 };
95
96 uart4_fck_am35xx: uart4_fck_am35xx {
97 #clock-cells = <0>;
98 compatible = "ti,wait-gate-clock";
99 clocks = <&core_48m_fck>;
100 reg = <0x0a00>;
101 ti,bit-shift = <23>;
102 };
103};
104
105&cm_clockdomains {
106 core_l3_clkdm: core_l3_clkdm {
107 compatible = "ti,clockdomain";
108 clocks = <&sdrc_ick>, <&ipss_ick>, <&emac_ick>, <&vpfe_ick>,
109 <&hsotgusb_ick_am35xx>, <&hsotgusb_fck_am35xx>,
110 <&hecc_ck>;
111 };
112
113 core_l4_clkdm: core_l4_clkdm {
114 compatible = "ti,clockdomain";
115 clocks = <&cpefuse_fck>, <&ts_fck>, <&usbtll_fck>,
116 <&usbtll_ick>, <&mmchs3_ick>, <&mmchs3_fck>,
117 <&mmchs2_fck>, <&mmchs1_fck>, <&i2c3_fck>, <&i2c2_fck>,
118 <&i2c1_fck>, <&mcspi4_fck>, <&mcspi3_fck>,
119 <&mcspi2_fck>, <&mcspi1_fck>, <&uart2_fck>,
120 <&uart1_fck>, <&hdq_fck>, <&mmchs2_ick>, <&mmchs1_ick>,
121 <&hdq_ick>, <&mcspi4_ick>, <&mcspi3_ick>,
122 <&mcspi2_ick>, <&mcspi1_ick>, <&i2c3_ick>, <&i2c2_ick>,
123 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
124 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
125 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>,
126 <&uart4_ick_am35xx>, <&uart4_fck_am35xx>;
127 };
128};
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index 974d103ab3b1..c6bd4d986c29 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -67,6 +67,32 @@
67 ranges; 67 ranges;
68 ti,hwmods = "l3_main"; 68 ti,hwmods = "l3_main";
69 69
70 prcm: prcm@44df0000 {
71 compatible = "ti,am4-prcm";
72 reg = <0x44df0000 0x11000>;
73
74 prcm_clocks: clocks {
75 #address-cells = <1>;
76 #size-cells = <0>;
77 };
78
79 prcm_clockdomains: clockdomains {
80 };
81 };
82
83 scrm: scrm@44e10000 {
84 compatible = "ti,am4-scrm";
85 reg = <0x44e10000 0x2000>;
86
87 scrm_clocks: clocks {
88 #address-cells = <1>;
89 #size-cells = <0>;
90 };
91
92 scrm_clockdomains: clockdomains {
93 };
94 };
95
70 edma: edma@49000000 { 96 edma: edma@49000000 {
71 compatible = "ti,edma3"; 97 compatible = "ti,edma3";
72 ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; 98 ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
@@ -665,3 +691,5 @@
665 }; 691 };
666 }; 692 };
667}; 693};
694
695/include/ "am43xx-clocks.dtsi"
diff --git a/arch/arm/boot/dts/am43xx-clocks.dtsi b/arch/arm/boot/dts/am43xx-clocks.dtsi
new file mode 100644
index 000000000000..142009cc9332
--- /dev/null
+++ b/arch/arm/boot/dts/am43xx-clocks.dtsi
@@ -0,0 +1,656 @@
1/*
2 * Device Tree Source for AM43xx clock data
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&scrm_clocks {
11 sys_clkin_ck: sys_clkin_ck {
12 #clock-cells = <0>;
13 compatible = "ti,mux-clock";
14 clocks = <&virt_19200000_ck>, <&virt_24000000_ck>, <&virt_25000000_ck>, <&virt_26000000_ck>;
15 ti,bit-shift = <22>;
16 reg = <0x0040>;
17 };
18
19 adc_tsc_fck: adc_tsc_fck {
20 #clock-cells = <0>;
21 compatible = "fixed-factor-clock";
22 clocks = <&sys_clkin_ck>;
23 clock-mult = <1>;
24 clock-div = <1>;
25 };
26
27 dcan0_fck: dcan0_fck {
28 #clock-cells = <0>;
29 compatible = "fixed-factor-clock";
30 clocks = <&sys_clkin_ck>;
31 clock-mult = <1>;
32 clock-div = <1>;
33 };
34
35 dcan1_fck: dcan1_fck {
36 #clock-cells = <0>;
37 compatible = "fixed-factor-clock";
38 clocks = <&sys_clkin_ck>;
39 clock-mult = <1>;
40 clock-div = <1>;
41 };
42
43 mcasp0_fck: mcasp0_fck {
44 #clock-cells = <0>;
45 compatible = "fixed-factor-clock";
46 clocks = <&sys_clkin_ck>;
47 clock-mult = <1>;
48 clock-div = <1>;
49 };
50
51 mcasp1_fck: mcasp1_fck {
52 #clock-cells = <0>;
53 compatible = "fixed-factor-clock";
54 clocks = <&sys_clkin_ck>;
55 clock-mult = <1>;
56 clock-div = <1>;
57 };
58
59 smartreflex0_fck: smartreflex0_fck {
60 #clock-cells = <0>;
61 compatible = "fixed-factor-clock";
62 clocks = <&sys_clkin_ck>;
63 clock-mult = <1>;
64 clock-div = <1>;
65 };
66
67 smartreflex1_fck: smartreflex1_fck {
68 #clock-cells = <0>;
69 compatible = "fixed-factor-clock";
70 clocks = <&sys_clkin_ck>;
71 clock-mult = <1>;
72 clock-div = <1>;
73 };
74
75 sha0_fck: sha0_fck {
76 #clock-cells = <0>;
77 compatible = "fixed-factor-clock";
78 clocks = <&sys_clkin_ck>;
79 clock-mult = <1>;
80 clock-div = <1>;
81 };
82
83 aes0_fck: aes0_fck {
84 #clock-cells = <0>;
85 compatible = "fixed-factor-clock";
86 clocks = <&sys_clkin_ck>;
87 clock-mult = <1>;
88 clock-div = <1>;
89 };
90};
91&prcm_clocks {
92 clk_32768_ck: clk_32768_ck {
93 #clock-cells = <0>;
94 compatible = "fixed-clock";
95 clock-frequency = <32768>;
96 };
97
98 clk_rc32k_ck: clk_rc32k_ck {
99 #clock-cells = <0>;
100 compatible = "fixed-clock";
101 clock-frequency = <32768>;
102 };
103
104 virt_19200000_ck: virt_19200000_ck {
105 #clock-cells = <0>;
106 compatible = "fixed-clock";
107 clock-frequency = <19200000>;
108 };
109
110 virt_24000000_ck: virt_24000000_ck {
111 #clock-cells = <0>;
112 compatible = "fixed-clock";
113 clock-frequency = <24000000>;
114 };
115
116 virt_25000000_ck: virt_25000000_ck {
117 #clock-cells = <0>;
118 compatible = "fixed-clock";
119 clock-frequency = <25000000>;
120 };
121
122 virt_26000000_ck: virt_26000000_ck {
123 #clock-cells = <0>;
124 compatible = "fixed-clock";
125 clock-frequency = <26000000>;
126 };
127
128 tclkin_ck: tclkin_ck {
129 #clock-cells = <0>;
130 compatible = "fixed-clock";
131 clock-frequency = <26000000>;
132 };
133
134 dpll_core_ck: dpll_core_ck {
135 #clock-cells = <0>;
136 compatible = "ti,am3-dpll-core-clock";
137 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
138 reg = <0x2d20>, <0x2d24>, <0x2d2c>;
139 };
140
141 dpll_core_x2_ck: dpll_core_x2_ck {
142 #clock-cells = <0>;
143 compatible = "ti,am3-dpll-x2-clock";
144 clocks = <&dpll_core_ck>;
145 };
146
147 dpll_core_m4_ck: dpll_core_m4_ck {
148 #clock-cells = <0>;
149 compatible = "ti,divider-clock";
150 clocks = <&dpll_core_x2_ck>;
151 ti,max-div = <31>;
152 ti,autoidle-shift = <8>;
153 reg = <0x2d38>;
154 ti,index-starts-at-one;
155 ti,invert-autoidle-bit;
156 };
157
158 dpll_core_m5_ck: dpll_core_m5_ck {
159 #clock-cells = <0>;
160 compatible = "ti,divider-clock";
161 clocks = <&dpll_core_x2_ck>;
162 ti,max-div = <31>;
163 ti,autoidle-shift = <8>;
164 reg = <0x2d3c>;
165 ti,index-starts-at-one;
166 ti,invert-autoidle-bit;
167 };
168
169 dpll_core_m6_ck: dpll_core_m6_ck {
170 #clock-cells = <0>;
171 compatible = "ti,divider-clock";
172 clocks = <&dpll_core_x2_ck>;
173 ti,max-div = <31>;
174 ti,autoidle-shift = <8>;
175 reg = <0x2d40>;
176 ti,index-starts-at-one;
177 ti,invert-autoidle-bit;
178 };
179
180 dpll_mpu_ck: dpll_mpu_ck {
181 #clock-cells = <0>;
182 compatible = "ti,am3-dpll-clock";
183 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
184 reg = <0x2d60>, <0x2d64>, <0x2d6c>;
185 };
186
187 dpll_mpu_m2_ck: dpll_mpu_m2_ck {
188 #clock-cells = <0>;
189 compatible = "ti,divider-clock";
190 clocks = <&dpll_mpu_ck>;
191 ti,max-div = <31>;
192 ti,autoidle-shift = <8>;
193 reg = <0x2d70>;
194 ti,index-starts-at-one;
195 ti,invert-autoidle-bit;
196 };
197
198 dpll_ddr_ck: dpll_ddr_ck {
199 #clock-cells = <0>;
200 compatible = "ti,am3-dpll-clock";
201 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
202 reg = <0x2da0>, <0x2da4>, <0x2dac>;
203 };
204
205 dpll_ddr_m2_ck: dpll_ddr_m2_ck {
206 #clock-cells = <0>;
207 compatible = "ti,divider-clock";
208 clocks = <&dpll_ddr_ck>;
209 ti,max-div = <31>;
210 ti,autoidle-shift = <8>;
211 reg = <0x2db0>;
212 ti,index-starts-at-one;
213 ti,invert-autoidle-bit;
214 };
215
216 dpll_disp_ck: dpll_disp_ck {
217 #clock-cells = <0>;
218 compatible = "ti,am3-dpll-clock";
219 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
220 reg = <0x2e20>, <0x2e24>, <0x2e2c>;
221 };
222
223 dpll_disp_m2_ck: dpll_disp_m2_ck {
224 #clock-cells = <0>;
225 compatible = "ti,divider-clock";
226 clocks = <&dpll_disp_ck>;
227 ti,max-div = <31>;
228 ti,autoidle-shift = <8>;
229 reg = <0x2e30>;
230 ti,index-starts-at-one;
231 ti,invert-autoidle-bit;
232 };
233
234 dpll_per_ck: dpll_per_ck {
235 #clock-cells = <0>;
236 compatible = "ti,am3-dpll-j-type-clock";
237 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
238 reg = <0x2de0>, <0x2de4>, <0x2dec>;
239 };
240
241 dpll_per_m2_ck: dpll_per_m2_ck {
242 #clock-cells = <0>;
243 compatible = "ti,divider-clock";
244 clocks = <&dpll_per_ck>;
245 ti,max-div = <127>;
246 ti,autoidle-shift = <8>;
247 reg = <0x2df0>;
248 ti,index-starts-at-one;
249 ti,invert-autoidle-bit;
250 };
251
252 dpll_per_m2_div4_wkupdm_ck: dpll_per_m2_div4_wkupdm_ck {
253 #clock-cells = <0>;
254 compatible = "fixed-factor-clock";
255 clocks = <&dpll_per_m2_ck>;
256 clock-mult = <1>;
257 clock-div = <4>;
258 };
259
260 dpll_per_m2_div4_ck: dpll_per_m2_div4_ck {
261 #clock-cells = <0>;
262 compatible = "fixed-factor-clock";
263 clocks = <&dpll_per_m2_ck>;
264 clock-mult = <1>;
265 clock-div = <4>;
266 };
267
268 clk_24mhz: clk_24mhz {
269 #clock-cells = <0>;
270 compatible = "fixed-factor-clock";
271 clocks = <&dpll_per_m2_ck>;
272 clock-mult = <1>;
273 clock-div = <8>;
274 };
275
276 clkdiv32k_ck: clkdiv32k_ck {
277 #clock-cells = <0>;
278 compatible = "fixed-factor-clock";
279 clocks = <&clk_24mhz>;
280 clock-mult = <1>;
281 clock-div = <732>;
282 };
283
284 clkdiv32k_ick: clkdiv32k_ick {
285 #clock-cells = <0>;
286 compatible = "ti,gate-clock";
287 clocks = <&clkdiv32k_ck>;
288 ti,bit-shift = <8>;
289 reg = <0x2a38>;
290 };
291
292 sysclk_div: sysclk_div {
293 #clock-cells = <0>;
294 compatible = "fixed-factor-clock";
295 clocks = <&dpll_core_m4_ck>;
296 clock-mult = <1>;
297 clock-div = <1>;
298 };
299
300 pruss_ocp_gclk: pruss_ocp_gclk {
301 #clock-cells = <0>;
302 compatible = "ti,mux-clock";
303 clocks = <&sysclk_div>, <&dpll_disp_m2_ck>;
304 reg = <0x4248>;
305 };
306
307 clk_32k_tpm_ck: clk_32k_tpm_ck {
308 #clock-cells = <0>;
309 compatible = "fixed-clock";
310 clock-frequency = <32768>;
311 };
312
313 timer1_fck: timer1_fck {
314 #clock-cells = <0>;
315 compatible = "ti,mux-clock";
316 clocks = <&sys_clkin_ck>, <&clkdiv32k_ick>, <&tclkin_ck>, <&clk_rc32k_ck>, <&clk_32768_ck>, <&clk_32k_tpm_ck>;
317 reg = <0x4200>;
318 };
319
320 timer2_fck: timer2_fck {
321 #clock-cells = <0>;
322 compatible = "ti,mux-clock";
323 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
324 reg = <0x4204>;
325 };
326
327 timer3_fck: timer3_fck {
328 #clock-cells = <0>;
329 compatible = "ti,mux-clock";
330 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
331 reg = <0x4208>;
332 };
333
334 timer4_fck: timer4_fck {
335 #clock-cells = <0>;
336 compatible = "ti,mux-clock";
337 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
338 reg = <0x420c>;
339 };
340
341 timer5_fck: timer5_fck {
342 #clock-cells = <0>;
343 compatible = "ti,mux-clock";
344 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
345 reg = <0x4210>;
346 };
347
348 timer6_fck: timer6_fck {
349 #clock-cells = <0>;
350 compatible = "ti,mux-clock";
351 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
352 reg = <0x4214>;
353 };
354
355 timer7_fck: timer7_fck {
356 #clock-cells = <0>;
357 compatible = "ti,mux-clock";
358 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>;
359 reg = <0x4218>;
360 };
361
362 wdt1_fck: wdt1_fck {
363 #clock-cells = <0>;
364 compatible = "ti,mux-clock";
365 clocks = <&clk_rc32k_ck>, <&clkdiv32k_ick>;
366 reg = <0x422c>;
367 };
368
369 l3_gclk: l3_gclk {
370 #clock-cells = <0>;
371 compatible = "fixed-factor-clock";
372 clocks = <&dpll_core_m4_ck>;
373 clock-mult = <1>;
374 clock-div = <1>;
375 };
376
377 dpll_core_m4_div2_ck: dpll_core_m4_div2_ck {
378 #clock-cells = <0>;
379 compatible = "fixed-factor-clock";
380 clocks = <&sysclk_div>;
381 clock-mult = <1>;
382 clock-div = <2>;
383 };
384
385 l4hs_gclk: l4hs_gclk {
386 #clock-cells = <0>;
387 compatible = "fixed-factor-clock";
388 clocks = <&dpll_core_m4_ck>;
389 clock-mult = <1>;
390 clock-div = <1>;
391 };
392
393 l3s_gclk: l3s_gclk {
394 #clock-cells = <0>;
395 compatible = "fixed-factor-clock";
396 clocks = <&dpll_core_m4_div2_ck>;
397 clock-mult = <1>;
398 clock-div = <1>;
399 };
400
401 l4ls_gclk: l4ls_gclk {
402 #clock-cells = <0>;
403 compatible = "fixed-factor-clock";
404 clocks = <&dpll_core_m4_div2_ck>;
405 clock-mult = <1>;
406 clock-div = <1>;
407 };
408
409 cpsw_125mhz_gclk: cpsw_125mhz_gclk {
410 #clock-cells = <0>;
411 compatible = "fixed-factor-clock";
412 clocks = <&dpll_core_m5_ck>;
413 clock-mult = <1>;
414 clock-div = <2>;
415 };
416
417 cpsw_cpts_rft_clk: cpsw_cpts_rft_clk {
418 #clock-cells = <0>;
419 compatible = "ti,mux-clock";
420 clocks = <&sysclk_div>, <&dpll_core_m5_ck>, <&dpll_disp_m2_ck>;
421 reg = <0x4238>;
422 };
423
424 clk_32k_mosc_ck: clk_32k_mosc_ck {
425 #clock-cells = <0>;
426 compatible = "fixed-clock";
427 clock-frequency = <32768>;
428 };
429
430 gpio0_dbclk_mux_ck: gpio0_dbclk_mux_ck {
431 #clock-cells = <0>;
432 compatible = "ti,mux-clock";
433 clocks = <&clk_rc32k_ck>, <&clk_32768_ck>, <&clkdiv32k_ick>, <&clk_32k_mosc_ck>, <&clk_32k_tpm_ck>;
434 reg = <0x4240>;
435 };
436
437 gpio0_dbclk: gpio0_dbclk {
438 #clock-cells = <0>;
439 compatible = "ti,gate-clock";
440 clocks = <&gpio0_dbclk_mux_ck>;
441 ti,bit-shift = <8>;
442 reg = <0x2b68>;
443 };
444
445 gpio1_dbclk: gpio1_dbclk {
446 #clock-cells = <0>;
447 compatible = "ti,gate-clock";
448 clocks = <&clkdiv32k_ick>;
449 ti,bit-shift = <8>;
450 reg = <0x8c78>;
451 };
452
453 gpio2_dbclk: gpio2_dbclk {
454 #clock-cells = <0>;
455 compatible = "ti,gate-clock";
456 clocks = <&clkdiv32k_ick>;
457 ti,bit-shift = <8>;
458 reg = <0x8c80>;
459 };
460
461 gpio3_dbclk: gpio3_dbclk {
462 #clock-cells = <0>;
463 compatible = "ti,gate-clock";
464 clocks = <&clkdiv32k_ick>;
465 ti,bit-shift = <8>;
466 reg = <0x8c88>;
467 };
468
469 gpio4_dbclk: gpio4_dbclk {
470 #clock-cells = <0>;
471 compatible = "ti,gate-clock";
472 clocks = <&clkdiv32k_ick>;
473 ti,bit-shift = <8>;
474 reg = <0x8c90>;
475 };
476
477 gpio5_dbclk: gpio5_dbclk {
478 #clock-cells = <0>;
479 compatible = "ti,gate-clock";
480 clocks = <&clkdiv32k_ick>;
481 ti,bit-shift = <8>;
482 reg = <0x8c98>;
483 };
484
485 mmc_clk: mmc_clk {
486 #clock-cells = <0>;
487 compatible = "fixed-factor-clock";
488 clocks = <&dpll_per_m2_ck>;
489 clock-mult = <1>;
490 clock-div = <2>;
491 };
492
493 gfx_fclk_clksel_ck: gfx_fclk_clksel_ck {
494 #clock-cells = <0>;
495 compatible = "ti,mux-clock";
496 clocks = <&sysclk_div>, <&dpll_per_m2_ck>;
497 ti,bit-shift = <1>;
498 reg = <0x423c>;
499 };
500
501 gfx_fck_div_ck: gfx_fck_div_ck {
502 #clock-cells = <0>;
503 compatible = "ti,divider-clock";
504 clocks = <&gfx_fclk_clksel_ck>;
505 reg = <0x423c>;
506 ti,max-div = <2>;
507 };
508
509 disp_clk: disp_clk {
510 #clock-cells = <0>;
511 compatible = "ti,mux-clock";
512 clocks = <&dpll_disp_m2_ck>, <&dpll_core_m5_ck>, <&dpll_per_m2_ck>;
513 reg = <0x4244>;
514 };
515
516 dpll_extdev_ck: dpll_extdev_ck {
517 #clock-cells = <0>;
518 compatible = "ti,am3-dpll-clock";
519 clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
520 reg = <0x2e60>, <0x2e64>, <0x2e6c>;
521 };
522
523 dpll_extdev_m2_ck: dpll_extdev_m2_ck {
524 #clock-cells = <0>;
525 compatible = "ti,divider-clock";
526 clocks = <&dpll_extdev_ck>;
527 ti,max-div = <127>;
528 ti,autoidle-shift = <8>;
529 reg = <0x2e70>;
530 ti,index-starts-at-one;
531 ti,invert-autoidle-bit;
532 };
533
534 mux_synctimer32k_ck: mux_synctimer32k_ck {
535 #clock-cells = <0>;
536 compatible = "ti,mux-clock";
537 clocks = <&clk_32768_ck>, <&clk_32k_tpm_ck>, <&clkdiv32k_ick>;
538 reg = <0x4230>;
539 };
540
541 synctimer_32kclk: synctimer_32kclk {
542 #clock-cells = <0>;
543 compatible = "ti,gate-clock";
544 clocks = <&mux_synctimer32k_ck>;
545 ti,bit-shift = <8>;
546 reg = <0x2a30>;
547 };
548
549 timer8_fck: timer8_fck {
550 #clock-cells = <0>;
551 compatible = "ti,mux-clock";
552 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>, <&clk_32k_tpm_ck>;
553 reg = <0x421c>;
554 };
555
556 timer9_fck: timer9_fck {
557 #clock-cells = <0>;
558 compatible = "ti,mux-clock";
559 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>, <&clk_32k_tpm_ck>;
560 reg = <0x4220>;
561 };
562
563 timer10_fck: timer10_fck {
564 #clock-cells = <0>;
565 compatible = "ti,mux-clock";
566 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>, <&clk_32k_tpm_ck>;
567 reg = <0x4224>;
568 };
569
570 timer11_fck: timer11_fck {
571 #clock-cells = <0>;
572 compatible = "ti,mux-clock";
573 clocks = <&tclkin_ck>, <&sys_clkin_ck>, <&clkdiv32k_ick>, <&clk_32k_tpm_ck>;
574 reg = <0x4228>;
575 };
576
577 cpsw_50m_clkdiv: cpsw_50m_clkdiv {
578 #clock-cells = <0>;
579 compatible = "fixed-factor-clock";
580 clocks = <&dpll_core_m5_ck>;
581 clock-mult = <1>;
582 clock-div = <1>;
583 };
584
585 cpsw_5m_clkdiv: cpsw_5m_clkdiv {
586 #clock-cells = <0>;
587 compatible = "fixed-factor-clock";
588 clocks = <&cpsw_50m_clkdiv>;
589 clock-mult = <1>;
590 clock-div = <10>;
591 };
592
593 dpll_ddr_x2_ck: dpll_ddr_x2_ck {
594 #clock-cells = <0>;
595 compatible = "ti,am3-dpll-x2-clock";
596 clocks = <&dpll_ddr_ck>;
597 };
598
599 dpll_ddr_m4_ck: dpll_ddr_m4_ck {
600 #clock-cells = <0>;
601 compatible = "ti,divider-clock";
602 clocks = <&dpll_ddr_x2_ck>;
603 ti,max-div = <31>;
604 ti,autoidle-shift = <8>;
605 reg = <0x2db8>;
606 ti,index-starts-at-one;
607 ti,invert-autoidle-bit;
608 };
609
610 dpll_per_clkdcoldo: dpll_per_clkdcoldo {
611 #clock-cells = <0>;
612 compatible = "fixed-factor-clock";
613 clocks = <&dpll_per_ck>;
614 clock-mult = <1>;
615 clock-div = <1>;
616 };
617
618 dll_aging_clk_div: dll_aging_clk_div {
619 #clock-cells = <0>;
620 compatible = "ti,divider-clock";
621 clocks = <&sys_clkin_ck>;
622 reg = <0x4250>;
623 ti,dividers = <8>, <16>, <32>;
624 };
625
626 div_core_25m_ck: div_core_25m_ck {
627 #clock-cells = <0>;
628 compatible = "fixed-factor-clock";
629 clocks = <&sysclk_div>;
630 clock-mult = <1>;
631 clock-div = <8>;
632 };
633
634 func_12m_clk: func_12m_clk {
635 #clock-cells = <0>;
636 compatible = "fixed-factor-clock";
637 clocks = <&dpll_per_m2_ck>;
638 clock-mult = <1>;
639 clock-div = <16>;
640 };
641
642 vtp_clk_div: vtp_clk_div {
643 #clock-cells = <0>;
644 compatible = "fixed-factor-clock";
645 clocks = <&sys_clkin_ck>;
646 clock-mult = <1>;
647 clock-div = <2>;
648 };
649
650 usbphy_32khz_clkmux: usbphy_32khz_clkmux {
651 #clock-cells = <0>;
652 compatible = "ti,mux-clock";
653 clocks = <&clk_32768_ck>, <&clk_32k_tpm_ck>;
654 reg = <0x4260>;
655 };
656};
diff --git a/arch/arm/boot/dts/animeo_ip.dts b/arch/arm/boot/dts/animeo_ip.dts
index 3a1de9eb5111..3c4f6d983cbd 100644
--- a/arch/arm/boot/dts/animeo_ip.dts
+++ b/arch/arm/boot/dts/animeo_ip.dts
@@ -90,34 +90,19 @@
90 nand-on-flash-bbt; 90 nand-on-flash-bbt;
91 status = "okay"; 91 status = "okay";
92 92
93 at91bootstrap@0 { 93 barebox@0 {
94 label = "at91bootstrap";
95 reg = <0x0 0x8000>;
96 };
97
98 barebox@8000 {
99 label = "barebox"; 94 label = "barebox";
100 reg = <0x8000 0x40000>; 95 reg = <0x0 0x58000>;
101 };
102
103 bareboxenv@48000 {
104 label = "bareboxenv";
105 reg = <0x48000 0x8000>;
106 };
107
108 user_block@0x50000 {
109 label = "user_block";
110 reg = <0x50000 0xb0000>;
111 }; 96 };
112 97
113 kernel@100000 { 98 u_boot_env@58000 {
114 label = "kernel"; 99 label = "u_boot_env";
115 reg = <0x100000 0x1b0000>; 100 reg = <0x58000 0x8000>;
116 }; 101 };
117 102
118 root@2b0000 { 103 ubi@60000 {
119 label = "root"; 104 label = "ubi";
120 reg = <0x2b0000 0x1D50000>; 105 reg = <0x60000 0x1FA0000>;
121 }; 106 };
122 }; 107 };
123 108
diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts
index 2471d9da767b..944e8785b308 100644
--- a/arch/arm/boot/dts/armada-370-mirabox.dts
+++ b/arch/arm/boot/dts/armada-370-mirabox.dts
@@ -74,13 +74,13 @@
74 green_pwr_led { 74 green_pwr_led {
75 label = "mirabox:green:pwr"; 75 label = "mirabox:green:pwr";
76 gpios = <&gpio1 31 1>; 76 gpios = <&gpio1 31 1>;
77 linux,default-trigger = "heartbeat"; 77 default-state = "keep";
78 }; 78 };
79 79
80 blue_stat_led { 80 blue_stat_led {
81 label = "mirabox:blue:stat"; 81 label = "mirabox:blue:stat";
82 gpios = <&gpio2 0 1>; 82 gpios = <&gpio2 0 1>;
83 linux,default-trigger = "cpu0"; 83 default-state = "off";
84 }; 84 };
85 85
86 green_stat_led { 86 green_stat_led {
@@ -139,6 +139,27 @@
139 reg = <0x25>; 139 reg = <0x25>;
140 }; 140 };
141 }; 141 };
142
143 nand@d0000 {
144 status = "okay";
145 num-cs = <1>;
146 marvell,nand-keep-config;
147 marvell,nand-enable-arbiter;
148 nand-on-flash-bbt;
149
150 partition@0 {
151 label = "U-Boot";
152 reg = <0 0x400000>;
153 };
154 partition@400000 {
155 label = "Linux";
156 reg = <0x400000 0x400000>;
157 };
158 partition@800000 {
159 label = "Filesystem";
160 reg = <0x800000 0x3f800000>;
161 };
162 };
142 }; 163 };
143 }; 164 };
144}; 165};
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn102.dts b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
index 8ac2ac1f69cc..651aeb5ef439 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn102.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn102.dts
@@ -11,6 +11,8 @@
11 11
12/dts-v1/; 12/dts-v1/;
13 13
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/gpio/gpio.h>
14#include "armada-370.dtsi" 16#include "armada-370.dtsi"
15 17
16/ { 18/ {
@@ -62,6 +64,7 @@
62 marvell,pins = "mpp57"; 64 marvell,pins = "mpp57";
63 marvell,function = "gpio"; 65 marvell,function = "gpio";
64 }; 66 };
67
65 sata1_led_pin: sata1-led-pin { 68 sata1_led_pin: sata1-led-pin {
66 marvell,pins = "mpp15"; 69 marvell,pins = "mpp15";
67 marvell,function = "gpio"; 70 marvell,function = "gpio";
@@ -77,6 +80,21 @@
77 marvell,function = "gpio"; 80 marvell,function = "gpio";
78 }; 81 };
79 82
83 backup_button_pin: backup-button-pin {
84 marvell,pins = "mpp58";
85 marvell,function = "gpio";
86 };
87
88 power_button_pin: power-button-pin {
89 marvell,pins = "mpp62";
90 marvell,function = "gpio";
91 };
92
93 reset_button_pin: reset-button-pin {
94 marvell,pins = "mpp6";
95 marvell,function = "gpio";
96 };
97
80 poweroff: poweroff { 98 poweroff: poweroff {
81 marvell,pins = "mpp8"; 99 marvell,pins = "mpp8";
82 marvell,function = "gpio"; 100 marvell,function = "gpio";
@@ -84,7 +102,7 @@
84 }; 102 };
85 103
86 mdio { 104 mdio {
87 phy0: ethernet-phy@0 { 105 phy0: ethernet-phy@0 { /* Marvell 88E1318 */
88 reg = <0>; 106 reg = <0>;
89 }; 107 };
90 }; 108 };
@@ -104,6 +122,11 @@
104 clock-frequency = <100000>; 122 clock-frequency = <100000>;
105 status = "okay"; 123 status = "okay";
106 124
125 isl12057: isl12057@68 {
126 compatible = "isl,isl12057";
127 reg = <0x68>;
128 };
129
107 g762: g762@3e { 130 g762: g762@3e {
108 compatible = "gmt,g762"; 131 compatible = "gmt,g762";
109 reg = <0x3e>; 132 reg = <0x3e>;
@@ -113,82 +136,116 @@
113 pwm_polarity = <0>; 136 pwm_polarity = <0>;
114 }; 137 };
115 }; 138 };
139
140 nand@d0000 {
141 status = "okay";
142 num-cs = <1>;
143 marvell,nand-keep-config;
144 marvell,nand-enable-arbiter;
145 nand-on-flash-bbt;
146
147 partition@0 {
148 label = "u-boot";
149 reg = <0x0000000 0x180000>; /* 1.5MB */
150 read-only;
151 };
152
153 partition@180000 {
154 label = "u-boot-env";
155 reg = <0x180000 0x20000>; /* 128KB */
156 read-only;
157 };
158
159 partition@200000 {
160 label = "uImage";
161 reg = <0x0200000 0x600000>; /* 6MB */
162 };
163
164 partition@800000 {
165 label = "minirootfs";
166 reg = <0x0800000 0x400000>; /* 4MB */
167 };
168
169 /* Last MB is for the BBT, i.e. not writable */
170 partition@c00000 {
171 label = "ubifs";
172 reg = <0x0c00000 0x7400000>; /* 116MB */
173 };
174 };
116 }; 175 };
117 }; 176 };
118 177
119 clocks { 178 clocks {
120 #address-cells = <1>; 179 g762_clk: g762-oscillator {
121 #size-cells = <0>;
122
123 g762_clk: fixedclk {
124 compatible = "fixed-clock"; 180 compatible = "fixed-clock";
125 #clock-cells = <0>; 181 #clock-cells = <0>;
126 clock-frequency = <8192>; 182 clock-frequency = <8192>;
127 }; 183 };
128 }; 184 };
129 185
130 gpio_leds { 186 gpio-leds {
131 compatible = "gpio-leds"; 187 compatible = "gpio-leds";
132 pinctrl-0 = < &power_led_pin 188 pinctrl-0 = <&power_led_pin
133 &sata1_led_pin 189 &sata1_led_pin
134 &sata2_led_pin 190 &sata2_led_pin
135 &backup_led_pin >; 191 &backup_led_pin>;
136 pinctrl-names = "default"; 192 pinctrl-names = "default";
137 193
138 blue_power_led { 194 blue-power-led {
139 label = "rn102:blue:pwr"; 195 label = "rn102:blue:pwr";
140 gpios = <&gpio1 25 1>; /* GPIO 57 Active Low */ 196 gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
141 linux,default-trigger = "heartbeat"; 197 default-state = "keep";
142 }; 198 };
143 199
144 green_sata1_led { 200 green-sata1-led {
145 label = "rn102:green:sata1"; 201 label = "rn102:green:sata1";
146 gpios = <&gpio0 15 1>; /* GPIO 15 Active Low */ 202 gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
147 default-state = "on"; 203 default-state = "on";
148 }; 204 };
149 205
150 green_sata2_led { 206 green-sata2-led {
151 label = "rn102:green:sata2"; 207 label = "rn102:green:sata2";
152 gpios = <&gpio0 14 1>; /* GPIO 14 Active Low */ 208 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
153 default-state = "on"; 209 default-state = "on";
154 }; 210 };
155 211
156 green_backup_led { 212 green-backup-led {
157 label = "rn102:green:backup"; 213 label = "rn102:green:backup";
158 gpios = <&gpio1 24 1>; /* GPIO 56 Active Low */ 214 gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
159 default-state = "on"; 215 default-state = "on";
160 }; 216 };
161 }; 217 };
162 218
163 gpio_keys { 219 gpio-keys {
164 compatible = "gpio-keys"; 220 compatible = "gpio-keys";
165 #address-cells = <1>; 221 pinctrl-0 = <&power_button_pin
166 #size-cells = <0>; 222 &reset_button_pin
223 &backup_button_pin>;
224 pinctrl-names = "default";
167 225
168 button@1 { 226 power-button {
169 label = "Power Button"; 227 label = "Power Button";
170 linux,code = <116>; /* KEY_POWER */ 228 linux,code = <KEY_POWER>;
171 gpios = <&gpio1 30 0>; 229 gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
172 }; 230 };
173 231
174 button@2 { 232 reset-button {
175 label = "Reset Button"; 233 label = "Reset Button";
176 linux,code = <0x198>; /* KEY_RESTART */ 234 linux,code = <KEY_RESTART>;
177 gpios = <&gpio0 6 1>; 235 gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
178 }; 236 };
179 237
180 button@3 { 238 backup-button {
181 label = "Backup Button"; 239 label = "Backup Button";
182 linux,code = <133>; /* KEY_COPY */ 240 linux,code = <KEY_COPY>;
183 gpios = <&gpio1 26 1>; 241 gpios = <&gpio1 26 GPIO_ACTIVE_LOW>;
184 }; 242 };
185 }; 243 };
186 244
187 gpio_poweroff { 245 gpio-poweroff {
188 compatible = "gpio-poweroff"; 246 compatible = "gpio-poweroff";
189 pinctrl-0 = <&poweroff>; 247 pinctrl-0 = <&poweroff>;
190 pinctrl-names = "default"; 248 pinctrl-names = "default";
191 gpios = <&gpio0 8 1>; 249 gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
192 }; 250 };
193
194}; 251};
diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
index b0b32f5fbeb4..4e27587667bf 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
@@ -11,6 +11,8 @@
11 11
12/dts-v1/; 12/dts-v1/;
13 13
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/gpio/gpio.h>
14#include "armada-370.dtsi" 16#include "armada-370.dtsi"
15 17
16/ { 18/ {
@@ -58,12 +60,12 @@
58 marvell,function = "gpio"; 60 marvell,function = "gpio";
59 }; 61 };
60 62
61 backup_key_pin: backup-key-pin { 63 backup_button_pin: backup-button-pin {
62 marvell,pins = "mpp52"; 64 marvell,pins = "mpp52";
63 marvell,function = "gpio"; 65 marvell,function = "gpio";
64 }; 66 };
65 67
66 power_key_pin: power-key-pin { 68 power_button_pin: power-button-pin {
67 marvell,pins = "mpp62"; 69 marvell,pins = "mpp62";
68 marvell,function = "gpio"; 70 marvell,function = "gpio";
69 }; 71 };
@@ -78,18 +80,18 @@
78 marvell,function = "gpio"; 80 marvell,function = "gpio";
79 }; 81 };
80 82
81 reset_key_pin: reset-key-pin { 83 reset_button_pin: reset-button-pin {
82 marvell,pins = "mpp65"; 84 marvell,pins = "mpp65";
83 marvell,function = "gpio"; 85 marvell,function = "gpio";
84 }; 86 };
85 }; 87 };
86 88
87 mdio { 89 mdio {
88 phy0: ethernet-phy@0 { 90 phy0: ethernet-phy@0 { /* Marvell 88E1318 */
89 reg = <0>; 91 reg = <0>;
90 }; 92 };
91 93
92 phy1: ethernet-phy@1 { 94 phy1: ethernet-phy@1 { /* Marvell 88E1318 */
93 reg = <1>; 95 reg = <1>;
94 }; 96 };
95 }; 97 };
@@ -115,6 +117,11 @@
115 clock-frequency = <100000>; 117 clock-frequency = <100000>;
116 status = "okay"; 118 status = "okay";
117 119
120 isl12057: isl12057@68 {
121 compatible = "isl,isl12057";
122 reg = <0x68>;
123 };
124
118 g762: g762@3e { 125 g762: g762@3e {
119 compatible = "gmt,g762"; 126 compatible = "gmt,g762";
120 reg = <0x3e>; 127 reg = <0x3e>;
@@ -123,71 +130,133 @@
123 fan_startv = <1>; 130 fan_startv = <1>;
124 pwm_polarity = <0>; 131 pwm_polarity = <0>;
125 }; 132 };
133
134 pca9554: pca9554@23 {
135 compatible = "nxp,pca9554";
136 gpio-controller;
137 #gpio-cells = <2>;
138 reg = <0x23>;
139 };
140 };
141
142 nand@d0000 {
143 status = "okay";
144 num-cs = <1>;
145 marvell,nand-keep-config;
146 marvell,nand-enable-arbiter;
147 nand-on-flash-bbt;
148
149 partition@0 {
150 label = "u-boot";
151 reg = <0x0000000 0x180000>; /* 1.5MB */
152 read-only;
153 };
154
155 partition@180000 {
156 label = "u-boot-env";
157 reg = <0x180000 0x20000>; /* 128KB */
158 read-only;
159 };
160
161 partition@200000 {
162 label = "uImage";
163 reg = <0x0200000 0x600000>; /* 6MB */
164 };
165
166 partition@800000 {
167 label = "minirootfs";
168 reg = <0x0800000 0x400000>; /* 4MB */
169 };
170
171 /* Last MB is for the BBT, i.e. not writable */
172 partition@c00000 {
173 label = "ubifs";
174 reg = <0x0c00000 0x7400000>; /* 116MB */
175 };
126 }; 176 };
127 }; 177 };
128 }; 178 };
129 179
130 clocks { 180 clocks {
131 #address-cells = <1>; 181 g762_clk: g762-oscillator {
132 #size-cells = <0>;
133
134 g762_clk: fixedclk {
135 compatible = "fixed-clock"; 182 compatible = "fixed-clock";
136 #clock-cells = <0>; 183 #clock-cells = <0>;
137 clock-frequency = <8192>; 184 clock-frequency = <8192>;
138 }; 185 };
139 }; 186 };
140 187
141 gpio_leds { 188 gpio-leds {
142 compatible = "gpio-leds"; 189 compatible = "gpio-leds";
143 pinctrl-0 = <&backup_led_pin &power_led_pin>; 190 pinctrl-0 = <&backup_led_pin &power_led_pin>;
144 pinctrl-names = "default"; 191 pinctrl-names = "default";
145 192
146 blue_backup_led { 193 blue-backup-led {
147 label = "rn104:blue:backup"; 194 label = "rn104:blue:backup";
148 gpios = <&gpio1 31 0>; /* GPIO 63 Active High */ 195 gpios = <&gpio1 31 GPIO_ACTIVE_HIGH>;
149 default-state = "off"; 196 default-state = "off";
150 }; 197 };
151 198
152 blue_power_led { 199 blue-power-led {
153 label = "rn104:blue:pwr"; 200 label = "rn104:blue:pwr";
154 gpios = <&gpio2 0 1>; /* GPIO 64 Active Low */ 201 gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
155 linux,default-trigger = "keep"; 202 linux,default-trigger = "keep";
156 }; 203 };
204
205 blue-sata1-led {
206 label = "rn104:blue:sata1";
207 gpios = <&pca9554 0 GPIO_ACTIVE_LOW>;
208 default-state = "off";
209 };
210
211 blue-sata2-led {
212 label = "rn104:blue:sata2";
213 gpios = <&pca9554 1 GPIO_ACTIVE_LOW>;
214 default-state = "off";
215 };
216
217 blue-sata3-led {
218 label = "rn104:blue:sata3";
219 gpios = <&pca9554 2 GPIO_ACTIVE_LOW>;
220 default-state = "off";
221 };
222
223 blue-sata4-led {
224 label = "rn104:blue:sata4";
225 gpios = <&pca9554 3 GPIO_ACTIVE_LOW>;
226 default-state = "off";
227 };
157 }; 228 };
158 229
159 gpio_keys { 230 gpio-keys {
160 compatible = "gpio-keys"; 231 compatible = "gpio-keys";
161 #address-cells = <1>; 232 pinctrl-0 = <&backup_button_pin
162 #size-cells = <0>; 233 &power_button_pin
163 pinctrl-0 = <&backup_key_pin 234 &reset_button_pin>;
164 &power_key_pin
165 &reset_key_pin>;
166 pinctrl-names = "default"; 235 pinctrl-names = "default";
167 236
168 button@1 { 237 backup-button {
169 label = "Backup Button"; 238 label = "Backup Button";
170 linux,code = <133>; /* KEY_COPY */ 239 linux,code = <KEY_COPY>;
171 gpios = <&gpio1 20 1>; 240 gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
172 }; 241 };
173 242
174 button@2 { 243 power-button {
175 label = "Power Button"; 244 label = "Power Button";
176 linux,code = <116>; /* KEY_POWER */ 245 linux,code = <KEY_POWER>;
177 gpios = <&gpio1 30 0>; 246 gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
178 }; 247 };
179 248
180 button@3 { 249 reset-button {
181 label = "Reset Button"; 250 label = "Reset Button";
182 linux,code = <0x198>; /* KEY_RESTART */ 251 linux,code = <KEY_RESTART>;
183 gpios = <&gpio2 1 1>; 252 gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
184 }; 253 };
185 }; 254 };
186 255
187 gpio_poweroff { 256 gpio-poweroff {
188 compatible = "gpio-poweroff"; 257 compatible = "gpio-poweroff";
189 pinctrl-0 = <&poweroff>; 258 pinctrl-0 = <&poweroff>;
190 pinctrl-names = "default"; 259 pinctrl-names = "default";
191 gpios = <&gpio1 28 1>; 260 gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
192 }; 261 };
193}; 262};
diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index f81810a59629..abbb807459d2 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -104,6 +104,27 @@
104 gpios = <&gpio0 6 1>; 104 gpios = <&gpio0 6 1>;
105 }; 105 };
106 }; 106 };
107
108 nand@d0000 {
109 status = "okay";
110 num-cs = <1>;
111 marvell,nand-keep-config;
112 marvell,nand-enable-arbiter;
113 nand-on-flash-bbt;
114
115 partition@0 {
116 label = "U-Boot";
117 reg = <0 0x800000>;
118 };
119 partition@800000 {
120 label = "Linux";
121 reg = <0x800000 0x800000>;
122 };
123 partition@1000000 {
124 label = "Filesystem";
125 reg = <0x1000000 0x3f000000>;
126 };
127 };
107 }; 128 };
108 }; 129 };
109 }; 130 };
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 7f10f627ae5b..74b5964430ac 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -103,22 +103,52 @@
103 #size-cells = <1>; 103 #size-cells = <1>;
104 ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>; 104 ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;
105 105
106 mbusc: mbus-controller@20000 { 106 rtc@10300 {
107 compatible = "marvell,mbus-controller"; 107 compatible = "marvell,orion-rtc";
108 reg = <0x20000 0x100>, <0x20180 0x20>; 108 reg = <0x10300 0x20>;
109 interrupts = <50>;
109 }; 110 };
110 111
111 mpic: interrupt-controller@20000 { 112 spi0: spi@10600 {
112 compatible = "marvell,mpic"; 113 compatible = "marvell,orion-spi";
113 #interrupt-cells = <1>; 114 reg = <0x10600 0x28>;
114 #size-cells = <1>; 115 #address-cells = <1>;
115 interrupt-controller; 116 #size-cells = <0>;
116 msi-controller; 117 cell-index = <0>;
118 interrupts = <30>;
119 clocks = <&coreclk 0>;
120 status = "disabled";
117 }; 121 };
118 122
119 coherency-fabric@20200 { 123 spi1: spi@10680 {
120 compatible = "marvell,coherency-fabric"; 124 compatible = "marvell,orion-spi";
121 reg = <0x20200 0xb0>, <0x21010 0x1c>; 125 reg = <0x10680 0x28>;
126 #address-cells = <1>;
127 #size-cells = <0>;
128 cell-index = <1>;
129 interrupts = <92>;
130 clocks = <&coreclk 0>;
131 status = "disabled";
132 };
133
134 i2c0: i2c@11000 {
135 compatible = "marvell,mv64xxx-i2c";
136 #address-cells = <1>;
137 #size-cells = <0>;
138 interrupts = <31>;
139 timeout-ms = <1000>;
140 clocks = <&coreclk 0>;
141 status = "disabled";
142 };
143
144 i2c1: i2c@11100 {
145 compatible = "marvell,mv64xxx-i2c";
146 #address-cells = <1>;
147 #size-cells = <0>;
148 interrupts = <32>;
149 timeout-ms = <1000>;
150 clocks = <&coreclk 0>;
151 status = "disabled";
122 }; 152 };
123 153
124 serial@12000 { 154 serial@12000 {
@@ -146,25 +176,41 @@
146 clock-output-names = "nand"; 176 clock-output-names = "nand";
147 }; 177 };
148 178
179 mbusc: mbus-controller@20000 {
180 compatible = "marvell,mbus-controller";
181 reg = <0x20000 0x100>, <0x20180 0x20>;
182 };
183
184 mpic: interrupt-controller@20000 {
185 compatible = "marvell,mpic";
186 #interrupt-cells = <1>;
187 #size-cells = <1>;
188 interrupt-controller;
189 msi-controller;
190 };
191
192 coherency-fabric@20200 {
193 compatible = "marvell,coherency-fabric";
194 reg = <0x20200 0xb0>, <0x21010 0x1c>;
195 };
196
149 timer@20300 { 197 timer@20300 {
150 reg = <0x20300 0x30>, <0x21040 0x30>; 198 reg = <0x20300 0x30>, <0x21040 0x30>;
151 interrupts = <37>, <38>, <39>, <40>, <5>, <6>; 199 interrupts = <37>, <38>, <39>, <40>, <5>, <6>;
152 }; 200 };
153 201
154 sata@a0000 { 202 usb@50000 {
155 compatible = "marvell,orion-sata"; 203 compatible = "marvell,orion-ehci";
156 reg = <0xa0000 0x5000>; 204 reg = <0x50000 0x500>;
157 interrupts = <55>; 205 interrupts = <45>;
158 clocks = <&gateclk 15>, <&gateclk 30>;
159 clock-names = "0", "1";
160 status = "disabled"; 206 status = "disabled";
161 }; 207 };
162 208
163 mdio { 209 usb@51000 {
164 #address-cells = <1>; 210 compatible = "marvell,orion-ehci";
165 #size-cells = <0>; 211 reg = <0x51000 0x500>;
166 compatible = "marvell,orion-mdio"; 212 interrupts = <46>;
167 reg = <0x72004 0x4>; 213 status = "disabled";
168 }; 214 };
169 215
170 eth0: ethernet@70000 { 216 eth0: ethernet@70000 {
@@ -175,6 +221,13 @@
175 status = "disabled"; 221 status = "disabled";
176 }; 222 };
177 223
224 mdio {
225 #address-cells = <1>;
226 #size-cells = <0>;
227 compatible = "marvell,orion-mdio";
228 reg = <0x72004 0x4>;
229 };
230
178 eth1: ethernet@74000 { 231 eth1: ethernet@74000 {
179 compatible = "marvell,armada-370-neta"; 232 compatible = "marvell,armada-370-neta";
180 reg = <0x74000 0x4000>; 233 reg = <0x74000 0x4000>;
@@ -183,32 +236,25 @@
183 status = "disabled"; 236 status = "disabled";
184 }; 237 };
185 238
186 i2c0: i2c@11000 { 239 sata@a0000 {
187 compatible = "marvell,mv64xxx-i2c"; 240 compatible = "marvell,armada-370-sata";
188 #address-cells = <1>; 241 reg = <0xa0000 0x5000>;
189 #size-cells = <0>; 242 interrupts = <55>;
190 interrupts = <31>; 243 clocks = <&gateclk 15>, <&gateclk 30>;
191 timeout-ms = <1000>; 244 clock-names = "0", "1";
192 clocks = <&coreclk 0>;
193 status = "disabled"; 245 status = "disabled";
194 }; 246 };
195 247
196 i2c1: i2c@11100 { 248 nand@d0000 {
197 compatible = "marvell,mv64xxx-i2c"; 249 compatible = "marvell,armada370-nand";
250 reg = <0xd0000 0x54>;
198 #address-cells = <1>; 251 #address-cells = <1>;
199 #size-cells = <0>; 252 #size-cells = <1>;
200 interrupts = <32>; 253 interrupts = <113>;
201 timeout-ms = <1000>; 254 clocks = <&coredivclk 0>;
202 clocks = <&coreclk 0>;
203 status = "disabled"; 255 status = "disabled";
204 }; 256 };
205 257
206 rtc@10300 {
207 compatible = "marvell,orion-rtc";
208 reg = <0x10300 0x20>;
209 interrupts = <50>;
210 };
211
212 mvsdio@d4000 { 258 mvsdio@d4000 {
213 compatible = "marvell,orion-sdio"; 259 compatible = "marvell,orion-sdio";
214 reg = <0xd4000 0x200>; 260 reg = <0xd4000 0x200>;
@@ -220,43 +266,6 @@
220 cap-mmc-highspeed; 266 cap-mmc-highspeed;
221 status = "disabled"; 267 status = "disabled";
222 }; 268 };
223
224 usb@50000 {
225 compatible = "marvell,orion-ehci";
226 reg = <0x50000 0x500>;
227 interrupts = <45>;
228 status = "disabled";
229 };
230
231 usb@51000 {
232 compatible = "marvell,orion-ehci";
233 reg = <0x51000 0x500>;
234 interrupts = <46>;
235 status = "disabled";
236 };
237
238 spi0: spi@10600 {
239 compatible = "marvell,orion-spi";
240 reg = <0x10600 0x28>;
241 #address-cells = <1>;
242 #size-cells = <0>;
243 cell-index = <0>;
244 interrupts = <30>;
245 clocks = <&coreclk 0>;
246 status = "disabled";
247 };
248
249 spi1: spi@10680 {
250 compatible = "marvell,orion-spi";
251 reg = <0x10680 0x28>;
252 #address-cells = <1>;
253 #size-cells = <0>;
254 cell-index = <1>;
255 interrupts = <92>;
256 clocks = <&coreclk 0>;
257 status = "disabled";
258 };
259
260 }; 269 };
261 }; 270 };
262 271
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 7a4b82e71aaf..0d8530c98cf5 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -91,11 +91,6 @@
91 }; 91 };
92 92
93 internal-regs { 93 internal-regs {
94 system-controller@18200 {
95 compatible = "marvell,armada-370-xp-system-controller";
96 reg = <0x18200 0x100>;
97 };
98
99 L2: l2-cache { 94 L2: l2-cache {
100 compatible = "marvell,aurora-outer-cache"; 95 compatible = "marvell,aurora-outer-cache";
101 reg = <0x08000 0x1000>; 96 reg = <0x08000 0x1000>;
@@ -103,8 +98,17 @@
103 wt-override; 98 wt-override;
104 }; 99 };
105 100
106 interrupt-controller@20000 { 101 i2c0: i2c@11000 {
107 reg = <0x20a00 0x1d0>, <0x21870 0x58>; 102 reg = <0x11000 0x20>;
103 };
104
105 i2c1: i2c@11100 {
106 reg = <0x11100 0x20>;
107 };
108
109 system-controller@18200 {
110 compatible = "marvell,armada-370-xp-system-controller";
111 reg = <0x18200 0x100>;
108 }; 112 };
109 113
110 pinctrl { 114 pinctrl {
@@ -163,9 +167,11 @@
163 interrupts = <91>; 167 interrupts = <91>;
164 }; 168 };
165 169
166 timer@20300 { 170 gateclk: clock-gating-control@18220 {
167 compatible = "marvell,armada-370-timer"; 171 compatible = "marvell,armada-370-gating-clock";
168 clocks = <&coreclk 2>; 172 reg = <0x18220 0x4>;
173 clocks = <&coreclk 0>;
174 #clock-cells = <1>;
169 }; 175 };
170 176
171 coreclk: mvebu-sar@18230 { 177 coreclk: mvebu-sar@18230 {
@@ -174,11 +180,28 @@
174 #clock-cells = <1>; 180 #clock-cells = <1>;
175 }; 181 };
176 182
177 gateclk: clock-gating-control@18220 { 183 thermal@18300 {
178 compatible = "marvell,armada-370-gating-clock"; 184 compatible = "marvell,armada370-thermal";
179 reg = <0x18220 0x4>; 185 reg = <0x18300 0x4
186 0x18304 0x4>;
187 status = "okay";
188 };
189
190 interrupt-controller@20000 {
191 reg = <0x20a00 0x1d0>, <0x21870 0x58>;
192 };
193
194 timer@20300 {
195 compatible = "marvell,armada-370-timer";
196 clocks = <&coreclk 2>;
197 };
198
199 usb@50000 {
200 clocks = <&coreclk 0>;
201 };
202
203 usb@51000 {
180 clocks = <&coreclk 0>; 204 clocks = <&coreclk 0>;
181 #clock-cells = <1>;
182 }; 205 };
183 206
184 xor@60800 { 207 xor@60800 {
@@ -218,29 +241,6 @@
218 dmacap,memset; 241 dmacap,memset;
219 }; 242 };
220 }; 243 };
221
222 i2c0: i2c@11000 {
223 reg = <0x11000 0x20>;
224 };
225
226 i2c1: i2c@11100 {
227 reg = <0x11100 0x20>;
228 };
229
230 usb@50000 {
231 clocks = <&coreclk 0>;
232 };
233
234 usb@51000 {
235 clocks = <&coreclk 0>;
236 };
237
238 thermal@18300 {
239 compatible = "marvell,armada370-thermal";
240 reg = <0x18300 0x4
241 0x18304 0x4>;
242 status = "okay";
243 };
244 }; 244 };
245 }; 245 };
246}; 246};
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index 2298e4a910e2..274e2ad5f51c 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -175,6 +175,14 @@
175 spi-max-frequency = <108000000>; 175 spi-max-frequency = <108000000>;
176 }; 176 };
177 }; 177 };
178
179 nand@d0000 {
180 status = "okay";
181 num-cs = <1>;
182 marvell,nand-keep-config;
183 marvell,nand-enable-arbiter;
184 nand-on-flash-bbt;
185 };
178 }; 186 };
179 }; 187 };
180}; 188};
diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
new file mode 100644
index 000000000000..ff049ee862eb
--- /dev/null
+++ b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
@@ -0,0 +1,327 @@
1/*
2 * Device Tree file for NETGEAR ReadyNAS 2120
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 <dt-bindings/input/input.h>
15#include <dt-bindings/gpio/gpio.h>
16#include "armada-xp-mv78230.dtsi"
17
18/ {
19 model = "NETGEAR ReadyNAS 2120";
20 compatible = "netgear,readynas-2120", "marvell,armadaxp-mv78230", "marvell,armadaxp", "marvell,armada-370-xp";
21
22 chosen {
23 bootargs = "console=ttyS0,115200 earlyprintk";
24 };
25
26 memory {
27 device_type = "memory";
28 reg = <0 0x00000000 0 0x80000000>; /* 2GB */
29 };
30
31 soc {
32 ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
33 MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
34
35 pcie-controller {
36 status = "okay";
37
38 /* Connected to first Marvell 88SE9170 SATA controller */
39 pcie@1,0 {
40 /* Port 0, Lane 0 */
41 status = "okay";
42 };
43
44 /* Connected to second Marvell 88SE9170 SATA controller */
45 pcie@2,0 {
46 /* Port 0, Lane 1 */
47 status = "okay";
48 };
49
50 /* Connected to Fresco Logic FL1009 USB 3.0 controller */
51 pcie@5,0 {
52 /* Port 1, Lane 0 */
53 status = "okay";
54 };
55 };
56
57 internal-regs {
58 pinctrl {
59 poweroff: poweroff {
60 marvell,pins = "mpp42";
61 marvell,function = "gpio";
62 };
63
64 power_button_pin: power-button-pin {
65 marvell,pins = "mpp27";
66 marvell,function = "gpio";
67 };
68
69 reset_button_pin: reset-button-pin {
70 marvell,pins = "mpp41";
71 marvell,function = "gpio";
72 };
73
74 sata1_led_pin: sata1-led-pin {
75 marvell,pins = "mpp31";
76 marvell,function = "gpio";
77 };
78
79 sata2_led_pin: sata2-led-pin {
80 marvell,pins = "mpp40";
81 marvell,function = "gpio";
82 };
83
84 sata3_led_pin: sata3-led-pin {
85 marvell,pins = "mpp44";
86 marvell,function = "gpio";
87 };
88
89 sata4_led_pin: sata4-led-pin {
90 marvell,pins = "mpp47";
91 marvell,function = "gpio";
92 };
93
94 sata1_power_pin: sata1-power-pin {
95 marvell,pins = "mpp24";
96 marvell,function = "gpio";
97 };
98
99 sata2_power_pin: sata2-power-pin {
100 marvell,pins = "mpp25";
101 marvell,function = "gpio";
102 };
103
104 sata3_power_pin: sata3-power-pin {
105 marvell,pins = "mpp26";
106 marvell,function = "gpio";
107 };
108
109 sata4_power_pin: sata4-power-pin {
110 marvell,pins = "mpp28";
111 marvell,function = "gpio";
112 };
113
114 sata1_pres_pin: sata1-pres-pin {
115 marvell,pins = "mpp32";
116 marvell,function = "gpio";
117 };
118
119 sata2_pres_pin: sata2-pres-pin {
120 marvell,pins = "mpp33";
121 marvell,function = "gpio";
122 };
123
124 sata3_pres_pin: sata3-pres-pin {
125 marvell,pins = "mpp34";
126 marvell,function = "gpio";
127 };
128
129 sata4_pres_pin: sata4-pres-pin {
130 marvell,pins = "mpp35";
131 marvell,function = "gpio";
132 };
133
134 err_led_pin: err-led-pin {
135 marvell,pins = "mpp45";
136 marvell,function = "gpio";
137 };
138 };
139
140 serial@12000 {
141 clocks = <&coreclk 0>;
142 status = "okay";
143 };
144
145 mdio {
146 phy0: ethernet-phy@0 { /* Marvell 88E1318 */
147 reg = <0>;
148 };
149
150 phy1: ethernet-phy@1 { /* Marvell 88E1318 */
151 reg = <1>;
152 };
153 };
154
155 ethernet@70000 {
156 status = "okay";
157 phy = <&phy0>;
158 phy-mode = "rgmii-id";
159 };
160
161 ethernet@74000 {
162 status = "okay";
163 phy = <&phy1>;
164 phy-mode = "rgmii-id";
165 };
166
167 /* Front USB 2.0 port */
168 usb@50000 {
169 status = "okay";
170 };
171
172 i2c@11000 {
173 compatible = "marvell,mv64xxx-i2c";
174 clock-frequency = <400000>;
175 status = "okay";
176
177 isl12057: isl12057@68 {
178 compatible = "isl,isl12057";
179 reg = <0x68>;
180 };
181
182 /* Controller for rear fan #1 of 3 (Protechnic
183 * MGT4012XB-O20, 8000RPM) near eSATA port */
184 g762_fan1: g762@3e {
185 compatible = "gmt,g762";
186 reg = <0x3e>;
187 clocks = <&g762_clk>; /* input clock */
188 fan_gear_mode = <0>;
189 fan_startv = <1>;
190 pwm_polarity = <0>;
191 };
192
193 /* Controller for rear (center) fan #2 of 3 */
194 g762_fan2: g762@48 {
195 compatible = "gmt,g762";
196 reg = <0x48>;
197 clocks = <&g762_clk>; /* input clock */
198 fan_gear_mode = <0>;
199 fan_startv = <1>;
200 pwm_polarity = <0>;
201 };
202
203 /* Controller for rear fan #3 of 3 */
204 g762_fan3: g762@49 {
205 compatible = "gmt,g762";
206 reg = <0x49>;
207 clocks = <&g762_clk>; /* input clock */
208 fan_gear_mode = <0>;
209 fan_startv = <1>;
210 pwm_polarity = <0>;
211 };
212
213 /* Temperature sensor */
214 g751: g751@4c {
215 compatible = "gmt,g751";
216 reg = <0x4c>;
217 };
218 };
219
220 nand@d0000 {
221 status = "okay";
222 num-cs = <1>;
223 marvell,nand-keep-config;
224 marvell,nand-enable-arbiter;
225 nand-on-flash-bbt;
226
227 partition@0 {
228 label = "u-boot";
229 reg = <0x0000000 0x180000>; /* 1.5MB */
230 read-only;
231 };
232
233 partition@180000 {
234 label = "u-boot-env";
235 reg = <0x180000 0x20000>; /* 128KB */
236 read-only;
237 };
238
239 partition@200000 {
240 label = "uImage";
241 reg = <0x0200000 0x600000>; /* 6MB */
242 };
243
244 partition@800000 {
245 label = "minirootfs";
246 reg = <0x0800000 0x400000>; /* 4MB */
247 };
248
249 /* Last MB is for the BBT, i.e. not writable */
250 partition@c00000 {
251 label = "ubifs";
252 reg = <0x0c00000 0x7400000>; /* 116MB */
253 };
254 };
255 };
256 };
257
258 clocks {
259 g762_clk: g762-oscillator {
260 compatible = "fixed-clock";
261 #clock-cells = <0>;
262 clock-frequency = <32768>;
263 };
264 };
265
266 gpio-leds {
267 compatible = "gpio-leds";
268 pinctrl-0 = <&sata1_led_pin &sata2_led_pin &err_led_pin
269 &sata3_led_pin &sata4_led_pin>;
270 pinctrl-names = "default";
271
272 red-sata1-led {
273 label = "rn2120:red:sata1";
274 gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
275 default-state = "off";
276 };
277
278 red-sata2-led {
279 label = "rn2120:red:sata2";
280 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
281 default-state = "off";
282 };
283
284 red-sata3-led {
285 label = "rn2120:red:sata3";
286 gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
287 default-state = "off";
288 };
289
290 red-sata4-led {
291 label = "rn2120:red:sata4";
292 gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
293 default-state = "off";
294 };
295
296 red-err-led {
297 label = "rn2120:red:err";
298 gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
299 default-state = "off";
300 };
301 };
302
303 gpio-keys {
304 compatible = "gpio-keys";
305 pinctrl-0 = <&power_button_pin &reset_button_pin>;
306 pinctrl-names = "default";
307
308 power-button {
309 label = "Power Button";
310 linux,code = <KEY_POWER>;
311 gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
312 };
313
314 reset-button {
315 label = "Reset Button";
316 linux,code = <KEY_RESTART>;
317 gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
318 };
319 };
320
321 gpio-poweroff {
322 compatible = "gpio-poweroff";
323 pinctrl-0 = <&poweroff>;
324 pinctrl-names = "default";
325 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
326 };
327};
diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
index 5695afcc04bf..99bcf76e6953 100644
--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
@@ -103,8 +103,7 @@
103 green_led { 103 green_led {
104 label = "green_led"; 104 label = "green_led";
105 gpios = <&gpio1 21 1>; 105 gpios = <&gpio1 21 1>;
106 default-state = "off"; 106 default-state = "keep";
107 linux,default-trigger = "heartbeat";
108 }; 107 };
109 }; 108 };
110 109
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index 281c6447e872..b8b84a22f0f3 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -42,13 +42,14 @@
42 wt-override; 42 wt-override;
43 }; 43 };
44 44
45 interrupt-controller@20000 { 45 i2c0: i2c@11000 {
46 reg = <0x20a00 0x2d0>, <0x21070 0x58>; 46 compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
47 reg = <0x11000 0x100>;
47 }; 48 };
48 49
49 armada-370-xp-pmsu@22000 { 50 i2c1: i2c@11100 {
50 compatible = "marvell,armada-370-xp-pmsu"; 51 compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
51 reg = <0x22100 0x430>, <0x20800 0x20>; 52 reg = <0x11100 0x100>;
52 }; 53 };
53 54
54 serial@12200 { 55 serial@12200 {
@@ -68,10 +69,16 @@
68 status = "disabled"; 69 status = "disabled";
69 }; 70 };
70 71
71 timer@20300 { 72 system-controller@18200 {
72 compatible = "marvell,armada-xp-timer"; 73 compatible = "marvell,armada-370-xp-system-controller";
73 clocks = <&coreclk 2>, <&refclk>; 74 reg = <0x18200 0x500>;
74 clock-names = "nbclk", "fixed"; 75 };
76
77 gateclk: clock-gating-control@18220 {
78 compatible = "marvell,armada-xp-gating-clock";
79 reg = <0x18220 0x4>;
80 clocks = <&coreclk 0>;
81 #clock-cells = <1>;
75 }; 82 };
76 83
77 coreclk: mvebu-sar@18230 { 84 coreclk: mvebu-sar@18230 {
@@ -80,6 +87,13 @@
80 #clock-cells = <1>; 87 #clock-cells = <1>;
81 }; 88 };
82 89
90 thermal@182b0 {
91 compatible = "marvell,armadaxp-thermal";
92 reg = <0x182b0 0x4
93 0x184d0 0x4>;
94 status = "okay";
95 };
96
83 cpuclk: clock-complex@18700 { 97 cpuclk: clock-complex@18700 {
84 #clock-cells = <1>; 98 #clock-cells = <1>;
85 compatible = "marvell,armada-xp-cpu-clock"; 99 compatible = "marvell,armada-xp-cpu-clock";
@@ -87,16 +101,19 @@
87 clocks = <&coreclk 1>; 101 clocks = <&coreclk 1>;
88 }; 102 };
89 103
90 gateclk: clock-gating-control@18220 { 104 interrupt-controller@20000 {
91 compatible = "marvell,armada-xp-gating-clock"; 105 reg = <0x20a00 0x2d0>, <0x21070 0x58>;
92 reg = <0x18220 0x4>;
93 clocks = <&coreclk 0>;
94 #clock-cells = <1>;
95 }; 106 };
96 107
97 system-controller@18200 { 108 timer@20300 {
98 compatible = "marvell,armada-370-xp-system-controller"; 109 compatible = "marvell,armada-xp-timer";
99 reg = <0x18200 0x500>; 110 clocks = <&coreclk 2>, <&refclk>;
111 clock-names = "nbclk", "fixed";
112 };
113
114 armada-370-xp-pmsu@22000 {
115 compatible = "marvell,armada-370-xp-pmsu";
116 reg = <0x22100 0x400>, <0x20800 0x20>;
100 }; 117 };
101 118
102 eth2: ethernet@30000 { 119 eth2: ethernet@30000 {
@@ -107,6 +124,22 @@
107 status = "disabled"; 124 status = "disabled";
108 }; 125 };
109 126
127 usb@50000 {
128 clocks = <&gateclk 18>;
129 };
130
131 usb@51000 {
132 clocks = <&gateclk 19>;
133 };
134
135 usb@52000 {
136 compatible = "marvell,orion-ehci";
137 reg = <0x52000 0x500>;
138 interrupts = <47>;
139 clocks = <&gateclk 20>;
140 status = "disabled";
141 };
142
110 xor@60900 { 143 xor@60900 {
111 compatible = "marvell,orion-xor"; 144 compatible = "marvell,orion-xor";
112 reg = <0x60900 0x100 145 reg = <0x60900 0x100
@@ -146,39 +179,6 @@
146 dmacap,memset; 179 dmacap,memset;
147 }; 180 };
148 }; 181 };
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
160 usb@50000 {
161 clocks = <&gateclk 18>;
162 };
163
164 usb@51000 {
165 clocks = <&gateclk 19>;
166 };
167
168 usb@52000 {
169 compatible = "marvell,orion-ehci";
170 reg = <0x52000 0x500>;
171 interrupts = <47>;
172 clocks = <&gateclk 20>;
173 status = "disabled";
174 };
175
176 thermal@182b0 {
177 compatible = "marvell,armadaxp-thermal";
178 reg = <0x182b0 0x4
179 0x184d0 0x4>;
180 status = "okay";
181 };
182 }; 182 };
183 }; 183 };
184 184
diff --git a/arch/arm/boot/dts/armv7-m.dtsi b/arch/arm/boot/dts/armv7-m.dtsi
new file mode 100644
index 000000000000..5a660d0faf42
--- /dev/null
+++ b/arch/arm/boot/dts/armv7-m.dtsi
@@ -0,0 +1,18 @@
1#include "skeleton.dtsi"
2
3/ {
4 nvic: nv-interrupt-controller {
5 compatible = "arm,armv7m-nvic";
6 interrupt-controller;
7 #interrupt-cells = <1>;
8 reg = <0xe000e100 0xc00>;
9 };
10
11 soc {
12 #address-cells = <1>;
13 #size-cells = <1>;
14 compatible = "simple-bus";
15 interrupt-parent = <&nvic>;
16 ranges;
17 };
18};
diff --git a/arch/arm/boot/dts/at91-cosino.dtsi b/arch/arm/boot/dts/at91-cosino.dtsi
new file mode 100644
index 000000000000..2093c4d7cd6a
--- /dev/null
+++ b/arch/arm/boot/dts/at91-cosino.dtsi
@@ -0,0 +1,122 @@
1/*
2 * at91-cosino.dtsi - Device Tree file for Cosino core module
3 *
4 * Copyright (C) 2013 - Rodolfo Giometti <giometti@linux.it>
5 * HCE Engineering
6 *
7 * Derived from at91sam9x5ek.dtsi by:
8 * Copyright (C) 2012 Atmel,
9 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
10 *
11 * Licensed under GPLv2 or later.
12 */
13
14#include "at91sam9g35.dtsi"
15
16/ {
17 model = "HCE Cosino core module";
18 compatible = "hce,cosino", "atmel,at91sam9x5", "atmel,at91sam9";
19
20 chosen {
21 bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait";
22 };
23
24 memory {
25 reg = <0x20000000 0x8000000>;
26 };
27
28 clocks {
29 #address-cells = <1>;
30 #size-cells = <1>;
31 ranges;
32
33 main_clock: clock@0 {
34 compatible = "atmel,osc", "fixed-clock";
35 clock-frequency = <12000000>;
36 };
37 };
38
39 ahb {
40 apb {
41 mmc0: mmc@f0008000 {
42 pinctrl-0 = <
43 &pinctrl_board_mmc0
44 &pinctrl_mmc0_slot0_clk_cmd_dat0
45 &pinctrl_mmc0_slot0_dat1_3>;
46 status = "okay";
47 slot@0 {
48 reg = <0>;
49 bus-width = <4>;
50 cd-gpios = <&pioD 15 GPIO_ACTIVE_HIGH>;
51 };
52 };
53
54 dbgu: serial@fffff200 {
55 status = "okay";
56 };
57
58 usart0: serial@f801c000 {
59 status = "okay";
60 };
61
62 i2c0: i2c@f8010000 {
63 status = "okay";
64 };
65
66 adc0: adc@f804c000 {
67 atmel,adc-clock-rate = <1000000>;
68 atmel,adc-ts-wires = <4>;
69 atmel,adc-ts-pressure-threshold = <10000>;
70 status = "okay";
71 };
72
73 pinctrl@fffff400 {
74 mmc0 {
75 pinctrl_board_mmc0: mmc0-board {
76 atmel,pins =
77 <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PD15 gpio CD pin pull up and deglitch */
78 };
79 };
80 };
81
82 watchdog@fffffe40 {
83 status = "okay";
84 };
85 };
86
87 nand0: nand@40000000 {
88 nand-bus-width = <8>;
89 nand-ecc-mode = "hw";
90 atmel,has-pmecc; /* Enable PMECC */
91 atmel,pmecc-cap = <4>;
92 atmel,pmecc-sector-size = <512>;
93 nand-on-flash-bbt;
94 status = "okay";
95
96 at91bootstrap@0 {
97 label = "at91bootstrap";
98 reg = <0x0 0x40000>;
99 };
100
101 uboot@40000 {
102 label = "u-boot";
103 reg = <0x40000 0x80000>;
104 };
105
106 ubootenv@c0000 {
107 label = "U-Boot Env";
108 reg = <0xc0000 0x140000>;
109 };
110
111 kernel@200000 {
112 label = "kernel";
113 reg = <0x200000 0x600000>;
114 };
115
116 rootfs@800000 {
117 label = "rootfs";
118 reg = <0x800000 0x0f800000>;
119 };
120 };
121 };
122};
diff --git a/arch/arm/boot/dts/at91-cosino_mega2560.dts b/arch/arm/boot/dts/at91-cosino_mega2560.dts
new file mode 100644
index 000000000000..f9415dd11f17
--- /dev/null
+++ b/arch/arm/boot/dts/at91-cosino_mega2560.dts
@@ -0,0 +1,84 @@
1/*
2 * at91-cosino_mega2560.dts - Device Tree file for Cosino board with
3 * Mega 2560 extension
4 *
5 * Copyright (C) 2013 - Rodolfo Giometti <giometti@linux.it>
6 * HCE Engineering
7 *
8 * Derived from at91sam9g35ek.dts by:
9 * Copyright (C) 2012 Atmel,
10 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
11 *
12 * Licensed under GPLv2 or later.
13 */
14
15/dts-v1/;
16#include "at91-cosino.dtsi"
17
18/ {
19 model = "HCE Cosino Mega 2560";
20 compatible = "hce,cosino_mega2560", "atmel,at91sam9x5", "atmel,at91sam9";
21
22 ahb {
23 apb {
24 macb0: ethernet@f802c000 {
25 phy-mode = "rmii";
26 status = "okay";
27 };
28
29 adc0: adc@f804c000 {
30 atmel,adc-clock-rate = <1000000>;
31 atmel,adc-ts-wires = <4>;
32 atmel,adc-ts-pressure-threshold = <10000>;
33 status = "okay";
34 };
35
36
37 tsadcc: tsadcc@f804c000 {
38 status = "okay";
39 };
40
41 rtc@fffffeb0 {
42 status = "okay";
43 };
44
45 usart1: serial@f8020000 {
46 status = "okay";
47 };
48
49 usart2: serial@f8024000 {
50 status = "okay";
51 };
52
53 usb2: gadget@f803c000 {
54 atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
55 status = "okay";
56 };
57
58 mmc1: mmc@f000c000 {
59 pinctrl-0 = <
60 &pinctrl_mmc1_slot0_clk_cmd_dat0
61 &pinctrl_mmc1_slot0_dat1_3>;
62 status = "okay";
63 slot@0 {
64 reg = <0>;
65 bus-width = <4>;
66 non-removable;
67 };
68 };
69 };
70
71 usb0: ohci@00600000 {
72 status = "okay";
73 num-ports = <3>;
74 atmel,vbus-gpio = <0 /* &pioD 18 GPIO_ACTIVE_LOW */
75 &pioD 19 GPIO_ACTIVE_LOW
76 &pioD 20 GPIO_ACTIVE_LOW
77 >;
78 };
79
80 usb1: ehci@00700000 {
81 status = "okay";
82 };
83 };
84};
diff --git a/arch/arm/boot/dts/at91-qil_a9260.dts b/arch/arm/boot/dts/at91-qil_a9260.dts
new file mode 100644
index 000000000000..5576ae8786c0
--- /dev/null
+++ b/arch/arm/boot/dts/at91-qil_a9260.dts
@@ -0,0 +1,185 @@
1/*
2 * at91-qil_a9260.dts - Device Tree file for Calao QIL A9260 board
3 *
4 * Copyright (C) 2011-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9#include "at91sam9260.dtsi"
10/ {
11 model = "Calao QIL A9260";
12 compatible = "calao,qil-a9260", "atmel,at91sam9260", "atmel,at91sam9";
13
14 chosen {
15 bootargs = "console=ttyS0,115200";
16 };
17
18 memory {
19 reg = <0x20000000 0x4000000>;
20 };
21
22 clocks {
23 #address-cells = <1>;
24 #size-cells = <1>;
25 ranges;
26
27 main_clock: clock@0 {
28 compatible = "atmel,osc", "fixed-clock";
29 clock-frequency = <12000000>;
30 };
31 };
32
33 ahb {
34 apb {
35 usb1: gadget@fffa4000 {
36 atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>;
37 status = "okay";
38 };
39
40 mmc0: mmc@fffa8000 {
41 pinctrl-0 = <
42 &pinctrl_mmc0_clk
43 &pinctrl_mmc0_slot0_cmd_dat0
44 &pinctrl_mmc0_slot0_dat1_3>;
45 status = "okay";
46 slot@0 {
47 reg = <0>;
48 bus-width = <4>;
49 };
50 };
51
52 usart0: serial@fffb0000 {
53 pinctrl-0 =
54 <&pinctrl_usart0
55 &pinctrl_usart0_rts
56 &pinctrl_usart0_cts
57 &pinctrl_usart0_dtr_dsr
58 &pinctrl_usart0_dcd
59 &pinctrl_usart0_ri>;
60 status = "okay";
61 };
62
63 usart1: serial@fffb4000 {
64 pinctrl-0 =
65 <&pinctrl_usart1
66 &pinctrl_usart1_rts
67 &pinctrl_usart1_cts>;
68 status = "okay";
69 };
70
71 usart2: serial@fffb8000 {
72 pinctrl-0 =
73 <&pinctrl_usart2
74 &pinctrl_usart2_rts
75 &pinctrl_usart2_cts>;
76 status = "okay";
77 };
78
79 macb0: ethernet@fffc4000 {
80 phy-mode = "rmii";
81 status = "okay";
82 };
83
84 spi0: spi@fffc8000 {
85 status = "okay";
86 cs-gpios = <&pioA 3 GPIO_ACTIVE_HIGH>;
87
88 m41t94@0 {
89 compatible = "st,m41t94";
90 reg = <0>;
91 spi-max-frequency = <1000000>;
92 };
93
94 };
95
96 dbgu: serial@fffff200 {
97 status = "okay";
98 };
99
100 shdwc@fffffd10 {
101 atmel,wakeup-counter = <10>;
102 atmel,wakeup-rtt-timer;
103 };
104 };
105
106 usb0: ohci@00500000 {
107 num-ports = <2>;
108 status = "okay";
109 };
110
111 nand0: nand@40000000 {
112 nand-bus-width = <8>;
113 nand-ecc-mode = "soft";
114 nand-on-flash-bbt;
115 status = "okay";
116
117 at91bootstrap@0 {
118 label = "at91bootstrap";
119 reg = <0x0 0x20000>;
120 };
121
122 barebox@20000 {
123 label = "barebox";
124 reg = <0x20000 0x40000>;
125 };
126
127 bareboxenv@60000 {
128 label = "bareboxenv";
129 reg = <0x60000 0x20000>;
130 };
131
132 bareboxenv2@80000 {
133 label = "bareboxenv2";
134 reg = <0x80000 0x20000>;
135 };
136
137 oftree@a0000 {
138 label = "oftree";
139 reg = <0xa0000 0x20000>;
140 };
141
142 kernel@c0000 {
143 label = "kernel";
144 reg = <0xc0000 0x400000>;
145 };
146
147 rootfs@4c0000 {
148 label = "rootfs";
149 reg = <0x4c0000 0x7800000>;
150 };
151
152 data@7cc0000 {
153 label = "data";
154 reg = <0x7cc0000 0x8340000>;
155 };
156 };
157 };
158
159 leds {
160 compatible = "gpio-leds";
161
162 user_led {
163 label = "user_led";
164 gpios = <&pioB 21 GPIO_ACTIVE_HIGH>;
165 linux,default-trigger = "heartbeat";
166 };
167 };
168
169 gpio_keys {
170 compatible = "gpio-keys";
171 #address-cells = <1>;
172 #size-cells = <0>;
173
174 user_pb {
175 label = "user_pb";
176 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
177 linux,code = <28>;
178 gpio-key,wakeup;
179 };
180 };
181
182 i2c@0 {
183 status = "okay";
184 };
185};
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index f77065506f1e..c61b16fba79b 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -191,12 +191,12 @@
191 AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA18 periph A */ 191 AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA18 periph A */
192 }; 192 };
193 193
194 pinctrl_uart0_rts: uart0_rts-0 { 194 pinctrl_uart0_cts: uart0_cts-0 {
195 atmel,pins = 195 atmel,pins =
196 <AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA20 periph A */ 196 <AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA20 periph A */
197 }; 197 };
198 198
199 pinctrl_uart0_cts: uart0_cts-0 { 199 pinctrl_uart0_rts: uart0_rts-0 {
200 atmel,pins = 200 atmel,pins =
201 <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA21 periph A */ 201 <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA21 periph A */
202 }; 202 };
diff --git a/arch/arm/boot/dts/at91rm9200ek.dts b/arch/arm/boot/dts/at91rm9200ek.dts
index d2d72c3b44c4..df6b0aa0e4dd 100644
--- a/arch/arm/boot/dts/at91rm9200ek.dts
+++ b/arch/arm/boot/dts/at91rm9200ek.dts
@@ -29,10 +29,22 @@
29 29
30 ahb { 30 ahb {
31 apb { 31 apb {
32 dbgu: serial@fffff200 { 32 usb1: gadget@fffb0000 {
33 atmel,vbus-gpio = <&pioD 4 GPIO_ACTIVE_HIGH>;
34 atmel,pullup-gpio = <&pioD 5 GPIO_ACTIVE_HIGH>;
33 status = "okay"; 35 status = "okay";
34 }; 36 };
35 37
38 macb0: ethernet@fffbc000 {
39 phy-mode = "rmii";
40 status = "okay";
41
42 phy0: ethernet-phy {
43 interrupt-parent = <&pioC>;
44 interrupts = <4 IRQ_TYPE_EDGE_BOTH>;
45 };
46 };
47
36 usart1: serial@fffc4000 { 48 usart1: serial@fffc4000 {
37 pinctrl-0 = 49 pinctrl-0 =
38 <&pinctrl_uart1 50 <&pinctrl_uart1
@@ -44,16 +56,6 @@
44 status = "okay"; 56 status = "okay";
45 }; 57 };
46 58
47 macb0: ethernet@fffbc000 {
48 phy-mode = "rmii";
49 status = "okay";
50 };
51
52 usb1: gadget@fffb0000 {
53 atmel,vbus-gpio = <&pioD 4 GPIO_ACTIVE_HIGH>;
54 status = "okay";
55 };
56
57 spi0: spi@fffe0000 { 59 spi0: spi@fffe0000 {
58 status = "okay"; 60 status = "okay";
59 cs-gpios = <&pioA 3 0>, <0>, <0>, <0>; 61 cs-gpios = <&pioA 3 0>, <0>, <0>, <0>;
@@ -63,12 +65,45 @@
63 reg = <0>; 65 reg = <0>;
64 }; 66 };
65 }; 67 };
68
69 dbgu: serial@fffff200 {
70 status = "okay";
71 };
66 }; 72 };
67 73
68 usb0: ohci@00300000 { 74 usb0: ohci@00300000 {
69 num-ports = <2>; 75 num-ports = <2>;
70 status = "okay"; 76 status = "okay";
71 }; 77 };
78
79 nor_flash@10000000 {
80 compatible = "cfi-flash";
81 reg = <0x10000000 0x800000>;
82 linux,mtd-name = "physmap-flash.0";
83 bank-width = <2>;
84 #address-cells = <1>;
85 #size-cells = <1>;
86
87 barebox@0 {
88 label = "barebox";
89 reg = <0x00000 0x40000>;
90 };
91
92 bareboxenv@40000 {
93 label = "bareboxenv";
94 reg = <0x40000 0x10000>;
95 };
96
97 kernel@50000 {
98 label = "kernel";
99 reg = <0x50000 0x300000>;
100 };
101
102 root@350000 {
103 label = "root";
104 reg = <0x350000 0x4B0000>;
105 };
106 };
72 }; 107 };
73 108
74 leds { 109 leds {
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 56ee8282a7a8..997901f7ed73 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -648,6 +648,11 @@
648 watchdog@fffffd40 { 648 watchdog@fffffd40 {
649 compatible = "atmel,at91sam9260-wdt"; 649 compatible = "atmel,at91sam9260-wdt";
650 reg = <0xfffffd40 0x10>; 650 reg = <0xfffffd40 0x10>;
651 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
652 atmel,watchdog-type = "hardware";
653 atmel,reset-type = "all";
654 atmel,dbg-halt;
655 atmel,idle-halt;
651 status = "disabled"; 656 status = "disabled";
652 }; 657 };
653 }; 658 };
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index d5bd65f74602..0042f73068b0 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -30,6 +30,7 @@
30 i2c0 = &i2c0; 30 i2c0 = &i2c0;
31 ssc0 = &ssc0; 31 ssc0 = &ssc0;
32 ssc1 = &ssc1; 32 ssc1 = &ssc1;
33 pwm0 = &pwm0;
33 }; 34 };
34 cpus { 35 cpus {
35 #address-cells = <0>; 36 #address-cells = <0>;
@@ -366,6 +367,34 @@
366 }; 367 };
367 }; 368 };
368 369
370 fb {
371 pinctrl_fb: fb-0 {
372 atmel,pins =
373 <AT91_PIOC 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC1 periph A */
374 AT91_PIOC 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC2 periph A */
375 AT91_PIOC 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC3 periph A */
376 AT91_PIOB 9 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB9 periph B */
377 AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC6 periph A */
378 AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC7 periph A */
379 AT91_PIOC 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC8 periph A */
380 AT91_PIOC 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC9 periph A */
381 AT91_PIOC 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC10 periph A */
382 AT91_PIOC 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC11 periph A */
383 AT91_PIOC 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC14 periph A */
384 AT91_PIOC 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC15 periph A */
385 AT91_PIOC 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC16 periph A */
386 AT91_PIOC 12 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC12 periph B */
387 AT91_PIOC 18 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC18 periph A */
388 AT91_PIOC 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC19 periph A */
389 AT91_PIOC 22 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC22 periph A */
390 AT91_PIOC 23 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC23 periph A */
391 AT91_PIOC 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC24 periph A */
392 AT91_PIOC 17 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC17 periph B */
393 AT91_PIOC 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC26 periph A */
394 AT91_PIOC 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC27 periph A */
395 };
396 };
397
369 pioA: gpio@fffff200 { 398 pioA: gpio@fffff200 {
370 compatible = "atmel,at91rm9200-gpio"; 399 compatible = "atmel,at91rm9200-gpio";
371 reg = <0xfffff200 0x200>; 400 reg = <0xfffff200 0x200>;
@@ -523,6 +552,11 @@
523 watchdog@fffffd40 { 552 watchdog@fffffd40 {
524 compatible = "atmel,at91sam9260-wdt"; 553 compatible = "atmel,at91sam9260-wdt";
525 reg = <0xfffffd40 0x10>; 554 reg = <0xfffffd40 0x10>;
555 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
556 atmel,watchdog-type = "hardware";
557 atmel,reset-type = "all";
558 atmel,dbg-halt;
559 atmel,idle-halt;
526 status = "disabled"; 560 status = "disabled";
527 }; 561 };
528 562
@@ -547,6 +581,23 @@
547 pinctrl-0 = <&pinctrl_spi1>; 581 pinctrl-0 = <&pinctrl_spi1>;
548 status = "disabled"; 582 status = "disabled";
549 }; 583 };
584
585 pwm0: pwm@fffb8000 {
586 compatible = "atmel,at91sam9rl-pwm";
587 reg = <0xfffb8000 0x300>;
588 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 4>;
589 #pwm-cells = <3>;
590 status = "disabled";
591 };
592 };
593
594 fb0: fb@0x00700000 {
595 compatible = "atmel,at91sam9263-lcdc";
596 reg = <0x00700000 0x1000>;
597 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 3>;
598 pinctrl-names = "default";
599 pinctrl-0 = <&pinctrl_fb>;
600 status = "disabled";
550 }; 601 };
551 602
552 nand0: nand@40000000 { 603 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index 70f835b55c0b..15009c9f2293 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -95,6 +95,36 @@
95 }; 95 };
96 }; 96 };
97 97
98 fb0: fb@0x00700000 {
99 display = <&display0>;
100 status = "okay";
101
102 display0: display {
103 bits-per-pixel = <16>;
104 atmel,lcdcon-backlight;
105 atmel,dmacon = <0x1>;
106 atmel,lcdcon2 = <0x80008002>;
107 atmel,guard-time = <1>;
108
109 display-timings {
110 native-mode = <&timing0>;
111 timing0: timing0 {
112 clock-frequency = <4965000>;
113 hactive = <240>;
114 vactive = <320>;
115 hback-porch = <1>;
116 hfront-porch = <33>;
117 vback-porch = <1>;
118 vfront-porch = <0>;
119 hsync-len = <5>;
120 vsync-len = <1>;
121 hsync-active = <1>;
122 vsync-active = <1>;
123 };
124 };
125 };
126 };
127
98 nand0: nand@40000000 { 128 nand0: nand@40000000 {
99 nand-bus-width = <8>; 129 nand-bus-width = <8>;
100 nand-ecc-mode = "soft"; 130 nand-ecc-mode = "soft";
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index c3e514837074..cbcc058b26b4 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -37,6 +37,7 @@
37 i2c1 = &i2c1; 37 i2c1 = &i2c1;
38 ssc0 = &ssc0; 38 ssc0 = &ssc0;
39 ssc1 = &ssc1; 39 ssc1 = &ssc1;
40 pwm0 = &pwm0;
40 }; 41 };
41 cpus { 42 cpus {
42 #address-cells = <0>; 43 #address-cells = <0>;
@@ -143,6 +144,22 @@
143 }; 144 };
144 }; 145 };
145 146
147 i2c0 {
148 pinctrl_i2c0: i2c0-0 {
149 atmel,pins =
150 <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA21 periph A TWCK0 */
151 AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA20 periph A TWD0 */
152 };
153 };
154
155 i2c1 {
156 pinctrl_i2c1: i2c1-0 {
157 atmel,pins =
158 <AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A TWCK1 */
159 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB10 periph A TWD1 */
160 };
161 };
162
146 usart0 { 163 usart0 {
147 pinctrl_usart0: usart0-0 { 164 pinctrl_usart0: usart0-0 {
148 atmel,pins = 165 atmel,pins =
@@ -425,6 +442,42 @@
425 }; 442 };
426 }; 443 };
427 444
445 fb {
446 pinctrl_fb: fb-0 {
447 atmel,pins =
448 <AT91_PIOE 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE0 periph A */
449 AT91_PIOE 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE2 periph A */
450 AT91_PIOE 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE3 periph A */
451 AT91_PIOE 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE4 periph A */
452 AT91_PIOE 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE5 periph A */
453 AT91_PIOE 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE6 periph A */
454 AT91_PIOE 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE7 periph A */
455 AT91_PIOE 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE8 periph A */
456 AT91_PIOE 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE9 periph A */
457 AT91_PIOE 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE10 periph A */
458 AT91_PIOE 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE11 periph A */
459 AT91_PIOE 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE12 periph A */
460 AT91_PIOE 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE13 periph A */
461 AT91_PIOE 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE14 periph A */
462 AT91_PIOE 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE15 periph A */
463 AT91_PIOE 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE16 periph A */
464 AT91_PIOE 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE17 periph A */
465 AT91_PIOE 18 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE18 periph A */
466 AT91_PIOE 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE19 periph A */
467 AT91_PIOE 20 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE20 periph A */
468 AT91_PIOE 21 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE21 periph A */
469 AT91_PIOE 22 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE22 periph A */
470 AT91_PIOE 23 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE23 periph A */
471 AT91_PIOE 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE24 periph A */
472 AT91_PIOE 25 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE25 periph A */
473 AT91_PIOE 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE26 periph A */
474 AT91_PIOE 27 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE27 periph A */
475 AT91_PIOE 28 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE28 periph A */
476 AT91_PIOE 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE29 periph A */
477 AT91_PIOE 30 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PE30 periph A */
478 };
479 };
480
428 pioA: gpio@fffff200 { 481 pioA: gpio@fffff200 {
429 compatible = "atmel,at91rm9200-gpio"; 482 compatible = "atmel,at91rm9200-gpio";
430 reg = <0xfffff200 0x200>; 483 reg = <0xfffff200 0x200>;
@@ -542,6 +595,8 @@
542 compatible = "atmel,at91sam9g10-i2c"; 595 compatible = "atmel,at91sam9g10-i2c";
543 reg = <0xfff84000 0x100>; 596 reg = <0xfff84000 0x100>;
544 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 6>; 597 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 6>;
598 pinctrl-names = "default";
599 pinctrl-0 = <&pinctrl_i2c0>;
545 #address-cells = <1>; 600 #address-cells = <1>;
546 #size-cells = <0>; 601 #size-cells = <0>;
547 status = "disabled"; 602 status = "disabled";
@@ -551,6 +606,8 @@
551 compatible = "atmel,at91sam9g10-i2c"; 606 compatible = "atmel,at91sam9g10-i2c";
552 reg = <0xfff88000 0x100>; 607 reg = <0xfff88000 0x100>;
553 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>; 608 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>;
609 pinctrl-names = "default";
610 pinctrl-0 = <&pinctrl_i2c1>;
554 #address-cells = <1>; 611 #address-cells = <1>;
555 #size-cells = <0>; 612 #size-cells = <0>;
556 status = "disabled"; 613 status = "disabled";
@@ -614,10 +671,19 @@
614 }; 671 };
615 }; 672 };
616 673
674 pwm0: pwm@fffb8000 {
675 compatible = "atmel,at91sam9rl-pwm";
676 reg = <0xfffb8000 0x300>;
677 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 4>;
678 #pwm-cells = <3>;
679 status = "disabled";
680 };
681
617 mmc0: mmc@fff80000 { 682 mmc0: mmc@fff80000 {
618 compatible = "atmel,hsmci"; 683 compatible = "atmel,hsmci";
619 reg = <0xfff80000 0x600>; 684 reg = <0xfff80000 0x600>;
620 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>; 685 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
686 pinctrl-names = "default";
621 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(0)>; 687 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(0)>;
622 dma-names = "rxtx"; 688 dma-names = "rxtx";
623 #address-cells = <1>; 689 #address-cells = <1>;
@@ -629,6 +695,7 @@
629 compatible = "atmel,hsmci"; 695 compatible = "atmel,hsmci";
630 reg = <0xfffd0000 0x600>; 696 reg = <0xfffd0000 0x600>;
631 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 0>; 697 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 0>;
698 pinctrl-names = "default";
632 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(13)>; 699 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(13)>;
633 dma-names = "rxtx"; 700 dma-names = "rxtx";
634 #address-cells = <1>; 701 #address-cells = <1>;
@@ -639,6 +706,11 @@
639 watchdog@fffffd40 { 706 watchdog@fffffd40 {
640 compatible = "atmel,at91sam9260-wdt"; 707 compatible = "atmel,at91sam9260-wdt";
641 reg = <0xfffffd40 0x10>; 708 reg = <0xfffffd40 0x10>;
709 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
710 atmel,watchdog-type = "hardware";
711 atmel,reset-type = "all";
712 atmel,dbg-halt;
713 atmel,idle-halt;
642 status = "disabled"; 714 status = "disabled";
643 }; 715 };
644 716
@@ -727,6 +799,15 @@
727 }; 799 };
728 }; 800 };
729 801
802 fb0: fb@0x00500000 {
803 compatible = "atmel,at91sam9g45-lcdc";
804 reg = <0x00500000 0x1000>;
805 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 3>;
806 pinctrl-names = "default";
807 pinctrl-0 = <&pinctrl_fb>;
808 status = "disabled";
809 };
810
730 nand0: nand@40000000 { 811 nand0: nand@40000000 {
731 compatible = "atmel,at91rm9200-nand"; 812 compatible = "atmel,at91rm9200-nand";
732 #address-cells = <1>; 813 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index a4b00e5c61c0..7ff665a8c708 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -105,6 +105,14 @@
105 AT91_PIOD 29 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PD29 gpio WP pin pull up */ 105 AT91_PIOD 29 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PD29 gpio WP pin pull up */
106 }; 106 };
107 }; 107 };
108
109 pwm0 {
110 pinctrl_pwm_leds: pwm-led {
111 atmel,pins =
112 <AT91_PIOD 0 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PD0 periph B */
113 AT91_PIOD 31 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PD31 periph B */
114 };
115 };
108 }; 116 };
109 117
110 spi0: spi@fffa4000{ 118 spi0: spi@fffa4000{
@@ -121,6 +129,42 @@
121 atmel,vbus-gpio = <&pioB 19 GPIO_ACTIVE_HIGH>; 129 atmel,vbus-gpio = <&pioB 19 GPIO_ACTIVE_HIGH>;
122 status = "okay"; 130 status = "okay";
123 }; 131 };
132
133 pwm0: pwm@fffb8000 {
134 status = "okay";
135
136 pinctrl-names = "default";
137 pinctrl-0 = <&pinctrl_pwm_leds>;
138 };
139 };
140
141 fb0: fb@0x00500000 {
142 display = <&display0>;
143 status = "okay";
144
145 display0: display {
146 bits-per-pixel = <32>;
147 atmel,lcdcon-backlight;
148 atmel,dmacon = <0x1>;
149 atmel,lcdcon2 = <0x80008002>;
150 atmel,guard-time = <9>;
151 atmel,lcd-wiring-mode = "RGB";
152
153 display-timings {
154 native-mode = <&timing0>;
155 timing0: timing0 {
156 clock-frequency = <9000000>;
157 hactive = <480>;
158 vactive = <272>;
159 hback-porch = <1>;
160 hfront-porch = <1>;
161 vback-porch = <40>;
162 vfront-porch = <1>;
163 hsync-len = <45>;
164 vsync-len = <1>;
165 };
166 };
167 };
124 }; 168 };
125 169
126 nand0: nand@40000000 { 170 nand0: nand@40000000 {
@@ -165,16 +209,22 @@
165 gpios = <&pioD 30 GPIO_ACTIVE_HIGH>; 209 gpios = <&pioD 30 GPIO_ACTIVE_HIGH>;
166 linux,default-trigger = "heartbeat"; 210 linux,default-trigger = "heartbeat";
167 }; 211 };
212 };
213
214 pwmleds {
215 compatible = "pwm-leds";
168 216
169 d6 { 217 d6 {
170 label = "d6"; 218 label = "d6";
171 gpios = <&pioD 0 GPIO_ACTIVE_LOW>; 219 pwms = <&pwm0 3 5000 0>;
220 max-brightness = <255>;
172 linux,default-trigger = "nand-disk"; 221 linux,default-trigger = "nand-disk";
173 }; 222 };
174 223
175 d7 { 224 d7 {
176 label = "d7"; 225 label = "d7";
177 gpios = <&pioD 31 GPIO_ACTIVE_LOW>; 226 pwms = <&pwm0 1 5000 0>;
227 max-brightness = <255>;
178 linux,default-trigger = "mmc0"; 228 linux,default-trigger = "mmc0";
179 }; 229 };
180 }; 230 };
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 6224f9fe2f2b..394e6ce2afb7 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -33,6 +33,7 @@
33 i2c0 = &i2c0; 33 i2c0 = &i2c0;
34 i2c1 = &i2c1; 34 i2c1 = &i2c1;
35 ssc0 = &ssc0; 35 ssc0 = &ssc0;
36 pwm0 = &pwm0;
36 }; 37 };
37 cpus { 38 cpus {
38 #address-cells = <0>; 39 #address-cells = <0>;
@@ -540,6 +541,19 @@
540 watchdog@fffffe40 { 541 watchdog@fffffe40 {
541 compatible = "atmel,at91sam9260-wdt"; 542 compatible = "atmel,at91sam9260-wdt";
542 reg = <0xfffffe40 0x10>; 543 reg = <0xfffffe40 0x10>;
544 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
545 atmel,watchdog-type = "hardware";
546 atmel,reset-type = "all";
547 atmel,dbg-halt;
548 atmel,idle-halt;
549 status = "disabled";
550 };
551
552 pwm0: pwm@f8034000 {
553 compatible = "atmel,at91sam9rl-pwm";
554 reg = <0xf8034000 0x300>;
555 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>;
556 #pwm-cells = <3>;
543 status = "disabled"; 557 status = "disabled";
544 }; 558 };
545 }; 559 };
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 40267a116c3c..174219de92fa 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -35,6 +35,7 @@
35 i2c1 = &i2c1; 35 i2c1 = &i2c1;
36 i2c2 = &i2c2; 36 i2c2 = &i2c2;
37 ssc0 = &ssc0; 37 ssc0 = &ssc0;
38 pwm0 = &pwm0;
38 }; 39 };
39 cpus { 40 cpus {
40 #address-cells = <0>; 41 #address-cells = <0>;
@@ -753,6 +754,11 @@
753 watchdog@fffffe40 { 754 watchdog@fffffe40 {
754 compatible = "atmel,at91sam9260-wdt"; 755 compatible = "atmel,at91sam9260-wdt";
755 reg = <0xfffffe40 0x10>; 756 reg = <0xfffffe40 0x10>;
757 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
758 atmel,watchdog-type = "hardware";
759 atmel,reset-type = "all";
760 atmel,dbg-halt;
761 atmel,idle-halt;
756 status = "disabled"; 762 status = "disabled";
757 }; 763 };
758 764
@@ -762,6 +768,14 @@
762 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 768 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
763 status = "disabled"; 769 status = "disabled";
764 }; 770 };
771
772 pwm0: pwm@f8034000 {
773 compatible = "atmel,at91sam9rl-pwm";
774 reg = <0xf8034000 0x300>;
775 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>;
776 #pwm-cells = <3>;
777 status = "disabled";
778 };
765 }; 779 };
766 780
767 nand0: nand@40000000 { 781 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
index 978bab4991df..f8674bcc4489 100644
--- a/arch/arm/boot/dts/atlas6.dtsi
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -27,6 +27,15 @@
27 timebase-frequency = <0>; 27 timebase-frequency = <0>;
28 bus-frequency = <0>; 28 bus-frequency = <0>;
29 clock-frequency = <0>; 29 clock-frequency = <0>;
30 clocks = <&clks 12>;
31 operating-points = <
32 /* kHz uV */
33 200000 1025000
34 400000 1025000
35 600000 1050000
36 800000 1100000
37 >;
38 clock-latency = <150000>;
30 }; 39 };
31 }; 40 };
32 41
@@ -69,6 +78,7 @@
69 cphifbg@88030000 { 78 cphifbg@88030000 {
70 compatible = "sirf,prima2-cphifbg"; 79 compatible = "sirf,prima2-cphifbg";
71 reg = <0x88030000 0x1000>; 80 reg = <0x88030000 0x1000>;
81 clocks = <&clks 42>;
72 }; 82 };
73 }; 83 };
74 84
@@ -546,6 +556,12 @@
546 sirf,function = "usp1"; 556 sirf,function = "usp1";
547 }; 557 };
548 }; 558 };
559 usp1_uart_nostreamctrl_pins_a: usp1@1 {
560 usp1 {
561 sirf,pins = "usp1_uart_nostreamctrl_grp";
562 sirf,function = "usp1_uart_nostreamctrl";
563 };
564 };
549 usb0_upli_drvbus_pins_a: usb0_upli_drvbus@0 { 565 usb0_upli_drvbus_pins_a: usb0_upli_drvbus@0 {
550 usb0_upli_drvbus { 566 usb0_upli_drvbus {
551 sirf,pins = "usb0_upli_drvbusgrp"; 567 sirf,pins = "usb0_upli_drvbusgrp";
@@ -636,6 +652,7 @@
636 reg = <0x56100000 0x100000>; 652 reg = <0x56100000 0x100000>;
637 interrupts = <38>; 653 interrupts = <38>;
638 status = "disabled"; 654 status = "disabled";
655 bus-width = <4>;
639 clocks = <&clks 36>; 656 clocks = <&clks 36>;
640 }; 657 };
641 658
@@ -645,6 +662,7 @@
645 reg = <0x56200000 0x100000>; 662 reg = <0x56200000 0x100000>;
646 interrupts = <23>; 663 interrupts = <23>;
647 status = "disabled"; 664 status = "disabled";
665 bus-width = <4>;
648 clocks = <&clks 37>; 666 clocks = <&clks 37>;
649 }; 667 };
650 668
@@ -654,6 +672,7 @@
654 reg = <0x56300000 0x100000>; 672 reg = <0x56300000 0x100000>;
655 interrupts = <23>; 673 interrupts = <23>;
656 status = "disabled"; 674 status = "disabled";
675 bus-width = <4>;
657 clocks = <&clks 37>; 676 clocks = <&clks 37>;
658 }; 677 };
659 678
@@ -663,6 +682,7 @@
663 reg = <0x56500000 0x100000>; 682 reg = <0x56500000 0x100000>;
664 interrupts = <39>; 683 interrupts = <39>;
665 status = "disabled"; 684 status = "disabled";
685 bus-width = <4>;
666 clocks = <&clks 38>; 686 clocks = <&clks 38>;
667 }; 687 };
668 688
@@ -697,6 +717,12 @@
697 interrupts = <52 53 54>; 717 interrupts = <52 53 54>;
698 }; 718 };
699 719
720 minigpsrtc@2000 {
721 compatible = "sirf,prima2-minigpsrtc";
722 reg = <0x2000 0x1000>;
723 interrupts = <54>;
724 };
725
700 pwrc@3000 { 726 pwrc@3000 {
701 compatible = "sirf,prima2-pwrc"; 727 compatible = "sirf,prima2-pwrc";
702 reg = <0x3000 0x1000>; 728 reg = <0x3000 0x1000>;
diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts
index 23cd16d736bf..396b70459cdc 100644
--- a/arch/arm/boot/dts/bcm11351-brt.dts
+++ b/arch/arm/boot/dts/bcm11351-brt.dts
@@ -44,5 +44,11 @@
44 status = "okay"; 44 status = "okay";
45 }; 45 };
46 46
47 usbotg: usb@3f120000 {
48 status = "okay";
49 };
47 50
51 usbphy: usb-phy@3f130000 {
52 status = "okay";
53 };
48}; 54};
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index b0c0610d1395..e491b82f8d67 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -43,7 +43,7 @@
43 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart"; 43 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
44 status = "disabled"; 44 status = "disabled";
45 reg = <0x3e000000 0x1000>; 45 reg = <0x3e000000 0x1000>;
46 clock-frequency = <13000000>; 46 clocks = <&uartb_clk>;
47 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; 47 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
48 reg-shift = <2>; 48 reg-shift = <2>;
49 reg-io-width = <4>; 49 reg-io-width = <4>;
@@ -53,7 +53,7 @@
53 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart"; 53 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
54 status = "disabled"; 54 status = "disabled";
55 reg = <0x3e001000 0x1000>; 55 reg = <0x3e001000 0x1000>;
56 clock-frequency = <13000000>; 56 clocks = <&uartb2_clk>;
57 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>; 57 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
58 reg-shift = <2>; 58 reg-shift = <2>;
59 reg-io-width = <4>; 59 reg-io-width = <4>;
@@ -63,7 +63,7 @@
63 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart"; 63 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
64 status = "disabled"; 64 status = "disabled";
65 reg = <0x3e002000 0x1000>; 65 reg = <0x3e002000 0x1000>;
66 clock-frequency = <13000000>; 66 clocks = <&uartb3_clk>;
67 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; 67 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
68 reg-shift = <2>; 68 reg-shift = <2>;
69 reg-io-width = <4>; 69 reg-io-width = <4>;
@@ -73,7 +73,7 @@
73 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart"; 73 compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
74 status = "disabled"; 74 status = "disabled";
75 reg = <0x3e003000 0x1000>; 75 reg = <0x3e003000 0x1000>;
76 clock-frequency = <13000000>; 76 clocks = <&uartb4_clk>;
77 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; 77 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
78 reg-shift = <2>; 78 reg-shift = <2>;
79 reg-io-width = <4>; 79 reg-io-width = <4>;
@@ -95,7 +95,7 @@
95 compatible = "brcm,kona-timer"; 95 compatible = "brcm,kona-timer";
96 reg = <0x35006000 0x1000>; 96 reg = <0x35006000 0x1000>;
97 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; 97 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
98 clock-frequency = <32768>; 98 clocks = <&hub_timer_clk>;
99 }; 99 };
100 100
101 gpio: gpio@35003000 { 101 gpio: gpio@35003000 {
@@ -118,6 +118,7 @@
118 compatible = "brcm,kona-sdhci"; 118 compatible = "brcm,kona-sdhci";
119 reg = <0x3f180000 0x10000>; 119 reg = <0x3f180000 0x10000>;
120 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; 120 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
121 clocks = <&sdio1_clk>;
121 status = "disabled"; 122 status = "disabled";
122 }; 123 };
123 124
@@ -125,6 +126,7 @@
125 compatible = "brcm,kona-sdhci"; 126 compatible = "brcm,kona-sdhci";
126 reg = <0x3f190000 0x10000>; 127 reg = <0x3f190000 0x10000>;
127 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>; 128 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
129 clocks = <&sdio2_clk>;
128 status = "disabled"; 130 status = "disabled";
129 }; 131 };
130 132
@@ -132,6 +134,7 @@
132 compatible = "brcm,kona-sdhci"; 134 compatible = "brcm,kona-sdhci";
133 reg = <0x3f1a0000 0x10000>; 135 reg = <0x3f1a0000 0x10000>;
134 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; 136 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
137 clocks = <&sdio3_clk>;
135 status = "disabled"; 138 status = "disabled";
136 }; 139 };
137 140
@@ -139,7 +142,168 @@
139 compatible = "brcm,kona-sdhci"; 142 compatible = "brcm,kona-sdhci";
140 reg = <0x3f1b0000 0x10000>; 143 reg = <0x3f1b0000 0x10000>;
141 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; 144 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
145 clocks = <&sdio4_clk>;
142 status = "disabled"; 146 status = "disabled";
143 }; 147 };
144 148
149 pinctrl@35004800 {
150 compatible = "brcm,capri-pinctrl";
151 reg = <0x35004800 0x430>;
152 };
153
154 i2c@3e016000 {
155 compatible = "brcm,bcm11351-i2c", "brcm,kona-i2c";
156 reg = <0x3e016000 0x80>;
157 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
158 #address-cells = <1>;
159 #size-cells = <0>;
160 clocks = <&bsc1_clk>;
161 status = "disabled";
162 };
163
164 i2c@3e017000 {
165 compatible = "brcm,bcm11351-i2c", "brcm,kona-i2c";
166 reg = <0x3e017000 0x80>;
167 interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
168 #address-cells = <1>;
169 #size-cells = <0>;
170 clocks = <&bsc2_clk>;
171 status = "disabled";
172 };
173
174 i2c@3e018000 {
175 compatible = "brcm,bcm11351-i2c", "brcm,kona-i2c";
176 reg = <0x3e018000 0x80>;
177 interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
178 #address-cells = <1>;
179 #size-cells = <0>;
180 clocks = <&bsc3_clk>;
181 status = "disabled";
182 };
183
184 i2c@3500d000 {
185 compatible = "brcm,bcm11351-i2c", "brcm,kona-i2c";
186 reg = <0x3500d000 0x80>;
187 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
188 #address-cells = <1>;
189 #size-cells = <0>;
190 clocks = <&pmu_bsc_clk>;
191 status = "disabled";
192 };
193
194 clocks {
195 bsc1_clk: bsc1 {
196 compatible = "fixed-clock";
197 clock-frequency = <13000000>;
198 #clock-cells = <0>;
199 };
200
201 bsc2_clk: bsc2 {
202 compatible = "fixed-clock";
203 clock-frequency = <13000000>;
204 #clock-cells = <0>;
205 };
206
207 bsc3_clk: bsc3 {
208 compatible = "fixed-clock";
209 clock-frequency = <13000000>;
210 #clock-cells = <0>;
211 };
212
213 pmu_bsc_clk: pmu_bsc {
214 compatible = "fixed-clock";
215 clock-frequency = <13000000>;
216 #clock-cells = <0>;
217 };
218
219 hub_timer_clk: hub_timer {
220 compatible = "fixed-clock";
221 clock-frequency = <32768>;
222 #clock-cells = <0>;
223 };
224
225 pwm_clk: pwm {
226 compatible = "fixed-clock";
227 clock-frequency = <26000000>;
228 #clock-cells = <0>;
229 };
230
231 sdio1_clk: sdio1 {
232 compatible = "fixed-clock";
233 clock-frequency = <48000000>;
234 #clock-cells = <0>;
235 };
236
237 sdio2_clk: sdio2 {
238 compatible = "fixed-clock";
239 clock-frequency = <48000000>;
240 #clock-cells = <0>;
241 };
242
243 sdio3_clk: sdio3 {
244 compatible = "fixed-clock";
245 clock-frequency = <48000000>;
246 #clock-cells = <0>;
247 };
248
249 sdio4_clk: sdio4 {
250 compatible = "fixed-clock";
251 clock-frequency = <48000000>;
252 #clock-cells = <0>;
253 };
254
255 tmon_1m_clk: tmon_1m {
256 compatible = "fixed-clock";
257 clock-frequency = <1000000>;
258 #clock-cells = <0>;
259 };
260
261 uartb_clk: uartb {
262 compatible = "fixed-clock";
263 clock-frequency = <13000000>;
264 #clock-cells = <0>;
265 };
266
267 uartb2_clk: uartb2 {
268 compatible = "fixed-clock";
269 clock-frequency = <13000000>;
270 #clock-cells = <0>;
271 };
272
273 uartb3_clk: uartb3 {
274 compatible = "fixed-clock";
275 clock-frequency = <13000000>;
276 #clock-cells = <0>;
277 };
278
279 uartb4_clk: uartb4 {
280 compatible = "fixed-clock";
281 clock-frequency = <13000000>;
282 #clock-cells = <0>;
283 };
284
285 usb_otg_ahb_clk: usb_otg_ahb {
286 compatible = "fixed-clock";
287 clock-frequency = <52000000>;
288 #clock-cells = <0>;
289 };
290 };
291
292 usbotg: usb@3f120000 {
293 compatible = "snps,dwc2";
294 reg = <0x3f120000 0x10000>;
295 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
296 clocks = <&usb_otg_ahb_clk>;
297 clock-names = "otg";
298 phys = <&usbphy>;
299 phy-names = "usb2-phy";
300 status = "disabled";
301 };
302
303 usbphy: usb-phy@3f130000 {
304 compatible = "brcm,kona-usb2-phy";
305 reg = <0x3f130000 0x28>;
306 #phy-cells = <0>;
307 status = "disabled";
308 };
145}; 309};
diff --git a/arch/arm/boot/dts/bcm28155-ap.dts b/arch/arm/boot/dts/bcm28155-ap.dts
index 08e47c285227..5ff2382a49e4 100644
--- a/arch/arm/boot/dts/bcm28155-ap.dts
+++ b/arch/arm/boot/dts/bcm28155-ap.dts
@@ -13,6 +13,8 @@
13 13
14/dts-v1/; 14/dts-v1/;
15 15
16#include <dt-bindings/gpio/gpio.h>
17
16#include "bcm11351.dtsi" 18#include "bcm11351.dtsi"
17 19
18/ { 20/ {
@@ -27,6 +29,26 @@
27 status = "okay"; 29 status = "okay";
28 }; 30 };
29 31
32 i2c@3e016000 {
33 status="okay";
34 clock-frequency = <400000>;
35 };
36
37 i2c@3e017000 {
38 status="okay";
39 clock-frequency = <400000>;
40 };
41
42 i2c@3e018000 {
43 status="okay";
44 clock-frequency = <400000>;
45 };
46
47 i2c@3500d000 {
48 status="okay";
49 clock-frequency = <400000>;
50 };
51
30 sdio1: sdio@3f180000 { 52 sdio1: sdio@3f180000 {
31 max-frequency = <48000000>; 53 max-frequency = <48000000>;
32 status = "okay"; 54 status = "okay";
@@ -40,7 +62,15 @@
40 62
41 sdio4: sdio@3f1b0000 { 63 sdio4: sdio@3f1b0000 {
42 max-frequency = <48000000>; 64 max-frequency = <48000000>;
43 cd-gpios = <&gpio 14 0>; 65 cd-gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
66 status = "okay";
67 };
68
69 usbotg: usb@3f120000 {
70 status = "okay";
71 };
72
73 usbphy: usb-phy@3f130000 {
44 status = "okay"; 74 status = "okay";
45 }; 75 };
46}; 76};
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 6e9deb786a7d..2a3b1c1313a0 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -23,10 +23,15 @@
23 23
24&gpio { 24&gpio {
25 pinctrl-names = "default"; 25 pinctrl-names = "default";
26 pinctrl-0 = <&alt0 &alt3>; 26 pinctrl-0 = <&gpioout &alt0 &alt3>;
27
28 gpioout: gpioout {
29 brcm,pins = <6>;
30 brcm,function = <1>; /* GPIO out */
31 };
27 32
28 alt0: alt0 { 33 alt0: alt0 {
29 brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 14 15 40 45>; 34 brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
30 brcm,function = <4>; /* alt0 */ 35 brcm,function = <4>; /* alt0 */
31 }; 36 };
32 37
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index aa537ed13f0a..b021c96d3ba1 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -107,6 +107,12 @@
107 clocks = <&clk_mmc>; 107 clocks = <&clk_mmc>;
108 status = "disabled"; 108 status = "disabled";
109 }; 109 };
110
111 usb {
112 compatible = "brcm,bcm2835-usb";
113 reg = <0x7e980000 0x10000>;
114 interrupts = <1 9>;
115 };
110 }; 116 };
111 117
112 clocks { 118 clocks {
diff --git a/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
new file mode 100644
index 000000000000..c72bfd468d10
--- /dev/null
+++ b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
@@ -0,0 +1,29 @@
1/*
2 * Device Tree file for Sony NSZ-GS7
3 *
4 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11/dts-v1/;
12
13#include "berlin2.dtsi"
14
15/ {
16 model = "Sony NSZ-GS7";
17 compatible = "sony,nsz-gs7", "marvell,berlin2", "marvell,berlin";
18
19 chosen {
20 bootargs = "console=ttyS0,115200 earlyprintk";
21 };
22
23 memory {
24 device_type = "memory";
25 reg = <0x00000000 0x40000000>; /* 1 GB */
26 };
27};
28
29&uart0 { status = "okay"; };
diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi
new file mode 100644
index 000000000000..56a1af2f1052
--- /dev/null
+++ b/arch/arm/boot/dts/berlin2.dtsi
@@ -0,0 +1,227 @@
1/*
2 * Device Tree Include file for Marvell Armada 1500 (Berlin BG2) SoC
3 *
4 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
5 *
6 * based on GPL'ed 2.6 kernel sources
7 * (c) Marvell International Ltd.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include "skeleton.dtsi"
15#include <dt-bindings/interrupt-controller/arm-gic.h>
16
17/ {
18 model = "Marvell Armada 1500 (BG2) SoC";
19 compatible = "marvell,berlin2", "marvell,berlin";
20
21 cpus {
22 #address-cells = <1>;
23 #size-cells = <0>;
24
25 cpu@0 {
26 compatible = "marvell,pj4b";
27 device_type = "cpu";
28 next-level-cache = <&l2>;
29 reg = <0>;
30 };
31
32 cpu@1 {
33 compatible = "marvell,pj4b";
34 device_type = "cpu";
35 next-level-cache = <&l2>;
36 reg = <1>;
37 };
38 };
39
40 clocks {
41 smclk: sysmgr-clock {
42 compatible = "fixed-clock";
43 #clock-cells = <0>;
44 clock-frequency = <25000000>;
45 };
46
47 cfgclk: cfg-clock {
48 compatible = "fixed-clock";
49 #clock-cells = <0>;
50 clock-frequency = <100000000>;
51 };
52
53 sysclk: system-clock {
54 compatible = "fixed-clock";
55 #clock-cells = <0>;
56 clock-frequency = <400000000>;
57 };
58 };
59
60 soc {
61 compatible = "simple-bus";
62 #address-cells = <1>;
63 #size-cells = <1>;
64 interrupt-parent = <&gic>;
65
66 ranges = <0 0xf7000000 0x1000000>;
67
68 l2: l2-cache-controller@ac0000 {
69 compatible = "marvell,tauros3-cache", "arm,pl310-cache";
70 reg = <0xac0000 0x1000>;
71 cache-unified;
72 cache-level = <2>;
73 };
74
75 gic: interrupt-controller@ad1000 {
76 compatible = "arm,cortex-a9-gic";
77 reg = <0xad1000 0x1000>, <0xad0100 0x0100>;
78 interrupt-controller;
79 #interrupt-cells = <3>;
80 };
81
82 local-timer@ad0600 {
83 compatible = "arm,cortex-a9-twd-timer";
84 reg = <0xad0600 0x20>;
85 interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
86 clocks = <&sysclk>;
87 };
88
89 apb@e80000 {
90 compatible = "simple-bus";
91 #address-cells = <1>;
92 #size-cells = <1>;
93
94 ranges = <0 0xe80000 0x10000>;
95 interrupt-parent = <&aic>;
96
97 timer0: timer@2c00 {
98 compatible = "snps,dw-apb-timer";
99 reg = <0x2c00 0x14>;
100 interrupts = <8>;
101 clocks = <&cfgclk>;
102 clock-names = "timer";
103 status = "okay";
104 };
105
106 timer1: timer@2c14 {
107 compatible = "snps,dw-apb-timer";
108 reg = <0x2c14 0x14>;
109 interrupts = <9>;
110 clocks = <&cfgclk>;
111 clock-names = "timer";
112 status = "okay";
113 };
114
115 timer2: timer@2c28 {
116 compatible = "snps,dw-apb-timer";
117 reg = <0x2c28 0x14>;
118 interrupts = <10>;
119 clocks = <&cfgclk>;
120 clock-names = "timer";
121 status = "disabled";
122 };
123
124 timer3: timer@2c3c {
125 compatible = "snps,dw-apb-timer";
126 reg = <0x2c3c 0x14>;
127 interrupts = <11>;
128 clocks = <&cfgclk>;
129 clock-names = "timer";
130 status = "disabled";
131 };
132
133 timer4: timer@2c50 {
134 compatible = "snps,dw-apb-timer";
135 reg = <0x2c50 0x14>;
136 interrupts = <12>;
137 clocks = <&cfgclk>;
138 clock-names = "timer";
139 status = "disabled";
140 };
141
142 timer5: timer@2c64 {
143 compatible = "snps,dw-apb-timer";
144 reg = <0x2c64 0x14>;
145 interrupts = <13>;
146 clocks = <&cfgclk>;
147 clock-names = "timer";
148 status = "disabled";
149 };
150
151 timer6: timer@2c78 {
152 compatible = "snps,dw-apb-timer";
153 reg = <0x2c78 0x14>;
154 interrupts = <14>;
155 clocks = <&cfgclk>;
156 clock-names = "timer";
157 status = "disabled";
158 };
159
160 timer7: timer@2c8c {
161 compatible = "snps,dw-apb-timer";
162 reg = <0x2c8c 0x14>;
163 interrupts = <15>;
164 clocks = <&cfgclk>;
165 clock-names = "timer";
166 status = "disabled";
167 };
168
169 aic: interrupt-controller@3000 {
170 compatible = "snps,dw-apb-ictl";
171 reg = <0x3000 0xc00>;
172 interrupt-controller;
173 #interrupt-cells = <1>;
174 interrupt-parent = <&gic>;
175 interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
176 };
177 };
178
179 apb@fc0000 {
180 compatible = "simple-bus";
181 #address-cells = <1>;
182 #size-cells = <1>;
183
184 ranges = <0 0xfc0000 0x10000>;
185 interrupt-parent = <&sic>;
186
187 uart0: serial@9000 {
188 compatible = "snps,dw-apb-uart";
189 reg = <0x9000 0x100>;
190 reg-shift = <2>;
191 reg-io-width = <1>;
192 interrupts = <8>;
193 clocks = <&smclk>;
194 status = "disabled";
195 };
196
197 uart1: serial@a000 {
198 compatible = "snps,dw-apb-uart";
199 reg = <0xa000 0x100>;
200 reg-shift = <2>;
201 reg-io-width = <1>;
202 interrupts = <9>;
203 clocks = <&smclk>;
204 status = "disabled";
205 };
206
207 uart2: serial@b000 {
208 compatible = "snps,dw-apb-uart";
209 reg = <0xb000 0x100>;
210 reg-shift = <2>;
211 reg-io-width = <1>;
212 interrupts = <10>;
213 clocks = <&smclk>;
214 status = "disabled";
215 };
216
217 sic: interrupt-controller@e000 {
218 compatible = "snps,dw-apb-ictl";
219 reg = <0xe000 0x400>;
220 interrupt-controller;
221 #interrupt-cells = <1>;
222 interrupt-parent = <&gic>;
223 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
224 };
225 };
226 };
227};
diff --git a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
new file mode 100644
index 000000000000..bcd81ffc495d
--- /dev/null
+++ b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
@@ -0,0 +1,29 @@
1/*
2 * Device Tree file for Google Chromecast
3 *
4 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11/dts-v1/;
12
13#include "berlin2cd.dtsi"
14
15/ {
16 model = "Google Chromecast";
17 compatible = "google,chromecast", "marvell,berlin2cd", "marvell,berlin";
18
19 chosen {
20 bootargs = "console=ttyS0,115200 earlyprintk";
21 };
22
23 memory {
24 device_type = "memory";
25 reg = <0x00000000 0x20000000>; /* 512 MB */
26 };
27};
28
29&uart0 { status = "okay"; };
diff --git a/arch/arm/boot/dts/berlin2cd.dtsi b/arch/arm/boot/dts/berlin2cd.dtsi
new file mode 100644
index 000000000000..094968c27533
--- /dev/null
+++ b/arch/arm/boot/dts/berlin2cd.dtsi
@@ -0,0 +1,210 @@
1/*
2 * Device Tree Include file for Marvell Armada 1500-mini (Berlin BG2CD) SoC
3 *
4 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
5 *
6 * based on GPL'ed 2.6 kernel sources
7 * (c) Marvell International Ltd.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include "skeleton.dtsi"
15#include <dt-bindings/interrupt-controller/arm-gic.h>
16
17/ {
18 model = "Marvell Armada 1500-mini (BG2CD) SoC";
19 compatible = "marvell,berlin2cd", "marvell,berlin";
20
21 cpus {
22 #address-cells = <1>;
23 #size-cells = <0>;
24
25 cpu@0 {
26 compatible = "arm,cortex-a9";
27 device_type = "cpu";
28 next-level-cache = <&l2>;
29 reg = <0>;
30 };
31 };
32
33 clocks {
34 smclk: sysmgr-clock {
35 compatible = "fixed-clock";
36 #clock-cells = <0>;
37 clock-frequency = <25000000>;
38 };
39
40 cfgclk: cfg-clock {
41 compatible = "fixed-clock";
42 #clock-cells = <0>;
43 clock-frequency = <75000000>;
44 };
45
46 sysclk: system-clock {
47 compatible = "fixed-clock";
48 #clock-cells = <0>;
49 clock-frequency = <300000000>;
50 };
51 };
52
53 soc {
54 compatible = "simple-bus";
55 #address-cells = <1>;
56 #size-cells = <1>;
57 interrupt-parent = <&gic>;
58
59 ranges = <0 0xf7000000 0x1000000>;
60
61 l2: l2-cache-controller@ac0000 {
62 compatible = "arm,pl310-cache";
63 reg = <0xac0000 0x1000>;
64 cache-unified;
65 cache-level = <2>;
66 };
67
68 gic: interrupt-controller@ad1000 {
69 compatible = "arm,cortex-a9-gic";
70 reg = <0xad1000 0x1000>, <0xad0100 0x0100>;
71 interrupt-controller;
72 #interrupt-cells = <3>;
73 };
74
75 local-timer@ad0600 {
76 compatible = "arm,cortex-a9-twd-timer";
77 reg = <0xad0600 0x20>;
78 interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
79 clocks = <&sysclk>;
80 };
81
82 apb@e80000 {
83 compatible = "simple-bus";
84 #address-cells = <1>;
85 #size-cells = <1>;
86
87 ranges = <0 0xe80000 0x10000>;
88 interrupt-parent = <&aic>;
89
90 timer0: timer@2c00 {
91 compatible = "snps,dw-apb-timer";
92 reg = <0x2c00 0x14>;
93 interrupts = <8>;
94 clocks = <&cfgclk>;
95 clock-names = "timer";
96 status = "okay";
97 };
98
99 timer1: timer@2c14 {
100 compatible = "snps,dw-apb-timer";
101 reg = <0x2c14 0x14>;
102 interrupts = <9>;
103 clocks = <&cfgclk>;
104 clock-names = "timer";
105 status = "okay";
106 };
107
108 timer2: timer@2c28 {
109 compatible = "snps,dw-apb-timer";
110 reg = <0x2c28 0x14>;
111 interrupts = <10>;
112 clocks = <&cfgclk>;
113 clock-names = "timer";
114 status = "disabled";
115 };
116
117 timer3: timer@2c3c {
118 compatible = "snps,dw-apb-timer";
119 reg = <0x2c3c 0x14>;
120 interrupts = <11>;
121 clocks = <&cfgclk>;
122 clock-names = "timer";
123 status = "disabled";
124 };
125
126 timer4: timer@2c50 {
127 compatible = "snps,dw-apb-timer";
128 reg = <0x2c50 0x14>;
129 interrupts = <12>;
130 clocks = <&cfgclk>;
131 clock-names = "timer";
132 status = "disabled";
133 };
134
135 timer5: timer@2c64 {
136 compatible = "snps,dw-apb-timer";
137 reg = <0x2c64 0x14>;
138 interrupts = <13>;
139 clocks = <&cfgclk>;
140 clock-names = "timer";
141 status = "disabled";
142 };
143
144 timer6: timer@2c78 {
145 compatible = "snps,dw-apb-timer";
146 reg = <0x2c78 0x14>;
147 interrupts = <14>;
148 clocks = <&cfgclk>;
149 clock-names = "timer";
150 status = "disabled";
151 };
152
153 timer7: timer@2c8c {
154 compatible = "snps,dw-apb-timer";
155 reg = <0x2c8c 0x14>;
156 interrupts = <15>;
157 clocks = <&cfgclk>;
158 clock-names = "timer";
159 status = "disabled";
160 };
161
162 aic: interrupt-controller@3000 {
163 compatible = "snps,dw-apb-ictl";
164 reg = <0x3000 0xc00>;
165 interrupt-controller;
166 #interrupt-cells = <1>;
167 interrupt-parent = <&gic>;
168 interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
169 };
170 };
171
172 apb@fc0000 {
173 compatible = "simple-bus";
174 #address-cells = <1>;
175 #size-cells = <1>;
176
177 ranges = <0 0xfc0000 0x10000>;
178 interrupt-parent = <&sic>;
179
180 uart0: serial@9000 {
181 compatible = "snps,dw-apb-uart";
182 reg = <0x9000 0x100>;
183 reg-shift = <2>;
184 reg-io-width = <1>;
185 interrupts = <8>;
186 clocks = <&smclk>;
187 status = "disabled";
188 };
189
190 uart1: serial@a000 {
191 compatible = "snps,dw-apb-uart";
192 reg = <0xa000 0x100>;
193 reg-shift = <2>;
194 reg-io-width = <1>;
195 interrupts = <9>;
196 clocks = <&smclk>;
197 status = "disabled";
198 };
199
200 sic: interrupt-controller@e000 {
201 compatible = "snps,dw-apb-ictl";
202 reg = <0xe000 0x400>;
203 interrupt-controller;
204 #interrupt-cells = <1>;
205 interrupt-parent = <&gic>;
206 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
207 };
208 };
209 };
210};
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 588ce58a2959..1e11e5a5f723 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -101,6 +101,9 @@
101 pinctrl-names = "default"; 101 pinctrl-names = "default";
102 pinctrl-0 = <&mii_pins>; 102 pinctrl-0 = <&mii_pins>;
103 }; 103 };
104 gpio: gpio@1e26000 {
105 status = "okay";
106 };
104 }; 107 };
105 nand_cs3@62000000 { 108 nand_cs3@62000000 {
106 status = "okay"; 109 status = "okay";
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 8d17346f9702..b695548dbb4e 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -8,6 +8,7 @@
8 * option) any later version. 8 * option) any later version.
9 */ 9 */
10#include "skeleton.dtsi" 10#include "skeleton.dtsi"
11#include <dt-bindings/interrupt-controller/irq.h>
11 12
12/ { 13/ {
13 arm { 14 arm {
@@ -256,6 +257,19 @@
256 36 257 36
257 >; 258 >;
258 }; 259 };
260 gpio: gpio@1e26000 {
261 compatible = "ti,dm6441-gpio";
262 gpio-controller;
263 reg = <0x226000 0x1000>;
264 interrupts = <42 IRQ_TYPE_EDGE_BOTH
265 43 IRQ_TYPE_EDGE_BOTH 44 IRQ_TYPE_EDGE_BOTH
266 45 IRQ_TYPE_EDGE_BOTH 46 IRQ_TYPE_EDGE_BOTH
267 47 IRQ_TYPE_EDGE_BOTH 48 IRQ_TYPE_EDGE_BOTH
268 49 IRQ_TYPE_EDGE_BOTH 50 IRQ_TYPE_EDGE_BOTH>;
269 ti,ngpio = <144>;
270 ti,davinci-gpio-unbanked = <0>;
271 status = "disabled";
272 };
259 }; 273 };
260 nand_cs3@62000000 { 274 nand_cs3@62000000 {
261 compatible = "ti,davinci-nand"; 275 compatible = "ti,davinci-nand";
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index 8349a248ecea..7a70f4ca502a 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -23,7 +23,7 @@
23 power { 23 power {
24 label = "Power"; 24 label = "Power";
25 gpios = <&gpio0 18 1>; 25 gpios = <&gpio0 18 1>;
26 linux,default-trigger = "default-on"; 26 default-state = "keep";
27 }; 27 };
28 }; 28 };
29 29
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 113a8bc7bee7..2b76524f4aa7 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -107,51 +107,29 @@
107 0xffffe000 MBUS_ID(0x03, 0x01) 0 0x0000800 /* CESA SRAM 2k */ 107 0xffffe000 MBUS_ID(0x03, 0x01) 0 0x0000800 /* CESA SRAM 2k */
108 0xfffff000 MBUS_ID(0x0d, 0x00) 0 0x0000800>; /* PMU SRAM 2k */ 108 0xfffff000 MBUS_ID(0x0d, 0x00) 0 0x0000800>; /* PMU SRAM 2k */
109 109
110 mbusc: mbus-ctrl@20000 { 110 spi0: spi-ctrl@10600 {
111 compatible = "marvell,mbus-controller"; 111 compatible = "marvell,orion-spi";
112 reg = <0x20000 0x80>, <0x800100 0x8>; 112 #address-cells = <1>;
113 }; 113 #size-cells = <0>;
114 114 cell-index = <0>;
115 timer: timer@20300 { 115 interrupts = <6>;
116 compatible = "marvell,orion-timer"; 116 reg = <0x10600 0x28>;
117 reg = <0x20300 0x20>;
118 interrupt-parent = <&bridge_intc>;
119 interrupts = <1>, <2>;
120 clocks = <&core_clk 0>; 117 clocks = <&core_clk 0>;
118 pinctrl-0 = <&pmx_spi0>;
119 pinctrl-names = "default";
120 status = "disabled";
121 }; 121 };
122 122
123 intc: main-interrupt-ctrl@20200 { 123 i2c0: i2c-ctrl@11000 {
124 compatible = "marvell,orion-intc"; 124 compatible = "marvell,mv64xxx-i2c";
125 interrupt-controller; 125 reg = <0x11000 0x20>;
126 #interrupt-cells = <1>; 126 #address-cells = <1>;
127 reg = <0x20200 0x10>, <0x20210 0x10>; 127 #size-cells = <0>;
128 }; 128 interrupts = <11>;
129 129 clock-frequency = <400000>;
130 bridge_intc: bridge-interrupt-ctrl@20110 { 130 timeout-ms = <1000>;
131 compatible = "marvell,orion-bridge-intc";
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>; 131 clocks = <&core_clk 0>;
149 #clock-cells = <1>; 132 status = "disabled";
150 };
151
152 thermal: thermal-diode@d001c {
153 compatible = "marvell,dove-thermal";
154 reg = <0xd001c 0x0c>, <0xd005c 0x08>;
155 }; 133 };
156 134
157 uart0: serial@12000 { 135 uart0: serial@12000 {
@@ -192,34 +170,222 @@
192 status = "disabled"; 170 status = "disabled";
193 }; 171 };
194 172
195 gpio0: gpio-ctrl@d0400 { 173 spi1: spi-ctrl@14600 {
196 compatible = "marvell,orion-gpio"; 174 compatible = "marvell,orion-spi";
197 #gpio-cells = <2>; 175 #address-cells = <1>;
198 gpio-controller; 176 #size-cells = <0>;
199 reg = <0xd0400 0x20>; 177 cell-index = <1>;
200 ngpios = <32>; 178 interrupts = <5>;
179 reg = <0x14600 0x28>;
180 clocks = <&core_clk 0>;
181 status = "disabled";
182 };
183
184 mbusc: mbus-ctrl@20000 {
185 compatible = "marvell,mbus-controller";
186 reg = <0x20000 0x80>, <0x800100 0x8>;
187 };
188
189 bridge_intc: bridge-interrupt-ctrl@20110 {
190 compatible = "marvell,orion-bridge-intc";
201 interrupt-controller; 191 interrupt-controller;
202 #interrupt-cells = <2>; 192 #interrupt-cells = <1>;
203 interrupts = <12>, <13>, <14>, <60>; 193 reg = <0x20110 0x8>;
194 interrupts = <0>;
195 marvell,#interrupts = <5>;
204 }; 196 };
205 197
206 gpio1: gpio-ctrl@d0420 { 198 intc: main-interrupt-ctrl@20200 {
207 compatible = "marvell,orion-gpio"; 199 compatible = "marvell,orion-intc";
208 #gpio-cells = <2>;
209 gpio-controller;
210 reg = <0xd0420 0x20>;
211 ngpios = <32>;
212 interrupt-controller; 200 interrupt-controller;
213 #interrupt-cells = <2>; 201 #interrupt-cells = <1>;
214 interrupts = <61>; 202 reg = <0x20200 0x10>, <0x20210 0x10>;
215 }; 203 };
216 204
217 gpio2: gpio-ctrl@e8400 { 205 timer: timer@20300 {
218 compatible = "marvell,orion-gpio"; 206 compatible = "marvell,orion-timer";
219 #gpio-cells = <2>; 207 reg = <0x20300 0x20>;
220 gpio-controller; 208 interrupt-parent = <&bridge_intc>;
221 reg = <0xe8400 0x0c>; 209 interrupts = <1>, <2>;
222 ngpios = <8>; 210 clocks = <&core_clk 0>;
211 };
212
213 crypto: crypto-engine@30000 {
214 compatible = "marvell,orion-crypto";
215 reg = <0x30000 0x10000>,
216 <0xffffe000 0x800>;
217 reg-names = "regs", "sram";
218 interrupts = <31>;
219 clocks = <&gate_clk 15>;
220 status = "okay";
221 };
222
223 ehci0: usb-host@50000 {
224 compatible = "marvell,orion-ehci";
225 reg = <0x50000 0x1000>;
226 interrupts = <24>;
227 clocks = <&gate_clk 0>;
228 status = "okay";
229 };
230
231 ehci1: usb-host@51000 {
232 compatible = "marvell,orion-ehci";
233 reg = <0x51000 0x1000>;
234 interrupts = <25>;
235 clocks = <&gate_clk 1>;
236 status = "okay";
237 };
238
239 xor0: dma-engine@60800 {
240 compatible = "marvell,orion-xor";
241 reg = <0x60800 0x100
242 0x60a00 0x100>;
243 clocks = <&gate_clk 23>;
244 status = "okay";
245
246 channel0 {
247 interrupts = <39>;
248 dmacap,memcpy;
249 dmacap,xor;
250 };
251
252 channel1 {
253 interrupts = <40>;
254 dmacap,memcpy;
255 dmacap,xor;
256 };
257 };
258
259 xor1: dma-engine@60900 {
260 compatible = "marvell,orion-xor";
261 reg = <0x60900 0x100
262 0x60b00 0x100>;
263 clocks = <&gate_clk 24>;
264 status = "okay";
265
266 channel0 {
267 interrupts = <42>;
268 dmacap,memcpy;
269 dmacap,xor;
270 };
271
272 channel1 {
273 interrupts = <43>;
274 dmacap,memcpy;
275 dmacap,xor;
276 };
277 };
278
279 sdio1: sdio-host@90000 {
280 compatible = "marvell,dove-sdhci";
281 reg = <0x90000 0x100>;
282 interrupts = <36>, <38>;
283 clocks = <&gate_clk 9>;
284 pinctrl-0 = <&pmx_sdio1>;
285 pinctrl-names = "default";
286 status = "disabled";
287 };
288
289 eth: ethernet-ctrl@72000 {
290 compatible = "marvell,orion-eth";
291 #address-cells = <1>;
292 #size-cells = <0>;
293 reg = <0x72000 0x4000>;
294 clocks = <&gate_clk 2>;
295 marvell,tx-checksum-limit = <1600>;
296 status = "disabled";
297
298 ethernet-port@0 {
299 compatible = "marvell,orion-eth-port";
300 reg = <0>;
301 interrupts = <29>;
302 /* overwrite MAC address in bootloader */
303 local-mac-address = [00 00 00 00 00 00];
304 phy-handle = <&ethphy>;
305 };
306 };
307
308 mdio: mdio-bus@72004 {
309 compatible = "marvell,orion-mdio";
310 #address-cells = <1>;
311 #size-cells = <0>;
312 reg = <0x72004 0x84>;
313 interrupts = <30>;
314 clocks = <&gate_clk 2>;
315 status = "disabled";
316
317 ethphy: ethernet-phy {
318 /* set phy address in board file */
319 };
320 };
321
322 sdio0: sdio-host@92000 {
323 compatible = "marvell,dove-sdhci";
324 reg = <0x92000 0x100>;
325 interrupts = <35>, <37>;
326 clocks = <&gate_clk 8>;
327 pinctrl-0 = <&pmx_sdio0>;
328 pinctrl-names = "default";
329 status = "disabled";
330 };
331
332 sata0: sata-host@a0000 {
333 compatible = "marvell,orion-sata";
334 reg = <0xa0000 0x2400>;
335 interrupts = <62>;
336 clocks = <&gate_clk 3>;
337 phys = <&sata_phy0>;
338 phy-names = "port0";
339 nr-ports = <1>;
340 status = "disabled";
341 };
342
343 sata_phy0: sata-phy@a2000 {
344 compatible = "marvell,mvebu-sata-phy";
345 reg = <0xa2000 0x0334>;
346 clocks = <&gate_clk 3>;
347 clock-names = "sata";
348 #phy-cells = <0>;
349 status = "ok";
350 };
351
352 audio0: audio-controller@b0000 {
353 compatible = "marvell,dove-audio";
354 reg = <0xb0000 0x2210>;
355 interrupts = <19>, <20>;
356 clocks = <&gate_clk 12>;
357 clock-names = "internal";
358 status = "disabled";
359 };
360
361 audio1: audio-controller@b4000 {
362 compatible = "marvell,dove-audio";
363 reg = <0xb4000 0x2210>;
364 interrupts = <21>, <22>;
365 clocks = <&gate_clk 13>;
366 clock-names = "internal";
367 status = "disabled";
368 };
369
370 thermal: thermal-diode@d001c {
371 compatible = "marvell,dove-thermal";
372 reg = <0xd001c 0x0c>, <0xd005c 0x08>;
373 };
374
375 gate_clk: clock-gating-ctrl@d0038 {
376 compatible = "marvell,dove-gating-clock";
377 reg = <0xd0038 0x4>;
378 clocks = <&core_clk 0>;
379 #clock-cells = <1>;
380 };
381
382 pmu_intc: pmu-interrupt-ctrl@d0050 {
383 compatible = "marvell,dove-pmu-intc";
384 interrupt-controller;
385 #interrupt-cells = <1>;
386 reg = <0xd0050 0x8>;
387 interrupts = <33>;
388 marvell,#interrupts = <7>;
223 }; 389 };
224 390
225 pinctrl: pin-ctrl@d0200 { 391 pinctrl: pin-ctrl@d0200 {
@@ -413,193 +579,47 @@
413 }; 579 };
414 }; 580 };
415 581
416 spi0: spi-ctrl@10600 { 582 core_clk: core-clocks@d0214 {
417 compatible = "marvell,orion-spi"; 583 compatible = "marvell,dove-core-clock";
418 #address-cells = <1>; 584 reg = <0xd0214 0x4>;
419 #size-cells = <0>; 585 #clock-cells = <1>;
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 }; 586 };
477 587
478 sdio1: sdio-host@90000 { 588 gpio0: gpio-ctrl@d0400 {
479 compatible = "marvell,dove-sdhci"; 589 compatible = "marvell,orion-gpio";
480 reg = <0x90000 0x100>; 590 #gpio-cells = <2>;
481 interrupts = <36>, <38>; 591 gpio-controller;
482 clocks = <&gate_clk 9>; 592 reg = <0xd0400 0x20>;
483 pinctrl-0 = <&pmx_sdio1>; 593 ngpios = <32>;
484 pinctrl-names = "default"; 594 interrupt-controller;
485 status = "disabled"; 595 #interrupt-cells = <2>;
596 interrupts = <12>, <13>, <14>, <60>;
486 }; 597 };
487 598
488 sata0: sata-host@a0000 { 599 gpio1: gpio-ctrl@d0420 {
489 compatible = "marvell,orion-sata"; 600 compatible = "marvell,orion-gpio";
490 reg = <0xa0000 0x2400>; 601 #gpio-cells = <2>;
491 interrupts = <62>; 602 gpio-controller;
492 clocks = <&gate_clk 3>; 603 reg = <0xd0420 0x20>;
493 nr-ports = <1>; 604 ngpios = <32>;
494 status = "disabled"; 605 interrupt-controller;
606 #interrupt-cells = <2>;
607 interrupts = <61>;
495 }; 608 };
496 609
497 rtc: real-time-clock@d8500 { 610 rtc: real-time-clock@d8500 {
498 compatible = "marvell,orion-rtc"; 611 compatible = "marvell,orion-rtc";
499 reg = <0xd8500 0x20>; 612 reg = <0xd8500 0x20>;
613 interrupt-parent = <&pmu_intc>;
614 interrupts = <5>;
500 }; 615 };
501 616
502 crypto: crypto-engine@30000 { 617 gpio2: gpio-ctrl@e8400 {
503 compatible = "marvell,orion-crypto"; 618 compatible = "marvell,orion-gpio";
504 reg = <0x30000 0x10000>, 619 #gpio-cells = <2>;
505 <0xffffe000 0x800>; 620 gpio-controller;
506 reg-names = "regs", "sram"; 621 reg = <0xe8400 0x0c>;
507 interrupts = <31>; 622 ngpios = <8>;
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";
603 }; 623 };
604 }; 624 };
605 }; 625 };
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index d0df4c4e8b0a..1fd75aa4639d 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -104,6 +104,45 @@
104 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, 104 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
105 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; 105 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
106 106
107 prm: prm@4ae06000 {
108 compatible = "ti,dra7-prm";
109 reg = <0x4ae06000 0x3000>;
110
111 prm_clocks: clocks {
112 #address-cells = <1>;
113 #size-cells = <0>;
114 };
115
116 prm_clockdomains: clockdomains {
117 };
118 };
119
120 cm_core_aon: cm_core_aon@4a005000 {
121 compatible = "ti,dra7-cm-core-aon";
122 reg = <0x4a005000 0x2000>;
123
124 cm_core_aon_clocks: clocks {
125 #address-cells = <1>;
126 #size-cells = <0>;
127 };
128
129 cm_core_aon_clockdomains: clockdomains {
130 };
131 };
132
133 cm_core: cm_core@4a008000 {
134 compatible = "ti,dra7-cm-core";
135 reg = <0x4a008000 0x3000>;
136
137 cm_core_clocks: clocks {
138 #address-cells = <1>;
139 #size-cells = <0>;
140 };
141
142 cm_core_clockdomains: clockdomains {
143 };
144 };
145
107 counter32k: counter@4ae04000 { 146 counter32k: counter@4ae04000 {
108 compatible = "ti,omap-counter32k"; 147 compatible = "ti,omap-counter32k";
109 reg = <0x4ae04000 0x40>; 148 reg = <0x4ae04000 0x40>;
@@ -584,3 +623,5 @@
584 }; 623 };
585 }; 624 };
586}; 625};
626
627/include/ "dra7xx-clocks.dtsi"
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
new file mode 100644
index 000000000000..e96da9a898ad
--- /dev/null
+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
@@ -0,0 +1,2015 @@
1/*
2 * Device Tree Source for DRA7xx clock data
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&cm_core_aon_clocks {
11 atl_clkin0_ck: atl_clkin0_ck {
12 #clock-cells = <0>;
13 compatible = "fixed-clock";
14 clock-frequency = <0>;
15 };
16
17 atl_clkin1_ck: atl_clkin1_ck {
18 #clock-cells = <0>;
19 compatible = "fixed-clock";
20 clock-frequency = <0>;
21 };
22
23 atl_clkin2_ck: atl_clkin2_ck {
24 #clock-cells = <0>;
25 compatible = "fixed-clock";
26 clock-frequency = <0>;
27 };
28
29 atlclkin3_ck: atlclkin3_ck {
30 #clock-cells = <0>;
31 compatible = "fixed-clock";
32 clock-frequency = <0>;
33 };
34
35 hdmi_clkin_ck: hdmi_clkin_ck {
36 #clock-cells = <0>;
37 compatible = "fixed-clock";
38 clock-frequency = <0>;
39 };
40
41 mlb_clkin_ck: mlb_clkin_ck {
42 #clock-cells = <0>;
43 compatible = "fixed-clock";
44 clock-frequency = <0>;
45 };
46
47 mlbp_clkin_ck: mlbp_clkin_ck {
48 #clock-cells = <0>;
49 compatible = "fixed-clock";
50 clock-frequency = <0>;
51 };
52
53 pciesref_acs_clk_ck: pciesref_acs_clk_ck {
54 #clock-cells = <0>;
55 compatible = "fixed-clock";
56 clock-frequency = <100000000>;
57 };
58
59 ref_clkin0_ck: ref_clkin0_ck {
60 #clock-cells = <0>;
61 compatible = "fixed-clock";
62 clock-frequency = <0>;
63 };
64
65 ref_clkin1_ck: ref_clkin1_ck {
66 #clock-cells = <0>;
67 compatible = "fixed-clock";
68 clock-frequency = <0>;
69 };
70
71 ref_clkin2_ck: ref_clkin2_ck {
72 #clock-cells = <0>;
73 compatible = "fixed-clock";
74 clock-frequency = <0>;
75 };
76
77 ref_clkin3_ck: ref_clkin3_ck {
78 #clock-cells = <0>;
79 compatible = "fixed-clock";
80 clock-frequency = <0>;
81 };
82
83 rmii_clk_ck: rmii_clk_ck {
84 #clock-cells = <0>;
85 compatible = "fixed-clock";
86 clock-frequency = <0>;
87 };
88
89 sdvenc_clkin_ck: sdvenc_clkin_ck {
90 #clock-cells = <0>;
91 compatible = "fixed-clock";
92 clock-frequency = <0>;
93 };
94
95 secure_32k_clk_src_ck: secure_32k_clk_src_ck {
96 #clock-cells = <0>;
97 compatible = "fixed-clock";
98 clock-frequency = <32768>;
99 };
100
101 sys_32k_ck: sys_32k_ck {
102 #clock-cells = <0>;
103 compatible = "fixed-clock";
104 clock-frequency = <32768>;
105 };
106
107 virt_12000000_ck: virt_12000000_ck {
108 #clock-cells = <0>;
109 compatible = "fixed-clock";
110 clock-frequency = <12000000>;
111 };
112
113 virt_13000000_ck: virt_13000000_ck {
114 #clock-cells = <0>;
115 compatible = "fixed-clock";
116 clock-frequency = <13000000>;
117 };
118
119 virt_16800000_ck: virt_16800000_ck {
120 #clock-cells = <0>;
121 compatible = "fixed-clock";
122 clock-frequency = <16800000>;
123 };
124
125 virt_19200000_ck: virt_19200000_ck {
126 #clock-cells = <0>;
127 compatible = "fixed-clock";
128 clock-frequency = <19200000>;
129 };
130
131 virt_20000000_ck: virt_20000000_ck {
132 #clock-cells = <0>;
133 compatible = "fixed-clock";
134 clock-frequency = <20000000>;
135 };
136
137 virt_26000000_ck: virt_26000000_ck {
138 #clock-cells = <0>;
139 compatible = "fixed-clock";
140 clock-frequency = <26000000>;
141 };
142
143 virt_27000000_ck: virt_27000000_ck {
144 #clock-cells = <0>;
145 compatible = "fixed-clock";
146 clock-frequency = <27000000>;
147 };
148
149 virt_38400000_ck: virt_38400000_ck {
150 #clock-cells = <0>;
151 compatible = "fixed-clock";
152 clock-frequency = <38400000>;
153 };
154
155 sys_clkin2: sys_clkin2 {
156 #clock-cells = <0>;
157 compatible = "fixed-clock";
158 clock-frequency = <22579200>;
159 };
160
161 usb_otg_clkin_ck: usb_otg_clkin_ck {
162 #clock-cells = <0>;
163 compatible = "fixed-clock";
164 clock-frequency = <0>;
165 };
166
167 video1_clkin_ck: video1_clkin_ck {
168 #clock-cells = <0>;
169 compatible = "fixed-clock";
170 clock-frequency = <0>;
171 };
172
173 video1_m2_clkin_ck: video1_m2_clkin_ck {
174 #clock-cells = <0>;
175 compatible = "fixed-clock";
176 clock-frequency = <0>;
177 };
178
179 video2_clkin_ck: video2_clkin_ck {
180 #clock-cells = <0>;
181 compatible = "fixed-clock";
182 clock-frequency = <0>;
183 };
184
185 video2_m2_clkin_ck: video2_m2_clkin_ck {
186 #clock-cells = <0>;
187 compatible = "fixed-clock";
188 clock-frequency = <0>;
189 };
190
191 dpll_abe_ck: dpll_abe_ck {
192 #clock-cells = <0>;
193 compatible = "ti,omap4-dpll-m4xen-clock";
194 clocks = <&abe_dpll_clk_mux>, <&abe_dpll_bypass_clk_mux>;
195 reg = <0x01e0>, <0x01e4>, <0x01ec>, <0x01e8>;
196 };
197
198 dpll_abe_x2_ck: dpll_abe_x2_ck {
199 #clock-cells = <0>;
200 compatible = "ti,omap4-dpll-x2-clock";
201 clocks = <&dpll_abe_ck>;
202 };
203
204 dpll_abe_m2x2_ck: dpll_abe_m2x2_ck {
205 #clock-cells = <0>;
206 compatible = "ti,divider-clock";
207 clocks = <&dpll_abe_x2_ck>;
208 ti,max-div = <31>;
209 ti,autoidle-shift = <8>;
210 reg = <0x01f0>;
211 ti,index-starts-at-one;
212 ti,invert-autoidle-bit;
213 };
214
215 abe_clk: abe_clk {
216 #clock-cells = <0>;
217 compatible = "ti,divider-clock";
218 clocks = <&dpll_abe_m2x2_ck>;
219 ti,max-div = <4>;
220 reg = <0x0108>;
221 ti,index-power-of-two;
222 };
223
224 dpll_abe_m2_ck: dpll_abe_m2_ck {
225 #clock-cells = <0>;
226 compatible = "ti,divider-clock";
227 clocks = <&dpll_abe_ck>;
228 ti,max-div = <31>;
229 ti,autoidle-shift = <8>;
230 reg = <0x01f0>;
231 ti,index-starts-at-one;
232 ti,invert-autoidle-bit;
233 };
234
235 dpll_abe_m3x2_ck: dpll_abe_m3x2_ck {
236 #clock-cells = <0>;
237 compatible = "ti,divider-clock";
238 clocks = <&dpll_abe_x2_ck>;
239 ti,max-div = <31>;
240 ti,autoidle-shift = <8>;
241 reg = <0x01f4>;
242 ti,index-starts-at-one;
243 ti,invert-autoidle-bit;
244 };
245
246 dpll_core_ck: dpll_core_ck {
247 #clock-cells = <0>;
248 compatible = "ti,omap4-dpll-core-clock";
249 clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
250 reg = <0x0120>, <0x0124>, <0x012c>, <0x0128>;
251 };
252
253 dpll_core_x2_ck: dpll_core_x2_ck {
254 #clock-cells = <0>;
255 compatible = "ti,omap4-dpll-x2-clock";
256 clocks = <&dpll_core_ck>;
257 };
258
259 dpll_core_h12x2_ck: dpll_core_h12x2_ck {
260 #clock-cells = <0>;
261 compatible = "ti,divider-clock";
262 clocks = <&dpll_core_x2_ck>;
263 ti,max-div = <63>;
264 ti,autoidle-shift = <8>;
265 reg = <0x013c>;
266 ti,index-starts-at-one;
267 ti,invert-autoidle-bit;
268 };
269
270 mpu_dpll_hs_clk_div: mpu_dpll_hs_clk_div {
271 #clock-cells = <0>;
272 compatible = "fixed-factor-clock";
273 clocks = <&dpll_core_h12x2_ck>;
274 clock-mult = <1>;
275 clock-div = <1>;
276 };
277
278 dpll_mpu_ck: dpll_mpu_ck {
279 #clock-cells = <0>;
280 compatible = "ti,omap4-dpll-clock";
281 clocks = <&sys_clkin1>, <&mpu_dpll_hs_clk_div>;
282 reg = <0x0160>, <0x0164>, <0x016c>, <0x0168>;
283 };
284
285 dpll_mpu_m2_ck: dpll_mpu_m2_ck {
286 #clock-cells = <0>;
287 compatible = "ti,divider-clock";
288 clocks = <&dpll_mpu_ck>;
289 ti,max-div = <31>;
290 ti,autoidle-shift = <8>;
291 reg = <0x0170>;
292 ti,index-starts-at-one;
293 ti,invert-autoidle-bit;
294 };
295
296 mpu_dclk_div: mpu_dclk_div {
297 #clock-cells = <0>;
298 compatible = "fixed-factor-clock";
299 clocks = <&dpll_mpu_m2_ck>;
300 clock-mult = <1>;
301 clock-div = <1>;
302 };
303
304 dsp_dpll_hs_clk_div: dsp_dpll_hs_clk_div {
305 #clock-cells = <0>;
306 compatible = "fixed-factor-clock";
307 clocks = <&dpll_core_h12x2_ck>;
308 clock-mult = <1>;
309 clock-div = <1>;
310 };
311
312 dpll_dsp_ck: dpll_dsp_ck {
313 #clock-cells = <0>;
314 compatible = "ti,omap4-dpll-clock";
315 clocks = <&sys_clkin1>, <&dsp_dpll_hs_clk_div>;
316 reg = <0x0234>, <0x0238>, <0x0240>, <0x023c>;
317 };
318
319 dpll_dsp_m2_ck: dpll_dsp_m2_ck {
320 #clock-cells = <0>;
321 compatible = "ti,divider-clock";
322 clocks = <&dpll_dsp_ck>;
323 ti,max-div = <31>;
324 ti,autoidle-shift = <8>;
325 reg = <0x0244>;
326 ti,index-starts-at-one;
327 ti,invert-autoidle-bit;
328 };
329
330 iva_dpll_hs_clk_div: iva_dpll_hs_clk_div {
331 #clock-cells = <0>;
332 compatible = "fixed-factor-clock";
333 clocks = <&dpll_core_h12x2_ck>;
334 clock-mult = <1>;
335 clock-div = <1>;
336 };
337
338 dpll_iva_ck: dpll_iva_ck {
339 #clock-cells = <0>;
340 compatible = "ti,omap4-dpll-clock";
341 clocks = <&sys_clkin1>, <&iva_dpll_hs_clk_div>;
342 reg = <0x01a0>, <0x01a4>, <0x01ac>, <0x01a8>;
343 };
344
345 dpll_iva_m2_ck: dpll_iva_m2_ck {
346 #clock-cells = <0>;
347 compatible = "ti,divider-clock";
348 clocks = <&dpll_iva_ck>;
349 ti,max-div = <31>;
350 ti,autoidle-shift = <8>;
351 reg = <0x01b0>;
352 ti,index-starts-at-one;
353 ti,invert-autoidle-bit;
354 };
355
356 iva_dclk: iva_dclk {
357 #clock-cells = <0>;
358 compatible = "fixed-factor-clock";
359 clocks = <&dpll_iva_m2_ck>;
360 clock-mult = <1>;
361 clock-div = <1>;
362 };
363
364 dpll_gpu_ck: dpll_gpu_ck {
365 #clock-cells = <0>;
366 compatible = "ti,omap4-dpll-clock";
367 clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
368 reg = <0x02d8>, <0x02dc>, <0x02e4>, <0x02e0>;
369 };
370
371 dpll_gpu_m2_ck: dpll_gpu_m2_ck {
372 #clock-cells = <0>;
373 compatible = "ti,divider-clock";
374 clocks = <&dpll_gpu_ck>;
375 ti,max-div = <31>;
376 ti,autoidle-shift = <8>;
377 reg = <0x02e8>;
378 ti,index-starts-at-one;
379 ti,invert-autoidle-bit;
380 };
381
382 dpll_core_m2_ck: dpll_core_m2_ck {
383 #clock-cells = <0>;
384 compatible = "ti,divider-clock";
385 clocks = <&dpll_core_ck>;
386 ti,max-div = <31>;
387 ti,autoidle-shift = <8>;
388 reg = <0x0130>;
389 ti,index-starts-at-one;
390 ti,invert-autoidle-bit;
391 };
392
393 core_dpll_out_dclk_div: core_dpll_out_dclk_div {
394 #clock-cells = <0>;
395 compatible = "fixed-factor-clock";
396 clocks = <&dpll_core_m2_ck>;
397 clock-mult = <1>;
398 clock-div = <1>;
399 };
400
401 dpll_ddr_ck: dpll_ddr_ck {
402 #clock-cells = <0>;
403 compatible = "ti,omap4-dpll-clock";
404 clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
405 reg = <0x0210>, <0x0214>, <0x021c>, <0x0218>;
406 };
407
408 dpll_ddr_m2_ck: dpll_ddr_m2_ck {
409 #clock-cells = <0>;
410 compatible = "ti,divider-clock";
411 clocks = <&dpll_ddr_ck>;
412 ti,max-div = <31>;
413 ti,autoidle-shift = <8>;
414 reg = <0x0220>;
415 ti,index-starts-at-one;
416 ti,invert-autoidle-bit;
417 };
418
419 dpll_gmac_ck: dpll_gmac_ck {
420 #clock-cells = <0>;
421 compatible = "ti,omap4-dpll-clock";
422 clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
423 reg = <0x02a8>, <0x02ac>, <0x02b4>, <0x02b0>;
424 };
425
426 dpll_gmac_m2_ck: dpll_gmac_m2_ck {
427 #clock-cells = <0>;
428 compatible = "ti,divider-clock";
429 clocks = <&dpll_gmac_ck>;
430 ti,max-div = <31>;
431 ti,autoidle-shift = <8>;
432 reg = <0x02b8>;
433 ti,index-starts-at-one;
434 ti,invert-autoidle-bit;
435 };
436
437 video2_dclk_div: video2_dclk_div {
438 #clock-cells = <0>;
439 compatible = "fixed-factor-clock";
440 clocks = <&video2_m2_clkin_ck>;
441 clock-mult = <1>;
442 clock-div = <1>;
443 };
444
445 video1_dclk_div: video1_dclk_div {
446 #clock-cells = <0>;
447 compatible = "fixed-factor-clock";
448 clocks = <&video1_m2_clkin_ck>;
449 clock-mult = <1>;
450 clock-div = <1>;
451 };
452
453 hdmi_dclk_div: hdmi_dclk_div {
454 #clock-cells = <0>;
455 compatible = "fixed-factor-clock";
456 clocks = <&hdmi_clkin_ck>;
457 clock-mult = <1>;
458 clock-div = <1>;
459 };
460
461 per_dpll_hs_clk_div: per_dpll_hs_clk_div {
462 #clock-cells = <0>;
463 compatible = "fixed-factor-clock";
464 clocks = <&dpll_abe_m3x2_ck>;
465 clock-mult = <1>;
466 clock-div = <2>;
467 };
468
469 usb_dpll_hs_clk_div: usb_dpll_hs_clk_div {
470 #clock-cells = <0>;
471 compatible = "fixed-factor-clock";
472 clocks = <&dpll_abe_m3x2_ck>;
473 clock-mult = <1>;
474 clock-div = <3>;
475 };
476
477 eve_dpll_hs_clk_div: eve_dpll_hs_clk_div {
478 #clock-cells = <0>;
479 compatible = "fixed-factor-clock";
480 clocks = <&dpll_core_h12x2_ck>;
481 clock-mult = <1>;
482 clock-div = <1>;
483 };
484
485 dpll_eve_ck: dpll_eve_ck {
486 #clock-cells = <0>;
487 compatible = "ti,omap4-dpll-clock";
488 clocks = <&sys_clkin1>, <&eve_dpll_hs_clk_div>;
489 reg = <0x0284>, <0x0288>, <0x0290>, <0x028c>;
490 };
491
492 dpll_eve_m2_ck: dpll_eve_m2_ck {
493 #clock-cells = <0>;
494 compatible = "ti,divider-clock";
495 clocks = <&dpll_eve_ck>;
496 ti,max-div = <31>;
497 ti,autoidle-shift = <8>;
498 reg = <0x0294>;
499 ti,index-starts-at-one;
500 ti,invert-autoidle-bit;
501 };
502
503 eve_dclk_div: eve_dclk_div {
504 #clock-cells = <0>;
505 compatible = "fixed-factor-clock";
506 clocks = <&dpll_eve_m2_ck>;
507 clock-mult = <1>;
508 clock-div = <1>;
509 };
510
511 dpll_core_h13x2_ck: dpll_core_h13x2_ck {
512 #clock-cells = <0>;
513 compatible = "ti,divider-clock";
514 clocks = <&dpll_core_x2_ck>;
515 ti,max-div = <63>;
516 ti,autoidle-shift = <8>;
517 reg = <0x0140>;
518 ti,index-starts-at-one;
519 ti,invert-autoidle-bit;
520 };
521
522 dpll_core_h14x2_ck: dpll_core_h14x2_ck {
523 #clock-cells = <0>;
524 compatible = "ti,divider-clock";
525 clocks = <&dpll_core_x2_ck>;
526 ti,max-div = <63>;
527 ti,autoidle-shift = <8>;
528 reg = <0x0144>;
529 ti,index-starts-at-one;
530 ti,invert-autoidle-bit;
531 };
532
533 dpll_core_h22x2_ck: dpll_core_h22x2_ck {
534 #clock-cells = <0>;
535 compatible = "ti,divider-clock";
536 clocks = <&dpll_core_x2_ck>;
537 ti,max-div = <63>;
538 ti,autoidle-shift = <8>;
539 reg = <0x0154>;
540 ti,index-starts-at-one;
541 ti,invert-autoidle-bit;
542 };
543
544 dpll_core_h23x2_ck: dpll_core_h23x2_ck {
545 #clock-cells = <0>;
546 compatible = "ti,divider-clock";
547 clocks = <&dpll_core_x2_ck>;
548 ti,max-div = <63>;
549 ti,autoidle-shift = <8>;
550 reg = <0x0158>;
551 ti,index-starts-at-one;
552 ti,invert-autoidle-bit;
553 };
554
555 dpll_core_h24x2_ck: dpll_core_h24x2_ck {
556 #clock-cells = <0>;
557 compatible = "ti,divider-clock";
558 clocks = <&dpll_core_x2_ck>;
559 ti,max-div = <63>;
560 ti,autoidle-shift = <8>;
561 reg = <0x015c>;
562 ti,index-starts-at-one;
563 ti,invert-autoidle-bit;
564 };
565
566 dpll_ddr_x2_ck: dpll_ddr_x2_ck {
567 #clock-cells = <0>;
568 compatible = "ti,omap4-dpll-x2-clock";
569 clocks = <&dpll_ddr_ck>;
570 };
571
572 dpll_ddr_h11x2_ck: dpll_ddr_h11x2_ck {
573 #clock-cells = <0>;
574 compatible = "ti,divider-clock";
575 clocks = <&dpll_ddr_x2_ck>;
576 ti,max-div = <63>;
577 ti,autoidle-shift = <8>;
578 reg = <0x0228>;
579 ti,index-starts-at-one;
580 ti,invert-autoidle-bit;
581 };
582
583 dpll_dsp_x2_ck: dpll_dsp_x2_ck {
584 #clock-cells = <0>;
585 compatible = "ti,omap4-dpll-x2-clock";
586 clocks = <&dpll_dsp_ck>;
587 };
588
589 dpll_dsp_m3x2_ck: dpll_dsp_m3x2_ck {
590 #clock-cells = <0>;
591 compatible = "ti,divider-clock";
592 clocks = <&dpll_dsp_x2_ck>;
593 ti,max-div = <31>;
594 ti,autoidle-shift = <8>;
595 reg = <0x0248>;
596 ti,index-starts-at-one;
597 ti,invert-autoidle-bit;
598 };
599
600 dpll_gmac_x2_ck: dpll_gmac_x2_ck {
601 #clock-cells = <0>;
602 compatible = "ti,omap4-dpll-x2-clock";
603 clocks = <&dpll_gmac_ck>;
604 };
605
606 dpll_gmac_h11x2_ck: dpll_gmac_h11x2_ck {
607 #clock-cells = <0>;
608 compatible = "ti,divider-clock";
609 clocks = <&dpll_gmac_x2_ck>;
610 ti,max-div = <63>;
611 ti,autoidle-shift = <8>;
612 reg = <0x02c0>;
613 ti,index-starts-at-one;
614 ti,invert-autoidle-bit;
615 };
616
617 dpll_gmac_h12x2_ck: dpll_gmac_h12x2_ck {
618 #clock-cells = <0>;
619 compatible = "ti,divider-clock";
620 clocks = <&dpll_gmac_x2_ck>;
621 ti,max-div = <63>;
622 ti,autoidle-shift = <8>;
623 reg = <0x02c4>;
624 ti,index-starts-at-one;
625 ti,invert-autoidle-bit;
626 };
627
628 dpll_gmac_h13x2_ck: dpll_gmac_h13x2_ck {
629 #clock-cells = <0>;
630 compatible = "ti,divider-clock";
631 clocks = <&dpll_gmac_x2_ck>;
632 ti,max-div = <63>;
633 ti,autoidle-shift = <8>;
634 reg = <0x02c8>;
635 ti,index-starts-at-one;
636 ti,invert-autoidle-bit;
637 };
638
639 dpll_gmac_m3x2_ck: dpll_gmac_m3x2_ck {
640 #clock-cells = <0>;
641 compatible = "ti,divider-clock";
642 clocks = <&dpll_gmac_x2_ck>;
643 ti,max-div = <31>;
644 ti,autoidle-shift = <8>;
645 reg = <0x02bc>;
646 ti,index-starts-at-one;
647 ti,invert-autoidle-bit;
648 };
649
650 gmii_m_clk_div: gmii_m_clk_div {
651 #clock-cells = <0>;
652 compatible = "fixed-factor-clock";
653 clocks = <&dpll_gmac_h11x2_ck>;
654 clock-mult = <1>;
655 clock-div = <2>;
656 };
657
658 hdmi_clk2_div: hdmi_clk2_div {
659 #clock-cells = <0>;
660 compatible = "fixed-factor-clock";
661 clocks = <&hdmi_clkin_ck>;
662 clock-mult = <1>;
663 clock-div = <1>;
664 };
665
666 hdmi_div_clk: hdmi_div_clk {
667 #clock-cells = <0>;
668 compatible = "fixed-factor-clock";
669 clocks = <&hdmi_clkin_ck>;
670 clock-mult = <1>;
671 clock-div = <1>;
672 };
673
674 l3_iclk_div: l3_iclk_div {
675 #clock-cells = <0>;
676 compatible = "fixed-factor-clock";
677 clocks = <&dpll_core_h12x2_ck>;
678 clock-mult = <1>;
679 clock-div = <1>;
680 };
681
682 l4_root_clk_div: l4_root_clk_div {
683 #clock-cells = <0>;
684 compatible = "fixed-factor-clock";
685 clocks = <&l3_iclk_div>;
686 clock-mult = <1>;
687 clock-div = <1>;
688 };
689
690 video1_clk2_div: video1_clk2_div {
691 #clock-cells = <0>;
692 compatible = "fixed-factor-clock";
693 clocks = <&video1_clkin_ck>;
694 clock-mult = <1>;
695 clock-div = <1>;
696 };
697
698 video1_div_clk: video1_div_clk {
699 #clock-cells = <0>;
700 compatible = "fixed-factor-clock";
701 clocks = <&video1_clkin_ck>;
702 clock-mult = <1>;
703 clock-div = <1>;
704 };
705
706 video2_clk2_div: video2_clk2_div {
707 #clock-cells = <0>;
708 compatible = "fixed-factor-clock";
709 clocks = <&video2_clkin_ck>;
710 clock-mult = <1>;
711 clock-div = <1>;
712 };
713
714 video2_div_clk: video2_div_clk {
715 #clock-cells = <0>;
716 compatible = "fixed-factor-clock";
717 clocks = <&video2_clkin_ck>;
718 clock-mult = <1>;
719 clock-div = <1>;
720 };
721
722 ipu1_gfclk_mux: ipu1_gfclk_mux {
723 #clock-cells = <0>;
724 compatible = "ti,mux-clock";
725 clocks = <&dpll_abe_m2x2_ck>, <&dpll_core_h22x2_ck>;
726 ti,bit-shift = <24>;
727 reg = <0x0520>;
728 };
729
730 mcasp1_ahclkr_mux: mcasp1_ahclkr_mux {
731 #clock-cells = <0>;
732 compatible = "ti,mux-clock";
733 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
734 ti,bit-shift = <28>;
735 reg = <0x0550>;
736 };
737
738 mcasp1_ahclkx_mux: mcasp1_ahclkx_mux {
739 #clock-cells = <0>;
740 compatible = "ti,mux-clock";
741 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
742 ti,bit-shift = <24>;
743 reg = <0x0550>;
744 };
745
746 mcasp1_aux_gfclk_mux: mcasp1_aux_gfclk_mux {
747 #clock-cells = <0>;
748 compatible = "ti,mux-clock";
749 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
750 ti,bit-shift = <22>;
751 reg = <0x0550>;
752 };
753
754 timer5_gfclk_mux: timer5_gfclk_mux {
755 #clock-cells = <0>;
756 compatible = "ti,mux-clock";
757 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>, <&clkoutmux0_clk_mux>;
758 ti,bit-shift = <24>;
759 reg = <0x0558>;
760 };
761
762 timer6_gfclk_mux: timer6_gfclk_mux {
763 #clock-cells = <0>;
764 compatible = "ti,mux-clock";
765 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>, <&clkoutmux0_clk_mux>;
766 ti,bit-shift = <24>;
767 reg = <0x0560>;
768 };
769
770 timer7_gfclk_mux: timer7_gfclk_mux {
771 #clock-cells = <0>;
772 compatible = "ti,mux-clock";
773 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>, <&clkoutmux0_clk_mux>;
774 ti,bit-shift = <24>;
775 reg = <0x0568>;
776 };
777
778 timer8_gfclk_mux: timer8_gfclk_mux {
779 #clock-cells = <0>;
780 compatible = "ti,mux-clock";
781 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>, <&clkoutmux0_clk_mux>;
782 ti,bit-shift = <24>;
783 reg = <0x0570>;
784 };
785
786 uart6_gfclk_mux: uart6_gfclk_mux {
787 #clock-cells = <0>;
788 compatible = "ti,mux-clock";
789 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
790 ti,bit-shift = <24>;
791 reg = <0x0580>;
792 };
793
794 dummy_ck: dummy_ck {
795 #clock-cells = <0>;
796 compatible = "fixed-clock";
797 clock-frequency = <0>;
798 };
799};
800&prm_clocks {
801 sys_clkin1: sys_clkin1 {
802 #clock-cells = <0>;
803 compatible = "ti,mux-clock";
804 clocks = <&virt_12000000_ck>, <&virt_20000000_ck>, <&virt_16800000_ck>, <&virt_19200000_ck>, <&virt_26000000_ck>, <&virt_27000000_ck>, <&virt_38400000_ck>;
805 reg = <0x0110>;
806 ti,index-starts-at-one;
807 };
808
809 abe_dpll_sys_clk_mux: abe_dpll_sys_clk_mux {
810 #clock-cells = <0>;
811 compatible = "ti,mux-clock";
812 clocks = <&sys_clkin1>, <&sys_clkin2>;
813 reg = <0x0118>;
814 };
815
816 abe_dpll_bypass_clk_mux: abe_dpll_bypass_clk_mux {
817 #clock-cells = <0>;
818 compatible = "ti,mux-clock";
819 clocks = <&abe_dpll_sys_clk_mux>, <&sys_32k_ck>;
820 reg = <0x0114>;
821 };
822
823 abe_dpll_clk_mux: abe_dpll_clk_mux {
824 #clock-cells = <0>;
825 compatible = "ti,mux-clock";
826 clocks = <&abe_dpll_sys_clk_mux>, <&sys_32k_ck>;
827 reg = <0x010c>;
828 };
829
830 abe_24m_fclk: abe_24m_fclk {
831 #clock-cells = <0>;
832 compatible = "ti,divider-clock";
833 clocks = <&dpll_abe_m2x2_ck>;
834 reg = <0x011c>;
835 ti,dividers = <8>, <16>;
836 };
837
838 aess_fclk: aess_fclk {
839 #clock-cells = <0>;
840 compatible = "ti,divider-clock";
841 clocks = <&abe_clk>;
842 reg = <0x0178>;
843 ti,max-div = <2>;
844 };
845
846 abe_giclk_div: abe_giclk_div {
847 #clock-cells = <0>;
848 compatible = "ti,divider-clock";
849 clocks = <&aess_fclk>;
850 reg = <0x0174>;
851 ti,max-div = <2>;
852 };
853
854 abe_lp_clk_div: abe_lp_clk_div {
855 #clock-cells = <0>;
856 compatible = "ti,divider-clock";
857 clocks = <&dpll_abe_m2x2_ck>;
858 reg = <0x01d8>;
859 ti,dividers = <16>, <32>;
860 };
861
862 abe_sys_clk_div: abe_sys_clk_div {
863 #clock-cells = <0>;
864 compatible = "ti,divider-clock";
865 clocks = <&sys_clkin1>;
866 reg = <0x0120>;
867 ti,max-div = <2>;
868 };
869
870 adc_gfclk_mux: adc_gfclk_mux {
871 #clock-cells = <0>;
872 compatible = "ti,mux-clock";
873 clocks = <&sys_clkin1>, <&sys_clkin2>, <&sys_32k_ck>;
874 reg = <0x01dc>;
875 };
876
877 sys_clk1_dclk_div: sys_clk1_dclk_div {
878 #clock-cells = <0>;
879 compatible = "ti,divider-clock";
880 clocks = <&sys_clkin1>;
881 ti,max-div = <64>;
882 reg = <0x01c8>;
883 ti,index-power-of-two;
884 };
885
886 sys_clk2_dclk_div: sys_clk2_dclk_div {
887 #clock-cells = <0>;
888 compatible = "ti,divider-clock";
889 clocks = <&sys_clkin2>;
890 ti,max-div = <64>;
891 reg = <0x01cc>;
892 ti,index-power-of-two;
893 };
894
895 per_abe_x1_dclk_div: per_abe_x1_dclk_div {
896 #clock-cells = <0>;
897 compatible = "ti,divider-clock";
898 clocks = <&dpll_abe_m2_ck>;
899 ti,max-div = <64>;
900 reg = <0x01bc>;
901 ti,index-power-of-two;
902 };
903
904 dsp_gclk_div: dsp_gclk_div {
905 #clock-cells = <0>;
906 compatible = "ti,divider-clock";
907 clocks = <&dpll_dsp_m2_ck>;
908 ti,max-div = <64>;
909 reg = <0x018c>;
910 ti,index-power-of-two;
911 };
912
913 gpu_dclk: gpu_dclk {
914 #clock-cells = <0>;
915 compatible = "ti,divider-clock";
916 clocks = <&dpll_gpu_m2_ck>;
917 ti,max-div = <64>;
918 reg = <0x01a0>;
919 ti,index-power-of-two;
920 };
921
922 emif_phy_dclk_div: emif_phy_dclk_div {
923 #clock-cells = <0>;
924 compatible = "ti,divider-clock";
925 clocks = <&dpll_ddr_m2_ck>;
926 ti,max-div = <64>;
927 reg = <0x0190>;
928 ti,index-power-of-two;
929 };
930
931 gmac_250m_dclk_div: gmac_250m_dclk_div {
932 #clock-cells = <0>;
933 compatible = "ti,divider-clock";
934 clocks = <&dpll_gmac_m2_ck>;
935 ti,max-div = <64>;
936 reg = <0x019c>;
937 ti,index-power-of-two;
938 };
939
940 l3init_480m_dclk_div: l3init_480m_dclk_div {
941 #clock-cells = <0>;
942 compatible = "ti,divider-clock";
943 clocks = <&dpll_usb_m2_ck>;
944 ti,max-div = <64>;
945 reg = <0x01ac>;
946 ti,index-power-of-two;
947 };
948
949 usb_otg_dclk_div: usb_otg_dclk_div {
950 #clock-cells = <0>;
951 compatible = "ti,divider-clock";
952 clocks = <&usb_otg_clkin_ck>;
953 ti,max-div = <64>;
954 reg = <0x0184>;
955 ti,index-power-of-two;
956 };
957
958 sata_dclk_div: sata_dclk_div {
959 #clock-cells = <0>;
960 compatible = "ti,divider-clock";
961 clocks = <&sys_clkin1>;
962 ti,max-div = <64>;
963 reg = <0x01c0>;
964 ti,index-power-of-two;
965 };
966
967 pcie2_dclk_div: pcie2_dclk_div {
968 #clock-cells = <0>;
969 compatible = "ti,divider-clock";
970 clocks = <&dpll_pcie_ref_m2_ck>;
971 ti,max-div = <64>;
972 reg = <0x01b8>;
973 ti,index-power-of-two;
974 };
975
976 pcie_dclk_div: pcie_dclk_div {
977 #clock-cells = <0>;
978 compatible = "ti,divider-clock";
979 clocks = <&apll_pcie_m2_ck>;
980 ti,max-div = <64>;
981 reg = <0x01b4>;
982 ti,index-power-of-two;
983 };
984
985 emu_dclk_div: emu_dclk_div {
986 #clock-cells = <0>;
987 compatible = "ti,divider-clock";
988 clocks = <&sys_clkin1>;
989 ti,max-div = <64>;
990 reg = <0x0194>;
991 ti,index-power-of-two;
992 };
993
994 secure_32k_dclk_div: secure_32k_dclk_div {
995 #clock-cells = <0>;
996 compatible = "ti,divider-clock";
997 clocks = <&secure_32k_clk_src_ck>;
998 ti,max-div = <64>;
999 reg = <0x01c4>;
1000 ti,index-power-of-two;
1001 };
1002
1003 clkoutmux0_clk_mux: clkoutmux0_clk_mux {
1004 #clock-cells = <0>;
1005 compatible = "ti,mux-clock";
1006 clocks = <&sys_clk1_dclk_div>, <&sys_clk2_dclk_div>, <&per_abe_x1_dclk_div>, <&mpu_dclk_div>, <&dsp_gclk_div>, <&iva_dclk>, <&gpu_dclk>, <&core_dpll_out_dclk_div>, <&emif_phy_dclk_div>, <&gmac_250m_dclk_div>, <&video2_dclk_div>, <&video1_dclk_div>, <&hdmi_dclk_div>, <&func_96m_aon_dclk_div>, <&l3init_480m_dclk_div>, <&usb_otg_dclk_div>, <&sata_dclk_div>, <&pcie2_dclk_div>, <&pcie_dclk_div>, <&emu_dclk_div>, <&secure_32k_dclk_div>, <&eve_dclk_div>;
1007 reg = <0x0158>;
1008 };
1009
1010 clkoutmux1_clk_mux: clkoutmux1_clk_mux {
1011 #clock-cells = <0>;
1012 compatible = "ti,mux-clock";
1013 clocks = <&sys_clk1_dclk_div>, <&sys_clk2_dclk_div>, <&per_abe_x1_dclk_div>, <&mpu_dclk_div>, <&dsp_gclk_div>, <&iva_dclk>, <&gpu_dclk>, <&core_dpll_out_dclk_div>, <&emif_phy_dclk_div>, <&gmac_250m_dclk_div>, <&video2_dclk_div>, <&video1_dclk_div>, <&hdmi_dclk_div>, <&func_96m_aon_dclk_div>, <&l3init_480m_dclk_div>, <&usb_otg_dclk_div>, <&sata_dclk_div>, <&pcie2_dclk_div>, <&pcie_dclk_div>, <&emu_dclk_div>, <&secure_32k_dclk_div>, <&eve_dclk_div>;
1014 reg = <0x015c>;
1015 };
1016
1017 clkoutmux2_clk_mux: clkoutmux2_clk_mux {
1018 #clock-cells = <0>;
1019 compatible = "ti,mux-clock";
1020 clocks = <&sys_clk1_dclk_div>, <&sys_clk2_dclk_div>, <&per_abe_x1_dclk_div>, <&mpu_dclk_div>, <&dsp_gclk_div>, <&iva_dclk>, <&gpu_dclk>, <&core_dpll_out_dclk_div>, <&emif_phy_dclk_div>, <&gmac_250m_dclk_div>, <&video2_dclk_div>, <&video1_dclk_div>, <&hdmi_dclk_div>, <&func_96m_aon_dclk_div>, <&l3init_480m_dclk_div>, <&usb_otg_dclk_div>, <&sata_dclk_div>, <&pcie2_dclk_div>, <&pcie_dclk_div>, <&emu_dclk_div>, <&secure_32k_dclk_div>, <&eve_dclk_div>;
1021 reg = <0x0160>;
1022 };
1023
1024 custefuse_sys_gfclk_div: custefuse_sys_gfclk_div {
1025 #clock-cells = <0>;
1026 compatible = "fixed-factor-clock";
1027 clocks = <&sys_clkin1>;
1028 clock-mult = <1>;
1029 clock-div = <2>;
1030 };
1031
1032 eve_clk: eve_clk {
1033 #clock-cells = <0>;
1034 compatible = "ti,mux-clock";
1035 clocks = <&dpll_eve_m2_ck>, <&dpll_dsp_m3x2_ck>;
1036 reg = <0x0180>;
1037 };
1038
1039 hdmi_dpll_clk_mux: hdmi_dpll_clk_mux {
1040 #clock-cells = <0>;
1041 compatible = "ti,mux-clock";
1042 clocks = <&sys_clkin1>, <&sys_clkin2>;
1043 reg = <0x01a4>;
1044 };
1045
1046 mlb_clk: mlb_clk {
1047 #clock-cells = <0>;
1048 compatible = "ti,divider-clock";
1049 clocks = <&mlb_clkin_ck>;
1050 ti,max-div = <64>;
1051 reg = <0x0134>;
1052 ti,index-power-of-two;
1053 };
1054
1055 mlbp_clk: mlbp_clk {
1056 #clock-cells = <0>;
1057 compatible = "ti,divider-clock";
1058 clocks = <&mlbp_clkin_ck>;
1059 ti,max-div = <64>;
1060 reg = <0x0130>;
1061 ti,index-power-of-two;
1062 };
1063
1064 per_abe_x1_gfclk2_div: per_abe_x1_gfclk2_div {
1065 #clock-cells = <0>;
1066 compatible = "ti,divider-clock";
1067 clocks = <&dpll_abe_m2_ck>;
1068 ti,max-div = <64>;
1069 reg = <0x0138>;
1070 ti,index-power-of-two;
1071 };
1072
1073 timer_sys_clk_div: timer_sys_clk_div {
1074 #clock-cells = <0>;
1075 compatible = "ti,divider-clock";
1076 clocks = <&sys_clkin1>;
1077 reg = <0x0144>;
1078 ti,max-div = <2>;
1079 };
1080
1081 video1_dpll_clk_mux: video1_dpll_clk_mux {
1082 #clock-cells = <0>;
1083 compatible = "ti,mux-clock";
1084 clocks = <&sys_clkin1>, <&sys_clkin2>;
1085 reg = <0x01d0>;
1086 };
1087
1088 video2_dpll_clk_mux: video2_dpll_clk_mux {
1089 #clock-cells = <0>;
1090 compatible = "ti,mux-clock";
1091 clocks = <&sys_clkin1>, <&sys_clkin2>;
1092 reg = <0x01d4>;
1093 };
1094
1095 wkupaon_iclk_mux: wkupaon_iclk_mux {
1096 #clock-cells = <0>;
1097 compatible = "ti,mux-clock";
1098 clocks = <&sys_clkin1>, <&abe_lp_clk_div>;
1099 reg = <0x0108>;
1100 };
1101
1102 gpio1_dbclk: gpio1_dbclk {
1103 #clock-cells = <0>;
1104 compatible = "ti,gate-clock";
1105 clocks = <&sys_32k_ck>;
1106 ti,bit-shift = <8>;
1107 reg = <0x1838>;
1108 };
1109
1110 dcan1_sys_clk_mux: dcan1_sys_clk_mux {
1111 #clock-cells = <0>;
1112 compatible = "ti,mux-clock";
1113 clocks = <&sys_clkin1>, <&sys_clkin2>;
1114 ti,bit-shift = <24>;
1115 reg = <0x1888>;
1116 };
1117
1118 timer1_gfclk_mux: timer1_gfclk_mux {
1119 #clock-cells = <0>;
1120 compatible = "ti,mux-clock";
1121 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1122 ti,bit-shift = <24>;
1123 reg = <0x1840>;
1124 };
1125
1126 uart10_gfclk_mux: uart10_gfclk_mux {
1127 #clock-cells = <0>;
1128 compatible = "ti,mux-clock";
1129 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1130 ti,bit-shift = <24>;
1131 reg = <0x1880>;
1132 };
1133};
1134&cm_core_clocks {
1135 dpll_pcie_ref_ck: dpll_pcie_ref_ck {
1136 #clock-cells = <0>;
1137 compatible = "ti,omap4-dpll-clock";
1138 clocks = <&sys_clkin1>, <&sys_clkin1>;
1139 reg = <0x0200>, <0x0204>, <0x020c>, <0x0208>;
1140 };
1141
1142 dpll_pcie_ref_m2ldo_ck: dpll_pcie_ref_m2ldo_ck {
1143 #clock-cells = <0>;
1144 compatible = "ti,divider-clock";
1145 clocks = <&dpll_pcie_ref_ck>;
1146 ti,max-div = <31>;
1147 ti,autoidle-shift = <8>;
1148 reg = <0x0210>;
1149 ti,index-starts-at-one;
1150 ti,invert-autoidle-bit;
1151 };
1152
1153 apll_pcie_in_clk_mux: apll_pcie_in_clk_mux@4ae06118 {
1154 compatible = "ti,mux-clock";
1155 clocks = <&dpll_pcie_ref_ck>, <&pciesref_acs_clk_ck>;
1156 #clock-cells = <0>;
1157 reg = <0x021c 0x4>;
1158 ti,bit-shift = <7>;
1159 };
1160
1161 apll_pcie_ck: apll_pcie_ck {
1162 #clock-cells = <0>;
1163 compatible = "ti,dra7-apll-clock";
1164 clocks = <&apll_pcie_in_clk_mux>, <&dpll_pcie_ref_ck>;
1165 reg = <0x021c>, <0x0220>;
1166 };
1167
1168 optfclk_pciephy_div: optfclk_pciephy_div@4a00821c {
1169 compatible = "ti,divider-clock";
1170 clocks = <&apll_pcie_ck>;
1171 #clock-cells = <0>;
1172 reg = <0x021c>;
1173 ti,bit-shift = <8>;
1174 ti,max-div = <2>;
1175 };
1176
1177 optfclk_pciephy_clk: optfclk_pciephy_clk@4a0093b0 {
1178 compatible = "ti,gate-clock";
1179 clocks = <&apll_pcie_ck>;
1180 #clock-cells = <0>;
1181 reg = <0x13b0>;
1182 ti,bit-shift = <9>;
1183 };
1184
1185 optfclk_pciephy_div_clk: optfclk_pciephy_div_clk@4a0093b0 {
1186 compatible = "ti,gate-clock";
1187 clocks = <&optfclk_pciephy_div>;
1188 #clock-cells = <0>;
1189 reg = <0x13b0>;
1190 ti,bit-shift = <10>;
1191 };
1192
1193 apll_pcie_clkvcoldo: apll_pcie_clkvcoldo {
1194 #clock-cells = <0>;
1195 compatible = "fixed-factor-clock";
1196 clocks = <&apll_pcie_ck>;
1197 clock-mult = <1>;
1198 clock-div = <1>;
1199 };
1200
1201 apll_pcie_clkvcoldo_div: apll_pcie_clkvcoldo_div {
1202 #clock-cells = <0>;
1203 compatible = "fixed-factor-clock";
1204 clocks = <&apll_pcie_ck>;
1205 clock-mult = <1>;
1206 clock-div = <1>;
1207 };
1208
1209 apll_pcie_m2_ck: apll_pcie_m2_ck {
1210 #clock-cells = <0>;
1211 compatible = "fixed-factor-clock";
1212 clocks = <&apll_pcie_ck>;
1213 clock-mult = <1>;
1214 clock-div = <1>;
1215 };
1216
1217 dpll_per_ck: dpll_per_ck {
1218 #clock-cells = <0>;
1219 compatible = "ti,omap4-dpll-clock";
1220 clocks = <&sys_clkin1>, <&per_dpll_hs_clk_div>;
1221 reg = <0x0140>, <0x0144>, <0x014c>, <0x0148>;
1222 };
1223
1224 dpll_per_m2_ck: dpll_per_m2_ck {
1225 #clock-cells = <0>;
1226 compatible = "ti,divider-clock";
1227 clocks = <&dpll_per_ck>;
1228 ti,max-div = <31>;
1229 ti,autoidle-shift = <8>;
1230 reg = <0x0150>;
1231 ti,index-starts-at-one;
1232 ti,invert-autoidle-bit;
1233 };
1234
1235 func_96m_aon_dclk_div: func_96m_aon_dclk_div {
1236 #clock-cells = <0>;
1237 compatible = "fixed-factor-clock";
1238 clocks = <&dpll_per_m2_ck>;
1239 clock-mult = <1>;
1240 clock-div = <1>;
1241 };
1242
1243 dpll_usb_ck: dpll_usb_ck {
1244 #clock-cells = <0>;
1245 compatible = "ti,omap4-dpll-j-type-clock";
1246 clocks = <&sys_clkin1>, <&usb_dpll_hs_clk_div>;
1247 reg = <0x0180>, <0x0184>, <0x018c>, <0x0188>;
1248 };
1249
1250 dpll_usb_m2_ck: dpll_usb_m2_ck {
1251 #clock-cells = <0>;
1252 compatible = "ti,divider-clock";
1253 clocks = <&dpll_usb_ck>;
1254 ti,max-div = <127>;
1255 ti,autoidle-shift = <8>;
1256 reg = <0x0190>;
1257 ti,index-starts-at-one;
1258 ti,invert-autoidle-bit;
1259 };
1260
1261 dpll_pcie_ref_m2_ck: dpll_pcie_ref_m2_ck {
1262 #clock-cells = <0>;
1263 compatible = "ti,divider-clock";
1264 clocks = <&dpll_pcie_ref_ck>;
1265 ti,max-div = <127>;
1266 ti,autoidle-shift = <8>;
1267 reg = <0x0210>;
1268 ti,index-starts-at-one;
1269 ti,invert-autoidle-bit;
1270 };
1271
1272 dpll_per_x2_ck: dpll_per_x2_ck {
1273 #clock-cells = <0>;
1274 compatible = "ti,omap4-dpll-x2-clock";
1275 clocks = <&dpll_per_ck>;
1276 };
1277
1278 dpll_per_h11x2_ck: dpll_per_h11x2_ck {
1279 #clock-cells = <0>;
1280 compatible = "ti,divider-clock";
1281 clocks = <&dpll_per_x2_ck>;
1282 ti,max-div = <63>;
1283 ti,autoidle-shift = <8>;
1284 reg = <0x0158>;
1285 ti,index-starts-at-one;
1286 ti,invert-autoidle-bit;
1287 };
1288
1289 dpll_per_h12x2_ck: dpll_per_h12x2_ck {
1290 #clock-cells = <0>;
1291 compatible = "ti,divider-clock";
1292 clocks = <&dpll_per_x2_ck>;
1293 ti,max-div = <63>;
1294 ti,autoidle-shift = <8>;
1295 reg = <0x015c>;
1296 ti,index-starts-at-one;
1297 ti,invert-autoidle-bit;
1298 };
1299
1300 dpll_per_h13x2_ck: dpll_per_h13x2_ck {
1301 #clock-cells = <0>;
1302 compatible = "ti,divider-clock";
1303 clocks = <&dpll_per_x2_ck>;
1304 ti,max-div = <63>;
1305 ti,autoidle-shift = <8>;
1306 reg = <0x0160>;
1307 ti,index-starts-at-one;
1308 ti,invert-autoidle-bit;
1309 };
1310
1311 dpll_per_h14x2_ck: dpll_per_h14x2_ck {
1312 #clock-cells = <0>;
1313 compatible = "ti,divider-clock";
1314 clocks = <&dpll_per_x2_ck>;
1315 ti,max-div = <63>;
1316 ti,autoidle-shift = <8>;
1317 reg = <0x0164>;
1318 ti,index-starts-at-one;
1319 ti,invert-autoidle-bit;
1320 };
1321
1322 dpll_per_m2x2_ck: dpll_per_m2x2_ck {
1323 #clock-cells = <0>;
1324 compatible = "ti,divider-clock";
1325 clocks = <&dpll_per_x2_ck>;
1326 ti,max-div = <31>;
1327 ti,autoidle-shift = <8>;
1328 reg = <0x0150>;
1329 ti,index-starts-at-one;
1330 ti,invert-autoidle-bit;
1331 };
1332
1333 dpll_usb_clkdcoldo: dpll_usb_clkdcoldo {
1334 #clock-cells = <0>;
1335 compatible = "fixed-factor-clock";
1336 clocks = <&dpll_usb_ck>;
1337 clock-mult = <1>;
1338 clock-div = <1>;
1339 };
1340
1341 func_128m_clk: func_128m_clk {
1342 #clock-cells = <0>;
1343 compatible = "fixed-factor-clock";
1344 clocks = <&dpll_per_h11x2_ck>;
1345 clock-mult = <1>;
1346 clock-div = <2>;
1347 };
1348
1349 func_12m_fclk: func_12m_fclk {
1350 #clock-cells = <0>;
1351 compatible = "fixed-factor-clock";
1352 clocks = <&dpll_per_m2x2_ck>;
1353 clock-mult = <1>;
1354 clock-div = <16>;
1355 };
1356
1357 func_24m_clk: func_24m_clk {
1358 #clock-cells = <0>;
1359 compatible = "fixed-factor-clock";
1360 clocks = <&dpll_per_m2_ck>;
1361 clock-mult = <1>;
1362 clock-div = <4>;
1363 };
1364
1365 func_48m_fclk: func_48m_fclk {
1366 #clock-cells = <0>;
1367 compatible = "fixed-factor-clock";
1368 clocks = <&dpll_per_m2x2_ck>;
1369 clock-mult = <1>;
1370 clock-div = <4>;
1371 };
1372
1373 func_96m_fclk: func_96m_fclk {
1374 #clock-cells = <0>;
1375 compatible = "fixed-factor-clock";
1376 clocks = <&dpll_per_m2x2_ck>;
1377 clock-mult = <1>;
1378 clock-div = <2>;
1379 };
1380
1381 l3init_60m_fclk: l3init_60m_fclk {
1382 #clock-cells = <0>;
1383 compatible = "ti,divider-clock";
1384 clocks = <&dpll_usb_m2_ck>;
1385 reg = <0x0104>;
1386 ti,dividers = <1>, <8>;
1387 };
1388
1389 dss_32khz_clk: dss_32khz_clk {
1390 #clock-cells = <0>;
1391 compatible = "ti,gate-clock";
1392 clocks = <&sys_32k_ck>;
1393 ti,bit-shift = <11>;
1394 reg = <0x1120>;
1395 };
1396
1397 dss_48mhz_clk: dss_48mhz_clk {
1398 #clock-cells = <0>;
1399 compatible = "ti,gate-clock";
1400 clocks = <&func_48m_fclk>;
1401 ti,bit-shift = <9>;
1402 reg = <0x1120>;
1403 };
1404
1405 dss_dss_clk: dss_dss_clk {
1406 #clock-cells = <0>;
1407 compatible = "ti,gate-clock";
1408 clocks = <&dpll_per_h12x2_ck>;
1409 ti,bit-shift = <8>;
1410 reg = <0x1120>;
1411 };
1412
1413 dss_hdmi_clk: dss_hdmi_clk {
1414 #clock-cells = <0>;
1415 compatible = "ti,gate-clock";
1416 clocks = <&hdmi_dpll_clk_mux>;
1417 ti,bit-shift = <10>;
1418 reg = <0x1120>;
1419 };
1420
1421 dss_video1_clk: dss_video1_clk {
1422 #clock-cells = <0>;
1423 compatible = "ti,gate-clock";
1424 clocks = <&video1_dpll_clk_mux>;
1425 ti,bit-shift = <12>;
1426 reg = <0x1120>;
1427 };
1428
1429 dss_video2_clk: dss_video2_clk {
1430 #clock-cells = <0>;
1431 compatible = "ti,gate-clock";
1432 clocks = <&video2_dpll_clk_mux>;
1433 ti,bit-shift = <13>;
1434 reg = <0x1120>;
1435 };
1436
1437 gpio2_dbclk: gpio2_dbclk {
1438 #clock-cells = <0>;
1439 compatible = "ti,gate-clock";
1440 clocks = <&sys_32k_ck>;
1441 ti,bit-shift = <8>;
1442 reg = <0x1760>;
1443 };
1444
1445 gpio3_dbclk: gpio3_dbclk {
1446 #clock-cells = <0>;
1447 compatible = "ti,gate-clock";
1448 clocks = <&sys_32k_ck>;
1449 ti,bit-shift = <8>;
1450 reg = <0x1768>;
1451 };
1452
1453 gpio4_dbclk: gpio4_dbclk {
1454 #clock-cells = <0>;
1455 compatible = "ti,gate-clock";
1456 clocks = <&sys_32k_ck>;
1457 ti,bit-shift = <8>;
1458 reg = <0x1770>;
1459 };
1460
1461 gpio5_dbclk: gpio5_dbclk {
1462 #clock-cells = <0>;
1463 compatible = "ti,gate-clock";
1464 clocks = <&sys_32k_ck>;
1465 ti,bit-shift = <8>;
1466 reg = <0x1778>;
1467 };
1468
1469 gpio6_dbclk: gpio6_dbclk {
1470 #clock-cells = <0>;
1471 compatible = "ti,gate-clock";
1472 clocks = <&sys_32k_ck>;
1473 ti,bit-shift = <8>;
1474 reg = <0x1780>;
1475 };
1476
1477 gpio7_dbclk: gpio7_dbclk {
1478 #clock-cells = <0>;
1479 compatible = "ti,gate-clock";
1480 clocks = <&sys_32k_ck>;
1481 ti,bit-shift = <8>;
1482 reg = <0x1810>;
1483 };
1484
1485 gpio8_dbclk: gpio8_dbclk {
1486 #clock-cells = <0>;
1487 compatible = "ti,gate-clock";
1488 clocks = <&sys_32k_ck>;
1489 ti,bit-shift = <8>;
1490 reg = <0x1818>;
1491 };
1492
1493 mmc1_clk32k: mmc1_clk32k {
1494 #clock-cells = <0>;
1495 compatible = "ti,gate-clock";
1496 clocks = <&sys_32k_ck>;
1497 ti,bit-shift = <8>;
1498 reg = <0x1328>;
1499 };
1500
1501 mmc2_clk32k: mmc2_clk32k {
1502 #clock-cells = <0>;
1503 compatible = "ti,gate-clock";
1504 clocks = <&sys_32k_ck>;
1505 ti,bit-shift = <8>;
1506 reg = <0x1330>;
1507 };
1508
1509 mmc3_clk32k: mmc3_clk32k {
1510 #clock-cells = <0>;
1511 compatible = "ti,gate-clock";
1512 clocks = <&sys_32k_ck>;
1513 ti,bit-shift = <8>;
1514 reg = <0x1820>;
1515 };
1516
1517 mmc4_clk32k: mmc4_clk32k {
1518 #clock-cells = <0>;
1519 compatible = "ti,gate-clock";
1520 clocks = <&sys_32k_ck>;
1521 ti,bit-shift = <8>;
1522 reg = <0x1828>;
1523 };
1524
1525 sata_ref_clk: sata_ref_clk {
1526 #clock-cells = <0>;
1527 compatible = "ti,gate-clock";
1528 clocks = <&sys_clkin1>;
1529 ti,bit-shift = <8>;
1530 reg = <0x1388>;
1531 };
1532
1533 usb_otg_ss1_refclk960m: usb_otg_ss1_refclk960m {
1534 #clock-cells = <0>;
1535 compatible = "ti,gate-clock";
1536 clocks = <&dpll_usb_clkdcoldo>;
1537 ti,bit-shift = <8>;
1538 reg = <0x13f0>;
1539 };
1540
1541 usb_otg_ss2_refclk960m: usb_otg_ss2_refclk960m {
1542 #clock-cells = <0>;
1543 compatible = "ti,gate-clock";
1544 clocks = <&dpll_usb_clkdcoldo>;
1545 ti,bit-shift = <8>;
1546 reg = <0x1340>;
1547 };
1548
1549 usb_phy1_always_on_clk32k: usb_phy1_always_on_clk32k {
1550 #clock-cells = <0>;
1551 compatible = "ti,gate-clock";
1552 clocks = <&sys_32k_ck>;
1553 ti,bit-shift = <8>;
1554 reg = <0x0640>;
1555 };
1556
1557 usb_phy2_always_on_clk32k: usb_phy2_always_on_clk32k {
1558 #clock-cells = <0>;
1559 compatible = "ti,gate-clock";
1560 clocks = <&sys_32k_ck>;
1561 ti,bit-shift = <8>;
1562 reg = <0x0688>;
1563 };
1564
1565 usb_phy3_always_on_clk32k: usb_phy3_always_on_clk32k {
1566 #clock-cells = <0>;
1567 compatible = "ti,gate-clock";
1568 clocks = <&sys_32k_ck>;
1569 ti,bit-shift = <8>;
1570 reg = <0x0698>;
1571 };
1572
1573 atl_dpll_clk_mux: atl_dpll_clk_mux {
1574 #clock-cells = <0>;
1575 compatible = "ti,mux-clock";
1576 clocks = <&sys_32k_ck>, <&video1_clkin_ck>, <&video2_clkin_ck>, <&hdmi_clkin_ck>;
1577 ti,bit-shift = <24>;
1578 reg = <0x0c00>;
1579 };
1580
1581 atl_gfclk_mux: atl_gfclk_mux {
1582 #clock-cells = <0>;
1583 compatible = "ti,mux-clock";
1584 clocks = <&l3_iclk_div>, <&dpll_abe_m2_ck>, <&atl_dpll_clk_mux>;
1585 ti,bit-shift = <26>;
1586 reg = <0x0c00>;
1587 };
1588
1589 gmac_gmii_ref_clk_div: gmac_gmii_ref_clk_div {
1590 #clock-cells = <0>;
1591 compatible = "ti,divider-clock";
1592 clocks = <&dpll_gmac_m2_ck>;
1593 ti,bit-shift = <24>;
1594 reg = <0x13d0>;
1595 ti,dividers = <2>;
1596 };
1597
1598 gmac_rft_clk_mux: gmac_rft_clk_mux {
1599 #clock-cells = <0>;
1600 compatible = "ti,mux-clock";
1601 clocks = <&video1_clkin_ck>, <&video2_clkin_ck>, <&dpll_abe_m2_ck>, <&hdmi_clkin_ck>, <&l3_iclk_div>;
1602 ti,bit-shift = <25>;
1603 reg = <0x13d0>;
1604 };
1605
1606 gpu_core_gclk_mux: gpu_core_gclk_mux {
1607 #clock-cells = <0>;
1608 compatible = "ti,mux-clock";
1609 clocks = <&dpll_core_h14x2_ck>, <&dpll_per_h14x2_ck>, <&dpll_gpu_m2_ck>;
1610 ti,bit-shift = <24>;
1611 reg = <0x1220>;
1612 };
1613
1614 gpu_hyd_gclk_mux: gpu_hyd_gclk_mux {
1615 #clock-cells = <0>;
1616 compatible = "ti,mux-clock";
1617 clocks = <&dpll_core_h14x2_ck>, <&dpll_per_h14x2_ck>, <&dpll_gpu_m2_ck>;
1618 ti,bit-shift = <26>;
1619 reg = <0x1220>;
1620 };
1621
1622 l3instr_ts_gclk_div: l3instr_ts_gclk_div {
1623 #clock-cells = <0>;
1624 compatible = "ti,divider-clock";
1625 clocks = <&wkupaon_iclk_mux>;
1626 ti,bit-shift = <24>;
1627 reg = <0x0e50>;
1628 ti,dividers = <8>, <16>, <32>;
1629 };
1630
1631 mcasp2_ahclkr_mux: mcasp2_ahclkr_mux {
1632 #clock-cells = <0>;
1633 compatible = "ti,mux-clock";
1634 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1635 ti,bit-shift = <28>;
1636 reg = <0x1860>;
1637 };
1638
1639 mcasp2_ahclkx_mux: mcasp2_ahclkx_mux {
1640 #clock-cells = <0>;
1641 compatible = "ti,mux-clock";
1642 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1643 ti,bit-shift = <28>;
1644 reg = <0x1860>;
1645 };
1646
1647 mcasp2_aux_gfclk_mux: mcasp2_aux_gfclk_mux {
1648 #clock-cells = <0>;
1649 compatible = "ti,mux-clock";
1650 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
1651 ti,bit-shift = <22>;
1652 reg = <0x1860>;
1653 };
1654
1655 mcasp3_ahclkx_mux: mcasp3_ahclkx_mux {
1656 #clock-cells = <0>;
1657 compatible = "ti,mux-clock";
1658 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1659 ti,bit-shift = <24>;
1660 reg = <0x1868>;
1661 };
1662
1663 mcasp3_aux_gfclk_mux: mcasp3_aux_gfclk_mux {
1664 #clock-cells = <0>;
1665 compatible = "ti,mux-clock";
1666 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
1667 ti,bit-shift = <22>;
1668 reg = <0x1868>;
1669 };
1670
1671 mcasp4_ahclkx_mux: mcasp4_ahclkx_mux {
1672 #clock-cells = <0>;
1673 compatible = "ti,mux-clock";
1674 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1675 ti,bit-shift = <24>;
1676 reg = <0x1898>;
1677 };
1678
1679 mcasp4_aux_gfclk_mux: mcasp4_aux_gfclk_mux {
1680 #clock-cells = <0>;
1681 compatible = "ti,mux-clock";
1682 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
1683 ti,bit-shift = <22>;
1684 reg = <0x1898>;
1685 };
1686
1687 mcasp5_ahclkx_mux: mcasp5_ahclkx_mux {
1688 #clock-cells = <0>;
1689 compatible = "ti,mux-clock";
1690 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1691 ti,bit-shift = <24>;
1692 reg = <0x1878>;
1693 };
1694
1695 mcasp5_aux_gfclk_mux: mcasp5_aux_gfclk_mux {
1696 #clock-cells = <0>;
1697 compatible = "ti,mux-clock";
1698 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
1699 ti,bit-shift = <22>;
1700 reg = <0x1878>;
1701 };
1702
1703 mcasp6_ahclkx_mux: mcasp6_ahclkx_mux {
1704 #clock-cells = <0>;
1705 compatible = "ti,mux-clock";
1706 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1707 ti,bit-shift = <24>;
1708 reg = <0x1904>;
1709 };
1710
1711 mcasp6_aux_gfclk_mux: mcasp6_aux_gfclk_mux {
1712 #clock-cells = <0>;
1713 compatible = "ti,mux-clock";
1714 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
1715 ti,bit-shift = <22>;
1716 reg = <0x1904>;
1717 };
1718
1719 mcasp7_ahclkx_mux: mcasp7_ahclkx_mux {
1720 #clock-cells = <0>;
1721 compatible = "ti,mux-clock";
1722 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1723 ti,bit-shift = <24>;
1724 reg = <0x1908>;
1725 };
1726
1727 mcasp7_aux_gfclk_mux: mcasp7_aux_gfclk_mux {
1728 #clock-cells = <0>;
1729 compatible = "ti,mux-clock";
1730 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
1731 ti,bit-shift = <22>;
1732 reg = <0x1908>;
1733 };
1734
1735 mcasp8_ahclk_mux: mcasp8_ahclk_mux {
1736 #clock-cells = <0>;
1737 compatible = "ti,mux-clock";
1738 clocks = <&abe_24m_fclk>, <&abe_sys_clk_div>, <&func_24m_clk>, <&atlclkin3_ck>, <&atl_clkin2_ck>, <&atl_clkin1_ck>, <&atl_clkin0_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&mlb_clk>, <&mlbp_clk>;
1739 ti,bit-shift = <22>;
1740 reg = <0x1890>;
1741 };
1742
1743 mcasp8_aux_gfclk_mux: mcasp8_aux_gfclk_mux {
1744 #clock-cells = <0>;
1745 compatible = "ti,mux-clock";
1746 clocks = <&per_abe_x1_gfclk2_div>, <&video1_clk2_div>, <&video2_clk2_div>, <&hdmi_clk2_div>;
1747 ti,bit-shift = <24>;
1748 reg = <0x1890>;
1749 };
1750
1751 mmc1_fclk_mux: mmc1_fclk_mux {
1752 #clock-cells = <0>;
1753 compatible = "ti,mux-clock";
1754 clocks = <&func_128m_clk>, <&dpll_per_m2x2_ck>;
1755 ti,bit-shift = <24>;
1756 reg = <0x1328>;
1757 };
1758
1759 mmc1_fclk_div: mmc1_fclk_div {
1760 #clock-cells = <0>;
1761 compatible = "ti,divider-clock";
1762 clocks = <&mmc1_fclk_mux>;
1763 ti,bit-shift = <25>;
1764 ti,max-div = <4>;
1765 reg = <0x1328>;
1766 ti,index-power-of-two;
1767 };
1768
1769 mmc2_fclk_mux: mmc2_fclk_mux {
1770 #clock-cells = <0>;
1771 compatible = "ti,mux-clock";
1772 clocks = <&func_128m_clk>, <&dpll_per_m2x2_ck>;
1773 ti,bit-shift = <24>;
1774 reg = <0x1330>;
1775 };
1776
1777 mmc2_fclk_div: mmc2_fclk_div {
1778 #clock-cells = <0>;
1779 compatible = "ti,divider-clock";
1780 clocks = <&mmc2_fclk_mux>;
1781 ti,bit-shift = <25>;
1782 ti,max-div = <4>;
1783 reg = <0x1330>;
1784 ti,index-power-of-two;
1785 };
1786
1787 mmc3_gfclk_mux: mmc3_gfclk_mux {
1788 #clock-cells = <0>;
1789 compatible = "ti,mux-clock";
1790 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1791 ti,bit-shift = <24>;
1792 reg = <0x1820>;
1793 };
1794
1795 mmc3_gfclk_div: mmc3_gfclk_div {
1796 #clock-cells = <0>;
1797 compatible = "ti,divider-clock";
1798 clocks = <&mmc3_gfclk_mux>;
1799 ti,bit-shift = <25>;
1800 ti,max-div = <4>;
1801 reg = <0x1820>;
1802 ti,index-power-of-two;
1803 };
1804
1805 mmc4_gfclk_mux: mmc4_gfclk_mux {
1806 #clock-cells = <0>;
1807 compatible = "ti,mux-clock";
1808 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1809 ti,bit-shift = <24>;
1810 reg = <0x1828>;
1811 };
1812
1813 mmc4_gfclk_div: mmc4_gfclk_div {
1814 #clock-cells = <0>;
1815 compatible = "ti,divider-clock";
1816 clocks = <&mmc4_gfclk_mux>;
1817 ti,bit-shift = <25>;
1818 ti,max-div = <4>;
1819 reg = <0x1828>;
1820 ti,index-power-of-two;
1821 };
1822
1823 qspi_gfclk_mux: qspi_gfclk_mux {
1824 #clock-cells = <0>;
1825 compatible = "ti,mux-clock";
1826 clocks = <&func_128m_clk>, <&dpll_per_h13x2_ck>;
1827 ti,bit-shift = <24>;
1828 reg = <0x1838>;
1829 };
1830
1831 qspi_gfclk_div: qspi_gfclk_div {
1832 #clock-cells = <0>;
1833 compatible = "ti,divider-clock";
1834 clocks = <&qspi_gfclk_mux>;
1835 ti,bit-shift = <25>;
1836 ti,max-div = <4>;
1837 reg = <0x1838>;
1838 ti,index-power-of-two;
1839 };
1840
1841 timer10_gfclk_mux: timer10_gfclk_mux {
1842 #clock-cells = <0>;
1843 compatible = "ti,mux-clock";
1844 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1845 ti,bit-shift = <24>;
1846 reg = <0x1728>;
1847 };
1848
1849 timer11_gfclk_mux: timer11_gfclk_mux {
1850 #clock-cells = <0>;
1851 compatible = "ti,mux-clock";
1852 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1853 ti,bit-shift = <24>;
1854 reg = <0x1730>;
1855 };
1856
1857 timer13_gfclk_mux: timer13_gfclk_mux {
1858 #clock-cells = <0>;
1859 compatible = "ti,mux-clock";
1860 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1861 ti,bit-shift = <24>;
1862 reg = <0x17c8>;
1863 };
1864
1865 timer14_gfclk_mux: timer14_gfclk_mux {
1866 #clock-cells = <0>;
1867 compatible = "ti,mux-clock";
1868 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1869 ti,bit-shift = <24>;
1870 reg = <0x17d0>;
1871 };
1872
1873 timer15_gfclk_mux: timer15_gfclk_mux {
1874 #clock-cells = <0>;
1875 compatible = "ti,mux-clock";
1876 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1877 ti,bit-shift = <24>;
1878 reg = <0x17d8>;
1879 };
1880
1881 timer16_gfclk_mux: timer16_gfclk_mux {
1882 #clock-cells = <0>;
1883 compatible = "ti,mux-clock";
1884 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1885 ti,bit-shift = <24>;
1886 reg = <0x1830>;
1887 };
1888
1889 timer2_gfclk_mux: timer2_gfclk_mux {
1890 #clock-cells = <0>;
1891 compatible = "ti,mux-clock";
1892 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1893 ti,bit-shift = <24>;
1894 reg = <0x1738>;
1895 };
1896
1897 timer3_gfclk_mux: timer3_gfclk_mux {
1898 #clock-cells = <0>;
1899 compatible = "ti,mux-clock";
1900 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1901 ti,bit-shift = <24>;
1902 reg = <0x1740>;
1903 };
1904
1905 timer4_gfclk_mux: timer4_gfclk_mux {
1906 #clock-cells = <0>;
1907 compatible = "ti,mux-clock";
1908 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1909 ti,bit-shift = <24>;
1910 reg = <0x1748>;
1911 };
1912
1913 timer9_gfclk_mux: timer9_gfclk_mux {
1914 #clock-cells = <0>;
1915 compatible = "ti,mux-clock";
1916 clocks = <&timer_sys_clk_div>, <&sys_32k_ck>, <&sys_clkin2>, <&ref_clkin0_ck>, <&ref_clkin1_ck>, <&ref_clkin2_ck>, <&ref_clkin3_ck>, <&abe_giclk_div>, <&video1_div_clk>, <&video2_div_clk>, <&hdmi_div_clk>;
1917 ti,bit-shift = <24>;
1918 reg = <0x1750>;
1919 };
1920
1921 uart1_gfclk_mux: uart1_gfclk_mux {
1922 #clock-cells = <0>;
1923 compatible = "ti,mux-clock";
1924 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1925 ti,bit-shift = <24>;
1926 reg = <0x1840>;
1927 };
1928
1929 uart2_gfclk_mux: uart2_gfclk_mux {
1930 #clock-cells = <0>;
1931 compatible = "ti,mux-clock";
1932 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1933 ti,bit-shift = <24>;
1934 reg = <0x1848>;
1935 };
1936
1937 uart3_gfclk_mux: uart3_gfclk_mux {
1938 #clock-cells = <0>;
1939 compatible = "ti,mux-clock";
1940 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1941 ti,bit-shift = <24>;
1942 reg = <0x1850>;
1943 };
1944
1945 uart4_gfclk_mux: uart4_gfclk_mux {
1946 #clock-cells = <0>;
1947 compatible = "ti,mux-clock";
1948 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1949 ti,bit-shift = <24>;
1950 reg = <0x1858>;
1951 };
1952
1953 uart5_gfclk_mux: uart5_gfclk_mux {
1954 #clock-cells = <0>;
1955 compatible = "ti,mux-clock";
1956 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1957 ti,bit-shift = <24>;
1958 reg = <0x1870>;
1959 };
1960
1961 uart7_gfclk_mux: uart7_gfclk_mux {
1962 #clock-cells = <0>;
1963 compatible = "ti,mux-clock";
1964 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1965 ti,bit-shift = <24>;
1966 reg = <0x18d0>;
1967 };
1968
1969 uart8_gfclk_mux: uart8_gfclk_mux {
1970 #clock-cells = <0>;
1971 compatible = "ti,mux-clock";
1972 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1973 ti,bit-shift = <24>;
1974 reg = <0x18e0>;
1975 };
1976
1977 uart9_gfclk_mux: uart9_gfclk_mux {
1978 #clock-cells = <0>;
1979 compatible = "ti,mux-clock";
1980 clocks = <&func_48m_fclk>, <&dpll_per_m2x2_ck>;
1981 ti,bit-shift = <24>;
1982 reg = <0x18e8>;
1983 };
1984
1985 vip1_gclk_mux: vip1_gclk_mux {
1986 #clock-cells = <0>;
1987 compatible = "ti,mux-clock";
1988 clocks = <&l3_iclk_div>, <&dpll_core_h23x2_ck>;
1989 ti,bit-shift = <24>;
1990 reg = <0x1020>;
1991 };
1992
1993 vip2_gclk_mux: vip2_gclk_mux {
1994 #clock-cells = <0>;
1995 compatible = "ti,mux-clock";
1996 clocks = <&l3_iclk_div>, <&dpll_core_h23x2_ck>;
1997 ti,bit-shift = <24>;
1998 reg = <0x1028>;
1999 };
2000
2001 vip3_gclk_mux: vip3_gclk_mux {
2002 #clock-cells = <0>;
2003 compatible = "ti,mux-clock";
2004 clocks = <&l3_iclk_div>, <&dpll_core_h23x2_ck>;
2005 ti,bit-shift = <24>;
2006 reg = <0x1030>;
2007 };
2008};
2009
2010&cm_core_clockdomains {
2011 coreaon_clkdm: coreaon_clkdm {
2012 compatible = "ti,clockdomain";
2013 clocks = <&dpll_usb_ck>;
2014 };
2015};
diff --git a/arch/arm/boot/dts/efm32gg-dk3750.dts b/arch/arm/boot/dts/efm32gg-dk3750.dts
new file mode 100644
index 000000000000..aa5c0f6363d6
--- /dev/null
+++ b/arch/arm/boot/dts/efm32gg-dk3750.dts
@@ -0,0 +1,86 @@
1/*
2 * Device tree for EFM32GG-DK3750 development board.
3 *
4 * Documentation available from
5 * http://www.silabs.com/Support%20Documents/TechnicalDocs/efm32gg-dk3750-ug.pdf
6 */
7
8/dts-v1/;
9#include "efm32gg.dtsi"
10
11/ {
12 model = "Energy Micro Giant Gecko Development Kit";
13 compatible = "efm32,dk3750";
14
15 chosen {
16 bootargs = "console=ttyefm4,115200 init=/linuxrc ignore_loglevel ihash_entries=64 dhash_entries=64 earlyprintk uclinux.physaddr=0x8c400000 root=/dev/mtdblock0";
17 };
18
19 memory {
20 reg = <0x88000000 0x400000>;
21 };
22
23 soc {
24 adc@40002000 {
25 status = "ok";
26 };
27
28 i2c@4000a000 {
29 location = <3>;
30 status = "ok";
31
32 temp@48 {
33 compatible = "st,stds75";
34 reg = <0x48>;
35 };
36
37 eeprom@50 {
38 compatible = "microchip,24c02";
39 reg = <0x50>;
40 pagesize = <16>;
41 };
42 };
43
44 spi0: spi@4000c000 { /* USART0 */
45 cs-gpios = <&gpio 68 1>; // E4
46 location = <1>;
47 status = "ok";
48
49 microsd@0 {
50 compatible = "mmc-spi-slot";
51 spi-max-frequency = <100000>;
52 voltage-ranges = <3200 3400>;
53 broken-cd;
54 reg = <0>;
55 };
56 };
57
58 spi1: spi@4000c400 { /* USART1 */
59 cs-gpios = <&gpio 51 1>; // D3
60 location = <1>;
61 status = "ok";
62
63 ks8851@0 {
64 compatible = "ks8851";
65 spi-max-frequency = <6000000>;
66 reg = <0>;
67 interrupt-parent = <&boardfpga>;
68 interrupts = <4>;
69 };
70 };
71
72 uart4: uart@4000e400 { /* UART1 */
73 location = <2>;
74 status = "ok";
75 };
76
77 boardfpga: boardfpga {
78 compatible = "efm32board";
79 reg = <0x80000000 0x400>;
80 irq-gpios = <&gpio 64 1>;
81 interrupt-controller;
82 #interrupt-cells = <1>;
83 status = "ok";
84 };
85 };
86};
diff --git a/arch/arm/boot/dts/efm32gg.dtsi b/arch/arm/boot/dts/efm32gg.dtsi
new file mode 100644
index 000000000000..a342ab0e6e4f
--- /dev/null
+++ b/arch/arm/boot/dts/efm32gg.dtsi
@@ -0,0 +1,172 @@
1/*
2 * Device tree for Energy Micro EFM32 Giant Gecko SoC.
3 *
4 * Documentation available from
5 * http://www.silabs.com/Support%20Documents/TechnicalDocs/EFM32GG-RM.pdf
6 */
7#include "armv7-m.dtsi"
8#include "dt-bindings/clock/efm32-cmu.h"
9
10/ {
11 aliases {
12 i2c0 = &i2c0;
13 i2c1 = &i2c1;
14 serial0 = &uart0;
15 serial1 = &uart1;
16 serial2 = &uart2;
17 serial3 = &uart3;
18 serial4 = &uart4;
19 spi0 = &spi0;
20 spi1 = &spi1;
21 spi2 = &spi2;
22 };
23
24 soc {
25 adc: adc@40002000 {
26 compatible = "efm32,adc";
27 reg = <0x40002000 0x400>;
28 interrupts = <7>;
29 clocks = <&cmu clk_HFPERCLKADC0>;
30 status = "disabled";
31 };
32
33 gpio: gpio@40006000 {
34 compatible = "efm32,gpio";
35 reg = <0x40006000 0x1000>;
36 interrupts = <1 11>;
37 gpio-controller;
38 #gpio-cells = <2>;
39 interrupt-controller;
40 #interrupt-cells = <1>;
41 clocks = <&cmu clk_HFPERCLKGPIO>;
42 status = "ok";
43 };
44
45 i2c0: i2c@4000a000 {
46 #address-cells = <1>;
47 #size-cells = <0>;
48 compatible = "efm32,i2c";
49 reg = <0x4000a000 0x400>;
50 interrupts = <9>;
51 clocks = <&cmu clk_HFPERCLKI2C0>;
52 clock-frequency = <100000>;
53 status = "disabled";
54 };
55
56 i2c1: i2c@4000a400 {
57 #address-cells = <1>;
58 #size-cells = <0>;
59 compatible = "efm32,i2c";
60 reg = <0x4000a400 0x400>;
61 interrupts = <10>;
62 clocks = <&cmu clk_HFPERCLKI2C1>;
63 clock-frequency = <100000>;
64 status = "disabled";
65 };
66
67 spi0: spi@4000c000 { /* USART0 */
68 #address-cells = <1>;
69 #size-cells = <0>;
70 compatible = "efm32,spi";
71 reg = <0x4000c000 0x400>;
72 interrupts = <3 4>;
73 clocks = <&cmu clk_HFPERCLKUSART0>;
74 status = "disabled";
75 };
76
77 spi1: spi@4000c400 { /* USART1 */
78 #address-cells = <1>;
79 #size-cells = <0>;
80 compatible = "efm32,spi";
81 reg = <0x4000c400 0x400>;
82 interrupts = <15 16>;
83 clocks = <&cmu clk_HFPERCLKUSART1>;
84 status = "disabled";
85 };
86
87 spi2: spi@40x4000c800 { /* USART2 */
88 #address-cells = <1>;
89 #size-cells = <0>;
90 compatible = "efm32,spi";
91 reg = <0x4000c800 0x400>;
92 interrupts = <18 19>;
93 clocks = <&cmu clk_HFPERCLKUSART2>;
94 status = "disabled";
95 };
96
97 uart0: uart@4000c000 { /* USART0 */
98 compatible = "efm32,uart";
99 reg = <0x4000c000 0x400>;
100 interrupts = <3 4>;
101 clocks = <&cmu clk_HFPERCLKUSART0>;
102 status = "disabled";
103 };
104
105 uart1: uart@4000c400 { /* USART1 */
106 compatible = "efm32,uart";
107 reg = <0x4000c400 0x400>;
108 interrupts = <15 16>;
109 clocks = <&cmu clk_HFPERCLKUSART1>;
110 status = "disabled";
111 };
112
113 uart2: uart@40x4000c800 { /* USART2 */
114 compatible = "efm32,uart";
115 reg = <0x4000c800 0x400>;
116 interrupts = <18 19>;
117 clocks = <&cmu clk_HFPERCLKUSART2>;
118 status = "disabled";
119 };
120
121 uart3: uart@4000e000 { /* UART0 */
122 compatible = "efm32,uart";
123 reg = <0x4000e000 0x400>;
124 interrupts = <20 21>;
125 clocks = <&cmu clk_HFPERCLKUART0>;
126 status = "disabled";
127 };
128
129 uart4: uart@4000e400 { /* UART1 */
130 compatible = "efm32,uart";
131 reg = <0x4000e400 0x400>;
132 interrupts = <22 23>;
133 clocks = <&cmu clk_HFPERCLKUART1>;
134 status = "disabled";
135 };
136
137 timer0: timer@40010000 {
138 compatible = "efm32,timer";
139 reg = <0x40010000 0x400>;
140 interrupts = <2>;
141 clocks = <&cmu clk_HFPERCLKTIMER0>;
142 };
143
144 timer1: timer@40010400 {
145 compatible = "efm32,timer";
146 reg = <0x40010400 0x400>;
147 interrupts = <12>;
148 clocks = <&cmu clk_HFPERCLKTIMER1>;
149 };
150
151 timer2: timer@40010800 {
152 compatible = "efm32,timer";
153 reg = <0x40010800 0x400>;
154 interrupts = <13>;
155 clocks = <&cmu clk_HFPERCLKTIMER2>;
156 };
157
158 timer3: timer@40010c00 {
159 compatible = "efm32,timer";
160 reg = <0x40010c00 0x400>;
161 interrupts = <14>;
162 clocks = <&cmu clk_HFPERCLKTIMER3>;
163 };
164
165 cmu: cmu@400c8000 {
166 compatible = "efm32gg,cmu";
167 reg = <0x400c8000 0x400>;
168 interrupts = <32>;
169 #clock-cells = <1>;
170 };
171 };
172};
diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
index 861aa7d6fc7d..50ccd151091e 100644
--- a/arch/arm/boot/dts/emev2-kzm9d.dts
+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
@@ -9,7 +9,10 @@
9 */ 9 */
10/dts-v1/; 10/dts-v1/;
11 11
12/include/ "emev2.dtsi" 12#include "emev2.dtsi"
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/interrupt-controller/irq.h>
13 16
14/ { 17/ {
15 model = "EMEV2 KZM9D Board"; 18 model = "EMEV2 KZM9D Board";
@@ -47,11 +50,46 @@
47 reg = <0x20000000 0x10000>; 50 reg = <0x20000000 0x10000>;
48 phy-mode = "mii"; 51 phy-mode = "mii";
49 interrupt-parent = <&gpio0>; 52 interrupt-parent = <&gpio0>;
50 interrupts = <1 1>; /* active high */ 53 interrupts = <1 IRQ_TYPE_EDGE_RISING>;
51 reg-io-width = <4>; 54 reg-io-width = <4>;
52 smsc,irq-active-high; 55 smsc,irq-active-high;
53 smsc,irq-push-pull; 56 smsc,irq-push-pull;
54 vddvario-supply = <&reg_1p8v>; 57 vddvario-supply = <&reg_1p8v>;
55 vdd33a-supply = <&reg_3p3v>; 58 vdd33a-supply = <&reg_3p3v>;
56 }; 59 };
60
61 gpio_keys {
62 compatible = "gpio-keys";
63 #address-cells = <1>;
64 #size-cells = <0>;
65
66 button@1 {
67 debounce_interval = <50>;
68 wakeup = <1>;
69 label = "DSW2-1";
70 linux,code = <KEY_1>;
71 gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
72 };
73 button@2 {
74 debounce_interval = <50>;
75 wakeup = <1>;
76 label = "DSW2-2";
77 linux,code = <KEY_2>;
78 gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
79 };
80 button@3 {
81 debounce_interval = <50>;
82 wakeup = <1>;
83 label = "DSW2-3";
84 linux,code = <KEY_3>;
85 gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
86 };
87 button@4 {
88 debounce_interval = <50>;
89 wakeup = <1>;
90 label = "DSW2-4";
91 linux,code = <KEY_4>;
92 gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
93 };
94 };
57}; 95};
diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
index 9063a4434d6a..e37985fa10e2 100644
--- a/arch/arm/boot/dts/emev2.dtsi
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -8,7 +8,8 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "skeleton.dtsi" 11#include "skeleton.dtsi"
12#include <dt-bindings/interrupt-controller/irq.h>
12 13
13/ { 14/ {
14 compatible = "renesas,emev2"; 15 compatible = "renesas,emev2";
@@ -48,44 +49,129 @@
48 49
49 pmu { 50 pmu {
50 compatible = "arm,cortex-a9-pmu"; 51 compatible = "arm,cortex-a9-pmu";
51 interrupts = <0 120 4>, 52 interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
52 <0 121 4>; 53 <0 121 IRQ_TYPE_LEVEL_HIGH>;
54 };
55
56 smu@e0110000 {
57 compatible = "renesas,emev2-smu";
58 reg = <0xe0110000 0x10000>;
59 #address-cells = <2>;
60 #size-cells = <0>;
61
62 c32ki: c32ki {
63 compatible = "fixed-clock";
64 clock-frequency = <32768>;
65 #clock-cells = <0>;
66 };
67 pll3_fo: pll3_fo {
68 compatible = "fixed-factor-clock";
69 clocks = <&c32ki>;
70 clock-div = <1>;
71 clock-mult = <7000>;
72 #clock-cells = <0>;
73 };
74 usia_u0_sclkdiv: usia_u0_sclkdiv {
75 compatible = "renesas,emev2-smu-clkdiv";
76 reg = <0x610 0>;
77 clocks = <&pll3_fo>;
78 #clock-cells = <0>;
79 };
80 usib_u1_sclkdiv: usib_u1_sclkdiv {
81 compatible = "renesas,emev2-smu-clkdiv";
82 reg = <0x65c 0>;
83 clocks = <&pll3_fo>;
84 #clock-cells = <0>;
85 };
86 usib_u2_sclkdiv: usib_u2_sclkdiv {
87 compatible = "renesas,emev2-smu-clkdiv";
88 reg = <0x65c 16>;
89 clocks = <&pll3_fo>;
90 #clock-cells = <0>;
91 };
92 usib_u3_sclkdiv: usib_u3_sclkdiv {
93 compatible = "renesas,emev2-smu-clkdiv";
94 reg = <0x660 0>;
95 clocks = <&pll3_fo>;
96 #clock-cells = <0>;
97 };
98 usia_u0_sclk: usia_u0_sclk {
99 compatible = "renesas,emev2-smu-gclk";
100 reg = <0x4a0 1>;
101 clocks = <&usia_u0_sclkdiv>;
102 #clock-cells = <0>;
103 };
104 usib_u1_sclk: usib_u1_sclk {
105 compatible = "renesas,emev2-smu-gclk";
106 reg = <0x4b8 1>;
107 clocks = <&usib_u1_sclkdiv>;
108 #clock-cells = <0>;
109 };
110 usib_u2_sclk: usib_u2_sclk {
111 compatible = "renesas,emev2-smu-gclk";
112 reg = <0x4bc 1>;
113 clocks = <&usib_u2_sclkdiv>;
114 #clock-cells = <0>;
115 };
116 usib_u3_sclk: usib_u3_sclk {
117 compatible = "renesas,emev2-smu-gclk";
118 reg = <0x4c0 1>;
119 clocks = <&usib_u3_sclkdiv>;
120 #clock-cells = <0>;
121 };
122 sti_sclk: sti_sclk {
123 compatible = "renesas,emev2-smu-gclk";
124 reg = <0x528 1>;
125 clocks = <&c32ki>;
126 #clock-cells = <0>;
127 };
53 }; 128 };
54 129
55 sti@e0180000 { 130 sti@e0180000 {
56 compatible = "renesas,em-sti"; 131 compatible = "renesas,em-sti";
57 reg = <0xe0180000 0x54>; 132 reg = <0xe0180000 0x54>;
58 interrupts = <0 125 0>; 133 interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>;
134 clocks = <&sti_sclk>;
135 clock-names = "sclk";
59 }; 136 };
60 137
61 uart@e1020000 { 138 uart@e1020000 {
62 compatible = "renesas,em-uart"; 139 compatible = "renesas,em-uart";
63 reg = <0xe1020000 0x38>; 140 reg = <0xe1020000 0x38>;
64 interrupts = <0 8 0>; 141 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
142 clocks = <&usia_u0_sclk>;
143 clock-names = "sclk";
65 }; 144 };
66 145
67 uart@e1030000 { 146 uart@e1030000 {
68 compatible = "renesas,em-uart"; 147 compatible = "renesas,em-uart";
69 reg = <0xe1030000 0x38>; 148 reg = <0xe1030000 0x38>;
70 interrupts = <0 9 0>; 149 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
150 clocks = <&usib_u1_sclk>;
151 clock-names = "sclk";
71 }; 152 };
72 153
73 uart@e1040000 { 154 uart@e1040000 {
74 compatible = "renesas,em-uart"; 155 compatible = "renesas,em-uart";
75 reg = <0xe1040000 0x38>; 156 reg = <0xe1040000 0x38>;
76 interrupts = <0 10 0>; 157 interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
158 clocks = <&usib_u2_sclk>;
159 clock-names = "sclk";
77 }; 160 };
78 161
79 uart@e1050000 { 162 uart@e1050000 {
80 compatible = "renesas,em-uart"; 163 compatible = "renesas,em-uart";
81 reg = <0xe1050000 0x38>; 164 reg = <0xe1050000 0x38>;
82 interrupts = <0 11 0>; 165 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
166 clocks = <&usib_u3_sclk>;
167 clock-names = "sclk";
83 }; 168 };
84 169
85 gpio0: gpio@e0050000 { 170 gpio0: gpio@e0050000 {
86 compatible = "renesas,em-gio"; 171 compatible = "renesas,em-gio";
87 reg = <0xe0050000 0x2c>, <0xe0050040 0x20>; 172 reg = <0xe0050000 0x2c>, <0xe0050040 0x20>;
88 interrupts = <0 67 0>, <0 68 0>; 173 interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>,
174 <0 68 IRQ_TYPE_LEVEL_HIGH>;
89 gpio-controller; 175 gpio-controller;
90 #gpio-cells = <2>; 176 #gpio-cells = <2>;
91 ngpios = <32>; 177 ngpios = <32>;
@@ -95,7 +181,8 @@
95 gpio1: gpio@e0050080 { 181 gpio1: gpio@e0050080 {
96 compatible = "renesas,em-gio"; 182 compatible = "renesas,em-gio";
97 reg = <0xe0050080 0x2c>, <0xe00500c0 0x20>; 183 reg = <0xe0050080 0x2c>, <0xe00500c0 0x20>;
98 interrupts = <0 69 0>, <0 70 0>; 184 interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>,
185 <0 70 IRQ_TYPE_LEVEL_HIGH>;
99 gpio-controller; 186 gpio-controller;
100 #gpio-cells = <2>; 187 #gpio-cells = <2>;
101 ngpios = <32>; 188 ngpios = <32>;
@@ -105,7 +192,8 @@
105 gpio2: gpio@e0050100 { 192 gpio2: gpio@e0050100 {
106 compatible = "renesas,em-gio"; 193 compatible = "renesas,em-gio";
107 reg = <0xe0050100 0x2c>, <0xe0050140 0x20>; 194 reg = <0xe0050100 0x2c>, <0xe0050140 0x20>;
108 interrupts = <0 71 0>, <0 72 0>; 195 interrupts = <0 71 IRQ_TYPE_LEVEL_HIGH>,
196 <0 72 IRQ_TYPE_LEVEL_HIGH>;
109 gpio-controller; 197 gpio-controller;
110 #gpio-cells = <2>; 198 #gpio-cells = <2>;
111 ngpios = <32>; 199 ngpios = <32>;
@@ -115,7 +203,8 @@
115 gpio3: gpio@e0050180 { 203 gpio3: gpio@e0050180 {
116 compatible = "renesas,em-gio"; 204 compatible = "renesas,em-gio";
117 reg = <0xe0050180 0x2c>, <0xe00501c0 0x20>; 205 reg = <0xe0050180 0x2c>, <0xe00501c0 0x20>;
118 interrupts = <0 73 0>, <0 74 0>; 206 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>,
207 <0 74 IRQ_TYPE_LEVEL_HIGH>;
119 gpio-controller; 208 gpio-controller;
120 #gpio-cells = <2>; 209 #gpio-cells = <2>;
121 ngpios = <32>; 210 ngpios = <32>;
@@ -125,7 +214,8 @@
125 gpio4: gpio@e0050200 { 214 gpio4: gpio@e0050200 {
126 compatible = "renesas,em-gio"; 215 compatible = "renesas,em-gio";
127 reg = <0xe0050200 0x2c>, <0xe0050240 0x20>; 216 reg = <0xe0050200 0x2c>, <0xe0050240 0x20>;
128 interrupts = <0 75 0>, <0 76 0>; 217 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>,
218 <0 76 IRQ_TYPE_LEVEL_HIGH>;
129 gpio-controller; 219 gpio-controller;
130 #gpio-cells = <2>; 220 #gpio-cells = <2>;
131 ngpios = <31>; 221 ngpios = <31>;
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index a73eeb5f258f..08452e183b57 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -85,21 +85,21 @@
85 reg = <0x10023CE0 0x20>; 85 reg = <0x10023CE0 0x20>;
86 }; 86 };
87 87
88 gic:interrupt-controller@10490000 { 88 gic: interrupt-controller@10490000 {
89 compatible = "arm,cortex-a9-gic"; 89 compatible = "arm,cortex-a9-gic";
90 #interrupt-cells = <3>; 90 #interrupt-cells = <3>;
91 interrupt-controller; 91 interrupt-controller;
92 reg = <0x10490000 0x1000>, <0x10480000 0x100>; 92 reg = <0x10490000 0x1000>, <0x10480000 0x100>;
93 }; 93 };
94 94
95 combiner:interrupt-controller@10440000 { 95 combiner: interrupt-controller@10440000 {
96 compatible = "samsung,exynos4210-combiner"; 96 compatible = "samsung,exynos4210-combiner";
97 #interrupt-cells = <2>; 97 #interrupt-cells = <2>;
98 interrupt-controller; 98 interrupt-controller;
99 reg = <0x10440000 0x1000>; 99 reg = <0x10440000 0x1000>;
100 }; 100 };
101 101
102 sys_reg: sysreg { 102 sys_reg: syscon@10010000 {
103 compatible = "samsung,exynos4-sysreg", "syscon"; 103 compatible = "samsung,exynos4-sysreg", "syscon";
104 reg = <0x10010000 0x400>; 104 reg = <0x10010000 0x400>;
105 }; 105 };
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts
index 1a12fb23767c..2aa13cb3bbed 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -313,7 +313,7 @@
313 display-timings { 313 display-timings {
314 native-mode = <&timing0>; 314 native-mode = <&timing0>;
315 timing0: timing { 315 timing0: timing {
316 clock-frequency = <50000>; 316 clock-frequency = <47500000>;
317 hactive = <1024>; 317 hactive = <1024>;
318 vactive = <600>; 318 vactive = <600>;
319 hfront-porch = <64>; 319 hfront-porch = <64>;
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 057d6829d319..48ecd7a755ab 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -36,11 +36,11 @@
36 reg = <0x10023CA0 0x20>; 36 reg = <0x10023CA0 0x20>;
37 }; 37 };
38 38
39 gic:interrupt-controller@10490000 { 39 gic: interrupt-controller@10490000 {
40 cpu-offset = <0x8000>; 40 cpu-offset = <0x8000>;
41 }; 41 };
42 42
43 combiner:interrupt-controller@10440000 { 43 combiner: interrupt-controller@10440000 {
44 samsung,combiner-nr = <16>; 44 samsung,combiner-nr = <16>;
45 interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>, 45 interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
46 <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>, 46 <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
@@ -51,24 +51,21 @@
51 mct@10050000 { 51 mct@10050000 {
52 compatible = "samsung,exynos4210-mct"; 52 compatible = "samsung,exynos4210-mct";
53 reg = <0x10050000 0x800>; 53 reg = <0x10050000 0x800>;
54 interrupt-controller;
55 #interrups-cells = <2>;
56 interrupt-parent = <&mct_map>; 54 interrupt-parent = <&mct_map>;
57 interrupts = <0 0>, <1 0>, <2 0>, <3 0>, 55 interrupts = <0>, <1>, <2>, <3>, <4>, <5>;
58 <4 0>, <5 0>;
59 clocks = <&clock 3>, <&clock 344>; 56 clocks = <&clock 3>, <&clock 344>;
60 clock-names = "fin_pll", "mct"; 57 clock-names = "fin_pll", "mct";
61 58
62 mct_map: mct-map { 59 mct_map: mct-map {
63 #interrupt-cells = <2>; 60 #interrupt-cells = <1>;
64 #address-cells = <0>; 61 #address-cells = <0>;
65 #size-cells = <0>; 62 #size-cells = <0>;
66 interrupt-map = <0x0 0 &gic 0 57 0>, 63 interrupt-map = <0 &gic 0 57 0>,
67 <0x1 0 &gic 0 69 0>, 64 <1 &gic 0 69 0>,
68 <0x2 0 &combiner 12 6>, 65 <2 &combiner 12 6>,
69 <0x3 0 &combiner 12 7>, 66 <3 &combiner 12 7>,
70 <0x4 0 &gic 0 42 0>, 67 <4 &gic 0 42 0>,
71 <0x5 0 &gic 0 48 0>; 68 <5 &gic 0 48 0>;
72 }; 69 };
73 }; 70 };
74 71
diff --git a/arch/arm/boot/dts/exynos4212.dtsi b/arch/arm/boot/dts/exynos4212.dtsi
index 6f34d7f6ba7e..94a43f9a05e2 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -22,7 +22,7 @@
22/ { 22/ {
23 compatible = "samsung,exynos4212"; 23 compatible = "samsung,exynos4212";
24 24
25 gic:interrupt-controller@10490000 { 25 gic: interrupt-controller@10490000 {
26 cpu-offset = <0x8000>; 26 cpu-offset = <0x8000>;
27 }; 27 };
28 28
@@ -34,26 +34,4 @@
34 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>, 34 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
35 <0 107 0>, <0 108 0>; 35 <0 107 0>, <0 108 0>;
36 }; 36 };
37
38 mct@10050000 {
39 compatible = "samsung,exynos4412-mct";
40 reg = <0x10050000 0x800>;
41 interrupt-controller;
42 #interrups-cells = <2>;
43 interrupt-parent = <&mct_map>;
44 interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
45 <4 0>, <5 0>;
46
47 mct_map: mct-map {
48 #interrupt-cells = <2>;
49 #address-cells = <0>;
50 #size-cells = <0>;
51 interrupt-map = <0x0 0 &gic 0 57 0>,
52 <0x1 0 &combiner 12 5>,
53 <0x2 0 &combiner 12 6>,
54 <0x3 0 &combiner 12 7>,
55 <0x4 0 &gic 1 12 0>,
56 <0x5 0 &gic 1 12 0>;
57 };
58 };
59}; 37};
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts
index 46c678ee119c..9804fcb71f8c 100644
--- a/arch/arm/boot/dts/exynos4412-odroidx.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -38,9 +38,7 @@
38 }; 38 };
39 }; 39 };
40 40
41 mshc@12550000 { 41 mmc@12550000 {
42 #address-cells = <1>;
43 #size-cells = <0>;
44 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; 42 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
45 pinctrl-names = "default"; 43 pinctrl-names = "default";
46 vmmc-supply = <&ldo20_reg &buck8_reg>; 44 vmmc-supply = <&ldo20_reg &buck8_reg>;
@@ -49,7 +47,6 @@
49 num-slots = <1>; 47 num-slots = <1>;
50 supports-highspeed; 48 supports-highspeed;
51 broken-cd; 49 broken-cd;
52 fifo-depth = <0x80>;
53 card-detect-delay = <200>; 50 card-detect-delay = <200>;
54 samsung,dw-mshc-ciu-div = <3>; 51 samsung,dw-mshc-ciu-div = <3>;
55 samsung,dw-mshc-sdr-timing = <2 3>; 52 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -119,6 +116,7 @@
119 max77686: pmic@09 { 116 max77686: pmic@09 {
120 compatible = "maxim,max77686"; 117 compatible = "maxim,max77686";
121 reg = <0x09>; 118 reg = <0x09>;
119 #clock-cells = <1>;
122 120
123 voltage-regulators { 121 voltage-regulators {
124 ldo1_reg: LDO1 { 122 ldo1_reg: LDO1 {
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index d65984c440f6..6bc053924e9e 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -122,9 +122,7 @@
122 status = "okay"; 122 status = "okay";
123 }; 123 };
124 124
125 mshc@12550000 { 125 mmc@12550000 {
126 #address-cells = <1>;
127 #size-cells = <0>;
128 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; 126 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
129 pinctrl-names = "default"; 127 pinctrl-names = "default";
130 status = "okay"; 128 status = "okay";
@@ -132,7 +130,6 @@
132 num-slots = <1>; 130 num-slots = <1>;
133 supports-highspeed; 131 supports-highspeed;
134 broken-cd; 132 broken-cd;
135 fifo-depth = <0x80>;
136 card-detect-delay = <200>; 133 card-detect-delay = <200>;
137 samsung,dw-mshc-ciu-div = <3>; 134 samsung,dw-mshc-ciu-div = <3>;
138 samsung,dw-mshc-sdr-timing = <2 3>; 135 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -159,7 +156,7 @@
159 display-timings { 156 display-timings {
160 native-mode = <&timing0>; 157 native-mode = <&timing0>;
161 timing0: timing { 158 timing0: timing {
162 clock-frequency = <50000>; 159 clock-frequency = <47500000>;
163 hactive = <1024>; 160 hactive = <1024>;
164 vactive = <600>; 161 vactive = <600>;
165 hfront-porch = <64>; 162 hfront-porch = <64>;
diff --git a/arch/arm/boot/dts/exynos4412-tiny4412.dts b/arch/arm/boot/dts/exynos4412-tiny4412.dts
new file mode 100644
index 000000000000..0a9831256b33
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-tiny4412.dts
@@ -0,0 +1,93 @@
1/*
2 * FriendlyARM's Exynos4412 based TINY4412 board device tree source
3 *
4 * Copyright (c) 2013 Alex Ling <kasimling@gmail.com>
5 *
6 * Device tree source file for FriendlyARM's TINY4412 board which is based on
7 * Samsung's Exynos4412 SoC.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14/dts-v1/;
15#include "exynos4412.dtsi"
16
17/ {
18 model = "FriendlyARM TINY4412 board based on Exynos4412";
19 compatible = "friendlyarm,tiny4412", "samsung,exynos4412";
20
21 memory {
22 reg = <0x40000000 0x40000000>;
23 };
24
25 leds {
26 compatible = "gpio-leds";
27
28 led1 {
29 label = "led1";
30 gpios = <&gpm4 0 1>;
31 default-state = "off";
32 linux,default-trigger = "heartbeat";
33 };
34
35 led2 {
36 label = "led2";
37 gpios = <&gpm4 1 1>;
38 default-state = "off";
39 };
40
41 led3 {
42 label = "led3";
43 gpios = <&gpm4 2 1>;
44 default-state = "off";
45 };
46
47 led4 {
48 label = "led4";
49 gpios = <&gpm4 3 1>;
50 default-state = "off";
51 linux,default-trigger = "mmc0";
52 };
53 };
54
55 rtc@10070000 {
56 status = "okay";
57 };
58
59 sdhci@12530000 {
60 bus-width = <4>;
61 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
62 pinctrl-names = "default";
63 status = "okay";
64 };
65
66 serial@13800000 {
67 status = "okay";
68 };
69
70 serial@13810000 {
71 status = "okay";
72 };
73
74 serial@13820000 {
75 status = "okay";
76 };
77
78 serial@13830000 {
79 status = "okay";
80 };
81
82 fixed-rate-clocks {
83 xxti {
84 compatible = "samsung,clock-xxti";
85 clock-frequency = <0>;
86 };
87
88 xusbxti {
89 compatible = "samsung,clock-xusbxti";
90 clock-frequency = <24000000>;
91 };
92 };
93};
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index fb7b9ae5f399..4f851ccf40eb 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -139,6 +139,7 @@
139 interrupt-parent = <&gpx0>; 139 interrupt-parent = <&gpx0>;
140 interrupts = <7 0>; 140 interrupts = <7 0>;
141 reg = <0x09>; 141 reg = <0x09>;
142 #clock-cells = <1>;
142 143
143 voltage-regulators { 144 voltage-regulators {
144 ldo1_reg: ldo1 { 145 ldo1_reg: ldo1 {
@@ -442,13 +443,25 @@
442 }; 443 };
443 }; 444 };
444 445
445 sdhci@12510000 { 446 mmc@12550000 {
446 bus-width = <8>; 447 num-slots = <1>;
448 supports-highspeed;
449 broken-cd;
447 non-removable; 450 non-removable;
448 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus8>; 451 card-detect-delay = <200>;
449 pinctrl-names = "default";
450 vmmc-supply = <&vemmc_reg>; 452 vmmc-supply = <&vemmc_reg>;
453 clock-frequency = <400000000>;
454 samsung,dw-mshc-ciu-div = <0>;
455 samsung,dw-mshc-sdr-timing = <2 3>;
456 samsung,dw-mshc-ddr-timing = <1 2>;
457 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
458 pinctrl-names = "default";
451 status = "okay"; 459 status = "okay";
460
461 slot@0 {
462 reg = <0>;
463 bus-width = <8>;
464 };
452 }; 465 };
453 466
454 serial@13800000 { 467 serial@13800000 {
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index e743e677a9e2..87b339c739de 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -22,7 +22,7 @@
22/ { 22/ {
23 compatible = "samsung,exynos4412"; 23 compatible = "samsung,exynos4412";
24 24
25 gic:interrupt-controller@10490000 { 25 gic: interrupt-controller@10490000 {
26 cpu-offset = <0x4000>; 26 cpu-offset = <0x4000>;
27 }; 27 };
28 28
@@ -35,37 +35,4 @@
35 <0 107 0>, <0 108 0>, <0 48 0>, <0 42 0>; 35 <0 107 0>, <0 108 0>, <0 48 0>, <0 42 0>;
36 }; 36 };
37 37
38 mct@10050000 {
39 compatible = "samsung,exynos4412-mct";
40 reg = <0x10050000 0x800>;
41 interrupt-controller;
42 #interrups-cells = <2>;
43 interrupt-parent = <&mct_map>;
44 interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
45 <4 0>, <5 0>, <6 0>, <7 0>;
46 clocks = <&clock 3>, <&clock 344>;
47 clock-names = "fin_pll", "mct";
48
49 mct_map: mct-map {
50 #interrupt-cells = <2>;
51 #address-cells = <0>;
52 #size-cells = <0>;
53 interrupt-map = <0x0 0 &gic 0 57 0>,
54 <0x1 0 &combiner 12 5>,
55 <0x2 0 &combiner 12 6>,
56 <0x3 0 &combiner 12 7>,
57 <0x4 0 &gic 1 12 0>,
58 <0x5 0 &gic 1 12 0>,
59 <0x6 0 &gic 1 12 0>,
60 <0x7 0 &gic 1 12 0>;
61 };
62 };
63
64 mshc@12550000 {
65 compatible = "samsung,exynos4412-dw-mshc";
66 reg = <0x12550000 0x1000>;
67 interrupts = <0 77 0>;
68 #address-cells = <1>;
69 #size-cells = <0>;
70 };
71}; 38};
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index ad531fe6ab95..5c412aa14738 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -28,6 +28,7 @@
28 pinctrl3 = &pinctrl_3; 28 pinctrl3 = &pinctrl_3;
29 fimc-lite0 = &fimc_lite_0; 29 fimc-lite0 = &fimc_lite_0;
30 fimc-lite1 = &fimc_lite_1; 30 fimc-lite1 = &fimc_lite_1;
31 mshc0 = &mshc_0;
31 }; 32 };
32 33
33 pd_isp: isp-power-domain@10023CA0 { 34 pd_isp: isp-power-domain@10023CA0 {
@@ -41,6 +42,26 @@
41 #clock-cells = <1>; 42 #clock-cells = <1>;
42 }; 43 };
43 44
45 mct@10050000 {
46 compatible = "samsung,exynos4412-mct";
47 reg = <0x10050000 0x800>;
48 interrupt-parent = <&mct_map>;
49 interrupts = <0>, <1>, <2>, <3>, <4>;
50 clocks = <&clock 3>, <&clock 344>;
51 clock-names = "fin_pll", "mct";
52
53 mct_map: mct-map {
54 #interrupt-cells = <1>;
55 #address-cells = <0>;
56 #size-cells = <0>;
57 interrupt-map = <0 &gic 0 57 0>,
58 <1 &combiner 12 5>,
59 <2 &combiner 12 6>,
60 <3 &combiner 12 7>,
61 <4 &gic 1 12 0>;
62 };
63 };
64
44 pinctrl_0: pinctrl@11400000 { 65 pinctrl_0: pinctrl@11400000 {
45 compatible = "samsung,exynos4x12-pinctrl"; 66 compatible = "samsung,exynos4x12-pinctrl";
46 reg = <0x11400000 0x1000>; 67 reg = <0x11400000 0x1000>;
@@ -176,4 +197,16 @@
176 }; 197 };
177 }; 198 };
178 }; 199 };
200
201 mshc_0: mmc@12550000 {
202 compatible = "samsung,exynos4412-dw-mshc";
203 reg = <0x12550000 0x1000>;
204 interrupts = <0 77 0>;
205 #address-cells = <1>;
206 #size-cells = <0>;
207 fifo-depth = <0x80>;
208 clocks = <&clock 301>, <&clock 149>;
209 clock-names = "biu", "ciu";
210 status = "disabled";
211 };
179}; 212};
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index 074739d39e2d..258dca441f36 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -23,7 +23,7 @@
23 reg = <0x10000000 0x100>; 23 reg = <0x10000000 0x100>;
24 }; 24 };
25 25
26 combiner:interrupt-controller@10440000 { 26 combiner: interrupt-controller@10440000 {
27 compatible = "samsung,exynos4210-combiner"; 27 compatible = "samsung,exynos4210-combiner";
28 #interrupt-cells = <2>; 28 #interrupt-cells = <2>;
29 interrupt-controller; 29 interrupt-controller;
@@ -39,7 +39,7 @@
39 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; 39 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
40 }; 40 };
41 41
42 gic:interrupt-controller@10481000 { 42 gic: interrupt-controller@10481000 {
43 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; 43 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
44 #interrupt-cells = <3>; 44 #interrupt-cells = <3>;
45 interrupt-controller; 45 interrupt-controller;
@@ -50,27 +50,6 @@
50 interrupts = <1 9 0xf04>; 50 interrupts = <1 9 0xf04>;
51 }; 51 };
52 52
53 dwmmc_0: dwmmc0@12200000 {
54 compatible = "samsung,exynos5250-dw-mshc";
55 interrupts = <0 75 0>;
56 #address-cells = <1>;
57 #size-cells = <0>;
58 };
59
60 dwmmc_1: dwmmc1@12210000 {
61 compatible = "samsung,exynos5250-dw-mshc";
62 interrupts = <0 76 0>;
63 #address-cells = <1>;
64 #size-cells = <0>;
65 };
66
67 dwmmc_2: dwmmc2@12220000 {
68 compatible = "samsung,exynos5250-dw-mshc";
69 interrupts = <0 77 0>;
70 #address-cells = <1>;
71 #size-cells = <0>;
72 };
73
74 serial@12C00000 { 53 serial@12C00000 {
75 compatible = "samsung,exynos4210-uart"; 54 compatible = "samsung,exynos4210-uart";
76 reg = <0x12C00000 0x100>; 55 reg = <0x12C00000 0x100>;
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index 684527087aa4..b42e658876e5 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -34,6 +34,7 @@
34 samsung,i2c-sda-delay = <100>; 34 samsung,i2c-sda-delay = <100>;
35 samsung,i2c-max-bus-freq = <20000>; 35 samsung,i2c-max-bus-freq = <20000>;
36 samsung,i2c-slave-addr = <0x66>; 36 samsung,i2c-slave-addr = <0x66>;
37 status = "okay";
37 38
38 s5m8767_pmic@66 { 39 s5m8767_pmic@66 {
39 compatible = "samsung,s5m8767-pmic"; 40 compatible = "samsung,s5m8767-pmic";
@@ -266,7 +267,7 @@
266 267
267 buck2_reg: BUCK2 { 268 buck2_reg: BUCK2 {
268 regulator-name = "vdd_arm"; 269 regulator-name = "vdd_arm";
269 regulator-min-microvolt = <925000>; 270 regulator-min-microvolt = <912500>;
270 regulator-max-microvolt = <1300000>; 271 regulator-max-microvolt = <1300000>;
271 regulator-always-on; 272 regulator-always-on;
272 regulator-boot-on; 273 regulator-boot-on;
@@ -302,11 +303,13 @@
302 buck7_reg: BUCK7 { 303 buck7_reg: BUCK7 {
303 regulator-name = "PVDD_BUCK7"; 304 regulator-name = "PVDD_BUCK7";
304 regulator-always-on; 305 regulator-always-on;
306 op_mode = <1>;
305 }; 307 };
306 308
307 buck8_reg: BUCK8 { 309 buck8_reg: BUCK8 {
308 regulator-name = "PVDD_BUCK8"; 310 regulator-name = "PVDD_BUCK8";
309 regulator-always-on; 311 regulator-always-on;
312 op_mode = <1>;
310 }; 313 };
311 314
312 buck9_reg: BUCK9 { 315 buck9_reg: BUCK9 {
@@ -319,11 +322,9 @@
319 }; 322 };
320 }; 323 };
321 324
322 i2c@12C70000 {
323 status = "disabled";
324 };
325
326 i2c@12C80000 { 325 i2c@12C80000 {
326 status = "okay";
327
327 samsung,i2c-sda-delay = <100>; 328 samsung,i2c-sda-delay = <100>;
328 samsung,i2c-max-bus-freq = <66000>; 329 samsung,i2c-max-bus-freq = <66000>;
329 samsung,i2c-slave-addr = <0x50>; 330 samsung,i2c-slave-addr = <0x50>;
@@ -335,7 +336,10 @@
335 }; 336 };
336 337
337 i2c@12C90000 { 338 i2c@12C90000 {
339 status = "okay";
340
338 wm1811a@1a { 341 wm1811a@1a {
342
339 compatible = "wlf,wm1811"; 343 compatible = "wlf,wm1811";
340 reg = <0x1a>; 344 reg = <0x1a>;
341 345
@@ -353,23 +357,9 @@
353 }; 357 };
354 }; 358 };
355 359
356 i2c@12CA0000 {
357 status = "disabled";
358 };
359
360 i2c@12CB0000 {
361 status = "disabled";
362 };
363
364 i2c@12CC0000 {
365 status = "disabled";
366 };
367
368 i2c@12CD0000 {
369 status = "disabled";
370 };
371
372 i2c@12CE0000 { 360 i2c@12CE0000 {
361 status = "okay";
362
373 samsung,i2c-sda-delay = <100>; 363 samsung,i2c-sda-delay = <100>;
374 samsung,i2c-max-bus-freq = <66000>; 364 samsung,i2c-max-bus-freq = <66000>;
375 samsung,i2c-slave-addr = <0x38>; 365 samsung,i2c-slave-addr = <0x38>;
@@ -380,15 +370,11 @@
380 }; 370 };
381 }; 371 };
382 372
383 i2c@121D0000 { 373 mmc_0: mmc@12200000 {
384 status = "disabled"; 374 status = "okay";
385 };
386
387 dwmmc_0: dwmmc0@12200000 {
388 num-slots = <1>; 375 num-slots = <1>;
389 supports-highspeed; 376 supports-highspeed;
390 broken-cd; 377 broken-cd;
391 fifo-depth = <0x80>;
392 card-detect-delay = <200>; 378 card-detect-delay = <200>;
393 samsung,dw-mshc-ciu-div = <3>; 379 samsung,dw-mshc-ciu-div = <3>;
394 samsung,dw-mshc-sdr-timing = <2 3>; 380 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -403,14 +389,10 @@
403 }; 389 };
404 }; 390 };
405 391
406 dwmmc_1: dwmmc1@12210000 { 392 mmc_2: mmc@12220000 {
407 status = "disabled"; 393 status = "okay";
408 };
409
410 dwmmc_2: dwmmc2@12220000 {
411 num-slots = <1>; 394 num-slots = <1>;
412 supports-highspeed; 395 supports-highspeed;
413 fifo-depth = <0x80>;
414 card-detect-delay = <200>; 396 card-detect-delay = <200>;
415 samsung,dw-mshc-ciu-div = <3>; 397 samsung,dw-mshc-ciu-div = <3>;
416 samsung,dw-mshc-sdr-timing = <2 3>; 398 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -426,26 +408,10 @@
426 }; 408 };
427 }; 409 };
428 410
429 dwmmc_3: dwmmc3@12230000 {
430 status = "disabled";
431 };
432
433 i2s0: i2s@03830000 { 411 i2s0: i2s@03830000 {
434 status = "okay"; 412 status = "okay";
435 }; 413 };
436 414
437 spi_0: spi@12d20000 {
438 status = "disabled";
439 };
440
441 spi_1: spi@12d30000 {
442 status = "disabled";
443 };
444
445 spi_2: spi@12d40000 {
446 status = "disabled";
447 };
448
449 gpio_keys { 415 gpio_keys {
450 compatible = "gpio-keys"; 416 compatible = "gpio-keys";
451 417
diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
index 9b186ac06c8b..2c1560d52f1a 100644
--- a/arch/arm/boot/dts/cros5250-common.dtsi
+++ b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
@@ -37,6 +37,7 @@
37 }; 37 };
38 38
39 i2c@12C60000 { 39 i2c@12C60000 {
40 status = "okay";
40 samsung,i2c-sda-delay = <100>; 41 samsung,i2c-sda-delay = <100>;
41 samsung,i2c-max-bus-freq = <378000>; 42 samsung,i2c-max-bus-freq = <378000>;
42 43
@@ -48,6 +49,7 @@
48 pinctrl-0 = <&max77686_irq>; 49 pinctrl-0 = <&max77686_irq>;
49 wakeup-source; 50 wakeup-source;
50 reg = <0x09>; 51 reg = <0x09>;
52 #clock-cells = <1>;
51 53
52 voltage-regulators { 54 voltage-regulators {
53 ldo1_reg: LDO1 { 55 ldo1_reg: LDO1 {
@@ -185,6 +187,7 @@
185 }; 187 };
186 188
187 i2c@12C70000 { 189 i2c@12C70000 {
190 status = "okay";
188 samsung,i2c-sda-delay = <100>; 191 samsung,i2c-sda-delay = <100>;
189 samsung,i2c-max-bus-freq = <378000>; 192 samsung,i2c-max-bus-freq = <378000>;
190 193
@@ -198,6 +201,7 @@
198 }; 201 };
199 202
200 i2c@12C80000 { 203 i2c@12C80000 {
204 status = "okay";
201 samsung,i2c-sda-delay = <100>; 205 samsung,i2c-sda-delay = <100>;
202 samsung,i2c-max-bus-freq = <66000>; 206 samsung,i2c-max-bus-freq = <66000>;
203 207
@@ -208,30 +212,31 @@
208 }; 212 };
209 213
210 i2c@12C90000 { 214 i2c@12C90000 {
215 status = "okay";
211 samsung,i2c-sda-delay = <100>; 216 samsung,i2c-sda-delay = <100>;
212 samsung,i2c-max-bus-freq = <66000>; 217 samsung,i2c-max-bus-freq = <66000>;
213 }; 218 };
214 219
215 i2c@12CA0000 { 220 i2c@12CA0000 {
221 status = "okay";
216 samsung,i2c-sda-delay = <100>; 222 samsung,i2c-sda-delay = <100>;
217 samsung,i2c-max-bus-freq = <66000>; 223 samsung,i2c-max-bus-freq = <66000>;
218 }; 224 };
219 225
220 i2c@12CB0000 { 226 i2c@12CB0000 {
227 status = "okay";
221 samsung,i2c-sda-delay = <100>; 228 samsung,i2c-sda-delay = <100>;
222 samsung,i2c-max-bus-freq = <66000>; 229 samsung,i2c-max-bus-freq = <66000>;
223 }; 230 };
224 231
225 i2c@12CC0000 {
226 status = "disabled";
227 };
228
229 i2c@12CD0000 { 232 i2c@12CD0000 {
233 status = "okay";
230 samsung,i2c-sda-delay = <100>; 234 samsung,i2c-sda-delay = <100>;
231 samsung,i2c-max-bus-freq = <66000>; 235 samsung,i2c-max-bus-freq = <66000>;
232 }; 236 };
233 237
234 i2c@12CE0000 { 238 i2c@12CE0000 {
239 status = "okay";
235 samsung,i2c-sda-delay = <100>; 240 samsung,i2c-sda-delay = <100>;
236 samsung,i2c-max-bus-freq = <378000>; 241 samsung,i2c-max-bus-freq = <378000>;
237 242
@@ -241,11 +246,10 @@
241 }; 246 };
242 }; 247 };
243 248
244 dwmmc0@12200000 { 249 mmc@12200000 {
245 num-slots = <1>; 250 num-slots = <1>;
246 supports-highspeed; 251 supports-highspeed;
247 broken-cd; 252 broken-cd;
248 fifo-depth = <0x80>;
249 card-detect-delay = <200>; 253 card-detect-delay = <200>;
250 samsung,dw-mshc-ciu-div = <3>; 254 samsung,dw-mshc-ciu-div = <3>;
251 samsung,dw-mshc-sdr-timing = <2 3>; 255 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -259,14 +263,9 @@
259 }; 263 };
260 }; 264 };
261 265
262 dwmmc1@12210000 { 266 mmc@12220000 {
263 status = "disabled";
264 };
265
266 dwmmc2@12220000 {
267 num-slots = <1>; 267 num-slots = <1>;
268 supports-highspeed; 268 supports-highspeed;
269 fifo-depth = <0x80>;
270 card-detect-delay = <200>; 269 card-detect-delay = <200>;
271 samsung,dw-mshc-ciu-div = <3>; 270 samsung,dw-mshc-ciu-div = <3>;
272 samsung,dw-mshc-sdr-timing = <2 3>; 271 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -281,11 +280,10 @@
281 }; 280 };
282 }; 281 };
283 282
284 dwmmc3@12230000 { 283 mmc@12230000 {
285 num-slots = <1>; 284 num-slots = <1>;
286 supports-highspeed; 285 supports-highspeed;
287 broken-cd; 286 broken-cd;
288 fifo-depth = <0x80>;
289 card-detect-delay = <200>; 287 card-detect-delay = <200>;
290 samsung,dw-mshc-ciu-div = <3>; 288 samsung,dw-mshc-ciu-div = <3>;
291 samsung,dw-mshc-sdr-timing = <2 3>; 289 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -298,19 +296,12 @@
298 }; 296 };
299 }; 297 };
300 298
301 spi_0: spi@12d20000 {
302 status = "disabled";
303 };
304
305 spi_1: spi@12d30000 { 299 spi_1: spi@12d30000 {
300 status = "okay";
306 samsung,spi-src-clk = <0>; 301 samsung,spi-src-clk = <0>;
307 num-cs = <1>; 302 num-cs = <1>;
308 }; 303 };
309 304
310 spi_2: spi@12d40000 {
311 status = "disabled";
312 };
313
314 hdmi { 305 hdmi {
315 hpd-gpio = <&gpx3 7 0>; 306 hpd-gpio = <&gpx3 7 0>;
316 }; 307 };
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index f86d56760a45..3e69837c435c 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -30,6 +30,7 @@
30 i2c@12C60000 { 30 i2c@12C60000 {
31 samsung,i2c-sda-delay = <100>; 31 samsung,i2c-sda-delay = <100>;
32 samsung,i2c-max-bus-freq = <20000>; 32 samsung,i2c-max-bus-freq = <20000>;
33 status = "okay";
33 34
34 eeprom@50 { 35 eeprom@50 {
35 compatible = "samsung,s524ad0xd1"; 36 compatible = "samsung,s524ad0xd1";
@@ -37,7 +38,7 @@
37 }; 38 };
38 }; 39 };
39 40
40 vdd:fixed-regulator@0 { 41 vdd: fixed-regulator@0 {
41 compatible = "regulator-fixed"; 42 compatible = "regulator-fixed";
42 regulator-name = "vdd-supply"; 43 regulator-name = "vdd-supply";
43 regulator-min-microvolt = <1800000>; 44 regulator-min-microvolt = <1800000>;
@@ -45,7 +46,7 @@
45 regulator-always-on; 46 regulator-always-on;
46 }; 47 };
47 48
48 dbvdd:fixed-regulator@1 { 49 dbvdd: fixed-regulator@1 {
49 compatible = "regulator-fixed"; 50 compatible = "regulator-fixed";
50 regulator-name = "dbvdd-supply"; 51 regulator-name = "dbvdd-supply";
51 regulator-min-microvolt = <3300000>; 52 regulator-min-microvolt = <3300000>;
@@ -53,7 +54,7 @@
53 regulator-always-on; 54 regulator-always-on;
54 }; 55 };
55 56
56 spkvdd:fixed-regulator@2 { 57 spkvdd: fixed-regulator@2 {
57 compatible = "regulator-fixed"; 58 compatible = "regulator-fixed";
58 regulator-name = "spkvdd-supply"; 59 regulator-name = "spkvdd-supply";
59 regulator-min-microvolt = <5000000>; 60 regulator-min-microvolt = <5000000>;
@@ -64,6 +65,7 @@
64 i2c@12C70000 { 65 i2c@12C70000 {
65 samsung,i2c-sda-delay = <100>; 66 samsung,i2c-sda-delay = <100>;
66 samsung,i2c-max-bus-freq = <20000>; 67 samsung,i2c-max-bus-freq = <20000>;
68 status = "okay";
67 69
68 eeprom@51 { 70 eeprom@51 {
69 compatible = "samsung,s524ad0xd1"; 71 compatible = "samsung,s524ad0xd1";
@@ -77,6 +79,9 @@
77 gpio-controller; 79 gpio-controller;
78 #gpio-cells = <2>; 80 #gpio-cells = <2>;
79 81
82 clocks = <&codec_mclk>;
83 clock-names = "MCLK1";
84
80 AVDD2-supply = <&vdd>; 85 AVDD2-supply = <&vdd>;
81 CPVDD-supply = <&vdd>; 86 CPVDD-supply = <&vdd>;
82 DBVDD-supply = <&dbvdd>; 87 DBVDD-supply = <&dbvdd>;
@@ -89,6 +94,7 @@
89 samsung,i2c-sda-delay = <100>; 94 samsung,i2c-sda-delay = <100>;
90 samsung,i2c-max-bus-freq = <40000>; 95 samsung,i2c-max-bus-freq = <40000>;
91 samsung,i2c-slave-addr = <0x38>; 96 samsung,i2c-slave-addr = <0x38>;
97 status = "okay";
92 98
93 sata-phy { 99 sata-phy {
94 compatible = "samsung,sata-phy"; 100 compatible = "samsung,sata-phy";
@@ -103,6 +109,7 @@
103 i2c@12C80000 { 109 i2c@12C80000 {
104 samsung,i2c-sda-delay = <100>; 110 samsung,i2c-sda-delay = <100>;
105 samsung,i2c-max-bus-freq = <66000>; 111 samsung,i2c-max-bus-freq = <66000>;
112 status = "okay";
106 113
107 hdmiddc@50 { 114 hdmiddc@50 {
108 compatible = "samsung,exynos4210-hdmiddc"; 115 compatible = "samsung,exynos4210-hdmiddc";
@@ -110,29 +117,10 @@
110 }; 117 };
111 }; 118 };
112 119
113 i2c@12C90000 {
114 status = "disabled";
115 };
116
117 i2c@12CA0000 {
118 status = "disabled";
119 };
120
121 i2c@12CB0000 {
122 status = "disabled";
123 };
124
125 i2c@12CC0000 {
126 status = "disabled";
127 };
128
129 i2c@12CD0000 {
130 status = "disabled";
131 };
132
133 i2c@12CE0000 { 120 i2c@12CE0000 {
134 samsung,i2c-sda-delay = <100>; 121 samsung,i2c-sda-delay = <100>;
135 samsung,i2c-max-bus-freq = <66000>; 122 samsung,i2c-max-bus-freq = <66000>;
123 status = "okay";
136 124
137 hdmiphy@38 { 125 hdmiphy@38 {
138 compatible = "samsung,exynos4212-hdmiphy"; 126 compatible = "samsung,exynos4212-hdmiphy";
@@ -140,11 +128,11 @@
140 }; 128 };
141 }; 129 };
142 130
143 dwmmc0@12200000 { 131 mmc@12200000 {
132 status = "okay";
144 num-slots = <1>; 133 num-slots = <1>;
145 supports-highspeed; 134 supports-highspeed;
146 broken-cd; 135 broken-cd;
147 fifo-depth = <0x80>;
148 card-detect-delay = <200>; 136 card-detect-delay = <200>;
149 samsung,dw-mshc-ciu-div = <3>; 137 samsung,dw-mshc-ciu-div = <3>;
150 samsung,dw-mshc-sdr-timing = <2 3>; 138 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -158,14 +146,10 @@
158 }; 146 };
159 }; 147 };
160 148
161 dwmmc1@12210000 { 149 mmc@12220000 {
162 status = "disabled"; 150 status = "okay";
163 };
164
165 dwmmc2@12220000 {
166 num-slots = <1>; 151 num-slots = <1>;
167 supports-highspeed; 152 supports-highspeed;
168 fifo-depth = <0x80>;
169 card-detect-delay = <200>; 153 card-detect-delay = <200>;
170 samsung,dw-mshc-ciu-div = <3>; 154 samsung,dw-mshc-ciu-div = <3>;
171 samsung,dw-mshc-sdr-timing = <2 3>; 155 samsung,dw-mshc-sdr-timing = <2 3>;
@@ -180,15 +164,13 @@
180 }; 164 };
181 }; 165 };
182 166
183 dwmmc3@12230000 {
184 status = "disabled";
185 };
186
187 spi_0: spi@12d20000 { 167 spi_0: spi@12d20000 {
188 status = "disabled"; 168 status = "disabled";
189 }; 169 };
190 170
191 spi_1: spi@12d30000 { 171 spi_1: spi@12d30000 {
172 status = "okay";
173
192 w25q80bw@0 { 174 w25q80bw@0 {
193 #address-cells = <1>; 175 #address-cells = <1>;
194 #size-cells = <1>; 176 #size-cells = <1>;
@@ -214,10 +196,6 @@
214 }; 196 };
215 }; 197 };
216 198
217 spi_2: spi@12d40000 {
218 status = "disabled";
219 };
220
221 hdmi { 199 hdmi {
222 hpd-gpio = <&gpx3 7 0>; 200 hpd-gpio = <&gpx3 7 0>;
223 }; 201 };
@@ -279,5 +257,11 @@
279 compatible = "samsung,clock-xxti"; 257 compatible = "samsung,clock-xxti";
280 clock-frequency = <24000000>; 258 clock-frequency = <24000000>;
281 }; 259 };
260
261 codec_mclk: codec-mclk {
262 compatible = "fixed-clock";
263 #clock-cells = <0>;
264 clock-frequency = <16934000>;
265 };
282 }; 266 };
283}; 267};
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
index fd711e245e8d..7e45eea2d78f 100644
--- a/arch/arm/boot/dts/exynos5250-snow.dts
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -10,7 +10,7 @@
10 10
11/dts-v1/; 11/dts-v1/;
12#include "exynos5250.dtsi" 12#include "exynos5250.dtsi"
13#include "cros5250-common.dtsi" 13#include "exynos5250-cros-common.dtsi"
14 14
15/ { 15/ {
16 model = "Google Snow"; 16 model = "Google Snow";
@@ -85,7 +85,7 @@
85 keypad,num-rows = <8>; 85 keypad,num-rows = <8>;
86 keypad,num-columns = <13>; 86 keypad,num-columns = <13>;
87 google,needs-ghost-filter; 87 google,needs-ghost-filter;
88 linux,keymap = <0x0001003a /* CAPSLK */ 88 linux,keymap = <0x0001007d /* L_META */
89 0x0002003b /* F1 */ 89 0x0002003b /* F1 */
90 0x00030030 /* B */ 90 0x00030030 /* B */
91 0x00040044 /* F10 */ 91 0x00040044 /* F10 */
@@ -130,6 +130,7 @@
130 0x04060024 /* J */ 130 0x04060024 /* J */
131 0x04080027 /* ; */ 131 0x04080027 /* ; */
132 0x04090026 /* L */ 132 0x04090026 /* L */
133 0x040a002b /* \ */
133 0x040b001c /* ENTER */ 134 0x040b001c /* ENTER */
134 135
135 0x0501002c /* Z */ 136 0x0501002c /* Z */
@@ -171,11 +172,20 @@
171 }; 172 };
172 }; 173 };
173 174
175 mmc@12200000 {
176 status = "okay";
177 };
178
179 mmc@12220000 {
180 status = "okay";
181 };
182
174 /* 183 /*
175 * On Snow we've got SIP WiFi and so can keep drive strengths low to 184 * On Snow we've got SIP WiFi and so can keep drive strengths low to
176 * reduce EMI. 185 * reduce EMI.
177 */ 186 */
178 dwmmc3@12230000 { 187 mmc@12230000 {
188 status = "okay";
179 slot@0 { 189 slot@0 {
180 pinctrl-names = "default"; 190 pinctrl-names = "default";
181 pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>; 191 pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>;
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 177becde7a26..b7dec41e32af 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -33,10 +33,10 @@
33 gsc1 = &gsc_1; 33 gsc1 = &gsc_1;
34 gsc2 = &gsc_2; 34 gsc2 = &gsc_2;
35 gsc3 = &gsc_3; 35 gsc3 = &gsc_3;
36 mshc0 = &dwmmc_0; 36 mshc0 = &mmc_0;
37 mshc1 = &dwmmc_1; 37 mshc1 = &mmc_1;
38 mshc2 = &dwmmc_2; 38 mshc2 = &mmc_2;
39 mshc3 = &dwmmc_3; 39 mshc3 = &mmc_3;
40 i2c0 = &i2c_0; 40 i2c0 = &i2c_0;
41 i2c1 = &i2c_1; 41 i2c1 = &i2c_1;
42 i2c2 = &i2c_2; 42 i2c2 = &i2c_2;
@@ -60,11 +60,13 @@
60 device_type = "cpu"; 60 device_type = "cpu";
61 compatible = "arm,cortex-a15"; 61 compatible = "arm,cortex-a15";
62 reg = <0>; 62 reg = <0>;
63 clock-frequency = <1700000000>;
63 }; 64 };
64 cpu@1 { 65 cpu@1 {
65 device_type = "cpu"; 66 device_type = "cpu";
66 compatible = "arm,cortex-a15"; 67 compatible = "arm,cortex-a15";
67 reg = <1>; 68 reg = <1>;
69 clock-frequency = <1700000000>;
68 }; 70 };
69 }; 71 };
70 72
@@ -88,6 +90,8 @@
88 compatible = "samsung,exynos5250-audss-clock"; 90 compatible = "samsung,exynos5250-audss-clock";
89 reg = <0x03810000 0x0C>; 91 reg = <0x03810000 0x0C>;
90 #clock-cells = <1>; 92 #clock-cells = <1>;
93 clocks = <&clock 1>, <&clock 7>, <&clock 138>, <&clock 160>;
94 clock-names = "pll_ref", "pll_in", "sclk_audio", "sclk_pcm_in";
91 }; 95 };
92 96
93 timer { 97 timer {
@@ -242,6 +246,7 @@
242 clock-names = "i2c"; 246 clock-names = "i2c";
243 pinctrl-names = "default"; 247 pinctrl-names = "default";
244 pinctrl-0 = <&i2c0_bus>; 248 pinctrl-0 = <&i2c0_bus>;
249 status = "disabled";
245 }; 250 };
246 251
247 i2c_1: i2c@12C70000 { 252 i2c_1: i2c@12C70000 {
@@ -254,6 +259,7 @@
254 clock-names = "i2c"; 259 clock-names = "i2c";
255 pinctrl-names = "default"; 260 pinctrl-names = "default";
256 pinctrl-0 = <&i2c1_bus>; 261 pinctrl-0 = <&i2c1_bus>;
262 status = "disabled";
257 }; 263 };
258 264
259 i2c_2: i2c@12C80000 { 265 i2c_2: i2c@12C80000 {
@@ -266,6 +272,7 @@
266 clock-names = "i2c"; 272 clock-names = "i2c";
267 pinctrl-names = "default"; 273 pinctrl-names = "default";
268 pinctrl-0 = <&i2c2_bus>; 274 pinctrl-0 = <&i2c2_bus>;
275 status = "disabled";
269 }; 276 };
270 277
271 i2c_3: i2c@12C90000 { 278 i2c_3: i2c@12C90000 {
@@ -278,6 +285,7 @@
278 clock-names = "i2c"; 285 clock-names = "i2c";
279 pinctrl-names = "default"; 286 pinctrl-names = "default";
280 pinctrl-0 = <&i2c3_bus>; 287 pinctrl-0 = <&i2c3_bus>;
288 status = "disabled";
281 }; 289 };
282 290
283 i2c_4: i2c@12CA0000 { 291 i2c_4: i2c@12CA0000 {
@@ -290,6 +298,7 @@
290 clock-names = "i2c"; 298 clock-names = "i2c";
291 pinctrl-names = "default"; 299 pinctrl-names = "default";
292 pinctrl-0 = <&i2c4_bus>; 300 pinctrl-0 = <&i2c4_bus>;
301 status = "disabled";
293 }; 302 };
294 303
295 i2c_5: i2c@12CB0000 { 304 i2c_5: i2c@12CB0000 {
@@ -302,6 +311,7 @@
302 clock-names = "i2c"; 311 clock-names = "i2c";
303 pinctrl-names = "default"; 312 pinctrl-names = "default";
304 pinctrl-0 = <&i2c5_bus>; 313 pinctrl-0 = <&i2c5_bus>;
314 status = "disabled";
305 }; 315 };
306 316
307 i2c_6: i2c@12CC0000 { 317 i2c_6: i2c@12CC0000 {
@@ -314,6 +324,7 @@
314 clock-names = "i2c"; 324 clock-names = "i2c";
315 pinctrl-names = "default"; 325 pinctrl-names = "default";
316 pinctrl-0 = <&i2c6_bus>; 326 pinctrl-0 = <&i2c6_bus>;
327 status = "disabled";
317 }; 328 };
318 329
319 i2c_7: i2c@12CD0000 { 330 i2c_7: i2c@12CD0000 {
@@ -326,6 +337,7 @@
326 clock-names = "i2c"; 337 clock-names = "i2c";
327 pinctrl-names = "default"; 338 pinctrl-names = "default";
328 pinctrl-0 = <&i2c7_bus>; 339 pinctrl-0 = <&i2c7_bus>;
340 status = "disabled";
329 }; 341 };
330 342
331 i2c_8: i2c@12CE0000 { 343 i2c_8: i2c@12CE0000 {
@@ -336,6 +348,7 @@
336 #size-cells = <0>; 348 #size-cells = <0>;
337 clocks = <&clock 302>; 349 clocks = <&clock 302>;
338 clock-names = "i2c"; 350 clock-names = "i2c";
351 status = "disabled";
339 }; 352 };
340 353
341 i2c@121D0000 { 354 i2c@121D0000 {
@@ -345,10 +358,12 @@
345 #size-cells = <0>; 358 #size-cells = <0>;
346 clocks = <&clock 288>; 359 clocks = <&clock 288>;
347 clock-names = "i2c"; 360 clock-names = "i2c";
361 status = "disabled";
348 }; 362 };
349 363
350 spi_0: spi@12d20000 { 364 spi_0: spi@12d20000 {
351 compatible = "samsung,exynos4210-spi"; 365 compatible = "samsung,exynos4210-spi";
366 status = "disabled";
352 reg = <0x12d20000 0x100>; 367 reg = <0x12d20000 0x100>;
353 interrupts = <0 66 0>; 368 interrupts = <0 66 0>;
354 dmas = <&pdma0 5 369 dmas = <&pdma0 5
@@ -364,6 +379,7 @@
364 379
365 spi_1: spi@12d30000 { 380 spi_1: spi@12d30000 {
366 compatible = "samsung,exynos4210-spi"; 381 compatible = "samsung,exynos4210-spi";
382 status = "disabled";
367 reg = <0x12d30000 0x100>; 383 reg = <0x12d30000 0x100>;
368 interrupts = <0 67 0>; 384 interrupts = <0 67 0>;
369 dmas = <&pdma1 5 385 dmas = <&pdma1 5
@@ -379,6 +395,7 @@
379 395
380 spi_2: spi@12d40000 { 396 spi_2: spi@12d40000 {
381 compatible = "samsung,exynos4210-spi"; 397 compatible = "samsung,exynos4210-spi";
398 status = "disabled";
382 reg = <0x12d40000 0x100>; 399 reg = <0x12d40000 0x100>;
383 interrupts = <0 68 0>; 400 interrupts = <0 68 0>;
384 dmas = <&pdma0 7 401 dmas = <&pdma0 7
@@ -392,25 +409,43 @@
392 pinctrl-0 = <&spi2_bus>; 409 pinctrl-0 = <&spi2_bus>;
393 }; 410 };
394 411
395 dwmmc_0: dwmmc0@12200000 { 412 mmc_0: mmc@12200000 {
413 compatible = "samsung,exynos5250-dw-mshc";
414 interrupts = <0 75 0>;
415 #address-cells = <1>;
416 #size-cells = <0>;
396 reg = <0x12200000 0x1000>; 417 reg = <0x12200000 0x1000>;
397 clocks = <&clock 280>, <&clock 139>; 418 clocks = <&clock 280>, <&clock 139>;
398 clock-names = "biu", "ciu"; 419 clock-names = "biu", "ciu";
420 fifo-depth = <0x80>;
421 status = "disabled";
399 }; 422 };
400 423
401 dwmmc_1: dwmmc1@12210000 { 424 mmc_1: mmc@12210000 {
425 compatible = "samsung,exynos5250-dw-mshc";
426 interrupts = <0 76 0>;
427 #address-cells = <1>;
428 #size-cells = <0>;
402 reg = <0x12210000 0x1000>; 429 reg = <0x12210000 0x1000>;
403 clocks = <&clock 281>, <&clock 140>; 430 clocks = <&clock 281>, <&clock 140>;
404 clock-names = "biu", "ciu"; 431 clock-names = "biu", "ciu";
432 fifo-depth = <0x80>;
433 status = "disabled";
405 }; 434 };
406 435
407 dwmmc_2: dwmmc2@12220000 { 436 mmc_2: mmc@12220000 {
437 compatible = "samsung,exynos5250-dw-mshc";
438 interrupts = <0 77 0>;
439 #address-cells = <1>;
440 #size-cells = <0>;
408 reg = <0x12220000 0x1000>; 441 reg = <0x12220000 0x1000>;
409 clocks = <&clock 282>, <&clock 141>; 442 clocks = <&clock 282>, <&clock 141>;
410 clock-names = "biu", "ciu"; 443 clock-names = "biu", "ciu";
444 fifo-depth = <0x80>;
445 status = "disabled";
411 }; 446 };
412 447
413 dwmmc_3: dwmmc3@12230000 { 448 mmc_3: mmc@12230000 {
414 compatible = "samsung,exynos5250-dw-mshc"; 449 compatible = "samsung,exynos5250-dw-mshc";
415 reg = <0x12230000 0x1000>; 450 reg = <0x12230000 0x1000>;
416 interrupts = <0 78 0>; 451 interrupts = <0 78 0>;
@@ -418,6 +453,8 @@
418 #size-cells = <0>; 453 #size-cells = <0>;
419 clocks = <&clock 283>, <&clock 142>; 454 clocks = <&clock 283>, <&clock 142>;
420 clock-names = "biu", "ciu"; 455 clock-names = "biu", "ciu";
456 fifo-depth = <0x80>;
457 status = "disabled";
421 }; 458 };
422 459
423 i2s0: i2s@03830000 { 460 i2s0: i2s@03830000 {
@@ -526,6 +563,15 @@
526 }; 563 };
527 }; 564 };
528 565
566 pwm: pwm@12dd0000 {
567 compatible = "samsung,exynos4210-pwm";
568 reg = <0x12dd0000 0x100>;
569 samsung,pwm-outputs = <0>, <1>, <2>, <3>;
570 #pwm-cells = <3>;
571 clocks = <&clock 311>;
572 clock-names = "timers";
573 };
574
529 amba { 575 amba {
530 #address-cells = <1>; 576 #address-cells = <1>;
531 #size-cells = <1>; 577 #size-cells = <1>;
diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
new file mode 100644
index 000000000000..7340745ff979
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
@@ -0,0 +1,66 @@
1/*
2 * Samsung's Exynos5420 based Arndale Octa board device tree source
3 *
4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12/dts-v1/;
13#include "exynos5420.dtsi"
14
15/ {
16 model = "Insignal Arndale Octa evaluation board based on EXYNOS5420";
17 compatible = "insignal,arndale-octa", "samsung,exynos5420";
18
19 memory {
20 reg = <0x20000000 0x80000000>;
21 };
22
23 chosen {
24 bootargs = "console=ttySAC3,115200";
25 };
26
27 fixed-rate-clocks {
28 oscclk {
29 compatible = "samsung,exynos5420-oscclk";
30 clock-frequency = <24000000>;
31 };
32 };
33
34 mmc@12200000 {
35 status = "okay";
36 broken-cd;
37 supports-highspeed;
38 card-detect-delay = <200>;
39 samsung,dw-mshc-ciu-div = <3>;
40 samsung,dw-mshc-sdr-timing = <0 4>;
41 samsung,dw-mshc-ddr-timing = <0 2>;
42 pinctrl-names = "default";
43 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
44
45 slot@0 {
46 reg = <0>;
47 bus-width = <8>;
48 };
49 };
50
51 mmc@12220000 {
52 status = "okay";
53 supports-highspeed;
54 card-detect-delay = <200>;
55 samsung,dw-mshc-ciu-div = <3>;
56 samsung,dw-mshc-sdr-timing = <2 3>;
57 samsung,dw-mshc-ddr-timing = <1 2>;
58 pinctrl-names = "default";
59 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
60
61 slot@0 {
62 reg = <0>;
63 bus-width = <4>;
64 };
65 };
66};
diff --git a/arch/arm/boot/dts/exynos5420-pinctrl.dtsi b/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
index e695aba5f73c..e62c8eb57438 100644
--- a/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
@@ -64,7 +64,7 @@
64 samsung,pins = "gpx0-7"; 64 samsung,pins = "gpx0-7";
65 samsung,pin-function = <3>; 65 samsung,pin-function = <3>;
66 samsung,pin-pud = <0>; 66 samsung,pin-pud = <0>;
67 samaung,pin-drv = <0>; 67 samsung,pin-drv = <0>;
68 }; 68 };
69 }; 69 };
70 70
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts
index 79524c74c603..fb5a1e25c632 100644
--- a/arch/arm/boot/dts/exynos5420-smdk5420.dts
+++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts
@@ -31,6 +31,39 @@
31 }; 31 };
32 }; 32 };
33 33
34 mmc@12200000 {
35 status = "okay";
36 broken-cd;
37 supports-highspeed;
38 card-detect-delay = <200>;
39 samsung,dw-mshc-ciu-div = <3>;
40 samsung,dw-mshc-sdr-timing = <0 4>;
41 samsung,dw-mshc-ddr-timing = <0 2>;
42 pinctrl-names = "default";
43 pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
44
45 slot@0 {
46 reg = <0>;
47 bus-width = <8>;
48 };
49 };
50
51 mmc@12220000 {
52 status = "okay";
53 supports-highspeed;
54 card-detect-delay = <200>;
55 samsung,dw-mshc-ciu-div = <3>;
56 samsung,dw-mshc-sdr-timing = <2 3>;
57 samsung,dw-mshc-ddr-timing = <1 2>;
58 pinctrl-names = "default";
59 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
60
61 slot@0 {
62 reg = <0>;
63 bus-width = <4>;
64 };
65 };
66
34 dp-controller@145B0000 { 67 dp-controller@145B0000 {
35 pinctrl-names = "default"; 68 pinctrl-names = "default";
36 pinctrl-0 = <&dp_hpd>; 69 pinctrl-0 = <&dp_hpd>;
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index 09aa06cb3d3a..8db792b26f79 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -22,6 +22,9 @@
22 compatible = "samsung,exynos5420"; 22 compatible = "samsung,exynos5420";
23 23
24 aliases { 24 aliases {
25 mshc0 = &mmc_0;
26 mshc1 = &mmc_1;
27 mshc2 = &mmc_2;
25 pinctrl0 = &pinctrl_0; 28 pinctrl0 = &pinctrl_0;
26 pinctrl1 = &pinctrl_1; 29 pinctrl1 = &pinctrl_1;
27 pinctrl2 = &pinctrl_2; 30 pinctrl2 = &pinctrl_2;
@@ -31,6 +34,18 @@
31 i2c1 = &i2c_1; 34 i2c1 = &i2c_1;
32 i2c2 = &i2c_2; 35 i2c2 = &i2c_2;
33 i2c3 = &i2c_3; 36 i2c3 = &i2c_3;
37 i2c4 = &hsi2c_4;
38 i2c5 = &hsi2c_5;
39 i2c6 = &hsi2c_6;
40 i2c7 = &hsi2c_7;
41 i2c8 = &hsi2c_8;
42 i2c9 = &hsi2c_9;
43 i2c10 = &hsi2c_10;
44 gsc0 = &gsc_0;
45 gsc1 = &gsc_1;
46 spi0 = &spi_0;
47 spi1 = &spi_1;
48 spi2 = &spi_2;
34 }; 49 };
35 50
36 cpus { 51 cpus {
@@ -64,6 +79,34 @@
64 reg = <0x3>; 79 reg = <0x3>;
65 clock-frequency = <1800000000>; 80 clock-frequency = <1800000000>;
66 }; 81 };
82
83 cpu4: cpu@100 {
84 device_type = "cpu";
85 compatible = "arm,cortex-a7";
86 reg = <0x100>;
87 clock-frequency = <1000000000>;
88 };
89
90 cpu5: cpu@101 {
91 device_type = "cpu";
92 compatible = "arm,cortex-a7";
93 reg = <0x101>;
94 clock-frequency = <1000000000>;
95 };
96
97 cpu6: cpu@102 {
98 device_type = "cpu";
99 compatible = "arm,cortex-a7";
100 reg = <0x102>;
101 clock-frequency = <1000000000>;
102 };
103
104 cpu7: cpu@103 {
105 device_type = "cpu";
106 compatible = "arm,cortex-a7";
107 reg = <0x103>;
108 clock-frequency = <1000000000>;
109 };
67 }; 110 };
68 111
69 clock: clock-controller@10010000 { 112 clock: clock-controller@10010000 {
@@ -76,8 +119,8 @@
76 compatible = "samsung,exynos5420-audss-clock"; 119 compatible = "samsung,exynos5420-audss-clock";
77 reg = <0x03810000 0x0C>; 120 reg = <0x03810000 0x0C>;
78 #clock-cells = <1>; 121 #clock-cells = <1>;
79 clocks = <&clock 148>; 122 clocks = <&clock 1>, <&clock 5>, <&clock 148>, <&clock 149>;
80 clock-names = "sclk_audio"; 123 clock-names = "pll_ref", "pll_in", "sclk_audio", "sclk_pcm_in";
81 }; 124 };
82 125
83 codec@11000000 { 126 codec@11000000 {
@@ -88,13 +131,50 @@
88 clock-names = "mfc"; 131 clock-names = "mfc";
89 }; 132 };
90 133
134 mmc_0: mmc@12200000 {
135 compatible = "samsung,exynos5420-dw-mshc-smu";
136 interrupts = <0 75 0>;
137 #address-cells = <1>;
138 #size-cells = <0>;
139 reg = <0x12200000 0x2000>;
140 clocks = <&clock 351>, <&clock 132>;
141 clock-names = "biu", "ciu";
142 fifo-depth = <0x40>;
143 status = "disabled";
144 };
145
146 mmc_1: mmc@12210000 {
147 compatible = "samsung,exynos5420-dw-mshc-smu";
148 interrupts = <0 76 0>;
149 #address-cells = <1>;
150 #size-cells = <0>;
151 reg = <0x12210000 0x2000>;
152 clocks = <&clock 352>, <&clock 133>;
153 clock-names = "biu", "ciu";
154 fifo-depth = <0x40>;
155 status = "disabled";
156 };
157
158 mmc_2: mmc@12220000 {
159 compatible = "samsung,exynos5420-dw-mshc";
160 interrupts = <0 77 0>;
161 #address-cells = <1>;
162 #size-cells = <0>;
163 reg = <0x12220000 0x1000>;
164 clocks = <&clock 353>, <&clock 134>;
165 clock-names = "biu", "ciu";
166 fifo-depth = <0x40>;
167 status = "disabled";
168 };
169
91 mct@101C0000 { 170 mct@101C0000 {
92 compatible = "samsung,exynos4210-mct"; 171 compatible = "samsung,exynos4210-mct";
93 reg = <0x101C0000 0x800>; 172 reg = <0x101C0000 0x800>;
94 interrupt-controller; 173 interrupt-controller;
95 #interrups-cells = <1>; 174 #interrups-cells = <1>;
96 interrupt-parent = <&mct_map>; 175 interrupt-parent = <&mct_map>;
97 interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>; 176 interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>,
177 <8>, <9>, <10>, <11>;
98 clocks = <&clock 1>, <&clock 315>; 178 clocks = <&clock 1>, <&clock 315>;
99 clock-names = "fin_pll", "mct"; 179 clock-names = "fin_pll", "mct";
100 180
@@ -109,7 +189,11 @@
109 <4 &gic 0 120 0>, 189 <4 &gic 0 120 0>,
110 <5 &gic 0 121 0>, 190 <5 &gic 0 121 0>,
111 <6 &gic 0 122 0>, 191 <6 &gic 0 122 0>,
112 <7 &gic 0 123 0>; 192 <7 &gic 0 123 0>,
193 <8 &gic 0 128 0>,
194 <9 &gic 0 129 0>,
195 <10 &gic 0 130 0>,
196 <11 &gic 0 131 0>;
113 }; 197 };
114 }; 198 };
115 199
@@ -190,6 +274,106 @@
190 status = "okay"; 274 status = "okay";
191 }; 275 };
192 276
277 amba {
278 #address-cells = <1>;
279 #size-cells = <1>;
280 compatible = "arm,amba-bus";
281 interrupt-parent = <&gic>;
282 ranges;
283
284 pdma0: pdma@121A0000 {
285 compatible = "arm,pl330", "arm,primecell";
286 reg = <0x121A0000 0x1000>;
287 interrupts = <0 34 0>;
288 clocks = <&clock 362>;
289 clock-names = "apb_pclk";
290 #dma-cells = <1>;
291 #dma-channels = <8>;
292 #dma-requests = <32>;
293 };
294
295 pdma1: pdma@121B0000 {
296 compatible = "arm,pl330", "arm,primecell";
297 reg = <0x121B0000 0x1000>;
298 interrupts = <0 35 0>;
299 clocks = <&clock 363>;
300 clock-names = "apb_pclk";
301 #dma-cells = <1>;
302 #dma-channels = <8>;
303 #dma-requests = <32>;
304 };
305
306 mdma0: mdma@10800000 {
307 compatible = "arm,pl330", "arm,primecell";
308 reg = <0x10800000 0x1000>;
309 interrupts = <0 33 0>;
310 clocks = <&clock 473>;
311 clock-names = "apb_pclk";
312 #dma-cells = <1>;
313 #dma-channels = <8>;
314 #dma-requests = <1>;
315 };
316
317 mdma1: mdma@11C10000 {
318 compatible = "arm,pl330", "arm,primecell";
319 reg = <0x11C10000 0x1000>;
320 interrupts = <0 124 0>;
321 clocks = <&clock 442>;
322 clock-names = "apb_pclk";
323 #dma-cells = <1>;
324 #dma-channels = <8>;
325 #dma-requests = <1>;
326 };
327 };
328
329 spi_0: spi@12d20000 {
330 compatible = "samsung,exynos4210-spi";
331 reg = <0x12d20000 0x100>;
332 interrupts = <0 66 0>;
333 dmas = <&pdma0 5
334 &pdma0 4>;
335 dma-names = "tx", "rx";
336 #address-cells = <1>;
337 #size-cells = <0>;
338 pinctrl-names = "default";
339 pinctrl-0 = <&spi0_bus>;
340 clocks = <&clock 271>, <&clock 135>;
341 clock-names = "spi", "spi_busclk0";
342 status = "disabled";
343 };
344
345 spi_1: spi@12d30000 {
346 compatible = "samsung,exynos4210-spi";
347 reg = <0x12d30000 0x100>;
348 interrupts = <0 67 0>;
349 dmas = <&pdma1 5
350 &pdma1 4>;
351 dma-names = "tx", "rx";
352 #address-cells = <1>;
353 #size-cells = <0>;
354 pinctrl-names = "default";
355 pinctrl-0 = <&spi1_bus>;
356 clocks = <&clock 272>, <&clock 136>;
357 clock-names = "spi", "spi_busclk0";
358 status = "disabled";
359 };
360
361 spi_2: spi@12d40000 {
362 compatible = "samsung,exynos4210-spi";
363 reg = <0x12d40000 0x100>;
364 interrupts = <0 68 0>;
365 dmas = <&pdma0 7
366 &pdma0 6>;
367 dma-names = "tx", "rx";
368 #address-cells = <1>;
369 #size-cells = <0>;
370 pinctrl-names = "default";
371 pinctrl-0 = <&spi2_bus>;
372 clocks = <&clock 273>, <&clock 137>;
373 clock-names = "spi", "spi_busclk0";
374 status = "disabled";
375 };
376
193 serial@12C00000 { 377 serial@12C00000 {
194 clocks = <&clock 257>, <&clock 128>; 378 clocks = <&clock 257>, <&clock 128>;
195 clock-names = "uart", "clk_uart_baud0"; 379 clock-names = "uart", "clk_uart_baud0";
@@ -210,6 +394,15 @@
210 clock-names = "uart", "clk_uart_baud0"; 394 clock-names = "uart", "clk_uart_baud0";
211 }; 395 };
212 396
397 pwm: pwm@12dd0000 {
398 compatible = "samsung,exynos4210-pwm";
399 reg = <0x12dd0000 0x100>;
400 samsung,pwm-outputs = <0>, <1>, <2>, <3>;
401 #pwm-cells = <3>;
402 clocks = <&clock 279>;
403 clock-names = "timers";
404 };
405
213 dp_phy: video-phy@10040728 { 406 dp_phy: video-phy@10040728 {
214 compatible = "samsung,exynos5250-dp-video-phy"; 407 compatible = "samsung,exynos5250-dp-video-phy";
215 reg = <0x10040728 4>; 408 reg = <0x10040728 4>;
@@ -292,6 +485,97 @@
292 status = "disabled"; 485 status = "disabled";
293 }; 486 };
294 487
488 hsi2c_4: i2c@12CA0000 {
489 compatible = "samsung,exynos5-hsi2c";
490 reg = <0x12CA0000 0x1000>;
491 interrupts = <0 60 0>;
492 #address-cells = <1>;
493 #size-cells = <0>;
494 pinctrl-names = "default";
495 pinctrl-0 = <&i2c4_hs_bus>;
496 clocks = <&clock 265>;
497 clock-names = "hsi2c";
498 status = "disabled";
499 };
500
501 hsi2c_5: i2c@12CB0000 {
502 compatible = "samsung,exynos5-hsi2c";
503 reg = <0x12CB0000 0x1000>;
504 interrupts = <0 61 0>;
505 #address-cells = <1>;
506 #size-cells = <0>;
507 pinctrl-names = "default";
508 pinctrl-0 = <&i2c5_hs_bus>;
509 clocks = <&clock 266>;
510 clock-names = "hsi2c";
511 status = "disabled";
512 };
513
514 hsi2c_6: i2c@12CC0000 {
515 compatible = "samsung,exynos5-hsi2c";
516 reg = <0x12CC0000 0x1000>;
517 interrupts = <0 62 0>;
518 #address-cells = <1>;
519 #size-cells = <0>;
520 pinctrl-names = "default";
521 pinctrl-0 = <&i2c6_hs_bus>;
522 clocks = <&clock 267>;
523 clock-names = "hsi2c";
524 status = "disabled";
525 };
526
527 hsi2c_7: i2c@12CD0000 {
528 compatible = "samsung,exynos5-hsi2c";
529 reg = <0x12CD0000 0x1000>;
530 interrupts = <0 63 0>;
531 #address-cells = <1>;
532 #size-cells = <0>;
533 pinctrl-names = "default";
534 pinctrl-0 = <&i2c7_hs_bus>;
535 clocks = <&clock 268>;
536 clock-names = "hsi2c";
537 status = "disabled";
538 };
539
540 hsi2c_8: i2c@12E00000 {
541 compatible = "samsung,exynos5-hsi2c";
542 reg = <0x12E00000 0x1000>;
543 interrupts = <0 87 0>;
544 #address-cells = <1>;
545 #size-cells = <0>;
546 pinctrl-names = "default";
547 pinctrl-0 = <&i2c8_hs_bus>;
548 clocks = <&clock 281>;
549 clock-names = "hsi2c";
550 status = "disabled";
551 };
552
553 hsi2c_9: i2c@12E10000 {
554 compatible = "samsung,exynos5-hsi2c";
555 reg = <0x12E10000 0x1000>;
556 interrupts = <0 88 0>;
557 #address-cells = <1>;
558 #size-cells = <0>;
559 pinctrl-names = "default";
560 pinctrl-0 = <&i2c9_hs_bus>;
561 clocks = <&clock 282>;
562 clock-names = "hsi2c";
563 status = "disabled";
564 };
565
566 hsi2c_10: i2c@12E20000 {
567 compatible = "samsung,exynos5-hsi2c";
568 reg = <0x12E20000 0x1000>;
569 interrupts = <0 203 0>;
570 #address-cells = <1>;
571 #size-cells = <0>;
572 pinctrl-names = "default";
573 pinctrl-0 = <&i2c10_hs_bus>;
574 clocks = <&clock 283>;
575 clock-names = "hsi2c";
576 status = "disabled";
577 };
578
295 hdmi@14530000 { 579 hdmi@14530000 {
296 compatible = "samsung,exynos4212-hdmi"; 580 compatible = "samsung,exynos4212-hdmi";
297 reg = <0x14530000 0x70000>; 581 reg = <0x14530000 0x70000>;
@@ -310,4 +594,62 @@
310 clocks = <&clock 431>, <&clock 143>; 594 clocks = <&clock 431>, <&clock 143>;
311 clock-names = "mixer", "sclk_hdmi"; 595 clock-names = "mixer", "sclk_hdmi";
312 }; 596 };
597
598 gsc_0: video-scaler@13e00000 {
599 compatible = "samsung,exynos5-gsc";
600 reg = <0x13e00000 0x1000>;
601 interrupts = <0 85 0>;
602 clocks = <&clock 465>;
603 clock-names = "gscl";
604 samsung,power-domain = <&gsc_pd>;
605 };
606
607 gsc_1: video-scaler@13e10000 {
608 compatible = "samsung,exynos5-gsc";
609 reg = <0x13e10000 0x1000>;
610 interrupts = <0 86 0>;
611 clocks = <&clock 466>;
612 clock-names = "gscl";
613 samsung,power-domain = <&gsc_pd>;
614 };
615
616 tmu_cpu0: tmu@10060000 {
617 compatible = "samsung,exynos5420-tmu";
618 reg = <0x10060000 0x100>;
619 interrupts = <0 65 0>;
620 clocks = <&clock 318>;
621 clock-names = "tmu_apbif";
622 };
623
624 tmu_cpu1: tmu@10064000 {
625 compatible = "samsung,exynos5420-tmu";
626 reg = <0x10064000 0x100>;
627 interrupts = <0 183 0>;
628 clocks = <&clock 318>;
629 clock-names = "tmu_apbif";
630 };
631
632 tmu_cpu2: tmu@10068000 {
633 compatible = "samsung,exynos5420-tmu-ext-triminfo";
634 reg = <0x10068000 0x100>, <0x1006c000 0x4>;
635 interrupts = <0 184 0>;
636 clocks = <&clock 318>, <&clock 318>;
637 clock-names = "tmu_apbif", "tmu_triminfo_apbif";
638 };
639
640 tmu_cpu3: tmu@1006c000 {
641 compatible = "samsung,exynos5420-tmu-ext-triminfo";
642 reg = <0x1006c000 0x100>, <0x100a0000 0x4>;
643 interrupts = <0 185 0>;
644 clocks = <&clock 318>, <&clock 319>;
645 clock-names = "tmu_apbif", "tmu_triminfo_apbif";
646 };
647
648 tmu_gpu: tmu@100a0000 {
649 compatible = "samsung,exynos5420-tmu-ext-triminfo";
650 reg = <0x100a0000 0x100>, <0x10068000 0x4>;
651 interrupts = <0 215 0>;
652 clocks = <&clock 319>, <&clock 318>;
653 clock-names = "tmu_apbif", "tmu_triminfo_apbif";
654 };
313}; 655};
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index 8da107088ce4..02a0a1226cef 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -29,7 +29,7 @@
29 #clock-cells = <1>; 29 #clock-cells = <1>;
30 }; 30 };
31 31
32 gic:interrupt-controller@2E0000 { 32 gic: interrupt-controller@2E0000 {
33 compatible = "arm,cortex-a15-gic"; 33 compatible = "arm,cortex-a15-gic";
34 #interrupt-cells = <3>; 34 #interrupt-cells = <3>;
35 interrupt-controller; 35 interrupt-controller;
diff --git a/arch/arm/boot/dts/hi3620-hi4511.dts b/arch/arm/boot/dts/hi3620-hi4511.dts
new file mode 100644
index 000000000000..fe623928f687
--- /dev/null
+++ b/arch/arm/boot/dts/hi3620-hi4511.dts
@@ -0,0 +1,649 @@
1/*
2 * Copyright (C) 2012-2013 Linaro Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/dts-v1/;
11
12#include "hi3620.dtsi"
13
14/ {
15 model = "Hisilicon Hi4511 Development Board";
16 compatible = "hisilicon,hi3620-hi4511";
17
18 chosen {
19 bootargs = "console=ttyAMA0,115200 root=/dev/ram0 earlyprintk";
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x40000000 0x20000000>;
25 };
26
27 amba {
28 dual_timer0: dual_timer@800000 {
29 status = "ok";
30 };
31
32 uart0: uart@b00000 { /* console */
33 pinctrl-names = "default", "idle";
34 pinctrl-0 = <&uart0_pmx_func &uart0_cfg_func>;
35 pinctrl-1 = <&uart0_pmx_idle &uart0_cfg_idle>;
36 status = "ok";
37 };
38
39 uart1: uart@b01000 { /* modem */
40 pinctrl-names = "default", "idle";
41 pinctrl-0 = <&uart1_pmx_func &uart1_cfg_func>;
42 pinctrl-1 = <&uart1_pmx_idle &uart1_cfg_idle>;
43 status = "ok";
44 };
45
46 uart2: uart@b02000 { /* audience */
47 pinctrl-names = "default", "idle";
48 pinctrl-0 = <&uart2_pmx_func &uart2_cfg_func>;
49 pinctrl-1 = <&uart2_pmx_idle &uart2_cfg_idle>;
50 status = "ok";
51 };
52
53 uart3: uart@b03000 {
54 pinctrl-names = "default", "idle";
55 pinctrl-0 = <&uart3_pmx_func &uart3_cfg_func>;
56 pinctrl-1 = <&uart3_pmx_idle &uart3_cfg_idle>;
57 status = "ok";
58 };
59
60 uart4: uart@b04000 {
61 pinctrl-names = "default", "idle";
62 pinctrl-0 = <&uart4_pmx_func &uart4_cfg_func>;
63 pinctrl-1 = <&uart4_pmx_idle &uart4_cfg_func>;
64 status = "ok";
65 };
66
67 pmx0: pinmux@803000 {
68 pinctrl-names = "default";
69 pinctrl-0 = <&board_pmx_pins>;
70
71 board_pmx_pins: board_pmx_pins {
72 pinctrl-single,pins = <
73 0x008 0x0 /* GPIO -- eFUSE_DOUT */
74 0x100 0x0 /* USIM_CLK & USIM_DATA (IOMG63) */
75 >;
76 };
77 uart0_pmx_func: uart0_pmx_func {
78 pinctrl-single,pins = <
79 0x0f0 0x0
80 0x0f4 0x0 /* UART0_RX & UART0_TX */
81 >;
82 };
83 uart0_pmx_idle: uart0_pmx_idle {
84 pinctrl-single,pins = <
85 /*0x0f0 0x1*/ /* UART0_CTS & UART0_RTS */
86 0x0f4 0x1 /* UART0_RX & UART0_TX */
87 >;
88 };
89 uart1_pmx_func: uart1_pmx_func {
90 pinctrl-single,pins = <
91 0x0f8 0x0 /* UART1_CTS & UART1_RTS (IOMG61) */
92 0x0fc 0x0 /* UART1_RX & UART1_TX (IOMG62) */
93 >;
94 };
95 uart1_pmx_idle: uart1_pmx_idle {
96 pinctrl-single,pins = <
97 0x0f8 0x1 /* GPIO (IOMG61) */
98 0x0fc 0x1 /* GPIO (IOMG62) */
99 >;
100 };
101 uart2_pmx_func: uart2_pmx_func {
102 pinctrl-single,pins = <
103 0x104 0x2 /* UART2_RXD (IOMG96) */
104 0x108 0x2 /* UART2_TXD (IOMG64) */
105 >;
106 };
107 uart2_pmx_idle: uart2_pmx_idle {
108 pinctrl-single,pins = <
109 0x104 0x1 /* GPIO (IOMG96) */
110 0x108 0x1 /* GPIO (IOMG64) */
111 >;
112 };
113 uart3_pmx_func: uart3_pmx_func {
114 pinctrl-single,pins = <
115 0x160 0x2 /* UART3_CTS & UART3_RTS (IOMG85) */
116 0x164 0x2 /* UART3_RXD & UART3_TXD (IOMG86) */
117 >;
118 };
119 uart3_pmx_idle: uart3_pmx_idle {
120 pinctrl-single,pins = <
121 0x160 0x1 /* GPIO (IOMG85) */
122 0x164 0x1 /* GPIO (IOMG86) */
123 >;
124 };
125 uart4_pmx_func: uart4_pmx_func {
126 pinctrl-single,pins = <
127 0x168 0x0 /* UART4_CTS & UART4_RTS (IOMG87) */
128 0x16c 0x0 /* UART4_RXD (IOMG88) */
129 0x170 0x0 /* UART4_TXD (IOMG93) */
130 >;
131 };
132 uart4_pmx_idle: uart4_pmx_idle {
133 pinctrl-single,pins = <
134 0x168 0x1 /* GPIO (IOMG87) */
135 0x16c 0x1 /* GPIO (IOMG88) */
136 0x170 0x1 /* GPIO (IOMG93) */
137 >;
138 };
139 i2c0_pmx_func: i2c0_pmx_func {
140 pinctrl-single,pins = <
141 0x0b4 0x0 /* I2C0_SCL & I2C0_SDA (IOMG45) */
142 >;
143 };
144 i2c0_pmx_idle: i2c0_pmx_idle {
145 pinctrl-single,pins = <
146 0x0b4 0x1 /* GPIO (IOMG45) */
147 >;
148 };
149 i2c1_pmx_func: i2c1_pmx_func {
150 pinctrl-single,pins = <
151 0x0b8 0x0 /* I2C1_SCL & I2C1_SDA (IOMG46) */
152 >;
153 };
154 i2c1_pmx_idle: i2c1_pmx_idle {
155 pinctrl-single,pins = <
156 0x0b8 0x1 /* GPIO (IOMG46) */
157 >;
158 };
159 i2c2_pmx_func: i2c2_pmx_func {
160 pinctrl-single,pins = <
161 0x068 0x0 /* I2C2_SCL (IOMG26) */
162 0x06c 0x0 /* I2C2_SDA (IOMG27) */
163 >;
164 };
165 i2c2_pmx_idle: i2c2_pmx_idle {
166 pinctrl-single,pins = <
167 0x068 0x1 /* GPIO (IOMG26) */
168 0x06c 0x1 /* GPIO (IOMG27) */
169 >;
170 };
171 i2c3_pmx_func: i2c3_pmx_func {
172 pinctrl-single,pins = <
173 0x050 0x2 /* I2C3_SCL (IOMG20) */
174 0x054 0x2 /* I2C3_SDA (IOMG21) */
175 >;
176 };
177 i2c3_pmx_idle: i2c3_pmx_idle {
178 pinctrl-single,pins = <
179 0x050 0x1 /* GPIO (IOMG20) */
180 0x054 0x1 /* GPIO (IOMG21) */
181 >;
182 };
183 spi0_pmx_func: spi0_pmx_func {
184 pinctrl-single,pins = <
185 0x0d4 0x0 /* SPI0_CLK/SPI0_DI/SPI0_DO (IOMG53) */
186 0x0d8 0x0 /* SPI0_CS0 (IOMG54) */
187 0x0dc 0x0 /* SPI0_CS1 (IOMG55) */
188 0x0e0 0x0 /* SPI0_CS2 (IOMG56) */
189 0x0e4 0x0 /* SPI0_CS3 (IOMG57) */
190 >;
191 };
192 spi0_pmx_idle: spi0_pmx_idle {
193 pinctrl-single,pins = <
194 0x0d4 0x1 /* GPIO (IOMG53) */
195 0x0d8 0x1 /* GPIO (IOMG54) */
196 0x0dc 0x1 /* GPIO (IOMG55) */
197 0x0e0 0x1 /* GPIO (IOMG56) */
198 0x0e4 0x1 /* GPIO (IOMG57) */
199 >;
200 };
201 spi1_pmx_func: spi1_pmx_func {
202 pinctrl-single,pins = <
203 0x184 0x0 /* SPI1_CLK/SPI1_DI (IOMG98) */
204 0x0e8 0x0 /* SPI1_DO (IOMG58) */
205 0x0ec 0x0 /* SPI1_CS (IOMG95) */
206 >;
207 };
208 spi1_pmx_idle: spi1_pmx_idle {
209 pinctrl-single,pins = <
210 0x184 0x1 /* GPIO (IOMG98) */
211 0x0e8 0x1 /* GPIO (IOMG58) */
212 0x0ec 0x1 /* GPIO (IOMG95) */
213 >;
214 };
215 kpc_pmx_func: kpc_pmx_func {
216 pinctrl-single,pins = <
217 0x12c 0x0 /* KEY_IN0 (IOMG73) */
218 0x130 0x0 /* KEY_IN1 (IOMG74) */
219 0x134 0x0 /* KEY_IN2 (IOMG75) */
220 0x10c 0x0 /* KEY_OUT0 (IOMG65) */
221 0x110 0x0 /* KEY_OUT1 (IOMG66) */
222 0x114 0x0 /* KEY_OUT2 (IOMG67) */
223 >;
224 };
225 kpc_pmx_idle: kpc_pmx_idle {
226 pinctrl-single,pins = <
227 0x12c 0x1 /* GPIO (IOMG73) */
228 0x130 0x1 /* GPIO (IOMG74) */
229 0x134 0x1 /* GPIO (IOMG75) */
230 0x10c 0x1 /* GPIO (IOMG65) */
231 0x110 0x1 /* GPIO (IOMG66) */
232 0x114 0x1 /* GPIO (IOMG67) */
233 >;
234 };
235 gpio_key_func: gpio_key_func {
236 pinctrl-single,pins = <
237 0x10c 0x1 /* KEY_OUT0/GPIO (IOMG65) */
238 0x130 0x1 /* KEY_IN1/GPIO (IOMG74) */
239 >;
240 };
241 emmc_pmx_func: emmc_pmx_func {
242 pinctrl-single,pins = <
243 0x030 0x2 /* eMMC_CMD/eMMC_CLK (IOMG12) */
244 0x018 0x0 /* NAND_CS3_N (IOMG6) */
245 0x024 0x0 /* NAND_BUSY2_N (IOMG8) */
246 0x028 0x0 /* NAND_BUSY3_N (IOMG9) */
247 0x02c 0x2 /* eMMC_DATA[0:7] (IOMG10) */
248 >;
249 };
250 emmc_pmx_idle: emmc_pmx_idle {
251 pinctrl-single,pins = <
252 0x030 0x0 /* GPIO (IOMG12) */
253 0x018 0x1 /* GPIO (IOMG6) */
254 0x024 0x1 /* GPIO (IOMG8) */
255 0x028 0x1 /* GPIO (IOMG9) */
256 0x02c 0x1 /* GPIO (IOMG10) */
257 >;
258 };
259 sd_pmx_func: sd_pmx_func {
260 pinctrl-single,pins = <
261 0x0bc 0x0 /* SD_CLK/SD_CMD/SD_DATA0/SD_DATA1/SD_DATA2 (IOMG47) */
262 0x0c0 0x0 /* SD_DATA3 (IOMG48) */
263 >;
264 };
265 sd_pmx_idle: sd_pmx_idle {
266 pinctrl-single,pins = <
267 0x0bc 0x1 /* GPIO (IOMG47) */
268 0x0c0 0x1 /* GPIO (IOMG48) */
269 >;
270 };
271 nand_pmx_func: nand_pmx_func {
272 pinctrl-single,pins = <
273 0x00c 0x0 /* NAND_ALE/NAND_CLE/.../NAND_DATA[0:7] (IOMG3) */
274 0x010 0x0 /* NAND_CS1_N (IOMG4) */
275 0x014 0x0 /* NAND_CS2_N (IOMG5) */
276 0x018 0x0 /* NAND_CS3_N (IOMG6) */
277 0x01c 0x0 /* NAND_BUSY0_N (IOMG94) */
278 0x020 0x0 /* NAND_BUSY1_N (IOMG7) */
279 0x024 0x0 /* NAND_BUSY2_N (IOMG8) */
280 0x028 0x0 /* NAND_BUSY3_N (IOMG9) */
281 0x02c 0x0 /* NAND_DATA[8:15] (IOMG10) */
282 >;
283 };
284 nand_pmx_idle: nand_pmx_idle {
285 pinctrl-single,pins = <
286 0x00c 0x1 /* GPIO (IOMG3) */
287 0x010 0x1 /* GPIO (IOMG4) */
288 0x014 0x1 /* GPIO (IOMG5) */
289 0x018 0x1 /* GPIO (IOMG6) */
290 0x01c 0x1 /* GPIO (IOMG94) */
291 0x020 0x1 /* GPIO (IOMG7) */
292 0x024 0x1 /* GPIO (IOMG8) */
293 0x028 0x1 /* GPIO (IOMG9) */
294 0x02c 0x1 /* GPIO (IOMG10) */
295 >;
296 };
297 sdio_pmx_func: sdio_pmx_func {
298 pinctrl-single,pins = <
299 0x0c4 0x0 /* SDIO_CLK/SDIO_CMD/SDIO_DATA[0:3] (IOMG49) */
300 >;
301 };
302 sdio_pmx_idle: sdio_pmx_idle {
303 pinctrl-single,pins = <
304 0x0c4 0x1 /* GPIO (IOMG49) */
305 >;
306 };
307 audio_out_pmx_func: audio_out_pmx_func {
308 pinctrl-single,pins = <
309 0x0f0 0x1 /* GPIO (IOMG59), audio spk & earphone */
310 >;
311 };
312 };
313
314 pmx1: pinmux@803800 {
315 pinctrl-names = "default";
316 pinctrl-0 = < &board_pu_pins &board_pd_pins &board_pd_ps_pins
317 &board_np_pins &board_ps_pins &kpc_cfg_func
318 &audio_out_cfg_func>;
319 board_pu_pins: board_pu_pins {
320 pinctrl-single,pins = <
321 0x014 0 /* GPIO_158 (IOCFG2) */
322 0x018 0 /* GPIO_159 (IOCFG3) */
323 0x01c 0 /* BOOT_MODE0 (IOCFG4) */
324 0x020 0 /* BOOT_MODE1 (IOCFG5) */
325 >;
326 pinctrl-single,bias-pulldown = <0 2 0 2>;
327 pinctrl-single,bias-pullup = <1 1 0 1>;
328 };
329 board_pd_pins: board_pd_pins {
330 pinctrl-single,pins = <
331 0x038 0 /* eFUSE_DOUT (IOCFG11) */
332 0x150 0 /* ISP_GPIO8 (IOCFG93) */
333 0x154 0 /* ISP_GPIO9 (IOCFG94) */
334 >;
335 pinctrl-single,bias-pulldown = <2 2 0 2>;
336 pinctrl-single,bias-pullup = <0 1 0 1>;
337 };
338 board_pd_ps_pins: board_pd_ps_pins {
339 pinctrl-single,pins = <
340 0x2d8 0 /* CLK_OUT0 (IOCFG190) */
341 0x004 0 /* PMU_SPI_DATA (IOCFG192) */
342 >;
343 pinctrl-single,bias-pulldown = <2 2 0 2>;
344 pinctrl-single,bias-pullup = <0 1 0 1>;
345 pinctrl-single,drive-strength = <0x30 0xf0>;
346 };
347 board_np_pins: board_np_pins {
348 pinctrl-single,pins = <
349 0x24c 0 /* KEYPAD_OUT7 (IOCFG155) */
350 >;
351 pinctrl-single,bias-pulldown = <0 2 0 2>;
352 pinctrl-single,bias-pullup = <0 1 0 1>;
353 };
354 board_ps_pins: board_ps_pins {
355 pinctrl-single,pins = <
356 0x000 0 /* PMU_SPI_CLK (IOCFG191) */
357 0x008 0 /* PMU_SPI_CS_N (IOCFG193) */
358 >;
359 pinctrl-single,drive-strength = <0x30 0xf0>;
360 };
361 uart0_cfg_func: uart0_cfg_func {
362 pinctrl-single,pins = <
363 0x208 0 /* UART0_RXD (IOCFG138) */
364 0x20c 0 /* UART0_TXD (IOCFG139) */
365 >;
366 pinctrl-single,bias-pulldown = <0 2 0 2>;
367 pinctrl-single,bias-pullup = <0 1 0 1>;
368 };
369 uart0_cfg_idle: uart0_cfg_idle {
370 pinctrl-single,pins = <
371 0x208 0 /* UART0_RXD (IOCFG138) */
372 0x20c 0 /* UART0_TXD (IOCFG139) */
373 >;
374 pinctrl-single,bias-pulldown = <2 2 0 2>;
375 pinctrl-single,bias-pullup = <0 1 0 1>;
376 };
377 uart1_cfg_func: uart1_cfg_func {
378 pinctrl-single,pins = <
379 0x210 0 /* UART1_CTS (IOCFG140) */
380 0x214 0 /* UART1_RTS (IOCFG141) */
381 0x218 0 /* UART1_RXD (IOCFG142) */
382 0x21c 0 /* UART1_TXD (IOCFG143) */
383 >;
384 pinctrl-single,bias-pulldown = <0 2 0 2>;
385 pinctrl-single,bias-pullup = <0 1 0 1>;
386 };
387 uart1_cfg_idle: uart1_cfg_idle {
388 pinctrl-single,pins = <
389 0x210 0 /* UART1_CTS (IOCFG140) */
390 0x214 0 /* UART1_RTS (IOCFG141) */
391 0x218 0 /* UART1_RXD (IOCFG142) */
392 0x21c 0 /* UART1_TXD (IOCFG143) */
393 >;
394 pinctrl-single,bias-pulldown = <2 2 0 2>;
395 pinctrl-single,bias-pullup = <0 1 0 1>;
396 };
397 uart2_cfg_func: uart2_cfg_func {
398 pinctrl-single,pins = <
399 0x220 0 /* UART2_CTS (IOCFG144) */
400 0x224 0 /* UART2_RTS (IOCFG145) */
401 0x228 0 /* UART2_RXD (IOCFG146) */
402 0x22c 0 /* UART2_TXD (IOCFG147) */
403 >;
404 pinctrl-single,bias-pulldown = <0 2 0 2>;
405 pinctrl-single,bias-pullup = <0 1 0 1>;
406 };
407 uart2_cfg_idle: uart2_cfg_idle {
408 pinctrl-single,pins = <
409 0x220 0 /* GPIO (IOCFG144) */
410 0x224 0 /* GPIO (IOCFG145) */
411 0x228 0 /* GPIO (IOCFG146) */
412 0x22c 0 /* GPIO (IOCFG147) */
413 >;
414 pinctrl-single,bias-pulldown = <2 2 0 2>;
415 pinctrl-single,bias-pullup = <0 1 0 1>;
416 };
417 uart3_cfg_func: uart3_cfg_func {
418 pinctrl-single,pins = <
419 0x294 0 /* UART3_CTS (IOCFG173) */
420 0x298 0 /* UART3_RTS (IOCFG174) */
421 0x29c 0 /* UART3_RXD (IOCFG175) */
422 0x2a0 0 /* UART3_TXD (IOCFG176) */
423 >;
424 pinctrl-single,bias-pulldown = <0 2 0 2>;
425 pinctrl-single,bias-pullup = <0 1 0 1>;
426 };
427 uart3_cfg_idle: uart3_cfg_idle {
428 pinctrl-single,pins = <
429 0x294 0 /* UART3_CTS (IOCFG173) */
430 0x298 0 /* UART3_RTS (IOCFG174) */
431 0x29c 0 /* UART3_RXD (IOCFG175) */
432 0x2a0 0 /* UART3_TXD (IOCFG176) */
433 >;
434 pinctrl-single,bias-pulldown = <2 2 0 2>;
435 pinctrl-single,bias-pullup = <0 1 0 1>;
436 };
437 uart4_cfg_func: uart4_cfg_func {
438 pinctrl-single,pins = <
439 0x2a4 0 /* UART4_CTS (IOCFG177) */
440 0x2a8 0 /* UART4_RTS (IOCFG178) */
441 0x2ac 0 /* UART4_RXD (IOCFG179) */
442 0x2b0 0 /* UART4_TXD (IOCFG180) */
443 >;
444 pinctrl-single,bias-pulldown = <0 2 0 2>;
445 pinctrl-single,bias-pullup = <0 1 0 1>;
446 };
447 i2c0_cfg_func: i2c0_cfg_func {
448 pinctrl-single,pins = <
449 0x17c 0 /* I2C0_SCL (IOCFG103) */
450 0x180 0 /* I2C0_SDA (IOCFG104) */
451 >;
452 pinctrl-single,bias-pulldown = <0 2 0 2>;
453 pinctrl-single,bias-pullup = <0 1 0 1>;
454 pinctrl-single,drive-strength = <0x30 0xf0>;
455 };
456 i2c1_cfg_func: i2c1_cfg_func {
457 pinctrl-single,pins = <
458 0x184 0 /* I2C1_SCL (IOCFG105) */
459 0x188 0 /* I2C1_SDA (IOCFG106) */
460 >;
461 pinctrl-single,bias-pulldown = <0 2 0 2>;
462 pinctrl-single,bias-pullup = <0 1 0 1>;
463 pinctrl-single,drive-strength = <0x30 0xf0>;
464 };
465 i2c2_cfg_func: i2c2_cfg_func {
466 pinctrl-single,pins = <
467 0x118 0 /* I2C2_SCL (IOCFG79) */
468 0x11c 0 /* I2C2_SDA (IOCFG80) */
469 >;
470 pinctrl-single,bias-pulldown = <0 2 0 2>;
471 pinctrl-single,bias-pullup = <0 1 0 1>;
472 pinctrl-single,drive-strength = <0x30 0xf0>;
473 };
474 i2c3_cfg_func: i2c3_cfg_func {
475 pinctrl-single,pins = <
476 0x100 0 /* I2C3_SCL (IOCFG73) */
477 0x104 0 /* I2C3_SDA (IOCFG74) */
478 >;
479 pinctrl-single,bias-pulldown = <0 2 0 2>;
480 pinctrl-single,bias-pullup = <0 1 0 1>;
481 pinctrl-single,drive-strength = <0x30 0xf0>;
482 };
483 spi0_cfg_func1: spi0_cfg_func1 {
484 pinctrl-single,pins = <
485 0x1d4 0 /* SPI0_CLK (IOCFG125) */
486 0x1d8 0 /* SPI0_DI (IOCFG126) */
487 0x1dc 0 /* SPI0_DO (IOCFG127) */
488 >;
489 pinctrl-single,bias-pulldown = <2 2 0 2>;
490 pinctrl-single,bias-pullup = <0 1 0 1>;
491 pinctrl-single,drive-strength = <0x30 0xf0>;
492 };
493 spi0_cfg_func2: spi0_cfg_func2 {
494 pinctrl-single,pins = <
495 0x1e0 0 /* SPI0_CS0 (IOCFG128) */
496 0x1e4 0 /* SPI0_CS1 (IOCFG129) */
497 0x1e8 0 /* SPI0_CS2 (IOCFG130 */
498 0x1ec 0 /* SPI0_CS3 (IOCFG131) */
499 >;
500 pinctrl-single,bias-pulldown = <0 2 0 2>;
501 pinctrl-single,bias-pullup = <1 1 0 1>;
502 pinctrl-single,drive-strength = <0x30 0xf0>;
503 };
504 spi1_cfg_func1: spi1_cfg_func1 {
505 pinctrl-single,pins = <
506 0x1f0 0 /* SPI1_CLK (IOCFG132) */
507 0x1f4 0 /* SPI1_DI (IOCFG133) */
508 0x1f8 0 /* SPI1_DO (IOCFG134) */
509 >;
510 pinctrl-single,bias-pulldown = <2 2 0 2>;
511 pinctrl-single,bias-pullup = <0 1 0 1>;
512 pinctrl-single,drive-strength = <0x30 0xf0>;
513 };
514 spi1_cfg_func2: spi1_cfg_func2 {
515 pinctrl-single,pins = <
516 0x1fc 0 /* SPI1_CS (IOCFG135) */
517 >;
518 pinctrl-single,bias-pulldown = <0 2 0 2>;
519 pinctrl-single,bias-pullup = <1 1 0 1>;
520 pinctrl-single,drive-strength = <0x30 0xf0>;
521 };
522 kpc_cfg_func: kpc_cfg_func {
523 pinctrl-single,pins = <
524 0x250 0 /* KEY_IN0 (IOCFG156) */
525 0x254 0 /* KEY_IN1 (IOCFG157) */
526 0x258 0 /* KEY_IN2 (IOCFG158) */
527 0x230 0 /* KEY_OUT0 (IOCFG148) */
528 0x234 0 /* KEY_OUT1 (IOCFG149) */
529 0x238 0 /* KEY_OUT2 (IOCFG150) */
530 >;
531 pinctrl-single,bias-pulldown = <2 2 0 2>;
532 pinctrl-single,bias-pullup = <0 1 0 1>;
533 };
534 emmc_cfg_func: emmc_cfg_func {
535 pinctrl-single,pins = <
536 0x0ac 0 /* eMMC_CMD (IOCFG40) */
537 0x0b0 0 /* eMMC_CLK (IOCFG41) */
538 0x058 0 /* NAND_CS3_N (IOCFG19) */
539 0x064 0 /* NAND_BUSY2_N (IOCFG22) */
540 0x068 0 /* NAND_BUSY3_N (IOCFG23) */
541 0x08c 0 /* NAND_DATA8 (IOCFG32) */
542 0x090 0 /* NAND_DATA9 (IOCFG33) */
543 0x094 0 /* NAND_DATA10 (IOCFG34) */
544 0x098 0 /* NAND_DATA11 (IOCFG35) */
545 0x09c 0 /* NAND_DATA12 (IOCFG36) */
546 0x0a0 0 /* NAND_DATA13 (IOCFG37) */
547 0x0a4 0 /* NAND_DATA14 (IOCFG38) */
548 0x0a8 0 /* NAND_DATA15 (IOCFG39) */
549 >;
550 pinctrl-single,bias-pulldown = <0 2 0 2>;
551 pinctrl-single,bias-pullup = <1 1 0 1>;
552 pinctrl-single,drive-strength = <0x30 0xf0>;
553 };
554 sd_cfg_func1: sd_cfg_func1 {
555 pinctrl-single,pins = <
556 0x18c 0 /* SD_CLK (IOCFG107) */
557 0x190 0 /* SD_CMD (IOCFG108) */
558 >;
559 pinctrl-single,bias-pulldown = <2 2 0 2>;
560 pinctrl-single,bias-pullup = <0 1 0 1>;
561 pinctrl-single,drive-strength = <0x30 0xf0>;
562 };
563 sd_cfg_func2: sd_cfg_func2 {
564 pinctrl-single,pins = <
565 0x194 0 /* SD_DATA0 (IOCFG109) */
566 0x198 0 /* SD_DATA1 (IOCFG110) */
567 0x19c 0 /* SD_DATA2 (IOCFG111) */
568 0x1a0 0 /* SD_DATA3 (IOCFG112) */
569 >;
570 pinctrl-single,bias-pulldown = <2 2 0 2>;
571 pinctrl-single,bias-pullup = <0 1 0 1>;
572 pinctrl-single,drive-strength = <0x70 0xf0>;
573 };
574 nand_cfg_func1: nand_cfg_func1 {
575 pinctrl-single,pins = <
576 0x03c 0 /* NAND_ALE (IOCFG12) */
577 0x040 0 /* NAND_CLE (IOCFG13) */
578 0x06c 0 /* NAND_DATA0 (IOCFG24) */
579 0x070 0 /* NAND_DATA1 (IOCFG25) */
580 0x074 0 /* NAND_DATA2 (IOCFG26) */
581 0x078 0 /* NAND_DATA3 (IOCFG27) */
582 0x07c 0 /* NAND_DATA4 (IOCFG28) */
583 0x080 0 /* NAND_DATA5 (IOCFG29) */
584 0x084 0 /* NAND_DATA6 (IOCFG30) */
585 0x088 0 /* NAND_DATA7 (IOCFG31) */
586 0x08c 0 /* NAND_DATA8 (IOCFG32) */
587 0x090 0 /* NAND_DATA9 (IOCFG33) */
588 0x094 0 /* NAND_DATA10 (IOCFG34) */
589 0x098 0 /* NAND_DATA11 (IOCFG35) */
590 0x09c 0 /* NAND_DATA12 (IOCFG36) */
591 0x0a0 0 /* NAND_DATA13 (IOCFG37) */
592 0x0a4 0 /* NAND_DATA14 (IOCFG38) */
593 0x0a8 0 /* NAND_DATA15 (IOCFG39) */
594 >;
595 pinctrl-single,bias-pulldown = <2 2 0 2>;
596 pinctrl-single,bias-pullup = <0 1 0 1>;
597 pinctrl-single,drive-strength = <0x30 0xf0>;
598 };
599 nand_cfg_func2: nand_cfg_func2 {
600 pinctrl-single,pins = <
601 0x044 0 /* NAND_RE_N (IOCFG14) */
602 0x048 0 /* NAND_WE_N (IOCFG15) */
603 0x04c 0 /* NAND_CS0_N (IOCFG16) */
604 0x050 0 /* NAND_CS1_N (IOCFG17) */
605 0x054 0 /* NAND_CS2_N (IOCFG18) */
606 0x058 0 /* NAND_CS3_N (IOCFG19) */
607 0x05c 0 /* NAND_BUSY0_N (IOCFG20) */
608 0x060 0 /* NAND_BUSY1_N (IOCFG21) */
609 0x064 0 /* NAND_BUSY2_N (IOCFG22) */
610 0x068 0 /* NAND_BUSY3_N (IOCFG23) */
611 >;
612 pinctrl-single,bias-pulldown = <0 2 0 2>;
613 pinctrl-single,bias-pullup = <1 1 0 1>;
614 pinctrl-single,drive-strength = <0x30 0xf0>;
615 };
616 sdio_cfg_func: sdio_cfg_func {
617 pinctrl-single,pins = <
618 0x1a4 0 /* SDIO0_CLK (IOCG113) */
619 0x1a8 0 /* SDIO0_CMD (IOCG114) */
620 0x1ac 0 /* SDIO0_DATA0 (IOCG115) */
621 0x1b0 0 /* SDIO0_DATA1 (IOCG116) */
622 0x1b4 0 /* SDIO0_DATA2 (IOCG117) */
623 0x1b8 0 /* SDIO0_DATA3 (IOCG118) */
624 >;
625 pinctrl-single,bias-pulldown = <2 2 0 2>;
626 pinctrl-single,bias-pullup = <0 1 0 1>;
627 pinctrl-single,drive-strength = <0x30 0xf0>;
628 };
629 audio_out_cfg_func: audio_out_cfg_func {
630 pinctrl-single,pins = <
631 0x200 0 /* GPIO (IOCFG136) */
632 0x204 0 /* GPIO (IOCFG137) */
633 >;
634 pinctrl-single,bias-pulldown = <2 2 0 2>;
635 pinctrl-single,bias-pullup = <0 1 0 1>;
636 };
637 };
638 };
639
640 gpio-keys {
641 compatible = "gpio-keys";
642
643 call {
644 label = "call";
645 gpios = <&gpio17 2 0>;
646 linux,code = <169>; /* KEY_PHONE */
647 };
648 };
649};
diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi
new file mode 100644
index 000000000000..ab1116d086be
--- /dev/null
+++ b/arch/arm/boot/dts/hi3620.dtsi
@@ -0,0 +1,565 @@
1/*
2 * Hisilicon Ltd. Hi3620 SoC
3 *
4 * Copyright (C) 2012-2013 Hisilicon Ltd.
5 * Copyright (C) 2012-2013 Linaro Ltd.
6 *
7 * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * publishhed by the Free Software Foundation.
12 */
13
14#include "skeleton.dtsi"
15#include <dt-bindings/clock/hi3620-clock.h>
16
17/ {
18 aliases {
19 serial0 = &uart0;
20 serial1 = &uart1;
21 serial2 = &uart2;
22 serial3 = &uart3;
23 serial4 = &uart4;
24 };
25
26 pclk: clk {
27 compatible = "fixed-clock";
28 #clock-cells = <0>;
29 clock-frequency = <26000000>;
30 clock-output-names = "apb_pclk";
31 };
32
33 cpus {
34 #address-cells = <1>;
35 #size-cells = <0>;
36
37 cpu@0 {
38 device_type = "cpu";
39 compatible = "arm,cortex-a9";
40 reg = <0x0>;
41 next-level-cache = <&L2>;
42 };
43
44 cpu@1 {
45 compatible = "arm,cortex-a9";
46 device_type = "cpu";
47 reg = <1>;
48 next-level-cache = <&L2>;
49 };
50
51 cpu@2 {
52 compatible = "arm,cortex-a9";
53 device_type = "cpu";
54 reg = <2>;
55 next-level-cache = <&L2>;
56 };
57
58 cpu@3 {
59 compatible = "arm,cortex-a9";
60 device_type = "cpu";
61 reg = <3>;
62 next-level-cache = <&L2>;
63 };
64 };
65
66 amba {
67
68 #address-cells = <1>;
69 #size-cells = <1>;
70 compatible = "arm,amba-bus";
71 interrupt-parent = <&gic>;
72 ranges = <0 0xfc000000 0x2000000>;
73
74 L2: l2-cache {
75 compatible = "arm,pl310-cache";
76 reg = <0xfc10000 0x100000>;
77 interrupts = <0 15 4>;
78 cache-unified;
79 cache-level = <2>;
80 };
81
82 gic: interrupt-controller@1000 {
83 compatible = "arm,cortex-a9-gic";
84 #interrupt-cells = <3>;
85 #address-cells = <0>;
86 interrupt-controller;
87 /* gic dist base, gic cpu base */
88 reg = <0x1000 0x1000>, <0x100 0x100>;
89 };
90
91 sysctrl: system-controller@802000 {
92 compatible = "hisilicon,sysctrl";
93 #address-cells = <1>;
94 #size-cells = <1>;
95 ranges = <0 0x802000 0x1000>;
96 reg = <0x802000 0x1000>;
97
98 smp-offset = <0x31c>;
99 resume-offset = <0x308>;
100 reboot-offset = <0x4>;
101
102 clock: clock@0 {
103 compatible = "hisilicon,hi3620-clock";
104 reg = <0 0x10000>;
105 #clock-cells = <1>;
106 };
107 };
108
109 dual_timer0: dual_timer@800000 {
110 compatible = "arm,sp804", "arm,primecell";
111 reg = <0x800000 0x1000>;
112 /* timer00 & timer01 */
113 interrupts = <0 0 4>, <0 1 4>;
114 clocks = <&clock HI3620_TIMER0_MUX>, <&clock HI3620_TIMER1_MUX>;
115 clock-names = "apb_pclk";
116 status = "disabled";
117 };
118
119 dual_timer1: dual_timer@801000 {
120 compatible = "arm,sp804", "arm,primecell";
121 reg = <0x801000 0x1000>;
122 /* timer10 & timer11 */
123 interrupts = <0 2 4>, <0 3 4>;
124 clocks = <&clock HI3620_TIMER2_MUX>, <&clock HI3620_TIMER3_MUX>;
125 clock-names = "apb_pclk";
126 status = "disabled";
127 };
128
129 dual_timer2: dual_timer@a01000 {
130 compatible = "arm,sp804", "arm,primecell";
131 reg = <0xa01000 0x1000>;
132 /* timer20 & timer21 */
133 interrupts = <0 4 4>, <0 5 4>;
134 clocks = <&clock HI3620_TIMER4_MUX>, <&clock HI3620_TIMER5_MUX>;
135 clock-names = "apb_pclk";
136 status = "disabled";
137 };
138
139 dual_timer3: dual_timer@a02000 {
140 compatible = "arm,sp804", "arm,primecell";
141 reg = <0xa02000 0x1000>;
142 /* timer30 & timer31 */
143 interrupts = <0 6 4>, <0 7 4>;
144 clocks = <&clock HI3620_TIMER6_MUX>, <&clock HI3620_TIMER7_MUX>;
145 clock-names = "apb_pclk";
146 status = "disabled";
147 };
148
149 dual_timer4: dual_timer@a03000 {
150 compatible = "arm,sp804", "arm,primecell";
151 reg = <0xa03000 0x1000>;
152 /* timer40 & timer41 */
153 interrupts = <0 96 4>, <0 97 4>;
154 clocks = <&clock HI3620_TIMER8_MUX>, <&clock HI3620_TIMER9_MUX>;
155 clock-names = "apb_pclk";
156 status = "disabled";
157 };
158
159 timer5: timer@600 {
160 compatible = "arm,cortex-a9-twd-timer";
161 reg = <0x600 0x20>;
162 interrupts = <1 13 0xf01>;
163 };
164
165 uart0: uart@b00000 {
166 compatible = "arm,pl011", "arm,primecell";
167 reg = <0xb00000 0x1000>;
168 interrupts = <0 20 4>;
169 clocks = <&clock HI3620_UARTCLK0>;
170 clock-names = "apb_pclk";
171 status = "disabled";
172 };
173
174 uart1: uart@b01000 {
175 compatible = "arm,pl011", "arm,primecell";
176 reg = <0xb01000 0x1000>;
177 interrupts = <0 21 4>;
178 clocks = <&clock HI3620_UARTCLK1>;
179 clock-names = "apb_pclk";
180 status = "disabled";
181 };
182
183 uart2: uart@b02000 {
184 compatible = "arm,pl011", "arm,primecell";
185 reg = <0xb02000 0x1000>;
186 interrupts = <0 22 4>;
187 clocks = <&clock HI3620_UARTCLK2>;
188 clock-names = "apb_pclk";
189 status = "disabled";
190 };
191
192 uart3: uart@b03000 {
193 compatible = "arm,pl011", "arm,primecell";
194 reg = <0xb03000 0x1000>;
195 interrupts = <0 23 4>;
196 clocks = <&clock HI3620_UARTCLK3>;
197 clock-names = "apb_pclk";
198 status = "disabled";
199 };
200
201 uart4: uart@b04000 {
202 compatible = "arm,pl011", "arm,primecell";
203 reg = <0xb04000 0x1000>;
204 interrupts = <0 24 4>;
205 clocks = <&clock HI3620_UARTCLK4>;
206 clock-names = "apb_pclk";
207 status = "disabled";
208 };
209
210 gpio0: gpio@806000 {
211 compatible = "arm,pl061", "arm,primecell";
212 reg = <0x806000 0x1000>;
213 interrupts = <0 64 0x4>;
214 gpio-controller;
215 #gpio-cells = <2>;
216 gpio-ranges = < &pmx0 2 0 1 &pmx0 3 0 1 &pmx0 4 0 1
217 &pmx0 5 0 1 &pmx0 6 1 1 &pmx0 7 2 1>;
218 interrupt-controller;
219 #interrupt-cells = <2>;
220 clocks = <&clock HI3620_GPIOCLK0>;
221 clock-names = "apb_pclk";
222 };
223
224 gpio1: gpio@807000 {
225 compatible = "arm,pl061", "arm,primecell";
226 reg = <0x807000 0x1000>;
227 interrupts = <0 65 0x4>;
228 gpio-controller;
229 #gpio-cells = <2>;
230 gpio-ranges = < &pmx0 0 3 1 &pmx0 1 3 1 &pmx0 2 3 1
231 &pmx0 3 3 1 &pmx0 4 3 1 &pmx0 5 4 1
232 &pmx0 6 5 1 &pmx0 7 6 1>;
233 interrupt-controller;
234 #interrupt-cells = <2>;
235 clocks = <&clock HI3620_GPIOCLK1>;
236 clock-names = "apb_pclk";
237 };
238
239 gpio2: gpio@808000 {
240 compatible = "arm,pl061", "arm,primecell";
241 reg = <0x808000 0x1000>;
242 interrupts = <0 66 0x4>;
243 gpio-controller;
244 #gpio-cells = <2>;
245 gpio-ranges = < &pmx0 0 7 1 &pmx0 1 8 1 &pmx0 2 9 1
246 &pmx0 3 10 1 &pmx0 4 3 1 &pmx0 5 3 1
247 &pmx0 6 3 1 &pmx0 7 3 1>;
248 interrupt-controller;
249 #interrupt-cells = <2>;
250 clocks = <&clock HI3620_GPIOCLK2>;
251 clock-names = "apb_pclk";
252 };
253
254 gpio3: gpio@809000 {
255 compatible = "arm,pl061", "arm,primecell";
256 reg = <0x809000 0x1000>;
257 interrupts = <0 67 0x4>;
258 gpio-controller;
259 #gpio-cells = <2>;
260 gpio-ranges = < &pmx0 0 3 1 &pmx0 1 3 1 &pmx0 2 3 1
261 &pmx0 3 3 1 &pmx0 4 11 1 &pmx0 5 11 1
262 &pmx0 6 11 1 &pmx0 7 11 1>;
263 interrupt-controller;
264 #interrupt-cells = <2>;
265 clocks = <&clock HI3620_GPIOCLK3>;
266 clock-names = "apb_pclk";
267 };
268
269 gpio4: gpio@80a000 {
270 compatible = "arm,pl061", "arm,primecell";
271 reg = <0x80a000 0x1000>;
272 interrupts = <0 68 0x4>;
273 gpio-controller;
274 #gpio-cells = <2>;
275 gpio-ranges = < &pmx0 0 11 1 &pmx0 1 11 1 &pmx0 2 11 1
276 &pmx0 3 11 1 &pmx0 4 12 1 &pmx0 5 12 1
277 &pmx0 6 13 1 &pmx0 7 13 1>;
278 interrupt-controller;
279 #interrupt-cells = <2>;
280 clocks = <&clock HI3620_GPIOCLK4>;
281 clock-names = "apb_pclk";
282 };
283
284 gpio5: gpio@80b000 {
285 compatible = "arm,pl061", "arm,primecell";
286 reg = <0x80b000 0x1000>;
287 interrupts = <0 69 0x4>;
288 gpio-controller;
289 #gpio-cells = <2>;
290 gpio-ranges = < &pmx0 0 14 1 &pmx0 1 15 1 &pmx0 2 16 1
291 &pmx0 3 16 1 &pmx0 4 16 1 &pmx0 5 16 1
292 &pmx0 6 16 1 &pmx0 7 16 1>;
293 interrupt-controller;
294 #interrupt-cells = <2>;
295 clocks = <&clock HI3620_GPIOCLK5>;
296 clock-names = "apb_pclk";
297 };
298
299 gpio6: gpio@80c000 {
300 compatible = "arm,pl061", "arm,primecell";
301 reg = <0x80c000 0x1000>;
302 interrupts = <0 70 0x4>;
303 gpio-controller;
304 #gpio-cells = <2>;
305 gpio-ranges = < &pmx0 0 16 1 &pmx0 1 16 1 &pmx0 2 17 1
306 &pmx0 3 17 1 &pmx0 4 18 1 &pmx0 5 18 1
307 &pmx0 6 18 1 &pmx0 7 19 1>;
308 interrupt-controller;
309 #interrupt-cells = <2>;
310 clocks = <&clock HI3620_GPIOCLK6>;
311 clock-names = "apb_pclk";
312 };
313
314 gpio7: gpio@80d000 {
315 compatible = "arm,pl061", "arm,primecell";
316 reg = <0x80d000 0x1000>;
317 interrupts = <0 71 0x4>;
318 gpio-controller;
319 #gpio-cells = <2>;
320 gpio-ranges = < &pmx0 0 19 1 &pmx0 1 20 1 &pmx0 2 21 1
321 &pmx0 3 22 1 &pmx0 4 23 1 &pmx0 5 24 1
322 &pmx0 6 25 1 &pmx0 7 26 1>;
323 interrupt-controller;
324 #interrupt-cells = <2>;
325 clocks = <&clock HI3620_GPIOCLK7>;
326 clock-names = "apb_pclk";
327 };
328
329 gpio8: gpio@80e000 {
330 compatible = "arm,pl061", "arm,primecell";
331 reg = <0x80e000 0x1000>;
332 interrupts = <0 72 0x4>;
333 gpio-controller;
334 #gpio-cells = <2>;
335 gpio-ranges = < &pmx0 0 27 1 &pmx0 1 28 1 &pmx0 2 29 1
336 &pmx0 3 30 1 &pmx0 4 31 1 &pmx0 5 32 1
337 &pmx0 6 33 1 &pmx0 7 34 1>;
338 interrupt-controller;
339 #interrupt-cells = <2>;
340 clocks = <&clock HI3620_GPIOCLK8>;
341 clock-names = "apb_pclk";
342 };
343
344 gpio9: gpio@80f000 {
345 compatible = "arm,pl061", "arm,primecell";
346 reg = <0x80f000 0x1000>;
347 interrupts = <0 73 0x4>;
348 gpio-controller;
349 #gpio-cells = <2>;
350 gpio-ranges = < &pmx0 0 35 1 &pmx0 1 36 1 &pmx0 2 37 1
351 &pmx0 3 38 1 &pmx0 4 39 1 &pmx0 5 40 1
352 &pmx0 6 41 1>;
353 interrupt-controller;
354 #interrupt-cells = <2>;
355 clocks = <&clock HI3620_GPIOCLK9>;
356 clock-names = "apb_pclk";
357 };
358
359 gpio10: gpio@810000 {
360 compatible = "arm,pl061", "arm,primecell";
361 reg = <0x810000 0x1000>;
362 interrupts = <0 74 0x4>;
363 gpio-controller;
364 #gpio-cells = <2>;
365 gpio-ranges = < &pmx0 2 43 1 &pmx0 3 44 1 &pmx0 4 45 1
366 &pmx0 5 45 1 &pmx0 6 46 1 &pmx0 7 46 1>;
367 interrupt-controller;
368 #interrupt-cells = <2>;
369 clocks = <&clock HI3620_GPIOCLK10>;
370 clock-names = "apb_pclk";
371 };
372
373 gpio11: gpio@811000 {
374 compatible = "arm,pl061", "arm,primecell";
375 reg = <0x811000 0x1000>;
376 interrupts = <0 75 0x4>;
377 gpio-controller;
378 #gpio-cells = <2>;
379 gpio-ranges = < &pmx0 0 47 1 &pmx0 1 47 1 &pmx0 2 47 1
380 &pmx0 3 47 1 &pmx0 4 47 1 &pmx0 5 48 1
381 &pmx0 6 49 1 &pmx0 7 49 1>;
382 interrupt-controller;
383 #interrupt-cells = <2>;
384 clocks = <&clock HI3620_GPIOCLK11>;
385 clock-names = "apb_pclk";
386 };
387
388 gpio12: gpio@812000 {
389 compatible = "arm,pl061", "arm,primecell";
390 reg = <0x812000 0x1000>;
391 interrupts = <0 76 0x4>;
392 gpio-controller;
393 #gpio-cells = <2>;
394 gpio-ranges = < &pmx0 0 49 1 &pmx0 1 50 1 &pmx0 2 49 1
395 &pmx0 3 49 1 &pmx0 4 51 1 &pmx0 5 51 1
396 &pmx0 6 51 1 &pmx0 7 52 1>;
397 interrupt-controller;
398 #interrupt-cells = <2>;
399 clocks = <&clock HI3620_GPIOCLK12>;
400 clock-names = "apb_pclk";
401 };
402
403 gpio13: gpio@813000 {
404 compatible = "arm,pl061", "arm,primecell";
405 reg = <0x813000 0x1000>;
406 interrupts = <0 77 0x4>;
407 gpio-controller;
408 #gpio-cells = <2>;
409 gpio-ranges = < &pmx0 0 51 1 &pmx0 1 51 1 &pmx0 2 53 1
410 &pmx0 3 53 1 &pmx0 4 53 1 &pmx0 5 54 1
411 &pmx0 6 55 1 &pmx0 7 56 1>;
412 interrupt-controller;
413 #interrupt-cells = <2>;
414 clocks = <&clock HI3620_GPIOCLK13>;
415 clock-names = "apb_pclk";
416 };
417
418 gpio14: gpio@814000 {
419 compatible = "arm,pl061", "arm,primecell";
420 reg = <0x814000 0x1000>;
421 interrupts = <0 78 0x4>;
422 gpio-controller;
423 #gpio-cells = <2>;
424 gpio-ranges = < &pmx0 0 57 1 &pmx0 1 97 1 &pmx0 2 97 1
425 &pmx0 3 58 1 &pmx0 4 59 1 &pmx0 5 60 1
426 &pmx0 6 60 1 &pmx0 7 61 1>;
427 interrupt-controller;
428 #interrupt-cells = <2>;
429 clocks = <&clock HI3620_GPIOCLK14>;
430 clock-names = "apb_pclk";
431 };
432
433 gpio15: gpio@815000 {
434 compatible = "arm,pl061", "arm,primecell";
435 reg = <0x815000 0x1000>;
436 interrupts = <0 79 0x4>;
437 gpio-controller;
438 #gpio-cells = <2>;
439 gpio-ranges = < &pmx0 0 61 1 &pmx0 1 62 1 &pmx0 2 62 1
440 &pmx0 3 63 1 &pmx0 4 63 1 &pmx0 5 64 1
441 &pmx0 6 64 1 &pmx0 7 65 1>;
442 interrupt-controller;
443 #interrupt-cells = <2>;
444 clocks = <&clock HI3620_GPIOCLK15>;
445 clock-names = "apb_pclk";
446 };
447
448 gpio16: gpio@816000 {
449 compatible = "arm,pl061", "arm,primecell";
450 reg = <0x816000 0x1000>;
451 interrupts = <0 80 0x4>;
452 gpio-controller;
453 #gpio-cells = <2>;
454 gpio-ranges = < &pmx0 0 66 1 &pmx0 1 67 1 &pmx0 2 68 1
455 &pmx0 3 69 1 &pmx0 4 70 1 &pmx0 5 71 1
456 &pmx0 6 72 1 &pmx0 7 73 1>;
457 interrupt-controller;
458 #interrupt-cells = <2>;
459 clocks = <&clock HI3620_GPIOCLK16>;
460 clock-names = "apb_pclk";
461 };
462
463 gpio17: gpio@817000 {
464 compatible = "arm,pl061", "arm,primecell";
465 reg = <0x817000 0x1000>;
466 interrupts = <0 81 0x4>;
467 gpio-controller;
468 #gpio-cells = <2>;
469 gpio-ranges = < &pmx0 0 74 1 &pmx0 1 75 1 &pmx0 2 76 1
470 &pmx0 3 77 1 &pmx0 4 78 1 &pmx0 5 79 1
471 &pmx0 6 80 1 &pmx0 7 81 1>;
472 interrupt-controller;
473 #interrupt-cells = <2>;
474 clocks = <&clock HI3620_GPIOCLK17>;
475 clock-names = "apb_pclk";
476 };
477
478 gpio18: gpio@818000 {
479 compatible = "arm,pl061", "arm,primecell";
480 reg = <0x818000 0x1000>;
481 interrupts = <0 82 0x4>;
482 gpio-controller;
483 #gpio-cells = <2>;
484 gpio-ranges = < &pmx0 0 82 1 &pmx0 1 83 1 &pmx0 2 83 1
485 &pmx0 3 84 1 &pmx0 4 84 1 &pmx0 5 85 1
486 &pmx0 6 86 1 &pmx0 7 87 1>;
487 interrupt-controller;
488 #interrupt-cells = <2>;
489 clocks = <&clock HI3620_GPIOCLK18>;
490 clock-names = "apb_pclk";
491 };
492
493 gpio19: gpio@819000 {
494 compatible = "arm,pl061", "arm,primecell";
495 reg = <0x819000 0x1000>;
496 interrupts = <0 83 0x4>;
497 gpio-controller;
498 #gpio-cells = <2>;
499 gpio-ranges = < &pmx0 0 87 1 &pmx0 1 87 1 &pmx0 2 88 1
500 &pmx0 3 88 1>;
501 interrupt-controller;
502 #interrupt-cells = <2>;
503 clocks = <&clock HI3620_GPIOCLK19>;
504 clock-names = "apb_pclk";
505 };
506
507 gpio20: gpio@81a000 {
508 compatible = "arm,pl061", "arm,primecell";
509 reg = <0x81a000 0x1000>;
510 interrupts = <0 84 0x4>;
511 gpio-controller;
512 #gpio-cells = <2>;
513 gpio-ranges = < &pmx0 0 89 1 &pmx0 1 89 1 &pmx0 2 90 1
514 &pmx0 3 90 1 &pmx0 4 91 1 &pmx0 5 92 1>;
515 interrupt-controller;
516 #interrupt-cells = <2>;
517 clocks = <&clock HI3620_GPIOCLK20>;
518 clock-names = "apb_pclk";
519 };
520
521 gpio21: gpio@81b000 {
522 compatible = "arm,pl061", "arm,primecell";
523 reg = <0x81b000 0x1000>;
524 interrupts = <0 85 0x4>;
525 gpio-controller;
526 #gpio-cells = <2>;
527 gpio-ranges = < &pmx0 3 94 1 &pmx0 7 96 1>;
528 interrupt-controller;
529 #interrupt-cells = <2>;
530 clocks = <&clock HI3620_GPIOCLK21>;
531 clock-names = "apb_pclk";
532 };
533
534 pmx0: pinmux@803000 {
535 compatible = "pinctrl-single";
536 reg = <0x803000 0x188>;
537 #address-cells = <1>;
538 #size-cells = <1>;
539 #gpio-range-cells = <3>;
540 ranges;
541
542 pinctrl-single,register-width = <32>;
543 pinctrl-single,function-mask = <7>;
544 /* pin base, nr pins & gpio function */
545 pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1
546 &range 12 1 0 &range 13 29 1
547 &range 43 1 0 &range 44 49 1
548 &range 94 1 1 &range 96 2 1>;
549
550 range: gpio-range {
551 #pinctrl-single,gpio-range-cells = <3>;
552 };
553 };
554
555 pmx1: pinmux@803800 {
556 compatible = "pinconf-single";
557 reg = <0x803800 0x2dc>;
558 #address-cells = <1>;
559 #size-cells = <1>;
560 ranges;
561
562 pinctrl-single,register-width = <32>;
563 };
564 };
565};
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index c96ceaef7ddf..581b75433be6 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -337,8 +337,10 @@
337 }; 337 };
338 338
339 dcp@80028000 { 339 dcp@80028000 {
340 compatible = "fsl,imx23-dcp";
340 reg = <0x80028000 0x2000>; 341 reg = <0x80028000 0x2000>;
341 status = "disabled"; 342 interrupts = <53 54>;
343 status = "okay";
342 }; 344 };
343 345
344 pxp@8002a000 { 346 pxp@8002a000 {
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index cda19c8b0a47..f8e9b20f6982 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -813,9 +813,10 @@
813 }; 813 };
814 814
815 dcp: dcp@80028000 { 815 dcp: dcp@80028000 {
816 compatible = "fsl,imx28-dcp", "fsl,imx23-dcp";
816 reg = <0x80028000 0x2000>; 817 reg = <0x80028000 0x2000>;
817 interrupts = <52 53 54>; 818 interrupts = <52 53 54>;
818 compatible = "fsl-dcp"; 819 status = "okay";
819 }; 820 };
820 821
821 pxp: pxp@8002a000 { 822 pxp: pxp@8002a000 {
diff --git a/arch/arm/boot/dts/imx6dl-cubox-i.dts b/arch/arm/boot/dts/imx6dl-cubox-i.dts
new file mode 100644
index 000000000000..58aa8f2b0f26
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-cubox-i.dts
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) 2014 Russell King
3 */
4/dts-v1/;
5
6#include "imx6dl.dtsi"
7#include "imx6qdl-cubox-i.dtsi"
8
9/ {
10 model = "SolidRun Cubox-i Solo/DualLite";
11 compatible = "solidrun,cubox-i/dl", "fsl,imx6dl";
12};
diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts
new file mode 100644
index 000000000000..fd8fc7cd53f3
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts
@@ -0,0 +1,167 @@
1/*
2 * Copyright (C) 2013,2014 Russell King
3 */
4/dts-v1/;
5
6#include "imx6dl.dtsi"
7#include "imx6qdl-microsom.dtsi"
8#include "imx6qdl-microsom-ar8035.dtsi"
9
10/ {
11 model = "SolidRun HummingBoard DL/Solo";
12 compatible = "solidrun,hummingboard", "fsl,imx6dl";
13
14 ir_recv: ir-receiver {
15 compatible = "gpio-ir-receiver";
16 gpios = <&gpio1 2 1>;
17 pinctrl-names = "default";
18 pinctrl-0 = <&pinctrl_hummingboard_gpio1_2>;
19 };
20
21 regulators {
22 compatible = "simple-bus";
23
24 reg_3p3v: 3p3v {
25 compatible = "regulator-fixed";
26 regulator-name = "3P3V";
27 regulator-min-microvolt = <3300000>;
28 regulator-max-microvolt = <3300000>;
29 regulator-always-on;
30 };
31
32 reg_usbh1_vbus: usb-h1-vbus {
33 compatible = "regulator-fixed";
34 enable-active-high;
35 gpio = <&gpio1 0 0>;
36 pinctrl-names = "default";
37 pinctrl-0 = <&pinctrl_hummingboard_usbh1_vbus>;
38 regulator-name = "usb_h1_vbus";
39 regulator-min-microvolt = <5000000>;
40 regulator-max-microvolt = <5000000>;
41 };
42
43 reg_usbotg_vbus: usb-otg-vbus {
44 compatible = "regulator-fixed";
45 enable-active-high;
46 gpio = <&gpio3 22 0>;
47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_hummingboard_usbotg_vbus>;
49 regulator-name = "usb_otg_vbus";
50 regulator-min-microvolt = <5000000>;
51 regulator-max-microvolt = <5000000>;
52 };
53 };
54
55 codec: spdif-transmitter {
56 compatible = "linux,spdif-dit";
57 pinctrl-names = "default";
58 pinctrl-0 = <&pinctrl_hummingboard_spdif>;
59 };
60
61 sound-spdif {
62 compatible = "fsl,imx-audio-spdif";
63 model = "imx-spdif";
64 /* IMX6 doesn't implement this yet */
65 spdif-controller = <&spdif>;
66 spdif-out;
67 };
68};
69
70&can1 {
71 pinctrl-names = "default";
72 pinctrl-0 = <&pinctrl_hummingboard_flexcan1>;
73 status = "okay";
74};
75
76&i2c1 {
77 pinctrl-names = "default";
78 pinctrl-0 = <&pinctrl_hummingboard_i2c1>;
79
80 /*
81 * Not fitted on Carrier-1 board... yet
82 status = "okay";
83
84 rtc: pcf8523@68 {
85 compatible = "nxp,pcf8523";
86 reg = <0x68>;
87 };
88 */
89};
90
91&iomuxc {
92 hummingboard {
93 pinctrl_hummingboard_flexcan1: hummingboard-flexcan1 {
94 fsl,pins = <
95 MX6QDL_PAD_SD3_CLK__FLEXCAN1_RX 0x80000000
96 MX6QDL_PAD_SD3_CMD__FLEXCAN1_TX 0x80000000
97 >;
98 };
99
100 pinctrl_hummingboard_gpio1_2: hummingboard-gpio1_2 {
101 fsl,pins = <
102 MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000
103 >;
104 };
105
106 pinctrl_hummingboard_i2c1: hummingboard-i2c1 {
107 fsl,pins = <
108 MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
109 MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
110 >;
111 };
112
113 pinctrl_hummingboard_spdif: hummingboard-spdif {
114 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0>;
115 };
116
117 pinctrl_hummingboard_usbh1_vbus: hummingboard-usbh1-vbus {
118 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>;
119 };
120
121 pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus {
122 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>;
123 };
124
125 pinctrl_hummingboard_usdhc2_aux: hummingboard-usdhc2-aux {
126 fsl,pins = <
127 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1f071
128 >;
129 };
130
131 pinctrl_hummingboard_usdhc2: hummingboard-usdhc2 {
132 fsl,pins = <
133 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
134 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
135 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
136 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
137 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
138 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x13059
139 >;
140 };
141 };
142};
143
144&spdif {
145 status = "okay";
146};
147
148&usbh1 {
149 vbus-supply = <&reg_usbh1_vbus>;
150 status = "okay";
151};
152
153&usbotg {
154 vbus-supply = <&reg_usbotg_vbus>;
155 status = "okay";
156};
157
158&usdhc2 {
159 pinctrl-names = "default";
160 pinctrl-0 = <
161 &pinctrl_hummingboard_usdhc2_aux
162 &pinctrl_hummingboard_usdhc2
163 >;
164 vmmc-supply = <&reg_3p3v>;
165 cd-gpios = <&gpio1 4 0>;
166 status = "okay";
167};
diff --git a/arch/arm/boot/dts/imx6q-cubox-i.dts b/arch/arm/boot/dts/imx6q-cubox-i.dts
new file mode 100644
index 000000000000..bc5f31e3e892
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-cubox-i.dts
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2014 Russell King
3 */
4/dts-v1/;
5
6#include "imx6q.dtsi"
7#include "imx6qdl-cubox-i.dtsi"
8
9/ {
10 model = "SolidRun Cubox-i Dual/Quad";
11 compatible = "solidrun,cubox-i/q", "fsl,imx6q";
12};
13
14&sata {
15 status = "okay";
16};
diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
new file mode 100644
index 000000000000..64daa3b311f6
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi
@@ -0,0 +1,143 @@
1/*
2 * Copyright (C) 2014 Russell King
3 */
4#include "imx6qdl-microsom.dtsi"
5#include "imx6qdl-microsom-ar8035.dtsi"
6
7/ {
8 ir_recv: ir-receiver {
9 compatible = "gpio-ir-receiver";
10 gpios = <&gpio3 9 1>;
11 pinctrl-names = "default";
12 pinctrl-0 = <&pinctrl_cubox_i_ir>;
13 };
14
15 regulators {
16 compatible = "simple-bus";
17
18 reg_3p3v: 3p3v {
19 compatible = "regulator-fixed";
20 regulator-name = "3P3V";
21 regulator-min-microvolt = <3300000>;
22 regulator-max-microvolt = <3300000>;
23 regulator-always-on;
24 };
25
26 reg_usbh1_vbus: usb-h1-vbus {
27 compatible = "regulator-fixed";
28 enable-active-high;
29 gpio = <&gpio1 0 0>;
30 pinctrl-names = "default";
31 pinctrl-0 = <&pinctrl_cubox_i_usbh1_vbus>;
32 regulator-name = "usb_h1_vbus";
33 regulator-min-microvolt = <5000000>;
34 regulator-max-microvolt = <5000000>;
35 };
36
37 reg_usbotg_vbus: usb-otg-vbus {
38 compatible = "regulator-fixed";
39 enable-active-high;
40 gpio = <&gpio3 22 0>;
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_cubox_i_usbotg_vbus>;
43 regulator-name = "usb_otg_vbus";
44 regulator-min-microvolt = <5000000>;
45 regulator-max-microvolt = <5000000>;
46 };
47 };
48
49 codec: spdif-transmitter {
50 compatible = "linux,spdif-dit";
51 pinctrl-names = "default";
52 pinctrl-0 = <&pinctrl_cubox_i_spdif>;
53 };
54
55 sound-spdif {
56 compatible = "fsl,imx-audio-spdif";
57 model = "imx-spdif";
58 /* IMX6 doesn't implement this yet */
59 spdif-controller = <&spdif>;
60 spdif-out;
61 };
62};
63
64&i2c3 {
65 pinctrl-names = "default";
66 pinctrl-0 = <&pinctrl_cubox_i_i2c3>;
67
68 status = "okay";
69
70 rtc: pcf8523@68 {
71 compatible = "nxp,pcf8523";
72 reg = <0x68>;
73 };
74};
75
76&iomuxc {
77 cubox_i {
78 pinctrl_cubox_i_i2c3: cubox-i-i2c3 {
79 fsl,pins = <
80 MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
81 MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
82 >;
83 };
84
85 pinctrl_cubox_i_ir: cubox-i-ir {
86 fsl,pins = <
87 MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000
88 >;
89 };
90
91 pinctrl_cubox_i_spdif: cubox-i-spdif {
92 fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0>;
93 };
94
95 pinctrl_cubox_i_usbh1_vbus: cubox-i-usbh1-vbus {
96 fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>;
97 };
98
99 pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus {
100 fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x4001b0b0>;
101 };
102
103 pinctrl_cubox_i_usdhc2_aux: cubox-i-usdhc2-aux {
104 fsl,pins = <
105 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x1f071
106 MX6QDL_PAD_KEY_ROW1__SD2_VSELECT 0x1b071
107 >;
108 };
109
110 pinctrl_cubox_i_usdhc2: cubox-i-usdhc2 {
111 fsl,pins = <
112 MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
113 MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
114 MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
115 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
116 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
117 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x13059
118 >;
119 };
120 };
121};
122
123&spdif {
124 status = "okay";
125};
126
127&usbh1 {
128 vbus-supply = <&reg_usbh1_vbus>;
129 status = "okay";
130};
131
132&usbotg {
133 vbus-supply = <&reg_usbotg_vbus>;
134 status = "okay";
135};
136
137&usdhc2 {
138 pinctrl-names = "default";
139 pinctrl-0 = <&pinctrl_cubox_i_usdhc2_aux &pinctrl_cubox_i_usdhc2>;
140 vmmc-supply = <&reg_3p3v>;
141 cd-gpios = <&gpio1 4 0>;
142 status = "okay";
143};
diff --git a/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi b/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi
new file mode 100644
index 000000000000..a3cb2fff8f61
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 2013,2014 Russell King
3 *
4 * This describes the hookup for an AR8035 to the iMX6 on the SolidRun
5 * MicroSOM.
6 */
7&fec {
8 pinctrl-names = "default";
9 pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
10 phy-mode = "rgmii";
11 phy-reset-duration = <2>;
12 phy-reset-gpios = <&gpio4 15 0>;
13 status = "okay";
14};
15
16&iomuxc {
17 enet {
18 pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 {
19 fsl,pins = <
20 MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
21 MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
22 /* AR8035 reset */
23 MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0
24 /* AR8035 interrupt */
25 MX6QDL_PAD_DI0_PIN2__GPIO4_IO18 0x80000000
26 /* GPIO16 -> AR8035 25MHz */
27 MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0xc0000000
28 MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x80000000
29 MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
30 MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
31 MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
32 MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
33 MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
34 /* AR8035 CLK_25M --> ENET_REF_CLK (V22) */
35 MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x0a0b1
36 /* AR8035 pin strapping: IO voltage: pull up */
37 MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
38 /* AR8035 pin strapping: PHYADDR#0: pull down */
39 MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x130b0
40 /* AR8035 pin strapping: PHYADDR#1: pull down */
41 MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x130b0
42 /* AR8035 pin strapping: MODE#1: pull up */
43 MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
44 /* AR8035 pin strapping: MODE#3: pull up */
45 MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
46 /* AR8035 pin strapping: MODE#0: pull down */
47 MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x130b0
48
49 /*
50 * As the RMII pins are also connected to RGMII
51 * so that an AR8030 can be placed, set these
52 * to high-z with the same pulls as above.
53 * Use the GPIO settings to avoid changing the
54 * input select registers.
55 */
56 MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x03000
57 MX6QDL_PAD_ENET_RXD0__GPIO1_IO27 0x03000
58 MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x03000
59 >;
60 };
61 };
62};
diff --git a/arch/arm/boot/dts/imx6qdl-microsom.dtsi b/arch/arm/boot/dts/imx6qdl-microsom.dtsi
new file mode 100644
index 000000000000..d729d0b15f25
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-microsom.dtsi
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2013,2014 Russell King
3 */
4
5&iomuxc {
6 microsom {
7 pinctrl_microsom_uart1: microsom-uart1 {
8 fsl,pins = <
9 MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1
10 MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
11 >;
12 };
13
14 pinctrl_microsom_usbotg: microsom-usbotg {
15 /*
16 * Similar to pinctrl_usbotg_2, but we want it
17 * pulled down for a fixed host connection.
18 */
19 fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>;
20 };
21 };
22};
23
24&uart1 {
25 pinctrl-names = "default";
26 pinctrl-0 = <&pinctrl_microsom_uart1>;
27 status = "okay";
28};
29
30&usbotg {
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_microsom_usbotg>;
33};
diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi
index 0f06f8687b0b..88e3d477bf16 100644
--- a/arch/arm/boot/dts/integrator.dtsi
+++ b/arch/arm/boot/dts/integrator.dtsi
@@ -10,6 +10,11 @@
10 reg = <0x10000000 0x200>; 10 reg = <0x10000000 0x200>;
11 }; 11 };
12 12
13 ebi@12000000 {
14 compatible = "arm,external-bus-interface";
15 reg = <0x12000000 0x100>;
16 };
17
13 timer@13000000 { 18 timer@13000000 {
14 reg = <0x13000000 0x100>; 19 reg = <0x13000000 0x100>;
15 interrupt-parent = <&pic>; 20 interrupt-parent = <&pic>;
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts
index 7deb3a3182b4..a21c17de9a5e 100644
--- a/arch/arm/boot/dts/integratorcp.dts
+++ b/arch/arm/boot/dts/integratorcp.dts
@@ -47,8 +47,11 @@
47 valid-mask = <0x00000007>; 47 valid-mask = <0x00000007>;
48 }; 48 };
49 49
50 /* The SIC is cascaded off IRQ 26 on the PIC */
50 sic: sic@ca000000 { 51 sic: sic@ca000000 {
51 compatible = "arm,versatile-fpga-irq"; 52 compatible = "arm,versatile-fpga-irq";
53 interrupt-parent = <&pic>;
54 interrupts = <26>;
52 #interrupt-cells = <1>; 55 #interrupt-cells = <1>;
53 interrupt-controller; 56 interrupt-controller;
54 reg = <0xca000000 0x100>; 57 reg = <0xca000000 0x100>;
diff --git a/arch/arm/boot/dts/k2hk-evm.dts b/arch/arm/boot/dts/k2hk-evm.dts
new file mode 100644
index 000000000000..eaefdfef65c3
--- /dev/null
+++ b/arch/arm/boot/dts/k2hk-evm.dts
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2013 Texas Instruments, Inc.
3 *
4 * Keystone 2 Kepler/Hawking EVM device tree
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 "keystone.dtsi"
13
14/ {
15 compatible = "ti,keystone-evm";
16
17 soc {
18 clock {
19 refclksys: refclksys {
20 #clock-cells = <0>;
21 compatible = "fixed-clock";
22 clock-frequency = <122880000>;
23 clock-output-names = "refclk-sys";
24 };
25
26 refclkpass: refclkpass {
27 #clock-cells = <0>;
28 compatible = "fixed-clock";
29 clock-frequency = <122880000>;
30 clock-output-names = "refclk-pass";
31 };
32
33 refclkarm: refclkarm {
34 #clock-cells = <0>;
35 compatible = "fixed-clock";
36 clock-frequency = <125000000>;
37 clock-output-names = "refclk-arm";
38 };
39
40 refclkddr3a: refclkddr3a {
41 #clock-cells = <0>;
42 compatible = "fixed-clock";
43 clock-frequency = <100000000>;
44 clock-output-names = "refclk-ddr3a";
45 };
46
47 refclkddr3b: refclkddr3b {
48 #clock-cells = <0>;
49 compatible = "fixed-clock";
50 clock-frequency = <100000000>;
51 clock-output-names = "refclk-ddr3b";
52 };
53 };
54 };
55};
56
57&usb_phy {
58 status = "okay";
59};
60
61&usb {
62 status = "okay";
63};
diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
index d6713b113258..2363593e1050 100644
--- a/arch/arm/boot/dts/keystone-clocks.dtsi
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -13,17 +13,10 @@ clocks {
13 #size-cells = <1>; 13 #size-cells = <1>;
14 ranges; 14 ranges;
15 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 { 16 mainpllclk: mainpllclk@2310110 {
24 #clock-cells = <0>; 17 #clock-cells = <0>;
25 compatible = "ti,keystone,main-pll-clock"; 18 compatible = "ti,keystone,main-pll-clock";
26 clocks = <&refclkmain>; 19 clocks = <&refclksys>;
27 reg = <0x02620350 4>, <0x02310110 4>; 20 reg = <0x02620350 4>, <0x02310110 4>;
28 reg-names = "control", "multiplier"; 21 reg-names = "control", "multiplier";
29 fixed-postdiv = <2>; 22 fixed-postdiv = <2>;
@@ -32,47 +25,43 @@ clocks {
32 papllclk: papllclk@2620358 { 25 papllclk: papllclk@2620358 {
33 #clock-cells = <0>; 26 #clock-cells = <0>;
34 compatible = "ti,keystone,pll-clock"; 27 compatible = "ti,keystone,pll-clock";
35 clocks = <&refclkmain>; 28 clocks = <&refclkpass>;
36 clock-output-names = "pa-pll-clk"; 29 clock-output-names = "pa-pll-clk";
37 reg = <0x02620358 4>; 30 reg = <0x02620358 4>;
38 reg-names = "control"; 31 reg-names = "control";
39 fixed-postdiv = <6>;
40 }; 32 };
41 33
42 ddr3allclk: ddr3apllclk@2620360 { 34 ddr3apllclk: ddr3apllclk@2620360 {
43 #clock-cells = <0>; 35 #clock-cells = <0>;
44 compatible = "ti,keystone,pll-clock"; 36 compatible = "ti,keystone,pll-clock";
45 clocks = <&refclkmain>; 37 clocks = <&refclkddr3a>;
46 clock-output-names = "ddr-3a-pll-clk"; 38 clock-output-names = "ddr-3a-pll-clk";
47 reg = <0x02620360 4>; 39 reg = <0x02620360 4>;
48 reg-names = "control"; 40 reg-names = "control";
49 fixed-postdiv = <6>;
50 }; 41 };
51 42
52 ddr3bllclk: ddr3bpllclk@2620368 { 43 ddr3bpllclk: ddr3bpllclk@2620368 {
53 #clock-cells = <0>; 44 #clock-cells = <0>;
54 compatible = "ti,keystone,pll-clock"; 45 compatible = "ti,keystone,pll-clock";
55 clocks = <&refclkmain>; 46 clocks = <&refclkddr3b>;
56 clock-output-names = "ddr-3b-pll-clk"; 47 clock-output-names = "ddr-3b-pll-clk";
57 reg = <0x02620368 4>; 48 reg = <0x02620368 4>;
58 reg-names = "control"; 49 reg-names = "control";
59 fixed-postdiv = <6>;
60 }; 50 };
61 51
62 armpllclk: armpllclk@2620370 { 52 armpllclk: armpllclk@2620370 {
63 #clock-cells = <0>; 53 #clock-cells = <0>;
64 compatible = "ti,keystone,pll-clock"; 54 compatible = "ti,keystone,pll-clock";
65 clocks = <&refclkmain>; 55 clocks = <&refclkarm>;
66 clock-output-names = "arm-pll-clk"; 56 clock-output-names = "arm-pll-clk";
67 reg = <0x02620370 4>; 57 reg = <0x02620370 4>;
68 reg-names = "control"; 58 reg-names = "control";
69 fixed-postdiv = <6>;
70 }; 59 };
71 60
72 mainmuxclk: mainmuxclk@2310108 { 61 mainmuxclk: mainmuxclk@2310108 {
73 #clock-cells = <0>; 62 #clock-cells = <0>;
74 compatible = "ti,keystone,pll-mux-clock"; 63 compatible = "ti,keystone,pll-mux-clock";
75 clocks = <&mainpllclk>, <&refclkmain>; 64 clocks = <&mainpllclk>, <&refclksys>;
76 reg = <0x02310108 4>; 65 reg = <0x02310108 4>;
77 bit-shift = <23>; 66 bit-shift = <23>;
78 bit-mask = <1>; 67 bit-mask = <1>;
@@ -135,6 +124,15 @@ clocks {
135 clock-output-names = "chipclk13"; 124 clock-output-names = "chipclk13";
136 }; 125 };
137 126
127 paclk13: paclk13 {
128 #clock-cells = <0>;
129 compatible = "fixed-factor-clock";
130 clocks = <&papllclk>;
131 clock-div = <3>;
132 clock-mult = <1>;
133 clock-output-names = "paclk13";
134 };
135
138 chipclk14: chipclk14 { 136 chipclk14: chipclk14 {
139 #clock-cells = <0>; 137 #clock-cells = <0>;
140 compatible = "fixed-factor-clock"; 138 compatible = "fixed-factor-clock";
diff --git a/arch/arm/boot/dts/keystone.dts b/arch/arm/boot/dts/keystone.dtsi
index 100bdf52b847..b4202907a27b 100644
--- a/arch/arm/boot/dts/keystone.dts
+++ b/arch/arm/boot/dts/keystone.dtsi
@@ -6,14 +6,12 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9/dts-v1/;
10#include <dt-bindings/interrupt-controller/arm-gic.h> 9#include <dt-bindings/interrupt-controller/arm-gic.h>
11 10
12#include "skeleton.dtsi" 11#include "skeleton.dtsi"
13 12
14/ { 13/ {
15 model = "Texas Instruments Keystone 2 SoC"; 14 model = "Texas Instruments Keystone 2 SoC";
16 compatible = "ti,keystone-evm";
17 #address-cells = <2>; 15 #address-cells = <2>;
18 #size-cells = <2>; 16 #size-cells = <2>;
19 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
@@ -64,7 +62,11 @@
64 #address-cells = <1>; 62 #address-cells = <1>;
65 interrupt-controller; 63 interrupt-controller;
66 reg = <0x0 0x02561000 0x0 0x1000>, 64 reg = <0x0 0x02561000 0x0 0x1000>,
67 <0x0 0x02562000 0x0 0x2000>; 65 <0x0 0x02562000 0x0 0x2000>,
66 <0x0 0x02564000 0x0 0x1000>,
67 <0x0 0x02566000 0x0 0x2000>;
68 interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
69 IRQ_TYPE_LEVEL_HIGH)>;
68 }; 70 };
69 71
70 timer { 72 timer {
@@ -179,5 +181,32 @@
179 interrupts = <GIC_SPI 300 IRQ_TYPE_EDGE_RISING>; 181 interrupts = <GIC_SPI 300 IRQ_TYPE_EDGE_RISING>;
180 clocks = <&clkspi>; 182 clocks = <&clkspi>;
181 }; 183 };
184
185 usb_phy: usb_phy@2620738 {
186 compatible = "ti,keystone-usbphy";
187 #address-cells = <1>;
188 #size-cells = <1>;
189 reg = <0x2620738 32>;
190 status = "disabled";
191 };
192
193 usb: usb@2680000 {
194 compatible = "ti,keystone-dwc3";
195 #address-cells = <1>;
196 #size-cells = <1>;
197 reg = <0x2680000 0x10000>;
198 clocks = <&clkusb>;
199 clock-names = "usb";
200 interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
201 ranges;
202 status = "disabled";
203
204 dwc3@2690000 {
205 compatible = "synopsys,dwc3";
206 reg = <0x2690000 0x70000>;
207 interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
208 usb-phy = <&usb_phy>, <&usb_phy>;
209 };
210 };
182 }; 211 };
183}; 212};
diff --git a/arch/arm/boot/dts/kirkwood-6192.dtsi b/arch/arm/boot/dts/kirkwood-6192.dtsi
new file mode 100644
index 000000000000..3916937d6818
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-6192.dtsi
@@ -0,0 +1,107 @@
1/ {
2 mbus {
3 pcie-controller {
4 compatible = "marvell,kirkwood-pcie";
5 status = "disabled";
6 device_type = "pci";
7
8 #address-cells = <3>;
9 #size-cells = <2>;
10
11 bus-range = <0x00 0xff>;
12
13 ranges =
14 <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000
15 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */
16 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */>;
17
18 pcie@1,0 {
19 device_type = "pci";
20 assigned-addresses = <0x82000800 0 0x00040000 0 0x2000>;
21 reg = <0x0800 0 0 0 0>;
22 #address-cells = <3>;
23 #size-cells = <2>;
24 #interrupt-cells = <1>;
25 ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
26 0x81000000 0 0 0x81000000 0x1 0 1 0>;
27 interrupt-map-mask = <0 0 0 0>;
28 interrupt-map = <0 0 0 0 &intc 9>;
29 marvell,pcie-port = <0>;
30 marvell,pcie-lane = <0>;
31 clocks = <&gate_clk 2>;
32 status = "disabled";
33 };
34 };
35 };
36
37 ocp@f1000000 {
38 pinctrl: pinctrl@10000 {
39 compatible = "marvell,88f6192-pinctrl";
40 reg = <0x10000 0x20>;
41
42 pmx_nand: pmx-nand {
43 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3",
44 "mpp4", "mpp5", "mpp18",
45 "mpp19";
46 marvell,function = "nand";
47 };
48 pmx_sata0: pmx-sata0 {
49 marvell,pins = "mpp5", "mpp21", "mpp23";
50 marvell,function = "sata0";
51 };
52 pmx_sata1: pmx-sata1 {
53 marvell,pins = "mpp4", "mpp20", "mpp22";
54 marvell,function = "sata1";
55 };
56 pmx_spi: pmx-spi {
57 marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3";
58 marvell,function = "spi";
59 };
60 pmx_twsi0: pmx-twsi0 {
61 marvell,pins = "mpp8", "mpp9";
62 marvell,function = "twsi0";
63 };
64 pmx_uart0: pmx-uart0 {
65 marvell,pins = "mpp10", "mpp11";
66 marvell,function = "uart0";
67 };
68 pmx_uart1: pmx-uart1 {
69 marvell,pins = "mpp13", "mpp14";
70 marvell,function = "uart1";
71 };
72 pmx_sdio: pmx-sdio {
73 marvell,pins = "mpp12", "mpp13", "mpp14",
74 "mpp15", "mpp16", "mpp17";
75 marvell,function = "sdio";
76 };
77 };
78
79 rtc@10300 {
80 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
81 reg = <0x10300 0x20>;
82 interrupts = <53>;
83 clocks = <&gate_clk 7>;
84 };
85
86 sata@80000 {
87 compatible = "marvell,orion-sata";
88 reg = <0x80000 0x5000>;
89 interrupts = <21>;
90 clocks = <&gate_clk 14>, <&gate_clk 15>;
91 clock-names = "0", "1";
92 status = "disabled";
93 };
94
95 mvsdio@90000 {
96 compatible = "marvell,orion-sdio";
97 reg = <0x90000 0x200>;
98 interrupts = <28>;
99 clocks = <&gate_clk 4>;
100 bus-width = <4>;
101 cap-sdio-irq;
102 cap-sd-highspeed;
103 cap-mmc-highspeed;
104 status = "disabled";
105 };
106 };
107};
diff --git a/arch/arm/boot/dts/kirkwood-6281.dtsi b/arch/arm/boot/dts/kirkwood-6281.dtsi
index 650ef30e1856..416d96e1302f 100644
--- a/arch/arm/boot/dts/kirkwood-6281.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6281.dtsi
@@ -89,6 +89,8 @@
89 interrupts = <21>; 89 interrupts = <21>;
90 clocks = <&gate_clk 14>, <&gate_clk 15>; 90 clocks = <&gate_clk 14>, <&gate_clk 15>;
91 clock-names = "0", "1"; 91 clock-names = "0", "1";
92 phys = <&sata_phy0>, <&sata_phy1>;
93 phy-names = "port0", "port1";
92 status = "disabled"; 94 status = "disabled";
93 }; 95 };
94 96
@@ -97,6 +99,8 @@
97 reg = <0x90000 0x200>; 99 reg = <0x90000 0x200>;
98 interrupts = <28>; 100 interrupts = <28>;
99 clocks = <&gate_clk 4>; 101 clocks = <&gate_clk 4>;
102 pinctrl-0 = <&pmx_sdio>;
103 pinctrl-names = "default";
100 bus-width = <4>; 104 bus-width = <4>;
101 cap-sdio-irq; 105 cap-sdio-irq;
102 cap-sd-highspeed; 106 cap-sd-highspeed;
diff --git a/arch/arm/boot/dts/kirkwood-6282.dtsi b/arch/arm/boot/dts/kirkwood-6282.dtsi
index 3933a331ddc2..2902e0d7971d 100644
--- a/arch/arm/boot/dts/kirkwood-6282.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6282.dtsi
@@ -104,6 +104,12 @@
104 }; 104 };
105 }; 105 };
106 106
107 thermal@10078 {
108 compatible = "marvell,kirkwood-thermal";
109 reg = <0x10078 0x4>;
110 status = "okay";
111 };
112
107 rtc@10300 { 113 rtc@10300 {
108 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc"; 114 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
109 reg = <0x10300 0x20>; 115 reg = <0x10300 0x20>;
@@ -111,12 +117,25 @@
111 clocks = <&gate_clk 7>; 117 clocks = <&gate_clk 7>;
112 }; 118 };
113 119
120 i2c@11100 {
121 compatible = "marvell,mv64xxx-i2c";
122 reg = <0x11100 0x20>;
123 #address-cells = <1>;
124 #size-cells = <0>;
125 interrupts = <32>;
126 clock-frequency = <100000>;
127 clocks = <&gate_clk 7>;
128 status = "disabled";
129 };
130
114 sata@80000 { 131 sata@80000 {
115 compatible = "marvell,orion-sata"; 132 compatible = "marvell,orion-sata";
116 reg = <0x80000 0x5000>; 133 reg = <0x80000 0x5000>;
117 interrupts = <21>; 134 interrupts = <21>;
118 clocks = <&gate_clk 14>, <&gate_clk 15>; 135 clocks = <&gate_clk 14>, <&gate_clk 15>;
119 clock-names = "0", "1"; 136 clock-names = "0", "1";
137 phys = <&sata_phy0>, <&sata_phy1>;
138 phy-names = "port0", "port1";
120 status = "disabled"; 139 status = "disabled";
121 }; 140 };
122 141
@@ -125,29 +144,13 @@
125 reg = <0x90000 0x200>; 144 reg = <0x90000 0x200>;
126 interrupts = <28>; 145 interrupts = <28>;
127 clocks = <&gate_clk 4>; 146 clocks = <&gate_clk 4>;
147 pinctrl-0 = <&pmx_sdio>;
148 pinctrl-names = "default";
128 bus-width = <4>; 149 bus-width = <4>;
129 cap-sdio-irq; 150 cap-sdio-irq;
130 cap-sd-highspeed; 151 cap-sd-highspeed;
131 cap-mmc-highspeed; 152 cap-mmc-highspeed;
132 status = "disabled"; 153 status = "disabled";
133 }; 154 };
134
135 thermal@10078 {
136 compatible = "marvell,kirkwood-thermal";
137 reg = <0x10078 0x4>;
138 status = "okay";
139 };
140
141 i2c@11100 {
142 compatible = "marvell,mv64xxx-i2c";
143 reg = <0x11100 0x20>;
144 #address-cells = <1>;
145 #size-cells = <0>;
146 interrupts = <32>;
147 clock-frequency = <100000>;
148 clocks = <&gate_clk 7>;
149 status = "disabled";
150 };
151
152 }; 155 };
153}; 156};
diff --git a/arch/arm/boot/dts/kirkwood-cloudbox.dts b/arch/arm/boot/dts/kirkwood-cloudbox.dts
index 142b9cd3b454..0e06fd3cee4d 100644
--- a/arch/arm/boot/dts/kirkwood-cloudbox.dts
+++ b/arch/arm/boot/dts/kirkwood-cloudbox.dts
@@ -66,8 +66,8 @@
66 66
67 button@1 { 67 button@1 {
68 label = "Power push button"; 68 label = "Power push button";
69 linux,code = <116>; 69 linux,code = <KEY_POWER>;
70 gpios = <&gpio0 16 1>; 70 gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
71 }; 71 };
72 }; 72 };
73 73
@@ -76,17 +76,17 @@
76 76
77 red-fail { 77 red-fail {
78 label = "cloudbox:red:fail"; 78 label = "cloudbox:red:fail";
79 gpios = <&gpio0 14 0>; 79 gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
80 }; 80 };
81 blue-sata { 81 blue-sata {
82 label = "cloudbox:blue:sata"; 82 label = "cloudbox:blue:sata";
83 gpios = <&gpio0 15 0>; 83 gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
84 }; 84 };
85 }; 85 };
86 86
87 gpio_poweroff { 87 gpio_poweroff {
88 compatible = "gpio-poweroff"; 88 compatible = "gpio-poweroff";
89 gpios = <&gpio0 17 0>; 89 gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
90 }; 90 };
91}; 91};
92 92
@@ -94,7 +94,6 @@
94 status = "okay"; 94 status = "okay";
95 95
96 ethphy0: ethernet-phy@0 { 96 ethphy0: ethernet-phy@0 {
97 device_type = "ethernet-phy";
98 reg = <0>; 97 reg = <0>;
99 }; 98 };
100}; 99};
diff --git a/arch/arm/boot/dts/kirkwood-db.dtsi b/arch/arm/boot/dts/kirkwood-db.dtsi
index 053aa20fb30f..02d1225ef99f 100644
--- a/arch/arm/boot/dts/kirkwood-db.dtsi
+++ b/arch/arm/boot/dts/kirkwood-db.dtsi
@@ -51,8 +51,8 @@
51 mvsdio@90000 { 51 mvsdio@90000 {
52 pinctrl-0 = <&pmx_sdio_gpios>; 52 pinctrl-0 = <&pmx_sdio_gpios>;
53 pinctrl-names = "default"; 53 pinctrl-names = "default";
54 wp-gpios = <&gpio1 5 0>; 54 wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
55 cd-gpios = <&gpio1 6 0>; 55 cd-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
56 status = "okay"; 56 status = "okay";
57 }; 57 };
58 }; 58 };
@@ -84,7 +84,6 @@
84 status = "okay"; 84 status = "okay";
85 85
86 ethphy0: ethernet-phy@8 { 86 ethphy0: ethernet-phy@8 {
87 device_type = "ethernet-phy";
88 reg = <8>; 87 reg = <8>;
89 }; 88 };
90}; 89};
diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
index e112ca62d978..bf7fe8ab88f4 100644
--- a/arch/arm/boot/dts/kirkwood-dns320.dts
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -24,24 +24,24 @@
24 24
25 blue-power { 25 blue-power {
26 label = "dns320:blue:power"; 26 label = "dns320:blue:power";
27 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */ 27 gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
28 linux,default-trigger = "default-on"; 28 default-state = "keep";
29 }; 29 };
30 blue-usb { 30 blue-usb {
31 label = "dns320:blue:usb"; 31 label = "dns320:blue:usb";
32 gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */ 32 gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
33 }; 33 };
34 orange-l_hdd { 34 orange-l_hdd {
35 label = "dns320:orange:l_hdd"; 35 label = "dns320:orange:l_hdd";
36 gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */ 36 gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
37 }; 37 };
38 orange-r_hdd { 38 orange-r_hdd {
39 label = "dns320:orange:r_hdd"; 39 label = "dns320:orange:r_hdd";
40 gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */ 40 gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
41 }; 41 };
42 orange-usb { 42 orange-usb {
43 label = "dns320:orange:usb"; 43 label = "dns320:orange:usb";
44 gpios = <&gpio1 3 1>; /* GPIO 35 Active Low */ 44 gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; /* GPIO 35 */
45 }; 45 };
46 }; 46 };
47 47
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
index 5119fb8a8eb6..cb9978c652f2 100644
--- a/arch/arm/boot/dts/kirkwood-dns325.dts
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -24,24 +24,24 @@
24 24
25 white-power { 25 white-power {
26 label = "dns325:white:power"; 26 label = "dns325:white:power";
27 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */ 27 gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
28 linux,default-trigger = "default-on"; 28 default-state = "keep";
29 }; 29 };
30 white-usb { 30 white-usb {
31 label = "dns325:white:usb"; 31 label = "dns325:white:usb";
32 gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */ 32 gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; /* GPIO 43 */
33 }; 33 };
34 red-l_hdd { 34 red-l_hdd {
35 label = "dns325:red:l_hdd"; 35 label = "dns325:red:l_hdd";
36 gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */ 36 gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
37 }; 37 };
38 red-r_hdd { 38 red-r_hdd {
39 label = "dns325:red:r_hdd"; 39 label = "dns325:red:r_hdd";
40 gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */ 40 gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
41 }; 41 };
42 red-usb { 42 red-usb {
43 label = "dns325:red:usb"; 43 label = "dns325:red:usb";
44 gpios = <&gpio0 29 1>; /* GPIO 29 Active Low */ 44 gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
45 }; 45 };
46 }; 46 };
47 47
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index aefa375a550d..d5aa9564a287 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -15,18 +15,18 @@
15 15
16 button@1 { 16 button@1 {
17 label = "Power button"; 17 label = "Power button";
18 linux,code = <116>; 18 linux,code = <KEY_POWER>;
19 gpios = <&gpio1 2 1>; 19 gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
20 }; 20 };
21 button@2 { 21 button@2 {
22 label = "USB unmount button"; 22 label = "USB unmount button";
23 linux,code = <161>; 23 linux,code = <KEY_EJECTCD>;
24 gpios = <&gpio1 15 1>; 24 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
25 }; 25 };
26 button@3 { 26 button@3 {
27 label = "Reset button"; 27 label = "Reset button";
28 linux,code = <0x198>; 28 linux,code = <KEY_RESTART>;
29 gpios = <&gpio1 16 1>; 29 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
30 }; 30 };
31 }; 31 };
32 32
@@ -35,8 +35,8 @@
35 compatible = "gpio-fan"; 35 compatible = "gpio-fan";
36 pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>; 36 pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>;
37 pinctrl-names = "default"; 37 pinctrl-names = "default";
38 gpios = <&gpio1 14 1 38 gpios = <&gpio1 14 GPIO_ACTIVE_LOW
39 &gpio1 13 1>; 39 &gpio1 13 GPIO_ACTIVE_LOW>;
40 gpio-fan,speed-map = <0 0 40 gpio-fan,speed-map = <0 0
41 3000 1 41 3000 1
42 6000 2>; 42 6000 2>;
@@ -46,7 +46,7 @@
46 compatible = "gpio-poweroff"; 46 compatible = "gpio-poweroff";
47 pinctrl-0 = <&pmx_power_off>; 47 pinctrl-0 = <&pmx_power_off>;
48 pinctrl-names = "default"; 48 pinctrl-names = "default";
49 gpios = <&gpio1 4 0>; 49 gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
50 }; 50 };
51 51
52 ocp@f1000000 { 52 ocp@f1000000 {
@@ -224,7 +224,6 @@
224 status = "okay"; 224 status = "okay";
225 225
226 ethphy0: ethernet-phy@8 { 226 ethphy0: ethernet-phy@8 {
227 device_type = "ethernet-phy";
228 reg = <8>; 227 reg = <8>;
229 }; 228 };
230}; 229};
diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 33ff368fbfa5..f31312ebd0d6 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -42,12 +42,12 @@
42 42
43 health { 43 health {
44 label = "status:green:health"; 44 label = "status:green:health";
45 gpios = <&gpio1 14 1>; 45 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
46 linux,default-trigger = "default-on"; 46 default-state = "keep";
47 }; 47 };
48 fault { 48 fault {
49 label = "status:orange:fault"; 49 label = "status:orange:fault";
50 gpios = <&gpio1 15 1>; 50 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
51 }; 51 };
52 }; 52 };
53 regulators { 53 regulators {
@@ -95,7 +95,6 @@
95 status = "okay"; 95 status = "okay";
96 96
97 ethphy0: ethernet-phy@0 { 97 ethphy0: ethernet-phy@0 {
98 device_type = "ethernet-phy";
99 compatible = "marvell,88e1116"; 98 compatible = "marvell,88e1116";
100 reg = <0>; 99 reg = <0>;
101 }; 100 };
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
index 6f62af99c9cb..ef3463e0ae19 100644
--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -87,15 +87,15 @@
87 87
88 bluetooth { 88 bluetooth {
89 label = "dreamplug:blue:bluetooth"; 89 label = "dreamplug:blue:bluetooth";
90 gpios = <&gpio1 15 1>; 90 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
91 }; 91 };
92 wifi { 92 wifi {
93 label = "dreamplug:green:wifi"; 93 label = "dreamplug:green:wifi";
94 gpios = <&gpio1 16 1>; 94 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
95 }; 95 };
96 wifi-ap { 96 wifi-ap {
97 label = "dreamplug:green:wifi_ap"; 97 label = "dreamplug:green:wifi_ap";
98 gpios = <&gpio1 17 1>; 98 gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
99 }; 99 };
100 }; 100 };
101}; 101};
@@ -104,12 +104,10 @@
104 status = "okay"; 104 status = "okay";
105 105
106 ethphy0: ethernet-phy@0 { 106 ethphy0: ethernet-phy@0 {
107 device_type = "ethernet-phy";
108 reg = <0>; 107 reg = <0>;
109 }; 108 };
110 109
111 ethphy1: ethernet-phy@1 { 110 ethphy1: ethernet-phy@1 {
112 device_type = "ethernet-phy";
113 reg = <1>; 111 reg = <1>;
114 }; 112 };
115}; 113};
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index a43bebb25110..eb9329420107 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -85,44 +85,44 @@
85 85
86 health { 86 health {
87 label = "status:green:health"; 87 label = "status:green:health";
88 gpios = <&gpio1 14 1>; 88 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
89 linux,default-trigger = "default-on"; 89 default-state = "keep";
90 }; 90 };
91 fault { 91 fault {
92 label = "status:orange:fault"; 92 label = "status:orange:fault";
93 gpios = <&gpio1 15 1>; 93 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
94 }; 94 };
95 left0 { 95 left0 {
96 label = "status:white:left0"; 96 label = "status:white:left0";
97 gpios = <&gpio1 10 0>; 97 gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
98 }; 98 };
99 left1 { 99 left1 {
100 label = "status:white:left1"; 100 label = "status:white:left1";
101 gpios = <&gpio1 11 0>; 101 gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
102 }; 102 };
103 left2 { 103 left2 {
104 label = "status:white:left2"; 104 label = "status:white:left2";
105 gpios = <&gpio1 12 0>; 105 gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
106 }; 106 };
107 left3 { 107 left3 {
108 label = "status:white:left3"; 108 label = "status:white:left3";
109 gpios = <&gpio1 13 0>; 109 gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
110 }; 110 };
111 right0 { 111 right0 {
112 label = "status:white:right0"; 112 label = "status:white:right0";
113 gpios = <&gpio1 6 0>; 113 gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
114 }; 114 };
115 right1 { 115 right1 {
116 label = "status:white:right1"; 116 label = "status:white:right1";
117 gpios = <&gpio1 7 0>; 117 gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
118 }; 118 };
119 right2 { 119 right2 {
120 label = "status:white:right2"; 120 label = "status:white:right2";
121 gpios = <&gpio1 8 0>; 121 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
122 }; 122 };
123 right3 { 123 right3 {
124 label = "status:white:right3"; 124 label = "status:white:right3";
125 gpios = <&gpio1 9 0>; 125 gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
126 }; 126 };
127 }; 127 };
128 regulators { 128 regulators {
@@ -141,7 +141,7 @@
141 enable-active-high; 141 enable-active-high;
142 regulator-always-on; 142 regulator-always-on;
143 regulator-boot-on; 143 regulator-boot-on;
144 gpio = <&gpio0 29 0>; 144 gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
145 }; 145 };
146 }; 146 };
147}; 147};
@@ -176,7 +176,6 @@
176 status = "okay"; 176 status = "okay";
177 177
178 ethphy0: ethernet-phy@0 { 178 ethphy0: ethernet-phy@0 {
179 device_type = "ethernet-phy";
180 reg = <0>; 179 reg = <0>;
181 }; 180 };
182}; 181};
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
index d30a91a5047d..2d51fce74a5a 100644
--- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
+++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
@@ -45,10 +45,10 @@
45 nr-ports = <1>; 45 nr-ports = <1>;
46 }; 46 };
47 47
48 /* AzureWave AW-GH381 WiFi/BT */
48 mvsdio@90000 { 49 mvsdio@90000 {
49 status = "okay"; 50 status = "okay";
50 /* No CD or WP GPIOs */ 51 non-removable;
51 broken-cd;
52 }; 52 };
53 }; 53 };
54 54
@@ -60,19 +60,19 @@
60 60
61 health-r { 61 health-r {
62 label = "guruplug:red:health"; 62 label = "guruplug:red:health";
63 gpios = <&gpio1 14 1>; 63 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
64 }; 64 };
65 health-g { 65 health-g {
66 label = "guruplug:green:health"; 66 label = "guruplug:green:health";
67 gpios = <&gpio1 15 1>; 67 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
68 }; 68 };
69 wmode-r { 69 wmode-r {
70 label = "guruplug:red:wmode"; 70 label = "guruplug:red:wmode";
71 gpios = <&gpio1 16 1>; 71 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
72 }; 72 };
73 wmode-g { 73 wmode-g {
74 label = "guruplug:green:wmode"; 74 label = "guruplug:green:wmode";
75 gpios = <&gpio1 17 1>; 75 gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
76 }; 76 };
77 }; 77 };
78}; 78};
@@ -101,13 +101,11 @@
101 status = "okay"; 101 status = "okay";
102 102
103 ethphy0: ethernet-phy@0 { 103 ethphy0: ethernet-phy@0 {
104 device_type = "ethernet-phy";
105 compatible = "marvell,88e1121"; 104 compatible = "marvell,88e1121";
106 reg = <0>; 105 reg = <0>;
107 }; 106 };
108 107
109 ethphy1: ethernet-phy@1 { 108 ethphy1: ethernet-phy@1 {
110 device_type = "ethernet-phy";
111 compatible = "marvell,88e1121"; 109 compatible = "marvell,88e1121";
112 reg = <1>; 110 reg = <1>;
113 }; 111 };
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
index c5fb02f7ebc3..a1add3f215e3 100644
--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -63,13 +63,13 @@
63 63
64 button@1 { 64 button@1 {
65 label = "USB Copy"; 65 label = "USB Copy";
66 linux,code = <133>; 66 linux,code = <KEY_COPY>;
67 gpios = <&gpio0 29 1>; 67 gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
68 }; 68 };
69 button@2 { 69 button@2 {
70 label = "Reset"; 70 label = "Reset";
71 linux,code = <0x198>; 71 linux,code = <KEY_RESTART>;
72 gpios = <&gpio0 28 1>; 72 gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
73 }; 73 };
74 }; 74 };
75 75
@@ -81,16 +81,16 @@
81 81
82 green-os { 82 green-os {
83 label = "ib62x0:green:os"; 83 label = "ib62x0:green:os";
84 gpios = <&gpio0 25 0>; 84 gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
85 linux,default-trigger = "default-on"; 85 default-state = "keep";
86 }; 86 };
87 red-os { 87 red-os {
88 label = "ib62x0:red:os"; 88 label = "ib62x0:red:os";
89 gpios = <&gpio0 22 0>; 89 gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
90 }; 90 };
91 usb-copy { 91 usb-copy {
92 label = "ib62x0:red:usb_copy"; 92 label = "ib62x0:red:usb_copy";
93 gpios = <&gpio0 27 0>; 93 gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
94 }; 94 };
95 }; 95 };
96 96
@@ -98,7 +98,7 @@
98 compatible = "gpio-poweroff"; 98 compatible = "gpio-poweroff";
99 pinctrl-0 = <&pmx_power_off>; 99 pinctrl-0 = <&pmx_power_off>;
100 pinctrl-names = "default"; 100 pinctrl-names = "default";
101 gpios = <&gpio0 24 0>; 101 gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
102 }; 102 };
103}; 103};
104 104
@@ -133,7 +133,6 @@
133 status = "okay"; 133 status = "okay";
134 134
135 ethphy0: ethernet-phy@8 { 135 ethphy0: ethernet-phy@8 {
136 device_type = "ethernet-phy";
137 reg = <8>; 136 reg = <8>;
138 }; 137 };
139}; 138};
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index 4a62b206f680..8d8c80e3656d 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -94,37 +94,37 @@
94 94
95 led-level { 95 led-level {
96 label = "led_level"; 96 label = "led_level";
97 gpios = <&gpio1 9 0>; 97 gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
98 linux,default-trigger = "default-on"; 98 default-state = "on";
99 }; 99 };
100 power-blue { 100 power-blue {
101 label = "power:blue"; 101 label = "power:blue";
102 gpios = <&gpio1 10 0>; 102 gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
103 linux,default-trigger = "timer"; 103 default-state = "keep";
104 }; 104 };
105 power-red { 105 power-red {
106 label = "power:red"; 106 label = "power:red";
107 gpios = <&gpio1 11 0>; 107 gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
108 }; 108 };
109 usb1 { 109 usb1 {
110 label = "usb1:blue"; 110 label = "usb1:blue";
111 gpios = <&gpio1 12 0>; 111 gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
112 }; 112 };
113 usb2 { 113 usb2 {
114 label = "usb2:blue"; 114 label = "usb2:blue";
115 gpios = <&gpio1 13 0>; 115 gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
116 }; 116 };
117 usb3 { 117 usb3 {
118 label = "usb3:blue"; 118 label = "usb3:blue";
119 gpios = <&gpio1 14 0>; 119 gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
120 }; 120 };
121 usb4 { 121 usb4 {
122 label = "usb4:blue"; 122 label = "usb4:blue";
123 gpios = <&gpio1 15 0>; 123 gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
124 }; 124 };
125 otb { 125 otb {
126 label = "otb:blue"; 126 label = "otb:blue";
127 gpios = <&gpio1 16 0>; 127 gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
128 }; 128 };
129 }; 129 };
130 130
@@ -137,14 +137,14 @@
137 137
138 button@1 { 138 button@1 {
139 label = "OTB Button"; 139 label = "OTB Button";
140 linux,code = <133>; 140 linux,code = <KEY_COPY>;
141 gpios = <&gpio1 3 1>; 141 gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
142 debounce-interval = <100>; 142 debounce-interval = <100>;
143 }; 143 };
144 button@2 { 144 button@2 {
145 label = "Reset"; 145 label = "Reset";
146 linux,code = <0x198>; 146 linux,code = <KEY_RESTART>;
147 gpios = <&gpio0 12 1>; 147 gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
148 debounce-interval = <100>; 148 debounce-interval = <100>;
149 }; 149 };
150 }; 150 };
@@ -183,7 +183,6 @@
183 status = "okay"; 183 status = "okay";
184 184
185 ethphy0: ethernet-phy@11 { 185 ethphy0: ethernet-phy@11 {
186 device_type = "ethernet-phy";
187 reg = <11>; 186 reg = <11>;
188 }; 187 };
189}; 188};
diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
index d15395d671ed..59e7a5adeedb 100644
--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -127,20 +127,20 @@
127 127
128 power_led { 128 power_led {
129 label = "status:white:power_led"; 129 label = "status:white:power_led";
130 gpios = <&gpio0 16 0>; 130 gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
131 linux,default-trigger = "default-on"; 131 default-state = "keep";
132 }; 132 };
133 rebuild_led { 133 rebuild_led {
134 label = "status:white:rebuild_led"; 134 label = "status:white:rebuild_led";
135 gpios = <&gpio1 4 0>; 135 gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
136 }; 136 };
137 health_led { 137 health_led {
138 label = "status:red:health_led"; 138 label = "status:red:health_led";
139 gpios = <&gpio1 5 0>; 139 gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
140 }; 140 };
141 backup_led { 141 backup_led {
142 label = "status:blue:backup_led"; 142 label = "status:blue:backup_led";
143 gpios = <&gpio0 15 0>; 143 gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
144 }; 144 };
145 }; 145 };
146 gpio-keys { 146 gpio-keys {
@@ -154,18 +154,18 @@
154 154
155 Power { 155 Power {
156 label = "Power Button"; 156 label = "Power Button";
157 linux,code = <116>; 157 linux,code = <KEY_POWER>;
158 gpios = <&gpio0 14 1>; 158 gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
159 }; 159 };
160 Reset { 160 Reset {
161 label = "Reset Button"; 161 label = "Reset Button";
162 linux,code = <0x198>; 162 linux,code = <KEY_RESTART>;
163 gpios = <&gpio0 12 1>; 163 gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
164 }; 164 };
165 OTB { 165 OTB {
166 label = "OTB Button"; 166 label = "OTB Button";
167 linux,code = <133>; 167 linux,code = <KEY_COPY>;
168 gpios = <&gpio1 3 1>; 168 gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
169 }; 169 };
170 }; 170 };
171}; 171};
@@ -200,7 +200,6 @@
200 status = "okay"; 200 status = "okay";
201 201
202 ethphy1: ethernet-phy@11 { 202 ethphy1: ethernet-phy@11 {
203 device_type = "ethernet-phy";
204 reg = <11>; 203 reg = <11>;
205 }; 204 };
206}; 205};
diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
index cd44f37e54b5..04a1e44541b3 100644
--- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
@@ -38,8 +38,8 @@
38 38
39 i2c@0 { 39 i2c@0 {
40 compatible = "i2c-gpio"; 40 compatible = "i2c-gpio";
41 gpios = < &gpio0 8 0 /* sda */ 41 gpios = < &gpio0 8 GPIO_ACTIVE_HIGH /* sda */
42 &gpio0 9 0 >; /* scl */ 42 &gpio0 9 GPIO_ACTIVE_HIGH>; /* scl */
43 i2c-gpio,delay-us = <2>; /* ~100 kHz */ 43 i2c-gpio,delay-us = <2>; /* ~100 kHz */
44 }; 44 };
45}; 45};
@@ -55,7 +55,6 @@
55 status = "okay"; 55 status = "okay";
56 56
57 ethphy0: ethernet-phy@0 { 57 ethphy0: ethernet-phy@0 {
58 device_type = "ethernet-phy";
59 reg = <0>; 58 reg = <0>;
60 }; 59 };
61}; 60};
diff --git a/arch/arm/boot/dts/kirkwood-laplug.dts b/arch/arm/boot/dts/kirkwood-laplug.dts
new file mode 100644
index 000000000000..c9e82eff9bf2
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-laplug.dts
@@ -0,0 +1,175 @@
1/*
2 * Copyright (C) 2013 Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9/dts-v1/;
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/input/input.h>
13#include "kirkwood.dtsi"
14#include "kirkwood-6192.dtsi"
15
16/ {
17 model = "LaCie LaPlug";
18 compatible = "lacie,laplug", "marvell,kirkwood-88f6192", "marvell,kirkwood";
19
20 memory {
21 device_type = "memory";
22 reg = <0x00000000 0x8000000>; /* 128 MB */
23 };
24
25 chosen {
26 bootargs = "console=ttyS0,115200n8 earlyprintk";
27 };
28
29 mbus {
30 pcie-controller {
31 status = "okay";
32 pcie@1,0 {
33 status = "okay";
34 };
35 };
36 };
37
38 ocp@f1000000 {
39 serial@12000 {
40 pinctrl-0 = <&pmx_uart0>;
41 pinctrl-names = "default";
42 status = "okay";
43 };
44
45 i2c@11000 {
46 pinctrl-0 = <&pmx_twsi0>;
47 pinctrl-names = "default";
48 status = "okay";
49
50 eeprom@50 {
51 compatible = "at,24c04";
52 pagesize = <16>;
53 reg = <0x50>;
54 };
55 };
56
57 pinctrl: pinctrl@10000 {
58 pmx_usb_power_enable: pmx-usb-power-enable {
59 marvell,pins = "mpp14";
60 marvell,function = "gpio";
61 };
62 };
63 };
64
65 gpio_keys {
66 compatible = "gpio-keys";
67
68 button@1{
69 label = "Power push button";
70 linux,code = <KEY_POWER>;
71 gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
72 };
73 };
74
75 gpio-leds {
76 compatible = "gpio-leds";
77
78 red-fail {
79 label = "laplug_v2:red:power";
80 gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
81 };
82 blue-power {
83 label = "laplug_v2:blue:power";
84 gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
85 linux,default-trigger = "default-on";
86 };
87 };
88
89 gpio_poweroff {
90 compatible = "gpio-poweroff";
91 gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
92 };
93
94 regulators {
95 compatible = "simple-bus";
96 #address-cells = <1>;
97 #size-cells = <0>;
98 pinctrl-0 = <&pmx_usb_power_enable>;
99 pinctrl-names = "default";
100
101 usb_power_back1: regulator@1 {
102 compatible = "regulator-fixed";
103 reg = <1>;
104 regulator-name = "USB Power Back 1";
105 regulator-min-microvolt = <5000000>;
106 regulator-max-microvolt = <5000000>;
107 enable-active-high;
108 regulator-always-on;
109 regulator-boot-on;
110 gpio = <&gpio0 15 GPIO_ACTIVE_HIGH>;
111 };
112
113 usb_power_back2: regulator@2 {
114 compatible = "regulator-fixed";
115 reg = <2>;
116 regulator-name = "USB Power Back 2";
117 regulator-min-microvolt = <5000000>;
118 regulator-max-microvolt = <5000000>;
119 enable-active-high;
120 regulator-always-on;
121 regulator-boot-on;
122 gpio = <&gpio0 28 GPIO_ACTIVE_HIGH>;
123 };
124
125 usb_power_front: regulator@3 {
126 compatible = "regulator-fixed";
127 reg = <3>;
128 regulator-name = "USB Power Front";
129 regulator-min-microvolt = <5000000>;
130 regulator-max-microvolt = <5000000>;
131 enable-active-high;
132 regulator-always-on;
133 regulator-boot-on;
134 gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>;
135 };
136 };
137};
138
139&nand {
140 /* Total size : 512MB */
141 status = "okay";
142 pinctrl-0 = <&pmx_nand>;
143
144 partition@0 {
145 label = "u-boot";
146 reg = <0x0 0x100000>; /* 1MB */
147 read-only;
148 };
149
150 partition@100000 {
151 label = "uImage";
152 reg = <0x100000 0x1000000>; /* 16MB */
153 };
154
155 partition@1100000 {
156 label = "rootfs";
157 reg = <0x1100000 0x1EF00000>; /* 495MB */
158 };
159};
160
161&mdio {
162 status = "okay";
163
164 ethphy0: ethernet-phy@0 {
165 device_type = "ethernet-phy";
166 reg = <0>;
167 };
168};
169
170&eth0 {
171 status = "okay";
172 ethernet0-port@0 {
173 phy-handle = <&ethphy0>;
174 };
175};
diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
index 4e8f9e42c592..1656653d339b 100644
--- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
@@ -108,20 +108,20 @@
108 108
109 button@1 { 109 button@1 {
110 label = "Function Button"; 110 label = "Function Button";
111 linux,code = <357>; 111 linux,code = <KEY_OPTION>;
112 gpios = <&gpio1 9 1>; 112 gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
113 }; 113 };
114 button@2 { 114 button@2 {
115 label = "Power-on Switch"; 115 label = "Power-on Switch";
116 linux,code = <0>; 116 linux,code = <KEY_RESERVED>;
117 linux,input-type = <5>; 117 linux,input-type = <5>;
118 gpios = <&gpio1 10 1>; 118 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
119 }; 119 };
120 button@3 { 120 button@3 {
121 label = "Power-auto Switch"; 121 label = "Power-auto Switch";
122 linux,code = <1>; 122 linux,code = <KEY_ESC>;
123 linux,input-type = <5>; 123 linux,input-type = <5>;
124 gpios = <&gpio1 11 1>; 124 gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
125 }; 125 };
126 }; 126 };
127 127
@@ -134,28 +134,28 @@
134 134
135 led@1 { 135 led@1 {
136 label = "lsxl:blue:func"; 136 label = "lsxl:blue:func";
137 gpios = <&gpio1 4 1>; 137 gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
138 }; 138 };
139 139
140 led@2 { 140 led@2 {
141 label = "lsxl:red:alarm"; 141 label = "lsxl:red:alarm";
142 gpios = <&gpio1 5 1>; 142 gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
143 }; 143 };
144 144
145 led@3 { 145 led@3 {
146 label = "lsxl:amber:info"; 146 label = "lsxl:amber:info";
147 gpios = <&gpio1 6 1>; 147 gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
148 }; 148 };
149 149
150 led@4 { 150 led@4 {
151 label = "lsxl:blue:power"; 151 label = "lsxl:blue:power";
152 gpios = <&gpio1 7 1>; 152 gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
153 linux,default-trigger = "default-on"; 153 default-state = "keep";
154 }; 154 };
155 155
156 led@5 { 156 led@5 {
157 label = "lsxl:red:func"; 157 label = "lsxl:red:func";
158 gpios = <&gpio1 16 1>; 158 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
159 }; 159 };
160 }; 160 };
161 161
@@ -163,13 +163,13 @@
163 compatible = "gpio-fan"; 163 compatible = "gpio-fan";
164 pinctrl-0 = <&pmx_fan_low &pmx_fan_high &pmx_fan_lock>; 164 pinctrl-0 = <&pmx_fan_low &pmx_fan_high &pmx_fan_lock>;
165 pinctrl-names = "default"; 165 pinctrl-names = "default";
166 gpios = <&gpio0 19 1 166 gpios = <&gpio0 19 GPIO_ACTIVE_LOW
167 &gpio0 18 1>; 167 &gpio0 18 GPIO_ACTIVE_LOW>;
168 gpio-fan,speed-map = <0 3 168 gpio-fan,speed-map = <0 3
169 1500 2 169 1500 2
170 3250 1 170 3250 1
171 5000 0>; 171 5000 0>;
172 alarm-gpios = <&gpio1 8 0>; 172 alarm-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
173 }; 173 };
174 174
175 restart_poweroff { 175 restart_poweroff {
@@ -212,12 +212,10 @@
212 status = "okay"; 212 status = "okay";
213 213
214 ethphy0: ethernet-phy@0 { 214 ethphy0: ethernet-phy@0 {
215 device_type = "ethernet-phy";
216 reg = <0>; 215 reg = <0>;
217 }; 216 };
218 217
219 ethphy1: ethernet-phy@8 { 218 ethphy1: ethernet-phy@8 {
220 device_type = "ethernet-phy";
221 reg = <8>; 219 reg = <8>;
222 }; 220 };
223}; 221};
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
index 6c1ec2786e6e..73722c067501 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -110,7 +110,7 @@
110 pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>; 110 pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>;
111 pinctrl-names = "default"; 111 pinctrl-names = "default";
112 status = "okay"; 112 status = "okay";
113 cd-gpios = <&gpio1 15 1>; 113 cd-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
114 /* No WP GPIO */ 114 /* No WP GPIO */
115 }; 115 };
116 }; 116 };
@@ -126,36 +126,36 @@
126 126
127 health { 127 health {
128 label = "status:green:health"; 128 label = "status:green:health";
129 gpios = <&gpio0 7 1>; 129 gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
130 }; 130 };
131 131
132 user1o { 132 user1o {
133 label = "user1:orange"; 133 label = "user1:orange";
134 gpios = <&gpio1 8 1>; 134 gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
135 default-state = "on"; 135 default-state = "on";
136 }; 136 };
137 137
138 user1g { 138 user1g {
139 label = "user1:green"; 139 label = "user1:green";
140 gpios = <&gpio1 9 1>; 140 gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
141 default-state = "on"; 141 default-state = "on";
142 }; 142 };
143 143
144 user0o { 144 user0o {
145 label = "user0:orange"; 145 label = "user0:orange";
146 gpios = <&gpio1 12 1>; 146 gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
147 default-state = "on"; 147 default-state = "on";
148 }; 148 };
149 149
150 user0g { 150 user0g {
151 label = "user0:green"; 151 label = "user0:green";
152 gpios = <&gpio1 13 1>; 152 gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
153 default-state = "on"; 153 default-state = "on";
154 }; 154 };
155 155
156 misc { 156 misc {
157 label = "status:orange:misc"; 157 label = "status:orange:misc";
158 gpios = <&gpio1 14 1>; 158 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
159 default-state = "on"; 159 default-state = "on";
160 }; 160 };
161 161
@@ -197,12 +197,10 @@
197 status = "okay"; 197 status = "okay";
198 198
199 ethphy0: ethernet-phy@1 { 199 ethphy0: ethernet-phy@1 {
200 device_type = "ethernet-phy";
201 reg = <1>; 200 reg = <1>;
202 }; 201 };
203 202
204 ethphy1: ethernet-phy@2 { 203 ethphy1: ethernet-phy@2 {
205 device_type = "ethernet-phy";
206 reg = <2>; 204 reg = <2>;
207 }; 205 };
208}; 206};
diff --git a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
index 6317e1d088b3..dc86429756d7 100644
--- a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
+++ b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
@@ -90,17 +90,17 @@
90 90
91 green-status { 91 green-status {
92 label = "gtw:green:Status"; 92 label = "gtw:green:Status";
93 gpios = <&gpio0 20 0>; 93 gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
94 }; 94 };
95 95
96 red-status { 96 red-status {
97 label = "gtw:red:Status"; 97 label = "gtw:red:Status";
98 gpios = <&gpio0 21 0>; 98 gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
99 }; 99 };
100 100
101 green-usb { 101 green-usb {
102 label = "gtw:green:USB"; 102 label = "gtw:green:USB";
103 gpios = <&gpio0 12 0>; 103 gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
104 }; 104 };
105 }; 105 };
106 106
@@ -113,13 +113,13 @@
113 113
114 button@1 { 114 button@1 {
115 label = "SWR Button"; 115 label = "SWR Button";
116 linux,code = <0x198>; /* KEY_RESTART */ 116 linux,code = <KEY_RESTART>;
117 gpios = <&gpio1 15 1>; 117 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
118 }; 118 };
119 button@2 { 119 button@2 {
120 label = "WPS Button"; 120 label = "WPS Button";
121 linux,code = <0x211>; /* KEY_WPS_BUTTON */ 121 linux,code = <KEY_WPS_BUTTON>;
122 gpios = <&gpio1 14 1>; 122 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
123 }; 123 };
124 }; 124 };
125}; 125};
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 e6a102cf424c..4838478019cc 100644
--- a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
@@ -1,3 +1,14 @@
1/*
2 * Device Tree file for NETGEAR ReadyNAS Duo v2
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
1/dts-v1/; 12/dts-v1/;
2 13
3#include "kirkwood.dtsi" 14#include "kirkwood.dtsi"
@@ -32,41 +43,50 @@
32 marvell,pins = "mpp47"; 43 marvell,pins = "mpp47";
33 marvell,function = "gpio"; 44 marvell,function = "gpio";
34 }; 45 };
46
35 pmx_button_backup: pmx-button-backup { 47 pmx_button_backup: pmx-button-backup {
36 marvell,pins = "mpp45"; 48 marvell,pins = "mpp45";
37 marvell,function = "gpio"; 49 marvell,function = "gpio";
38 }; 50 };
51
39 pmx_button_reset: pmx-button-reset { 52 pmx_button_reset: pmx-button-reset {
40 marvell,pins = "mpp13"; 53 marvell,pins = "mpp13";
41 marvell,function = "gpio"; 54 marvell,function = "gpio";
42 }; 55 };
56
43 pmx_led_blue_power: pmx-led-blue-power { 57 pmx_led_blue_power: pmx-led-blue-power {
44 marvell,pins = "mpp31"; 58 marvell,pins = "mpp31";
45 marvell,function = "gpio"; 59 marvell,function = "gpio";
46 }; 60 };
61
47 pmx_led_blue_activity: pmx-led-blue-activity { 62 pmx_led_blue_activity: pmx-led-blue-activity {
48 marvell,pins = "mpp38"; 63 marvell,pins = "mpp38";
49 marvell,function = "gpio"; 64 marvell,function = "gpio";
50 }; 65 };
66
51 pmx_led_blue_disk1: pmx-led-blue-disk1 { 67 pmx_led_blue_disk1: pmx-led-blue-disk1 {
52 marvell,pins = "mpp23"; 68 marvell,pins = "mpp23";
53 marvell,function = "gpio"; 69 marvell,function = "gpio";
54 }; 70 };
71
55 pmx_led_blue_disk2: pmx-led-blue-disk2 { 72 pmx_led_blue_disk2: pmx-led-blue-disk2 {
56 marvell,pins = "mpp22"; 73 marvell,pins = "mpp22";
57 marvell,function = "gpio"; 74 marvell,function = "gpio";
58 }; 75 };
76
59 pmx_led_blue_backup: pmx-led-blue-backup { 77 pmx_led_blue_backup: pmx-led-blue-backup {
60 marvell,pins = "mpp29"; 78 marvell,pins = "mpp29";
61 marvell,function = "gpio"; 79 marvell,function = "gpio";
62 }; 80 };
81
82 pmx_poweroff: pmx-poweroff {
83 marvell,pins = "mpp30";
84 marvell,function = "gpio";
85 };
63 }; 86 };
64 87
65 clocks { 88 clocks {
66 #address-cells = <1>; 89 g762_clk: g762-oscillator {
67 #size-cells = <0>;
68
69 g762_clk: fixedclk {
70 compatible = "fixed-clock"; 90 compatible = "fixed-clock";
71 #clock-cells = <0>; 91 #clock-cells = <0>;
72 clock-frequency = <8192>; 92 clock-frequency = <8192>;
@@ -112,69 +132,80 @@
112 132
113 power_led { 133 power_led {
114 label = "status:blue:power_led"; 134 label = "status:blue:power_led";
115 gpios = <&gpio0 31 1>; /* GPIO 31 Active Low */ 135 gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
116 linux,default-trigger = "default-on"; 136 default-state = "keep";
117 }; 137 };
138
118 activity_led { 139 activity_led {
119 label = "status:blue:activity_led"; 140 label = "status:blue:activity_led";
120 gpios = <&gpio1 6 1>; /* GPIO 38 Active Low */ 141 gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
121 }; 142 };
143
122 disk1_led { 144 disk1_led {
123 label = "status:blue:disk1_led"; 145 label = "status:blue:disk1_led";
124 gpios = <&gpio0 23 1>; /* GPIO 23 Active Low */ 146 gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
125 }; 147 };
148
126 disk2_led { 149 disk2_led {
127 label = "status:blue:disk2_led"; 150 label = "status:blue:disk2_led";
128 gpios = <&gpio0 22 1>; /* GPIO 22 Active Low */ 151 gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
129 }; 152 };
153
130 backup_led { 154 backup_led {
131 label = "status:blue:backup_led"; 155 label = "status:blue:backup_led";
132 gpios = <&gpio0 29 1>; /* GPIO 29 Active Low*/ 156 gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
133 }; 157 };
134 }; 158 };
135 159
136 gpio_keys { 160 gpio-keys {
137 compatible = "gpio-keys"; 161 compatible = "gpio-keys";
138 #address-cells = <1>;
139 #size-cells = <0>;
140 pinctrl-0 = <&pmx_button_power &pmx_button_backup 162 pinctrl-0 = <&pmx_button_power &pmx_button_backup
141 &pmx_button_reset>; 163 &pmx_button_reset>;
142 pinctrl-names = "default"; 164 pinctrl-names = "default";
143 165
144 button@1 { 166 power-button {
145 label = "Power Button"; 167 label = "Power Button";
146 linux,code = <116>; /* KEY_POWER */ 168 linux,code = <KEY_POWER>;
147 gpios = <&gpio1 15 1>; 169 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
148 }; 170 };
149 button@2 { 171
172 reset-button {
150 label = "Reset Button"; 173 label = "Reset Button";
151 linux,code = <0x198>; /* KEY_RESTART */ 174 linux,code = <KEY_RESTART>;
152 gpios = <&gpio0 13 1>; 175 gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
153 }; 176 };
154 button@3 { 177
178 backup-button {
155 label = "Backup Button"; 179 label = "Backup Button";
156 linux,code = <133>; /* KEY_COPY */ 180 linux,code = <KEY_COPY>;
157 gpios = <&gpio1 13 1>; 181 gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
158 }; 182 };
159 }; 183 };
160 184
161 regulators { 185 gpio-poweroff {
162 compatible = "simple-bus"; 186 compatible = "gpio-poweroff";
163 #address-cells = <1>; 187 pinctrl-0 = <&pmx_poweroff>;
164 #size-cells = <0>; 188 pinctrl-names = "default";
165 189 gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
166 usb_power: regulator@1 { 190 };
167 compatible = "regulator-fixed"; 191
168 reg = <1>; 192 regulators {
169 regulator-name = "USB 3.0 Power"; 193 compatible = "simple-bus";
170 regulator-min-microvolt = <5000000>; 194 #address-cells = <1>;
171 regulator-max-microvolt = <5000000>; 195 #size-cells = <0>;
172 enable-active-high; 196
173 regulator-always-on; 197 usb3_regulator: usb3-regulator {
174 regulator-boot-on; 198 compatible = "regulator-fixed";
175 gpio = <&gpio1 14 0>; 199 reg = <1>;
176 }; 200 regulator-name = "USB 3.0 Power";
177 }; 201 regulator-min-microvolt = <5000000>;
202 regulator-max-microvolt = <5000000>;
203 enable-active-high;
204 regulator-always-on;
205 regulator-boot-on;
206 gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
207 };
208 };
178}; 209};
179 210
180&nand { 211&nand {
@@ -210,8 +241,7 @@
210&mdio { 241&mdio {
211 status = "okay"; 242 status = "okay";
212 243
213 ethphy0: ethernet-phy@0 { 244 ethphy0: ethernet-phy@0 { /* Marvell 88E1318 */
214 device_type = "ethernet-phy";
215 reg = <0>; 245 reg = <0>;
216 }; 246 };
217}; 247};
diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas_nv+_v2.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas_nv+_v2.dts
new file mode 100644
index 000000000000..7c8a0d9d8d1f
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_nv+_v2.dts
@@ -0,0 +1,268 @@
1/*
2 * Device Tree file for NETGEAR ReadyNAS NV+ v2
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 "kirkwood.dtsi"
15#include "kirkwood-6282.dtsi"
16
17/ {
18 model = "NETGEAR ReadyNAS NV+ v2";
19 compatible = "netgear,readynas-nv+-v2", "netgear,readynas", "marvell,kirkwood-88f6282", "marvell,kirkwood";
20
21 memory { /* 256 MB */
22 device_type = "memory";
23 reg = <0x00000000 0x10000000>;
24 };
25
26 chosen {
27 bootargs = "console=ttyS0,115200n8 earlyprintk";
28 };
29
30 mbus {
31 pcie-controller {
32 status = "okay";
33
34 /* Connected to NEC uPD720200 USB 3.0 controller */
35 pcie@1,0 {
36 /* Port 0, Lane 0 */
37 status = "okay";
38 };
39 };
40 };
41
42 ocp@f1000000 {
43 pinctrl: pinctrl@10000 {
44 pmx_button_power: pmx-button-power {
45 marvell,pins = "mpp47";
46 marvell,function = "gpio";
47 };
48
49 pmx_button_backup: pmx-button-backup {
50 marvell,pins = "mpp45";
51 marvell,function = "gpio";
52 };
53
54 pmx_button_reset: pmx-button-reset {
55 marvell,pins = "mpp13";
56 marvell,function = "gpio";
57 };
58
59 pmx_led_blue_power: pmx-led-blue-power {
60 marvell,pins = "mpp31";
61 marvell,function = "gpio";
62 };
63
64 pmx_led_blue_backup: pmx-led-blue-backup {
65 marvell,pins = "mpp22";
66 marvell,function = "gpio";
67 };
68
69 pmx_led_blue_disk1: pmx-led-blue-disk1 {
70 marvell,pins = "mpp20";
71 marvell,function = "gpio";
72 };
73
74 pmx_led_blue_disk2: pmx-led-blue-disk2 {
75 marvell,pins = "mpp23";
76 marvell,function = "gpio";
77 };
78
79 pmx_led_blue_disk3: pmx-led-blue-disk3 {
80 marvell,pins = "mpp24";
81 marvell,function = "gpio";
82 };
83
84 pmx_led_blue_disk4: pmx-led-blue-disk4 {
85 marvell,pins = "mpp29";
86 marvell,function = "gpio";
87 };
88
89 pmx_poweroff: pmx-poweroff {
90 marvell,pins = "mpp30";
91 marvell,function = "gpio";
92 };
93 };
94
95 clocks {
96 g762_clk: g762-oscillator {
97 compatible = "fixed-clock";
98 #clock-cells = <0>;
99 clock-frequency = <8192>;
100 };
101 };
102
103 i2c@11000 {
104 status = "okay";
105
106 rs5c372a: rs5c372a@32 {
107 compatible = "ricoh,rs5c372a";
108 reg = <0x32>;
109 };
110
111 g762: g762@3e {
112 compatible = "gmt,g762";
113 reg = <0x3e>;
114 clocks = <&g762_clk>; /* input clock */
115 fan_gear_mode = <0>;
116 fan_startv = <1>;
117 pwm_polarity = <0>;
118 };
119 };
120
121 serial@12000 {
122 pinctrl-0 = <&pmx_uart0>;
123 pinctrl-names = "default";
124 status = "okay";
125 };
126
127 sata@80000 { /* Connected to Marvell 88SM4140 SATA port multiplier */
128 status = "okay";
129 nr-ports = <1>;
130 };
131 };
132
133 gpio-leds {
134 compatible = "gpio-leds";
135 pinctrl-0 = < &pmx_led_blue_power &pmx_led_blue_backup
136 &pmx_led_blue_disk1 &pmx_led_blue_disk2
137 &pmx_led_blue_disk3 &pmx_led_blue_disk3 >;
138 pinctrl-names = "default";
139
140 power_led {
141 label = "status:blue:power_led";
142 gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
143 linux,default-trigger = "default-on";
144 };
145
146 backup_led {
147 label = "status:blue:backup_led";
148 gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
149 };
150
151 disk1_led {
152 label = "status:blue:disk1_led";
153 gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
154 };
155
156 disk2_led {
157 label = "status:blue:disk2_led";
158 gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
159 };
160
161 disk3_led {
162 label = "status:blue:disk3_led";
163 gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
164 };
165
166 disk4_led {
167 label = "status:blue:disk4_led";
168 gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
169 };
170 };
171
172 gpio-keys {
173 compatible = "gpio-keys";
174 pinctrl-0 = <&pmx_button_power &pmx_button_backup
175 &pmx_button_reset>;
176 pinctrl-names = "default";
177
178 power-button {
179 label = "Power Button";
180 linux,code = <KEY_POWER>;
181 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
182 };
183
184 reset-button {
185 label = "Reset Button";
186 linux,code = <KEY_RESTART>;
187 gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
188 };
189
190 backup-button {
191 label = "Backup Button";
192 linux,code = <KEY_COPY>;
193 gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
194 };
195 };
196
197 gpio-poweroff {
198 compatible = "gpio-poweroff";
199 pinctrl-0 = <&pmx_poweroff>;
200 pinctrl-names = "default";
201 gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
202 };
203
204 regulators {
205 compatible = "simple-bus";
206 #address-cells = <1>;
207 #size-cells = <0>;
208
209 usb3_regulator: usb3-regulator {
210 compatible = "regulator-fixed";
211 reg = <1>;
212 regulator-name = "USB 3.0 Power";
213 regulator-min-microvolt = <5000000>;
214 regulator-max-microvolt = <5000000>;
215 enable-active-high;
216 regulator-always-on;
217 regulator-boot-on;
218 gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
219 };
220 };
221};
222
223&nand {
224 status = "okay";
225
226 partition@0 {
227 label = "u-boot";
228 reg = <0x0000000 0x180000>;
229 read-only;
230 };
231
232 partition@180000 {
233 label = "u-boot-env";
234 reg = <0x180000 0x20000>;
235 };
236
237 partition@200000 {
238 label = "uImage";
239 reg = <0x0200000 0x600000>;
240 };
241
242 partition@800000 {
243 label = "minirootfs";
244 reg = <0x0800000 0x1000000>;
245 };
246
247 partition@1800000 {
248 label = "jffs2";
249 reg = <0x1800000 0x6800000>;
250 };
251};
252
253&mdio {
254 status = "okay";
255
256 ethphy0: ethernet-phy@0 { /* Marvell 88E1318 */
257 device_type = "ethernet-phy";
258 reg = <0>;
259 };
260};
261
262&eth0 {
263 status = "okay";
264
265 ethernet0-port@0 {
266 phy-handle = <&ethphy0>;
267 };
268};
diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
index 2fcb82e20828..743152f31a81 100644
--- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
@@ -64,8 +64,8 @@
64 64
65 button@1 { 65 button@1 {
66 label = "Power push button"; 66 label = "Power push button";
67 linux,code = <116>; 67 linux,code = <KEY_POWER>;
68 gpios = <&gpio1 0 0>; 68 gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
69 }; 69 };
70 }; 70 };
71 71
@@ -74,13 +74,13 @@
74 74
75 red-fail { 75 red-fail {
76 label = "ns2:red:fail"; 76 label = "ns2:red:fail";
77 gpios = <&gpio0 12 0>; 77 gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
78 }; 78 };
79 }; 79 };
80 80
81 gpio_poweroff { 81 gpio_poweroff {
82 compatible = "gpio-poweroff"; 82 compatible = "gpio-poweroff";
83 gpios = <&gpio0 31 0>; 83 gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
84 }; 84 };
85 85
86}; 86};
@@ -89,7 +89,6 @@
89 status = "okay"; 89 status = "okay";
90 90
91 ethphy0: ethernet-phy { 91 ethphy0: ethernet-phy {
92 device_type = "ethernet-phy";
93 /* overwrite reg property in board file */ 92 /* overwrite reg property in board file */
94 }; 93 };
95}; 94};
diff --git a/arch/arm/boot/dts/kirkwood-ns2lite.dts b/arch/arm/boot/dts/kirkwood-ns2lite.dts
index 279607093cdb..1f2ca60d8b3d 100644
--- a/arch/arm/boot/dts/kirkwood-ns2lite.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2lite.dts
@@ -25,8 +25,8 @@
25 25
26 blue-sata { 26 blue-sata {
27 label = "ns2:blue:sata"; 27 label = "ns2:blue:sata";
28 gpios = <&gpio0 30 1>; 28 gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
29 linux,default-trigger = "default-on"; 29 linux,default-trigger = "ide-disk";
30 }; 30 };
31 }; 31 };
32}; 32};
diff --git a/arch/arm/boot/dts/kirkwood-ns2max.dts b/arch/arm/boot/dts/kirkwood-ns2max.dts
index defdc77fb550..72c78d0b1116 100644
--- a/arch/arm/boot/dts/kirkwood-ns2max.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2max.dts
@@ -22,10 +22,10 @@
22 22
23 gpio_fan { 23 gpio_fan {
24 compatible = "gpio-fan"; 24 compatible = "gpio-fan";
25 gpios = <&gpio0 22 1 25 gpios = <&gpio0 22 GPIO_ACTIVE_LOW
26 &gpio0 7 1 26 &gpio0 7 GPIO_ACTIVE_LOW
27 &gpio1 1 1 27 &gpio1 1 GPIO_ACTIVE_LOW
28 &gpio0 23 1>; 28 &gpio0 23 GPIO_ACTIVE_LOW>;
29 gpio-fan,speed-map = 29 gpio-fan,speed-map =
30 < 0 0 30 < 0 0
31 1500 15 31 1500 15
@@ -36,7 +36,7 @@
36 3300 10 36 3300 10
37 4300 9 37 4300 9
38 5500 8>; 38 5500 8>;
39 alarm-gpios = <&gpio0 25 1>; 39 alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
40 }; 40 };
41 41
42 ns2-leds { 42 ns2-leds {
diff --git a/arch/arm/boot/dts/kirkwood-ns2mini.dts b/arch/arm/boot/dts/kirkwood-ns2mini.dts
index adbafdd90991..c441bf62c09f 100644
--- a/arch/arm/boot/dts/kirkwood-ns2mini.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
@@ -23,10 +23,10 @@
23 23
24 gpio_fan { 24 gpio_fan {
25 compatible = "gpio-fan"; 25 compatible = "gpio-fan";
26 gpios = <&gpio0 22 1 26 gpios = <&gpio0 22 GPIO_ACTIVE_LOW
27 &gpio0 7 1 27 &gpio0 7 GPIO_ACTIVE_LOW
28 &gpio1 1 1 28 &gpio1 1 GPIO_ACTIVE_LOW
29 &gpio0 23 1>; 29 &gpio0 23 GPIO_ACTIVE_LOW>;
30 gpio-fan,speed-map = 30 gpio-fan,speed-map =
31 < 0 0 31 < 0 0
32 3000 15 32 3000 15
@@ -37,7 +37,7 @@
37 7140 10 37 7140 10
38 7980 9 38 7980 9
39 9200 8>; 39 9200 8>;
40 alarm-gpios = <&gpio0 25 1>; 40 alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
41 }; 41 };
42 42
43 ns2-leds { 43 ns2-leds {
diff --git a/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi b/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
index e3f915defd3d..aa78c2d11fe7 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
@@ -40,7 +40,7 @@
40 compatible = "gpio-poweroff"; 40 compatible = "gpio-poweroff";
41 pinctrl-0 = <&pmx_pwr_off>; 41 pinctrl-0 = <&pmx_pwr_off>;
42 pinctrl-names = "default"; 42 pinctrl-names = "default";
43 gpios = <&gpio1 16 0>; 43 gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
44 }; 44 };
45 45
46 regulators { 46 regulators {
@@ -58,7 +58,7 @@
58 regulator-max-microvolt = <5000000>; 58 regulator-max-microvolt = <5000000>;
59 regulator-always-on; 59 regulator-always-on;
60 regulator-boot-on; 60 regulator-boot-on;
61 gpio = <&gpio0 21 0>; 61 gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
62 }; 62 };
63 }; 63 };
64}; 64};
diff --git a/arch/arm/boot/dts/kirkwood-nsa310.dts b/arch/arm/boot/dts/kirkwood-nsa310.dts
index b5418bcaecce..03fa24cf3344 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310.dts
+++ b/arch/arm/boot/dts/kirkwood-nsa310.dts
@@ -119,18 +119,18 @@
119 119
120 button@1 { 120 button@1 {
121 label = "Power Button"; 121 label = "Power Button";
122 linux,code = <116>; 122 linux,code = <KEY_POWER>;
123 gpios = <&gpio1 14 0>; 123 gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
124 }; 124 };
125 button@2 { 125 button@2 {
126 label = "Copy Button"; 126 label = "Copy Button";
127 linux,code = <133>; 127 linux,code = <KEY_COPY>;
128 gpios = <&gpio1 5 1>; 128 gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
129 }; 129 };
130 button@3 { 130 button@3 {
131 label = "Reset Button"; 131 label = "Reset Button";
132 linux,code = <0x198>; 132 linux,code = <KEY_RESTART>;
133 gpios = <&gpio1 4 1>; 133 gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
134 }; 134 };
135 }; 135 };
136 136
@@ -145,43 +145,43 @@
145 145
146 green-sys { 146 green-sys {
147 label = "nsa310:green:sys"; 147 label = "nsa310:green:sys";
148 gpios = <&gpio0 28 0>; 148 gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
149 }; 149 };
150 red-sys { 150 red-sys {
151 label = "nsa310:red:sys"; 151 label = "nsa310:red:sys";
152 gpios = <&gpio0 29 0>; 152 gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
153 }; 153 };
154 green-hdd { 154 green-hdd {
155 label = "nsa310:green:hdd"; 155 label = "nsa310:green:hdd";
156 gpios = <&gpio1 9 0>; 156 gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
157 }; 157 };
158 red-hdd { 158 red-hdd {
159 label = "nsa310:red:hdd"; 159 label = "nsa310:red:hdd";
160 gpios = <&gpio1 10 0>; 160 gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
161 }; 161 };
162 green-esata { 162 green-esata {
163 label = "nsa310:green:esata"; 163 label = "nsa310:green:esata";
164 gpios = <&gpio0 12 0>; 164 gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
165 }; 165 };
166 red-esata { 166 red-esata {
167 label = "nsa310:red:esata"; 167 label = "nsa310:red:esata";
168 gpios = <&gpio0 13 0>; 168 gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
169 }; 169 };
170 green-usb { 170 green-usb {
171 label = "nsa310:green:usb"; 171 label = "nsa310:green:usb";
172 gpios = <&gpio0 15 0>; 172 gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
173 }; 173 };
174 red-usb { 174 red-usb {
175 label = "nsa310:red:usb"; 175 label = "nsa310:red:usb";
176 gpios = <&gpio0 16 0>; 176 gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
177 }; 177 };
178 green-copy { 178 green-copy {
179 label = "nsa310:green:copy"; 179 label = "nsa310:green:copy";
180 gpios = <&gpio1 7 0>; 180 gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
181 }; 181 };
182 red-copy { 182 red-copy {
183 label = "nsa310:red:copy"; 183 label = "nsa310:red:copy";
184 gpios = <&gpio1 8 0>; 184 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
185 }; 185 };
186 }; 186 };
187}; 187};
diff --git a/arch/arm/boot/dts/kirkwood-nsa310a.dts b/arch/arm/boot/dts/kirkwood-nsa310a.dts
index ab0212b0e6f5..a5e779452867 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310a.dts
+++ b/arch/arm/boot/dts/kirkwood-nsa310a.dts
@@ -107,18 +107,18 @@
107 107
108 button@1 { 108 button@1 {
109 label = "Power Button"; 109 label = "Power Button";
110 linux,code = <116>; 110 linux,code = <KEY_POWER>;
111 gpios = <&gpio1 14 0>; 111 gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
112 }; 112 };
113 button@2 { 113 button@2 {
114 label = "Copy Button"; 114 label = "Copy Button";
115 linux,code = <133>; 115 linux,code = <KEY_COPY>;
116 gpios = <&gpio1 5 1>; 116 gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
117 }; 117 };
118 button@3 { 118 button@3 {
119 label = "Reset Button"; 119 label = "Reset Button";
120 linux,code = <0x198>; 120 linux,code = <KEY_RESTART>;
121 gpios = <&gpio1 4 1>; 121 gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
122 }; 122 };
123 }; 123 };
124 124
@@ -127,39 +127,39 @@
127 127
128 green-sys { 128 green-sys {
129 label = "nsa310:green:sys"; 129 label = "nsa310:green:sys";
130 gpios = <&gpio0 28 0>; 130 gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
131 }; 131 };
132 red-sys { 132 red-sys {
133 label = "nsa310:red:sys"; 133 label = "nsa310:red:sys";
134 gpios = <&gpio0 29 0>; 134 gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
135 }; 135 };
136 green-hdd { 136 green-hdd {
137 label = "nsa310:green:hdd"; 137 label = "nsa310:green:hdd";
138 gpios = <&gpio1 9 0>; 138 gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
139 }; 139 };
140 red-hdd { 140 red-hdd {
141 label = "nsa310:red:hdd"; 141 label = "nsa310:red:hdd";
142 gpios = <&gpio1 10 0>; 142 gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
143 }; 143 };
144 green-esata { 144 green-esata {
145 label = "nsa310:green:esata"; 145 label = "nsa310:green:esata";
146 gpios = <&gpio0 12 0>; 146 gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
147 }; 147 };
148 red-esata { 148 red-esata {
149 label = "nsa310:red:esata"; 149 label = "nsa310:red:esata";
150 gpios = <&gpio0 13 0>; 150 gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
151 }; 151 };
152 green-usb { 152 green-usb {
153 label = "nsa310:green:usb"; 153 label = "nsa310:green:usb";
154 gpios = <&gpio0 15 0>; 154 gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
155 }; 155 };
156 green-copy { 156 green-copy {
157 label = "nsa310:green:copy"; 157 label = "nsa310:green:copy";
158 gpios = <&gpio1 7 0>; 158 gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
159 }; 159 };
160 red-copy { 160 red-copy {
161 label = "nsa310:red:copy"; 161 label = "nsa310:red:copy";
162 gpios = <&gpio1 8 0>; 162 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
163 }; 163 };
164 }; 164 };
165}; 165};
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
index f0e3d213604c..b88da9392c32 100644
--- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
@@ -101,17 +101,17 @@
101 101
102 led-red { 102 led-red {
103 label = "obsa6:red:stat"; 103 label = "obsa6:red:stat";
104 gpios = <&gpio1 9 1>; 104 gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
105 }; 105 };
106 106
107 led-green { 107 led-green {
108 label = "obsa6:green:stat"; 108 label = "obsa6:green:stat";
109 gpios = <&gpio1 10 1>; 109 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
110 }; 110 };
111 111
112 led-yellow { 112 led-yellow {
113 label = "obsa6:yellow:stat"; 113 label = "obsa6:yellow:stat";
114 gpios = <&gpio1 11 1>; 114 gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
115 }; 115 };
116 }; 116 };
117 117
@@ -124,8 +124,8 @@
124 124
125 button@1 { 125 button@1 {
126 label = "Init Button"; 126 label = "Init Button";
127 linux,code = <116>; 127 linux,code = <KEY_POWER>;
128 gpios = <&gpio1 6 0>; 128 gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
129 }; 129 };
130 }; 130 };
131}; 131};
@@ -171,7 +171,6 @@
171 status = "okay"; 171 status = "okay";
172 172
173 ethphy0: ethernet-phy@0 { 173 ethphy0: ethernet-phy@0 {
174 device_type = "ethernet-phy";
175 reg = <0>; 174 reg = <0>;
176 }; 175 };
177}; 176};
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a7.dts b/arch/arm/boot/dts/kirkwood-openblocks_a7.dts
index 851fb2a60f20..b2f7cae06839 100644
--- a/arch/arm/boot/dts/kirkwood-openblocks_a7.dts
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a7.dts
@@ -126,17 +126,17 @@
126 126
127 led-red { 127 led-red {
128 label = "obsa7:red:stat"; 128 label = "obsa7:red:stat";
129 gpios = <&gpio1 9 1>; 129 gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
130 }; 130 };
131 131
132 led-green { 132 led-green {
133 label = "obsa7:green:stat"; 133 label = "obsa7:green:stat";
134 gpios = <&gpio1 10 1>; 134 gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
135 }; 135 };
136 136
137 led-yellow { 137 led-yellow {
138 label = "obsa7:yellow:stat"; 138 label = "obsa7:yellow:stat";
139 gpios = <&gpio1 11 1>; 139 gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
140 }; 140 };
141 }; 141 };
142 142
@@ -149,8 +149,8 @@
149 149
150 button@1 { 150 button@1 {
151 label = "Init Button"; 151 label = "Init Button";
152 linux,code = <116>; 152 linux,code = <KEY_POWER>;
153 gpios = <&gpio1 6 0>; 153 gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
154 }; 154 };
155 }; 155 };
156}; 156};
@@ -196,12 +196,10 @@
196 status = "okay"; 196 status = "okay";
197 197
198 ethphy0: ethernet-phy@0 { 198 ethphy0: ethernet-phy@0 {
199 device_type = "ethernet-phy";
200 reg = <0>; 199 reg = <0>;
201 }; 200 };
202 201
203 ethphy1: ethernet-phy@1 { 202 ethphy1: ethernet-phy@1 {
204 device_type = "ethernet-phy";
205 reg = <1>; 203 reg = <1>;
206 }; 204 };
207}; 205};
diff --git a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
index 1173d7fb31b2..1ff848d570a9 100644
--- a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
@@ -1,5 +1,5 @@
1/* 1/*
2 * kirkwood-sheevaplug-common.dts - Common parts for Sheevaplugs 2 * kirkwood-sheevaplug-common.dtsi - Common parts for Sheevaplugs
3 * 3 *
4 * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com> 4 * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com>
5 * 5 *
@@ -96,7 +96,6 @@
96 status = "okay"; 96 status = "okay";
97 97
98 ethphy0: ethernet-phy@0 { 98 ethphy0: ethernet-phy@0 {
99 device_type = "ethernet-phy";
100 reg = <0>; 99 reg = <0>;
101 }; 100 };
102}; 101};
diff --git a/arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts b/arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts
index eac6a21f3b1f..e2b4ea4f9e10 100644
--- a/arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts
+++ b/arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts
@@ -24,8 +24,8 @@
24 pinctrl-0 = <&pmx_sdio &pmx_sdio_cd &pmx_sdio_wp>; 24 pinctrl-0 = <&pmx_sdio &pmx_sdio_cd &pmx_sdio_wp>;
25 pinctrl-names = "default"; 25 pinctrl-names = "default";
26 status = "okay"; 26 status = "okay";
27 cd-gpios = <&gpio1 12 1>; 27 cd-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
28 wp-gpios = <&gpio1 15 0>; 28 wp-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
29 }; 29 };
30 }; 30 };
31 31
@@ -36,8 +36,8 @@
36 36
37 health { 37 health {
38 label = "sheevaplug:blue:health"; 38 label = "sheevaplug:blue:health";
39 gpios = <&gpio1 17 1>; 39 gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
40 linux,default-trigger = "default-on"; 40 default-state = "keep";
41 }; 41 };
42 }; 42 };
43}; 43};
diff --git a/arch/arm/boot/dts/kirkwood-sheevaplug.dts b/arch/arm/boot/dts/kirkwood-sheevaplug.dts
index bb61918313db..82f6abf120fd 100644
--- a/arch/arm/boot/dts/kirkwood-sheevaplug.dts
+++ b/arch/arm/boot/dts/kirkwood-sheevaplug.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * kirkwood-sheevaplug-esata.dts - Device tree file for Sheevaplug 2 * kirkwood-sheevaplug.dts - Device tree file for Sheevaplug
3 * 3 *
4 * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com> 4 * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com>
5 * 5 *
@@ -31,13 +31,13 @@
31 31
32 health { 32 health {
33 label = "sheevaplug:blue:health"; 33 label = "sheevaplug:blue:health";
34 gpios = <&gpio1 17 1>; 34 gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
35 linux,default-trigger = "default-on"; 35 default-state = "keep";
36 }; 36 };
37 37
38 misc { 38 misc {
39 label = "sheevaplug:red:misc"; 39 label = "sheevaplug:red:misc";
40 gpios = <&gpio1 14 1>; 40 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
41 }; 41 };
42 }; 42 };
43}; 43};
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
index 320da677b984..5fc817c2cb87 100644
--- a/arch/arm/boot/dts/kirkwood-topkick.dts
+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
@@ -131,25 +131,25 @@
131 131
132 disk { 132 disk {
133 label = "topkick:yellow:disk"; 133 label = "topkick:yellow:disk";
134 gpios = <&gpio0 21 1>; 134 gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
135 linux,default-trigger = "ide-disk"; 135 linux,default-trigger = "ide-disk";
136 }; 136 };
137 system2 { 137 system2 {
138 label = "topkick:red:system"; 138 label = "topkick:red:system";
139 gpios = <&gpio1 5 1>; 139 gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
140 }; 140 };
141 system { 141 system {
142 label = "topkick:blue:system"; 142 label = "topkick:blue:system";
143 gpios = <&gpio1 6 1>; 143 gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
144 default-state = "on"; 144 default-state = "on";
145 }; 145 };
146 wifi { 146 wifi {
147 label = "topkick:green:wifi"; 147 label = "topkick:green:wifi";
148 gpios = <&gpio1 7 1>; 148 gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
149 }; 149 };
150 wifi2 { 150 wifi2 {
151 label = "topkick:yellow:wifi"; 151 label = "topkick:yellow:wifi";
152 gpios = <&gpio1 16 1>; 152 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
153 }; 153 };
154 }; 154 };
155 regulators { 155 regulators {
@@ -208,7 +208,6 @@
208 status = "okay"; 208 status = "okay";
209 209
210 ethphy0: ethernet-phy@0 { 210 ethphy0: ethernet-phy@0 {
211 device_type = "ethernet-phy";
212 reg = <0>; 211 reg = <0>;
213 }; 212 };
214}; 213};
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
index f755bc1dc604..c17ae45e19be 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6281.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -41,13 +41,13 @@
41 41
42 button@1 { 42 button@1 {
43 label = "USB Copy"; 43 label = "USB Copy";
44 linux,code = <133>; 44 linux,code = <KEY_COPY>;
45 gpios = <&gpio0 15 1>; 45 gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
46 }; 46 };
47 button@2 { 47 button@2 {
48 label = "Reset"; 48 label = "Reset";
49 linux,code = <0x198>; 49 linux,code = <KEY_RESTART>;
50 gpios = <&gpio0 16 1>; 50 gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
51 }; 51 };
52 }; 52 };
53}; 53};
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
index 345562f75891..0713d072758a 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -51,13 +51,13 @@
51 51
52 button@1 { 52 button@1 {
53 label = "USB Copy"; 53 label = "USB Copy";
54 linux,code = <133>; 54 linux,code = <KEY_COPY>;
55 gpios = <&gpio1 11 1>; 55 gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
56 }; 56 };
57 button@2 { 57 button@2 {
58 label = "Reset"; 58 label = "Reset";
59 linux,code = <0x198>; 59 linux,code = <KEY_RESTART>;
60 gpios = <&gpio1 5 1>; 60 gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
61 }; 61 };
62 }; 62 };
63}; 63};
diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
index 39158cf16258..911f3a8cee23 100644
--- a/arch/arm/boot/dts/kirkwood-ts219.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -104,7 +104,6 @@
104 status = "okay"; 104 status = "okay";
105 105
106 ethphy0: ethernet-phy { 106 ethphy0: ethernet-phy {
107 device_type = "ethernet-phy";
108 /* overwrite reg property in board file */ 107 /* overwrite reg property in board file */
109 }; 108 };
110}; 109};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 8b73c80f1dad..6abf44d257df 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -1,4 +1,6 @@
1/include/ "skeleton.dtsi" 1/include/ "skeleton.dtsi"
2#include <dt-bindings/input/input.h>
3#include <dt-bindings/gpio/gpio.h>
2 4
3#define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16)) 5#define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))
4 6
@@ -68,39 +70,21 @@
68 #address-cells = <1>; 70 #address-cells = <1>;
69 #size-cells = <1>; 71 #size-cells = <1>;
70 72
71 mbusc: mbus-controller@20000 {
72 compatible = "marvell,mbus-controller";
73 reg = <0x20000 0x80>, <0x1500 0x20>;
74 };
75
76 timer: timer@20300 {
77 compatible = "marvell,orion-timer";
78 reg = <0x20300 0x20>;
79 interrupt-parent = <&bridge_intc>;
80 interrupts = <1>, <2>;
81 clocks = <&core_clk 0>;
82 };
83
84 intc: main-interrupt-ctrl@20200 {
85 compatible = "marvell,orion-intc";
86 interrupt-controller;
87 #interrupt-cells = <1>;
88 reg = <0x20200 0x10>, <0x20210 0x10>;
89 };
90
91 bridge_intc: bridge-interrupt-ctrl@20110 {
92 compatible = "marvell,orion-bridge-intc";
93 interrupt-controller;
94 #interrupt-cells = <1>;
95 reg = <0x20110 0x8>;
96 interrupts = <1>;
97 marvell,#interrupts = <6>;
98 };
99
100 core_clk: core-clocks@10030 { 73 core_clk: core-clocks@10030 {
101 compatible = "marvell,kirkwood-core-clock"; 74 compatible = "marvell,kirkwood-core-clock";
102 reg = <0x10030 0x4>; 75 reg = <0x10030 0x4>;
103 #clock-cells = <1>; 76 #clock-cells = <1>;
77 };
78
79 spi@10600 {
80 compatible = "marvell,orion-spi";
81 #address-cells = <1>;
82 #size-cells = <0>;
83 cell-index = <0>;
84 interrupts = <23>;
85 reg = <0x10600 0x28>;
86 clocks = <&gate_clk 7>;
87 status = "disabled";
104 }; 88 };
105 89
106 gpio0: gpio@10100 { 90 gpio0: gpio@10100 {
@@ -127,6 +111,17 @@
127 clocks = <&gate_clk 7>; 111 clocks = <&gate_clk 7>;
128 }; 112 };
129 113
114 i2c@11000 {
115 compatible = "marvell,mv64xxx-i2c";
116 reg = <0x11000 0x20>;
117 #address-cells = <1>;
118 #size-cells = <0>;
119 interrupts = <29>;
120 clock-frequency = <100000>;
121 clocks = <&gate_clk 7>;
122 status = "disabled";
123 };
124
130 serial@12000 { 125 serial@12000 {
131 compatible = "ns16550a"; 126 compatible = "ns16550a";
132 reg = <0x12000 0x100>; 127 reg = <0x12000 0x100>;
@@ -145,15 +140,18 @@
145 status = "disabled"; 140 status = "disabled";
146 }; 141 };
147 142
148 spi@10600 { 143 mbusc: mbus-controller@20000 {
149 compatible = "marvell,orion-spi"; 144 compatible = "marvell,mbus-controller";
150 #address-cells = <1>; 145 reg = <0x20000 0x80>, <0x1500 0x20>;
151 #size-cells = <0>; 146 };
152 cell-index = <0>; 147
153 interrupts = <23>; 148 bridge_intc: bridge-interrupt-ctrl@20110 {
154 reg = <0x10600 0x28>; 149 compatible = "marvell,orion-bridge-intc";
155 clocks = <&gate_clk 7>; 150 interrupt-controller;
156 status = "disabled"; 151 #interrupt-cells = <1>;
152 reg = <0x20110 0x8>;
153 interrupts = <1>;
154 marvell,#interrupts = <6>;
157 }; 155 };
158 156
159 gate_clk: clock-gating-control@2011c { 157 gate_clk: clock-gating-control@2011c {
@@ -163,6 +161,21 @@
163 #clock-cells = <1>; 161 #clock-cells = <1>;
164 }; 162 };
165 163
164 intc: main-interrupt-ctrl@20200 {
165 compatible = "marvell,orion-intc";
166 interrupt-controller;
167 #interrupt-cells = <1>;
168 reg = <0x20200 0x10>, <0x20210 0x10>;
169 };
170
171 timer: timer@20300 {
172 compatible = "marvell,orion-timer";
173 reg = <0x20300 0x20>;
174 interrupt-parent = <&bridge_intc>;
175 interrupts = <1>, <2>;
176 clocks = <&core_clk 0>;
177 };
178
166 wdt: watchdog-timer@20300 { 179 wdt: watchdog-timer@20300 {
167 compatible = "marvell,orion-wdt"; 180 compatible = "marvell,orion-wdt";
168 reg = <0x20300 0x28>; 181 reg = <0x20300 0x28>;
@@ -172,6 +185,14 @@
172 status = "okay"; 185 status = "okay";
173 }; 186 };
174 187
188 ehci@50000 {
189 compatible = "marvell,orion-ehci";
190 reg = <0x50000 0x1000>;
191 interrupts = <19>;
192 clocks = <&gate_clk 3>;
193 status = "okay";
194 };
195
175 xor@60800 { 196 xor@60800 {
176 compatible = "marvell,orion-xor"; 197 compatible = "marvell,orion-xor";
177 reg = <0x60800 0x100 198 reg = <0x60800 0x100
@@ -212,37 +233,6 @@
212 }; 233 };
213 }; 234 };
214 235
215 ehci@50000 {
216 compatible = "marvell,orion-ehci";
217 reg = <0x50000 0x1000>;
218 interrupts = <19>;
219 clocks = <&gate_clk 3>;
220 status = "okay";
221 };
222
223 i2c@11000 {
224 compatible = "marvell,mv64xxx-i2c";
225 reg = <0x11000 0x20>;
226 #address-cells = <1>;
227 #size-cells = <0>;
228 interrupts = <29>;
229 clock-frequency = <100000>;
230 clocks = <&gate_clk 7>;
231 status = "disabled";
232 };
233
234 mdio: mdio-bus@72004 {
235 compatible = "marvell,orion-mdio";
236 #address-cells = <1>;
237 #size-cells = <0>;
238 reg = <0x72004 0x84>;
239 interrupts = <46>;
240 clocks = <&gate_clk 0>;
241 status = "disabled";
242
243 /* add phy nodes in board file */
244 };
245
246 eth0: ethernet-controller@72000 { 236 eth0: ethernet-controller@72000 {
247 compatible = "marvell,kirkwood-eth"; 237 compatible = "marvell,kirkwood-eth";
248 #address-cells = <1>; 238 #address-cells = <1>;
@@ -253,7 +243,6 @@
253 status = "disabled"; 243 status = "disabled";
254 244
255 ethernet0-port@0 { 245 ethernet0-port@0 {
256 device_type = "network";
257 compatible = "marvell,kirkwood-eth-port"; 246 compatible = "marvell,kirkwood-eth-port";
258 reg = <0>; 247 reg = <0>;
259 interrupts = <11>; 248 interrupts = <11>;
@@ -263,6 +252,18 @@
263 }; 252 };
264 }; 253 };
265 254
255 mdio: mdio-bus@72004 {
256 compatible = "marvell,orion-mdio";
257 #address-cells = <1>;
258 #size-cells = <0>;
259 reg = <0x72004 0x84>;
260 interrupts = <46>;
261 clocks = <&gate_clk 0>;
262 status = "disabled";
263
264 /* add phy nodes in board file */
265 };
266
266 eth1: ethernet-controller@76000 { 267 eth1: ethernet-controller@76000 {
267 compatible = "marvell,kirkwood-eth"; 268 compatible = "marvell,kirkwood-eth";
268 #address-cells = <1>; 269 #address-cells = <1>;
@@ -273,7 +274,6 @@
273 status = "disabled"; 274 status = "disabled";
274 275
275 ethernet1-port@0 { 276 ethernet1-port@0 {
276 device_type = "network";
277 compatible = "marvell,kirkwood-eth-port"; 277 compatible = "marvell,kirkwood-eth-port";
278 reg = <0>; 278 reg = <0>;
279 interrupts = <15>; 279 interrupts = <15>;
@@ -282,5 +282,23 @@
282 /* set phy-handle property in board file */ 282 /* set phy-handle property in board file */
283 }; 283 };
284 }; 284 };
285
286 sata_phy0: sata-phy@82000 {
287 compatible = "marvell,mvebu-sata-phy";
288 reg = <0x82000 0x0334>;
289 clocks = <&gate_clk 14>;
290 clock-names = "sata";
291 #phy-cells = <0>;
292 status = "ok";
293 };
294
295 sata_phy1: sata-phy@84000 {
296 compatible = "marvell,mvebu-sata-phy";
297 reg = <0x84000 0x0334>;
298 clocks = <&gate_clk 15>;
299 clock-names = "sata";
300 #phy-cells = <0>;
301 status = "ok";
302 };
285 }; 303 };
286}; 304};
diff --git a/arch/arm/boot/dts/kizbox.dts b/arch/arm/boot/dts/kizbox.dts
index 02df1914a47c..928f6eef2d59 100644
--- a/arch/arm/boot/dts/kizbox.dts
+++ b/arch/arm/boot/dts/kizbox.dts
@@ -53,6 +53,12 @@
53 status = "okay"; 53 status = "okay";
54 }; 54 };
55 55
56 watchdog@fffffd40 {
57 timeout-sec = <15>;
58 atmel,max-heartbeat-sec = <16>;
59 atmel,min-heartbeat-sec = <0>;
60 status = "okay";
61 };
56 }; 62 };
57 63
58 nand0: nand@40000000 { 64 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/moxart-uc7112lx.dts b/arch/arm/boot/dts/moxart-uc7112lx.dts
new file mode 100644
index 000000000000..10d088df0c35
--- /dev/null
+++ b/arch/arm/boot/dts/moxart-uc7112lx.dts
@@ -0,0 +1,117 @@
1/* moxart-uc7112lx.dts - Device Tree file for MOXA UC-7112-LX
2 *
3 * Copyright (C) 2013 Jonas Jensen <jonas.jensen@gmail.com>
4 *
5 * Licensed under GPLv2 or later.
6 */
7
8/dts-v1/;
9/include/ "moxart.dtsi"
10
11/ {
12 model = "MOXA UC-7112-LX";
13 compatible = "moxa,moxart-uc-7112-lx", "moxa,moxart";
14
15 memory {
16 device_type = "memory";
17 reg = <0x0 0x2000000>;
18 };
19
20 clocks {
21 ref12: ref12M {
22 compatible = "fixed-clock";
23 #clock-cells = <0>;
24 clock-frequency = <12000000>;
25 };
26 };
27
28 flash@80000000,0 {
29 compatible = "numonyx,js28f128", "cfi-flash";
30 reg = <0x80000000 0x1000000>;
31 bank-width = <2>;
32 #address-cells = <1>;
33 #size-cells = <1>;
34 partition@0 {
35 label = "bootloader";
36 reg = <0x0 0x40000>;
37 };
38 partition@40000 {
39 label = "linux kernel";
40 reg = <0x40000 0x1C0000>;
41 };
42 partition@200000 {
43 label = "root filesystem";
44 reg = <0x200000 0x800000>;
45 };
46 partition@a00000 {
47 label = "user filesystem";
48 reg = <0xa00000 0x600000>;
49 };
50 };
51
52 leds {
53 compatible = "gpio-leds";
54 user-led {
55 label = "ready-led";
56 gpios = <&gpio 27 0x1>;
57 default-state = "on";
58 linux,default-trigger = "default-on";
59 };
60 };
61
62 gpio_keys_polled {
63 compatible = "gpio-keys-polled";
64 #address-cells = <1>;
65 #size-cells = <0>;
66 poll-interval = <500>;
67 button@25 {
68 label = "GPIO Reset";
69 linux,code = <116>;
70 gpios = <&gpio 25 1>;
71 };
72 };
73
74 chosen {
75 bootargs = "console=ttyS0,115200n8 earlyprintk root=/dev/mmcblk0p1 rw rootwait";
76 };
77};
78
79&clk_pll {
80 clocks = <&ref12>;
81};
82
83&sdhci {
84 status = "okay";
85};
86
87&mdio0 {
88 status = "okay";
89
90 ethphy0: ethernet-phy@1 {
91 device_type = "ethernet-phy";
92 compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
93 reg = <1>;
94 };
95};
96
97&mdio1 {
98 status = "okay";
99
100 ethphy1: ethernet-phy@1 {
101 device_type = "ethernet-phy";
102 compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
103 reg = <1>;
104 };
105};
106
107&mac0 {
108 status = "okay";
109};
110
111&mac1 {
112 status = "okay";
113};
114
115&uart0 {
116 status = "okay";
117};
diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi
new file mode 100644
index 000000000000..1fd27ed65a01
--- /dev/null
+++ b/arch/arm/boot/dts/moxart.dtsi
@@ -0,0 +1,148 @@
1/* moxart.dtsi - Device Tree Include file for MOXA ART family SoC
2 *
3 * Copyright (C) 2013 Jonas Jensen <jonas.jensen@gmail.com>
4 *
5 * Licensed under GPLv2 or later.
6 */
7
8/include/ "skeleton.dtsi"
9
10/ {
11 compatible = "moxa,moxart";
12 model = "MOXART";
13 interrupt-parent = <&intc>;
14
15 cpus {
16 #address-cells = <1>;
17 #size-cells = <0>;
18
19 cpu@0 {
20 device_type = "cpu";
21 compatible = "faraday,fa526";
22 reg = <0>;
23 };
24 };
25
26 clocks {
27 #address-cells = <1>;
28 #size-cells = <0>;
29 };
30
31 soc {
32 compatible = "simple-bus";
33 #address-cells = <1>;
34 #size-cells = <1>;
35 reg = <0x90000000 0x10000000>;
36 ranges;
37
38 intc: interrupt-controller@98800000 {
39 compatible = "moxa,moxart-ic";
40 reg = <0x98800000 0x38>;
41 interrupt-controller;
42 #interrupt-cells = <2>;
43 interrupt-mask = <0x00080000>;
44 };
45
46 clk_pll: clk_pll@98100000 {
47 compatible = "moxa,moxart-pll-clock";
48 #clock-cells = <0>;
49 reg = <0x98100000 0x34>;
50 };
51
52 clk_apb: clk_apb@98100000 {
53 compatible = "moxa,moxart-apb-clock";
54 #clock-cells = <0>;
55 reg = <0x98100000 0x34>;
56 clocks = <&clk_pll>;
57 };
58
59 timer: timer@98400000 {
60 compatible = "moxa,moxart-timer";
61 reg = <0x98400000 0x42>;
62 interrupts = <19 1>;
63 clocks = <&clk_apb>;
64 };
65
66 gpio: gpio@98700000 {
67 gpio-controller;
68 #gpio-cells = <2>;
69 compatible = "moxa,moxart-gpio";
70 reg = <0x98700000 0xC>;
71 };
72
73 rtc: rtc {
74 compatible = "moxa,moxart-rtc";
75 gpio-rtc-sclk = <&gpio 5 0>;
76 gpio-rtc-data = <&gpio 6 0>;
77 gpio-rtc-reset = <&gpio 7 0>;
78 };
79
80 dma: dma@90500000 {
81 compatible = "moxa,moxart-dma";
82 reg = <0x90500080 0x40>;
83 interrupts = <24 0>;
84 #dma-cells = <1>;
85 };
86
87 watchdog: watchdog@98500000 {
88 compatible = "moxa,moxart-watchdog";
89 reg = <0x98500000 0x10>;
90 clocks = <&clk_apb>;
91 };
92
93 sdhci: sdhci@98e00000 {
94 compatible = "moxa,moxart-sdhci";
95 reg = <0x98e00000 0x5C>;
96 interrupts = <5 0>;
97 clocks = <&clk_apb>;
98 dmas = <&dma 5>,
99 <&dma 5>;
100 dma-names = "tx", "rx";
101 status = "disabled";
102 };
103
104 mdio0: mdio@90900090 {
105 compatible = "moxa,moxart-mdio";
106 reg = <0x90900090 0x8>;
107 #address-cells = <1>;
108 #size-cells = <0>;
109 status = "disabled";
110 };
111
112 mdio1: mdio@92000090 {
113 compatible = "moxa,moxart-mdio";
114 reg = <0x92000090 0x8>;
115 #address-cells = <1>;
116 #size-cells = <0>;
117 status = "disabled";
118 };
119
120 mac0: mac@90900000 {
121 compatible = "moxa,moxart-mac";
122 reg = <0x90900000 0x90>;
123 interrupts = <25 0>;
124 phy-handle = <&ethphy0>;
125 phy-mode = "mii";
126 status = "disabled";
127 };
128
129 mac1: mac@92000000 {
130 compatible = "moxa,moxart-mac";
131 reg = <0x92000000 0x90>;
132 interrupts = <27 0>;
133 phy-handle = <&ethphy1>;
134 phy-mode = "mii";
135 status = "disabled";
136 };
137
138 uart0: uart@98200000 {
139 compatible = "ns16550a";
140 reg = <0x98200000 0x20>;
141 interrupts = <31 8>;
142 reg-shift = <2>;
143 reg-io-width = <4>;
144 clock-frequency = <14745600>;
145 status = "disabled";
146 };
147 };
148};
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi
index d0c5b37e248c..5377ddf83bf8 100644
--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -145,7 +145,7 @@
145 compatible = "ti,omap2-rng"; 145 compatible = "ti,omap2-rng";
146 ti,hwmods = "rng"; 146 ti,hwmods = "rng";
147 reg = <0x480a0000 0x50>; 147 reg = <0x480a0000 0x50>;
148 interrupts = <36>; 148 interrupts = <52>;
149 }; 149 };
150 150
151 sham: sham@480a4000 { 151 sham: sham@480a4000 {
diff --git a/arch/arm/boot/dts/omap2420-n800.dts b/arch/arm/boot/dts/omap2420-n800.dts
new file mode 100644
index 000000000000..d8c1b423606a
--- /dev/null
+++ b/arch/arm/boot/dts/omap2420-n800.dts
@@ -0,0 +1,8 @@
1/dts-v1/;
2
3#include "omap2420-n8x0-common.dtsi"
4
5/ {
6 model = "Nokia N800";
7 compatible = "nokia,n800", "nokia,n8x0", "ti,omap2420", "ti,omap2";
8};
diff --git a/arch/arm/boot/dts/omap2420-n810-wimax.dts b/arch/arm/boot/dts/omap2420-n810-wimax.dts
new file mode 100644
index 000000000000..6b25b0359ac9
--- /dev/null
+++ b/arch/arm/boot/dts/omap2420-n810-wimax.dts
@@ -0,0 +1,8 @@
1/dts-v1/;
2
3#include "omap2420-n8x0-common.dtsi"
4
5/ {
6 model = "Nokia N810 WiMax";
7 compatible = "nokia,n810-wimax", "nokia,n8x0", "ti,omap2420", "ti,omap2";
8};
diff --git a/arch/arm/boot/dts/omap2420-n810.dts b/arch/arm/boot/dts/omap2420-n810.dts
new file mode 100644
index 000000000000..21baec154b78
--- /dev/null
+++ b/arch/arm/boot/dts/omap2420-n810.dts
@@ -0,0 +1,8 @@
1/dts-v1/;
2
3#include "omap2420-n8x0-common.dtsi"
4
5/ {
6 model = "Nokia N810";
7 compatible = "nokia,n810", "nokia,n8x0", "ti,omap2420", "ti,omap2";
8};
diff --git a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
new file mode 100644
index 000000000000..89608b206519
--- /dev/null
+++ b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
@@ -0,0 +1,99 @@
1#include "omap2420.dtsi"
2
3/ {
4 memory {
5 device_type = "memory";
6 reg = <0x80000000 0x8000000>; /* 128 MB */
7 };
8
9 ocp {
10 i2c@0 {
11 compatible = "i2c-cbus-gpio";
12 gpios = <&gpio3 2 0 /* gpio66 clk */
13 &gpio3 1 0 /* gpio65 dat */
14 &gpio3 0 0 /* gpio64 sel */
15 >;
16 #address-cells = <1>;
17 #size-cells = <0>;
18 retu_mfd: retu@1 {
19 compatible = "retu-mfd";
20 interrupt-parent = <&gpio4>;
21 interrupts = <12 IRQ_TYPE_EDGE_RISING>;
22 reg = <0x1>;
23 };
24 };
25 };
26};
27
28&i2c1 {
29 clock-frequency = <400000>;
30};
31
32&i2c2 {
33 clock-frequency = <400000>;
34};
35
36&gpmc {
37 ranges = <0 0 0x04000000 0x10000000>;
38
39 /* gpio-irq for dma: 26 */
40
41 onenand@0,0 {
42 #address-cells = <1>;
43 #size-cells = <1>;
44 reg = <0 0 0x10000000>;
45
46 gpmc,sync-read;
47 gpmc,burst-length = <16>;
48 gpmc,burst-read;
49 gpmc,burst-wrap;
50 gpmc,device-width = <2>;
51 gpmc,mux-add-data = <2>;
52 gpmc,cs-on-ns = <0>;
53 gpmc,cs-rd-off-ns = <127>;
54 gpmc,cs-wr-off-ns = <109>;
55 gpmc,adv-on-ns = <0>;
56 gpmc,adv-rd-off-ns = <18>;
57 gpmc,adv-wr-off-ns = <18>;
58 gpmc,oe-on-ns = <27>;
59 gpmc,oe-off-ns = <127>;
60 gpmc,we-on-ns = <27>;
61 gpmc,we-off-ns = <72>;
62 gpmc,rd-cycle-ns = <145>;
63 gpmc,wr-cycle-ns = <136>;
64 gpmc,access-ns = <118>;
65 gpmc,page-burst-access-ns = <27>;
66 gpmc,bus-turnaround-ns = <0>;
67 gpmc,cycle2cycle-delay-ns = <0>;
68 gpmc,wait-monitoring-ns = <0>;
69 gpmc,clk-activation-ns = <9>;
70 gpmc,sync-clk-ps = <27000>;
71
72 /* MTD partition table corresponding to old board-n8x0 file. */
73 partition@0 {
74 label = "bootloader";
75 reg = <0x00000000 0x00020000>;
76 read-only;
77 };
78 partition@1 {
79 label = "config";
80 reg = <0x00020000 0x00060000>;
81 };
82 partition@2 {
83 label = "kernel";
84 reg = <0x00080000 0x00200000>;
85 };
86 partition@3 {
87 label = "initfs";
88 reg = <0x00280000 0x00400000>;
89 };
90 partition@4 {
91 label = "rootfs";
92 reg = <0x00680000 0x0f980000>;
93 };
94 partition@5 {
95 label = "omap2-onenand";
96 reg = <0x00000000 0x10000000>;
97 };
98 };
99};
diff --git a/arch/arm/boot/dts/omap2430-sdp.dts b/arch/arm/boot/dts/omap2430-sdp.dts
new file mode 100644
index 000000000000..2c90d29b4cad
--- /dev/null
+++ b/arch/arm/boot/dts/omap2430-sdp.dts
@@ -0,0 +1,49 @@
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 "omap2430.dtsi"
11
12/ {
13 model = "TI OMAP2430 SDP";
14 compatible = "ti,omap2430-sdp", "ti,omap2430", "ti,omap2";
15
16 memory {
17 device_type = "memory";
18 reg = <0x80000000 0x8000000>; /* 128 MB */
19 };
20};
21
22&i2c2 {
23 clock-frequency = <100000>;
24
25 twl: twl@48 {
26 reg = <0x48>;
27 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
28 };
29};
30
31#include "twl4030.dtsi"
32
33&mmc1 {
34 vmmc-supply = <&vmmc1>;
35 bus-width = <4>;
36};
37
38&gpmc {
39 ranges = <5 0 0x08000000 0x01000000>;
40 ethernet@gpmc {
41 compatible = "smsc,lan91c94";
42 interrupt-parent = <&gpio5>;
43 interrupts = <21 IRQ_TYPE_LEVEL_LOW>; /* gpio149 */
44 reg = <5 0x300 0xf>;
45 bank-width = <2>;
46 gpmc,mux-add-data;
47 };
48};
49
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index df33a50bc070..447e714d435b 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -99,7 +99,7 @@
99&omap3_pmx_core { 99&omap3_pmx_core {
100 pinctrl-names = "default"; 100 pinctrl-names = "default";
101 pinctrl-0 = < 101 pinctrl-0 = <
102 &hsusbb2_pins 102 &hsusb2_pins
103 >; 103 >;
104 104
105 uart3_pins: pinmux_uart3_pins { 105 uart3_pins: pinmux_uart3_pins {
@@ -109,20 +109,32 @@
109 >; 109 >;
110 }; 110 };
111 111
112 hsusbb2_pins: pinmux_hsusbb2_pins { 112 hsusb2_pins: pinmux_hsusb2_pins {
113 pinctrl-single,pins = < 113 pinctrl-single,pins = <
114 0x5c0 (PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ 114 OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
115 0x5c2 (PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ 115 OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
116 0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ 116 OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
117 0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ 117 OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
118 0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ 118 OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
119 0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ 119 OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
120 0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */ 120 >;
121 0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */ 121 };
122 0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */ 122};
123 0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */ 123
124 0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */ 124&omap3_pmx_core2 {
125 0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */ 125 pinctrl-names = "default";
126 pinctrl-0 = <
127 &hsusb2_2_pins
128 >;
129
130 hsusb2_2_pins: pinmux_hsusb2_2_pins {
131 pinctrl-single,pins = <
132 OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
133 OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
134 OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
135 OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
136 OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
137 OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
126 >; 138 >;
127 }; 139 };
128}; 140};
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 3ba4a625ea5b..5053766d369b 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -93,23 +93,17 @@
93&omap3_pmx_core { 93&omap3_pmx_core {
94 pinctrl-names = "default"; 94 pinctrl-names = "default";
95 pinctrl-0 = < 95 pinctrl-0 = <
96 &hsusbb2_pins 96 &hsusb2_pins
97 >; 97 >;
98 98
99 hsusbb2_pins: pinmux_hsusbb2_pins { 99 hsusb2_pins: pinmux_hsusb2_pins {
100 pinctrl-single,pins = < 100 pinctrl-single,pins = <
101 0x5c0 (PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */ 101 OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
102 0x5c2 (PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */ 102 OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
103 0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */ 103 OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
104 0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */ 104 OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
105 0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */ 105 OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
106 0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */ 106 OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
107 0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
108 0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
109 0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
110 0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
111 0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
112 0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
113 >; 107 >;
114 }; 108 };
115 109
@@ -121,6 +115,24 @@
121 }; 115 };
122}; 116};
123 117
118&omap3_pmx_core2 {
119 pinctrl-names = "default";
120 pinctrl-0 = <
121 &hsusb2_2_pins
122 >;
123
124 hsusb2_2_pins: pinmux_hsusb2_2_pins {
125 pinctrl-single,pins = <
126 OMAP3430_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
127 OMAP3430_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
128 OMAP3430_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
129 OMAP3430_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
130 OMAP3430_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
131 OMAP3430_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
132 >;
133 };
134};
135
124&i2c1 { 136&i2c1 {
125 clock-frequency = <2600000>; 137 clock-frequency = <2600000>;
126 138
diff --git a/arch/arm/boot/dts/omap3-cm-t3730.dts b/arch/arm/boot/dts/omap3-cm-t3730.dts
new file mode 100644
index 000000000000..486f4d6c4219
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-cm-t3730.dts
@@ -0,0 +1,104 @@
1/*
2 * Support for CompuLab CM-T3730
3 */
4/dts-v1/;
5
6#include "omap36xx.dtsi"
7#include "omap3-cm-t3x30.dtsi"
8
9/ {
10 model = "CompuLab CM-T3730";
11 compatible = "compulab,omap3-cm-t3730", "ti,omap36xx", "ti,omap3";
12
13 wl12xx_vmmc2: wl12xx_vmmc2 {
14 compatible = "regulator-fixed";
15 regulator-name = "vw1271";
16 pinctrl-names = "default";
17 pinctrl-0 = <&wl12xx_gpio>;
18 regulator-min-microvolt = <1800000>;
19 regulator-max-microvolt = <1800000>;
20 gpio = <&gpio3 9 GPIO_ACTIVE_HIGH>; /* gpio73 */
21 startup-delay-us = <20000>;
22 enable-active-high;
23 };
24
25 wl12xx_vaux2: wl12xx_vaux2 {
26 compatible = "regulator-fixed";
27 regulator-name = "vwl1271_vaux2";
28 regulator-min-microvolt = <1800000>;
29 regulator-max-microvolt = <1800000>;
30 vin-supply = <&vaux2>;
31 };
32};
33
34&omap3_pmx_core {
35 mmc1_pins: pinmux_mmc1_pins {
36 pinctrl-single,pins = <
37 0x114 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
38 0x116 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
39 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
40 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
41 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
42 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
43 >;
44 };
45
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 (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 smsc1_pins: pinmux_smsc1_pins {
58 pinctrl-single,pins = <
59 0x88 (PIN_OUTPUT | MUX_MODE0) /* gpmc_ncs5.gpmc_ncs5 */
60 0x16a (PIN_INPUT_PULLUP | MUX_MODE4) /* uart3_cts_rctx.gpio_163 */
61 >;
62 };
63
64 uart3_pins: pinmux_uart3_pins {
65 pinctrl-single,pins = <
66 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
67 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
68 >;
69 };
70
71 wl12xx_gpio: pinmux_wl12xx_gpio {
72 pinctrl-single,pins = <
73 0xb2 (PIN_OUTPUT | MUX_MODE4) /* dss_data3.gpio_73 */
74 0x134 (PIN_INPUT | MUX_MODE4) /* sdmmc2_dat4.gpio_136 */
75 >;
76 };
77};
78
79&mmc1 {
80 vmmc-supply = <&vmmc1>;
81 bus-width = <4>;
82 pinctrl-names = "default";
83 pinctrl-0 = <&mmc1_pins>;
84};
85
86&mmc2 {
87 pinctrl-names = "default";
88 pinctrl-0 = <&mmc2_pins>;
89 vmmc-supply = <&wl12xx_vmmc2>;
90 vmmc_aux-supply = <&wl12xx_vaux2>;
91 non-removable;
92 bus-width = <4>;
93 cap-power-off-card;
94};
95
96&smsc1 {
97 pinctrl-names = "default";
98 pinctrl-0 = <&smsc1_pins>;
99};
100
101&uart3 {
102 pinctrl-names = "default";
103 pinctrl-0 = <&uart3_pins>;
104};
diff --git a/arch/arm/boot/dts/omap3-cm-t3x30.dtsi b/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
new file mode 100644
index 000000000000..3a9f004d8924
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
@@ -0,0 +1,95 @@
1/*
2 * Common support for CompuLab CM-T3530 and CM-T3730
3 */
4
5/ {
6 memory {
7 device_type = "memory";
8 reg = <0x80000000 0x10000000>; /* 256 MB */
9 };
10
11 cpus {
12 cpu@0 {
13 cpu0-supply = <&vcc>;
14 };
15 };
16
17 leds {
18 compatible = "gpio-leds";
19 ledb {
20 label = "cm-t35:green";
21 gpios = <&gpio6 26 GPIO_ACTIVE_HIGH>; /* gpio186 */
22 linux,default-trigger = "heartbeat";
23 };
24 };
25
26 vddvario: regulator-vddvario {
27 compatible = "regulator-fixed";
28 regulator-name = "vddvario";
29 regulator-always-on;
30 };
31
32 vdd33a: regulator-vdd33a {
33 compatible = "regulator-fixed";
34 regulator-name = "vdd33a";
35 regulator-always-on;
36 };
37};
38
39&gpmc {
40 ranges = <5 0 0x2c000000 0x01000000>;
41
42 smsc1: ethernet@5,0 {
43 compatible = "smsc,lan9221", "smsc,lan9115";
44 interrupt-parent = <&gpio6>;
45 interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
46 reg = <5 0 0xff>;
47 bank-width = <2>;
48 gpmc,mux-add-data;
49 gpmc,cs-on-ns = <0>;
50 gpmc,cs-rd-off-ns = <186>;
51 gpmc,cs-wr-off-ns = <186>;
52 gpmc,adv-on-ns = <12>;
53 gpmc,adv-rd-off-ns = <48>;
54 gpmc,adv-wr-off-ns = <48>;
55 gpmc,oe-on-ns = <54>;
56 gpmc,oe-off-ns = <168>;
57 gpmc,we-on-ns = <54>;
58 gpmc,we-off-ns = <168>;
59 gpmc,rd-cycle-ns = <186>;
60 gpmc,wr-cycle-ns = <186>;
61 gpmc,access-ns = <114>;
62 gpmc,page-burst-access-ns = <6>;
63 gpmc,bus-turnaround-ns = <12>;
64 gpmc,cycle2cycle-delay-ns = <18>;
65 gpmc,wr-data-mux-bus-ns = <90>;
66 gpmc,wr-access-ns = <186>;
67 gpmc,cycle2cycle-samecsen;
68 gpmc,cycle2cycle-diffcsen;
69 vddvario-supply = <&vddvario>;
70 vdd33a-supply = <&vdd33a>;
71 reg-io-width = <4>;
72 smsc,save-mac-address;
73 };
74};
75
76&i2c1 {
77 clock-frequency = <400000>;
78
79 twl: twl@48 {
80 reg = <0x48>;
81 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
82 interrupt-parent = <&intc>;
83 };
84};
85
86#include "twl4030.dtsi"
87#include "twl4030_omap3.dtsi"
88
89&i2c3 {
90 clock-frequency = <400000>;
91};
92
93&twl_gpio {
94 ti,use-leds;
95};
diff --git a/arch/arm/boot/dts/omap3-igep.dtsi b/arch/arm/boot/dts/omap3-igep.dtsi
index 165aaf7591ba..c17009323520 100644
--- a/arch/arm/boot/dts/omap3-igep.dtsi
+++ b/arch/arm/boot/dts/omap3-igep.dtsi
@@ -133,8 +133,6 @@
133 0x194 (PIN_INPUT | MUX_MODE0) /* i2c3_sda.i2c3_sda */ 133 0x194 (PIN_INPUT | MUX_MODE0) /* i2c3_sda.i2c3_sda */
134 >; 134 >;
135 }; 135 };
136
137 leds_pins: pinmux_leds_pins { };
138}; 136};
139 137
140&i2c1 { 138&i2c1 {
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts
index 1c7e74d2d2bc..25a2b5f652fd 100644
--- a/arch/arm/boot/dts/omap3-igep0020.dts
+++ b/arch/arm/boot/dts/omap3-igep0020.dts
@@ -66,28 +66,10 @@
66&omap3_pmx_core { 66&omap3_pmx_core {
67 pinctrl-names = "default"; 67 pinctrl-names = "default";
68 pinctrl-0 = < 68 pinctrl-0 = <
69 &hsusbb1_pins
70 &tfp410_pins 69 &tfp410_pins
71 &dss_pins 70 &dss_pins
72 >; 71 >;
73 72
74 hsusbb1_pins: pinmux_hsusbb1_pins {
75 pinctrl-single,pins = <
76 0x5aa (PIN_OUTPUT | MUX_MODE3) /* etk_ctl.hsusb1_clk */
77 0x5a8 (PIN_OUTPUT | MUX_MODE3) /* etk_clk.hsusb1_stp */
78 0x5bc (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d8.hsusb1_dir */
79 0x5be (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d9.hsusb1_nxt */
80 0x5ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d0.hsusb1_data0 */
81 0x5ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d1.hsusb1_data1 */
82 0x5b0 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d2.hsusb1_data2 */
83 0x5b2 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d3.hsusb1_data7 */
84 0x5b4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d4.hsusb1_data4 */
85 0x5b6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d5.hsusb1_data5 */
86 0x5b8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d6.hsusb1_data6 */
87 0x5ba (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */
88 >;
89 };
90
91 tfp410_pins: tfp410_dvi_pins { 73 tfp410_pins: tfp410_dvi_pins {
92 pinctrl-single,pins = < 74 pinctrl-single,pins = <
93 0x196 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */ 75 0x196 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */
@@ -128,12 +110,36 @@
128 }; 110 };
129}; 111};
130 112
131&leds_pins { 113&omap3_pmx_core2 {
132 pinctrl-single,pins = < 114 pinctrl-names = "default";
133 0x5c4 (PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */ 115 pinctrl-0 = <
134 0x5c6 (PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */ 116 &hsusbb1_pins
135 0x5c8 (PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
136 >; 117 >;
118
119 hsusbb1_pins: pinmux_hsusbb1_pins {
120 pinctrl-single,pins = <
121 OMAP3630_CORE2_IOPAD(0x25da, PIN_OUTPUT | MUX_MODE3) /* etk_ctl.hsusb1_clk */
122 OMAP3630_CORE2_IOPAD(0x25d8, PIN_OUTPUT | MUX_MODE3) /* etk_clk.hsusb1_stp */
123 OMAP3630_CORE2_IOPAD(0x25ec, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d8.hsusb1_dir */
124 OMAP3630_CORE2_IOPAD(0x25ee, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d9.hsusb1_nxt */
125 OMAP3630_CORE2_IOPAD(0x25dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d0.hsusb1_data0 */
126 OMAP3630_CORE2_IOPAD(0x25de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d1.hsusb1_data1 */
127 OMAP3630_CORE2_IOPAD(0x25e0, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d2.hsusb1_data2 */
128 OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d3.hsusb1_data7 */
129 OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d4.hsusb1_data4 */
130 OMAP3630_CORE2_IOPAD(0x25e6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d5.hsusb1_data5 */
131 OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d6.hsusb1_data6 */
132 OMAP3630_CORE2_IOPAD(0x25ea, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */
133 >;
134 };
135
136 leds_pins: pinmux_leds_pins {
137 pinctrl-single,pins = <
138 OMAP3630_CORE2_IOPAD(0x25f4, PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */
139 OMAP3630_CORE2_IOPAD(0x25f6, PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */
140 OMAP3630_CORE2_IOPAD(0x25f8, PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
141 >;
142 };
137}; 143};
138 144
139&i2c3 { 145&i2c3 {
diff --git a/arch/arm/boot/dts/omap3-igep0030.dts b/arch/arm/boot/dts/omap3-igep0030.dts
index 02a23f8a3384..145c58cfc8ac 100644
--- a/arch/arm/boot/dts/omap3-igep0030.dts
+++ b/arch/arm/boot/dts/omap3-igep0030.dts
@@ -46,10 +46,12 @@
46 }; 46 };
47}; 47};
48 48
49&leds_pins { 49&omap3_pmx_core2 {
50 pinctrl-single,pins = < 50 leds_pins: pinmux_leds_pins {
51 0x5b0 (PIN_OUTPUT | MUX_MODE4) /* etk_d2.gpio_16 */ 51 pinctrl-single,pins = <
52 >; 52 OMAP3630_CORE2_IOPAD(0x25e0, PIN_OUTPUT | MUX_MODE4) /* etk_d2.gpio_16 */
53 >;
54 };
53}; 55};
54 56
55&gpmc { 57&gpmc {
diff --git a/arch/arm/boot/dts/omap3-ldp.dts b/arch/arm/boot/dts/omap3-ldp.dts
new file mode 100644
index 000000000000..ddce0d807f70
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-ldp.dts
@@ -0,0 +1,231 @@
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 "omap34xx.dtsi"
11#include "omap-gpmc-smsc911x.dtsi"
12
13/ {
14 model = "TI OMAP3430 LDP (Zoom1 Labrador)";
15 compatible = "ti,omap3-ldp", "ti,omap3";
16
17 memory {
18 device_type = "memory";
19 reg = <0x80000000 0x8000000>; /* 128 MB */
20 };
21
22 cpus {
23 cpu@0 {
24 cpu0-supply = <&vcc>;
25 };
26 };
27
28 gpio_keys {
29 compatible = "gpio-keys";
30 pinctrl-names = "default";
31 pinctrl-0 = <&gpio_key_pins>;
32
33 key_enter {
34 label = "enter";
35 gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; /* gpio101 */
36 linux,code = <0x0107001c>; /* KEY_ENTER */
37 gpio-key,wakeup;
38 };
39
40 key_f1 {
41 label = "f1";
42 gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; /* gpio102 */
43 linux,code = <0x0303003b>; /* KEY_F1 */
44 gpio-key,wakeup;
45 };
46
47 key_f2 {
48 label = "f2";
49 gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; /* gpio103 */
50 linux,code = <0x0403003c>; /* KEY_F2 */
51 gpio-key,wakeup;
52 };
53
54 key_f3 {
55 label = "f3";
56 gpios = <&gpio4 8 GPIO_ACTIVE_LOW>; /* gpio104 */
57 linux,code = <0x0503003d>; /* KEY_F3 */
58 gpio-key,wakeup;
59 };
60
61 key_f4 {
62 label = "f4";
63 gpios = <&gpio4 9 GPIO_ACTIVE_LOW>; /* gpio105 */
64 linux,code = <0x0704003e>; /* KEY_F4 */
65 gpio-key,wakeup;
66 };
67
68 key_left {
69 label = "left";
70 gpios = <&gpio4 10 GPIO_ACTIVE_LOW>; /* gpio106 */
71 linux,code = <0x04070069>; /* KEY_LEFT */
72 gpio-key,wakeup;
73 };
74
75 key_right {
76 label = "right";
77 gpios = <&gpio4 11 GPIO_ACTIVE_LOW>; /* gpio107 */
78 linux,code = <0x0507006a>; /* KEY_RIGHT */
79 gpio-key,wakeup;
80 };
81
82 key_up {
83 label = "up";
84 gpios = <&gpio4 12 GPIO_ACTIVE_LOW>; /* gpio108 */
85 linux,code = <0x06070067>; /* KEY_UP */
86 gpio-key,wakeup;
87 };
88
89 key_down {
90 label = "down";
91 gpios = <&gpio4 13 GPIO_ACTIVE_LOW>; /* gpio109 */
92 linux,code = <0x0707006c>; /* KEY_DOWN */
93 gpio-key,wakeup;
94 };
95 };
96};
97
98&gpmc {
99 ranges = <0 0 0x00000000 0x01000000>,
100 <1 0 0x08000000 0x01000000>;
101
102 nand@0,0 {
103 linux,mtd-name= "micron,nand";
104 reg = <0 0 0>;
105 nand-bus-width = <16>;
106 ti,nand-ecc-opt = "bch8";
107
108 gpmc,sync-clk-ps = <0>;
109 gpmc,cs-on-ns = <0>;
110 gpmc,cs-rd-off-ns = <44>;
111 gpmc,cs-wr-off-ns = <44>;
112 gpmc,adv-on-ns = <6>;
113 gpmc,adv-rd-off-ns = <34>;
114 gpmc,adv-wr-off-ns = <44>;
115 gpmc,we-off-ns = <40>;
116 gpmc,oe-off-ns = <54>;
117 gpmc,access-ns = <64>;
118 gpmc,rd-cycle-ns = <82>;
119 gpmc,wr-cycle-ns = <82>;
120 gpmc,wr-access-ns = <40>;
121 gpmc,wr-data-mux-bus-ns = <0>;
122
123 #address-cells = <1>;
124 #size-cells = <1>;
125
126 partition@0 {
127 label = "X-Loader";
128 reg = <0 0x80000>;
129 };
130 partition@80000 {
131 label = "U-Boot";
132 reg = <0x80000 0x140000>;
133 };
134 partition@1c0000 {
135 label = "Environment";
136 reg = <0x1c0000 0x40000>;
137 };
138 partition@200000 {
139 label = "Kernel";
140 reg = <0x200000 0x1e00000>;
141 };
142 partition@2000000 {
143 label = "Filesystem";
144 reg = <0x2000000 0xe000000>;
145 };
146 };
147
148 ethernet@gpmc {
149 interrupt-parent = <&gpio5>;
150 interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
151 reg = <1 0 0xff>;
152 };
153};
154
155&i2c1 {
156 clock-frequency = <2600000>;
157
158 twl: twl@48 {
159 reg = <0x48>;
160 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
161 interrupt-parent = <&intc>;
162 };
163};
164
165#include "twl4030.dtsi"
166#include "twl4030_omap3.dtsi"
167
168&i2c2 {
169 clock-frequency = <400000>;
170};
171
172&i2c3 {
173 clock-frequency = <400000>;
174};
175
176&mmc1 {
177 vmmc-supply = <&vmmc1>;
178 bus-width = <4>;
179};
180
181&omap3_pmx_core {
182 gpio_key_pins: pinmux_gpio_key_pins {
183 pinctrl-single,pins = <
184 0xea (PIN_INPUT | MUX_MODE4) /* cam_d2.gpio_101 */
185 0xec (PIN_INPUT | MUX_MODE4) /* cam_d3.gpio_102 */
186 0xee (PIN_INPUT | MUX_MODE4) /* cam_d4.gpio_103 */
187 0xf0 (PIN_INPUT | MUX_MODE4) /* cam_d5.gpio_104 */
188 0xf2 (PIN_INPUT | MUX_MODE4) /* cam_d6.gpio_105 */
189 0xf4 (PIN_INPUT | MUX_MODE4) /* cam_d7.gpio_106 */
190 0xf6 (PIN_INPUT | MUX_MODE4) /* cam_d8.gpio_107 */
191 0xf8 (PIN_INPUT | MUX_MODE4) /* cam_d9.gpio_108 */
192 0xfa (PIN_INPUT | MUX_MODE4) /* cam_d10.gpio_109 */
193 >;
194 };
195
196 musb_pins: pinmux_musb_pins {
197 pinctrl-single,pins = <
198 0x172 (PIN_INPUT | MUX_MODE0) /* hsusb0_clk.hsusb0_clk */
199 0x17a (PIN_INPUT | MUX_MODE0) /* hsusb0_data0.hsusb0_data0 */
200 0x17c (PIN_INPUT | MUX_MODE0) /* hsusb0_data1.hsusb0_data1 */
201 0x17e (PIN_INPUT | MUX_MODE0) /* hsusb0_data2.hsusb0_data2 */
202 0x180 (PIN_INPUT | MUX_MODE0) /* hsusb0_data3.hsusb0_data3 */
203 0x182 (PIN_INPUT | MUX_MODE0) /* hsusb0_data4.hsusb0_data4 */
204 0x184 (PIN_INPUT | MUX_MODE0) /* hsusb0_data5.hsusb0_data5 */
205 0x186 (PIN_INPUT | MUX_MODE0) /* hsusb0_data6.hsusb0_data6 */
206 0x188 (PIN_INPUT | MUX_MODE0) /* hsusb0_data7.hsusb0_data7 */
207 0x176 (PIN_INPUT | MUX_MODE0) /* hsusb0_dir.hsusb0_dir */
208 0x178 (PIN_INPUT | MUX_MODE0) /* hsusb0_nxt.hsusb0_nxt */
209 0x174 (PIN_OUTPUT | MUX_MODE0) /* hsusb0_stp.hsusb0_stp */
210 >;
211 };
212};
213
214&usb_otg_hs {
215 pinctrl-names = "default";
216 pinctrl-0 = <&musb_pins>;
217 interface-type = <0>;
218 usb-phy = <&usb2_phy>;
219 mode = <3>;
220 power = <50>;
221};
222
223&vaux1 {
224 /* Needed for ads7846 */
225 regulator-name = "vcc";
226};
227
228&vpll2 {
229 /* Needed for DSS */
230 regulator-name = "vdds_dsi";
231};
diff --git a/arch/arm/boot/dts/omap3-sb-t35.dtsi b/arch/arm/boot/dts/omap3-sb-t35.dtsi
new file mode 100644
index 000000000000..b9a2fedce7ee
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-sb-t35.dtsi
@@ -0,0 +1,40 @@
1/*
2 * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730
3 */
4
5&gpmc {
6 ranges = <4 0 0x2d000000 0x01000000>;
7
8 smsc2: ethernet@4,0 {
9 compatible = "smsc,lan9221", "smsc,lan9115";
10 interrupt-parent = <&gpio3>;
11 interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
12 reg = <4 0 0xff>;
13 bank-width = <2>;
14 gpmc,mux-add-data;
15 gpmc,cs-on-ns = <0>;
16 gpmc,cs-rd-off-ns = <186>;
17 gpmc,cs-wr-off-ns = <186>;
18 gpmc,adv-on-ns = <12>;
19 gpmc,adv-rd-off-ns = <48>;
20 gpmc,adv-wr-off-ns = <48>;
21 gpmc,oe-on-ns = <54>;
22 gpmc,oe-off-ns = <168>;
23 gpmc,we-on-ns = <54>;
24 gpmc,we-off-ns = <168>;
25 gpmc,rd-cycle-ns = <186>;
26 gpmc,wr-cycle-ns = <186>;
27 gpmc,access-ns = <114>;
28 gpmc,page-burst-access-ns = <6>;
29 gpmc,bus-turnaround-ns = <12>;
30 gpmc,cycle2cycle-delay-ns = <18>;
31 gpmc,wr-data-mux-bus-ns = <90>;
32 gpmc,wr-access-ns = <186>;
33 gpmc,cycle2cycle-samecsen;
34 gpmc,cycle2cycle-diffcsen;
35 vddvario-supply = <&vddvario>;
36 vdd33a-supply = <&vdd33a>;
37 reg-io-width = <4>;
38 smsc,save-mac-address;
39 };
40};
diff --git a/arch/arm/boot/dts/omap3-sbc-t3730.dts b/arch/arm/boot/dts/omap3-sbc-t3730.dts
new file mode 100644
index 000000000000..c119bd545053
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-sbc-t3730.dts
@@ -0,0 +1,30 @@
1/*
2 * Suppport for CompuLab SBC-T3730 with CM-T3730
3 */
4
5#include "omap3-cm-t3730.dts"
6#include "omap3-sb-t35.dtsi"
7
8/ {
9 model = "CompuLab SBC-T3730 with CM-T3730";
10 compatible = "compulab,omap3-sbc-t3730", "compulab,omap3-cm-t3730", "ti,omap36xx", "ti,omap3";
11};
12
13&gpmc {
14 ranges = <5 0 0x2c000000 0x01000000>,
15 <4 0 0x2d000000 0x01000000>;
16};
17
18&smsc2 {
19 pinctrl-names = "default";
20 pinctrl-0 = <&smsc2_pins>;
21};
22
23&omap3_pmx_core {
24 smsc2_pins: pinmux_smsc2_pins {
25 pinctrl-single,pins = <
26 0x86 (PIN_OUTPUT | MUX_MODE0) /* gpmc_ncs4.gpmc_ncs4 */
27 0xa2 (PIN_INPUT_PULLUP | MUX_MODE4) /* gpmc_wait3.gpio_65 */
28 >;
29 };
30}; \ No newline at end of file
diff --git a/arch/arm/boot/dts/omap3-zoom3.dts b/arch/arm/boot/dts/omap3-zoom3.dts
index 15eb9fe5169c..6644f516a42b 100644
--- a/arch/arm/boot/dts/omap3-zoom3.dts
+++ b/arch/arm/boot/dts/omap3-zoom3.dts
@@ -80,13 +80,8 @@
80 80
81 mmc3_pins: pinmux_mmc3_pins { 81 mmc3_pins: pinmux_mmc3_pins {
82 pinctrl-single,pins = < 82 pinctrl-single,pins = <
83 0x168 (PIN_INPUT | MUX_MODE4) /* mcbsp1_clkx.gpio_162 WLAN IRQ */ 83 OMAP3_CORE1_IOPAD(0x2198, PIN_INPUT | MUX_MODE4) /* mcbsp1_clkx.gpio_162 WLAN IRQ */
84 0x1a0 (PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_cs1.sdmmc3_cmd */ 84 OMAP3_CORE1_IOPAD(0x21d0, 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 >; 85 >;
91 }; 86 };
92 87
@@ -125,6 +120,18 @@
125 }; 120 };
126}; 121};
127 122
123&omap3_pmx_core2 {
124 mmc3_2_pins: pinmux_mmc3_2_pins {
125 pinctrl-single,pins = <
126 OMAP3630_CORE2_IOPAD(0x25d8, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_clk.sdmmc3_clk */
127 OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d4.sdmmc3_dat0 */
128 OMAP3630_CORE2_IOPAD(0x25e6, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d5.sdmmc3_dat1 */
129 OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d6.sdmmc3_dat2 */
130 OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d3.sdmmc3_dat3 */
131 >;
132 };
133};
134
128&omap3_pmx_wkup { 135&omap3_pmx_wkup {
129 wlan_host_wkup: pinmux_wlan_host_wkup_pins { 136 wlan_host_wkup: pinmux_wlan_host_wkup_pins {
130 pinctrl-single,pins = < 137 pinctrl-single,pins = <
@@ -187,7 +194,7 @@
187 bus-width = <4>; 194 bus-width = <4>;
188 cap-power-off-card; 195 cap-power-off-card;
189 pinctrl-names = "default"; 196 pinctrl-names = "default";
190 pinctrl-0 = <&mmc3_pins>; 197 pinctrl-0 = <&mmc3_pins &mmc3_2_pins>;
191}; 198};
192 199
193&uart1 { 200&uart1 {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index daabf99d402a..a5fc83b9c835 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -89,6 +89,45 @@
89 interrupts = <0>; 89 interrupts = <0>;
90 }; 90 };
91 91
92 prm: prm@48306000 {
93 compatible = "ti,omap3-prm";
94 reg = <0x48306000 0x4000>;
95
96 prm_clocks: clocks {
97 #address-cells = <1>;
98 #size-cells = <0>;
99 };
100
101 prm_clockdomains: clockdomains {
102 };
103 };
104
105 cm: cm@48004000 {
106 compatible = "ti,omap3-cm";
107 reg = <0x48004000 0x4000>;
108
109 cm_clocks: clocks {
110 #address-cells = <1>;
111 #size-cells = <0>;
112 };
113
114 cm_clockdomains: clockdomains {
115 };
116 };
117
118 scrm: scrm@48002000 {
119 compatible = "ti,omap3-scrm";
120 reg = <0x48002000 0x2000>;
121
122 scrm_clocks: clocks {
123 #address-cells = <1>;
124 #size-cells = <0>;
125 };
126
127 scrm_clockdomains: clockdomains {
128 };
129 };
130
92 counter32k: counter@48320000 { 131 counter32k: counter@48320000 {
93 compatible = "ti,omap-counter32k"; 132 compatible = "ti,omap-counter32k";
94 reg = <0x48320000 0x20>; 133 reg = <0x48320000 0x20>;
@@ -117,7 +156,7 @@
117 156
118 omap3_pmx_core: pinmux@48002030 { 157 omap3_pmx_core: pinmux@48002030 {
119 compatible = "ti,omap3-padconf", "pinctrl-single"; 158 compatible = "ti,omap3-padconf", "pinctrl-single";
120 reg = <0x48002030 0x05cc>; 159 reg = <0x48002030 0x0238>;
121 #address-cells = <1>; 160 #address-cells = <1>;
122 #size-cells = <0>; 161 #size-cells = <0>;
123 #interrupt-cells = <1>; 162 #interrupt-cells = <1>;
@@ -632,3 +671,5 @@
632 }; 671 };
633 }; 672 };
634}; 673};
674
675/include/ "omap3xxx-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap3430es1-clocks.dtsi b/arch/arm/boot/dts/omap3430es1-clocks.dtsi
new file mode 100644
index 000000000000..02f6c7fabbec
--- /dev/null
+++ b/arch/arm/boot/dts/omap3430es1-clocks.dtsi
@@ -0,0 +1,208 @@
1/*
2 * Device Tree Source for OMAP3430 ES1 clock data
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&cm_clocks {
11 gfx_l3_ck: gfx_l3_ck {
12 #clock-cells = <0>;
13 compatible = "ti,wait-gate-clock";
14 clocks = <&l3_ick>;
15 reg = <0x0b10>;
16 ti,bit-shift = <0>;
17 };
18
19 gfx_l3_fck: gfx_l3_fck {
20 #clock-cells = <0>;
21 compatible = "ti,divider-clock";
22 clocks = <&l3_ick>;
23 ti,max-div = <7>;
24 reg = <0x0b40>;
25 ti,index-starts-at-one;
26 };
27
28 gfx_l3_ick: gfx_l3_ick {
29 #clock-cells = <0>;
30 compatible = "fixed-factor-clock";
31 clocks = <&gfx_l3_ck>;
32 clock-mult = <1>;
33 clock-div = <1>;
34 };
35
36 gfx_cg1_ck: gfx_cg1_ck {
37 #clock-cells = <0>;
38 compatible = "ti,wait-gate-clock";
39 clocks = <&gfx_l3_fck>;
40 reg = <0x0b00>;
41 ti,bit-shift = <1>;
42 };
43
44 gfx_cg2_ck: gfx_cg2_ck {
45 #clock-cells = <0>;
46 compatible = "ti,wait-gate-clock";
47 clocks = <&gfx_l3_fck>;
48 reg = <0x0b00>;
49 ti,bit-shift = <2>;
50 };
51
52 d2d_26m_fck: d2d_26m_fck {
53 #clock-cells = <0>;
54 compatible = "ti,wait-gate-clock";
55 clocks = <&sys_ck>;
56 reg = <0x0a00>;
57 ti,bit-shift = <3>;
58 };
59
60 fshostusb_fck: fshostusb_fck {
61 #clock-cells = <0>;
62 compatible = "ti,wait-gate-clock";
63 clocks = <&core_48m_fck>;
64 reg = <0x0a00>;
65 ti,bit-shift = <5>;
66 };
67
68 ssi_ssr_gate_fck_3430es1: ssi_ssr_gate_fck_3430es1 {
69 #clock-cells = <0>;
70 compatible = "ti,composite-no-wait-gate-clock";
71 clocks = <&corex2_fck>;
72 ti,bit-shift = <0>;
73 reg = <0x0a00>;
74 };
75
76 ssi_ssr_div_fck_3430es1: ssi_ssr_div_fck_3430es1 {
77 #clock-cells = <0>;
78 compatible = "ti,composite-divider-clock";
79 clocks = <&corex2_fck>;
80 ti,bit-shift = <8>;
81 reg = <0x0a40>;
82 ti,dividers = <0>, <1>, <2>, <3>, <4>, <0>, <6>, <0>, <8>;
83 };
84
85 ssi_ssr_fck_3430es1: ssi_ssr_fck_3430es1 {
86 #clock-cells = <0>;
87 compatible = "ti,composite-clock";
88 clocks = <&ssi_ssr_gate_fck_3430es1>, <&ssi_ssr_div_fck_3430es1>;
89 };
90
91 ssi_sst_fck_3430es1: ssi_sst_fck_3430es1 {
92 #clock-cells = <0>;
93 compatible = "fixed-factor-clock";
94 clocks = <&ssi_ssr_fck_3430es1>;
95 clock-mult = <1>;
96 clock-div = <2>;
97 };
98
99 hsotgusb_ick_3430es1: hsotgusb_ick_3430es1 {
100 #clock-cells = <0>;
101 compatible = "ti,omap3-no-wait-interface-clock";
102 clocks = <&core_l3_ick>;
103 reg = <0x0a10>;
104 ti,bit-shift = <4>;
105 };
106
107 fac_ick: fac_ick {
108 #clock-cells = <0>;
109 compatible = "ti,omap3-interface-clock";
110 clocks = <&core_l4_ick>;
111 reg = <0x0a10>;
112 ti,bit-shift = <8>;
113 };
114
115 ssi_l4_ick: ssi_l4_ick {
116 #clock-cells = <0>;
117 compatible = "fixed-factor-clock";
118 clocks = <&l4_ick>;
119 clock-mult = <1>;
120 clock-div = <1>;
121 };
122
123 ssi_ick_3430es1: ssi_ick_3430es1 {
124 #clock-cells = <0>;
125 compatible = "ti,omap3-no-wait-interface-clock";
126 clocks = <&ssi_l4_ick>;
127 reg = <0x0a10>;
128 ti,bit-shift = <0>;
129 };
130
131 usb_l4_gate_ick: usb_l4_gate_ick {
132 #clock-cells = <0>;
133 compatible = "ti,composite-interface-clock";
134 clocks = <&l4_ick>;
135 ti,bit-shift = <5>;
136 reg = <0x0a10>;
137 };
138
139 usb_l4_div_ick: usb_l4_div_ick {
140 #clock-cells = <0>;
141 compatible = "ti,composite-divider-clock";
142 clocks = <&l4_ick>;
143 ti,bit-shift = <4>;
144 ti,max-div = <1>;
145 reg = <0x0a40>;
146 ti,index-starts-at-one;
147 };
148
149 usb_l4_ick: usb_l4_ick {
150 #clock-cells = <0>;
151 compatible = "ti,composite-clock";
152 clocks = <&usb_l4_gate_ick>, <&usb_l4_div_ick>;
153 };
154
155 dss1_alwon_fck_3430es1: dss1_alwon_fck_3430es1 {
156 #clock-cells = <0>;
157 compatible = "ti,gate-clock";
158 clocks = <&dpll4_m4x2_ck>;
159 ti,bit-shift = <0>;
160 reg = <0x0e00>;
161 ti,set-rate-parent;
162 };
163
164 dss_ick_3430es1: dss_ick_3430es1 {
165 #clock-cells = <0>;
166 compatible = "ti,omap3-no-wait-interface-clock";
167 clocks = <&l4_ick>;
168 reg = <0x0e10>;
169 ti,bit-shift = <0>;
170 };
171};
172
173&cm_clockdomains {
174 core_l3_clkdm: core_l3_clkdm {
175 compatible = "ti,clockdomain";
176 clocks = <&sdrc_ick>, <&hsotgusb_ick_3430es1>;
177 };
178
179 gfx_3430es1_clkdm: gfx_3430es1_clkdm {
180 compatible = "ti,clockdomain";
181 clocks = <&gfx_l3_ck>, <&gfx_cg1_ck>, <&gfx_cg2_ck>;
182 };
183
184 dss_clkdm: dss_clkdm {
185 compatible = "ti,clockdomain";
186 clocks = <&dss_tv_fck>, <&dss_96m_fck>, <&dss2_alwon_fck>,
187 <&dss1_alwon_fck_3430es1>, <&dss_ick_3430es1>;
188 };
189
190 d2d_clkdm: d2d_clkdm {
191 compatible = "ti,clockdomain";
192 clocks = <&d2d_26m_fck>;
193 };
194
195 core_l4_clkdm: core_l4_clkdm {
196 compatible = "ti,clockdomain";
197 clocks = <&mmchs2_fck>, <&mmchs1_fck>, <&i2c3_fck>, <&i2c2_fck>,
198 <&i2c1_fck>, <&mcspi4_fck>, <&mcspi3_fck>,
199 <&mcspi2_fck>, <&mcspi1_fck>, <&uart2_fck>,
200 <&uart1_fck>, <&hdq_fck>, <&mmchs2_ick>, <&mmchs1_ick>,
201 <&hdq_ick>, <&mcspi4_ick>, <&mcspi3_ick>,
202 <&mcspi2_ick>, <&mcspi1_ick>, <&i2c3_ick>, <&i2c2_ick>,
203 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
204 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
205 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>,
206 <&fshostusb_fck>, <&fac_ick>, <&ssi_ick_3430es1>;
207 };
208};
diff --git a/arch/arm/boot/dts/omap34xx-omap36xx-clocks.dtsi b/arch/arm/boot/dts/omap34xx-omap36xx-clocks.dtsi
new file mode 100644
index 000000000000..b02017b7630e
--- /dev/null
+++ b/arch/arm/boot/dts/omap34xx-omap36xx-clocks.dtsi
@@ -0,0 +1,268 @@
1/*
2 * Device Tree Source for OMAP34XX/OMAP36XX clock data
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&cm_clocks {
11 security_l4_ick2: security_l4_ick2 {
12 #clock-cells = <0>;
13 compatible = "fixed-factor-clock";
14 clocks = <&l4_ick>;
15 clock-mult = <1>;
16 clock-div = <1>;
17 };
18
19 aes1_ick: aes1_ick {
20 #clock-cells = <0>;
21 compatible = "ti,omap3-interface-clock";
22 clocks = <&security_l4_ick2>;
23 ti,bit-shift = <3>;
24 reg = <0x0a14>;
25 };
26
27 rng_ick: rng_ick {
28 #clock-cells = <0>;
29 compatible = "ti,omap3-interface-clock";
30 clocks = <&security_l4_ick2>;
31 reg = <0x0a14>;
32 ti,bit-shift = <2>;
33 };
34
35 sha11_ick: sha11_ick {
36 #clock-cells = <0>;
37 compatible = "ti,omap3-interface-clock";
38 clocks = <&security_l4_ick2>;
39 reg = <0x0a14>;
40 ti,bit-shift = <1>;
41 };
42
43 des1_ick: des1_ick {
44 #clock-cells = <0>;
45 compatible = "ti,omap3-interface-clock";
46 clocks = <&security_l4_ick2>;
47 reg = <0x0a14>;
48 ti,bit-shift = <0>;
49 };
50
51 cam_mclk: cam_mclk {
52 #clock-cells = <0>;
53 compatible = "ti,gate-clock";
54 clocks = <&dpll4_m5x2_ck>;
55 ti,bit-shift = <0>;
56 reg = <0x0f00>;
57 ti,set-rate-parent;
58 };
59
60 cam_ick: cam_ick {
61 #clock-cells = <0>;
62 compatible = "ti,omap3-no-wait-interface-clock";
63 clocks = <&l4_ick>;
64 reg = <0x0f10>;
65 ti,bit-shift = <0>;
66 };
67
68 csi2_96m_fck: csi2_96m_fck {
69 #clock-cells = <0>;
70 compatible = "ti,gate-clock";
71 clocks = <&core_96m_fck>;
72 reg = <0x0f00>;
73 ti,bit-shift = <1>;
74 };
75
76 security_l3_ick: security_l3_ick {
77 #clock-cells = <0>;
78 compatible = "fixed-factor-clock";
79 clocks = <&l3_ick>;
80 clock-mult = <1>;
81 clock-div = <1>;
82 };
83
84 pka_ick: pka_ick {
85 #clock-cells = <0>;
86 compatible = "ti,omap3-interface-clock";
87 clocks = <&security_l3_ick>;
88 reg = <0x0a14>;
89 ti,bit-shift = <4>;
90 };
91
92 icr_ick: icr_ick {
93 #clock-cells = <0>;
94 compatible = "ti,omap3-interface-clock";
95 clocks = <&core_l4_ick>;
96 reg = <0x0a10>;
97 ti,bit-shift = <29>;
98 };
99
100 des2_ick: des2_ick {
101 #clock-cells = <0>;
102 compatible = "ti,omap3-interface-clock";
103 clocks = <&core_l4_ick>;
104 reg = <0x0a10>;
105 ti,bit-shift = <26>;
106 };
107
108 mspro_ick: mspro_ick {
109 #clock-cells = <0>;
110 compatible = "ti,omap3-interface-clock";
111 clocks = <&core_l4_ick>;
112 reg = <0x0a10>;
113 ti,bit-shift = <23>;
114 };
115
116 mailboxes_ick: mailboxes_ick {
117 #clock-cells = <0>;
118 compatible = "ti,omap3-interface-clock";
119 clocks = <&core_l4_ick>;
120 reg = <0x0a10>;
121 ti,bit-shift = <7>;
122 };
123
124 ssi_l4_ick: ssi_l4_ick {
125 #clock-cells = <0>;
126 compatible = "fixed-factor-clock";
127 clocks = <&l4_ick>;
128 clock-mult = <1>;
129 clock-div = <1>;
130 };
131
132 sr1_fck: sr1_fck {
133 #clock-cells = <0>;
134 compatible = "ti,wait-gate-clock";
135 clocks = <&sys_ck>;
136 reg = <0x0c00>;
137 ti,bit-shift = <6>;
138 };
139
140 sr2_fck: sr2_fck {
141 #clock-cells = <0>;
142 compatible = "ti,wait-gate-clock";
143 clocks = <&sys_ck>;
144 reg = <0x0c00>;
145 ti,bit-shift = <7>;
146 };
147
148 sr_l4_ick: sr_l4_ick {
149 #clock-cells = <0>;
150 compatible = "fixed-factor-clock";
151 clocks = <&l4_ick>;
152 clock-mult = <1>;
153 clock-div = <1>;
154 };
155
156 dpll2_fck: dpll2_fck {
157 #clock-cells = <0>;
158 compatible = "ti,divider-clock";
159 clocks = <&core_ck>;
160 ti,bit-shift = <19>;
161 ti,max-div = <7>;
162 reg = <0x0040>;
163 ti,index-starts-at-one;
164 };
165
166 dpll2_ck: dpll2_ck {
167 #clock-cells = <0>;
168 compatible = "ti,omap3-dpll-clock";
169 clocks = <&sys_ck>, <&dpll2_fck>;
170 reg = <0x0004>, <0x0024>, <0x0040>, <0x0034>;
171 ti,low-power-stop;
172 ti,lock;
173 ti,low-power-bypass;
174 };
175
176 dpll2_m2_ck: dpll2_m2_ck {
177 #clock-cells = <0>;
178 compatible = "ti,divider-clock";
179 clocks = <&dpll2_ck>;
180 ti,max-div = <31>;
181 reg = <0x0044>;
182 ti,index-starts-at-one;
183 };
184
185 iva2_ck: iva2_ck {
186 #clock-cells = <0>;
187 compatible = "ti,wait-gate-clock";
188 clocks = <&dpll2_m2_ck>;
189 reg = <0x0000>;
190 ti,bit-shift = <0>;
191 };
192
193 modem_fck: modem_fck {
194 #clock-cells = <0>;
195 compatible = "ti,omap3-interface-clock";
196 clocks = <&sys_ck>;
197 reg = <0x0a00>;
198 ti,bit-shift = <31>;
199 };
200
201 sad2d_ick: sad2d_ick {
202 #clock-cells = <0>;
203 compatible = "ti,omap3-interface-clock";
204 clocks = <&l3_ick>;
205 reg = <0x0a10>;
206 ti,bit-shift = <3>;
207 };
208
209 mad2d_ick: mad2d_ick {
210 #clock-cells = <0>;
211 compatible = "ti,omap3-interface-clock";
212 clocks = <&l3_ick>;
213 reg = <0x0a18>;
214 ti,bit-shift = <3>;
215 };
216
217 mspro_fck: mspro_fck {
218 #clock-cells = <0>;
219 compatible = "ti,wait-gate-clock";
220 clocks = <&core_96m_fck>;
221 reg = <0x0a00>;
222 ti,bit-shift = <23>;
223 };
224};
225
226&cm_clockdomains {
227 cam_clkdm: cam_clkdm {
228 compatible = "ti,clockdomain";
229 clocks = <&cam_ick>, <&csi2_96m_fck>;
230 };
231
232 iva2_clkdm: iva2_clkdm {
233 compatible = "ti,clockdomain";
234 clocks = <&iva2_ck>;
235 };
236
237 dpll2_clkdm: dpll2_clkdm {
238 compatible = "ti,clockdomain";
239 clocks = <&dpll2_ck>;
240 };
241
242 wkup_clkdm: wkup_clkdm {
243 compatible = "ti,clockdomain";
244 clocks = <&gpio1_dbck>, <&wdt2_fck>, <&wdt2_ick>, <&wdt1_ick>,
245 <&gpio1_ick>, <&omap_32ksync_ick>, <&gpt12_ick>,
246 <&gpt1_ick>, <&sr1_fck>, <&sr2_fck>;
247 };
248
249 d2d_clkdm: d2d_clkdm {
250 compatible = "ti,clockdomain";
251 clocks = <&modem_fck>, <&sad2d_ick>, <&mad2d_ick>;
252 };
253
254 core_l4_clkdm: core_l4_clkdm {
255 compatible = "ti,clockdomain";
256 clocks = <&mmchs2_fck>, <&mmchs1_fck>, <&i2c3_fck>, <&i2c2_fck>,
257 <&i2c1_fck>, <&mcspi4_fck>, <&mcspi3_fck>,
258 <&mcspi2_fck>, <&mcspi1_fck>, <&uart2_fck>,
259 <&uart1_fck>, <&hdq_fck>, <&mmchs2_ick>, <&mmchs1_ick>,
260 <&hdq_ick>, <&mcspi4_ick>, <&mcspi3_ick>,
261 <&mcspi2_ick>, <&mcspi1_ick>, <&i2c3_ick>, <&i2c2_ick>,
262 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
263 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
264 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>, <&icr_ick>,
265 <&des2_ick>, <&mspro_ick>, <&mailboxes_ick>,
266 <&mspro_fck>;
267 };
268};
diff --git a/arch/arm/boot/dts/omap34xx.dtsi b/arch/arm/boot/dts/omap34xx.dtsi
index 5355d6173748..2e92360da1f3 100644
--- a/arch/arm/boot/dts/omap34xx.dtsi
+++ b/arch/arm/boot/dts/omap34xx.dtsi
@@ -25,4 +25,21 @@
25 clock-latency = <300000>; /* From legacy driver */ 25 clock-latency = <300000>; /* From legacy driver */
26 }; 26 };
27 }; 27 };
28
29 ocp {
30 omap3_pmx_core2: pinmux@480025d8 {
31 compatible = "ti,omap3-padconf", "pinctrl-single";
32 reg = <0x480025d8 0x24>;
33 #address-cells = <1>;
34 #size-cells = <0>;
35 #interrupt-cells = <1>;
36 interrupt-controller;
37 pinctrl-single,register-width = <16>;
38 pinctrl-single,function-mask = <0xff1f>;
39 };
40 };
28}; 41};
42
43/include/ "omap34xx-omap36xx-clocks.dtsi"
44/include/ "omap36xx-omap3430es2plus-clocks.dtsi"
45/include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi b/arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi
new file mode 100644
index 000000000000..af9ae5346bf2
--- /dev/null
+++ b/arch/arm/boot/dts/omap36xx-am35xx-omap3430es2plus-clocks.dtsi
@@ -0,0 +1,242 @@
1/*
2 * Device Tree Source for OMAP36xx/AM35xx/OMAP34xx clock data
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&prm_clocks {
11 corex2_d3_fck: corex2_d3_fck {
12 #clock-cells = <0>;
13 compatible = "fixed-factor-clock";
14 clocks = <&corex2_fck>;
15 clock-mult = <1>;
16 clock-div = <3>;
17 };
18
19 corex2_d5_fck: corex2_d5_fck {
20 #clock-cells = <0>;
21 compatible = "fixed-factor-clock";
22 clocks = <&corex2_fck>;
23 clock-mult = <1>;
24 clock-div = <5>;
25 };
26};
27&cm_clocks {
28 dpll5_ck: dpll5_ck {
29 #clock-cells = <0>;
30 compatible = "ti,omap3-dpll-clock";
31 clocks = <&sys_ck>, <&sys_ck>;
32 reg = <0x0d04>, <0x0d24>, <0x0d4c>, <0x0d34>;
33 ti,low-power-stop;
34 ti,lock;
35 };
36
37 dpll5_m2_ck: dpll5_m2_ck {
38 #clock-cells = <0>;
39 compatible = "ti,divider-clock";
40 clocks = <&dpll5_ck>;
41 ti,max-div = <31>;
42 reg = <0x0d50>;
43 ti,index-starts-at-one;
44 };
45
46 sgx_gate_fck: sgx_gate_fck {
47 #clock-cells = <0>;
48 compatible = "ti,composite-gate-clock";
49 clocks = <&core_ck>;
50 ti,bit-shift = <1>;
51 reg = <0x0b00>;
52 };
53
54 core_d3_ck: core_d3_ck {
55 #clock-cells = <0>;
56 compatible = "fixed-factor-clock";
57 clocks = <&core_ck>;
58 clock-mult = <1>;
59 clock-div = <3>;
60 };
61
62 core_d4_ck: core_d4_ck {
63 #clock-cells = <0>;
64 compatible = "fixed-factor-clock";
65 clocks = <&core_ck>;
66 clock-mult = <1>;
67 clock-div = <4>;
68 };
69
70 core_d6_ck: core_d6_ck {
71 #clock-cells = <0>;
72 compatible = "fixed-factor-clock";
73 clocks = <&core_ck>;
74 clock-mult = <1>;
75 clock-div = <6>;
76 };
77
78 omap_192m_alwon_fck: omap_192m_alwon_fck {
79 #clock-cells = <0>;
80 compatible = "fixed-factor-clock";
81 clocks = <&dpll4_m2x2_ck>;
82 clock-mult = <1>;
83 clock-div = <1>;
84 };
85
86 core_d2_ck: core_d2_ck {
87 #clock-cells = <0>;
88 compatible = "fixed-factor-clock";
89 clocks = <&core_ck>;
90 clock-mult = <1>;
91 clock-div = <2>;
92 };
93
94 sgx_mux_fck: sgx_mux_fck {
95 #clock-cells = <0>;
96 compatible = "ti,composite-mux-clock";
97 clocks = <&core_d3_ck>, <&core_d4_ck>, <&core_d6_ck>, <&cm_96m_fck>, <&omap_192m_alwon_fck>, <&core_d2_ck>, <&corex2_d3_fck>, <&corex2_d5_fck>;
98 reg = <0x0b40>;
99 };
100
101 sgx_fck: sgx_fck {
102 #clock-cells = <0>;
103 compatible = "ti,composite-clock";
104 clocks = <&sgx_gate_fck>, <&sgx_mux_fck>;
105 };
106
107 sgx_ick: sgx_ick {
108 #clock-cells = <0>;
109 compatible = "ti,wait-gate-clock";
110 clocks = <&l3_ick>;
111 reg = <0x0b10>;
112 ti,bit-shift = <0>;
113 };
114
115 cpefuse_fck: cpefuse_fck {
116 #clock-cells = <0>;
117 compatible = "ti,gate-clock";
118 clocks = <&sys_ck>;
119 reg = <0x0a08>;
120 ti,bit-shift = <0>;
121 };
122
123 ts_fck: ts_fck {
124 #clock-cells = <0>;
125 compatible = "ti,gate-clock";
126 clocks = <&omap_32k_fck>;
127 reg = <0x0a08>;
128 ti,bit-shift = <1>;
129 };
130
131 usbtll_fck: usbtll_fck {
132 #clock-cells = <0>;
133 compatible = "ti,wait-gate-clock";
134 clocks = <&dpll5_m2_ck>;
135 reg = <0x0a08>;
136 ti,bit-shift = <2>;
137 };
138
139 usbtll_ick: usbtll_ick {
140 #clock-cells = <0>;
141 compatible = "ti,omap3-interface-clock";
142 clocks = <&core_l4_ick>;
143 reg = <0x0a18>;
144 ti,bit-shift = <2>;
145 };
146
147 mmchs3_ick: mmchs3_ick {
148 #clock-cells = <0>;
149 compatible = "ti,omap3-interface-clock";
150 clocks = <&core_l4_ick>;
151 reg = <0x0a10>;
152 ti,bit-shift = <30>;
153 };
154
155 mmchs3_fck: mmchs3_fck {
156 #clock-cells = <0>;
157 compatible = "ti,wait-gate-clock";
158 clocks = <&core_96m_fck>;
159 reg = <0x0a00>;
160 ti,bit-shift = <30>;
161 };
162
163 dss1_alwon_fck_3430es2: dss1_alwon_fck_3430es2 {
164 #clock-cells = <0>;
165 compatible = "ti,dss-gate-clock";
166 clocks = <&dpll4_m4x2_ck>;
167 ti,bit-shift = <0>;
168 reg = <0x0e00>;
169 ti,set-rate-parent;
170 };
171
172 dss_ick_3430es2: dss_ick_3430es2 {
173 #clock-cells = <0>;
174 compatible = "ti,omap3-dss-interface-clock";
175 clocks = <&l4_ick>;
176 reg = <0x0e10>;
177 ti,bit-shift = <0>;
178 };
179
180 usbhost_120m_fck: usbhost_120m_fck {
181 #clock-cells = <0>;
182 compatible = "ti,gate-clock";
183 clocks = <&dpll5_m2_ck>;
184 reg = <0x1400>;
185 ti,bit-shift = <1>;
186 };
187
188 usbhost_48m_fck: usbhost_48m_fck {
189 #clock-cells = <0>;
190 compatible = "ti,dss-gate-clock";
191 clocks = <&omap_48m_fck>;
192 reg = <0x1400>;
193 ti,bit-shift = <0>;
194 };
195
196 usbhost_ick: usbhost_ick {
197 #clock-cells = <0>;
198 compatible = "ti,omap3-dss-interface-clock";
199 clocks = <&l4_ick>;
200 reg = <0x1410>;
201 ti,bit-shift = <0>;
202 };
203};
204
205&cm_clockdomains {
206 dpll5_clkdm: dpll5_clkdm {
207 compatible = "ti,clockdomain";
208 clocks = <&dpll5_ck>;
209 };
210
211 sgx_clkdm: sgx_clkdm {
212 compatible = "ti,clockdomain";
213 clocks = <&sgx_ick>;
214 };
215
216 dss_clkdm: dss_clkdm {
217 compatible = "ti,clockdomain";
218 clocks = <&dss_tv_fck>, <&dss_96m_fck>, <&dss2_alwon_fck>,
219 <&dss1_alwon_fck_3430es2>, <&dss_ick_3430es2>;
220 };
221
222 core_l4_clkdm: core_l4_clkdm {
223 compatible = "ti,clockdomain";
224 clocks = <&mmchs2_fck>, <&mmchs1_fck>, <&i2c3_fck>, <&i2c2_fck>,
225 <&i2c1_fck>, <&mcspi4_fck>, <&mcspi3_fck>,
226 <&mcspi2_fck>, <&mcspi1_fck>, <&uart2_fck>,
227 <&uart1_fck>, <&hdq_fck>, <&mmchs2_ick>, <&mmchs1_ick>,
228 <&hdq_ick>, <&mcspi4_ick>, <&mcspi3_ick>,
229 <&mcspi2_ick>, <&mcspi1_ick>, <&i2c3_ick>, <&i2c2_ick>,
230 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
231 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
232 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>,
233 <&cpefuse_fck>, <&ts_fck>, <&usbtll_fck>,
234 <&usbtll_ick>, <&mmchs3_ick>, <&mmchs3_fck>;
235 };
236
237 usbhost_clkdm: usbhost_clkdm {
238 compatible = "ti,clockdomain";
239 clocks = <&usbhost_120m_fck>, <&usbhost_48m_fck>,
240 <&usbhost_ick>;
241 };
242};
diff --git a/arch/arm/boot/dts/omap36xx-clocks.dtsi b/arch/arm/boot/dts/omap36xx-clocks.dtsi
new file mode 100644
index 000000000000..2fcf253b677c
--- /dev/null
+++ b/arch/arm/boot/dts/omap36xx-clocks.dtsi
@@ -0,0 +1,90 @@
1/*
2 * Device Tree Source for OMAP36xx clock data
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&cm_clocks {
11 dpll4_ck: dpll4_ck {
12 #clock-cells = <0>;
13 compatible = "ti,omap3-dpll-per-j-type-clock";
14 clocks = <&sys_ck>, <&sys_ck>;
15 reg = <0x0d00>, <0x0d20>, <0x0d44>, <0x0d30>;
16 };
17
18 dpll4_m5x2_ck: dpll4_m5x2_ck {
19 #clock-cells = <0>;
20 compatible = "ti,hsdiv-gate-clock";
21 clocks = <&dpll4_m5x2_mul_ck>;
22 ti,bit-shift = <0x1e>;
23 reg = <0x0d00>;
24 ti,set-rate-parent;
25 ti,set-bit-to-disable;
26 };
27
28 dpll4_m2x2_ck: dpll4_m2x2_ck {
29 #clock-cells = <0>;
30 compatible = "ti,hsdiv-gate-clock";
31 clocks = <&dpll4_m2x2_mul_ck>;
32 ti,bit-shift = <0x1b>;
33 reg = <0x0d00>;
34 ti,set-bit-to-disable;
35 };
36
37 dpll3_m3x2_ck: dpll3_m3x2_ck {
38 #clock-cells = <0>;
39 compatible = "ti,hsdiv-gate-clock";
40 clocks = <&dpll3_m3x2_mul_ck>;
41 ti,bit-shift = <0xc>;
42 reg = <0x0d00>;
43 ti,set-bit-to-disable;
44 };
45
46 dpll4_m3x2_ck: dpll4_m3x2_ck {
47 #clock-cells = <0>;
48 compatible = "ti,hsdiv-gate-clock";
49 clocks = <&dpll4_m3x2_mul_ck>;
50 ti,bit-shift = <0x1c>;
51 reg = <0x0d00>;
52 ti,set-bit-to-disable;
53 };
54
55 dpll4_m6x2_ck: dpll4_m6x2_ck {
56 #clock-cells = <0>;
57 compatible = "ti,hsdiv-gate-clock";
58 clocks = <&dpll4_m6x2_mul_ck>;
59 ti,bit-shift = <0x1f>;
60 reg = <0x0d00>;
61 ti,set-bit-to-disable;
62 };
63
64 uart4_fck: uart4_fck {
65 #clock-cells = <0>;
66 compatible = "ti,wait-gate-clock";
67 clocks = <&per_48m_fck>;
68 reg = <0x1000>;
69 ti,bit-shift = <18>;
70 };
71};
72
73&cm_clockdomains {
74 dpll4_clkdm: dpll4_clkdm {
75 compatible = "ti,clockdomain";
76 clocks = <&dpll4_ck>;
77 };
78
79 per_clkdm: per_clkdm {
80 compatible = "ti,clockdomain";
81 clocks = <&uart3_fck>, <&gpio6_dbck>, <&gpio5_dbck>,
82 <&gpio4_dbck>, <&gpio3_dbck>, <&gpio2_dbck>,
83 <&wdt3_fck>, <&gpio6_ick>, <&gpio5_ick>, <&gpio4_ick>,
84 <&gpio3_ick>, <&gpio2_ick>, <&wdt3_ick>, <&uart3_ick>,
85 <&uart4_ick>, <&gpt9_ick>, <&gpt8_ick>, <&gpt7_ick>,
86 <&gpt6_ick>, <&gpt5_ick>, <&gpt4_ick>, <&gpt3_ick>,
87 <&gpt2_ick>, <&mcbsp2_ick>, <&mcbsp3_ick>,
88 <&mcbsp4_ick>, <&uart4_fck>;
89 };
90};
diff --git a/arch/arm/boot/dts/omap36xx-omap3430es2plus-clocks.dtsi b/arch/arm/boot/dts/omap36xx-omap3430es2plus-clocks.dtsi
new file mode 100644
index 000000000000..8ed475dd63c9
--- /dev/null
+++ b/arch/arm/boot/dts/omap36xx-omap3430es2plus-clocks.dtsi
@@ -0,0 +1,198 @@
1/*
2 * Device Tree Source for OMAP34xx/OMAP36xx clock data
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&cm_clocks {
11 ssi_ssr_gate_fck_3430es2: ssi_ssr_gate_fck_3430es2 {
12 #clock-cells = <0>;
13 compatible = "ti,composite-no-wait-gate-clock";
14 clocks = <&corex2_fck>;
15 ti,bit-shift = <0>;
16 reg = <0x0a00>;
17 };
18
19 ssi_ssr_div_fck_3430es2: ssi_ssr_div_fck_3430es2 {
20 #clock-cells = <0>;
21 compatible = "ti,composite-divider-clock";
22 clocks = <&corex2_fck>;
23 ti,bit-shift = <8>;
24 reg = <0x0a40>;
25 ti,dividers = <0>, <1>, <2>, <3>, <4>, <0>, <6>, <0>, <8>;
26 };
27
28 ssi_ssr_fck_3430es2: ssi_ssr_fck_3430es2 {
29 #clock-cells = <0>;
30 compatible = "ti,composite-clock";
31 clocks = <&ssi_ssr_gate_fck_3430es2>, <&ssi_ssr_div_fck_3430es2>;
32 };
33
34 ssi_sst_fck_3430es2: ssi_sst_fck_3430es2 {
35 #clock-cells = <0>;
36 compatible = "fixed-factor-clock";
37 clocks = <&ssi_ssr_fck_3430es2>;
38 clock-mult = <1>;
39 clock-div = <2>;
40 };
41
42 hsotgusb_ick_3430es2: hsotgusb_ick_3430es2 {
43 #clock-cells = <0>;
44 compatible = "ti,omap3-hsotgusb-interface-clock";
45 clocks = <&core_l3_ick>;
46 reg = <0x0a10>;
47 ti,bit-shift = <4>;
48 };
49
50 ssi_l4_ick: ssi_l4_ick {
51 #clock-cells = <0>;
52 compatible = "fixed-factor-clock";
53 clocks = <&l4_ick>;
54 clock-mult = <1>;
55 clock-div = <1>;
56 };
57
58 ssi_ick_3430es2: ssi_ick_3430es2 {
59 #clock-cells = <0>;
60 compatible = "ti,omap3-ssi-interface-clock";
61 clocks = <&ssi_l4_ick>;
62 reg = <0x0a10>;
63 ti,bit-shift = <0>;
64 };
65
66 usim_gate_fck: usim_gate_fck {
67 #clock-cells = <0>;
68 compatible = "ti,composite-gate-clock";
69 clocks = <&omap_96m_fck>;
70 ti,bit-shift = <9>;
71 reg = <0x0c00>;
72 };
73
74 sys_d2_ck: sys_d2_ck {
75 #clock-cells = <0>;
76 compatible = "fixed-factor-clock";
77 clocks = <&sys_ck>;
78 clock-mult = <1>;
79 clock-div = <2>;
80 };
81
82 omap_96m_d2_fck: omap_96m_d2_fck {
83 #clock-cells = <0>;
84 compatible = "fixed-factor-clock";
85 clocks = <&omap_96m_fck>;
86 clock-mult = <1>;
87 clock-div = <2>;
88 };
89
90 omap_96m_d4_fck: omap_96m_d4_fck {
91 #clock-cells = <0>;
92 compatible = "fixed-factor-clock";
93 clocks = <&omap_96m_fck>;
94 clock-mult = <1>;
95 clock-div = <4>;
96 };
97
98 omap_96m_d8_fck: omap_96m_d8_fck {
99 #clock-cells = <0>;
100 compatible = "fixed-factor-clock";
101 clocks = <&omap_96m_fck>;
102 clock-mult = <1>;
103 clock-div = <8>;
104 };
105
106 omap_96m_d10_fck: omap_96m_d10_fck {
107 #clock-cells = <0>;
108 compatible = "fixed-factor-clock";
109 clocks = <&omap_96m_fck>;
110 clock-mult = <1>;
111 clock-div = <10>;
112 };
113
114 dpll5_m2_d4_ck: dpll5_m2_d4_ck {
115 #clock-cells = <0>;
116 compatible = "fixed-factor-clock";
117 clocks = <&dpll5_m2_ck>;
118 clock-mult = <1>;
119 clock-div = <4>;
120 };
121
122 dpll5_m2_d8_ck: dpll5_m2_d8_ck {
123 #clock-cells = <0>;
124 compatible = "fixed-factor-clock";
125 clocks = <&dpll5_m2_ck>;
126 clock-mult = <1>;
127 clock-div = <8>;
128 };
129
130 dpll5_m2_d16_ck: dpll5_m2_d16_ck {
131 #clock-cells = <0>;
132 compatible = "fixed-factor-clock";
133 clocks = <&dpll5_m2_ck>;
134 clock-mult = <1>;
135 clock-div = <16>;
136 };
137
138 dpll5_m2_d20_ck: dpll5_m2_d20_ck {
139 #clock-cells = <0>;
140 compatible = "fixed-factor-clock";
141 clocks = <&dpll5_m2_ck>;
142 clock-mult = <1>;
143 clock-div = <20>;
144 };
145
146 usim_mux_fck: usim_mux_fck {
147 #clock-cells = <0>;
148 compatible = "ti,composite-mux-clock";
149 clocks = <&sys_ck>, <&sys_d2_ck>, <&omap_96m_d2_fck>, <&omap_96m_d4_fck>, <&omap_96m_d8_fck>, <&omap_96m_d10_fck>, <&dpll5_m2_d4_ck>, <&dpll5_m2_d8_ck>, <&dpll5_m2_d16_ck>, <&dpll5_m2_d20_ck>;
150 ti,bit-shift = <3>;
151 reg = <0x0c40>;
152 ti,index-starts-at-one;
153 };
154
155 usim_fck: usim_fck {
156 #clock-cells = <0>;
157 compatible = "ti,composite-clock";
158 clocks = <&usim_gate_fck>, <&usim_mux_fck>;
159 };
160
161 usim_ick: usim_ick {
162 #clock-cells = <0>;
163 compatible = "ti,omap3-interface-clock";
164 clocks = <&wkup_l4_ick>;
165 reg = <0x0c10>;
166 ti,bit-shift = <9>;
167 };
168};
169
170&cm_clockdomains {
171 core_l3_clkdm: core_l3_clkdm {
172 compatible = "ti,clockdomain";
173 clocks = <&sdrc_ick>, <&hsotgusb_ick_3430es2>;
174 };
175
176 wkup_clkdm: wkup_clkdm {
177 compatible = "ti,clockdomain";
178 clocks = <&gpio1_dbck>, <&wdt2_fck>, <&wdt2_ick>, <&wdt1_ick>,
179 <&gpio1_ick>, <&omap_32ksync_ick>, <&gpt12_ick>,
180 <&gpt1_ick>, <&usim_ick>;
181 };
182
183 core_l4_clkdm: core_l4_clkdm {
184 compatible = "ti,clockdomain";
185 clocks = <&cpefuse_fck>, <&ts_fck>, <&usbtll_fck>,
186 <&usbtll_ick>, <&mmchs3_ick>, <&mmchs3_fck>,
187 <&mmchs2_fck>, <&mmchs1_fck>, <&i2c3_fck>, <&i2c2_fck>,
188 <&i2c1_fck>, <&mcspi4_fck>, <&mcspi3_fck>,
189 <&mcspi2_fck>, <&mcspi1_fck>, <&uart2_fck>,
190 <&uart1_fck>, <&hdq_fck>, <&mmchs2_ick>, <&mmchs1_ick>,
191 <&hdq_ick>, <&mcspi4_ick>, <&mcspi3_ick>,
192 <&mcspi2_ick>, <&mcspi1_ick>, <&i2c3_ick>, <&i2c2_ick>,
193 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
194 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
195 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>,
196 <&ssi_ick_3430es2>;
197 };
198};
diff --git a/arch/arm/boot/dts/omap36xx.dtsi b/arch/arm/boot/dts/omap36xx.dtsi
index 380c22eb468e..7e8dee9175d6 100644
--- a/arch/arm/boot/dts/omap36xx.dtsi
+++ b/arch/arm/boot/dts/omap36xx.dtsi
@@ -38,5 +38,21 @@
38 ti,hwmods = "uart4"; 38 ti,hwmods = "uart4";
39 clock-frequency = <48000000>; 39 clock-frequency = <48000000>;
40 }; 40 };
41
42 omap3_pmx_core2: pinmux@480025a0 {
43 compatible = "ti,omap3-padconf", "pinctrl-single";
44 reg = <0x480025a0 0x5c>;
45 #address-cells = <1>;
46 #size-cells = <0>;
47 #interrupt-cells = <1>;
48 interrupt-controller;
49 pinctrl-single,register-width = <16>;
50 pinctrl-single,function-mask = <0xff1f>;
51 };
41 }; 52 };
42}; 53};
54
55/include/ "omap36xx-clocks.dtsi"
56/include/ "omap34xx-omap36xx-clocks.dtsi"
57/include/ "omap36xx-omap3430es2plus-clocks.dtsi"
58/include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap3xxx-clocks.dtsi b/arch/arm/boot/dts/omap3xxx-clocks.dtsi
new file mode 100644
index 000000000000..cb04d4b37e7f
--- /dev/null
+++ b/arch/arm/boot/dts/omap3xxx-clocks.dtsi
@@ -0,0 +1,1660 @@
1/*
2 * Device Tree Source for OMAP3 clock data
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&prm_clocks {
11 virt_16_8m_ck: virt_16_8m_ck {
12 #clock-cells = <0>;
13 compatible = "fixed-clock";
14 clock-frequency = <16800000>;
15 };
16
17 osc_sys_ck: osc_sys_ck {
18 #clock-cells = <0>;
19 compatible = "ti,mux-clock";
20 clocks = <&virt_12m_ck>, <&virt_13m_ck>, <&virt_19200000_ck>, <&virt_26000000_ck>, <&virt_38_4m_ck>, <&virt_16_8m_ck>;
21 reg = <0x0d40>;
22 };
23
24 sys_ck: sys_ck {
25 #clock-cells = <0>;
26 compatible = "ti,divider-clock";
27 clocks = <&osc_sys_ck>;
28 ti,bit-shift = <6>;
29 ti,max-div = <3>;
30 reg = <0x1270>;
31 ti,index-starts-at-one;
32 };
33
34 sys_clkout1: sys_clkout1 {
35 #clock-cells = <0>;
36 compatible = "ti,gate-clock";
37 clocks = <&osc_sys_ck>;
38 reg = <0x0d70>;
39 ti,bit-shift = <7>;
40 };
41
42 dpll3_x2_ck: dpll3_x2_ck {
43 #clock-cells = <0>;
44 compatible = "fixed-factor-clock";
45 clocks = <&dpll3_ck>;
46 clock-mult = <2>;
47 clock-div = <1>;
48 };
49
50 dpll3_m2x2_ck: dpll3_m2x2_ck {
51 #clock-cells = <0>;
52 compatible = "fixed-factor-clock";
53 clocks = <&dpll3_m2_ck>;
54 clock-mult = <2>;
55 clock-div = <1>;
56 };
57
58 dpll4_x2_ck: dpll4_x2_ck {
59 #clock-cells = <0>;
60 compatible = "fixed-factor-clock";
61 clocks = <&dpll4_ck>;
62 clock-mult = <2>;
63 clock-div = <1>;
64 };
65
66 corex2_fck: corex2_fck {
67 #clock-cells = <0>;
68 compatible = "fixed-factor-clock";
69 clocks = <&dpll3_m2x2_ck>;
70 clock-mult = <1>;
71 clock-div = <1>;
72 };
73
74 wkup_l4_ick: wkup_l4_ick {
75 #clock-cells = <0>;
76 compatible = "fixed-factor-clock";
77 clocks = <&sys_ck>;
78 clock-mult = <1>;
79 clock-div = <1>;
80 };
81};
82&scrm_clocks {
83 mcbsp5_mux_fck: mcbsp5_mux_fck {
84 #clock-cells = <0>;
85 compatible = "ti,composite-mux-clock";
86 clocks = <&core_96m_fck>, <&mcbsp_clks>;
87 ti,bit-shift = <4>;
88 reg = <0x02d8>;
89 };
90
91 mcbsp5_fck: mcbsp5_fck {
92 #clock-cells = <0>;
93 compatible = "ti,composite-clock";
94 clocks = <&mcbsp5_gate_fck>, <&mcbsp5_mux_fck>;
95 };
96
97 mcbsp1_mux_fck: mcbsp1_mux_fck {
98 #clock-cells = <0>;
99 compatible = "ti,composite-mux-clock";
100 clocks = <&core_96m_fck>, <&mcbsp_clks>;
101 ti,bit-shift = <2>;
102 reg = <0x0274>;
103 };
104
105 mcbsp1_fck: mcbsp1_fck {
106 #clock-cells = <0>;
107 compatible = "ti,composite-clock";
108 clocks = <&mcbsp1_gate_fck>, <&mcbsp1_mux_fck>;
109 };
110
111 mcbsp2_mux_fck: mcbsp2_mux_fck {
112 #clock-cells = <0>;
113 compatible = "ti,composite-mux-clock";
114 clocks = <&per_96m_fck>, <&mcbsp_clks>;
115 ti,bit-shift = <6>;
116 reg = <0x0274>;
117 };
118
119 mcbsp2_fck: mcbsp2_fck {
120 #clock-cells = <0>;
121 compatible = "ti,composite-clock";
122 clocks = <&mcbsp2_gate_fck>, <&mcbsp2_mux_fck>;
123 };
124
125 mcbsp3_mux_fck: mcbsp3_mux_fck {
126 #clock-cells = <0>;
127 compatible = "ti,composite-mux-clock";
128 clocks = <&per_96m_fck>, <&mcbsp_clks>;
129 reg = <0x02d8>;
130 };
131
132 mcbsp3_fck: mcbsp3_fck {
133 #clock-cells = <0>;
134 compatible = "ti,composite-clock";
135 clocks = <&mcbsp3_gate_fck>, <&mcbsp3_mux_fck>;
136 };
137
138 mcbsp4_mux_fck: mcbsp4_mux_fck {
139 #clock-cells = <0>;
140 compatible = "ti,composite-mux-clock";
141 clocks = <&per_96m_fck>, <&mcbsp_clks>;
142 ti,bit-shift = <2>;
143 reg = <0x02d8>;
144 };
145
146 mcbsp4_fck: mcbsp4_fck {
147 #clock-cells = <0>;
148 compatible = "ti,composite-clock";
149 clocks = <&mcbsp4_gate_fck>, <&mcbsp4_mux_fck>;
150 };
151};
152&cm_clocks {
153 dummy_apb_pclk: dummy_apb_pclk {
154 #clock-cells = <0>;
155 compatible = "fixed-clock";
156 clock-frequency = <0x0>;
157 };
158
159 omap_32k_fck: omap_32k_fck {
160 #clock-cells = <0>;
161 compatible = "fixed-clock";
162 clock-frequency = <32768>;
163 };
164
165 virt_12m_ck: virt_12m_ck {
166 #clock-cells = <0>;
167 compatible = "fixed-clock";
168 clock-frequency = <12000000>;
169 };
170
171 virt_13m_ck: virt_13m_ck {
172 #clock-cells = <0>;
173 compatible = "fixed-clock";
174 clock-frequency = <13000000>;
175 };
176
177 virt_19200000_ck: virt_19200000_ck {
178 #clock-cells = <0>;
179 compatible = "fixed-clock";
180 clock-frequency = <19200000>;
181 };
182
183 virt_26000000_ck: virt_26000000_ck {
184 #clock-cells = <0>;
185 compatible = "fixed-clock";
186 clock-frequency = <26000000>;
187 };
188
189 virt_38_4m_ck: virt_38_4m_ck {
190 #clock-cells = <0>;
191 compatible = "fixed-clock";
192 clock-frequency = <38400000>;
193 };
194
195 dpll4_ck: dpll4_ck {
196 #clock-cells = <0>;
197 compatible = "ti,omap3-dpll-per-clock";
198 clocks = <&sys_ck>, <&sys_ck>;
199 reg = <0x0d00>, <0x0d20>, <0x0d44>, <0x0d30>;
200 };
201
202 dpll4_m2_ck: dpll4_m2_ck {
203 #clock-cells = <0>;
204 compatible = "ti,divider-clock";
205 clocks = <&dpll4_ck>;
206 ti,max-div = <63>;
207 reg = <0x0d48>;
208 ti,index-starts-at-one;
209 };
210
211 dpll4_m2x2_mul_ck: dpll4_m2x2_mul_ck {
212 #clock-cells = <0>;
213 compatible = "fixed-factor-clock";
214 clocks = <&dpll4_m2_ck>;
215 clock-mult = <2>;
216 clock-div = <1>;
217 };
218
219 dpll4_m2x2_ck: dpll4_m2x2_ck {
220 #clock-cells = <0>;
221 compatible = "ti,gate-clock";
222 clocks = <&dpll4_m2x2_mul_ck>;
223 ti,bit-shift = <0x1b>;
224 reg = <0x0d00>;
225 ti,set-bit-to-disable;
226 };
227
228 omap_96m_alwon_fck: omap_96m_alwon_fck {
229 #clock-cells = <0>;
230 compatible = "fixed-factor-clock";
231 clocks = <&dpll4_m2x2_ck>;
232 clock-mult = <1>;
233 clock-div = <1>;
234 };
235
236 dpll3_ck: dpll3_ck {
237 #clock-cells = <0>;
238 compatible = "ti,omap3-dpll-core-clock";
239 clocks = <&sys_ck>, <&sys_ck>;
240 reg = <0x0d00>, <0x0d20>, <0x0d40>, <0x0d30>;
241 };
242
243 dpll3_m3_ck: dpll3_m3_ck {
244 #clock-cells = <0>;
245 compatible = "ti,divider-clock";
246 clocks = <&dpll3_ck>;
247 ti,bit-shift = <16>;
248 ti,max-div = <31>;
249 reg = <0x1140>;
250 ti,index-starts-at-one;
251 };
252
253 dpll3_m3x2_mul_ck: dpll3_m3x2_mul_ck {
254 #clock-cells = <0>;
255 compatible = "fixed-factor-clock";
256 clocks = <&dpll3_m3_ck>;
257 clock-mult = <2>;
258 clock-div = <1>;
259 };
260
261 dpll3_m3x2_ck: dpll3_m3x2_ck {
262 #clock-cells = <0>;
263 compatible = "ti,gate-clock";
264 clocks = <&dpll3_m3x2_mul_ck>;
265 ti,bit-shift = <0xc>;
266 reg = <0x0d00>;
267 ti,set-bit-to-disable;
268 };
269
270 emu_core_alwon_ck: emu_core_alwon_ck {
271 #clock-cells = <0>;
272 compatible = "fixed-factor-clock";
273 clocks = <&dpll3_m3x2_ck>;
274 clock-mult = <1>;
275 clock-div = <1>;
276 };
277
278 sys_altclk: sys_altclk {
279 #clock-cells = <0>;
280 compatible = "fixed-clock";
281 clock-frequency = <0x0>;
282 };
283
284 mcbsp_clks: mcbsp_clks {
285 #clock-cells = <0>;
286 compatible = "fixed-clock";
287 clock-frequency = <0x0>;
288 };
289
290 dpll3_m2_ck: dpll3_m2_ck {
291 #clock-cells = <0>;
292 compatible = "ti,divider-clock";
293 clocks = <&dpll3_ck>;
294 ti,bit-shift = <27>;
295 ti,max-div = <31>;
296 reg = <0x0d40>;
297 ti,index-starts-at-one;
298 };
299
300 core_ck: core_ck {
301 #clock-cells = <0>;
302 compatible = "fixed-factor-clock";
303 clocks = <&dpll3_m2_ck>;
304 clock-mult = <1>;
305 clock-div = <1>;
306 };
307
308 dpll1_fck: dpll1_fck {
309 #clock-cells = <0>;
310 compatible = "ti,divider-clock";
311 clocks = <&core_ck>;
312 ti,bit-shift = <19>;
313 ti,max-div = <7>;
314 reg = <0x0940>;
315 ti,index-starts-at-one;
316 };
317
318 dpll1_ck: dpll1_ck {
319 #clock-cells = <0>;
320 compatible = "ti,omap3-dpll-clock";
321 clocks = <&sys_ck>, <&dpll1_fck>;
322 reg = <0x0904>, <0x0924>, <0x0940>, <0x0934>;
323 };
324
325 dpll1_x2_ck: dpll1_x2_ck {
326 #clock-cells = <0>;
327 compatible = "fixed-factor-clock";
328 clocks = <&dpll1_ck>;
329 clock-mult = <2>;
330 clock-div = <1>;
331 };
332
333 dpll1_x2m2_ck: dpll1_x2m2_ck {
334 #clock-cells = <0>;
335 compatible = "ti,divider-clock";
336 clocks = <&dpll1_x2_ck>;
337 ti,max-div = <31>;
338 reg = <0x0944>;
339 ti,index-starts-at-one;
340 };
341
342 cm_96m_fck: cm_96m_fck {
343 #clock-cells = <0>;
344 compatible = "fixed-factor-clock";
345 clocks = <&omap_96m_alwon_fck>;
346 clock-mult = <1>;
347 clock-div = <1>;
348 };
349
350 omap_96m_fck: omap_96m_fck {
351 #clock-cells = <0>;
352 compatible = "ti,mux-clock";
353 clocks = <&cm_96m_fck>, <&sys_ck>;
354 ti,bit-shift = <6>;
355 reg = <0x0d40>;
356 };
357
358 dpll4_m3_ck: dpll4_m3_ck {
359 #clock-cells = <0>;
360 compatible = "ti,divider-clock";
361 clocks = <&dpll4_ck>;
362 ti,bit-shift = <8>;
363 ti,max-div = <32>;
364 reg = <0x0e40>;
365 ti,index-starts-at-one;
366 };
367
368 dpll4_m3x2_mul_ck: dpll4_m3x2_mul_ck {
369 #clock-cells = <0>;
370 compatible = "fixed-factor-clock";
371 clocks = <&dpll4_m3_ck>;
372 clock-mult = <2>;
373 clock-div = <1>;
374 };
375
376 dpll4_m3x2_ck: dpll4_m3x2_ck {
377 #clock-cells = <0>;
378 compatible = "ti,gate-clock";
379 clocks = <&dpll4_m3x2_mul_ck>;
380 ti,bit-shift = <0x1c>;
381 reg = <0x0d00>;
382 ti,set-bit-to-disable;
383 };
384
385 omap_54m_fck: omap_54m_fck {
386 #clock-cells = <0>;
387 compatible = "ti,mux-clock";
388 clocks = <&dpll4_m3x2_ck>, <&sys_altclk>;
389 ti,bit-shift = <5>;
390 reg = <0x0d40>;
391 };
392
393 cm_96m_d2_fck: cm_96m_d2_fck {
394 #clock-cells = <0>;
395 compatible = "fixed-factor-clock";
396 clocks = <&cm_96m_fck>;
397 clock-mult = <1>;
398 clock-div = <2>;
399 };
400
401 omap_48m_fck: omap_48m_fck {
402 #clock-cells = <0>;
403 compatible = "ti,mux-clock";
404 clocks = <&cm_96m_d2_fck>, <&sys_altclk>;
405 ti,bit-shift = <3>;
406 reg = <0x0d40>;
407 };
408
409 omap_12m_fck: omap_12m_fck {
410 #clock-cells = <0>;
411 compatible = "fixed-factor-clock";
412 clocks = <&omap_48m_fck>;
413 clock-mult = <1>;
414 clock-div = <4>;
415 };
416
417 dpll4_m4_ck: dpll4_m4_ck {
418 #clock-cells = <0>;
419 compatible = "ti,divider-clock";
420 clocks = <&dpll4_ck>;
421 ti,max-div = <32>;
422 reg = <0x0e40>;
423 ti,index-starts-at-one;
424 };
425
426 dpll4_m4x2_mul_ck: dpll4_m4x2_mul_ck {
427 #clock-cells = <0>;
428 compatible = "fixed-factor-clock";
429 clocks = <&dpll4_m4_ck>;
430 clock-mult = <2>;
431 clock-div = <1>;
432 };
433
434 dpll4_m4x2_ck: dpll4_m4x2_ck {
435 #clock-cells = <0>;
436 compatible = "ti,gate-clock";
437 clocks = <&dpll4_m4x2_mul_ck>;
438 ti,bit-shift = <0x1d>;
439 reg = <0x0d00>;
440 ti,set-bit-to-disable;
441 };
442
443 dpll4_m5_ck: dpll4_m5_ck {
444 #clock-cells = <0>;
445 compatible = "ti,divider-clock";
446 clocks = <&dpll4_ck>;
447 ti,max-div = <63>;
448 reg = <0x0f40>;
449 ti,index-starts-at-one;
450 };
451
452 dpll4_m5x2_mul_ck: dpll4_m5x2_mul_ck {
453 #clock-cells = <0>;
454 compatible = "fixed-factor-clock";
455 clocks = <&dpll4_m5_ck>;
456 clock-mult = <2>;
457 clock-div = <1>;
458 };
459
460 dpll4_m5x2_ck: dpll4_m5x2_ck {
461 #clock-cells = <0>;
462 compatible = "ti,gate-clock";
463 clocks = <&dpll4_m5x2_mul_ck>;
464 ti,bit-shift = <0x1e>;
465 reg = <0x0d00>;
466 ti,set-bit-to-disable;
467 };
468
469 dpll4_m6_ck: dpll4_m6_ck {
470 #clock-cells = <0>;
471 compatible = "ti,divider-clock";
472 clocks = <&dpll4_ck>;
473 ti,bit-shift = <24>;
474 ti,max-div = <63>;
475 reg = <0x1140>;
476 ti,index-starts-at-one;
477 };
478
479 dpll4_m6x2_mul_ck: dpll4_m6x2_mul_ck {
480 #clock-cells = <0>;
481 compatible = "fixed-factor-clock";
482 clocks = <&dpll4_m6_ck>;
483 clock-mult = <2>;
484 clock-div = <1>;
485 };
486
487 dpll4_m6x2_ck: dpll4_m6x2_ck {
488 #clock-cells = <0>;
489 compatible = "ti,gate-clock";
490 clocks = <&dpll4_m6x2_mul_ck>;
491 ti,bit-shift = <0x1f>;
492 reg = <0x0d00>;
493 ti,set-bit-to-disable;
494 };
495
496 emu_per_alwon_ck: emu_per_alwon_ck {
497 #clock-cells = <0>;
498 compatible = "fixed-factor-clock";
499 clocks = <&dpll4_m6x2_ck>;
500 clock-mult = <1>;
501 clock-div = <1>;
502 };
503
504 clkout2_src_gate_ck: clkout2_src_gate_ck {
505 #clock-cells = <0>;
506 compatible = "ti,composite-no-wait-gate-clock";
507 clocks = <&core_ck>;
508 ti,bit-shift = <7>;
509 reg = <0x0d70>;
510 };
511
512 clkout2_src_mux_ck: clkout2_src_mux_ck {
513 #clock-cells = <0>;
514 compatible = "ti,composite-mux-clock";
515 clocks = <&core_ck>, <&sys_ck>, <&cm_96m_fck>, <&omap_54m_fck>;
516 reg = <0x0d70>;
517 };
518
519 clkout2_src_ck: clkout2_src_ck {
520 #clock-cells = <0>;
521 compatible = "ti,composite-clock";
522 clocks = <&clkout2_src_gate_ck>, <&clkout2_src_mux_ck>;
523 };
524
525 sys_clkout2: sys_clkout2 {
526 #clock-cells = <0>;
527 compatible = "ti,divider-clock";
528 clocks = <&clkout2_src_ck>;
529 ti,bit-shift = <3>;
530 ti,max-div = <64>;
531 reg = <0x0d70>;
532 ti,index-power-of-two;
533 };
534
535 mpu_ck: mpu_ck {
536 #clock-cells = <0>;
537 compatible = "fixed-factor-clock";
538 clocks = <&dpll1_x2m2_ck>;
539 clock-mult = <1>;
540 clock-div = <1>;
541 };
542
543 arm_fck: arm_fck {
544 #clock-cells = <0>;
545 compatible = "ti,divider-clock";
546 clocks = <&mpu_ck>;
547 reg = <0x0924>;
548 ti,max-div = <2>;
549 };
550
551 emu_mpu_alwon_ck: emu_mpu_alwon_ck {
552 #clock-cells = <0>;
553 compatible = "fixed-factor-clock";
554 clocks = <&mpu_ck>;
555 clock-mult = <1>;
556 clock-div = <1>;
557 };
558
559 l3_ick: l3_ick {
560 #clock-cells = <0>;
561 compatible = "ti,divider-clock";
562 clocks = <&core_ck>;
563 ti,max-div = <3>;
564 reg = <0x0a40>;
565 ti,index-starts-at-one;
566 };
567
568 l4_ick: l4_ick {
569 #clock-cells = <0>;
570 compatible = "ti,divider-clock";
571 clocks = <&l3_ick>;
572 ti,bit-shift = <2>;
573 ti,max-div = <3>;
574 reg = <0x0a40>;
575 ti,index-starts-at-one;
576 };
577
578 rm_ick: rm_ick {
579 #clock-cells = <0>;
580 compatible = "ti,divider-clock";
581 clocks = <&l4_ick>;
582 ti,bit-shift = <1>;
583 ti,max-div = <3>;
584 reg = <0x0c40>;
585 ti,index-starts-at-one;
586 };
587
588 gpt10_gate_fck: gpt10_gate_fck {
589 #clock-cells = <0>;
590 compatible = "ti,composite-gate-clock";
591 clocks = <&sys_ck>;
592 ti,bit-shift = <11>;
593 reg = <0x0a00>;
594 };
595
596 gpt10_mux_fck: gpt10_mux_fck {
597 #clock-cells = <0>;
598 compatible = "ti,composite-mux-clock";
599 clocks = <&omap_32k_fck>, <&sys_ck>;
600 ti,bit-shift = <6>;
601 reg = <0x0a40>;
602 };
603
604 gpt10_fck: gpt10_fck {
605 #clock-cells = <0>;
606 compatible = "ti,composite-clock";
607 clocks = <&gpt10_gate_fck>, <&gpt10_mux_fck>;
608 };
609
610 gpt11_gate_fck: gpt11_gate_fck {
611 #clock-cells = <0>;
612 compatible = "ti,composite-gate-clock";
613 clocks = <&sys_ck>;
614 ti,bit-shift = <12>;
615 reg = <0x0a00>;
616 };
617
618 gpt11_mux_fck: gpt11_mux_fck {
619 #clock-cells = <0>;
620 compatible = "ti,composite-mux-clock";
621 clocks = <&omap_32k_fck>, <&sys_ck>;
622 ti,bit-shift = <7>;
623 reg = <0x0a40>;
624 };
625
626 gpt11_fck: gpt11_fck {
627 #clock-cells = <0>;
628 compatible = "ti,composite-clock";
629 clocks = <&gpt11_gate_fck>, <&gpt11_mux_fck>;
630 };
631
632 core_96m_fck: core_96m_fck {
633 #clock-cells = <0>;
634 compatible = "fixed-factor-clock";
635 clocks = <&omap_96m_fck>;
636 clock-mult = <1>;
637 clock-div = <1>;
638 };
639
640 mmchs2_fck: mmchs2_fck {
641 #clock-cells = <0>;
642 compatible = "ti,wait-gate-clock";
643 clocks = <&core_96m_fck>;
644 reg = <0x0a00>;
645 ti,bit-shift = <25>;
646 };
647
648 mmchs1_fck: mmchs1_fck {
649 #clock-cells = <0>;
650 compatible = "ti,wait-gate-clock";
651 clocks = <&core_96m_fck>;
652 reg = <0x0a00>;
653 ti,bit-shift = <24>;
654 };
655
656 i2c3_fck: i2c3_fck {
657 #clock-cells = <0>;
658 compatible = "ti,wait-gate-clock";
659 clocks = <&core_96m_fck>;
660 reg = <0x0a00>;
661 ti,bit-shift = <17>;
662 };
663
664 i2c2_fck: i2c2_fck {
665 #clock-cells = <0>;
666 compatible = "ti,wait-gate-clock";
667 clocks = <&core_96m_fck>;
668 reg = <0x0a00>;
669 ti,bit-shift = <16>;
670 };
671
672 i2c1_fck: i2c1_fck {
673 #clock-cells = <0>;
674 compatible = "ti,wait-gate-clock";
675 clocks = <&core_96m_fck>;
676 reg = <0x0a00>;
677 ti,bit-shift = <15>;
678 };
679
680 mcbsp5_gate_fck: mcbsp5_gate_fck {
681 #clock-cells = <0>;
682 compatible = "ti,composite-gate-clock";
683 clocks = <&mcbsp_clks>;
684 ti,bit-shift = <10>;
685 reg = <0x0a00>;
686 };
687
688 mcbsp1_gate_fck: mcbsp1_gate_fck {
689 #clock-cells = <0>;
690 compatible = "ti,composite-gate-clock";
691 clocks = <&mcbsp_clks>;
692 ti,bit-shift = <9>;
693 reg = <0x0a00>;
694 };
695
696 core_48m_fck: core_48m_fck {
697 #clock-cells = <0>;
698 compatible = "fixed-factor-clock";
699 clocks = <&omap_48m_fck>;
700 clock-mult = <1>;
701 clock-div = <1>;
702 };
703
704 mcspi4_fck: mcspi4_fck {
705 #clock-cells = <0>;
706 compatible = "ti,wait-gate-clock";
707 clocks = <&core_48m_fck>;
708 reg = <0x0a00>;
709 ti,bit-shift = <21>;
710 };
711
712 mcspi3_fck: mcspi3_fck {
713 #clock-cells = <0>;
714 compatible = "ti,wait-gate-clock";
715 clocks = <&core_48m_fck>;
716 reg = <0x0a00>;
717 ti,bit-shift = <20>;
718 };
719
720 mcspi2_fck: mcspi2_fck {
721 #clock-cells = <0>;
722 compatible = "ti,wait-gate-clock";
723 clocks = <&core_48m_fck>;
724 reg = <0x0a00>;
725 ti,bit-shift = <19>;
726 };
727
728 mcspi1_fck: mcspi1_fck {
729 #clock-cells = <0>;
730 compatible = "ti,wait-gate-clock";
731 clocks = <&core_48m_fck>;
732 reg = <0x0a00>;
733 ti,bit-shift = <18>;
734 };
735
736 uart2_fck: uart2_fck {
737 #clock-cells = <0>;
738 compatible = "ti,wait-gate-clock";
739 clocks = <&core_48m_fck>;
740 reg = <0x0a00>;
741 ti,bit-shift = <14>;
742 };
743
744 uart1_fck: uart1_fck {
745 #clock-cells = <0>;
746 compatible = "ti,wait-gate-clock";
747 clocks = <&core_48m_fck>;
748 reg = <0x0a00>;
749 ti,bit-shift = <13>;
750 };
751
752 core_12m_fck: core_12m_fck {
753 #clock-cells = <0>;
754 compatible = "fixed-factor-clock";
755 clocks = <&omap_12m_fck>;
756 clock-mult = <1>;
757 clock-div = <1>;
758 };
759
760 hdq_fck: hdq_fck {
761 #clock-cells = <0>;
762 compatible = "ti,wait-gate-clock";
763 clocks = <&core_12m_fck>;
764 reg = <0x0a00>;
765 ti,bit-shift = <22>;
766 };
767
768 core_l3_ick: core_l3_ick {
769 #clock-cells = <0>;
770 compatible = "fixed-factor-clock";
771 clocks = <&l3_ick>;
772 clock-mult = <1>;
773 clock-div = <1>;
774 };
775
776 sdrc_ick: sdrc_ick {
777 #clock-cells = <0>;
778 compatible = "ti,wait-gate-clock";
779 clocks = <&core_l3_ick>;
780 reg = <0x0a10>;
781 ti,bit-shift = <1>;
782 };
783
784 gpmc_fck: gpmc_fck {
785 #clock-cells = <0>;
786 compatible = "fixed-factor-clock";
787 clocks = <&core_l3_ick>;
788 clock-mult = <1>;
789 clock-div = <1>;
790 };
791
792 core_l4_ick: core_l4_ick {
793 #clock-cells = <0>;
794 compatible = "fixed-factor-clock";
795 clocks = <&l4_ick>;
796 clock-mult = <1>;
797 clock-div = <1>;
798 };
799
800 mmchs2_ick: mmchs2_ick {
801 #clock-cells = <0>;
802 compatible = "ti,omap3-interface-clock";
803 clocks = <&core_l4_ick>;
804 reg = <0x0a10>;
805 ti,bit-shift = <25>;
806 };
807
808 mmchs1_ick: mmchs1_ick {
809 #clock-cells = <0>;
810 compatible = "ti,omap3-interface-clock";
811 clocks = <&core_l4_ick>;
812 reg = <0x0a10>;
813 ti,bit-shift = <24>;
814 };
815
816 hdq_ick: hdq_ick {
817 #clock-cells = <0>;
818 compatible = "ti,omap3-interface-clock";
819 clocks = <&core_l4_ick>;
820 reg = <0x0a10>;
821 ti,bit-shift = <22>;
822 };
823
824 mcspi4_ick: mcspi4_ick {
825 #clock-cells = <0>;
826 compatible = "ti,omap3-interface-clock";
827 clocks = <&core_l4_ick>;
828 reg = <0x0a10>;
829 ti,bit-shift = <21>;
830 };
831
832 mcspi3_ick: mcspi3_ick {
833 #clock-cells = <0>;
834 compatible = "ti,omap3-interface-clock";
835 clocks = <&core_l4_ick>;
836 reg = <0x0a10>;
837 ti,bit-shift = <20>;
838 };
839
840 mcspi2_ick: mcspi2_ick {
841 #clock-cells = <0>;
842 compatible = "ti,omap3-interface-clock";
843 clocks = <&core_l4_ick>;
844 reg = <0x0a10>;
845 ti,bit-shift = <19>;
846 };
847
848 mcspi1_ick: mcspi1_ick {
849 #clock-cells = <0>;
850 compatible = "ti,omap3-interface-clock";
851 clocks = <&core_l4_ick>;
852 reg = <0x0a10>;
853 ti,bit-shift = <18>;
854 };
855
856 i2c3_ick: i2c3_ick {
857 #clock-cells = <0>;
858 compatible = "ti,omap3-interface-clock";
859 clocks = <&core_l4_ick>;
860 reg = <0x0a10>;
861 ti,bit-shift = <17>;
862 };
863
864 i2c2_ick: i2c2_ick {
865 #clock-cells = <0>;
866 compatible = "ti,omap3-interface-clock";
867 clocks = <&core_l4_ick>;
868 reg = <0x0a10>;
869 ti,bit-shift = <16>;
870 };
871
872 i2c1_ick: i2c1_ick {
873 #clock-cells = <0>;
874 compatible = "ti,omap3-interface-clock";
875 clocks = <&core_l4_ick>;
876 reg = <0x0a10>;
877 ti,bit-shift = <15>;
878 };
879
880 uart2_ick: uart2_ick {
881 #clock-cells = <0>;
882 compatible = "ti,omap3-interface-clock";
883 clocks = <&core_l4_ick>;
884 reg = <0x0a10>;
885 ti,bit-shift = <14>;
886 };
887
888 uart1_ick: uart1_ick {
889 #clock-cells = <0>;
890 compatible = "ti,omap3-interface-clock";
891 clocks = <&core_l4_ick>;
892 reg = <0x0a10>;
893 ti,bit-shift = <13>;
894 };
895
896 gpt11_ick: gpt11_ick {
897 #clock-cells = <0>;
898 compatible = "ti,omap3-interface-clock";
899 clocks = <&core_l4_ick>;
900 reg = <0x0a10>;
901 ti,bit-shift = <12>;
902 };
903
904 gpt10_ick: gpt10_ick {
905 #clock-cells = <0>;
906 compatible = "ti,omap3-interface-clock";
907 clocks = <&core_l4_ick>;
908 reg = <0x0a10>;
909 ti,bit-shift = <11>;
910 };
911
912 mcbsp5_ick: mcbsp5_ick {
913 #clock-cells = <0>;
914 compatible = "ti,omap3-interface-clock";
915 clocks = <&core_l4_ick>;
916 reg = <0x0a10>;
917 ti,bit-shift = <10>;
918 };
919
920 mcbsp1_ick: mcbsp1_ick {
921 #clock-cells = <0>;
922 compatible = "ti,omap3-interface-clock";
923 clocks = <&core_l4_ick>;
924 reg = <0x0a10>;
925 ti,bit-shift = <9>;
926 };
927
928 omapctrl_ick: omapctrl_ick {
929 #clock-cells = <0>;
930 compatible = "ti,omap3-interface-clock";
931 clocks = <&core_l4_ick>;
932 reg = <0x0a10>;
933 ti,bit-shift = <6>;
934 };
935
936 dss_tv_fck: dss_tv_fck {
937 #clock-cells = <0>;
938 compatible = "ti,gate-clock";
939 clocks = <&omap_54m_fck>;
940 reg = <0x0e00>;
941 ti,bit-shift = <2>;
942 };
943
944 dss_96m_fck: dss_96m_fck {
945 #clock-cells = <0>;
946 compatible = "ti,gate-clock";
947 clocks = <&omap_96m_fck>;
948 reg = <0x0e00>;
949 ti,bit-shift = <2>;
950 };
951
952 dss2_alwon_fck: dss2_alwon_fck {
953 #clock-cells = <0>;
954 compatible = "ti,gate-clock";
955 clocks = <&sys_ck>;
956 reg = <0x0e00>;
957 ti,bit-shift = <1>;
958 };
959
960 dummy_ck: dummy_ck {
961 #clock-cells = <0>;
962 compatible = "fixed-clock";
963 clock-frequency = <0>;
964 };
965
966 gpt1_gate_fck: gpt1_gate_fck {
967 #clock-cells = <0>;
968 compatible = "ti,composite-gate-clock";
969 clocks = <&sys_ck>;
970 ti,bit-shift = <0>;
971 reg = <0x0c00>;
972 };
973
974 gpt1_mux_fck: gpt1_mux_fck {
975 #clock-cells = <0>;
976 compatible = "ti,composite-mux-clock";
977 clocks = <&omap_32k_fck>, <&sys_ck>;
978 reg = <0x0c40>;
979 };
980
981 gpt1_fck: gpt1_fck {
982 #clock-cells = <0>;
983 compatible = "ti,composite-clock";
984 clocks = <&gpt1_gate_fck>, <&gpt1_mux_fck>;
985 };
986
987 aes2_ick: aes2_ick {
988 #clock-cells = <0>;
989 compatible = "ti,omap3-interface-clock";
990 clocks = <&core_l4_ick>;
991 ti,bit-shift = <28>;
992 reg = <0x0a10>;
993 };
994
995 wkup_32k_fck: wkup_32k_fck {
996 #clock-cells = <0>;
997 compatible = "fixed-factor-clock";
998 clocks = <&omap_32k_fck>;
999 clock-mult = <1>;
1000 clock-div = <1>;
1001 };
1002
1003 gpio1_dbck: gpio1_dbck {
1004 #clock-cells = <0>;
1005 compatible = "ti,gate-clock";
1006 clocks = <&wkup_32k_fck>;
1007 reg = <0x0c00>;
1008 ti,bit-shift = <3>;
1009 };
1010
1011 sha12_ick: sha12_ick {
1012 #clock-cells = <0>;
1013 compatible = "ti,omap3-interface-clock";
1014 clocks = <&core_l4_ick>;
1015 reg = <0x0a10>;
1016 ti,bit-shift = <27>;
1017 };
1018
1019 wdt2_fck: wdt2_fck {
1020 #clock-cells = <0>;
1021 compatible = "ti,wait-gate-clock";
1022 clocks = <&wkup_32k_fck>;
1023 reg = <0x0c00>;
1024 ti,bit-shift = <5>;
1025 };
1026
1027 wdt2_ick: wdt2_ick {
1028 #clock-cells = <0>;
1029 compatible = "ti,omap3-interface-clock";
1030 clocks = <&wkup_l4_ick>;
1031 reg = <0x0c10>;
1032 ti,bit-shift = <5>;
1033 };
1034
1035 wdt1_ick: wdt1_ick {
1036 #clock-cells = <0>;
1037 compatible = "ti,omap3-interface-clock";
1038 clocks = <&wkup_l4_ick>;
1039 reg = <0x0c10>;
1040 ti,bit-shift = <4>;
1041 };
1042
1043 gpio1_ick: gpio1_ick {
1044 #clock-cells = <0>;
1045 compatible = "ti,omap3-interface-clock";
1046 clocks = <&wkup_l4_ick>;
1047 reg = <0x0c10>;
1048 ti,bit-shift = <3>;
1049 };
1050
1051 omap_32ksync_ick: omap_32ksync_ick {
1052 #clock-cells = <0>;
1053 compatible = "ti,omap3-interface-clock";
1054 clocks = <&wkup_l4_ick>;
1055 reg = <0x0c10>;
1056 ti,bit-shift = <2>;
1057 };
1058
1059 gpt12_ick: gpt12_ick {
1060 #clock-cells = <0>;
1061 compatible = "ti,omap3-interface-clock";
1062 clocks = <&wkup_l4_ick>;
1063 reg = <0x0c10>;
1064 ti,bit-shift = <1>;
1065 };
1066
1067 gpt1_ick: gpt1_ick {
1068 #clock-cells = <0>;
1069 compatible = "ti,omap3-interface-clock";
1070 clocks = <&wkup_l4_ick>;
1071 reg = <0x0c10>;
1072 ti,bit-shift = <0>;
1073 };
1074
1075 per_96m_fck: per_96m_fck {
1076 #clock-cells = <0>;
1077 compatible = "fixed-factor-clock";
1078 clocks = <&omap_96m_alwon_fck>;
1079 clock-mult = <1>;
1080 clock-div = <1>;
1081 };
1082
1083 per_48m_fck: per_48m_fck {
1084 #clock-cells = <0>;
1085 compatible = "fixed-factor-clock";
1086 clocks = <&omap_48m_fck>;
1087 clock-mult = <1>;
1088 clock-div = <1>;
1089 };
1090
1091 uart3_fck: uart3_fck {
1092 #clock-cells = <0>;
1093 compatible = "ti,wait-gate-clock";
1094 clocks = <&per_48m_fck>;
1095 reg = <0x1000>;
1096 ti,bit-shift = <11>;
1097 };
1098
1099 gpt2_gate_fck: gpt2_gate_fck {
1100 #clock-cells = <0>;
1101 compatible = "ti,composite-gate-clock";
1102 clocks = <&sys_ck>;
1103 ti,bit-shift = <3>;
1104 reg = <0x1000>;
1105 };
1106
1107 gpt2_mux_fck: gpt2_mux_fck {
1108 #clock-cells = <0>;
1109 compatible = "ti,composite-mux-clock";
1110 clocks = <&omap_32k_fck>, <&sys_ck>;
1111 reg = <0x1040>;
1112 };
1113
1114 gpt2_fck: gpt2_fck {
1115 #clock-cells = <0>;
1116 compatible = "ti,composite-clock";
1117 clocks = <&gpt2_gate_fck>, <&gpt2_mux_fck>;
1118 };
1119
1120 gpt3_gate_fck: gpt3_gate_fck {
1121 #clock-cells = <0>;
1122 compatible = "ti,composite-gate-clock";
1123 clocks = <&sys_ck>;
1124 ti,bit-shift = <4>;
1125 reg = <0x1000>;
1126 };
1127
1128 gpt3_mux_fck: gpt3_mux_fck {
1129 #clock-cells = <0>;
1130 compatible = "ti,composite-mux-clock";
1131 clocks = <&omap_32k_fck>, <&sys_ck>;
1132 ti,bit-shift = <1>;
1133 reg = <0x1040>;
1134 };
1135
1136 gpt3_fck: gpt3_fck {
1137 #clock-cells = <0>;
1138 compatible = "ti,composite-clock";
1139 clocks = <&gpt3_gate_fck>, <&gpt3_mux_fck>;
1140 };
1141
1142 gpt4_gate_fck: gpt4_gate_fck {
1143 #clock-cells = <0>;
1144 compatible = "ti,composite-gate-clock";
1145 clocks = <&sys_ck>;
1146 ti,bit-shift = <5>;
1147 reg = <0x1000>;
1148 };
1149
1150 gpt4_mux_fck: gpt4_mux_fck {
1151 #clock-cells = <0>;
1152 compatible = "ti,composite-mux-clock";
1153 clocks = <&omap_32k_fck>, <&sys_ck>;
1154 ti,bit-shift = <2>;
1155 reg = <0x1040>;
1156 };
1157
1158 gpt4_fck: gpt4_fck {
1159 #clock-cells = <0>;
1160 compatible = "ti,composite-clock";
1161 clocks = <&gpt4_gate_fck>, <&gpt4_mux_fck>;
1162 };
1163
1164 gpt5_gate_fck: gpt5_gate_fck {
1165 #clock-cells = <0>;
1166 compatible = "ti,composite-gate-clock";
1167 clocks = <&sys_ck>;
1168 ti,bit-shift = <6>;
1169 reg = <0x1000>;
1170 };
1171
1172 gpt5_mux_fck: gpt5_mux_fck {
1173 #clock-cells = <0>;
1174 compatible = "ti,composite-mux-clock";
1175 clocks = <&omap_32k_fck>, <&sys_ck>;
1176 ti,bit-shift = <3>;
1177 reg = <0x1040>;
1178 };
1179
1180 gpt5_fck: gpt5_fck {
1181 #clock-cells = <0>;
1182 compatible = "ti,composite-clock";
1183 clocks = <&gpt5_gate_fck>, <&gpt5_mux_fck>;
1184 };
1185
1186 gpt6_gate_fck: gpt6_gate_fck {
1187 #clock-cells = <0>;
1188 compatible = "ti,composite-gate-clock";
1189 clocks = <&sys_ck>;
1190 ti,bit-shift = <7>;
1191 reg = <0x1000>;
1192 };
1193
1194 gpt6_mux_fck: gpt6_mux_fck {
1195 #clock-cells = <0>;
1196 compatible = "ti,composite-mux-clock";
1197 clocks = <&omap_32k_fck>, <&sys_ck>;
1198 ti,bit-shift = <4>;
1199 reg = <0x1040>;
1200 };
1201
1202 gpt6_fck: gpt6_fck {
1203 #clock-cells = <0>;
1204 compatible = "ti,composite-clock";
1205 clocks = <&gpt6_gate_fck>, <&gpt6_mux_fck>;
1206 };
1207
1208 gpt7_gate_fck: gpt7_gate_fck {
1209 #clock-cells = <0>;
1210 compatible = "ti,composite-gate-clock";
1211 clocks = <&sys_ck>;
1212 ti,bit-shift = <8>;
1213 reg = <0x1000>;
1214 };
1215
1216 gpt7_mux_fck: gpt7_mux_fck {
1217 #clock-cells = <0>;
1218 compatible = "ti,composite-mux-clock";
1219 clocks = <&omap_32k_fck>, <&sys_ck>;
1220 ti,bit-shift = <5>;
1221 reg = <0x1040>;
1222 };
1223
1224 gpt7_fck: gpt7_fck {
1225 #clock-cells = <0>;
1226 compatible = "ti,composite-clock";
1227 clocks = <&gpt7_gate_fck>, <&gpt7_mux_fck>;
1228 };
1229
1230 gpt8_gate_fck: gpt8_gate_fck {
1231 #clock-cells = <0>;
1232 compatible = "ti,composite-gate-clock";
1233 clocks = <&sys_ck>;
1234 ti,bit-shift = <9>;
1235 reg = <0x1000>;
1236 };
1237
1238 gpt8_mux_fck: gpt8_mux_fck {
1239 #clock-cells = <0>;
1240 compatible = "ti,composite-mux-clock";
1241 clocks = <&omap_32k_fck>, <&sys_ck>;
1242 ti,bit-shift = <6>;
1243 reg = <0x1040>;
1244 };
1245
1246 gpt8_fck: gpt8_fck {
1247 #clock-cells = <0>;
1248 compatible = "ti,composite-clock";
1249 clocks = <&gpt8_gate_fck>, <&gpt8_mux_fck>;
1250 };
1251
1252 gpt9_gate_fck: gpt9_gate_fck {
1253 #clock-cells = <0>;
1254 compatible = "ti,composite-gate-clock";
1255 clocks = <&sys_ck>;
1256 ti,bit-shift = <10>;
1257 reg = <0x1000>;
1258 };
1259
1260 gpt9_mux_fck: gpt9_mux_fck {
1261 #clock-cells = <0>;
1262 compatible = "ti,composite-mux-clock";
1263 clocks = <&omap_32k_fck>, <&sys_ck>;
1264 ti,bit-shift = <7>;
1265 reg = <0x1040>;
1266 };
1267
1268 gpt9_fck: gpt9_fck {
1269 #clock-cells = <0>;
1270 compatible = "ti,composite-clock";
1271 clocks = <&gpt9_gate_fck>, <&gpt9_mux_fck>;
1272 };
1273
1274 per_32k_alwon_fck: per_32k_alwon_fck {
1275 #clock-cells = <0>;
1276 compatible = "fixed-factor-clock";
1277 clocks = <&omap_32k_fck>;
1278 clock-mult = <1>;
1279 clock-div = <1>;
1280 };
1281
1282 gpio6_dbck: gpio6_dbck {
1283 #clock-cells = <0>;
1284 compatible = "ti,gate-clock";
1285 clocks = <&per_32k_alwon_fck>;
1286 reg = <0x1000>;
1287 ti,bit-shift = <17>;
1288 };
1289
1290 gpio5_dbck: gpio5_dbck {
1291 #clock-cells = <0>;
1292 compatible = "ti,gate-clock";
1293 clocks = <&per_32k_alwon_fck>;
1294 reg = <0x1000>;
1295 ti,bit-shift = <16>;
1296 };
1297
1298 gpio4_dbck: gpio4_dbck {
1299 #clock-cells = <0>;
1300 compatible = "ti,gate-clock";
1301 clocks = <&per_32k_alwon_fck>;
1302 reg = <0x1000>;
1303 ti,bit-shift = <15>;
1304 };
1305
1306 gpio3_dbck: gpio3_dbck {
1307 #clock-cells = <0>;
1308 compatible = "ti,gate-clock";
1309 clocks = <&per_32k_alwon_fck>;
1310 reg = <0x1000>;
1311 ti,bit-shift = <14>;
1312 };
1313
1314 gpio2_dbck: gpio2_dbck {
1315 #clock-cells = <0>;
1316 compatible = "ti,gate-clock";
1317 clocks = <&per_32k_alwon_fck>;
1318 reg = <0x1000>;
1319 ti,bit-shift = <13>;
1320 };
1321
1322 wdt3_fck: wdt3_fck {
1323 #clock-cells = <0>;
1324 compatible = "ti,wait-gate-clock";
1325 clocks = <&per_32k_alwon_fck>;
1326 reg = <0x1000>;
1327 ti,bit-shift = <12>;
1328 };
1329
1330 per_l4_ick: per_l4_ick {
1331 #clock-cells = <0>;
1332 compatible = "fixed-factor-clock";
1333 clocks = <&l4_ick>;
1334 clock-mult = <1>;
1335 clock-div = <1>;
1336 };
1337
1338 gpio6_ick: gpio6_ick {
1339 #clock-cells = <0>;
1340 compatible = "ti,omap3-interface-clock";
1341 clocks = <&per_l4_ick>;
1342 reg = <0x1010>;
1343 ti,bit-shift = <17>;
1344 };
1345
1346 gpio5_ick: gpio5_ick {
1347 #clock-cells = <0>;
1348 compatible = "ti,omap3-interface-clock";
1349 clocks = <&per_l4_ick>;
1350 reg = <0x1010>;
1351 ti,bit-shift = <16>;
1352 };
1353
1354 gpio4_ick: gpio4_ick {
1355 #clock-cells = <0>;
1356 compatible = "ti,omap3-interface-clock";
1357 clocks = <&per_l4_ick>;
1358 reg = <0x1010>;
1359 ti,bit-shift = <15>;
1360 };
1361
1362 gpio3_ick: gpio3_ick {
1363 #clock-cells = <0>;
1364 compatible = "ti,omap3-interface-clock";
1365 clocks = <&per_l4_ick>;
1366 reg = <0x1010>;
1367 ti,bit-shift = <14>;
1368 };
1369
1370 gpio2_ick: gpio2_ick {
1371 #clock-cells = <0>;
1372 compatible = "ti,omap3-interface-clock";
1373 clocks = <&per_l4_ick>;
1374 reg = <0x1010>;
1375 ti,bit-shift = <13>;
1376 };
1377
1378 wdt3_ick: wdt3_ick {
1379 #clock-cells = <0>;
1380 compatible = "ti,omap3-interface-clock";
1381 clocks = <&per_l4_ick>;
1382 reg = <0x1010>;
1383 ti,bit-shift = <12>;
1384 };
1385
1386 uart3_ick: uart3_ick {
1387 #clock-cells = <0>;
1388 compatible = "ti,omap3-interface-clock";
1389 clocks = <&per_l4_ick>;
1390 reg = <0x1010>;
1391 ti,bit-shift = <11>;
1392 };
1393
1394 uart4_ick: uart4_ick {
1395 #clock-cells = <0>;
1396 compatible = "ti,omap3-interface-clock";
1397 clocks = <&per_l4_ick>;
1398 reg = <0x1010>;
1399 ti,bit-shift = <18>;
1400 };
1401
1402 gpt9_ick: gpt9_ick {
1403 #clock-cells = <0>;
1404 compatible = "ti,omap3-interface-clock";
1405 clocks = <&per_l4_ick>;
1406 reg = <0x1010>;
1407 ti,bit-shift = <10>;
1408 };
1409
1410 gpt8_ick: gpt8_ick {
1411 #clock-cells = <0>;
1412 compatible = "ti,omap3-interface-clock";
1413 clocks = <&per_l4_ick>;
1414 reg = <0x1010>;
1415 ti,bit-shift = <9>;
1416 };
1417
1418 gpt7_ick: gpt7_ick {
1419 #clock-cells = <0>;
1420 compatible = "ti,omap3-interface-clock";
1421 clocks = <&per_l4_ick>;
1422 reg = <0x1010>;
1423 ti,bit-shift = <8>;
1424 };
1425
1426 gpt6_ick: gpt6_ick {
1427 #clock-cells = <0>;
1428 compatible = "ti,omap3-interface-clock";
1429 clocks = <&per_l4_ick>;
1430 reg = <0x1010>;
1431 ti,bit-shift = <7>;
1432 };
1433
1434 gpt5_ick: gpt5_ick {
1435 #clock-cells = <0>;
1436 compatible = "ti,omap3-interface-clock";
1437 clocks = <&per_l4_ick>;
1438 reg = <0x1010>;
1439 ti,bit-shift = <6>;
1440 };
1441
1442 gpt4_ick: gpt4_ick {
1443 #clock-cells = <0>;
1444 compatible = "ti,omap3-interface-clock";
1445 clocks = <&per_l4_ick>;
1446 reg = <0x1010>;
1447 ti,bit-shift = <5>;
1448 };
1449
1450 gpt3_ick: gpt3_ick {
1451 #clock-cells = <0>;
1452 compatible = "ti,omap3-interface-clock";
1453 clocks = <&per_l4_ick>;
1454 reg = <0x1010>;
1455 ti,bit-shift = <4>;
1456 };
1457
1458 gpt2_ick: gpt2_ick {
1459 #clock-cells = <0>;
1460 compatible = "ti,omap3-interface-clock";
1461 clocks = <&per_l4_ick>;
1462 reg = <0x1010>;
1463 ti,bit-shift = <3>;
1464 };
1465
1466 mcbsp2_ick: mcbsp2_ick {
1467 #clock-cells = <0>;
1468 compatible = "ti,omap3-interface-clock";
1469 clocks = <&per_l4_ick>;
1470 reg = <0x1010>;
1471 ti,bit-shift = <0>;
1472 };
1473
1474 mcbsp3_ick: mcbsp3_ick {
1475 #clock-cells = <0>;
1476 compatible = "ti,omap3-interface-clock";
1477 clocks = <&per_l4_ick>;
1478 reg = <0x1010>;
1479 ti,bit-shift = <1>;
1480 };
1481
1482 mcbsp4_ick: mcbsp4_ick {
1483 #clock-cells = <0>;
1484 compatible = "ti,omap3-interface-clock";
1485 clocks = <&per_l4_ick>;
1486 reg = <0x1010>;
1487 ti,bit-shift = <2>;
1488 };
1489
1490 mcbsp2_gate_fck: mcbsp2_gate_fck {
1491 #clock-cells = <0>;
1492 compatible = "ti,composite-gate-clock";
1493 clocks = <&mcbsp_clks>;
1494 ti,bit-shift = <0>;
1495 reg = <0x1000>;
1496 };
1497
1498 mcbsp3_gate_fck: mcbsp3_gate_fck {
1499 #clock-cells = <0>;
1500 compatible = "ti,composite-gate-clock";
1501 clocks = <&mcbsp_clks>;
1502 ti,bit-shift = <1>;
1503 reg = <0x1000>;
1504 };
1505
1506 mcbsp4_gate_fck: mcbsp4_gate_fck {
1507 #clock-cells = <0>;
1508 compatible = "ti,composite-gate-clock";
1509 clocks = <&mcbsp_clks>;
1510 ti,bit-shift = <2>;
1511 reg = <0x1000>;
1512 };
1513
1514 emu_src_mux_ck: emu_src_mux_ck {
1515 #clock-cells = <0>;
1516 compatible = "ti,mux-clock";
1517 clocks = <&sys_ck>, <&emu_core_alwon_ck>, <&emu_per_alwon_ck>, <&emu_mpu_alwon_ck>;
1518 reg = <0x1140>;
1519 };
1520
1521 emu_src_ck: emu_src_ck {
1522 #clock-cells = <0>;
1523 compatible = "ti,clkdm-gate-clock";
1524 clocks = <&emu_src_mux_ck>;
1525 };
1526
1527 pclk_fck: pclk_fck {
1528 #clock-cells = <0>;
1529 compatible = "ti,divider-clock";
1530 clocks = <&emu_src_ck>;
1531 ti,bit-shift = <8>;
1532 ti,max-div = <7>;
1533 reg = <0x1140>;
1534 ti,index-starts-at-one;
1535 };
1536
1537 pclkx2_fck: pclkx2_fck {
1538 #clock-cells = <0>;
1539 compatible = "ti,divider-clock";
1540 clocks = <&emu_src_ck>;
1541 ti,bit-shift = <6>;
1542 ti,max-div = <3>;
1543 reg = <0x1140>;
1544 ti,index-starts-at-one;
1545 };
1546
1547 atclk_fck: atclk_fck {
1548 #clock-cells = <0>;
1549 compatible = "ti,divider-clock";
1550 clocks = <&emu_src_ck>;
1551 ti,bit-shift = <4>;
1552 ti,max-div = <3>;
1553 reg = <0x1140>;
1554 ti,index-starts-at-one;
1555 };
1556
1557 traceclk_src_fck: traceclk_src_fck {
1558 #clock-cells = <0>;
1559 compatible = "ti,mux-clock";
1560 clocks = <&sys_ck>, <&emu_core_alwon_ck>, <&emu_per_alwon_ck>, <&emu_mpu_alwon_ck>;
1561 ti,bit-shift = <2>;
1562 reg = <0x1140>;
1563 };
1564
1565 traceclk_fck: traceclk_fck {
1566 #clock-cells = <0>;
1567 compatible = "ti,divider-clock";
1568 clocks = <&traceclk_src_fck>;
1569 ti,bit-shift = <11>;
1570 ti,max-div = <7>;
1571 reg = <0x1140>;
1572 ti,index-starts-at-one;
1573 };
1574
1575 secure_32k_fck: secure_32k_fck {
1576 #clock-cells = <0>;
1577 compatible = "fixed-clock";
1578 clock-frequency = <32768>;
1579 };
1580
1581 gpt12_fck: gpt12_fck {
1582 #clock-cells = <0>;
1583 compatible = "fixed-factor-clock";
1584 clocks = <&secure_32k_fck>;
1585 clock-mult = <1>;
1586 clock-div = <1>;
1587 };
1588
1589 wdt1_fck: wdt1_fck {
1590 #clock-cells = <0>;
1591 compatible = "fixed-factor-clock";
1592 clocks = <&secure_32k_fck>;
1593 clock-mult = <1>;
1594 clock-div = <1>;
1595 };
1596};
1597
1598&cm_clockdomains {
1599 core_l3_clkdm: core_l3_clkdm {
1600 compatible = "ti,clockdomain";
1601 clocks = <&sdrc_ick>;
1602 };
1603
1604 dpll3_clkdm: dpll3_clkdm {
1605 compatible = "ti,clockdomain";
1606 clocks = <&dpll3_ck>;
1607 };
1608
1609 dpll1_clkdm: dpll1_clkdm {
1610 compatible = "ti,clockdomain";
1611 clocks = <&dpll1_ck>;
1612 };
1613
1614 per_clkdm: per_clkdm {
1615 compatible = "ti,clockdomain";
1616 clocks = <&uart3_fck>, <&gpio6_dbck>, <&gpio5_dbck>,
1617 <&gpio4_dbck>, <&gpio3_dbck>, <&gpio2_dbck>,
1618 <&wdt3_fck>, <&gpio6_ick>, <&gpio5_ick>, <&gpio4_ick>,
1619 <&gpio3_ick>, <&gpio2_ick>, <&wdt3_ick>, <&uart3_ick>,
1620 <&uart4_ick>, <&gpt9_ick>, <&gpt8_ick>, <&gpt7_ick>,
1621 <&gpt6_ick>, <&gpt5_ick>, <&gpt4_ick>, <&gpt3_ick>,
1622 <&gpt2_ick>, <&mcbsp2_ick>, <&mcbsp3_ick>,
1623 <&mcbsp4_ick>;
1624 };
1625
1626 emu_clkdm: emu_clkdm {
1627 compatible = "ti,clockdomain";
1628 clocks = <&emu_src_ck>;
1629 };
1630
1631 dpll4_clkdm: dpll4_clkdm {
1632 compatible = "ti,clockdomain";
1633 clocks = <&dpll4_ck>;
1634 };
1635
1636 wkup_clkdm: wkup_clkdm {
1637 compatible = "ti,clockdomain";
1638 clocks = <&gpio1_dbck>, <&wdt2_fck>, <&wdt2_ick>, <&wdt1_ick>,
1639 <&gpio1_ick>, <&omap_32ksync_ick>, <&gpt12_ick>,
1640 <&gpt1_ick>;
1641 };
1642
1643 dss_clkdm: dss_clkdm {
1644 compatible = "ti,clockdomain";
1645 clocks = <&dss_tv_fck>, <&dss_96m_fck>, <&dss2_alwon_fck>;
1646 };
1647
1648 core_l4_clkdm: core_l4_clkdm {
1649 compatible = "ti,clockdomain";
1650 clocks = <&mmchs2_fck>, <&mmchs1_fck>, <&i2c3_fck>, <&i2c2_fck>,
1651 <&i2c1_fck>, <&mcspi4_fck>, <&mcspi3_fck>,
1652 <&mcspi2_fck>, <&mcspi1_fck>, <&uart2_fck>,
1653 <&uart1_fck>, <&hdq_fck>, <&mmchs2_ick>, <&mmchs1_ick>,
1654 <&hdq_ick>, <&mcspi4_ick>, <&mcspi3_ick>,
1655 <&mcspi2_ick>, <&mcspi1_ick>, <&i2c3_ick>, <&i2c2_ick>,
1656 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
1657 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
1658 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>;
1659 };
1660};
diff --git a/arch/arm/boot/dts/omap4-cpu-thermal.dtsi b/arch/arm/boot/dts/omap4-cpu-thermal.dtsi
new file mode 100644
index 000000000000..cb9458feb2e3
--- /dev/null
+++ b/arch/arm/boot/dts/omap4-cpu-thermal.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Device Tree Source for OMAP4/5 SoC CPU thermal
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 * Contact: Eduardo Valentin <eduardo.valentin@ti.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#include <dt-bindings/thermal/thermal.h>
13
14cpu_thermal: cpu_thermal {
15 polling-delay-passive = <250>; /* milliseconds */
16 polling-delay = <1000>; /* milliseconds */
17
18 /* sensor ID */
19 thermal-sensors = <&bandgap 0>;
20
21 trips {
22 cpu_alert0: cpu_alert {
23 temperature = <100000>; /* millicelsius */
24 hysteresis = <2000>; /* millicelsius */
25 type = "passive";
26 };
27 cpu_crit: cpu_crit {
28 temperature = <125000>; /* millicelsius */
29 hysteresis = <2000>; /* millicelsius */
30 type = "critical";
31 };
32 };
33
34 cooling-maps {
35 map0 {
36 trip = <&cpu_alert0>;
37 cooling-device =
38 <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
39 };
40 };
41};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index a1e05853afcd..d3f8a6e8ca20 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -107,6 +107,58 @@
107 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, 107 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
108 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; 108 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
109 109
110 cm1: cm1@4a004000 {
111 compatible = "ti,omap4-cm1";
112 reg = <0x4a004000 0x2000>;
113
114 cm1_clocks: clocks {
115 #address-cells = <1>;
116 #size-cells = <0>;
117 };
118
119 cm1_clockdomains: clockdomains {
120 };
121 };
122
123 prm: prm@4a306000 {
124 compatible = "ti,omap4-prm";
125 reg = <0x4a306000 0x3000>;
126
127 prm_clocks: clocks {
128 #address-cells = <1>;
129 #size-cells = <0>;
130 };
131
132 prm_clockdomains: clockdomains {
133 };
134 };
135
136 cm2: cm2@4a008000 {
137 compatible = "ti,omap4-cm2";
138 reg = <0x4a008000 0x3000>;
139
140 cm2_clocks: clocks {
141 #address-cells = <1>;
142 #size-cells = <0>;
143 };
144
145 cm2_clockdomains: clockdomains {
146 };
147 };
148
149 scrm: scrm@4a30a000 {
150 compatible = "ti,omap4-scrm";
151 reg = <0x4a30a000 0x2000>;
152
153 scrm_clocks: clocks {
154 #address-cells = <1>;
155 #size-cells = <0>;
156 };
157
158 scrm_clockdomains: clockdomains {
159 };
160 };
161
110 counter32k: counter@4a304000 { 162 counter32k: counter@4a304000 {
111 compatible = "ti,omap-counter32k"; 163 compatible = "ti,omap-counter32k";
112 reg = <0x4a304000 0x20>; 164 reg = <0x4a304000 0x20>;
@@ -707,3 +759,5 @@
707 }; 759 };
708 }; 760 };
709}; 761};
762
763/include/ "omap44xx-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap443x-clocks.dtsi b/arch/arm/boot/dts/omap443x-clocks.dtsi
new file mode 100644
index 000000000000..2bd2166f88d3
--- /dev/null
+++ b/arch/arm/boot/dts/omap443x-clocks.dtsi
@@ -0,0 +1,18 @@
1/*
2 * Device Tree Source for OMAP4 clock data
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&prm_clocks {
11 bandgap_fclk: bandgap_fclk {
12 #clock-cells = <0>;
13 compatible = "ti,gate-clock";
14 clocks = <&sys_32k_ck>;
15 ti,bit-shift = <8>;
16 reg = <0x1888>;
17 };
18};
diff --git a/arch/arm/boot/dts/omap443x.dtsi b/arch/arm/boot/dts/omap443x.dtsi
index bcf455efe18d..8c1cfad30d60 100644
--- a/arch/arm/boot/dts/omap443x.dtsi
+++ b/arch/arm/boot/dts/omap443x.dtsi
@@ -12,7 +12,7 @@
12 12
13/ { 13/ {
14 cpus { 14 cpus {
15 cpu@0 { 15 cpu0: cpu@0 {
16 /* OMAP443x variants OPP50-OPPNT */ 16 /* OMAP443x variants OPP50-OPPNT */
17 operating-points = < 17 operating-points = <
18 /* kHz uV */ 18 /* kHz uV */
@@ -22,12 +22,27 @@
22 1008000 1375000 22 1008000 1375000
23 >; 23 >;
24 clock-latency = <300000>; /* From legacy driver */ 24 clock-latency = <300000>; /* From legacy driver */
25
26 /* cooling options */
27 cooling-min-level = <0>;
28 cooling-max-level = <3>;
29 #cooling-cells = <2>; /* min followed by max */
25 }; 30 };
26 }; 31 };
27 32
28 bandgap { 33 thermal-zones {
29 reg = <0x4a002260 0x4 34 #include "omap4-cpu-thermal.dtsi"
30 0x4a00232C 0x4>; 35 };
31 compatible = "ti,omap4430-bandgap"; 36
37 ocp {
38 bandgap: bandgap {
39 reg = <0x4a002260 0x4
40 0x4a00232C 0x4>;
41 compatible = "ti,omap4430-bandgap";
42
43 #thermal-sensor-cells = <0>;
44 };
32 }; 45 };
33}; 46};
47
48/include/ "omap443x-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap4460.dtsi b/arch/arm/boot/dts/omap4460.dtsi
index c2f0f39b5a24..6b32f520741a 100644
--- a/arch/arm/boot/dts/omap4460.dtsi
+++ b/arch/arm/boot/dts/omap4460.dtsi
@@ -12,7 +12,7 @@
12/ { 12/ {
13 cpus { 13 cpus {
14 /* OMAP446x 'standard device' variants OPP50 to OPPTurbo */ 14 /* OMAP446x 'standard device' variants OPP50 to OPPTurbo */
15 cpu@0 { 15 cpu0: cpu@0 {
16 operating-points = < 16 operating-points = <
17 /* kHz uV */ 17 /* kHz uV */
18 350000 1025000 18 350000 1025000
@@ -20,6 +20,11 @@
20 920000 1313000 20 920000 1313000
21 >; 21 >;
22 clock-latency = <300000>; /* From legacy driver */ 22 clock-latency = <300000>; /* From legacy driver */
23
24 /* cooling options */
25 cooling-min-level = <0>;
26 cooling-max-level = <2>;
27 #cooling-cells = <2>; /* min followed by max */
23 }; 28 };
24 }; 29 };
25 30
@@ -30,12 +35,22 @@
30 ti,hwmods = "debugss"; 35 ti,hwmods = "debugss";
31 }; 36 };
32 37
33 bandgap { 38 thermal-zones {
34 reg = <0x4a002260 0x4 39 #include "omap4-cpu-thermal.dtsi"
35 0x4a00232C 0x4 40 };
36 0x4a002378 0x18>; 41
37 compatible = "ti,omap4460-bandgap"; 42 ocp {
38 interrupts = <0 126 IRQ_TYPE_LEVEL_HIGH>; /* talert */ 43 bandgap: bandgap {
39 gpios = <&gpio3 22 0>; /* tshut */ 44 reg = <0x4a002260 0x4
45 0x4a00232C 0x4
46 0x4a002378 0x18>;
47 compatible = "ti,omap4460-bandgap";
48 interrupts = <0 126 IRQ_TYPE_LEVEL_HIGH>; /* talert */
49 gpios = <&gpio3 22 0>; /* tshut */
50
51 #thermal-sensor-cells = <0>;
52 };
40 }; 53 };
41}; 54};
55
56/include/ "omap446x-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap446x-clocks.dtsi b/arch/arm/boot/dts/omap446x-clocks.dtsi
new file mode 100644
index 000000000000..be033e9803e9
--- /dev/null
+++ b/arch/arm/boot/dts/omap446x-clocks.dtsi
@@ -0,0 +1,27 @@
1/*
2 * Device Tree Source for OMAP4 clock data
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&prm_clocks {
11 div_ts_ck: div_ts_ck {
12 #clock-cells = <0>;
13 compatible = "ti,divider-clock";
14 clocks = <&l4_wkup_clk_mux_ck>;
15 ti,bit-shift = <24>;
16 reg = <0x1888>;
17 ti,dividers = <8>, <16>, <32>;
18 };
19
20 bandgap_ts_fclk: bandgap_ts_fclk {
21 #clock-cells = <0>;
22 compatible = "ti,gate-clock";
23 clocks = <&div_ts_ck>;
24 ti,bit-shift = <8>;
25 reg = <0x1888>;
26 };
27};
diff --git a/arch/arm/boot/dts/omap44xx-clocks.dtsi b/arch/arm/boot/dts/omap44xx-clocks.dtsi
new file mode 100644
index 000000000000..c821ff5e9b8d
--- /dev/null
+++ b/arch/arm/boot/dts/omap44xx-clocks.dtsi
@@ -0,0 +1,1651 @@
1/*
2 * Device Tree Source for OMAP4 clock data
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&cm1_clocks {
11 extalt_clkin_ck: extalt_clkin_ck {
12 #clock-cells = <0>;
13 compatible = "fixed-clock";
14 clock-frequency = <59000000>;
15 };
16
17 pad_clks_src_ck: pad_clks_src_ck {
18 #clock-cells = <0>;
19 compatible = "fixed-clock";
20 clock-frequency = <12000000>;
21 };
22
23 pad_clks_ck: pad_clks_ck {
24 #clock-cells = <0>;
25 compatible = "ti,gate-clock";
26 clocks = <&pad_clks_src_ck>;
27 ti,bit-shift = <8>;
28 reg = <0x0108>;
29 };
30
31 pad_slimbus_core_clks_ck: pad_slimbus_core_clks_ck {
32 #clock-cells = <0>;
33 compatible = "fixed-clock";
34 clock-frequency = <12000000>;
35 };
36
37 secure_32k_clk_src_ck: secure_32k_clk_src_ck {
38 #clock-cells = <0>;
39 compatible = "fixed-clock";
40 clock-frequency = <32768>;
41 };
42
43 slimbus_src_clk: slimbus_src_clk {
44 #clock-cells = <0>;
45 compatible = "fixed-clock";
46 clock-frequency = <12000000>;
47 };
48
49 slimbus_clk: slimbus_clk {
50 #clock-cells = <0>;
51 compatible = "ti,gate-clock";
52 clocks = <&slimbus_src_clk>;
53 ti,bit-shift = <10>;
54 reg = <0x0108>;
55 };
56
57 sys_32k_ck: sys_32k_ck {
58 #clock-cells = <0>;
59 compatible = "fixed-clock";
60 clock-frequency = <32768>;
61 };
62
63 virt_12000000_ck: virt_12000000_ck {
64 #clock-cells = <0>;
65 compatible = "fixed-clock";
66 clock-frequency = <12000000>;
67 };
68
69 virt_13000000_ck: virt_13000000_ck {
70 #clock-cells = <0>;
71 compatible = "fixed-clock";
72 clock-frequency = <13000000>;
73 };
74
75 virt_16800000_ck: virt_16800000_ck {
76 #clock-cells = <0>;
77 compatible = "fixed-clock";
78 clock-frequency = <16800000>;
79 };
80
81 virt_19200000_ck: virt_19200000_ck {
82 #clock-cells = <0>;
83 compatible = "fixed-clock";
84 clock-frequency = <19200000>;
85 };
86
87 virt_26000000_ck: virt_26000000_ck {
88 #clock-cells = <0>;
89 compatible = "fixed-clock";
90 clock-frequency = <26000000>;
91 };
92
93 virt_27000000_ck: virt_27000000_ck {
94 #clock-cells = <0>;
95 compatible = "fixed-clock";
96 clock-frequency = <27000000>;
97 };
98
99 virt_38400000_ck: virt_38400000_ck {
100 #clock-cells = <0>;
101 compatible = "fixed-clock";
102 clock-frequency = <38400000>;
103 };
104
105 tie_low_clock_ck: tie_low_clock_ck {
106 #clock-cells = <0>;
107 compatible = "fixed-clock";
108 clock-frequency = <0>;
109 };
110
111 utmi_phy_clkout_ck: utmi_phy_clkout_ck {
112 #clock-cells = <0>;
113 compatible = "fixed-clock";
114 clock-frequency = <60000000>;
115 };
116
117 xclk60mhsp1_ck: xclk60mhsp1_ck {
118 #clock-cells = <0>;
119 compatible = "fixed-clock";
120 clock-frequency = <60000000>;
121 };
122
123 xclk60mhsp2_ck: xclk60mhsp2_ck {
124 #clock-cells = <0>;
125 compatible = "fixed-clock";
126 clock-frequency = <60000000>;
127 };
128
129 xclk60motg_ck: xclk60motg_ck {
130 #clock-cells = <0>;
131 compatible = "fixed-clock";
132 clock-frequency = <60000000>;
133 };
134
135 dpll_abe_ck: dpll_abe_ck {
136 #clock-cells = <0>;
137 compatible = "ti,omap4-dpll-m4xen-clock";
138 clocks = <&abe_dpll_refclk_mux_ck>, <&abe_dpll_bypass_clk_mux_ck>;
139 reg = <0x01e0>, <0x01e4>, <0x01ec>, <0x01e8>;
140 };
141
142 dpll_abe_x2_ck: dpll_abe_x2_ck {
143 #clock-cells = <0>;
144 compatible = "ti,omap4-dpll-x2-clock";
145 clocks = <&dpll_abe_ck>;
146 reg = <0x01f0>;
147 };
148
149 dpll_abe_m2x2_ck: dpll_abe_m2x2_ck {
150 #clock-cells = <0>;
151 compatible = "ti,divider-clock";
152 clocks = <&dpll_abe_x2_ck>;
153 ti,max-div = <31>;
154 ti,autoidle-shift = <8>;
155 reg = <0x01f0>;
156 ti,index-starts-at-one;
157 ti,invert-autoidle-bit;
158 };
159
160 abe_24m_fclk: abe_24m_fclk {
161 #clock-cells = <0>;
162 compatible = "fixed-factor-clock";
163 clocks = <&dpll_abe_m2x2_ck>;
164 clock-mult = <1>;
165 clock-div = <8>;
166 };
167
168 abe_clk: abe_clk {
169 #clock-cells = <0>;
170 compatible = "ti,divider-clock";
171 clocks = <&dpll_abe_m2x2_ck>;
172 ti,max-div = <4>;
173 reg = <0x0108>;
174 ti,index-power-of-two;
175 };
176
177 aess_fclk: aess_fclk {
178 #clock-cells = <0>;
179 compatible = "ti,divider-clock";
180 clocks = <&abe_clk>;
181 ti,bit-shift = <24>;
182 ti,max-div = <2>;
183 reg = <0x0528>;
184 };
185
186 dpll_abe_m3x2_ck: dpll_abe_m3x2_ck {
187 #clock-cells = <0>;
188 compatible = "ti,divider-clock";
189 clocks = <&dpll_abe_x2_ck>;
190 ti,max-div = <31>;
191 ti,autoidle-shift = <8>;
192 reg = <0x01f4>;
193 ti,index-starts-at-one;
194 ti,invert-autoidle-bit;
195 };
196
197 core_hsd_byp_clk_mux_ck: core_hsd_byp_clk_mux_ck {
198 #clock-cells = <0>;
199 compatible = "ti,mux-clock";
200 clocks = <&sys_clkin_ck>, <&dpll_abe_m3x2_ck>;
201 ti,bit-shift = <23>;
202 reg = <0x012c>;
203 };
204
205 dpll_core_ck: dpll_core_ck {
206 #clock-cells = <0>;
207 compatible = "ti,omap4-dpll-core-clock";
208 clocks = <&sys_clkin_ck>, <&core_hsd_byp_clk_mux_ck>;
209 reg = <0x0120>, <0x0124>, <0x012c>, <0x0128>;
210 };
211
212 dpll_core_x2_ck: dpll_core_x2_ck {
213 #clock-cells = <0>;
214 compatible = "ti,omap4-dpll-x2-clock";
215 clocks = <&dpll_core_ck>;
216 };
217
218 dpll_core_m6x2_ck: dpll_core_m6x2_ck {
219 #clock-cells = <0>;
220 compatible = "ti,divider-clock";
221 clocks = <&dpll_core_x2_ck>;
222 ti,max-div = <31>;
223 ti,autoidle-shift = <8>;
224 reg = <0x0140>;
225 ti,index-starts-at-one;
226 ti,invert-autoidle-bit;
227 };
228
229 dpll_core_m2_ck: dpll_core_m2_ck {
230 #clock-cells = <0>;
231 compatible = "ti,divider-clock";
232 clocks = <&dpll_core_ck>;
233 ti,max-div = <31>;
234 ti,autoidle-shift = <8>;
235 reg = <0x0130>;
236 ti,index-starts-at-one;
237 ti,invert-autoidle-bit;
238 };
239
240 ddrphy_ck: ddrphy_ck {
241 #clock-cells = <0>;
242 compatible = "fixed-factor-clock";
243 clocks = <&dpll_core_m2_ck>;
244 clock-mult = <1>;
245 clock-div = <2>;
246 };
247
248 dpll_core_m5x2_ck: dpll_core_m5x2_ck {
249 #clock-cells = <0>;
250 compatible = "ti,divider-clock";
251 clocks = <&dpll_core_x2_ck>;
252 ti,max-div = <31>;
253 ti,autoidle-shift = <8>;
254 reg = <0x013c>;
255 ti,index-starts-at-one;
256 ti,invert-autoidle-bit;
257 };
258
259 div_core_ck: div_core_ck {
260 #clock-cells = <0>;
261 compatible = "ti,divider-clock";
262 clocks = <&dpll_core_m5x2_ck>;
263 reg = <0x0100>;
264 ti,max-div = <2>;
265 };
266
267 div_iva_hs_clk: div_iva_hs_clk {
268 #clock-cells = <0>;
269 compatible = "ti,divider-clock";
270 clocks = <&dpll_core_m5x2_ck>;
271 ti,max-div = <4>;
272 reg = <0x01dc>;
273 ti,index-power-of-two;
274 };
275
276 div_mpu_hs_clk: div_mpu_hs_clk {
277 #clock-cells = <0>;
278 compatible = "ti,divider-clock";
279 clocks = <&dpll_core_m5x2_ck>;
280 ti,max-div = <4>;
281 reg = <0x019c>;
282 ti,index-power-of-two;
283 };
284
285 dpll_core_m4x2_ck: dpll_core_m4x2_ck {
286 #clock-cells = <0>;
287 compatible = "ti,divider-clock";
288 clocks = <&dpll_core_x2_ck>;
289 ti,max-div = <31>;
290 ti,autoidle-shift = <8>;
291 reg = <0x0138>;
292 ti,index-starts-at-one;
293 ti,invert-autoidle-bit;
294 };
295
296 dll_clk_div_ck: dll_clk_div_ck {
297 #clock-cells = <0>;
298 compatible = "fixed-factor-clock";
299 clocks = <&dpll_core_m4x2_ck>;
300 clock-mult = <1>;
301 clock-div = <2>;
302 };
303
304 dpll_abe_m2_ck: dpll_abe_m2_ck {
305 #clock-cells = <0>;
306 compatible = "ti,divider-clock";
307 clocks = <&dpll_abe_ck>;
308 ti,max-div = <31>;
309 reg = <0x01f0>;
310 ti,index-starts-at-one;
311 };
312
313 dpll_core_m3x2_gate_ck: dpll_core_m3x2_gate_ck {
314 #clock-cells = <0>;
315 compatible = "ti,composite-no-wait-gate-clock";
316 clocks = <&dpll_core_x2_ck>;
317 ti,bit-shift = <8>;
318 reg = <0x0134>;
319 };
320
321 dpll_core_m3x2_div_ck: dpll_core_m3x2_div_ck {
322 #clock-cells = <0>;
323 compatible = "ti,composite-divider-clock";
324 clocks = <&dpll_core_x2_ck>;
325 ti,max-div = <31>;
326 reg = <0x0134>;
327 ti,index-starts-at-one;
328 };
329
330 dpll_core_m3x2_ck: dpll_core_m3x2_ck {
331 #clock-cells = <0>;
332 compatible = "ti,composite-clock";
333 clocks = <&dpll_core_m3x2_gate_ck>, <&dpll_core_m3x2_div_ck>;
334 };
335
336 dpll_core_m7x2_ck: dpll_core_m7x2_ck {
337 #clock-cells = <0>;
338 compatible = "ti,divider-clock";
339 clocks = <&dpll_core_x2_ck>;
340 ti,max-div = <31>;
341 ti,autoidle-shift = <8>;
342 reg = <0x0144>;
343 ti,index-starts-at-one;
344 ti,invert-autoidle-bit;
345 };
346
347 iva_hsd_byp_clk_mux_ck: iva_hsd_byp_clk_mux_ck {
348 #clock-cells = <0>;
349 compatible = "ti,mux-clock";
350 clocks = <&sys_clkin_ck>, <&div_iva_hs_clk>;
351 ti,bit-shift = <23>;
352 reg = <0x01ac>;
353 };
354
355 dpll_iva_ck: dpll_iva_ck {
356 #clock-cells = <0>;
357 compatible = "ti,omap4-dpll-clock";
358 clocks = <&sys_clkin_ck>, <&iva_hsd_byp_clk_mux_ck>;
359 reg = <0x01a0>, <0x01a4>, <0x01ac>, <0x01a8>;
360 };
361
362 dpll_iva_x2_ck: dpll_iva_x2_ck {
363 #clock-cells = <0>;
364 compatible = "ti,omap4-dpll-x2-clock";
365 clocks = <&dpll_iva_ck>;
366 };
367
368 dpll_iva_m4x2_ck: dpll_iva_m4x2_ck {
369 #clock-cells = <0>;
370 compatible = "ti,divider-clock";
371 clocks = <&dpll_iva_x2_ck>;
372 ti,max-div = <31>;
373 ti,autoidle-shift = <8>;
374 reg = <0x01b8>;
375 ti,index-starts-at-one;
376 ti,invert-autoidle-bit;
377 };
378
379 dpll_iva_m5x2_ck: dpll_iva_m5x2_ck {
380 #clock-cells = <0>;
381 compatible = "ti,divider-clock";
382 clocks = <&dpll_iva_x2_ck>;
383 ti,max-div = <31>;
384 ti,autoidle-shift = <8>;
385 reg = <0x01bc>;
386 ti,index-starts-at-one;
387 ti,invert-autoidle-bit;
388 };
389
390 dpll_mpu_ck: dpll_mpu_ck {
391 #clock-cells = <0>;
392 compatible = "ti,omap4-dpll-clock";
393 clocks = <&sys_clkin_ck>, <&div_mpu_hs_clk>;
394 reg = <0x0160>, <0x0164>, <0x016c>, <0x0168>;
395 };
396
397 dpll_mpu_m2_ck: dpll_mpu_m2_ck {
398 #clock-cells = <0>;
399 compatible = "ti,divider-clock";
400 clocks = <&dpll_mpu_ck>;
401 ti,max-div = <31>;
402 ti,autoidle-shift = <8>;
403 reg = <0x0170>;
404 ti,index-starts-at-one;
405 ti,invert-autoidle-bit;
406 };
407
408 per_hs_clk_div_ck: per_hs_clk_div_ck {
409 #clock-cells = <0>;
410 compatible = "fixed-factor-clock";
411 clocks = <&dpll_abe_m3x2_ck>;
412 clock-mult = <1>;
413 clock-div = <2>;
414 };
415
416 usb_hs_clk_div_ck: usb_hs_clk_div_ck {
417 #clock-cells = <0>;
418 compatible = "fixed-factor-clock";
419 clocks = <&dpll_abe_m3x2_ck>;
420 clock-mult = <1>;
421 clock-div = <3>;
422 };
423
424 l3_div_ck: l3_div_ck {
425 #clock-cells = <0>;
426 compatible = "ti,divider-clock";
427 clocks = <&div_core_ck>;
428 ti,bit-shift = <4>;
429 ti,max-div = <2>;
430 reg = <0x0100>;
431 };
432
433 l4_div_ck: l4_div_ck {
434 #clock-cells = <0>;
435 compatible = "ti,divider-clock";
436 clocks = <&l3_div_ck>;
437 ti,bit-shift = <8>;
438 ti,max-div = <2>;
439 reg = <0x0100>;
440 };
441
442 lp_clk_div_ck: lp_clk_div_ck {
443 #clock-cells = <0>;
444 compatible = "fixed-factor-clock";
445 clocks = <&dpll_abe_m2x2_ck>;
446 clock-mult = <1>;
447 clock-div = <16>;
448 };
449
450 mpu_periphclk: mpu_periphclk {
451 #clock-cells = <0>;
452 compatible = "fixed-factor-clock";
453 clocks = <&dpll_mpu_ck>;
454 clock-mult = <1>;
455 clock-div = <2>;
456 };
457
458 ocp_abe_iclk: ocp_abe_iclk {
459 #clock-cells = <0>;
460 compatible = "ti,divider-clock";
461 clocks = <&aess_fclk>;
462 ti,bit-shift = <24>;
463 reg = <0x0528>;
464 ti,dividers = <2>, <1>;
465 };
466
467 per_abe_24m_fclk: per_abe_24m_fclk {
468 #clock-cells = <0>;
469 compatible = "fixed-factor-clock";
470 clocks = <&dpll_abe_m2_ck>;
471 clock-mult = <1>;
472 clock-div = <4>;
473 };
474
475 dmic_sync_mux_ck: dmic_sync_mux_ck {
476 #clock-cells = <0>;
477 compatible = "ti,mux-clock";
478 clocks = <&abe_24m_fclk>, <&syc_clk_div_ck>, <&func_24m_clk>;
479 ti,bit-shift = <25>;
480 reg = <0x0538>;
481 };
482
483 func_dmic_abe_gfclk: func_dmic_abe_gfclk {
484 #clock-cells = <0>;
485 compatible = "ti,mux-clock";
486 clocks = <&dmic_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
487 ti,bit-shift = <24>;
488 reg = <0x0538>;
489 };
490
491 mcasp_sync_mux_ck: mcasp_sync_mux_ck {
492 #clock-cells = <0>;
493 compatible = "ti,mux-clock";
494 clocks = <&abe_24m_fclk>, <&syc_clk_div_ck>, <&func_24m_clk>;
495 ti,bit-shift = <25>;
496 reg = <0x0540>;
497 };
498
499 func_mcasp_abe_gfclk: func_mcasp_abe_gfclk {
500 #clock-cells = <0>;
501 compatible = "ti,mux-clock";
502 clocks = <&mcasp_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
503 ti,bit-shift = <24>;
504 reg = <0x0540>;
505 };
506
507 mcbsp1_sync_mux_ck: mcbsp1_sync_mux_ck {
508 #clock-cells = <0>;
509 compatible = "ti,mux-clock";
510 clocks = <&abe_24m_fclk>, <&syc_clk_div_ck>, <&func_24m_clk>;
511 ti,bit-shift = <25>;
512 reg = <0x0548>;
513 };
514
515 func_mcbsp1_gfclk: func_mcbsp1_gfclk {
516 #clock-cells = <0>;
517 compatible = "ti,mux-clock";
518 clocks = <&mcbsp1_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
519 ti,bit-shift = <24>;
520 reg = <0x0548>;
521 };
522
523 mcbsp2_sync_mux_ck: mcbsp2_sync_mux_ck {
524 #clock-cells = <0>;
525 compatible = "ti,mux-clock";
526 clocks = <&abe_24m_fclk>, <&syc_clk_div_ck>, <&func_24m_clk>;
527 ti,bit-shift = <25>;
528 reg = <0x0550>;
529 };
530
531 func_mcbsp2_gfclk: func_mcbsp2_gfclk {
532 #clock-cells = <0>;
533 compatible = "ti,mux-clock";
534 clocks = <&mcbsp2_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
535 ti,bit-shift = <24>;
536 reg = <0x0550>;
537 };
538
539 mcbsp3_sync_mux_ck: mcbsp3_sync_mux_ck {
540 #clock-cells = <0>;
541 compatible = "ti,mux-clock";
542 clocks = <&abe_24m_fclk>, <&syc_clk_div_ck>, <&func_24m_clk>;
543 ti,bit-shift = <25>;
544 reg = <0x0558>;
545 };
546
547 func_mcbsp3_gfclk: func_mcbsp3_gfclk {
548 #clock-cells = <0>;
549 compatible = "ti,mux-clock";
550 clocks = <&mcbsp3_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
551 ti,bit-shift = <24>;
552 reg = <0x0558>;
553 };
554
555 slimbus1_fclk_1: slimbus1_fclk_1 {
556 #clock-cells = <0>;
557 compatible = "ti,gate-clock";
558 clocks = <&func_24m_clk>;
559 ti,bit-shift = <9>;
560 reg = <0x0560>;
561 };
562
563 slimbus1_fclk_0: slimbus1_fclk_0 {
564 #clock-cells = <0>;
565 compatible = "ti,gate-clock";
566 clocks = <&abe_24m_fclk>;
567 ti,bit-shift = <8>;
568 reg = <0x0560>;
569 };
570
571 slimbus1_fclk_2: slimbus1_fclk_2 {
572 #clock-cells = <0>;
573 compatible = "ti,gate-clock";
574 clocks = <&pad_clks_ck>;
575 ti,bit-shift = <10>;
576 reg = <0x0560>;
577 };
578
579 slimbus1_slimbus_clk: slimbus1_slimbus_clk {
580 #clock-cells = <0>;
581 compatible = "ti,gate-clock";
582 clocks = <&slimbus_clk>;
583 ti,bit-shift = <11>;
584 reg = <0x0560>;
585 };
586
587 timer5_sync_mux: timer5_sync_mux {
588 #clock-cells = <0>;
589 compatible = "ti,mux-clock";
590 clocks = <&syc_clk_div_ck>, <&sys_32k_ck>;
591 ti,bit-shift = <24>;
592 reg = <0x0568>;
593 };
594
595 timer6_sync_mux: timer6_sync_mux {
596 #clock-cells = <0>;
597 compatible = "ti,mux-clock";
598 clocks = <&syc_clk_div_ck>, <&sys_32k_ck>;
599 ti,bit-shift = <24>;
600 reg = <0x0570>;
601 };
602
603 timer7_sync_mux: timer7_sync_mux {
604 #clock-cells = <0>;
605 compatible = "ti,mux-clock";
606 clocks = <&syc_clk_div_ck>, <&sys_32k_ck>;
607 ti,bit-shift = <24>;
608 reg = <0x0578>;
609 };
610
611 timer8_sync_mux: timer8_sync_mux {
612 #clock-cells = <0>;
613 compatible = "ti,mux-clock";
614 clocks = <&syc_clk_div_ck>, <&sys_32k_ck>;
615 ti,bit-shift = <24>;
616 reg = <0x0580>;
617 };
618
619 dummy_ck: dummy_ck {
620 #clock-cells = <0>;
621 compatible = "fixed-clock";
622 clock-frequency = <0>;
623 };
624};
625&prm_clocks {
626 sys_clkin_ck: sys_clkin_ck {
627 #clock-cells = <0>;
628 compatible = "ti,mux-clock";
629 clocks = <&virt_12000000_ck>, <&virt_13000000_ck>, <&virt_16800000_ck>, <&virt_19200000_ck>, <&virt_26000000_ck>, <&virt_27000000_ck>, <&virt_38400000_ck>;
630 reg = <0x0110>;
631 ti,index-starts-at-one;
632 };
633
634 abe_dpll_bypass_clk_mux_ck: abe_dpll_bypass_clk_mux_ck {
635 #clock-cells = <0>;
636 compatible = "ti,mux-clock";
637 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
638 ti,bit-shift = <24>;
639 reg = <0x0108>;
640 };
641
642 abe_dpll_refclk_mux_ck: abe_dpll_refclk_mux_ck {
643 #clock-cells = <0>;
644 compatible = "ti,mux-clock";
645 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
646 reg = <0x010c>;
647 };
648
649 dbgclk_mux_ck: dbgclk_mux_ck {
650 #clock-cells = <0>;
651 compatible = "fixed-factor-clock";
652 clocks = <&sys_clkin_ck>;
653 clock-mult = <1>;
654 clock-div = <1>;
655 };
656
657 l4_wkup_clk_mux_ck: l4_wkup_clk_mux_ck {
658 #clock-cells = <0>;
659 compatible = "ti,mux-clock";
660 clocks = <&sys_clkin_ck>, <&lp_clk_div_ck>;
661 reg = <0x0108>;
662 };
663
664 syc_clk_div_ck: syc_clk_div_ck {
665 #clock-cells = <0>;
666 compatible = "ti,divider-clock";
667 clocks = <&sys_clkin_ck>;
668 reg = <0x0100>;
669 ti,max-div = <2>;
670 };
671
672 gpio1_dbclk: gpio1_dbclk {
673 #clock-cells = <0>;
674 compatible = "ti,gate-clock";
675 clocks = <&sys_32k_ck>;
676 ti,bit-shift = <8>;
677 reg = <0x1838>;
678 };
679
680 dmt1_clk_mux: dmt1_clk_mux {
681 #clock-cells = <0>;
682 compatible = "ti,mux-clock";
683 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
684 ti,bit-shift = <24>;
685 reg = <0x1840>;
686 };
687
688 usim_ck: usim_ck {
689 #clock-cells = <0>;
690 compatible = "ti,divider-clock";
691 clocks = <&dpll_per_m4x2_ck>;
692 ti,bit-shift = <24>;
693 reg = <0x1858>;
694 ti,dividers = <14>, <18>;
695 };
696
697 usim_fclk: usim_fclk {
698 #clock-cells = <0>;
699 compatible = "ti,gate-clock";
700 clocks = <&usim_ck>;
701 ti,bit-shift = <8>;
702 reg = <0x1858>;
703 };
704
705 pmd_stm_clock_mux_ck: pmd_stm_clock_mux_ck {
706 #clock-cells = <0>;
707 compatible = "ti,mux-clock";
708 clocks = <&sys_clkin_ck>, <&dpll_core_m6x2_ck>, <&tie_low_clock_ck>;
709 ti,bit-shift = <20>;
710 reg = <0x1a20>;
711 };
712
713 pmd_trace_clk_mux_ck: pmd_trace_clk_mux_ck {
714 #clock-cells = <0>;
715 compatible = "ti,mux-clock";
716 clocks = <&sys_clkin_ck>, <&dpll_core_m6x2_ck>, <&tie_low_clock_ck>;
717 ti,bit-shift = <22>;
718 reg = <0x1a20>;
719 };
720
721 stm_clk_div_ck: stm_clk_div_ck {
722 #clock-cells = <0>;
723 compatible = "ti,divider-clock";
724 clocks = <&pmd_stm_clock_mux_ck>;
725 ti,bit-shift = <27>;
726 ti,max-div = <64>;
727 reg = <0x1a20>;
728 ti,index-power-of-two;
729 };
730
731 trace_clk_div_div_ck: trace_clk_div_div_ck {
732 #clock-cells = <0>;
733 compatible = "ti,divider-clock";
734 clocks = <&pmd_trace_clk_mux_ck>;
735 ti,bit-shift = <24>;
736 reg = <0x1a20>;
737 ti,dividers = <0>, <1>, <2>, <0>, <4>;
738 };
739
740 trace_clk_div_ck: trace_clk_div_ck {
741 #clock-cells = <0>;
742 compatible = "ti,clkdm-gate-clock";
743 clocks = <&trace_clk_div_div_ck>;
744 };
745};
746
747&prm_clockdomains {
748 emu_sys_clkdm: emu_sys_clkdm {
749 compatible = "ti,clockdomain";
750 clocks = <&trace_clk_div_ck>;
751 };
752};
753
754&cm2_clocks {
755 per_hsd_byp_clk_mux_ck: per_hsd_byp_clk_mux_ck {
756 #clock-cells = <0>;
757 compatible = "ti,mux-clock";
758 clocks = <&sys_clkin_ck>, <&per_hs_clk_div_ck>;
759 ti,bit-shift = <23>;
760 reg = <0x014c>;
761 };
762
763 dpll_per_ck: dpll_per_ck {
764 #clock-cells = <0>;
765 compatible = "ti,omap4-dpll-clock";
766 clocks = <&sys_clkin_ck>, <&per_hsd_byp_clk_mux_ck>;
767 reg = <0x0140>, <0x0144>, <0x014c>, <0x0148>;
768 };
769
770 dpll_per_m2_ck: dpll_per_m2_ck {
771 #clock-cells = <0>;
772 compatible = "ti,divider-clock";
773 clocks = <&dpll_per_ck>;
774 ti,max-div = <31>;
775 reg = <0x0150>;
776 ti,index-starts-at-one;
777 };
778
779 dpll_per_x2_ck: dpll_per_x2_ck {
780 #clock-cells = <0>;
781 compatible = "ti,omap4-dpll-x2-clock";
782 clocks = <&dpll_per_ck>;
783 reg = <0x0150>;
784 };
785
786 dpll_per_m2x2_ck: dpll_per_m2x2_ck {
787 #clock-cells = <0>;
788 compatible = "ti,divider-clock";
789 clocks = <&dpll_per_x2_ck>;
790 ti,max-div = <31>;
791 ti,autoidle-shift = <8>;
792 reg = <0x0150>;
793 ti,index-starts-at-one;
794 ti,invert-autoidle-bit;
795 };
796
797 dpll_per_m3x2_gate_ck: dpll_per_m3x2_gate_ck {
798 #clock-cells = <0>;
799 compatible = "ti,composite-no-wait-gate-clock";
800 clocks = <&dpll_per_x2_ck>;
801 ti,bit-shift = <8>;
802 reg = <0x0154>;
803 };
804
805 dpll_per_m3x2_div_ck: dpll_per_m3x2_div_ck {
806 #clock-cells = <0>;
807 compatible = "ti,composite-divider-clock";
808 clocks = <&dpll_per_x2_ck>;
809 ti,max-div = <31>;
810 reg = <0x0154>;
811 ti,index-starts-at-one;
812 };
813
814 dpll_per_m3x2_ck: dpll_per_m3x2_ck {
815 #clock-cells = <0>;
816 compatible = "ti,composite-clock";
817 clocks = <&dpll_per_m3x2_gate_ck>, <&dpll_per_m3x2_div_ck>;
818 };
819
820 dpll_per_m4x2_ck: dpll_per_m4x2_ck {
821 #clock-cells = <0>;
822 compatible = "ti,divider-clock";
823 clocks = <&dpll_per_x2_ck>;
824 ti,max-div = <31>;
825 ti,autoidle-shift = <8>;
826 reg = <0x0158>;
827 ti,index-starts-at-one;
828 ti,invert-autoidle-bit;
829 };
830
831 dpll_per_m5x2_ck: dpll_per_m5x2_ck {
832 #clock-cells = <0>;
833 compatible = "ti,divider-clock";
834 clocks = <&dpll_per_x2_ck>;
835 ti,max-div = <31>;
836 ti,autoidle-shift = <8>;
837 reg = <0x015c>;
838 ti,index-starts-at-one;
839 ti,invert-autoidle-bit;
840 };
841
842 dpll_per_m6x2_ck: dpll_per_m6x2_ck {
843 #clock-cells = <0>;
844 compatible = "ti,divider-clock";
845 clocks = <&dpll_per_x2_ck>;
846 ti,max-div = <31>;
847 ti,autoidle-shift = <8>;
848 reg = <0x0160>;
849 ti,index-starts-at-one;
850 ti,invert-autoidle-bit;
851 };
852
853 dpll_per_m7x2_ck: dpll_per_m7x2_ck {
854 #clock-cells = <0>;
855 compatible = "ti,divider-clock";
856 clocks = <&dpll_per_x2_ck>;
857 ti,max-div = <31>;
858 ti,autoidle-shift = <8>;
859 reg = <0x0164>;
860 ti,index-starts-at-one;
861 ti,invert-autoidle-bit;
862 };
863
864 dpll_usb_ck: dpll_usb_ck {
865 #clock-cells = <0>;
866 compatible = "ti,omap4-dpll-j-type-clock";
867 clocks = <&sys_clkin_ck>, <&usb_hs_clk_div_ck>;
868 reg = <0x0180>, <0x0184>, <0x018c>, <0x0188>;
869 };
870
871 dpll_usb_clkdcoldo_ck: dpll_usb_clkdcoldo_ck {
872 #clock-cells = <0>;
873 compatible = "ti,fixed-factor-clock";
874 clocks = <&dpll_usb_ck>;
875 ti,clock-div = <1>;
876 ti,autoidle-shift = <8>;
877 reg = <0x01b4>;
878 ti,clock-mult = <1>;
879 ti,invert-autoidle-bit;
880 };
881
882 dpll_usb_m2_ck: dpll_usb_m2_ck {
883 #clock-cells = <0>;
884 compatible = "ti,divider-clock";
885 clocks = <&dpll_usb_ck>;
886 ti,max-div = <127>;
887 ti,autoidle-shift = <8>;
888 reg = <0x0190>;
889 ti,index-starts-at-one;
890 ti,invert-autoidle-bit;
891 };
892
893 ducati_clk_mux_ck: ducati_clk_mux_ck {
894 #clock-cells = <0>;
895 compatible = "ti,mux-clock";
896 clocks = <&div_core_ck>, <&dpll_per_m6x2_ck>;
897 reg = <0x0100>;
898 };
899
900 func_12m_fclk: func_12m_fclk {
901 #clock-cells = <0>;
902 compatible = "fixed-factor-clock";
903 clocks = <&dpll_per_m2x2_ck>;
904 clock-mult = <1>;
905 clock-div = <16>;
906 };
907
908 func_24m_clk: func_24m_clk {
909 #clock-cells = <0>;
910 compatible = "fixed-factor-clock";
911 clocks = <&dpll_per_m2_ck>;
912 clock-mult = <1>;
913 clock-div = <4>;
914 };
915
916 func_24mc_fclk: func_24mc_fclk {
917 #clock-cells = <0>;
918 compatible = "fixed-factor-clock";
919 clocks = <&dpll_per_m2x2_ck>;
920 clock-mult = <1>;
921 clock-div = <8>;
922 };
923
924 func_48m_fclk: func_48m_fclk {
925 #clock-cells = <0>;
926 compatible = "ti,divider-clock";
927 clocks = <&dpll_per_m2x2_ck>;
928 reg = <0x0108>;
929 ti,dividers = <4>, <8>;
930 };
931
932 func_48mc_fclk: func_48mc_fclk {
933 #clock-cells = <0>;
934 compatible = "fixed-factor-clock";
935 clocks = <&dpll_per_m2x2_ck>;
936 clock-mult = <1>;
937 clock-div = <4>;
938 };
939
940 func_64m_fclk: func_64m_fclk {
941 #clock-cells = <0>;
942 compatible = "ti,divider-clock";
943 clocks = <&dpll_per_m4x2_ck>;
944 reg = <0x0108>;
945 ti,dividers = <2>, <4>;
946 };
947
948 func_96m_fclk: func_96m_fclk {
949 #clock-cells = <0>;
950 compatible = "ti,divider-clock";
951 clocks = <&dpll_per_m2x2_ck>;
952 reg = <0x0108>;
953 ti,dividers = <2>, <4>;
954 };
955
956 init_60m_fclk: init_60m_fclk {
957 #clock-cells = <0>;
958 compatible = "ti,divider-clock";
959 clocks = <&dpll_usb_m2_ck>;
960 reg = <0x0104>;
961 ti,dividers = <1>, <8>;
962 };
963
964 per_abe_nc_fclk: per_abe_nc_fclk {
965 #clock-cells = <0>;
966 compatible = "ti,divider-clock";
967 clocks = <&dpll_abe_m2_ck>;
968 reg = <0x0108>;
969 ti,max-div = <2>;
970 };
971
972 aes1_fck: aes1_fck {
973 #clock-cells = <0>;
974 compatible = "ti,gate-clock";
975 clocks = <&l3_div_ck>;
976 ti,bit-shift = <1>;
977 reg = <0x15a0>;
978 };
979
980 aes2_fck: aes2_fck {
981 #clock-cells = <0>;
982 compatible = "ti,gate-clock";
983 clocks = <&l3_div_ck>;
984 ti,bit-shift = <1>;
985 reg = <0x15a8>;
986 };
987
988 dss_sys_clk: dss_sys_clk {
989 #clock-cells = <0>;
990 compatible = "ti,gate-clock";
991 clocks = <&syc_clk_div_ck>;
992 ti,bit-shift = <10>;
993 reg = <0x1120>;
994 };
995
996 dss_tv_clk: dss_tv_clk {
997 #clock-cells = <0>;
998 compatible = "ti,gate-clock";
999 clocks = <&extalt_clkin_ck>;
1000 ti,bit-shift = <11>;
1001 reg = <0x1120>;
1002 };
1003
1004 dss_dss_clk: dss_dss_clk {
1005 #clock-cells = <0>;
1006 compatible = "ti,gate-clock";
1007 clocks = <&dpll_per_m5x2_ck>;
1008 ti,bit-shift = <8>;
1009 reg = <0x1120>;
1010 ti,set-rate-parent;
1011 };
1012
1013 dss_48mhz_clk: dss_48mhz_clk {
1014 #clock-cells = <0>;
1015 compatible = "ti,gate-clock";
1016 clocks = <&func_48mc_fclk>;
1017 ti,bit-shift = <9>;
1018 reg = <0x1120>;
1019 };
1020
1021 dss_fck: dss_fck {
1022 #clock-cells = <0>;
1023 compatible = "ti,gate-clock";
1024 clocks = <&l3_div_ck>;
1025 ti,bit-shift = <1>;
1026 reg = <0x1120>;
1027 };
1028
1029 fdif_fck: fdif_fck {
1030 #clock-cells = <0>;
1031 compatible = "ti,divider-clock";
1032 clocks = <&dpll_per_m4x2_ck>;
1033 ti,bit-shift = <24>;
1034 ti,max-div = <4>;
1035 reg = <0x1028>;
1036 ti,index-power-of-two;
1037 };
1038
1039 gpio2_dbclk: gpio2_dbclk {
1040 #clock-cells = <0>;
1041 compatible = "ti,gate-clock";
1042 clocks = <&sys_32k_ck>;
1043 ti,bit-shift = <8>;
1044 reg = <0x1460>;
1045 };
1046
1047 gpio3_dbclk: gpio3_dbclk {
1048 #clock-cells = <0>;
1049 compatible = "ti,gate-clock";
1050 clocks = <&sys_32k_ck>;
1051 ti,bit-shift = <8>;
1052 reg = <0x1468>;
1053 };
1054
1055 gpio4_dbclk: gpio4_dbclk {
1056 #clock-cells = <0>;
1057 compatible = "ti,gate-clock";
1058 clocks = <&sys_32k_ck>;
1059 ti,bit-shift = <8>;
1060 reg = <0x1470>;
1061 };
1062
1063 gpio5_dbclk: gpio5_dbclk {
1064 #clock-cells = <0>;
1065 compatible = "ti,gate-clock";
1066 clocks = <&sys_32k_ck>;
1067 ti,bit-shift = <8>;
1068 reg = <0x1478>;
1069 };
1070
1071 gpio6_dbclk: gpio6_dbclk {
1072 #clock-cells = <0>;
1073 compatible = "ti,gate-clock";
1074 clocks = <&sys_32k_ck>;
1075 ti,bit-shift = <8>;
1076 reg = <0x1480>;
1077 };
1078
1079 sgx_clk_mux: sgx_clk_mux {
1080 #clock-cells = <0>;
1081 compatible = "ti,mux-clock";
1082 clocks = <&dpll_core_m7x2_ck>, <&dpll_per_m7x2_ck>;
1083 ti,bit-shift = <24>;
1084 reg = <0x1220>;
1085 };
1086
1087 hsi_fck: hsi_fck {
1088 #clock-cells = <0>;
1089 compatible = "ti,divider-clock";
1090 clocks = <&dpll_per_m2x2_ck>;
1091 ti,bit-shift = <24>;
1092 ti,max-div = <4>;
1093 reg = <0x1338>;
1094 ti,index-power-of-two;
1095 };
1096
1097 iss_ctrlclk: iss_ctrlclk {
1098 #clock-cells = <0>;
1099 compatible = "ti,gate-clock";
1100 clocks = <&func_96m_fclk>;
1101 ti,bit-shift = <8>;
1102 reg = <0x1020>;
1103 };
1104
1105 mcbsp4_sync_mux_ck: mcbsp4_sync_mux_ck {
1106 #clock-cells = <0>;
1107 compatible = "ti,mux-clock";
1108 clocks = <&func_96m_fclk>, <&per_abe_nc_fclk>;
1109 ti,bit-shift = <25>;
1110 reg = <0x14e0>;
1111 };
1112
1113 per_mcbsp4_gfclk: per_mcbsp4_gfclk {
1114 #clock-cells = <0>;
1115 compatible = "ti,mux-clock";
1116 clocks = <&mcbsp4_sync_mux_ck>, <&pad_clks_ck>;
1117 ti,bit-shift = <24>;
1118 reg = <0x14e0>;
1119 };
1120
1121 hsmmc1_fclk: hsmmc1_fclk {
1122 #clock-cells = <0>;
1123 compatible = "ti,mux-clock";
1124 clocks = <&func_64m_fclk>, <&func_96m_fclk>;
1125 ti,bit-shift = <24>;
1126 reg = <0x1328>;
1127 };
1128
1129 hsmmc2_fclk: hsmmc2_fclk {
1130 #clock-cells = <0>;
1131 compatible = "ti,mux-clock";
1132 clocks = <&func_64m_fclk>, <&func_96m_fclk>;
1133 ti,bit-shift = <24>;
1134 reg = <0x1330>;
1135 };
1136
1137 ocp2scp_usb_phy_phy_48m: ocp2scp_usb_phy_phy_48m {
1138 #clock-cells = <0>;
1139 compatible = "ti,gate-clock";
1140 clocks = <&func_48m_fclk>;
1141 ti,bit-shift = <8>;
1142 reg = <0x13e0>;
1143 };
1144
1145 sha2md5_fck: sha2md5_fck {
1146 #clock-cells = <0>;
1147 compatible = "ti,gate-clock";
1148 clocks = <&l3_div_ck>;
1149 ti,bit-shift = <1>;
1150 reg = <0x15c8>;
1151 };
1152
1153 slimbus2_fclk_1: slimbus2_fclk_1 {
1154 #clock-cells = <0>;
1155 compatible = "ti,gate-clock";
1156 clocks = <&per_abe_24m_fclk>;
1157 ti,bit-shift = <9>;
1158 reg = <0x1538>;
1159 };
1160
1161 slimbus2_fclk_0: slimbus2_fclk_0 {
1162 #clock-cells = <0>;
1163 compatible = "ti,gate-clock";
1164 clocks = <&func_24mc_fclk>;
1165 ti,bit-shift = <8>;
1166 reg = <0x1538>;
1167 };
1168
1169 slimbus2_slimbus_clk: slimbus2_slimbus_clk {
1170 #clock-cells = <0>;
1171 compatible = "ti,gate-clock";
1172 clocks = <&pad_slimbus_core_clks_ck>;
1173 ti,bit-shift = <10>;
1174 reg = <0x1538>;
1175 };
1176
1177 smartreflex_core_fck: smartreflex_core_fck {
1178 #clock-cells = <0>;
1179 compatible = "ti,gate-clock";
1180 clocks = <&l4_wkup_clk_mux_ck>;
1181 ti,bit-shift = <1>;
1182 reg = <0x0638>;
1183 };
1184
1185 smartreflex_iva_fck: smartreflex_iva_fck {
1186 #clock-cells = <0>;
1187 compatible = "ti,gate-clock";
1188 clocks = <&l4_wkup_clk_mux_ck>;
1189 ti,bit-shift = <1>;
1190 reg = <0x0630>;
1191 };
1192
1193 smartreflex_mpu_fck: smartreflex_mpu_fck {
1194 #clock-cells = <0>;
1195 compatible = "ti,gate-clock";
1196 clocks = <&l4_wkup_clk_mux_ck>;
1197 ti,bit-shift = <1>;
1198 reg = <0x0628>;
1199 };
1200
1201 cm2_dm10_mux: cm2_dm10_mux {
1202 #clock-cells = <0>;
1203 compatible = "ti,mux-clock";
1204 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
1205 ti,bit-shift = <24>;
1206 reg = <0x1428>;
1207 };
1208
1209 cm2_dm11_mux: cm2_dm11_mux {
1210 #clock-cells = <0>;
1211 compatible = "ti,mux-clock";
1212 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
1213 ti,bit-shift = <24>;
1214 reg = <0x1430>;
1215 };
1216
1217 cm2_dm2_mux: cm2_dm2_mux {
1218 #clock-cells = <0>;
1219 compatible = "ti,mux-clock";
1220 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
1221 ti,bit-shift = <24>;
1222 reg = <0x1438>;
1223 };
1224
1225 cm2_dm3_mux: cm2_dm3_mux {
1226 #clock-cells = <0>;
1227 compatible = "ti,mux-clock";
1228 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
1229 ti,bit-shift = <24>;
1230 reg = <0x1440>;
1231 };
1232
1233 cm2_dm4_mux: cm2_dm4_mux {
1234 #clock-cells = <0>;
1235 compatible = "ti,mux-clock";
1236 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
1237 ti,bit-shift = <24>;
1238 reg = <0x1448>;
1239 };
1240
1241 cm2_dm9_mux: cm2_dm9_mux {
1242 #clock-cells = <0>;
1243 compatible = "ti,mux-clock";
1244 clocks = <&sys_clkin_ck>, <&sys_32k_ck>;
1245 ti,bit-shift = <24>;
1246 reg = <0x1450>;
1247 };
1248
1249 usb_host_fs_fck: usb_host_fs_fck {
1250 #clock-cells = <0>;
1251 compatible = "ti,gate-clock";
1252 clocks = <&func_48mc_fclk>;
1253 ti,bit-shift = <1>;
1254 reg = <0x13d0>;
1255 };
1256
1257 utmi_p1_gfclk: utmi_p1_gfclk {
1258 #clock-cells = <0>;
1259 compatible = "ti,mux-clock";
1260 clocks = <&init_60m_fclk>, <&xclk60mhsp1_ck>;
1261 ti,bit-shift = <24>;
1262 reg = <0x1358>;
1263 };
1264
1265 usb_host_hs_utmi_p1_clk: usb_host_hs_utmi_p1_clk {
1266 #clock-cells = <0>;
1267 compatible = "ti,gate-clock";
1268 clocks = <&utmi_p1_gfclk>;
1269 ti,bit-shift = <8>;
1270 reg = <0x1358>;
1271 };
1272
1273 utmi_p2_gfclk: utmi_p2_gfclk {
1274 #clock-cells = <0>;
1275 compatible = "ti,mux-clock";
1276 clocks = <&init_60m_fclk>, <&xclk60mhsp2_ck>;
1277 ti,bit-shift = <25>;
1278 reg = <0x1358>;
1279 };
1280
1281 usb_host_hs_utmi_p2_clk: usb_host_hs_utmi_p2_clk {
1282 #clock-cells = <0>;
1283 compatible = "ti,gate-clock";
1284 clocks = <&utmi_p2_gfclk>;
1285 ti,bit-shift = <9>;
1286 reg = <0x1358>;
1287 };
1288
1289 usb_host_hs_utmi_p3_clk: usb_host_hs_utmi_p3_clk {
1290 #clock-cells = <0>;
1291 compatible = "ti,gate-clock";
1292 clocks = <&init_60m_fclk>;
1293 ti,bit-shift = <10>;
1294 reg = <0x1358>;
1295 };
1296
1297 usb_host_hs_hsic480m_p1_clk: usb_host_hs_hsic480m_p1_clk {
1298 #clock-cells = <0>;
1299 compatible = "ti,gate-clock";
1300 clocks = <&dpll_usb_m2_ck>;
1301 ti,bit-shift = <13>;
1302 reg = <0x1358>;
1303 };
1304
1305 usb_host_hs_hsic60m_p1_clk: usb_host_hs_hsic60m_p1_clk {
1306 #clock-cells = <0>;
1307 compatible = "ti,gate-clock";
1308 clocks = <&init_60m_fclk>;
1309 ti,bit-shift = <11>;
1310 reg = <0x1358>;
1311 };
1312
1313 usb_host_hs_hsic60m_p2_clk: usb_host_hs_hsic60m_p2_clk {
1314 #clock-cells = <0>;
1315 compatible = "ti,gate-clock";
1316 clocks = <&init_60m_fclk>;
1317 ti,bit-shift = <12>;
1318 reg = <0x1358>;
1319 };
1320
1321 usb_host_hs_hsic480m_p2_clk: usb_host_hs_hsic480m_p2_clk {
1322 #clock-cells = <0>;
1323 compatible = "ti,gate-clock";
1324 clocks = <&dpll_usb_m2_ck>;
1325 ti,bit-shift = <14>;
1326 reg = <0x1358>;
1327 };
1328
1329 usb_host_hs_func48mclk: usb_host_hs_func48mclk {
1330 #clock-cells = <0>;
1331 compatible = "ti,gate-clock";
1332 clocks = <&func_48mc_fclk>;
1333 ti,bit-shift = <15>;
1334 reg = <0x1358>;
1335 };
1336
1337 usb_host_hs_fck: usb_host_hs_fck {
1338 #clock-cells = <0>;
1339 compatible = "ti,gate-clock";
1340 clocks = <&init_60m_fclk>;
1341 ti,bit-shift = <1>;
1342 reg = <0x1358>;
1343 };
1344
1345 otg_60m_gfclk: otg_60m_gfclk {
1346 #clock-cells = <0>;
1347 compatible = "ti,mux-clock";
1348 clocks = <&utmi_phy_clkout_ck>, <&xclk60motg_ck>;
1349 ti,bit-shift = <24>;
1350 reg = <0x1360>;
1351 };
1352
1353 usb_otg_hs_xclk: usb_otg_hs_xclk {
1354 #clock-cells = <0>;
1355 compatible = "ti,gate-clock";
1356 clocks = <&otg_60m_gfclk>;
1357 ti,bit-shift = <8>;
1358 reg = <0x1360>;
1359 };
1360
1361 usb_otg_hs_ick: usb_otg_hs_ick {
1362 #clock-cells = <0>;
1363 compatible = "ti,gate-clock";
1364 clocks = <&l3_div_ck>;
1365 ti,bit-shift = <0>;
1366 reg = <0x1360>;
1367 };
1368
1369 usb_phy_cm_clk32k: usb_phy_cm_clk32k {
1370 #clock-cells = <0>;
1371 compatible = "ti,gate-clock";
1372 clocks = <&sys_32k_ck>;
1373 ti,bit-shift = <8>;
1374 reg = <0x0640>;
1375 };
1376
1377 usb_tll_hs_usb_ch2_clk: usb_tll_hs_usb_ch2_clk {
1378 #clock-cells = <0>;
1379 compatible = "ti,gate-clock";
1380 clocks = <&init_60m_fclk>;
1381 ti,bit-shift = <10>;
1382 reg = <0x1368>;
1383 };
1384
1385 usb_tll_hs_usb_ch0_clk: usb_tll_hs_usb_ch0_clk {
1386 #clock-cells = <0>;
1387 compatible = "ti,gate-clock";
1388 clocks = <&init_60m_fclk>;
1389 ti,bit-shift = <8>;
1390 reg = <0x1368>;
1391 };
1392
1393 usb_tll_hs_usb_ch1_clk: usb_tll_hs_usb_ch1_clk {
1394 #clock-cells = <0>;
1395 compatible = "ti,gate-clock";
1396 clocks = <&init_60m_fclk>;
1397 ti,bit-shift = <9>;
1398 reg = <0x1368>;
1399 };
1400
1401 usb_tll_hs_ick: usb_tll_hs_ick {
1402 #clock-cells = <0>;
1403 compatible = "ti,gate-clock";
1404 clocks = <&l4_div_ck>;
1405 ti,bit-shift = <0>;
1406 reg = <0x1368>;
1407 };
1408};
1409
1410&cm2_clockdomains {
1411 l3_init_clkdm: l3_init_clkdm {
1412 compatible = "ti,clockdomain";
1413 clocks = <&dpll_usb_ck>, <&usb_host_fs_fck>;
1414 };
1415};
1416
1417&scrm_clocks {
1418 auxclk0_src_gate_ck: auxclk0_src_gate_ck {
1419 #clock-cells = <0>;
1420 compatible = "ti,composite-no-wait-gate-clock";
1421 clocks = <&dpll_core_m3x2_ck>;
1422 ti,bit-shift = <8>;
1423 reg = <0x0310>;
1424 };
1425
1426 auxclk0_src_mux_ck: auxclk0_src_mux_ck {
1427 #clock-cells = <0>;
1428 compatible = "ti,composite-mux-clock";
1429 clocks = <&sys_clkin_ck>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1430 ti,bit-shift = <1>;
1431 reg = <0x0310>;
1432 };
1433
1434 auxclk0_src_ck: auxclk0_src_ck {
1435 #clock-cells = <0>;
1436 compatible = "ti,composite-clock";
1437 clocks = <&auxclk0_src_gate_ck>, <&auxclk0_src_mux_ck>;
1438 };
1439
1440 auxclk0_ck: auxclk0_ck {
1441 #clock-cells = <0>;
1442 compatible = "ti,divider-clock";
1443 clocks = <&auxclk0_src_ck>;
1444 ti,bit-shift = <16>;
1445 ti,max-div = <16>;
1446 reg = <0x0310>;
1447 };
1448
1449 auxclk1_src_gate_ck: auxclk1_src_gate_ck {
1450 #clock-cells = <0>;
1451 compatible = "ti,composite-no-wait-gate-clock";
1452 clocks = <&dpll_core_m3x2_ck>;
1453 ti,bit-shift = <8>;
1454 reg = <0x0314>;
1455 };
1456
1457 auxclk1_src_mux_ck: auxclk1_src_mux_ck {
1458 #clock-cells = <0>;
1459 compatible = "ti,composite-mux-clock";
1460 clocks = <&sys_clkin_ck>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1461 ti,bit-shift = <1>;
1462 reg = <0x0314>;
1463 };
1464
1465 auxclk1_src_ck: auxclk1_src_ck {
1466 #clock-cells = <0>;
1467 compatible = "ti,composite-clock";
1468 clocks = <&auxclk1_src_gate_ck>, <&auxclk1_src_mux_ck>;
1469 };
1470
1471 auxclk1_ck: auxclk1_ck {
1472 #clock-cells = <0>;
1473 compatible = "ti,divider-clock";
1474 clocks = <&auxclk1_src_ck>;
1475 ti,bit-shift = <16>;
1476 ti,max-div = <16>;
1477 reg = <0x0314>;
1478 };
1479
1480 auxclk2_src_gate_ck: auxclk2_src_gate_ck {
1481 #clock-cells = <0>;
1482 compatible = "ti,composite-no-wait-gate-clock";
1483 clocks = <&dpll_core_m3x2_ck>;
1484 ti,bit-shift = <8>;
1485 reg = <0x0318>;
1486 };
1487
1488 auxclk2_src_mux_ck: auxclk2_src_mux_ck {
1489 #clock-cells = <0>;
1490 compatible = "ti,composite-mux-clock";
1491 clocks = <&sys_clkin_ck>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1492 ti,bit-shift = <1>;
1493 reg = <0x0318>;
1494 };
1495
1496 auxclk2_src_ck: auxclk2_src_ck {
1497 #clock-cells = <0>;
1498 compatible = "ti,composite-clock";
1499 clocks = <&auxclk2_src_gate_ck>, <&auxclk2_src_mux_ck>;
1500 };
1501
1502 auxclk2_ck: auxclk2_ck {
1503 #clock-cells = <0>;
1504 compatible = "ti,divider-clock";
1505 clocks = <&auxclk2_src_ck>;
1506 ti,bit-shift = <16>;
1507 ti,max-div = <16>;
1508 reg = <0x0318>;
1509 };
1510
1511 auxclk3_src_gate_ck: auxclk3_src_gate_ck {
1512 #clock-cells = <0>;
1513 compatible = "ti,composite-no-wait-gate-clock";
1514 clocks = <&dpll_core_m3x2_ck>;
1515 ti,bit-shift = <8>;
1516 reg = <0x031c>;
1517 };
1518
1519 auxclk3_src_mux_ck: auxclk3_src_mux_ck {
1520 #clock-cells = <0>;
1521 compatible = "ti,composite-mux-clock";
1522 clocks = <&sys_clkin_ck>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1523 ti,bit-shift = <1>;
1524 reg = <0x031c>;
1525 };
1526
1527 auxclk3_src_ck: auxclk3_src_ck {
1528 #clock-cells = <0>;
1529 compatible = "ti,composite-clock";
1530 clocks = <&auxclk3_src_gate_ck>, <&auxclk3_src_mux_ck>;
1531 };
1532
1533 auxclk3_ck: auxclk3_ck {
1534 #clock-cells = <0>;
1535 compatible = "ti,divider-clock";
1536 clocks = <&auxclk3_src_ck>;
1537 ti,bit-shift = <16>;
1538 ti,max-div = <16>;
1539 reg = <0x031c>;
1540 };
1541
1542 auxclk4_src_gate_ck: auxclk4_src_gate_ck {
1543 #clock-cells = <0>;
1544 compatible = "ti,composite-no-wait-gate-clock";
1545 clocks = <&dpll_core_m3x2_ck>;
1546 ti,bit-shift = <8>;
1547 reg = <0x0320>;
1548 };
1549
1550 auxclk4_src_mux_ck: auxclk4_src_mux_ck {
1551 #clock-cells = <0>;
1552 compatible = "ti,composite-mux-clock";
1553 clocks = <&sys_clkin_ck>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1554 ti,bit-shift = <1>;
1555 reg = <0x0320>;
1556 };
1557
1558 auxclk4_src_ck: auxclk4_src_ck {
1559 #clock-cells = <0>;
1560 compatible = "ti,composite-clock";
1561 clocks = <&auxclk4_src_gate_ck>, <&auxclk4_src_mux_ck>;
1562 };
1563
1564 auxclk4_ck: auxclk4_ck {
1565 #clock-cells = <0>;
1566 compatible = "ti,divider-clock";
1567 clocks = <&auxclk4_src_ck>;
1568 ti,bit-shift = <16>;
1569 ti,max-div = <16>;
1570 reg = <0x0320>;
1571 };
1572
1573 auxclk5_src_gate_ck: auxclk5_src_gate_ck {
1574 #clock-cells = <0>;
1575 compatible = "ti,composite-no-wait-gate-clock";
1576 clocks = <&dpll_core_m3x2_ck>;
1577 ti,bit-shift = <8>;
1578 reg = <0x0324>;
1579 };
1580
1581 auxclk5_src_mux_ck: auxclk5_src_mux_ck {
1582 #clock-cells = <0>;
1583 compatible = "ti,composite-mux-clock";
1584 clocks = <&sys_clkin_ck>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1585 ti,bit-shift = <1>;
1586 reg = <0x0324>;
1587 };
1588
1589 auxclk5_src_ck: auxclk5_src_ck {
1590 #clock-cells = <0>;
1591 compatible = "ti,composite-clock";
1592 clocks = <&auxclk5_src_gate_ck>, <&auxclk5_src_mux_ck>;
1593 };
1594
1595 auxclk5_ck: auxclk5_ck {
1596 #clock-cells = <0>;
1597 compatible = "ti,divider-clock";
1598 clocks = <&auxclk5_src_ck>;
1599 ti,bit-shift = <16>;
1600 ti,max-div = <16>;
1601 reg = <0x0324>;
1602 };
1603
1604 auxclkreq0_ck: auxclkreq0_ck {
1605 #clock-cells = <0>;
1606 compatible = "ti,mux-clock";
1607 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>, <&auxclk5_ck>;
1608 ti,bit-shift = <2>;
1609 reg = <0x0210>;
1610 };
1611
1612 auxclkreq1_ck: auxclkreq1_ck {
1613 #clock-cells = <0>;
1614 compatible = "ti,mux-clock";
1615 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>, <&auxclk5_ck>;
1616 ti,bit-shift = <2>;
1617 reg = <0x0214>;
1618 };
1619
1620 auxclkreq2_ck: auxclkreq2_ck {
1621 #clock-cells = <0>;
1622 compatible = "ti,mux-clock";
1623 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>, <&auxclk5_ck>;
1624 ti,bit-shift = <2>;
1625 reg = <0x0218>;
1626 };
1627
1628 auxclkreq3_ck: auxclkreq3_ck {
1629 #clock-cells = <0>;
1630 compatible = "ti,mux-clock";
1631 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>, <&auxclk5_ck>;
1632 ti,bit-shift = <2>;
1633 reg = <0x021c>;
1634 };
1635
1636 auxclkreq4_ck: auxclkreq4_ck {
1637 #clock-cells = <0>;
1638 compatible = "ti,mux-clock";
1639 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>, <&auxclk5_ck>;
1640 ti,bit-shift = <2>;
1641 reg = <0x0220>;
1642 };
1643
1644 auxclkreq5_ck: auxclkreq5_ck {
1645 #clock-cells = <0>;
1646 compatible = "ti,mux-clock";
1647 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>, <&auxclk5_ck>;
1648 ti,bit-shift = <2>;
1649 reg = <0x0224>;
1650 };
1651};
diff --git a/arch/arm/boot/dts/omap5-core-thermal.dtsi b/arch/arm/boot/dts/omap5-core-thermal.dtsi
new file mode 100644
index 000000000000..19212ac6eef0
--- /dev/null
+++ b/arch/arm/boot/dts/omap5-core-thermal.dtsi
@@ -0,0 +1,28 @@
1/*
2 * Device Tree Source for OMAP543x SoC CORE thermal
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 * Contact: Eduardo Valentin <eduardo.valentin@ti.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#include <dt-bindings/thermal/thermal.h>
13
14core_thermal: core_thermal {
15 polling-delay-passive = <250>; /* milliseconds */
16 polling-delay = <1000>; /* milliseconds */
17
18 /* sensor ID */
19 thermal-sensors = <&bandgap 2>;
20
21 trips {
22 core_crit: core_crit {
23 temperature = <125000>; /* milliCelsius */
24 hysteresis = <2000>; /* milliCelsius */
25 type = "critical";
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/omap5-gpu-thermal.dtsi b/arch/arm/boot/dts/omap5-gpu-thermal.dtsi
new file mode 100644
index 000000000000..1b87aca88b77
--- /dev/null
+++ b/arch/arm/boot/dts/omap5-gpu-thermal.dtsi
@@ -0,0 +1,28 @@
1/*
2 * Device Tree Source for OMAP543x SoC GPU thermal
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 * Contact: Eduardo Valentin <eduardo.valentin@ti.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#include <dt-bindings/thermal/thermal.h>
13
14gpu_thermal: gpu_thermal {
15 polling-delay-passive = <250>; /* milliseconds */
16 polling-delay = <1000>; /* milliseconds */
17
18 /* sensor ID */
19 thermal-sensors = <&bandgap 1>;
20
21 trips {
22 gpu_crit: gpu_crit {
23 temperature = <125000>; /* milliCelsius */
24 hysteresis = <2000>; /* milliCelsius */
25 type = "critical";
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index fc3fad563861..a72813a9663e 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -49,6 +49,10 @@
49 1000000 1060000 49 1000000 1060000
50 1500000 1250000 50 1500000 1250000
51 >; 51 >;
52 /* cooling options */
53 cooling-min-level = <0>;
54 cooling-max-level = <2>;
55 #cooling-cells = <2>; /* min followed by max */
52 }; 56 };
53 cpu@1 { 57 cpu@1 {
54 device_type = "cpu"; 58 device_type = "cpu";
@@ -57,6 +61,12 @@
57 }; 61 };
58 }; 62 };
59 63
64 thermal-zones {
65 #include "omap4-cpu-thermal.dtsi"
66 #include "omap5-gpu-thermal.dtsi"
67 #include "omap5-core-thermal.dtsi"
68 };
69
60 timer { 70 timer {
61 compatible = "arm,armv7-timer"; 71 compatible = "arm,armv7-timer";
62 /* PPI secure/nonsecure IRQ */ 72 /* PPI secure/nonsecure IRQ */
@@ -107,6 +117,58 @@
107 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, 117 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
108 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; 118 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
109 119
120 prm: prm@4ae06000 {
121 compatible = "ti,omap5-prm";
122 reg = <0x4ae06000 0x3000>;
123
124 prm_clocks: clocks {
125 #address-cells = <1>;
126 #size-cells = <0>;
127 };
128
129 prm_clockdomains: clockdomains {
130 };
131 };
132
133 cm_core_aon: cm_core_aon@4a004000 {
134 compatible = "ti,omap5-cm-core-aon";
135 reg = <0x4a004000 0x2000>;
136
137 cm_core_aon_clocks: clocks {
138 #address-cells = <1>;
139 #size-cells = <0>;
140 };
141
142 cm_core_aon_clockdomains: clockdomains {
143 };
144 };
145
146 scrm: scrm@4ae0a000 {
147 compatible = "ti,omap5-scrm";
148 reg = <0x4ae0a000 0x2000>;
149
150 scrm_clocks: clocks {
151 #address-cells = <1>;
152 #size-cells = <0>;
153 };
154
155 scrm_clockdomains: clockdomains {
156 };
157 };
158
159 cm_core: cm_core@4a008000 {
160 compatible = "ti,omap5-cm-core";
161 reg = <0x4a008000 0x3000>;
162
163 cm_core_clocks: clocks {
164 #address-cells = <1>;
165 #size-cells = <0>;
166 };
167
168 cm_core_clockdomains: clockdomains {
169 };
170 };
171
110 counter32k: counter@4ae04000 { 172 counter32k: counter@4ae04000 {
111 compatible = "ti,omap-counter32k"; 173 compatible = "ti,omap-counter32k";
112 reg = <0x4ae04000 0x40>; 174 reg = <0x4ae04000 0x40>;
@@ -729,13 +791,17 @@
729 }; 791 };
730 }; 792 };
731 793
732 bandgap@4a0021e0 { 794 bandgap: bandgap@4a0021e0 {
733 reg = <0x4a0021e0 0xc 795 reg = <0x4a0021e0 0xc
734 0x4a00232c 0xc 796 0x4a00232c 0xc
735 0x4a002380 0x2c 797 0x4a002380 0x2c
736 0x4a0023C0 0x3c>; 798 0x4a0023C0 0x3c>;
737 interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>; 799 interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
738 compatible = "ti,omap5430-bandgap"; 800 compatible = "ti,omap5430-bandgap";
801
802 #thermal-sensor-cells = <1>;
739 }; 803 };
740 }; 804 };
741}; 805};
806
807/include/ "omap54xx-clocks.dtsi"
diff --git a/arch/arm/boot/dts/omap54xx-clocks.dtsi b/arch/arm/boot/dts/omap54xx-clocks.dtsi
new file mode 100644
index 000000000000..d487fdab3921
--- /dev/null
+++ b/arch/arm/boot/dts/omap54xx-clocks.dtsi
@@ -0,0 +1,1399 @@
1/*
2 * Device Tree Source for OMAP5 clock data
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&cm_core_aon_clocks {
11 pad_clks_src_ck: pad_clks_src_ck {
12 #clock-cells = <0>;
13 compatible = "fixed-clock";
14 clock-frequency = <12000000>;
15 };
16
17 pad_clks_ck: pad_clks_ck {
18 #clock-cells = <0>;
19 compatible = "ti,gate-clock";
20 clocks = <&pad_clks_src_ck>;
21 ti,bit-shift = <8>;
22 reg = <0x0108>;
23 };
24
25 secure_32k_clk_src_ck: secure_32k_clk_src_ck {
26 #clock-cells = <0>;
27 compatible = "fixed-clock";
28 clock-frequency = <32768>;
29 };
30
31 slimbus_src_clk: slimbus_src_clk {
32 #clock-cells = <0>;
33 compatible = "fixed-clock";
34 clock-frequency = <12000000>;
35 };
36
37 slimbus_clk: slimbus_clk {
38 #clock-cells = <0>;
39 compatible = "ti,gate-clock";
40 clocks = <&slimbus_src_clk>;
41 ti,bit-shift = <10>;
42 reg = <0x0108>;
43 };
44
45 sys_32k_ck: sys_32k_ck {
46 #clock-cells = <0>;
47 compatible = "fixed-clock";
48 clock-frequency = <32768>;
49 };
50
51 virt_12000000_ck: virt_12000000_ck {
52 #clock-cells = <0>;
53 compatible = "fixed-clock";
54 clock-frequency = <12000000>;
55 };
56
57 virt_13000000_ck: virt_13000000_ck {
58 #clock-cells = <0>;
59 compatible = "fixed-clock";
60 clock-frequency = <13000000>;
61 };
62
63 virt_16800000_ck: virt_16800000_ck {
64 #clock-cells = <0>;
65 compatible = "fixed-clock";
66 clock-frequency = <16800000>;
67 };
68
69 virt_19200000_ck: virt_19200000_ck {
70 #clock-cells = <0>;
71 compatible = "fixed-clock";
72 clock-frequency = <19200000>;
73 };
74
75 virt_26000000_ck: virt_26000000_ck {
76 #clock-cells = <0>;
77 compatible = "fixed-clock";
78 clock-frequency = <26000000>;
79 };
80
81 virt_27000000_ck: virt_27000000_ck {
82 #clock-cells = <0>;
83 compatible = "fixed-clock";
84 clock-frequency = <27000000>;
85 };
86
87 virt_38400000_ck: virt_38400000_ck {
88 #clock-cells = <0>;
89 compatible = "fixed-clock";
90 clock-frequency = <38400000>;
91 };
92
93 xclk60mhsp1_ck: xclk60mhsp1_ck {
94 #clock-cells = <0>;
95 compatible = "fixed-clock";
96 clock-frequency = <60000000>;
97 };
98
99 xclk60mhsp2_ck: xclk60mhsp2_ck {
100 #clock-cells = <0>;
101 compatible = "fixed-clock";
102 clock-frequency = <60000000>;
103 };
104
105 dpll_abe_ck: dpll_abe_ck {
106 #clock-cells = <0>;
107 compatible = "ti,omap4-dpll-m4xen-clock";
108 clocks = <&abe_dpll_clk_mux>, <&abe_dpll_bypass_clk_mux>;
109 reg = <0x01e0>, <0x01e4>, <0x01ec>, <0x01e8>;
110 };
111
112 dpll_abe_x2_ck: dpll_abe_x2_ck {
113 #clock-cells = <0>;
114 compatible = "ti,omap4-dpll-x2-clock";
115 clocks = <&dpll_abe_ck>;
116 };
117
118 dpll_abe_m2x2_ck: dpll_abe_m2x2_ck {
119 #clock-cells = <0>;
120 compatible = "ti,divider-clock";
121 clocks = <&dpll_abe_x2_ck>;
122 ti,max-div = <31>;
123 ti,autoidle-shift = <8>;
124 reg = <0x01f0>;
125 ti,index-starts-at-one;
126 ti,invert-autoidle-bit;
127 };
128
129 abe_24m_fclk: abe_24m_fclk {
130 #clock-cells = <0>;
131 compatible = "fixed-factor-clock";
132 clocks = <&dpll_abe_m2x2_ck>;
133 clock-mult = <1>;
134 clock-div = <8>;
135 };
136
137 abe_clk: abe_clk {
138 #clock-cells = <0>;
139 compatible = "ti,divider-clock";
140 clocks = <&dpll_abe_m2x2_ck>;
141 ti,max-div = <4>;
142 reg = <0x0108>;
143 ti,index-power-of-two;
144 };
145
146 abe_iclk: abe_iclk {
147 #clock-cells = <0>;
148 compatible = "fixed-factor-clock";
149 clocks = <&abe_clk>;
150 clock-mult = <1>;
151 clock-div = <2>;
152 };
153
154 abe_lp_clk_div: abe_lp_clk_div {
155 #clock-cells = <0>;
156 compatible = "fixed-factor-clock";
157 clocks = <&dpll_abe_m2x2_ck>;
158 clock-mult = <1>;
159 clock-div = <16>;
160 };
161
162 dpll_abe_m3x2_ck: dpll_abe_m3x2_ck {
163 #clock-cells = <0>;
164 compatible = "ti,divider-clock";
165 clocks = <&dpll_abe_x2_ck>;
166 ti,max-div = <31>;
167 ti,autoidle-shift = <8>;
168 reg = <0x01f4>;
169 ti,index-starts-at-one;
170 ti,invert-autoidle-bit;
171 };
172
173 dpll_core_ck: dpll_core_ck {
174 #clock-cells = <0>;
175 compatible = "ti,omap4-dpll-core-clock";
176 clocks = <&sys_clkin>, <&dpll_abe_m3x2_ck>;
177 reg = <0x0120>, <0x0124>, <0x012c>, <0x0128>;
178 };
179
180 dpll_core_x2_ck: dpll_core_x2_ck {
181 #clock-cells = <0>;
182 compatible = "ti,omap4-dpll-x2-clock";
183 clocks = <&dpll_core_ck>;
184 };
185
186 dpll_core_h21x2_ck: dpll_core_h21x2_ck {
187 #clock-cells = <0>;
188 compatible = "ti,divider-clock";
189 clocks = <&dpll_core_x2_ck>;
190 ti,max-div = <63>;
191 ti,autoidle-shift = <8>;
192 reg = <0x0150>;
193 ti,index-starts-at-one;
194 ti,invert-autoidle-bit;
195 };
196
197 c2c_fclk: c2c_fclk {
198 #clock-cells = <0>;
199 compatible = "fixed-factor-clock";
200 clocks = <&dpll_core_h21x2_ck>;
201 clock-mult = <1>;
202 clock-div = <1>;
203 };
204
205 c2c_iclk: c2c_iclk {
206 #clock-cells = <0>;
207 compatible = "fixed-factor-clock";
208 clocks = <&c2c_fclk>;
209 clock-mult = <1>;
210 clock-div = <2>;
211 };
212
213 dpll_core_h11x2_ck: dpll_core_h11x2_ck {
214 #clock-cells = <0>;
215 compatible = "ti,divider-clock";
216 clocks = <&dpll_core_x2_ck>;
217 ti,max-div = <63>;
218 ti,autoidle-shift = <8>;
219 reg = <0x0138>;
220 ti,index-starts-at-one;
221 ti,invert-autoidle-bit;
222 };
223
224 dpll_core_h12x2_ck: dpll_core_h12x2_ck {
225 #clock-cells = <0>;
226 compatible = "ti,divider-clock";
227 clocks = <&dpll_core_x2_ck>;
228 ti,max-div = <63>;
229 ti,autoidle-shift = <8>;
230 reg = <0x013c>;
231 ti,index-starts-at-one;
232 ti,invert-autoidle-bit;
233 };
234
235 dpll_core_h13x2_ck: dpll_core_h13x2_ck {
236 #clock-cells = <0>;
237 compatible = "ti,divider-clock";
238 clocks = <&dpll_core_x2_ck>;
239 ti,max-div = <63>;
240 ti,autoidle-shift = <8>;
241 reg = <0x0140>;
242 ti,index-starts-at-one;
243 ti,invert-autoidle-bit;
244 };
245
246 dpll_core_h14x2_ck: dpll_core_h14x2_ck {
247 #clock-cells = <0>;
248 compatible = "ti,divider-clock";
249 clocks = <&dpll_core_x2_ck>;
250 ti,max-div = <63>;
251 ti,autoidle-shift = <8>;
252 reg = <0x0144>;
253 ti,index-starts-at-one;
254 ti,invert-autoidle-bit;
255 };
256
257 dpll_core_h22x2_ck: dpll_core_h22x2_ck {
258 #clock-cells = <0>;
259 compatible = "ti,divider-clock";
260 clocks = <&dpll_core_x2_ck>;
261 ti,max-div = <63>;
262 ti,autoidle-shift = <8>;
263 reg = <0x0154>;
264 ti,index-starts-at-one;
265 ti,invert-autoidle-bit;
266 };
267
268 dpll_core_h23x2_ck: dpll_core_h23x2_ck {
269 #clock-cells = <0>;
270 compatible = "ti,divider-clock";
271 clocks = <&dpll_core_x2_ck>;
272 ti,max-div = <63>;
273 ti,autoidle-shift = <8>;
274 reg = <0x0158>;
275 ti,index-starts-at-one;
276 ti,invert-autoidle-bit;
277 };
278
279 dpll_core_h24x2_ck: dpll_core_h24x2_ck {
280 #clock-cells = <0>;
281 compatible = "ti,divider-clock";
282 clocks = <&dpll_core_x2_ck>;
283 ti,max-div = <63>;
284 ti,autoidle-shift = <8>;
285 reg = <0x015c>;
286 ti,index-starts-at-one;
287 ti,invert-autoidle-bit;
288 };
289
290 dpll_core_m2_ck: dpll_core_m2_ck {
291 #clock-cells = <0>;
292 compatible = "ti,divider-clock";
293 clocks = <&dpll_core_ck>;
294 ti,max-div = <31>;
295 ti,autoidle-shift = <8>;
296 reg = <0x0130>;
297 ti,index-starts-at-one;
298 ti,invert-autoidle-bit;
299 };
300
301 dpll_core_m3x2_ck: dpll_core_m3x2_ck {
302 #clock-cells = <0>;
303 compatible = "ti,divider-clock";
304 clocks = <&dpll_core_x2_ck>;
305 ti,max-div = <31>;
306 ti,autoidle-shift = <8>;
307 reg = <0x0134>;
308 ti,index-starts-at-one;
309 ti,invert-autoidle-bit;
310 };
311
312 iva_dpll_hs_clk_div: iva_dpll_hs_clk_div {
313 #clock-cells = <0>;
314 compatible = "fixed-factor-clock";
315 clocks = <&dpll_core_h12x2_ck>;
316 clock-mult = <1>;
317 clock-div = <1>;
318 };
319
320 dpll_iva_ck: dpll_iva_ck {
321 #clock-cells = <0>;
322 compatible = "ti,omap4-dpll-clock";
323 clocks = <&sys_clkin>, <&iva_dpll_hs_clk_div>;
324 reg = <0x01a0>, <0x01a4>, <0x01ac>, <0x01a8>;
325 };
326
327 dpll_iva_x2_ck: dpll_iva_x2_ck {
328 #clock-cells = <0>;
329 compatible = "ti,omap4-dpll-x2-clock";
330 clocks = <&dpll_iva_ck>;
331 };
332
333 dpll_iva_h11x2_ck: dpll_iva_h11x2_ck {
334 #clock-cells = <0>;
335 compatible = "ti,divider-clock";
336 clocks = <&dpll_iva_x2_ck>;
337 ti,max-div = <63>;
338 ti,autoidle-shift = <8>;
339 reg = <0x01b8>;
340 ti,index-starts-at-one;
341 ti,invert-autoidle-bit;
342 };
343
344 dpll_iva_h12x2_ck: dpll_iva_h12x2_ck {
345 #clock-cells = <0>;
346 compatible = "ti,divider-clock";
347 clocks = <&dpll_iva_x2_ck>;
348 ti,max-div = <63>;
349 ti,autoidle-shift = <8>;
350 reg = <0x01bc>;
351 ti,index-starts-at-one;
352 ti,invert-autoidle-bit;
353 };
354
355 mpu_dpll_hs_clk_div: mpu_dpll_hs_clk_div {
356 #clock-cells = <0>;
357 compatible = "fixed-factor-clock";
358 clocks = <&dpll_core_h12x2_ck>;
359 clock-mult = <1>;
360 clock-div = <1>;
361 };
362
363 dpll_mpu_ck: dpll_mpu_ck {
364 #clock-cells = <0>;
365 compatible = "ti,omap4-dpll-clock";
366 clocks = <&sys_clkin>, <&mpu_dpll_hs_clk_div>;
367 reg = <0x0160>, <0x0164>, <0x016c>, <0x0168>;
368 };
369
370 dpll_mpu_m2_ck: dpll_mpu_m2_ck {
371 #clock-cells = <0>;
372 compatible = "ti,divider-clock";
373 clocks = <&dpll_mpu_ck>;
374 ti,max-div = <31>;
375 ti,autoidle-shift = <8>;
376 reg = <0x0170>;
377 ti,index-starts-at-one;
378 ti,invert-autoidle-bit;
379 };
380
381 per_dpll_hs_clk_div: per_dpll_hs_clk_div {
382 #clock-cells = <0>;
383 compatible = "fixed-factor-clock";
384 clocks = <&dpll_abe_m3x2_ck>;
385 clock-mult = <1>;
386 clock-div = <2>;
387 };
388
389 usb_dpll_hs_clk_div: usb_dpll_hs_clk_div {
390 #clock-cells = <0>;
391 compatible = "fixed-factor-clock";
392 clocks = <&dpll_abe_m3x2_ck>;
393 clock-mult = <1>;
394 clock-div = <3>;
395 };
396
397 l3_iclk_div: l3_iclk_div {
398 #clock-cells = <0>;
399 compatible = "fixed-factor-clock";
400 clocks = <&dpll_core_h12x2_ck>;
401 clock-mult = <1>;
402 clock-div = <1>;
403 };
404
405 gpu_l3_iclk: gpu_l3_iclk {
406 #clock-cells = <0>;
407 compatible = "fixed-factor-clock";
408 clocks = <&l3_iclk_div>;
409 clock-mult = <1>;
410 clock-div = <1>;
411 };
412
413 l4_root_clk_div: l4_root_clk_div {
414 #clock-cells = <0>;
415 compatible = "fixed-factor-clock";
416 clocks = <&l3_iclk_div>;
417 clock-mult = <1>;
418 clock-div = <1>;
419 };
420
421 slimbus1_slimbus_clk: slimbus1_slimbus_clk {
422 #clock-cells = <0>;
423 compatible = "ti,gate-clock";
424 clocks = <&slimbus_clk>;
425 ti,bit-shift = <11>;
426 reg = <0x0560>;
427 };
428
429 aess_fclk: aess_fclk {
430 #clock-cells = <0>;
431 compatible = "ti,divider-clock";
432 clocks = <&abe_clk>;
433 ti,bit-shift = <24>;
434 ti,max-div = <2>;
435 reg = <0x0528>;
436 };
437
438 dmic_sync_mux_ck: dmic_sync_mux_ck {
439 #clock-cells = <0>;
440 compatible = "ti,mux-clock";
441 clocks = <&abe_24m_fclk>, <&dss_syc_gfclk_div>, <&func_24m_clk>;
442 ti,bit-shift = <26>;
443 reg = <0x0538>;
444 };
445
446 dmic_gfclk: dmic_gfclk {
447 #clock-cells = <0>;
448 compatible = "ti,mux-clock";
449 clocks = <&dmic_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
450 ti,bit-shift = <24>;
451 reg = <0x0538>;
452 };
453
454 mcasp_sync_mux_ck: mcasp_sync_mux_ck {
455 #clock-cells = <0>;
456 compatible = "ti,mux-clock";
457 clocks = <&abe_24m_fclk>, <&dss_syc_gfclk_div>, <&func_24m_clk>;
458 ti,bit-shift = <26>;
459 reg = <0x0540>;
460 };
461
462 mcasp_gfclk: mcasp_gfclk {
463 #clock-cells = <0>;
464 compatible = "ti,mux-clock";
465 clocks = <&mcasp_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
466 ti,bit-shift = <24>;
467 reg = <0x0540>;
468 };
469
470 mcbsp1_sync_mux_ck: mcbsp1_sync_mux_ck {
471 #clock-cells = <0>;
472 compatible = "ti,mux-clock";
473 clocks = <&abe_24m_fclk>, <&dss_syc_gfclk_div>, <&func_24m_clk>;
474 ti,bit-shift = <26>;
475 reg = <0x0548>;
476 };
477
478 mcbsp1_gfclk: mcbsp1_gfclk {
479 #clock-cells = <0>;
480 compatible = "ti,mux-clock";
481 clocks = <&mcbsp1_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
482 ti,bit-shift = <24>;
483 reg = <0x0548>;
484 };
485
486 mcbsp2_sync_mux_ck: mcbsp2_sync_mux_ck {
487 #clock-cells = <0>;
488 compatible = "ti,mux-clock";
489 clocks = <&abe_24m_fclk>, <&dss_syc_gfclk_div>, <&func_24m_clk>;
490 ti,bit-shift = <26>;
491 reg = <0x0550>;
492 };
493
494 mcbsp2_gfclk: mcbsp2_gfclk {
495 #clock-cells = <0>;
496 compatible = "ti,mux-clock";
497 clocks = <&mcbsp2_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
498 ti,bit-shift = <24>;
499 reg = <0x0550>;
500 };
501
502 mcbsp3_sync_mux_ck: mcbsp3_sync_mux_ck {
503 #clock-cells = <0>;
504 compatible = "ti,mux-clock";
505 clocks = <&abe_24m_fclk>, <&dss_syc_gfclk_div>, <&func_24m_clk>;
506 ti,bit-shift = <26>;
507 reg = <0x0558>;
508 };
509
510 mcbsp3_gfclk: mcbsp3_gfclk {
511 #clock-cells = <0>;
512 compatible = "ti,mux-clock";
513 clocks = <&mcbsp3_sync_mux_ck>, <&pad_clks_ck>, <&slimbus_clk>;
514 ti,bit-shift = <24>;
515 reg = <0x0558>;
516 };
517
518 timer5_gfclk_mux: timer5_gfclk_mux {
519 #clock-cells = <0>;
520 compatible = "ti,mux-clock";
521 clocks = <&dss_syc_gfclk_div>, <&sys_32k_ck>;
522 ti,bit-shift = <24>;
523 reg = <0x0568>;
524 };
525
526 timer6_gfclk_mux: timer6_gfclk_mux {
527 #clock-cells = <0>;
528 compatible = "ti,mux-clock";
529 clocks = <&dss_syc_gfclk_div>, <&sys_32k_ck>;
530 ti,bit-shift = <24>;
531 reg = <0x0570>;
532 };
533
534 timer7_gfclk_mux: timer7_gfclk_mux {
535 #clock-cells = <0>;
536 compatible = "ti,mux-clock";
537 clocks = <&dss_syc_gfclk_div>, <&sys_32k_ck>;
538 ti,bit-shift = <24>;
539 reg = <0x0578>;
540 };
541
542 timer8_gfclk_mux: timer8_gfclk_mux {
543 #clock-cells = <0>;
544 compatible = "ti,mux-clock";
545 clocks = <&dss_syc_gfclk_div>, <&sys_32k_ck>;
546 ti,bit-shift = <24>;
547 reg = <0x0580>;
548 };
549
550 dummy_ck: dummy_ck {
551 #clock-cells = <0>;
552 compatible = "fixed-clock";
553 clock-frequency = <0>;
554 };
555};
556&prm_clocks {
557 sys_clkin: sys_clkin {
558 #clock-cells = <0>;
559 compatible = "ti,mux-clock";
560 clocks = <&virt_12000000_ck>, <&virt_13000000_ck>, <&virt_16800000_ck>, <&virt_19200000_ck>, <&virt_26000000_ck>, <&virt_27000000_ck>, <&virt_38400000_ck>;
561 reg = <0x0110>;
562 ti,index-starts-at-one;
563 };
564
565 abe_dpll_bypass_clk_mux: abe_dpll_bypass_clk_mux {
566 #clock-cells = <0>;
567 compatible = "ti,mux-clock";
568 clocks = <&sys_clkin>, <&sys_32k_ck>;
569 reg = <0x0108>;
570 };
571
572 abe_dpll_clk_mux: abe_dpll_clk_mux {
573 #clock-cells = <0>;
574 compatible = "ti,mux-clock";
575 clocks = <&sys_clkin>, <&sys_32k_ck>;
576 reg = <0x010c>;
577 };
578
579 custefuse_sys_gfclk_div: custefuse_sys_gfclk_div {
580 #clock-cells = <0>;
581 compatible = "fixed-factor-clock";
582 clocks = <&sys_clkin>;
583 clock-mult = <1>;
584 clock-div = <2>;
585 };
586
587 dss_syc_gfclk_div: dss_syc_gfclk_div {
588 #clock-cells = <0>;
589 compatible = "fixed-factor-clock";
590 clocks = <&sys_clkin>;
591 clock-mult = <1>;
592 clock-div = <1>;
593 };
594
595 wkupaon_iclk_mux: wkupaon_iclk_mux {
596 #clock-cells = <0>;
597 compatible = "ti,mux-clock";
598 clocks = <&sys_clkin>, <&abe_lp_clk_div>;
599 reg = <0x0108>;
600 };
601
602 l3instr_ts_gclk_div: l3instr_ts_gclk_div {
603 #clock-cells = <0>;
604 compatible = "fixed-factor-clock";
605 clocks = <&wkupaon_iclk_mux>;
606 clock-mult = <1>;
607 clock-div = <1>;
608 };
609
610 gpio1_dbclk: gpio1_dbclk {
611 #clock-cells = <0>;
612 compatible = "ti,gate-clock";
613 clocks = <&sys_32k_ck>;
614 ti,bit-shift = <8>;
615 reg = <0x1938>;
616 };
617
618 timer1_gfclk_mux: timer1_gfclk_mux {
619 #clock-cells = <0>;
620 compatible = "ti,mux-clock";
621 clocks = <&sys_clkin>, <&sys_32k_ck>;
622 ti,bit-shift = <24>;
623 reg = <0x1940>;
624 };
625};
626&cm_core_clocks {
627 dpll_per_ck: dpll_per_ck {
628 #clock-cells = <0>;
629 compatible = "ti,omap4-dpll-clock";
630 clocks = <&sys_clkin>, <&per_dpll_hs_clk_div>;
631 reg = <0x0140>, <0x0144>, <0x014c>, <0x0148>;
632 };
633
634 dpll_per_x2_ck: dpll_per_x2_ck {
635 #clock-cells = <0>;
636 compatible = "ti,omap4-dpll-x2-clock";
637 clocks = <&dpll_per_ck>;
638 };
639
640 dpll_per_h11x2_ck: dpll_per_h11x2_ck {
641 #clock-cells = <0>;
642 compatible = "ti,divider-clock";
643 clocks = <&dpll_per_x2_ck>;
644 ti,max-div = <63>;
645 ti,autoidle-shift = <8>;
646 reg = <0x0158>;
647 ti,index-starts-at-one;
648 ti,invert-autoidle-bit;
649 };
650
651 dpll_per_h12x2_ck: dpll_per_h12x2_ck {
652 #clock-cells = <0>;
653 compatible = "ti,divider-clock";
654 clocks = <&dpll_per_x2_ck>;
655 ti,max-div = <63>;
656 ti,autoidle-shift = <8>;
657 reg = <0x015c>;
658 ti,index-starts-at-one;
659 ti,invert-autoidle-bit;
660 };
661
662 dpll_per_h14x2_ck: dpll_per_h14x2_ck {
663 #clock-cells = <0>;
664 compatible = "ti,divider-clock";
665 clocks = <&dpll_per_x2_ck>;
666 ti,max-div = <63>;
667 ti,autoidle-shift = <8>;
668 reg = <0x0164>;
669 ti,index-starts-at-one;
670 ti,invert-autoidle-bit;
671 };
672
673 dpll_per_m2_ck: dpll_per_m2_ck {
674 #clock-cells = <0>;
675 compatible = "ti,divider-clock";
676 clocks = <&dpll_per_ck>;
677 ti,max-div = <31>;
678 ti,autoidle-shift = <8>;
679 reg = <0x0150>;
680 ti,index-starts-at-one;
681 ti,invert-autoidle-bit;
682 };
683
684 dpll_per_m2x2_ck: dpll_per_m2x2_ck {
685 #clock-cells = <0>;
686 compatible = "ti,divider-clock";
687 clocks = <&dpll_per_x2_ck>;
688 ti,max-div = <31>;
689 ti,autoidle-shift = <8>;
690 reg = <0x0150>;
691 ti,index-starts-at-one;
692 ti,invert-autoidle-bit;
693 };
694
695 dpll_per_m3x2_ck: dpll_per_m3x2_ck {
696 #clock-cells = <0>;
697 compatible = "ti,divider-clock";
698 clocks = <&dpll_per_x2_ck>;
699 ti,max-div = <31>;
700 ti,autoidle-shift = <8>;
701 reg = <0x0154>;
702 ti,index-starts-at-one;
703 ti,invert-autoidle-bit;
704 };
705
706 dpll_unipro1_ck: dpll_unipro1_ck {
707 #clock-cells = <0>;
708 compatible = "ti,omap4-dpll-clock";
709 clocks = <&sys_clkin>, <&sys_clkin>;
710 reg = <0x0200>, <0x0204>, <0x020c>, <0x0208>;
711 };
712
713 dpll_unipro1_clkdcoldo: dpll_unipro1_clkdcoldo {
714 #clock-cells = <0>;
715 compatible = "fixed-factor-clock";
716 clocks = <&dpll_unipro1_ck>;
717 clock-mult = <1>;
718 clock-div = <1>;
719 };
720
721 dpll_unipro1_m2_ck: dpll_unipro1_m2_ck {
722 #clock-cells = <0>;
723 compatible = "ti,divider-clock";
724 clocks = <&dpll_unipro1_ck>;
725 ti,max-div = <127>;
726 ti,autoidle-shift = <8>;
727 reg = <0x0210>;
728 ti,index-starts-at-one;
729 ti,invert-autoidle-bit;
730 };
731
732 dpll_unipro2_ck: dpll_unipro2_ck {
733 #clock-cells = <0>;
734 compatible = "ti,omap4-dpll-clock";
735 clocks = <&sys_clkin>, <&sys_clkin>;
736 reg = <0x01c0>, <0x01c4>, <0x01cc>, <0x01c8>;
737 };
738
739 dpll_unipro2_clkdcoldo: dpll_unipro2_clkdcoldo {
740 #clock-cells = <0>;
741 compatible = "fixed-factor-clock";
742 clocks = <&dpll_unipro2_ck>;
743 clock-mult = <1>;
744 clock-div = <1>;
745 };
746
747 dpll_unipro2_m2_ck: dpll_unipro2_m2_ck {
748 #clock-cells = <0>;
749 compatible = "ti,divider-clock";
750 clocks = <&dpll_unipro2_ck>;
751 ti,max-div = <127>;
752 ti,autoidle-shift = <8>;
753 reg = <0x01d0>;
754 ti,index-starts-at-one;
755 ti,invert-autoidle-bit;
756 };
757
758 dpll_usb_ck: dpll_usb_ck {
759 #clock-cells = <0>;
760 compatible = "ti,omap4-dpll-j-type-clock";
761 clocks = <&sys_clkin>, <&usb_dpll_hs_clk_div>;
762 reg = <0x0180>, <0x0184>, <0x018c>, <0x0188>;
763 };
764
765 dpll_usb_clkdcoldo: dpll_usb_clkdcoldo {
766 #clock-cells = <0>;
767 compatible = "fixed-factor-clock";
768 clocks = <&dpll_usb_ck>;
769 clock-mult = <1>;
770 clock-div = <1>;
771 };
772
773 dpll_usb_m2_ck: dpll_usb_m2_ck {
774 #clock-cells = <0>;
775 compatible = "ti,divider-clock";
776 clocks = <&dpll_usb_ck>;
777 ti,max-div = <127>;
778 ti,autoidle-shift = <8>;
779 reg = <0x0190>;
780 ti,index-starts-at-one;
781 ti,invert-autoidle-bit;
782 };
783
784 func_128m_clk: func_128m_clk {
785 #clock-cells = <0>;
786 compatible = "fixed-factor-clock";
787 clocks = <&dpll_per_h11x2_ck>;
788 clock-mult = <1>;
789 clock-div = <2>;
790 };
791
792 func_12m_fclk: func_12m_fclk {
793 #clock-cells = <0>;
794 compatible = "fixed-factor-clock";
795 clocks = <&dpll_per_m2x2_ck>;
796 clock-mult = <1>;
797 clock-div = <16>;
798 };
799
800 func_24m_clk: func_24m_clk {
801 #clock-cells = <0>;
802 compatible = "fixed-factor-clock";
803 clocks = <&dpll_per_m2_ck>;
804 clock-mult = <1>;
805 clock-div = <4>;
806 };
807
808 func_48m_fclk: func_48m_fclk {
809 #clock-cells = <0>;
810 compatible = "fixed-factor-clock";
811 clocks = <&dpll_per_m2x2_ck>;
812 clock-mult = <1>;
813 clock-div = <4>;
814 };
815
816 func_96m_fclk: func_96m_fclk {
817 #clock-cells = <0>;
818 compatible = "fixed-factor-clock";
819 clocks = <&dpll_per_m2x2_ck>;
820 clock-mult = <1>;
821 clock-div = <2>;
822 };
823
824 l3init_60m_fclk: l3init_60m_fclk {
825 #clock-cells = <0>;
826 compatible = "ti,divider-clock";
827 clocks = <&dpll_usb_m2_ck>;
828 reg = <0x0104>;
829 ti,dividers = <1>, <8>;
830 };
831
832 dss_32khz_clk: dss_32khz_clk {
833 #clock-cells = <0>;
834 compatible = "ti,gate-clock";
835 clocks = <&sys_32k_ck>;
836 ti,bit-shift = <11>;
837 reg = <0x1420>;
838 };
839
840 dss_48mhz_clk: dss_48mhz_clk {
841 #clock-cells = <0>;
842 compatible = "ti,gate-clock";
843 clocks = <&func_48m_fclk>;
844 ti,bit-shift = <9>;
845 reg = <0x1420>;
846 };
847
848 dss_dss_clk: dss_dss_clk {
849 #clock-cells = <0>;
850 compatible = "ti,gate-clock";
851 clocks = <&dpll_per_h12x2_ck>;
852 ti,bit-shift = <8>;
853 reg = <0x1420>;
854 };
855
856 dss_sys_clk: dss_sys_clk {
857 #clock-cells = <0>;
858 compatible = "ti,gate-clock";
859 clocks = <&dss_syc_gfclk_div>;
860 ti,bit-shift = <10>;
861 reg = <0x1420>;
862 };
863
864 gpio2_dbclk: gpio2_dbclk {
865 #clock-cells = <0>;
866 compatible = "ti,gate-clock";
867 clocks = <&sys_32k_ck>;
868 ti,bit-shift = <8>;
869 reg = <0x1060>;
870 };
871
872 gpio3_dbclk: gpio3_dbclk {
873 #clock-cells = <0>;
874 compatible = "ti,gate-clock";
875 clocks = <&sys_32k_ck>;
876 ti,bit-shift = <8>;
877 reg = <0x1068>;
878 };
879
880 gpio4_dbclk: gpio4_dbclk {
881 #clock-cells = <0>;
882 compatible = "ti,gate-clock";
883 clocks = <&sys_32k_ck>;
884 ti,bit-shift = <8>;
885 reg = <0x1070>;
886 };
887
888 gpio5_dbclk: gpio5_dbclk {
889 #clock-cells = <0>;
890 compatible = "ti,gate-clock";
891 clocks = <&sys_32k_ck>;
892 ti,bit-shift = <8>;
893 reg = <0x1078>;
894 };
895
896 gpio6_dbclk: gpio6_dbclk {
897 #clock-cells = <0>;
898 compatible = "ti,gate-clock";
899 clocks = <&sys_32k_ck>;
900 ti,bit-shift = <8>;
901 reg = <0x1080>;
902 };
903
904 gpio7_dbclk: gpio7_dbclk {
905 #clock-cells = <0>;
906 compatible = "ti,gate-clock";
907 clocks = <&sys_32k_ck>;
908 ti,bit-shift = <8>;
909 reg = <0x1110>;
910 };
911
912 gpio8_dbclk: gpio8_dbclk {
913 #clock-cells = <0>;
914 compatible = "ti,gate-clock";
915 clocks = <&sys_32k_ck>;
916 ti,bit-shift = <8>;
917 reg = <0x1118>;
918 };
919
920 iss_ctrlclk: iss_ctrlclk {
921 #clock-cells = <0>;
922 compatible = "ti,gate-clock";
923 clocks = <&func_96m_fclk>;
924 ti,bit-shift = <8>;
925 reg = <0x1320>;
926 };
927
928 lli_txphy_clk: lli_txphy_clk {
929 #clock-cells = <0>;
930 compatible = "ti,gate-clock";
931 clocks = <&dpll_unipro1_clkdcoldo>;
932 ti,bit-shift = <8>;
933 reg = <0x0f20>;
934 };
935
936 lli_txphy_ls_clk: lli_txphy_ls_clk {
937 #clock-cells = <0>;
938 compatible = "ti,gate-clock";
939 clocks = <&dpll_unipro1_m2_ck>;
940 ti,bit-shift = <9>;
941 reg = <0x0f20>;
942 };
943
944 mmc1_32khz_clk: mmc1_32khz_clk {
945 #clock-cells = <0>;
946 compatible = "ti,gate-clock";
947 clocks = <&sys_32k_ck>;
948 ti,bit-shift = <8>;
949 reg = <0x1628>;
950 };
951
952 sata_ref_clk: sata_ref_clk {
953 #clock-cells = <0>;
954 compatible = "ti,gate-clock";
955 clocks = <&sys_clkin>;
956 ti,bit-shift = <8>;
957 reg = <0x1688>;
958 };
959
960 usb_host_hs_hsic480m_p1_clk: usb_host_hs_hsic480m_p1_clk {
961 #clock-cells = <0>;
962 compatible = "ti,gate-clock";
963 clocks = <&dpll_usb_m2_ck>;
964 ti,bit-shift = <13>;
965 reg = <0x1658>;
966 };
967
968 usb_host_hs_hsic480m_p2_clk: usb_host_hs_hsic480m_p2_clk {
969 #clock-cells = <0>;
970 compatible = "ti,gate-clock";
971 clocks = <&dpll_usb_m2_ck>;
972 ti,bit-shift = <14>;
973 reg = <0x1658>;
974 };
975
976 usb_host_hs_hsic480m_p3_clk: usb_host_hs_hsic480m_p3_clk {
977 #clock-cells = <0>;
978 compatible = "ti,gate-clock";
979 clocks = <&dpll_usb_m2_ck>;
980 ti,bit-shift = <7>;
981 reg = <0x1658>;
982 };
983
984 usb_host_hs_hsic60m_p1_clk: usb_host_hs_hsic60m_p1_clk {
985 #clock-cells = <0>;
986 compatible = "ti,gate-clock";
987 clocks = <&l3init_60m_fclk>;
988 ti,bit-shift = <11>;
989 reg = <0x1658>;
990 };
991
992 usb_host_hs_hsic60m_p2_clk: usb_host_hs_hsic60m_p2_clk {
993 #clock-cells = <0>;
994 compatible = "ti,gate-clock";
995 clocks = <&l3init_60m_fclk>;
996 ti,bit-shift = <12>;
997 reg = <0x1658>;
998 };
999
1000 usb_host_hs_hsic60m_p3_clk: usb_host_hs_hsic60m_p3_clk {
1001 #clock-cells = <0>;
1002 compatible = "ti,gate-clock";
1003 clocks = <&l3init_60m_fclk>;
1004 ti,bit-shift = <6>;
1005 reg = <0x1658>;
1006 };
1007
1008 utmi_p1_gfclk: utmi_p1_gfclk {
1009 #clock-cells = <0>;
1010 compatible = "ti,mux-clock";
1011 clocks = <&l3init_60m_fclk>, <&xclk60mhsp1_ck>;
1012 ti,bit-shift = <24>;
1013 reg = <0x1658>;
1014 };
1015
1016 usb_host_hs_utmi_p1_clk: usb_host_hs_utmi_p1_clk {
1017 #clock-cells = <0>;
1018 compatible = "ti,gate-clock";
1019 clocks = <&utmi_p1_gfclk>;
1020 ti,bit-shift = <8>;
1021 reg = <0x1658>;
1022 };
1023
1024 utmi_p2_gfclk: utmi_p2_gfclk {
1025 #clock-cells = <0>;
1026 compatible = "ti,mux-clock";
1027 clocks = <&l3init_60m_fclk>, <&xclk60mhsp2_ck>;
1028 ti,bit-shift = <25>;
1029 reg = <0x1658>;
1030 };
1031
1032 usb_host_hs_utmi_p2_clk: usb_host_hs_utmi_p2_clk {
1033 #clock-cells = <0>;
1034 compatible = "ti,gate-clock";
1035 clocks = <&utmi_p2_gfclk>;
1036 ti,bit-shift = <9>;
1037 reg = <0x1658>;
1038 };
1039
1040 usb_host_hs_utmi_p3_clk: usb_host_hs_utmi_p3_clk {
1041 #clock-cells = <0>;
1042 compatible = "ti,gate-clock";
1043 clocks = <&l3init_60m_fclk>;
1044 ti,bit-shift = <10>;
1045 reg = <0x1658>;
1046 };
1047
1048 usb_otg_ss_refclk960m: usb_otg_ss_refclk960m {
1049 #clock-cells = <0>;
1050 compatible = "ti,gate-clock";
1051 clocks = <&dpll_usb_clkdcoldo>;
1052 ti,bit-shift = <8>;
1053 reg = <0x16f0>;
1054 };
1055
1056 usb_phy_cm_clk32k: usb_phy_cm_clk32k {
1057 #clock-cells = <0>;
1058 compatible = "ti,gate-clock";
1059 clocks = <&sys_32k_ck>;
1060 ti,bit-shift = <8>;
1061 reg = <0x0640>;
1062 };
1063
1064 usb_tll_hs_usb_ch0_clk: usb_tll_hs_usb_ch0_clk {
1065 #clock-cells = <0>;
1066 compatible = "ti,gate-clock";
1067 clocks = <&l3init_60m_fclk>;
1068 ti,bit-shift = <8>;
1069 reg = <0x1668>;
1070 };
1071
1072 usb_tll_hs_usb_ch1_clk: usb_tll_hs_usb_ch1_clk {
1073 #clock-cells = <0>;
1074 compatible = "ti,gate-clock";
1075 clocks = <&l3init_60m_fclk>;
1076 ti,bit-shift = <9>;
1077 reg = <0x1668>;
1078 };
1079
1080 usb_tll_hs_usb_ch2_clk: usb_tll_hs_usb_ch2_clk {
1081 #clock-cells = <0>;
1082 compatible = "ti,gate-clock";
1083 clocks = <&l3init_60m_fclk>;
1084 ti,bit-shift = <10>;
1085 reg = <0x1668>;
1086 };
1087
1088 fdif_fclk: fdif_fclk {
1089 #clock-cells = <0>;
1090 compatible = "ti,divider-clock";
1091 clocks = <&dpll_per_h11x2_ck>;
1092 ti,bit-shift = <24>;
1093 ti,max-div = <2>;
1094 reg = <0x1328>;
1095 };
1096
1097 gpu_core_gclk_mux: gpu_core_gclk_mux {
1098 #clock-cells = <0>;
1099 compatible = "ti,mux-clock";
1100 clocks = <&dpll_core_h14x2_ck>, <&dpll_per_h14x2_ck>;
1101 ti,bit-shift = <24>;
1102 reg = <0x1520>;
1103 };
1104
1105 gpu_hyd_gclk_mux: gpu_hyd_gclk_mux {
1106 #clock-cells = <0>;
1107 compatible = "ti,mux-clock";
1108 clocks = <&dpll_core_h14x2_ck>, <&dpll_per_h14x2_ck>;
1109 ti,bit-shift = <25>;
1110 reg = <0x1520>;
1111 };
1112
1113 hsi_fclk: hsi_fclk {
1114 #clock-cells = <0>;
1115 compatible = "ti,divider-clock";
1116 clocks = <&dpll_per_m2x2_ck>;
1117 ti,bit-shift = <24>;
1118 ti,max-div = <2>;
1119 reg = <0x1638>;
1120 };
1121
1122 mmc1_fclk_mux: mmc1_fclk_mux {
1123 #clock-cells = <0>;
1124 compatible = "ti,mux-clock";
1125 clocks = <&func_128m_clk>, <&dpll_per_m2x2_ck>;
1126 ti,bit-shift = <24>;
1127 reg = <0x1628>;
1128 };
1129
1130 mmc1_fclk: mmc1_fclk {
1131 #clock-cells = <0>;
1132 compatible = "ti,divider-clock";
1133 clocks = <&mmc1_fclk_mux>;
1134 ti,bit-shift = <25>;
1135 ti,max-div = <2>;
1136 reg = <0x1628>;
1137 };
1138
1139 mmc2_fclk_mux: mmc2_fclk_mux {
1140 #clock-cells = <0>;
1141 compatible = "ti,mux-clock";
1142 clocks = <&func_128m_clk>, <&dpll_per_m2x2_ck>;
1143 ti,bit-shift = <24>;
1144 reg = <0x1630>;
1145 };
1146
1147 mmc2_fclk: mmc2_fclk {
1148 #clock-cells = <0>;
1149 compatible = "ti,divider-clock";
1150 clocks = <&mmc2_fclk_mux>;
1151 ti,bit-shift = <25>;
1152 ti,max-div = <2>;
1153 reg = <0x1630>;
1154 };
1155
1156 timer10_gfclk_mux: timer10_gfclk_mux {
1157 #clock-cells = <0>;
1158 compatible = "ti,mux-clock";
1159 clocks = <&sys_clkin>, <&sys_32k_ck>;
1160 ti,bit-shift = <24>;
1161 reg = <0x1028>;
1162 };
1163
1164 timer11_gfclk_mux: timer11_gfclk_mux {
1165 #clock-cells = <0>;
1166 compatible = "ti,mux-clock";
1167 clocks = <&sys_clkin>, <&sys_32k_ck>;
1168 ti,bit-shift = <24>;
1169 reg = <0x1030>;
1170 };
1171
1172 timer2_gfclk_mux: timer2_gfclk_mux {
1173 #clock-cells = <0>;
1174 compatible = "ti,mux-clock";
1175 clocks = <&sys_clkin>, <&sys_32k_ck>;
1176 ti,bit-shift = <24>;
1177 reg = <0x1038>;
1178 };
1179
1180 timer3_gfclk_mux: timer3_gfclk_mux {
1181 #clock-cells = <0>;
1182 compatible = "ti,mux-clock";
1183 clocks = <&sys_clkin>, <&sys_32k_ck>;
1184 ti,bit-shift = <24>;
1185 reg = <0x1040>;
1186 };
1187
1188 timer4_gfclk_mux: timer4_gfclk_mux {
1189 #clock-cells = <0>;
1190 compatible = "ti,mux-clock";
1191 clocks = <&sys_clkin>, <&sys_32k_ck>;
1192 ti,bit-shift = <24>;
1193 reg = <0x1048>;
1194 };
1195
1196 timer9_gfclk_mux: timer9_gfclk_mux {
1197 #clock-cells = <0>;
1198 compatible = "ti,mux-clock";
1199 clocks = <&sys_clkin>, <&sys_32k_ck>;
1200 ti,bit-shift = <24>;
1201 reg = <0x1050>;
1202 };
1203};
1204
1205&cm_core_clockdomains {
1206 l3init_clkdm: l3init_clkdm {
1207 compatible = "ti,clockdomain";
1208 clocks = <&dpll_usb_ck>;
1209 };
1210};
1211
1212&scrm_clocks {
1213 auxclk0_src_gate_ck: auxclk0_src_gate_ck {
1214 #clock-cells = <0>;
1215 compatible = "ti,composite-no-wait-gate-clock";
1216 clocks = <&dpll_core_m3x2_ck>;
1217 ti,bit-shift = <8>;
1218 reg = <0x0310>;
1219 };
1220
1221 auxclk0_src_mux_ck: auxclk0_src_mux_ck {
1222 #clock-cells = <0>;
1223 compatible = "ti,composite-mux-clock";
1224 clocks = <&sys_clkin>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1225 ti,bit-shift = <1>;
1226 reg = <0x0310>;
1227 };
1228
1229 auxclk0_src_ck: auxclk0_src_ck {
1230 #clock-cells = <0>;
1231 compatible = "ti,composite-clock";
1232 clocks = <&auxclk0_src_gate_ck>, <&auxclk0_src_mux_ck>;
1233 };
1234
1235 auxclk0_ck: auxclk0_ck {
1236 #clock-cells = <0>;
1237 compatible = "ti,divider-clock";
1238 clocks = <&auxclk0_src_ck>;
1239 ti,bit-shift = <16>;
1240 ti,max-div = <16>;
1241 reg = <0x0310>;
1242 };
1243
1244 auxclk1_src_gate_ck: auxclk1_src_gate_ck {
1245 #clock-cells = <0>;
1246 compatible = "ti,composite-no-wait-gate-clock";
1247 clocks = <&dpll_core_m3x2_ck>;
1248 ti,bit-shift = <8>;
1249 reg = <0x0314>;
1250 };
1251
1252 auxclk1_src_mux_ck: auxclk1_src_mux_ck {
1253 #clock-cells = <0>;
1254 compatible = "ti,composite-mux-clock";
1255 clocks = <&sys_clkin>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1256 ti,bit-shift = <1>;
1257 reg = <0x0314>;
1258 };
1259
1260 auxclk1_src_ck: auxclk1_src_ck {
1261 #clock-cells = <0>;
1262 compatible = "ti,composite-clock";
1263 clocks = <&auxclk1_src_gate_ck>, <&auxclk1_src_mux_ck>;
1264 };
1265
1266 auxclk1_ck: auxclk1_ck {
1267 #clock-cells = <0>;
1268 compatible = "ti,divider-clock";
1269 clocks = <&auxclk1_src_ck>;
1270 ti,bit-shift = <16>;
1271 ti,max-div = <16>;
1272 reg = <0x0314>;
1273 };
1274
1275 auxclk2_src_gate_ck: auxclk2_src_gate_ck {
1276 #clock-cells = <0>;
1277 compatible = "ti,composite-no-wait-gate-clock";
1278 clocks = <&dpll_core_m3x2_ck>;
1279 ti,bit-shift = <8>;
1280 reg = <0x0318>;
1281 };
1282
1283 auxclk2_src_mux_ck: auxclk2_src_mux_ck {
1284 #clock-cells = <0>;
1285 compatible = "ti,composite-mux-clock";
1286 clocks = <&sys_clkin>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1287 ti,bit-shift = <1>;
1288 reg = <0x0318>;
1289 };
1290
1291 auxclk2_src_ck: auxclk2_src_ck {
1292 #clock-cells = <0>;
1293 compatible = "ti,composite-clock";
1294 clocks = <&auxclk2_src_gate_ck>, <&auxclk2_src_mux_ck>;
1295 };
1296
1297 auxclk2_ck: auxclk2_ck {
1298 #clock-cells = <0>;
1299 compatible = "ti,divider-clock";
1300 clocks = <&auxclk2_src_ck>;
1301 ti,bit-shift = <16>;
1302 ti,max-div = <16>;
1303 reg = <0x0318>;
1304 };
1305
1306 auxclk3_src_gate_ck: auxclk3_src_gate_ck {
1307 #clock-cells = <0>;
1308 compatible = "ti,composite-no-wait-gate-clock";
1309 clocks = <&dpll_core_m3x2_ck>;
1310 ti,bit-shift = <8>;
1311 reg = <0x031c>;
1312 };
1313
1314 auxclk3_src_mux_ck: auxclk3_src_mux_ck {
1315 #clock-cells = <0>;
1316 compatible = "ti,composite-mux-clock";
1317 clocks = <&sys_clkin>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1318 ti,bit-shift = <1>;
1319 reg = <0x031c>;
1320 };
1321
1322 auxclk3_src_ck: auxclk3_src_ck {
1323 #clock-cells = <0>;
1324 compatible = "ti,composite-clock";
1325 clocks = <&auxclk3_src_gate_ck>, <&auxclk3_src_mux_ck>;
1326 };
1327
1328 auxclk3_ck: auxclk3_ck {
1329 #clock-cells = <0>;
1330 compatible = "ti,divider-clock";
1331 clocks = <&auxclk3_src_ck>;
1332 ti,bit-shift = <16>;
1333 ti,max-div = <16>;
1334 reg = <0x031c>;
1335 };
1336
1337 auxclk4_src_gate_ck: auxclk4_src_gate_ck {
1338 #clock-cells = <0>;
1339 compatible = "ti,composite-no-wait-gate-clock";
1340 clocks = <&dpll_core_m3x2_ck>;
1341 ti,bit-shift = <8>;
1342 reg = <0x0320>;
1343 };
1344
1345 auxclk4_src_mux_ck: auxclk4_src_mux_ck {
1346 #clock-cells = <0>;
1347 compatible = "ti,composite-mux-clock";
1348 clocks = <&sys_clkin>, <&dpll_core_m3x2_ck>, <&dpll_per_m3x2_ck>;
1349 ti,bit-shift = <1>;
1350 reg = <0x0320>;
1351 };
1352
1353 auxclk4_src_ck: auxclk4_src_ck {
1354 #clock-cells = <0>;
1355 compatible = "ti,composite-clock";
1356 clocks = <&auxclk4_src_gate_ck>, <&auxclk4_src_mux_ck>;
1357 };
1358
1359 auxclk4_ck: auxclk4_ck {
1360 #clock-cells = <0>;
1361 compatible = "ti,divider-clock";
1362 clocks = <&auxclk4_src_ck>;
1363 ti,bit-shift = <16>;
1364 ti,max-div = <16>;
1365 reg = <0x0320>;
1366 };
1367
1368 auxclkreq0_ck: auxclkreq0_ck {
1369 #clock-cells = <0>;
1370 compatible = "ti,mux-clock";
1371 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>;
1372 ti,bit-shift = <2>;
1373 reg = <0x0210>;
1374 };
1375
1376 auxclkreq1_ck: auxclkreq1_ck {
1377 #clock-cells = <0>;
1378 compatible = "ti,mux-clock";
1379 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>;
1380 ti,bit-shift = <2>;
1381 reg = <0x0214>;
1382 };
1383
1384 auxclkreq2_ck: auxclkreq2_ck {
1385 #clock-cells = <0>;
1386 compatible = "ti,mux-clock";
1387 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>;
1388 ti,bit-shift = <2>;
1389 reg = <0x0218>;
1390 };
1391
1392 auxclkreq3_ck: auxclkreq3_ck {
1393 #clock-cells = <0>;
1394 compatible = "ti,mux-clock";
1395 clocks = <&auxclk0_ck>, <&auxclk1_ck>, <&auxclk2_ck>, <&auxclk3_ck>, <&auxclk4_ck>;
1396 ti,bit-shift = <2>;
1397 reg = <0x021c>;
1398 };
1399};
diff --git a/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts b/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
index aed83deaa991..5ed6c1376901 100644
--- a/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
+++ b/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
@@ -58,7 +58,6 @@
58 status = "okay"; 58 status = "okay";
59 59
60 ethphy: ethernet-phy { 60 ethphy: ethernet-phy {
61 device-type = "ethernet-phy";
62 reg = <8>; 61 reg = <8>;
63 }; 62 };
64}; 63};
diff --git a/arch/arm/boot/dts/orion5x.dtsi b/arch/arm/boot/dts/orion5x.dtsi
index e06c37e91ac6..174d89241f70 100644
--- a/arch/arm/boot/dts/orion5x.dtsi
+++ b/arch/arm/boot/dts/orion5x.dtsi
@@ -42,6 +42,25 @@
42 interrupts = <6>, <7>, <8>, <9>; 42 interrupts = <6>, <7>, <8>, <9>;
43 }; 43 };
44 44
45 spi@10600 {
46 compatible = "marvell,orion-spi";
47 #address-cells = <1>;
48 #size-cells = <0>;
49 cell-index = <0>;
50 reg = <0x10600 0x28>;
51 status = "disabled";
52 };
53
54 i2c@11000 {
55 compatible = "marvell,mv64xxx-i2c";
56 reg = <0x11000 0x20>;
57 #address-cells = <1>;
58 #size-cells = <0>;
59 interrupts = <5>;
60 clock-frequency = <100000>;
61 status = "disabled";
62 };
63
45 serial@12000 { 64 serial@12000 {
46 compatible = "ns16550a"; 65 compatible = "ns16550a";
47 reg = <0x12000 0x100>; 66 reg = <0x12000 0x100>;
@@ -60,15 +79,6 @@
60 status = "disabled"; 79 status = "disabled";
61 }; 80 };
62 81
63 spi@10600 {
64 compatible = "marvell,orion-spi";
65 #address-cells = <1>;
66 #size-cells = <0>;
67 cell-index = <0>;
68 reg = <0x10600 0x28>;
69 status = "disabled";
70 };
71
72 wdt@20300 { 82 wdt@20300 {
73 compatible = "marvell,orion-wdt"; 83 compatible = "marvell,orion-wdt";
74 reg = <0x20300 0x28>; 84 reg = <0x20300 0x28>;
@@ -82,30 +92,6 @@
82 status = "disabled"; 92 status = "disabled";
83 }; 93 };
84 94
85 ehci@a0000 {
86 compatible = "marvell,orion-ehci";
87 reg = <0xa0000 0x1000>;
88 interrupts = <12>;
89 status = "disabled";
90 };
91
92 sata@80000 {
93 compatible = "marvell,orion-sata";
94 reg = <0x80000 0x5000>;
95 interrupts = <29>;
96 status = "disabled";
97 };
98
99 i2c@11000 {
100 compatible = "marvell,mv64xxx-i2c";
101 reg = <0x11000 0x20>;
102 #address-cells = <1>;
103 #size-cells = <0>;
104 interrupts = <5>;
105 clock-frequency = <100000>;
106 status = "disabled";
107 };
108
109 xor@60900 { 95 xor@60900 {
110 compatible = "marvell,orion-xor"; 96 compatible = "marvell,orion-xor";
111 reg = <0x60900 0x100 97 reg = <0x60900 0x100
@@ -125,26 +111,6 @@
125 }; 111 };
126 }; 112 };
127 113
128 crypto@90000 {
129 compatible = "marvell,orion-crypto";
130 reg = <0x90000 0x10000>,
131 <0xf2200000 0x800>;
132 reg-names = "regs", "sram";
133 interrupts = <28>;
134 status = "okay";
135 };
136
137 mdio: mdio-bus@72004 {
138 compatible = "marvell,orion-mdio";
139 #address-cells = <1>;
140 #size-cells = <0>;
141 reg = <0x72004 0x84>;
142 interrupts = <22>;
143 status = "disabled";
144
145 /* add phy nodes in board file */
146 };
147
148 eth: ethernet-controller@72000 { 114 eth: ethernet-controller@72000 {
149 compatible = "marvell,orion-eth"; 115 compatible = "marvell,orion-eth";
150 #address-cells = <1>; 116 #address-cells = <1>;
@@ -154,7 +120,6 @@
154 status = "disabled"; 120 status = "disabled";
155 121
156 ethernet-port@0 { 122 ethernet-port@0 {
157 device_type = "network";
158 compatible = "marvell,orion-eth-port"; 123 compatible = "marvell,orion-eth-port";
159 reg = <0>; 124 reg = <0>;
160 /* overwrite MAC address in bootloader */ 125 /* overwrite MAC address in bootloader */
@@ -162,5 +127,39 @@
162 /* set phy-handle property in board file */ 127 /* set phy-handle property in board file */
163 }; 128 };
164 }; 129 };
130
131 mdio: mdio-bus@72004 {
132 compatible = "marvell,orion-mdio";
133 #address-cells = <1>;
134 #size-cells = <0>;
135 reg = <0x72004 0x84>;
136 interrupts = <22>;
137 status = "disabled";
138
139 /* add phy nodes in board file */
140 };
141
142 sata@80000 {
143 compatible = "marvell,orion-sata";
144 reg = <0x80000 0x5000>;
145 interrupts = <29>;
146 status = "disabled";
147 };
148
149 crypto@90000 {
150 compatible = "marvell,orion-crypto";
151 reg = <0x90000 0x10000>,
152 <0xf2200000 0x800>;
153 reg-names = "regs", "sram";
154 interrupts = <28>;
155 status = "okay";
156 };
157
158 ehci@a0000 {
159 compatible = "marvell,orion-ehci";
160 reg = <0xa0000 0x1000>;
161 interrupts = <12>;
162 status = "disabled";
163 };
165 }; 164 };
166}; 165};
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi
index daee58944e15..0e219932d7cc 100644
--- a/arch/arm/boot/dts/prima2.dtsi
+++ b/arch/arm/boot/dts/prima2.dtsi
@@ -29,6 +29,15 @@
29 timebase-frequency = <0>; 29 timebase-frequency = <0>;
30 bus-frequency = <0>; 30 bus-frequency = <0>;
31 clock-frequency = <0>; 31 clock-frequency = <0>;
32 clocks = <&clks 12>;
33 operating-points = <
34 /* kHz uV */
35 200000 1025000
36 400000 1025000
37 664000 1050000
38 800000 1100000
39 >;
40 clock-latency = <150000>;
32 }; 41 };
33 }; 42 };
34 43
@@ -80,6 +89,7 @@
80 cphifbg@88030000 { 89 cphifbg@88030000 {
81 compatible = "sirf,prima2-cphifbg"; 90 compatible = "sirf,prima2-cphifbg";
82 reg = <0x88030000 0x1000>; 91 reg = <0x88030000 0x1000>;
92 clocks = <&clks 42>;
83 }; 93 };
84 }; 94 };
85 95
@@ -540,6 +550,18 @@
540 "usp0_uart_nostreamctrl"; 550 "usp0_uart_nostreamctrl";
541 }; 551 };
542 }; 552 };
553 usp0_only_utfs_pins_a: usp0@2 {
554 usp0 {
555 sirf,pins = "usp0_only_utfs_grp";
556 sirf,function = "usp0_only_utfs";
557 };
558 };
559 usp0_only_urfs_pins_a: usp0@3 {
560 usp0 {
561 sirf,pins = "usp0_only_urfs_grp";
562 sirf,function = "usp0_only_urfs";
563 };
564 };
543 usp1_pins_a: usp1@0 { 565 usp1_pins_a: usp1@0 {
544 usp1 { 566 usp1 {
545 sirf,pins = "usp1grp"; 567 sirf,pins = "usp1grp";
@@ -648,6 +670,9 @@
648 compatible = "sirf,prima2-sdhc"; 670 compatible = "sirf,prima2-sdhc";
649 reg = <0x56000000 0x100000>; 671 reg = <0x56000000 0x100000>;
650 interrupts = <38>; 672 interrupts = <38>;
673 status = "disabled";
674 bus-width = <8>;
675 clocks = <&clks 36>;
651 }; 676 };
652 677
653 sd1: sdhci@56100000 { 678 sd1: sdhci@56100000 {
@@ -655,6 +680,9 @@
655 compatible = "sirf,prima2-sdhc"; 680 compatible = "sirf,prima2-sdhc";
656 reg = <0x56100000 0x100000>; 681 reg = <0x56100000 0x100000>;
657 interrupts = <38>; 682 interrupts = <38>;
683 status = "disabled";
684 bus-width = <4>;
685 clocks = <&clks 36>;
658 }; 686 };
659 687
660 sd2: sdhci@56200000 { 688 sd2: sdhci@56200000 {
@@ -662,6 +690,8 @@
662 compatible = "sirf,prima2-sdhc"; 690 compatible = "sirf,prima2-sdhc";
663 reg = <0x56200000 0x100000>; 691 reg = <0x56200000 0x100000>;
664 interrupts = <23>; 692 interrupts = <23>;
693 status = "disabled";
694 clocks = <&clks 37>;
665 }; 695 };
666 696
667 sd3: sdhci@56300000 { 697 sd3: sdhci@56300000 {
@@ -669,6 +699,8 @@
669 compatible = "sirf,prima2-sdhc"; 699 compatible = "sirf,prima2-sdhc";
670 reg = <0x56300000 0x100000>; 700 reg = <0x56300000 0x100000>;
671 interrupts = <23>; 701 interrupts = <23>;
702 status = "disabled";
703 clocks = <&clks 37>;
672 }; 704 };
673 705
674 sd4: sdhci@56400000 { 706 sd4: sdhci@56400000 {
@@ -676,6 +708,8 @@
676 compatible = "sirf,prima2-sdhc"; 708 compatible = "sirf,prima2-sdhc";
677 reg = <0x56400000 0x100000>; 709 reg = <0x56400000 0x100000>;
678 interrupts = <39>; 710 interrupts = <39>;
711 status = "disabled";
712 clocks = <&clks 38>;
679 }; 713 };
680 714
681 sd5: sdhci@56500000 { 715 sd5: sdhci@56500000 {
@@ -683,6 +717,7 @@
683 compatible = "sirf,prima2-sdhc"; 717 compatible = "sirf,prima2-sdhc";
684 reg = <0x56500000 0x100000>; 718 reg = <0x56500000 0x100000>;
685 interrupts = <39>; 719 interrupts = <39>;
720 clocks = <&clks 38>;
686 }; 721 };
687 722
688 pci-copy@57900000 { 723 pci-copy@57900000 {
@@ -716,6 +751,12 @@
716 interrupts = <52 53 54>; 751 interrupts = <52 53 54>;
717 }; 752 };
718 753
754 minigpsrtc@2000 {
755 compatible = "sirf,prima2-minigpsrtc";
756 reg = <0x2000 0x1000>;
757 interrupts = <54>;
758 };
759
719 pwrc@3000 { 760 pwrc@3000 {
720 compatible = "sirf,prima2-pwrc"; 761 compatible = "sirf,prima2-pwrc";
721 reg = <0x3000 0x1000>; 762 reg = <0x3000 0x1000>;
diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi
index d7c5d721a5c7..a70546945985 100644
--- a/arch/arm/boot/dts/pxa27x.dtsi
+++ b/arch/arm/boot/dts/pxa27x.dtsi
@@ -10,5 +10,29 @@
10 marvell,intc-priority; 10 marvell,intc-priority;
11 marvell,intc-nr-irqs = <34>; 11 marvell,intc-nr-irqs = <34>;
12 }; 12 };
13
14 pwm0: pwm@40b00000 {
15 compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
16 reg = <0x40b00000 0x10>;
17 #pwm-cells = <1>;
18 };
19
20 pwm1: pwm@40b00010 {
21 compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
22 reg = <0x40b00010 0x10>;
23 #pwm-cells = <1>;
24 };
25
26 pwm2: pwm@40c00000 {
27 compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
28 reg = <0x40c00000 0x10>;
29 #pwm-cells = <1>;
30 };
31
32 pwm3: pwm@40c00010 {
33 compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
34 reg = <0x40c00010 0x10>;
35 #pwm-cells = <1>;
36 };
13 }; 37 };
14}; 38};
diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
new file mode 100644
index 000000000000..13ac3e222495
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
@@ -0,0 +1,6 @@
1#include "qcom-msm8974.dtsi"
2
3/ {
4 model = "Qualcomm APQ8074 Dragonboard";
5 compatible = "qcom,apq8074-dragonboard", "qcom,apq8074";
6};
diff --git a/arch/arm/boot/dts/qcom-msm8660-surf.dts b/arch/arm/boot/dts/qcom-msm8660-surf.dts
index 386d42870215..68a72f5507b9 100644
--- a/arch/arm/boot/dts/qcom-msm8660-surf.dts
+++ b/arch/arm/boot/dts/qcom-msm8660-surf.dts
@@ -2,6 +2,8 @@
2 2
3/include/ "skeleton.dtsi" 3/include/ "skeleton.dtsi"
4 4
5#include <dt-bindings/clock/qcom,gcc-msm8660.h>
6
5/ { 7/ {
6 model = "Qualcomm MSM8660 SURF"; 8 model = "Qualcomm MSM8660 SURF";
7 compatible = "qcom,msm8660-surf", "qcom,msm8660"; 9 compatible = "qcom,msm8660-surf", "qcom,msm8660";
@@ -28,20 +30,29 @@
28 30
29 msmgpio: gpio@800000 { 31 msmgpio: gpio@800000 {
30 compatible = "qcom,msm-gpio"; 32 compatible = "qcom,msm-gpio";
31 reg = <0x00800000 0x1000>; 33 reg = <0x00800000 0x4000>;
32 gpio-controller; 34 gpio-controller;
33 #gpio-cells = <2>; 35 #gpio-cells = <2>;
34 ngpio = <173>; 36 ngpio = <173>;
35 interrupts = <0 32 0x4>; 37 interrupts = <0 16 0x4>;
36 interrupt-controller; 38 interrupt-controller;
37 #interrupt-cells = <2>; 39 #interrupt-cells = <2>;
38 }; 40 };
39 41
42 gcc: clock-controller@900000 {
43 compatible = "qcom,gcc-msm8660";
44 #clock-cells = <1>;
45 #reset-cells = <1>;
46 reg = <0x900000 0x4000>;
47 };
48
40 serial@19c40000 { 49 serial@19c40000 {
41 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; 50 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm";
42 reg = <0x19c40000 0x1000>, 51 reg = <0x19c40000 0x1000>,
43 <0x19c00000 0x1000>; 52 <0x19c00000 0x1000>;
44 interrupts = <0 195 0x0>; 53 interrupts = <0 195 0x0>;
54 clocks = <&gcc GSBI12_UART_CLK>, <&gcc GSBI12_H_CLK>;
55 clock-names = "core", "iface";
45 }; 56 };
46 57
47 qcom,ssbi@500000 { 58 qcom,ssbi@500000 {
diff --git a/arch/arm/boot/dts/qcom-msm8960-cdp.dts b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
index 93e9f7e0b7ad..7c30de4fa302 100644
--- a/arch/arm/boot/dts/qcom-msm8960-cdp.dts
+++ b/arch/arm/boot/dts/qcom-msm8960-cdp.dts
@@ -2,6 +2,8 @@
2 2
3/include/ "skeleton.dtsi" 3/include/ "skeleton.dtsi"
4 4
5#include <dt-bindings/clock/qcom,gcc-msm8960.h>
6
5/ { 7/ {
6 model = "Qualcomm MSM8960 CDP"; 8 model = "Qualcomm MSM8960 CDP";
7 compatible = "qcom,msm8960-cdp", "qcom,msm8960"; 9 compatible = "qcom,msm8960-cdp", "qcom,msm8960";
@@ -31,17 +33,33 @@
31 gpio-controller; 33 gpio-controller;
32 #gpio-cells = <2>; 34 #gpio-cells = <2>;
33 ngpio = <150>; 35 ngpio = <150>;
34 interrupts = <0 32 0x4>; 36 interrupts = <0 16 0x4>;
35 interrupt-controller; 37 interrupt-controller;
36 #interrupt-cells = <2>; 38 #interrupt-cells = <2>;
37 reg = <0x800000 0x4000>; 39 reg = <0x800000 0x4000>;
38 }; 40 };
39 41
42 gcc: clock-controller@900000 {
43 compatible = "qcom,gcc-msm8960";
44 #clock-cells = <1>;
45 #reset-cells = <1>;
46 reg = <0x900000 0x4000>;
47 };
48
49 clock-controller@4000000 {
50 compatible = "qcom,mmcc-msm8960";
51 reg = <0x4000000 0x1000>;
52 #clock-cells = <1>;
53 #reset-cells = <1>;
54 };
55
40 serial@16440000 { 56 serial@16440000 {
41 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; 57 compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm";
42 reg = <0x16440000 0x1000>, 58 reg = <0x16440000 0x1000>,
43 <0x16400000 0x1000>; 59 <0x16400000 0x1000>;
44 interrupts = <0 154 0x0>; 60 interrupts = <0 154 0x0>;
61 clocks = <&gcc GSBI5_UART_CLK>, <&gcc GSBI5_H_CLK>;
62 clock-names = "core", "iface";
45 }; 63 };
46 64
47 qcom,ssbi@500000 { 65 qcom,ssbi@500000 {
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
new file mode 100644
index 000000000000..9e5dadb101eb
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -0,0 +1,121 @@
1/dts-v1/;
2
3#include "skeleton.dtsi"
4
5#include <dt-bindings/clock/qcom,gcc-msm8974.h>
6
7/ {
8 model = "Qualcomm MSM8974";
9 compatible = "qcom,msm8974";
10 interrupt-parent = <&intc>;
11
12 soc: soc {
13 #address-cells = <1>;
14 #size-cells = <1>;
15 ranges;
16 compatible = "simple-bus";
17
18 intc: interrupt-controller@f9000000 {
19 compatible = "qcom,msm-qgic2";
20 interrupt-controller;
21 #interrupt-cells = <3>;
22 reg = <0xf9000000 0x1000>,
23 <0xf9002000 0x1000>;
24 };
25
26 timer {
27 compatible = "arm,armv7-timer";
28 interrupts = <1 2 0xf08>,
29 <1 3 0xf08>,
30 <1 4 0xf08>,
31 <1 1 0xf08>;
32 clock-frequency = <19200000>;
33 };
34
35 timer@f9020000 {
36 #address-cells = <1>;
37 #size-cells = <1>;
38 ranges;
39 compatible = "arm,armv7-timer-mem";
40 reg = <0xf9020000 0x1000>;
41 clock-frequency = <19200000>;
42
43 frame@f9021000 {
44 frame-number = <0>;
45 interrupts = <0 8 0x4>,
46 <0 7 0x4>;
47 reg = <0xf9021000 0x1000>,
48 <0xf9022000 0x1000>;
49 };
50
51 frame@f9023000 {
52 frame-number = <1>;
53 interrupts = <0 9 0x4>;
54 reg = <0xf9023000 0x1000>;
55 status = "disabled";
56 };
57
58 frame@f9024000 {
59 frame-number = <2>;
60 interrupts = <0 10 0x4>;
61 reg = <0xf9024000 0x1000>;
62 status = "disabled";
63 };
64
65 frame@f9025000 {
66 frame-number = <3>;
67 interrupts = <0 11 0x4>;
68 reg = <0xf9025000 0x1000>;
69 status = "disabled";
70 };
71
72 frame@f9026000 {
73 frame-number = <4>;
74 interrupts = <0 12 0x4>;
75 reg = <0xf9026000 0x1000>;
76 status = "disabled";
77 };
78
79 frame@f9027000 {
80 frame-number = <5>;
81 interrupts = <0 13 0x4>;
82 reg = <0xf9027000 0x1000>;
83 status = "disabled";
84 };
85
86 frame@f9028000 {
87 frame-number = <6>;
88 interrupts = <0 14 0x4>;
89 reg = <0xf9028000 0x1000>;
90 status = "disabled";
91 };
92 };
93
94 restart@fc4ab000 {
95 compatible = "qcom,pshold";
96 reg = <0xfc4ab000 0x4>;
97 };
98
99 gcc: clock-controller@fc400000 {
100 compatible = "qcom,gcc-msm8974";
101 #clock-cells = <1>;
102 #reset-cells = <1>;
103 reg = <0xfc400000 0x4000>;
104 };
105
106 mmcc: clock-controller@fd8c0000 {
107 compatible = "qcom,mmcc-msm8974";
108 #clock-cells = <1>;
109 #reset-cells = <1>;
110 reg = <0xfd8c0000 0x6000>;
111 };
112
113 serial@f991e000 {
114 compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
115 reg = <0xf991e000 0x1000>;
116 interrupts = <0 108 0x0>;
117 clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
118 clock-names = "core", "iface";
119 };
120 };
121};
diff --git a/arch/arm/boot/dts/r7s72100-genmai-reference.dts b/arch/arm/boot/dts/r7s72100-genmai-reference.dts
new file mode 100644
index 000000000000..da19c70ed82b
--- /dev/null
+++ b/arch/arm/boot/dts/r7s72100-genmai-reference.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-reference", "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-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
index 1fb20f2333cc..b1deaf7e2e06 100644
--- a/arch/arm/boot/dts/r7s72100-genmai.dts
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "r7s72100.dtsi" 12#include "r7s72100.dtsi"
13 13
14/ { 14/ {
15 model = "Genmai"; 15 model = "Genmai";
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
index 9443e93d3cac..70b1fff8f4a3 100644
--- a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
+++ b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "r8a73a4.dtsi" 12#include "r8a73a4.dtsi"
13#include <dt-bindings/gpio/gpio.h> 13#include <dt-bindings/gpio/gpio.h>
14 14
15/ { 15/ {
@@ -25,6 +25,11 @@
25 reg = <0 0x40000000 0 0x40000000>; 25 reg = <0 0x40000000 0 0x40000000>;
26 }; 26 };
27 27
28 memory@200000000 {
29 device_type = "memory";
30 reg = <2 0x00000000 0 0x40000000>;
31 };
32
28 vcc_mmc0: regulator@0 { 33 vcc_mmc0: regulator@0 {
29 compatible = "regulator-fixed"; 34 compatible = "regulator-fixed";
30 regulator-name = "MMC0 Vcc"; 35 regulator-name = "MMC0 Vcc";
@@ -88,22 +93,22 @@
88 pinctrl-0 = <&scifa0_pins>; 93 pinctrl-0 = <&scifa0_pins>;
89 pinctrl-names = "default"; 94 pinctrl-names = "default";
90 95
91 scifa0_pins: scifa0 { 96 scifa0_pins: serial0 {
92 renesas,groups = "scifa0_data"; 97 renesas,groups = "scifa0_data";
93 renesas,function = "scifa0"; 98 renesas,function = "scifa0";
94 }; 99 };
95 100
96 mmc0_pins: mmcif { 101 mmc0_pins: mmc {
97 renesas,groups = "mmc0_data8", "mmc0_ctrl"; 102 renesas,groups = "mmc0_data8", "mmc0_ctrl";
98 renesas,function = "mmc0"; 103 renesas,function = "mmc0";
99 }; 104 };
100 105
101 sdhi0_pins: sdhi0 { 106 sdhi0_pins: sd0 {
102 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd"; 107 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
103 renesas,function = "sdhi0"; 108 renesas,function = "sdhi0";
104 }; 109 };
105 110
106 sdhi1_pins: sdhi1 { 111 sdhi1_pins: sd1 {
107 renesas,groups = "sdhi1_data4", "sdhi1_ctrl"; 112 renesas,groups = "sdhi1_data4", "sdhi1_ctrl";
108 renesas,function = "sdhi1"; 113 renesas,function = "sdhi1";
109 }; 114 };
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm.dts b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
index 91436b58016f..ce085fa444a1 100644
--- a/arch/arm/boot/dts/r8a73a4-ape6evm.dts
+++ b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
@@ -9,7 +9,8 @@
9 */ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "r8a73a4.dtsi" 12#include "r8a73a4.dtsi"
13#include <dt-bindings/interrupt-controller/irq.h>
13 14
14/ { 15/ {
15 model = "APE6EVM"; 16 model = "APE6EVM";
@@ -24,6 +25,11 @@
24 reg = <0 0x40000000 0 0x40000000>; 25 reg = <0 0x40000000 0 0x40000000>;
25 }; 26 };
26 27
28 memory@200000000 {
29 device_type = "memory";
30 reg = <2 0x00000000 0 0x40000000>;
31 };
32
27 ape6evm_fixed_3v3: fixedregulator@0 { 33 ape6evm_fixed_3v3: fixedregulator@0 {
28 compatible = "regulator-fixed"; 34 compatible = "regulator-fixed";
29 regulator-name = "3V3"; 35 regulator-name = "3V3";
@@ -40,7 +46,7 @@
40 compatible = "smsc,lan9118", "smsc,lan9115"; 46 compatible = "smsc,lan9118", "smsc,lan9115";
41 reg = <0x08000000 0x1000>; 47 reg = <0x08000000 0x1000>;
42 interrupt-parent = <&irqc1>; 48 interrupt-parent = <&irqc1>;
43 interrupts = <8 0x4>; 49 interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
44 phy-mode = "mii"; 50 phy-mode = "mii";
45 reg-io-width = <4>; 51 reg-io-width = <4>;
46 smsc,irq-active-high; 52 smsc,irq-active-high;
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 287e047592a0..62d0211bd192 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -9,6 +9,9 @@
9 * kind, whether express or implied. 9 * kind, whether express or implied.
10 */ 10 */
11 11
12#include <dt-bindings/interrupt-controller/arm-gic.h>
13#include <dt-bindings/interrupt-controller/irq.h>
14
12/ { 15/ {
13 compatible = "renesas,r8a73a4"; 16 compatible = "renesas,r8a73a4";
14 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
@@ -36,15 +39,15 @@
36 <0 0xf1002000 0 0x1000>, 39 <0 0xf1002000 0 0x1000>,
37 <0 0xf1004000 0 0x2000>, 40 <0 0xf1004000 0 0x2000>,
38 <0 0xf1006000 0 0x2000>; 41 <0 0xf1006000 0 0x2000>;
39 interrupts = <1 9 0xf04>; 42 interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
40 }; 43 };
41 44
42 timer { 45 timer {
43 compatible = "arm,armv7-timer"; 46 compatible = "arm,armv7-timer";
44 interrupts = <1 13 0xf08>, 47 interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
45 <1 14 0xf08>, 48 <1 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
46 <1 11 0xf08>, 49 <1 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
47 <1 10 0xf08>; 50 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
48 }; 51 };
49 52
50 irqc0: interrupt-controller@e61c0000 { 53 irqc0: interrupt-controller@e61c0000 {
@@ -53,14 +56,38 @@
53 interrupt-controller; 56 interrupt-controller;
54 reg = <0 0xe61c0000 0 0x200>; 57 reg = <0 0xe61c0000 0 0x200>;
55 interrupt-parent = <&gic>; 58 interrupt-parent = <&gic>;
56 interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>, 59 interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
57 <0 4 4>, <0 5 4>, <0 6 4>, <0 7 4>, 60 <0 1 IRQ_TYPE_LEVEL_HIGH>,
58 <0 8 4>, <0 9 4>, <0 10 4>, <0 11 4>, 61 <0 2 IRQ_TYPE_LEVEL_HIGH>,
59 <0 12 4>, <0 13 4>, <0 14 4>, <0 15 4>, 62 <0 3 IRQ_TYPE_LEVEL_HIGH>,
60 <0 16 4>, <0 17 4>, <0 18 4>, <0 19 4>, 63 <0 4 IRQ_TYPE_LEVEL_HIGH>,
61 <0 20 4>, <0 21 4>, <0 22 4>, <0 23 4>, 64 <0 5 IRQ_TYPE_LEVEL_HIGH>,
62 <0 24 4>, <0 25 4>, <0 26 4>, <0 27 4>, 65 <0 6 IRQ_TYPE_LEVEL_HIGH>,
63 <0 28 4>, <0 29 4>, <0 30 4>, <0 31 4>; 66 <0 7 IRQ_TYPE_LEVEL_HIGH>,
67 <0 8 IRQ_TYPE_LEVEL_HIGH>,
68 <0 9 IRQ_TYPE_LEVEL_HIGH>,
69 <0 10 IRQ_TYPE_LEVEL_HIGH>,
70 <0 11 IRQ_TYPE_LEVEL_HIGH>,
71 <0 12 IRQ_TYPE_LEVEL_HIGH>,
72 <0 13 IRQ_TYPE_LEVEL_HIGH>,
73 <0 14 IRQ_TYPE_LEVEL_HIGH>,
74 <0 15 IRQ_TYPE_LEVEL_HIGH>,
75 <0 16 IRQ_TYPE_LEVEL_HIGH>,
76 <0 17 IRQ_TYPE_LEVEL_HIGH>,
77 <0 18 IRQ_TYPE_LEVEL_HIGH>,
78 <0 19 IRQ_TYPE_LEVEL_HIGH>,
79 <0 20 IRQ_TYPE_LEVEL_HIGH>,
80 <0 21 IRQ_TYPE_LEVEL_HIGH>,
81 <0 22 IRQ_TYPE_LEVEL_HIGH>,
82 <0 23 IRQ_TYPE_LEVEL_HIGH>,
83 <0 24 IRQ_TYPE_LEVEL_HIGH>,
84 <0 25 IRQ_TYPE_LEVEL_HIGH>,
85 <0 26 IRQ_TYPE_LEVEL_HIGH>,
86 <0 27 IRQ_TYPE_LEVEL_HIGH>,
87 <0 28 IRQ_TYPE_LEVEL_HIGH>,
88 <0 29 IRQ_TYPE_LEVEL_HIGH>,
89 <0 30 IRQ_TYPE_LEVEL_HIGH>,
90 <0 31 IRQ_TYPE_LEVEL_HIGH>;
64 }; 91 };
65 92
66 irqc1: interrupt-controller@e61c0200 { 93 irqc1: interrupt-controller@e61c0200 {
@@ -69,13 +96,32 @@
69 interrupt-controller; 96 interrupt-controller;
70 reg = <0 0xe61c0200 0 0x200>; 97 reg = <0 0xe61c0200 0 0x200>;
71 interrupt-parent = <&gic>; 98 interrupt-parent = <&gic>;
72 interrupts = <0 32 4>, <0 33 4>, <0 34 4>, <0 35 4>, 99 interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>,
73 <0 36 4>, <0 37 4>, <0 38 4>, <0 39 4>, 100 <0 33 IRQ_TYPE_LEVEL_HIGH>,
74 <0 40 4>, <0 41 4>, <0 42 4>, <0 43 4>, 101 <0 34 IRQ_TYPE_LEVEL_HIGH>,
75 <0 44 4>, <0 45 4>, <0 46 4>, <0 47 4>, 102 <0 35 IRQ_TYPE_LEVEL_HIGH>,
76 <0 48 4>, <0 49 4>, <0 50 4>, <0 51 4>, 103 <0 36 IRQ_TYPE_LEVEL_HIGH>,
77 <0 52 4>, <0 53 4>, <0 54 4>, <0 55 4>, 104 <0 37 IRQ_TYPE_LEVEL_HIGH>,
78 <0 56 4>, <0 57 4>; 105 <0 38 IRQ_TYPE_LEVEL_HIGH>,
106 <0 39 IRQ_TYPE_LEVEL_HIGH>,
107 <0 40 IRQ_TYPE_LEVEL_HIGH>,
108 <0 41 IRQ_TYPE_LEVEL_HIGH>,
109 <0 42 IRQ_TYPE_LEVEL_HIGH>,
110 <0 43 IRQ_TYPE_LEVEL_HIGH>,
111 <0 44 IRQ_TYPE_LEVEL_HIGH>,
112 <0 45 IRQ_TYPE_LEVEL_HIGH>,
113 <0 46 IRQ_TYPE_LEVEL_HIGH>,
114 <0 47 IRQ_TYPE_LEVEL_HIGH>,
115 <0 48 IRQ_TYPE_LEVEL_HIGH>,
116 <0 49 IRQ_TYPE_LEVEL_HIGH>,
117 <0 50 IRQ_TYPE_LEVEL_HIGH>,
118 <0 51 IRQ_TYPE_LEVEL_HIGH>,
119 <0 52 IRQ_TYPE_LEVEL_HIGH>,
120 <0 53 IRQ_TYPE_LEVEL_HIGH>,
121 <0 54 IRQ_TYPE_LEVEL_HIGH>,
122 <0 55 IRQ_TYPE_LEVEL_HIGH>,
123 <0 56 IRQ_TYPE_LEVEL_HIGH>,
124 <0 57 IRQ_TYPE_LEVEL_HIGH>;
79 }; 125 };
80 126
81 dmac: dma-multiplexer@0 { 127 dmac: dma-multiplexer@0 {
@@ -91,27 +137,27 @@
91 compatible = "renesas,shdma-r8a73a4"; 137 compatible = "renesas,shdma-r8a73a4";
92 reg = <0 0xe6700020 0 0x89e0>; 138 reg = <0 0xe6700020 0 0x89e0>;
93 interrupt-parent = <&gic>; 139 interrupt-parent = <&gic>;
94 interrupts = <0 220 4 140 interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH
95 0 200 4 141 0 200 IRQ_TYPE_LEVEL_HIGH
96 0 201 4 142 0 201 IRQ_TYPE_LEVEL_HIGH
97 0 202 4 143 0 202 IRQ_TYPE_LEVEL_HIGH
98 0 203 4 144 0 203 IRQ_TYPE_LEVEL_HIGH
99 0 204 4 145 0 204 IRQ_TYPE_LEVEL_HIGH
100 0 205 4 146 0 205 IRQ_TYPE_LEVEL_HIGH
101 0 206 4 147 0 206 IRQ_TYPE_LEVEL_HIGH
102 0 207 4 148 0 207 IRQ_TYPE_LEVEL_HIGH
103 0 208 4 149 0 208 IRQ_TYPE_LEVEL_HIGH
104 0 209 4 150 0 209 IRQ_TYPE_LEVEL_HIGH
105 0 210 4 151 0 210 IRQ_TYPE_LEVEL_HIGH
106 0 211 4 152 0 211 IRQ_TYPE_LEVEL_HIGH
107 0 212 4 153 0 212 IRQ_TYPE_LEVEL_HIGH
108 0 213 4 154 0 213 IRQ_TYPE_LEVEL_HIGH
109 0 214 4 155 0 214 IRQ_TYPE_LEVEL_HIGH
110 0 215 4 156 0 215 IRQ_TYPE_LEVEL_HIGH
111 0 216 4 157 0 216 IRQ_TYPE_LEVEL_HIGH
112 0 217 4 158 0 217 IRQ_TYPE_LEVEL_HIGH
113 0 218 4 159 0 218 IRQ_TYPE_LEVEL_HIGH
114 0 219 4>; 160 0 219 IRQ_TYPE_LEVEL_HIGH>;
115 interrupt-names = "error", 161 interrupt-names = "error",
116 "ch0", "ch1", "ch2", "ch3", 162 "ch0", "ch1", "ch2", "ch3",
117 "ch4", "ch5", "ch6", "ch7", 163 "ch4", "ch5", "ch6", "ch7",
@@ -126,7 +172,7 @@
126 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>, 172 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>,
127 <0 0xe61f0200 0 0x38>, <0 0xe61f0300 0 0x38>; 173 <0 0xe61f0200 0 0x38>, <0 0xe61f0300 0 0x38>;
128 interrupt-parent = <&gic>; 174 interrupt-parent = <&gic>;
129 interrupts = <0 69 4>; 175 interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
130 }; 176 };
131 177
132 i2c0: i2c@e6500000 { 178 i2c0: i2c@e6500000 {
@@ -135,7 +181,7 @@
135 compatible = "renesas,rmobile-iic"; 181 compatible = "renesas,rmobile-iic";
136 reg = <0 0xe6500000 0 0x428>; 182 reg = <0 0xe6500000 0 0x428>;
137 interrupt-parent = <&gic>; 183 interrupt-parent = <&gic>;
138 interrupts = <0 174 0x4>; 184 interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>;
139 status = "disabled"; 185 status = "disabled";
140 }; 186 };
141 187
@@ -145,7 +191,7 @@
145 compatible = "renesas,rmobile-iic"; 191 compatible = "renesas,rmobile-iic";
146 reg = <0 0xe6510000 0 0x428>; 192 reg = <0 0xe6510000 0 0x428>;
147 interrupt-parent = <&gic>; 193 interrupt-parent = <&gic>;
148 interrupts = <0 175 0x4>; 194 interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>;
149 status = "disabled"; 195 status = "disabled";
150 }; 196 };
151 197
@@ -155,7 +201,7 @@
155 compatible = "renesas,rmobile-iic"; 201 compatible = "renesas,rmobile-iic";
156 reg = <0 0xe6520000 0 0x428>; 202 reg = <0 0xe6520000 0 0x428>;
157 interrupt-parent = <&gic>; 203 interrupt-parent = <&gic>;
158 interrupts = <0 176 0x4>; 204 interrupts = <0 176 IRQ_TYPE_LEVEL_HIGH>;
159 status = "disabled"; 205 status = "disabled";
160 }; 206 };
161 207
@@ -165,7 +211,7 @@
165 compatible = "renesas,rmobile-iic"; 211 compatible = "renesas,rmobile-iic";
166 reg = <0 0xe6530000 0 0x428>; 212 reg = <0 0xe6530000 0 0x428>;
167 interrupt-parent = <&gic>; 213 interrupt-parent = <&gic>;
168 interrupts = <0 177 0x4>; 214 interrupts = <0 177 IRQ_TYPE_LEVEL_HIGH>;
169 status = "disabled"; 215 status = "disabled";
170 }; 216 };
171 217
@@ -175,7 +221,7 @@
175 compatible = "renesas,rmobile-iic"; 221 compatible = "renesas,rmobile-iic";
176 reg = <0 0xe6540000 0 0x428>; 222 reg = <0 0xe6540000 0 0x428>;
177 interrupt-parent = <&gic>; 223 interrupt-parent = <&gic>;
178 interrupts = <0 178 0x4>; 224 interrupts = <0 178 IRQ_TYPE_LEVEL_HIGH>;
179 status = "disabled"; 225 status = "disabled";
180 }; 226 };
181 227
@@ -185,7 +231,7 @@
185 compatible = "renesas,rmobile-iic"; 231 compatible = "renesas,rmobile-iic";
186 reg = <0 0xe60b0000 0 0x428>; 232 reg = <0 0xe60b0000 0 0x428>;
187 interrupt-parent = <&gic>; 233 interrupt-parent = <&gic>;
188 interrupts = <0 179 0x4>; 234 interrupts = <0 179 IRQ_TYPE_LEVEL_HIGH>;
189 status = "disabled"; 235 status = "disabled";
190 }; 236 };
191 237
@@ -195,7 +241,7 @@
195 compatible = "renesas,rmobile-iic"; 241 compatible = "renesas,rmobile-iic";
196 reg = <0 0xe6550000 0 0x428>; 242 reg = <0 0xe6550000 0 0x428>;
197 interrupt-parent = <&gic>; 243 interrupt-parent = <&gic>;
198 interrupts = <0 184 0x4>; 244 interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
199 status = "disabled"; 245 status = "disabled";
200 }; 246 };
201 247
@@ -205,7 +251,7 @@
205 compatible = "renesas,rmobile-iic"; 251 compatible = "renesas,rmobile-iic";
206 reg = <0 0xe6560000 0 0x428>; 252 reg = <0 0xe6560000 0 0x428>;
207 interrupt-parent = <&gic>; 253 interrupt-parent = <&gic>;
208 interrupts = <0 185 0x4>; 254 interrupts = <0 185 IRQ_TYPE_LEVEL_HIGH>;
209 status = "disabled"; 255 status = "disabled";
210 }; 256 };
211 257
@@ -215,24 +261,24 @@
215 compatible = "renesas,rmobile-iic"; 261 compatible = "renesas,rmobile-iic";
216 reg = <0 0xe6570000 0 0x428>; 262 reg = <0 0xe6570000 0 0x428>;
217 interrupt-parent = <&gic>; 263 interrupt-parent = <&gic>;
218 interrupts = <0 173 0x4>; 264 interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>;
219 status = "disabled"; 265 status = "disabled";
220 }; 266 };
221 267
222 mmcif0: mmcif@ee200000 { 268 mmcif0: mmc@ee200000 {
223 compatible = "renesas,sh-mmcif"; 269 compatible = "renesas,sh-mmcif";
224 reg = <0 0xee200000 0 0x80>; 270 reg = <0 0xee200000 0 0x80>;
225 interrupt-parent = <&gic>; 271 interrupt-parent = <&gic>;
226 interrupts = <0 169 0x4>; 272 interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
227 reg-io-width = <4>; 273 reg-io-width = <4>;
228 status = "disabled"; 274 status = "disabled";
229 }; 275 };
230 276
231 mmcif1: mmcif@ee220000 { 277 mmcif1: mmc@ee220000 {
232 compatible = "renesas,sh-mmcif"; 278 compatible = "renesas,sh-mmcif";
233 reg = <0 0xee220000 0 0x80>; 279 reg = <0 0xee220000 0 0x80>;
234 interrupt-parent = <&gic>; 280 interrupt-parent = <&gic>;
235 interrupts = <0 170 0x4>; 281 interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>;
236 reg-io-width = <4>; 282 reg-io-width = <4>;
237 status = "disabled"; 283 status = "disabled";
238 }; 284 };
@@ -242,31 +288,47 @@
242 reg = <0 0xe6050000 0 0x9000>; 288 reg = <0 0xe6050000 0 0x9000>;
243 gpio-controller; 289 gpio-controller;
244 #gpio-cells = <2>; 290 #gpio-cells = <2>;
291 interrupts-extended =
292 <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>,
293 <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>,
294 <&irqc0 8 0>, <&irqc0 9 0>, <&irqc0 10 0>, <&irqc0 11 0>,
295 <&irqc0 12 0>, <&irqc0 13 0>, <&irqc0 14 0>, <&irqc0 15 0>,
296 <&irqc0 16 0>, <&irqc0 17 0>, <&irqc0 18 0>, <&irqc0 19 0>,
297 <&irqc0 20 0>, <&irqc0 21 0>, <&irqc0 22 0>, <&irqc0 23 0>,
298 <&irqc0 24 0>, <&irqc0 25 0>, <&irqc0 26 0>, <&irqc0 27 0>,
299 <&irqc0 28 0>, <&irqc0 29 0>, <&irqc0 30 0>, <&irqc0 31 0>,
300 <&irqc1 0 0>, <&irqc1 1 0>, <&irqc1 2 0>, <&irqc1 3 0>,
301 <&irqc1 4 0>, <&irqc1 5 0>, <&irqc1 6 0>, <&irqc1 7 0>,
302 <&irqc1 8 0>, <&irqc1 9 0>, <&irqc1 10 0>, <&irqc1 11 0>,
303 <&irqc1 12 0>, <&irqc1 13 0>, <&irqc1 14 0>, <&irqc1 15 0>,
304 <&irqc1 16 0>, <&irqc1 17 0>, <&irqc1 18 0>, <&irqc1 19 0>,
305 <&irqc1 20 0>, <&irqc1 21 0>, <&irqc1 22 0>, <&irqc1 23 0>,
306 <&irqc1 24 0>, <&irqc1 25 0>;
245 }; 307 };
246 308
247 sdhi0: sdhi@ee100000 { 309 sdhi0: sd@ee100000 {
248 compatible = "renesas,sdhi-r8a73a4"; 310 compatible = "renesas,sdhi-r8a73a4";
249 reg = <0 0xee100000 0 0x100>; 311 reg = <0 0xee100000 0 0x100>;
250 interrupt-parent = <&gic>; 312 interrupt-parent = <&gic>;
251 interrupts = <0 165 4>; 313 interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>;
252 cap-sd-highspeed; 314 cap-sd-highspeed;
253 status = "disabled"; 315 status = "disabled";
254 }; 316 };
255 317
256 sdhi1: sdhi@ee120000 { 318 sdhi1: sd@ee120000 {
257 compatible = "renesas,sdhi-r8a73a4"; 319 compatible = "renesas,sdhi-r8a73a4";
258 reg = <0 0xee120000 0 0x100>; 320 reg = <0 0xee120000 0 0x100>;
259 interrupt-parent = <&gic>; 321 interrupt-parent = <&gic>;
260 interrupts = <0 166 4>; 322 interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>;
261 cap-sd-highspeed; 323 cap-sd-highspeed;
262 status = "disabled"; 324 status = "disabled";
263 }; 325 };
264 326
265 sdhi2: sdhi@ee140000 { 327 sdhi2: sd@ee140000 {
266 compatible = "renesas,sdhi-r8a73a4"; 328 compatible = "renesas,sdhi-r8a73a4";
267 reg = <0 0xee140000 0 0x100>; 329 reg = <0 0xee140000 0 0x100>;
268 interrupt-parent = <&gic>; 330 interrupt-parent = <&gic>;
269 interrupts = <0 167 4>; 331 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>;
270 cap-sd-highspeed; 332 cap-sd-highspeed;
271 status = "disabled"; 333 status = "disabled";
272 }; 334 };
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
index 1c56c5e56950..95a849bf921f 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
@@ -9,8 +9,9 @@
9 */ 9 */
10 10
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/interrupt-controller/irq.h>
14#include <dt-bindings/pwm/pwm.h> 15#include <dt-bindings/pwm/pwm.h>
15 16
16/ { 17/ {
@@ -62,6 +63,44 @@
62 enable-active-high; 63 enable-active-high;
63 }; 64 };
64 65
66 reg_5p0v: regulator@3 {
67 compatible = "regulator-fixed";
68 regulator-name = "fixed-5.0V";
69 regulator-min-microvolt = <5000000>;
70 regulator-max-microvolt = <5000000>;
71 regulator-always-on;
72 regulator-boot-on;
73 };
74
75 gpio-keys {
76 compatible = "gpio-keys";
77
78 power-key {
79 gpios = <&pfc 99 GPIO_ACTIVE_LOW>;
80 linux,code = <116>;
81 label = "SW3";
82 gpio-key,wakeup;
83 };
84
85 back-key {
86 gpios = <&pfc 100 GPIO_ACTIVE_LOW>;
87 linux,code = <158>;
88 label = "SW4";
89 };
90
91 menu-key {
92 gpios = <&pfc 97 GPIO_ACTIVE_LOW>;
93 linux,code = <139>;
94 label = "SW5";
95 };
96
97 home-key {
98 gpios = <&pfc 98 GPIO_ACTIVE_LOW>;
99 linux,code = <102>;
100 label = "SW6";
101 };
102 };
103
65 leds { 104 leds {
66 compatible = "gpio-leds"; 105 compatible = "gpio-leds";
67 led1 { 106 led1 {
@@ -85,32 +124,58 @@
85 default-brightness-level = <9>; 124 default-brightness-level = <9>;
86 pinctrl-0 = <&backlight_pins>; 125 pinctrl-0 = <&backlight_pins>;
87 pinctrl-names = "default"; 126 pinctrl-names = "default";
127 power-supply = <&reg_5p0v>;
128 enable-gpios = <&pfc 61 GPIO_ACTIVE_HIGH>;
129 };
130
131 sound {
132 compatible = "simple-audio-card";
133
134 simple-audio-card,format = "i2s";
135
136 simple-audio-card,cpu {
137 sound-dai = <&sh_fsi2 0>;
138 bitclock-inversion;
139 };
140
141 simple-audio-card,codec {
142 sound-dai = <&wm8978>;
143 bitclock-master;
144 frame-master;
145 system-clock-frequency = <12288000>;
146 };
88 }; 147 };
89}; 148};
90 149
91&i2c0 { 150&i2c0 {
92 status = "okay"; 151 status = "okay";
93 touchscreen: st1232@55 { 152 touchscreen@55 {
94 compatible = "sitronix,st1232"; 153 compatible = "sitronix,st1232";
95 reg = <0x55>; 154 reg = <0x55>;
96 interrupt-parent = <&irqpin1>; 155 interrupt-parent = <&irqpin1>;
97 interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */ 156 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
98 pinctrl-0 = <&st1232_pins>; 157 pinctrl-0 = <&st1232_pins>;
99 pinctrl-names = "default"; 158 pinctrl-names = "default";
100 gpios = <&pfc 166 GPIO_ACTIVE_LOW>; 159 gpios = <&pfc 166 GPIO_ACTIVE_LOW>;
101 }; 160 };
161
162 wm8978: wm8978@1a {
163 #sound-dai-cells = <0>;
164 compatible = "wlf,wm8978";
165 reg = <0x1a>;
166 };
102}; 167};
103 168
104&pfc { 169&pfc {
105 pinctrl-0 = <&scifa1_pins>; 170 pinctrl-0 = <&scifa1_pins>;
106 pinctrl-names = "default"; 171 pinctrl-names = "default";
107 172
108 scifa1_pins: scifa1 { 173 scifa1_pins: serial1 {
109 renesas,groups = "scifa1_data"; 174 renesas,groups = "scifa1_data";
110 renesas,function = "scifa1"; 175 renesas,function = "scifa1";
111 }; 176 };
112 177
113 st1232_pins: st1232 { 178 st1232_pins: touchscreen {
114 renesas,groups = "intc_irq10"; 179 renesas,groups = "intc_irq10";
115 renesas,function = "intc"; 180 renesas,function = "intc";
116 }; 181 };
@@ -125,10 +190,16 @@
125 renesas,function = "mmc0"; 190 renesas,function = "mmc0";
126 }; 191 };
127 192
128 sdhi0_pins: sdhi0 { 193 sdhi0_pins: sd0 {
129 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_wp"; 194 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_wp";
130 renesas,function = "sdhi0"; 195 renesas,function = "sdhi0";
131 }; 196 };
197
198 fsia_pins: sounda {
199 renesas,groups = "fsia_sclk_in", "fsia_mclk_out",
200 "fsia_data_in_1", "fsia_data_out_0";
201 renesas,function = "fsia";
202 };
132}; 203};
133 204
134&tpu { 205&tpu {
@@ -155,3 +226,10 @@
155 cd-gpios = <&pfc 167 GPIO_ACTIVE_LOW>; 226 cd-gpios = <&pfc 167 GPIO_ACTIVE_LOW>;
156 status = "okay"; 227 status = "okay";
157}; 228};
229
230&sh_fsi2 {
231 pinctrl-0 = <&fsia_pins>;
232 pinctrl-names = "default";
233
234 status = "okay";
235};
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
index 426cd9c3e1c4..a06a11e1a840 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "r8a7740.dtsi" 12#include "r8a7740.dtsi"
13 13
14/ { 14/ {
15 model = "armadillo 800 eva"; 15 model = "armadillo 800 eva";
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index ae1e230f711d..8280884bfa59 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -10,6 +10,8 @@
10 10
11/include/ "skeleton.dtsi" 11/include/ "skeleton.dtsi"
12 12
13#include <dt-bindings/interrupt-controller/irq.h>
14
13/ { 15/ {
14 compatible = "renesas,r8a7740"; 16 compatible = "renesas,r8a7740";
15 17
@@ -34,12 +36,12 @@
34 36
35 pmu { 37 pmu {
36 compatible = "arm,cortex-a9-pmu"; 38 compatible = "arm,cortex-a9-pmu";
37 interrupts = <0 83 4>; 39 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
38 }; 40 };
39 41
40 /* irqpin0: IRQ0 - IRQ7 */ 42 /* irqpin0: IRQ0 - IRQ7 */
41 irqpin0: irqpin@e6900000 { 43 irqpin0: irqpin@e6900000 {
42 compatible = "renesas,intc-irqpin"; 44 compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
43 #interrupt-cells = <2>; 45 #interrupt-cells = <2>;
44 interrupt-controller; 46 interrupt-controller;
45 reg = <0xe6900000 4>, 47 reg = <0xe6900000 4>,
@@ -48,19 +50,19 @@
48 <0xe6900040 1>, 50 <0xe6900040 1>,
49 <0xe6900060 1>; 51 <0xe6900060 1>;
50 interrupt-parent = <&gic>; 52 interrupt-parent = <&gic>;
51 interrupts = <0 149 0x4 53 interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
52 0 149 0x4 54 0 149 IRQ_TYPE_LEVEL_HIGH
53 0 149 0x4 55 0 149 IRQ_TYPE_LEVEL_HIGH
54 0 149 0x4 56 0 149 IRQ_TYPE_LEVEL_HIGH
55 0 149 0x4 57 0 149 IRQ_TYPE_LEVEL_HIGH
56 0 149 0x4 58 0 149 IRQ_TYPE_LEVEL_HIGH
57 0 149 0x4 59 0 149 IRQ_TYPE_LEVEL_HIGH
58 0 149 0x4>; 60 0 149 IRQ_TYPE_LEVEL_HIGH>;
59 }; 61 };
60 62
61 /* irqpin1: IRQ8 - IRQ15 */ 63 /* irqpin1: IRQ8 - IRQ15 */
62 irqpin1: irqpin@e6900004 { 64 irqpin1: irqpin@e6900004 {
63 compatible = "renesas,intc-irqpin"; 65 compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
64 #interrupt-cells = <2>; 66 #interrupt-cells = <2>;
65 interrupt-controller; 67 interrupt-controller;
66 reg = <0xe6900004 4>, 68 reg = <0xe6900004 4>,
@@ -69,19 +71,19 @@
69 <0xe6900044 1>, 71 <0xe6900044 1>,
70 <0xe6900064 1>; 72 <0xe6900064 1>;
71 interrupt-parent = <&gic>; 73 interrupt-parent = <&gic>;
72 interrupts = <0 149 0x4 74 interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
73 0 149 0x4 75 0 149 IRQ_TYPE_LEVEL_HIGH
74 0 149 0x4 76 0 149 IRQ_TYPE_LEVEL_HIGH
75 0 149 0x4 77 0 149 IRQ_TYPE_LEVEL_HIGH
76 0 149 0x4 78 0 149 IRQ_TYPE_LEVEL_HIGH
77 0 149 0x4 79 0 149 IRQ_TYPE_LEVEL_HIGH
78 0 149 0x4 80 0 149 IRQ_TYPE_LEVEL_HIGH
79 0 149 0x4>; 81 0 149 IRQ_TYPE_LEVEL_HIGH>;
80 }; 82 };
81 83
82 /* irqpin2: IRQ16 - IRQ23 */ 84 /* irqpin2: IRQ16 - IRQ23 */
83 irqpin2: irqpin@e6900008 { 85 irqpin2: irqpin@e6900008 {
84 compatible = "renesas,intc-irqpin"; 86 compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
85 #interrupt-cells = <2>; 87 #interrupt-cells = <2>;
86 interrupt-controller; 88 interrupt-controller;
87 reg = <0xe6900008 4>, 89 reg = <0xe6900008 4>,
@@ -90,19 +92,19 @@
90 <0xe6900048 1>, 92 <0xe6900048 1>,
91 <0xe6900068 1>; 93 <0xe6900068 1>;
92 interrupt-parent = <&gic>; 94 interrupt-parent = <&gic>;
93 interrupts = <0 149 0x4 95 interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
94 0 149 0x4 96 0 149 IRQ_TYPE_LEVEL_HIGH
95 0 149 0x4 97 0 149 IRQ_TYPE_LEVEL_HIGH
96 0 149 0x4 98 0 149 IRQ_TYPE_LEVEL_HIGH
97 0 149 0x4 99 0 149 IRQ_TYPE_LEVEL_HIGH
98 0 149 0x4 100 0 149 IRQ_TYPE_LEVEL_HIGH
99 0 149 0x4 101 0 149 IRQ_TYPE_LEVEL_HIGH
100 0 149 0x4>; 102 0 149 IRQ_TYPE_LEVEL_HIGH>;
101 }; 103 };
102 104
103 /* irqpin3: IRQ24 - IRQ31 */ 105 /* irqpin3: IRQ24 - IRQ31 */
104 irqpin3: irqpin@e690000c { 106 irqpin3: irqpin@e690000c {
105 compatible = "renesas,intc-irqpin"; 107 compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
106 #interrupt-cells = <2>; 108 #interrupt-cells = <2>;
107 interrupt-controller; 109 interrupt-controller;
108 reg = <0xe690000c 4>, 110 reg = <0xe690000c 4>,
@@ -111,14 +113,14 @@
111 <0xe690004c 1>, 113 <0xe690004c 1>,
112 <0xe690006c 1>; 114 <0xe690006c 1>;
113 interrupt-parent = <&gic>; 115 interrupt-parent = <&gic>;
114 interrupts = <0 149 0x4 116 interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
115 0 149 0x4 117 0 149 IRQ_TYPE_LEVEL_HIGH
116 0 149 0x4 118 0 149 IRQ_TYPE_LEVEL_HIGH
117 0 149 0x4 119 0 149 IRQ_TYPE_LEVEL_HIGH
118 0 149 0x4 120 0 149 IRQ_TYPE_LEVEL_HIGH
119 0 149 0x4 121 0 149 IRQ_TYPE_LEVEL_HIGH
120 0 149 0x4 122 0 149 IRQ_TYPE_LEVEL_HIGH
121 0 149 0x4>; 123 0 149 IRQ_TYPE_LEVEL_HIGH>;
122 }; 124 };
123 125
124 i2c0: i2c@fff20000 { 126 i2c0: i2c@fff20000 {
@@ -127,10 +129,10 @@
127 compatible = "renesas,rmobile-iic"; 129 compatible = "renesas,rmobile-iic";
128 reg = <0xfff20000 0x425>; 130 reg = <0xfff20000 0x425>;
129 interrupt-parent = <&gic>; 131 interrupt-parent = <&gic>;
130 interrupts = <0 201 0x4 132 interrupts = <0 201 IRQ_TYPE_LEVEL_HIGH
131 0 202 0x4 133 0 202 IRQ_TYPE_LEVEL_HIGH
132 0 203 0x4 134 0 203 IRQ_TYPE_LEVEL_HIGH
133 0 204 0x4>; 135 0 204 IRQ_TYPE_LEVEL_HIGH>;
134 status = "disabled"; 136 status = "disabled";
135 }; 137 };
136 138
@@ -140,10 +142,10 @@
140 compatible = "renesas,rmobile-iic"; 142 compatible = "renesas,rmobile-iic";
141 reg = <0xe6c20000 0x425>; 143 reg = <0xe6c20000 0x425>;
142 interrupt-parent = <&gic>; 144 interrupt-parent = <&gic>;
143 interrupts = <0 70 0x4 145 interrupts = <0 70 IRQ_TYPE_LEVEL_HIGH
144 0 71 0x4 146 0 71 IRQ_TYPE_LEVEL_HIGH
145 0 72 0x4 147 0 72 IRQ_TYPE_LEVEL_HIGH
146 0 73 0x4>; 148 0 73 IRQ_TYPE_LEVEL_HIGH>;
147 status = "disabled"; 149 status = "disabled";
148 }; 150 };
149 151
@@ -153,6 +155,15 @@
153 <0xe605800c 0x20>; 155 <0xe605800c 0x20>;
154 gpio-controller; 156 gpio-controller;
155 #gpio-cells = <2>; 157 #gpio-cells = <2>;
158 interrupts-extended =
159 <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>,
160 <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
161 <&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>,
162 <&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>,
163 <&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>,
164 <&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
165 <&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
166 <&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
156 }; 167 };
157 168
158 tpu: pwm@e6600000 { 169 tpu: pwm@e6600000 {
@@ -162,36 +173,57 @@
162 #pwm-cells = <3>; 173 #pwm-cells = <3>;
163 }; 174 };
164 175
165 mmcif0: mmcif@e6bd0000 { 176 mmcif0: mmc@e6bd0000 {
166 compatible = "renesas,sh-mmcif"; 177 compatible = "renesas,sh-mmcif";
167 reg = <0xe6bd0000 0x100>; 178 reg = <0xe6bd0000 0x100>;
168 interrupt-parent = <&gic>; 179 interrupt-parent = <&gic>;
169 interrupts = <0 56 4 180 interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH
170 0 57 4>; 181 0 57 IRQ_TYPE_LEVEL_HIGH>;
171 status = "disabled"; 182 status = "disabled";
172 }; 183 };
173 184
174 sdhi0: sdhi@e6850000 { 185 sdhi0: sd@e6850000 {
175 compatible = "renesas,sdhi-r8a7740"; 186 compatible = "renesas,sdhi-r8a7740";
176 reg = <0xe6850000 0x100>; 187 reg = <0xe6850000 0x100>;
177 interrupt-parent = <&gic>; 188 interrupt-parent = <&gic>;
178 interrupts = <0 117 4 189 interrupts = <0 117 IRQ_TYPE_LEVEL_HIGH
179 0 118 4 190 0 118 IRQ_TYPE_LEVEL_HIGH
180 0 119 4>; 191 0 119 IRQ_TYPE_LEVEL_HIGH>;
181 cap-sd-highspeed; 192 cap-sd-highspeed;
182 cap-sdio-irq; 193 cap-sdio-irq;
183 status = "disabled"; 194 status = "disabled";
184 }; 195 };
185 196
186 sdhi1: sdhi@e6860000 { 197 sdhi1: sd@e6860000 {
187 compatible = "renesas,sdhi-r8a7740"; 198 compatible = "renesas,sdhi-r8a7740";
188 reg = <0xe6860000 0x100>; 199 reg = <0xe6860000 0x100>;
189 interrupt-parent = <&gic>; 200 interrupt-parent = <&gic>;
190 interrupts = <0 121 4 201 interrupts = <0 121 IRQ_TYPE_LEVEL_HIGH
191 0 122 4 202 0 122 IRQ_TYPE_LEVEL_HIGH
192 0 123 4>; 203 0 123 IRQ_TYPE_LEVEL_HIGH>;
204 cap-sd-highspeed;
205 cap-sdio-irq;
206 status = "disabled";
207 };
208
209 sdhi2: sd@e6870000 {
210 compatible = "renesas,sdhi-r8a7740";
211 reg = <0xe6870000 0x100>;
212 interrupt-parent = <&gic>;
213 interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH
214 0 126 IRQ_TYPE_LEVEL_HIGH
215 0 127 IRQ_TYPE_LEVEL_HIGH>;
193 cap-sd-highspeed; 216 cap-sd-highspeed;
194 cap-sdio-irq; 217 cap-sdio-irq;
195 status = "disabled"; 218 status = "disabled";
196 }; 219 };
220
221 sh_fsi2: sound@fe1f0000 {
222 #sound-dai-cells = <1>;
223 compatible = "renesas,sh_fsi2";
224 reg = <0xfe1f0000 0x400>;
225 interrupt-parent = <&gic>;
226 interrupts = <0 9 0x4>;
227 status = "disabled";
228 };
197}; 229};
diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index 969e386e852c..bb62c7a906f4 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17/dts-v1/; 17/dts-v1/;
18/include/ "r8a7778.dtsi" 18#include "r8a7778.dtsi"
19#include <dt-bindings/interrupt-controller/irq.h>
19 20
20/ { 21/ {
21 model = "bockw"; 22 model = "bockw";
@@ -45,13 +46,65 @@
45 46
46 phy-mode = "mii"; 47 phy-mode = "mii";
47 interrupt-parent = <&irqpin>; 48 interrupt-parent = <&irqpin>;
48 interrupts = <0 0>; /* IRQ0: hwirq 0 on irqpin */ 49 interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
49 reg-io-width = <4>; 50 reg-io-width = <4>;
50 vddvario-supply = <&fixedregulator3v3>; 51 vddvario-supply = <&fixedregulator3v3>;
51 vdd33a-supply = <&fixedregulator3v3>; 52 vdd33a-supply = <&fixedregulator3v3>;
52 }; 53 };
54
55};
56
57&mmcif {
58 pinctrl-0 = <&mmc_pins>;
59 pinctrl-names = "default";
60
61 vmmc-supply = <&fixedregulator3v3>;
62 bus-width = <8>;
63 broken-cd;
64 status = "okay";
53}; 65};
54 66
55&irqpin { 67&irqpin {
56 status = "okay"; 68 status = "okay";
57}; 69};
70
71&pfc {
72 pinctrl-0 = <&scif0_pins>;
73 pinctrl-names = "default";
74
75 scif0_pins: serial0 {
76 renesas,groups = "scif0_data_a", "scif0_ctrl";
77 renesas,function = "scif0";
78 };
79
80 mmc_pins: mmc {
81 renesas,groups = "mmc_data8", "mmc_ctrl";
82 renesas,function = "mmc";
83 };
84
85 sdhi0_pins: sd0 {
86 renesas,groups = "sdhi0_data4", "sdhi0_ctrl",
87 "sdhi0_cd", "sdhi0_wp";
88 renesas,function = "sdhi0";
89 };
90
91 hspi0_pins: hspi0 {
92 renesas,groups = "hspi0_a";
93 renesas,function = "hspi0";
94 };
95};
96
97&sdhi0 {
98 pinctrl-0 = <&sdhi0_pins>;
99 pinctrl-names = "default";
100
101 vmmc-supply = <&fixedregulator3v3>;
102 bus-width = <4>;
103 status = "okay";
104};
105
106&hspi0 {
107 pinctrl-0 = <&hspi0_pins>;
108 pinctrl-names = "default";
109 status = "okay";
110};
diff --git a/arch/arm/boot/dts/r8a7778-bockw.dts b/arch/arm/boot/dts/r8a7778-bockw.dts
index 12bbebc9c955..46a884d45175 100644
--- a/arch/arm/boot/dts/r8a7778-bockw.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw.dts
@@ -15,7 +15,7 @@
15 */ 15 */
16 16
17/dts-v1/; 17/dts-v1/;
18/include/ "r8a7778.dtsi" 18#include "r8a7778.dtsi"
19 19
20/ { 20/ {
21 model = "bockw"; 21 model = "bockw";
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index a6308a399e2d..ddb3bd7a8838 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -16,6 +16,8 @@
16 16
17/include/ "skeleton.dtsi" 17/include/ "skeleton.dtsi"
18 18
19#include <dt-bindings/interrupt-controller/irq.h>
20
19/ { 21/ {
20 compatible = "renesas,r8a7778"; 22 compatible = "renesas,r8a7778";
21 23
@@ -25,6 +27,12 @@
25 }; 27 };
26 }; 28 };
27 29
30 aliases {
31 spi0 = &hspi0;
32 spi1 = &hspi1;
33 spi2 = &hspi2;
34 };
35
28 gic: interrupt-controller@fe438000 { 36 gic: interrupt-controller@fe438000 {
29 compatible = "arm,cortex-a9-gic"; 37 compatible = "arm,cortex-a9-gic";
30 #interrupt-cells = <3>; 38 #interrupt-cells = <3>;
@@ -35,7 +43,7 @@
35 43
36 /* irqpin: IRQ0 - IRQ3 */ 44 /* irqpin: IRQ0 - IRQ3 */
37 irqpin: irqpin@fe78001c { 45 irqpin: irqpin@fe78001c {
38 compatible = "renesas,intc-irqpin"; 46 compatible = "renesas,intc-irqpin-r8a7778", "renesas,intc-irqpin";
39 #interrupt-cells = <2>; 47 #interrupt-cells = <2>;
40 interrupt-controller; 48 interrupt-controller;
41 status = "disabled"; /* default off */ 49 status = "disabled"; /* default off */
@@ -45,10 +53,10 @@
45 <0xfe780044 4>, 53 <0xfe780044 4>,
46 <0xfe780064 4>; 54 <0xfe780064 4>;
47 interrupt-parent = <&gic>; 55 interrupt-parent = <&gic>;
48 interrupts = <0 27 0x4 56 interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH
49 0 28 0x4 57 0 28 IRQ_TYPE_LEVEL_HIGH
50 0 29 0x4 58 0 29 IRQ_TYPE_LEVEL_HIGH
51 0 30 0x4>; 59 0 30 IRQ_TYPE_LEVEL_HIGH>;
52 sense-bitfield-width = <2>; 60 sense-bitfield-width = <2>;
53 }; 61 };
54 62
@@ -56,7 +64,7 @@
56 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; 64 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
57 reg = <0xffc40000 0x2c>; 65 reg = <0xffc40000 0x2c>;
58 interrupt-parent = <&gic>; 66 interrupt-parent = <&gic>;
59 interrupts = <0 103 0x4>; 67 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
60 #gpio-cells = <2>; 68 #gpio-cells = <2>;
61 gpio-controller; 69 gpio-controller;
62 gpio-ranges = <&pfc 0 0 32>; 70 gpio-ranges = <&pfc 0 0 32>;
@@ -68,7 +76,7 @@
68 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; 76 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
69 reg = <0xffc41000 0x2c>; 77 reg = <0xffc41000 0x2c>;
70 interrupt-parent = <&gic>; 78 interrupt-parent = <&gic>;
71 interrupts = <0 103 0x4>; 79 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
72 #gpio-cells = <2>; 80 #gpio-cells = <2>;
73 gpio-controller; 81 gpio-controller;
74 gpio-ranges = <&pfc 0 32 32>; 82 gpio-ranges = <&pfc 0 32 32>;
@@ -80,7 +88,7 @@
80 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; 88 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
81 reg = <0xffc42000 0x2c>; 89 reg = <0xffc42000 0x2c>;
82 interrupt-parent = <&gic>; 90 interrupt-parent = <&gic>;
83 interrupts = <0 103 0x4>; 91 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
84 #gpio-cells = <2>; 92 #gpio-cells = <2>;
85 gpio-controller; 93 gpio-controller;
86 gpio-ranges = <&pfc 0 64 32>; 94 gpio-ranges = <&pfc 0 64 32>;
@@ -92,7 +100,7 @@
92 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; 100 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
93 reg = <0xffc43000 0x2c>; 101 reg = <0xffc43000 0x2c>;
94 interrupt-parent = <&gic>; 102 interrupt-parent = <&gic>;
95 interrupts = <0 103 0x4>; 103 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
96 #gpio-cells = <2>; 104 #gpio-cells = <2>;
97 gpio-controller; 105 gpio-controller;
98 gpio-ranges = <&pfc 0 96 32>; 106 gpio-ranges = <&pfc 0 96 32>;
@@ -104,7 +112,7 @@
104 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; 112 compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
105 reg = <0xffc44000 0x2c>; 113 reg = <0xffc44000 0x2c>;
106 interrupt-parent = <&gic>; 114 interrupt-parent = <&gic>;
107 interrupts = <0 103 0x4>; 115 interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
108 #gpio-cells = <2>; 116 #gpio-cells = <2>;
109 gpio-controller; 117 gpio-controller;
110 gpio-ranges = <&pfc 0 128 27>; 118 gpio-ranges = <&pfc 0 128 27>;
@@ -114,6 +122,148 @@
114 122
115 pfc: pfc@fffc0000 { 123 pfc: pfc@fffc0000 {
116 compatible = "renesas,pfc-r8a7778"; 124 compatible = "renesas,pfc-r8a7778";
117 reg = <0xfffc000 0x118>; 125 reg = <0xfffc0000 0x118>;
126 };
127
128 i2c0: i2c@ffc70000 {
129 #address-cells = <1>;
130 #size-cells = <0>;
131 compatible = "renesas,i2c-r8a7778";
132 reg = <0xffc70000 0x1000>;
133 interrupt-parent = <&gic>;
134 interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
135 status = "disabled";
136 };
137
138 i2c1: i2c@ffc71000 {
139 #address-cells = <1>;
140 #size-cells = <0>;
141 compatible = "renesas,i2c-r8a7778";
142 reg = <0xffc71000 0x1000>;
143 interrupt-parent = <&gic>;
144 interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
145 status = "disabled";
146 };
147
148 i2c2: i2c@ffc72000 {
149 #address-cells = <1>;
150 #size-cells = <0>;
151 compatible = "renesas,i2c-r8a7778";
152 reg = <0xffc72000 0x1000>;
153 interrupt-parent = <&gic>;
154 interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
155 status = "disabled";
156 };
157
158 i2c3: i2c@ffc73000 {
159 #address-cells = <1>;
160 #size-cells = <0>;
161 compatible = "renesas,i2c-r8a7778";
162 reg = <0xffc73000 0x1000>;
163 interrupt-parent = <&gic>;
164 interrupts = <0 77 IRQ_TYPE_LEVEL_HIGH>;
165 status = "disabled";
166 };
167
168 mmcif: mmc@ffe4e000 {
169 compatible = "renesas,sh-mmcif";
170 reg = <0xffe4e000 0x100>;
171 interrupt-parent = <&gic>;
172 interrupts = <0 61 IRQ_TYPE_LEVEL_HIGH>;
173 status = "disabled";
174 };
175
176 sdhi0: sd@ffe4c000 {
177 compatible = "renesas,sdhi-r8a7778";
178 reg = <0xffe4c000 0x100>;
179 interrupt-parent = <&gic>;
180 interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>;
181 cap-sd-highspeed;
182 cap-sdio-irq;
183 status = "disabled";
184 };
185
186 sdhi1: sd@ffe4d000 {
187 compatible = "renesas,sdhi-r8a7778";
188 reg = <0xffe4d000 0x100>;
189 interrupt-parent = <&gic>;
190 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
191 cap-sd-highspeed;
192 cap-sdio-irq;
193 status = "disabled";
194 };
195
196 sdhi2: sd@ffe4f000 {
197 compatible = "renesas,sdhi-r8a7778";
198 reg = <0xffe4f000 0x100>;
199 interrupt-parent = <&gic>;
200 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
201 cap-sd-highspeed;
202 cap-sdio-irq;
203 status = "disabled";
204 };
205
206 i2c0: i2c@ffc70000 {
207 #address-cells = <1>;
208 #size-cells = <0>;
209 compatible = "renesas,i2c-r8a7778";
210 reg = <0xffc70000 0x1000>;
211 interrupt-parent = <&gic>;
212 interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
213 status = "disabled";
214 };
215
216 i2c1: i2c@ffc71000 {
217 #address-cells = <1>;
218 #size-cells = <0>;
219 compatible = "renesas,i2c-r8a7778";
220 reg = <0xffc71000 0x1000>;
221 interrupt-parent = <&gic>;
222 interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
223 status = "disabled";
224 };
225
226 i2c2: i2c@ffc72000 {
227 #address-cells = <1>;
228 #size-cells = <0>;
229 compatible = "renesas,i2c-r8a7778";
230 reg = <0xffc72000 0x1000>;
231 interrupt-parent = <&gic>;
232 interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
233 status = "disabled";
234 };
235
236 i2c3: i2c@ffc73000 {
237 #address-cells = <1>;
238 #size-cells = <0>;
239 compatible = "renesas,i2c-r8a7778";
240 reg = <0xffc73000 0x1000>;
241 interrupt-parent = <&gic>;
242 interrupts = <0 77 IRQ_TYPE_LEVEL_HIGH>;
243 status = "disabled";
244 };
245
246 hspi0: spi@fffc7000 {
247 compatible = "renesas,hspi";
248 reg = <0xfffc7000 0x18>;
249 interrupt-controller = <&gic>;
250 interrupts = <0 63 IRQ_TYPE_LEVEL_HIGH>;
251 status = "disabled";
252 };
253
254 hspi1: spi@fffc8000 {
255 compatible = "renesas,hspi";
256 reg = <0xfffc8000 0x18>;
257 interrupt-controller = <&gic>;
258 interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
259 status = "disabled";
260 };
261
262 hspi2: spi@fffc6000 {
263 compatible = "renesas,hspi";
264 reg = <0xfffc6000 0x18>;
265 interrupt-controller = <&gic>;
266 interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>;
267 status = "disabled";
118 }; 268 };
119}; 269};
diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
index ab4110aa3c3b..76f5eef7d1cc 100644
--- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -10,8 +10,9 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "r8a7779.dtsi" 13#include "r8a7779.dtsi"
14#include <dt-bindings/gpio/gpio.h> 14#include <dt-bindings/gpio/gpio.h>
15#include <dt-bindings/interrupt-controller/irq.h>
15 16
16/ { 17/ {
17 model = "marzen"; 18 model = "marzen";
@@ -43,7 +44,7 @@
43 44
44 phy-mode = "mii"; 45 phy-mode = "mii";
45 interrupt-parent = <&irqpin0>; 46 interrupt-parent = <&irqpin0>;
46 interrupts = <1 0>; /* IRQ1: hwirq 1 on irqpin0 */ 47 interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
47 reg-io-width = <4>; 48 reg-io-width = <4>;
48 vddvario-supply = <&fixedregulator3v3>; 49 vddvario-supply = <&fixedregulator3v3>;
49 vdd33a-supply = <&fixedregulator3v3>; 50 vdd33a-supply = <&fixedregulator3v3>;
@@ -68,7 +69,7 @@
68}; 69};
69 70
70&pfc { 71&pfc {
71 pinctrl-0 = <&scif2_pins &scif4_pins &sdhi0_pins>; 72 pinctrl-0 = <&scif2_pins &scif4_pins>;
72 pinctrl-names = "default"; 73 pinctrl-names = "default";
73 74
74 lan0_pins: lan0 { 75 lan0_pins: lan0 {
@@ -82,19 +83,38 @@
82 }; 83 };
83 }; 84 };
84 85
85 scif2_pins: scif2 { 86 scif2_pins: serial2 {
86 renesas,groups = "scif2_data_c"; 87 renesas,groups = "scif2_data_c";
87 renesas,function = "scif2"; 88 renesas,function = "scif2";
88 }; 89 };
89 90
90 scif4_pins: scif4 { 91 scif4_pins: serial4 {
91 renesas,groups = "scif4_data"; 92 renesas,groups = "scif4_data";
92 renesas,function = "scif4"; 93 renesas,function = "scif4";
93 }; 94 };
94 95
95 sdhi0_pins: sdhi0 { 96 sdhi0_pins: sd0 {
96 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd", 97 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
97 "sdhi0_wp";
98 renesas,function = "sdhi0"; 98 renesas,function = "sdhi0";
99 }; 99 };
100
101 hspi0_pins: hspi0 {
102 renesas,groups = "hspi0";
103 renesas,function = "hspi0";
104 };
105};
106
107&sdhi0 {
108 pinctrl-0 = <&sdhi0_pins>;
109 pinctrl-names = "default";
110
111 vmmc-supply = <&fixedregulator3v3>;
112 bus-width = <4>;
113 status = "okay";
114};
115
116&hspi0 {
117 pinctrl-0 = <&hspi0_pins>;
118 pinctrl-names = "default";
119 status = "okay";
100}; 120};
diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
index f3f7f7999736..a7af2c2371f2 100644
--- a/arch/arm/boot/dts/r8a7779-marzen.dts
+++ b/arch/arm/boot/dts/r8a7779-marzen.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "r8a7779.dtsi" 13#include "r8a7779.dtsi"
14 14
15/ { 15/ {
16 model = "marzen"; 16 model = "marzen";
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 19faeac3fd2e..d0561d4c7c46 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -11,6 +11,8 @@
11 11
12/include/ "skeleton.dtsi" 12/include/ "skeleton.dtsi"
13 13
14#include <dt-bindings/interrupt-controller/irq.h>
15
14/ { 16/ {
15 compatible = "renesas,r8a7779"; 17 compatible = "renesas,r8a7779";
16 18
@@ -40,6 +42,12 @@
40 }; 42 };
41 }; 43 };
42 44
45 aliases {
46 spi0 = &hspi0;
47 spi1 = &hspi1;
48 spi2 = &hspi2;
49 };
50
43 gic: interrupt-controller@f0001000 { 51 gic: interrupt-controller@f0001000 {
44 compatible = "arm,cortex-a9-gic"; 52 compatible = "arm,cortex-a9-gic";
45 #interrupt-cells = <3>; 53 #interrupt-cells = <3>;
@@ -52,7 +60,7 @@
52 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 60 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
53 reg = <0xffc40000 0x2c>; 61 reg = <0xffc40000 0x2c>;
54 interrupt-parent = <&gic>; 62 interrupt-parent = <&gic>;
55 interrupts = <0 141 0x4>; 63 interrupts = <0 141 IRQ_TYPE_LEVEL_HIGH>;
56 #gpio-cells = <2>; 64 #gpio-cells = <2>;
57 gpio-controller; 65 gpio-controller;
58 gpio-ranges = <&pfc 0 0 32>; 66 gpio-ranges = <&pfc 0 0 32>;
@@ -64,7 +72,7 @@
64 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 72 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
65 reg = <0xffc41000 0x2c>; 73 reg = <0xffc41000 0x2c>;
66 interrupt-parent = <&gic>; 74 interrupt-parent = <&gic>;
67 interrupts = <0 142 0x4>; 75 interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>;
68 #gpio-cells = <2>; 76 #gpio-cells = <2>;
69 gpio-controller; 77 gpio-controller;
70 gpio-ranges = <&pfc 0 32 32>; 78 gpio-ranges = <&pfc 0 32 32>;
@@ -76,7 +84,7 @@
76 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 84 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
77 reg = <0xffc42000 0x2c>; 85 reg = <0xffc42000 0x2c>;
78 interrupt-parent = <&gic>; 86 interrupt-parent = <&gic>;
79 interrupts = <0 143 0x4>; 87 interrupts = <0 143 IRQ_TYPE_LEVEL_HIGH>;
80 #gpio-cells = <2>; 88 #gpio-cells = <2>;
81 gpio-controller; 89 gpio-controller;
82 gpio-ranges = <&pfc 0 64 32>; 90 gpio-ranges = <&pfc 0 64 32>;
@@ -88,7 +96,7 @@
88 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 96 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
89 reg = <0xffc43000 0x2c>; 97 reg = <0xffc43000 0x2c>;
90 interrupt-parent = <&gic>; 98 interrupt-parent = <&gic>;
91 interrupts = <0 144 0x4>; 99 interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
92 #gpio-cells = <2>; 100 #gpio-cells = <2>;
93 gpio-controller; 101 gpio-controller;
94 gpio-ranges = <&pfc 0 96 32>; 102 gpio-ranges = <&pfc 0 96 32>;
@@ -100,7 +108,7 @@
100 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 108 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
101 reg = <0xffc44000 0x2c>; 109 reg = <0xffc44000 0x2c>;
102 interrupt-parent = <&gic>; 110 interrupt-parent = <&gic>;
103 interrupts = <0 145 0x4>; 111 interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
104 #gpio-cells = <2>; 112 #gpio-cells = <2>;
105 gpio-controller; 113 gpio-controller;
106 gpio-ranges = <&pfc 0 128 32>; 114 gpio-ranges = <&pfc 0 128 32>;
@@ -112,7 +120,7 @@
112 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 120 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
113 reg = <0xffc45000 0x2c>; 121 reg = <0xffc45000 0x2c>;
114 interrupt-parent = <&gic>; 122 interrupt-parent = <&gic>;
115 interrupts = <0 146 0x4>; 123 interrupts = <0 146 IRQ_TYPE_LEVEL_HIGH>;
116 #gpio-cells = <2>; 124 #gpio-cells = <2>;
117 gpio-controller; 125 gpio-controller;
118 gpio-ranges = <&pfc 0 160 32>; 126 gpio-ranges = <&pfc 0 160 32>;
@@ -124,7 +132,7 @@
124 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; 132 compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
125 reg = <0xffc46000 0x2c>; 133 reg = <0xffc46000 0x2c>;
126 interrupt-parent = <&gic>; 134 interrupt-parent = <&gic>;
127 interrupts = <0 147 0x4>; 135 interrupts = <0 147 IRQ_TYPE_LEVEL_HIGH>;
128 #gpio-cells = <2>; 136 #gpio-cells = <2>;
129 gpio-controller; 137 gpio-controller;
130 gpio-ranges = <&pfc 0 192 9>; 138 gpio-ranges = <&pfc 0 192 9>;
@@ -133,7 +141,7 @@
133 }; 141 };
134 142
135 irqpin0: irqpin@fe780010 { 143 irqpin0: irqpin@fe780010 {
136 compatible = "renesas,intc-irqpin"; 144 compatible = "renesas,intc-irqpin-r8a7779", "renesas,intc-irqpin";
137 #interrupt-cells = <2>; 145 #interrupt-cells = <2>;
138 status = "disabled"; 146 status = "disabled";
139 interrupt-controller; 147 interrupt-controller;
@@ -143,50 +151,50 @@
143 <0xfe780044 4>, 151 <0xfe780044 4>,
144 <0xfe780064 4>; 152 <0xfe780064 4>;
145 interrupt-parent = <&gic>; 153 interrupt-parent = <&gic>;
146 interrupts = <0 27 0x4 154 interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH
147 0 28 0x4 155 0 28 IRQ_TYPE_LEVEL_HIGH
148 0 29 0x4 156 0 29 IRQ_TYPE_LEVEL_HIGH
149 0 30 0x4>; 157 0 30 IRQ_TYPE_LEVEL_HIGH>;
150 sense-bitfield-width = <2>; 158 sense-bitfield-width = <2>;
151 }; 159 };
152 160
153 i2c0: i2c@ffc70000 { 161 i2c0: i2c@ffc70000 {
154 #address-cells = <1>; 162 #address-cells = <1>;
155 #size-cells = <0>; 163 #size-cells = <0>;
156 compatible = "renesas,rmobile-iic"; 164 compatible = "renesas,i2c-r8a7779";
157 reg = <0xffc70000 0x1000>; 165 reg = <0xffc70000 0x1000>;
158 interrupt-parent = <&gic>; 166 interrupt-parent = <&gic>;
159 interrupts = <0 79 0x4>; 167 interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
160 status = "disabled"; 168 status = "disabled";
161 }; 169 };
162 170
163 i2c1: i2c@ffc71000 { 171 i2c1: i2c@ffc71000 {
164 #address-cells = <1>; 172 #address-cells = <1>;
165 #size-cells = <0>; 173 #size-cells = <0>;
166 compatible = "renesas,rmobile-iic"; 174 compatible = "renesas,i2c-r8a7779";
167 reg = <0xffc71000 0x1000>; 175 reg = <0xffc71000 0x1000>;
168 interrupt-parent = <&gic>; 176 interrupt-parent = <&gic>;
169 interrupts = <0 82 0x4>; 177 interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
170 status = "disabled"; 178 status = "disabled";
171 }; 179 };
172 180
173 i2c2: i2c@ffc72000 { 181 i2c2: i2c@ffc72000 {
174 #address-cells = <1>; 182 #address-cells = <1>;
175 #size-cells = <0>; 183 #size-cells = <0>;
176 compatible = "renesas,rmobile-iic"; 184 compatible = "renesas,i2c-r8a7779";
177 reg = <0xffc72000 0x1000>; 185 reg = <0xffc72000 0x1000>;
178 interrupt-parent = <&gic>; 186 interrupt-parent = <&gic>;
179 interrupts = <0 80 0x4>; 187 interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
180 status = "disabled"; 188 status = "disabled";
181 }; 189 };
182 190
183 i2c3: i2c@ffc73000 { 191 i2c3: i2c@ffc73000 {
184 #address-cells = <1>; 192 #address-cells = <1>;
185 #size-cells = <0>; 193 #size-cells = <0>;
186 compatible = "renesas,rmobile-iic"; 194 compatible = "renesas,i2c-r8a7779";
187 reg = <0xffc73000 0x1000>; 195 reg = <0xffc73000 0x1000>;
188 interrupt-parent = <&gic>; 196 interrupt-parent = <&gic>;
189 interrupts = <0 81 0x4>; 197 interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
190 status = "disabled"; 198 status = "disabled";
191 }; 199 };
192 200
@@ -204,6 +212,70 @@
204 compatible = "renesas,rcar-sata"; 212 compatible = "renesas,rcar-sata";
205 reg = <0xfc600000 0x2000>; 213 reg = <0xfc600000 0x2000>;
206 interrupt-parent = <&gic>; 214 interrupt-parent = <&gic>;
207 interrupts = <0 100 0x4>; 215 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
216 };
217
218 sdhi0: sd@ffe4c000 {
219 compatible = "renesas,sdhi-r8a7779";
220 reg = <0xffe4c000 0x100>;
221 interrupt-parent = <&gic>;
222 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
223 cap-sd-highspeed;
224 cap-sdio-irq;
225 status = "disabled";
226 };
227
228 sdhi1: sd@ffe4d000 {
229 compatible = "renesas,sdhi-r8a7779";
230 reg = <0xffe4d000 0x100>;
231 interrupt-parent = <&gic>;
232 interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
233 cap-sd-highspeed;
234 cap-sdio-irq;
235 status = "disabled";
236 };
237
238 sdhi2: sd@ffe4e000 {
239 compatible = "renesas,sdhi-r8a7779";
240 reg = <0xffe4e000 0x100>;
241 interrupt-parent = <&gic>;
242 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
243 cap-sd-highspeed;
244 cap-sdio-irq;
245 status = "disabled";
246 };
247
248 sdhi3: sd@ffe4f000 {
249 compatible = "renesas,sdhi-r8a7779";
250 reg = <0xffe4f000 0x100>;
251 interrupt-parent = <&gic>;
252 interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
253 cap-sd-highspeed;
254 cap-sdio-irq;
255 status = "disabled";
256 };
257
258 hspi0: spi@fffc7000 {
259 compatible = "renesas,hspi";
260 reg = <0xfffc7000 0x18>;
261 interrupt-controller = <&gic>;
262 interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
263 status = "disabled";
264 };
265
266 hspi1: spi@fffc8000 {
267 compatible = "renesas,hspi";
268 reg = <0xfffc8000 0x18>;
269 interrupt-controller = <&gic>;
270 interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
271 status = "disabled";
272 };
273
274 hspi2: spi@fffc6000 {
275 compatible = "renesas,hspi";
276 reg = <0xfffc6000 0x18>;
277 interrupt-controller = <&gic>;
278 interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
279 status = "disabled";
208 }; 280 };
209}; 281};
diff --git a/arch/arm/boot/dts/r8a7790-lager-reference.dts b/arch/arm/boot/dts/r8a7790-lager-reference.dts
deleted file mode 100644
index c462ef138922..000000000000
--- a/arch/arm/boot/dts/r8a7790-lager-reference.dts
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * Device Tree Source for the Lager 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/ "r8a7790.dtsi"
13#include <dt-bindings/gpio/gpio.h>
14
15/ {
16 model = "Lager";
17 compatible = "renesas,lager-reference", "renesas,r8a7790";
18
19 chosen {
20 bootargs = "console=ttySC6,115200 ignore_loglevel rw";
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
33 leds {
34 compatible = "gpio-leds";
35 led6 {
36 gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>;
37 };
38 led7 {
39 gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>;
40 };
41 led8 {
42 gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>;
43 };
44 };
45};
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 203bd089af29..57569cba1528 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -9,7 +9,8 @@
9 */ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "r8a7790.dtsi" 12#include "r8a7790.dtsi"
13#include <dt-bindings/gpio/gpio.h>
13 14
14/ { 15/ {
15 model = "Lager"; 16 model = "Lager";
@@ -24,8 +25,69 @@
24 reg = <0 0x40000000 0 0x80000000>; 25 reg = <0 0x40000000 0 0x80000000>;
25 }; 26 };
26 27
28 memory@180000000 {
29 device_type = "memory";
30 reg = <1 0x80000000 0 0x80000000>;
31 };
32
27 lbsc { 33 lbsc {
28 #address-cells = <1>; 34 #address-cells = <1>;
29 #size-cells = <1>; 35 #size-cells = <1>;
30 }; 36 };
37
38 leds {
39 compatible = "gpio-leds";
40 led6 {
41 gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>;
42 };
43 led7 {
44 gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>;
45 };
46 led8 {
47 gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>;
48 };
49 };
50
51 fixedregulator3v3: fixedregulator@0 {
52 compatible = "regulator-fixed";
53 regulator-name = "fixed-3.3V";
54 regulator-min-microvolt = <3300000>;
55 regulator-max-microvolt = <3300000>;
56 regulator-boot-on;
57 regulator-always-on;
58 };
59};
60
61&extal_clk {
62 clock-frequency = <20000000>;
63};
64
65&pfc {
66 pinctrl-0 = <&scif0_pins &scif1_pins>;
67 pinctrl-names = "default";
68
69 scif0_pins: serial0 {
70 renesas,groups = "scif0_data";
71 renesas,function = "scif0";
72 };
73
74 scif1_pins: serial1 {
75 renesas,groups = "scif1_data";
76 renesas,function = "scif1";
77 };
78
79 mmc1_pins: mmc1 {
80 renesas,groups = "mmc1_data8", "mmc1_ctrl";
81 renesas,function = "mmc1";
82 };
83};
84
85&mmcif1 {
86 pinctrl-0 = <&mmc1_pins>;
87 pinctrl-names = "default";
88
89 vmmc-supply = <&fixedregulator3v3>;
90 bus-width = <8>;
91 non-removable;
92 status = "okay";
31}; 93};
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 9987dd0e9c59..71b1251f79c7 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -8,6 +8,10 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11#include <dt-bindings/clock/r8a7790-clock.h>
12#include <dt-bindings/interrupt-controller/arm-gic.h>
13#include <dt-bindings/interrupt-controller/irq.h>
14
11/ { 15/ {
12 compatible = "renesas,r8a7790"; 16 compatible = "renesas,r8a7790";
13 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
@@ -84,14 +88,14 @@
84 <0 0xf1002000 0 0x1000>, 88 <0 0xf1002000 0 0x1000>,
85 <0 0xf1004000 0 0x2000>, 89 <0 0xf1004000 0 0x2000>,
86 <0 0xf1006000 0 0x2000>; 90 <0 0xf1006000 0 0x2000>;
87 interrupts = <1 9 0xf04>; 91 interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
88 }; 92 };
89 93
90 gpio0: gpio@e6050000 { 94 gpio0: gpio@e6050000 {
91 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; 95 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
92 reg = <0 0xe6050000 0 0x50>; 96 reg = <0 0xe6050000 0 0x50>;
93 interrupt-parent = <&gic>; 97 interrupt-parent = <&gic>;
94 interrupts = <0 4 0x4>; 98 interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
95 #gpio-cells = <2>; 99 #gpio-cells = <2>;
96 gpio-controller; 100 gpio-controller;
97 gpio-ranges = <&pfc 0 0 32>; 101 gpio-ranges = <&pfc 0 0 32>;
@@ -103,7 +107,7 @@
103 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; 107 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
104 reg = <0 0xe6051000 0 0x50>; 108 reg = <0 0xe6051000 0 0x50>;
105 interrupt-parent = <&gic>; 109 interrupt-parent = <&gic>;
106 interrupts = <0 5 0x4>; 110 interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>;
107 #gpio-cells = <2>; 111 #gpio-cells = <2>;
108 gpio-controller; 112 gpio-controller;
109 gpio-ranges = <&pfc 0 32 32>; 113 gpio-ranges = <&pfc 0 32 32>;
@@ -115,7 +119,7 @@
115 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; 119 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
116 reg = <0 0xe6052000 0 0x50>; 120 reg = <0 0xe6052000 0 0x50>;
117 interrupt-parent = <&gic>; 121 interrupt-parent = <&gic>;
118 interrupts = <0 6 0x4>; 122 interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
119 #gpio-cells = <2>; 123 #gpio-cells = <2>;
120 gpio-controller; 124 gpio-controller;
121 gpio-ranges = <&pfc 0 64 32>; 125 gpio-ranges = <&pfc 0 64 32>;
@@ -127,7 +131,7 @@
127 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; 131 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
128 reg = <0 0xe6053000 0 0x50>; 132 reg = <0 0xe6053000 0 0x50>;
129 interrupt-parent = <&gic>; 133 interrupt-parent = <&gic>;
130 interrupts = <0 7 0x4>; 134 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
131 #gpio-cells = <2>; 135 #gpio-cells = <2>;
132 gpio-controller; 136 gpio-controller;
133 gpio-ranges = <&pfc 0 96 32>; 137 gpio-ranges = <&pfc 0 96 32>;
@@ -139,7 +143,7 @@
139 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; 143 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
140 reg = <0 0xe6054000 0 0x50>; 144 reg = <0 0xe6054000 0 0x50>;
141 interrupt-parent = <&gic>; 145 interrupt-parent = <&gic>;
142 interrupts = <0 8 0x4>; 146 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
143 #gpio-cells = <2>; 147 #gpio-cells = <2>;
144 gpio-controller; 148 gpio-controller;
145 gpio-ranges = <&pfc 0 128 32>; 149 gpio-ranges = <&pfc 0 128 32>;
@@ -151,7 +155,7 @@
151 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; 155 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
152 reg = <0 0xe6055000 0 0x50>; 156 reg = <0 0xe6055000 0 0x50>;
153 interrupt-parent = <&gic>; 157 interrupt-parent = <&gic>;
154 interrupts = <0 9 0x4>; 158 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
155 #gpio-cells = <2>; 159 #gpio-cells = <2>;
156 gpio-controller; 160 gpio-controller;
157 gpio-ranges = <&pfc 0 160 32>; 161 gpio-ranges = <&pfc 0 160 32>;
@@ -159,21 +163,31 @@
159 interrupt-controller; 163 interrupt-controller;
160 }; 164 };
161 165
166 thermal@e61f0000 {
167 compatible = "renesas,thermal-r8a7790", "renesas,rcar-thermal";
168 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
169 interrupt-parent = <&gic>;
170 interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
171 };
172
162 timer { 173 timer {
163 compatible = "arm,armv7-timer"; 174 compatible = "arm,armv7-timer";
164 interrupts = <1 13 0xf08>, 175 interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
165 <1 14 0xf08>, 176 <1 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
166 <1 11 0xf08>, 177 <1 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
167 <1 10 0xf08>; 178 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
168 }; 179 };
169 180
170 irqc0: interrupt-controller@e61c0000 { 181 irqc0: interrupt-controller@e61c0000 {
171 compatible = "renesas,irqc"; 182 compatible = "renesas,irqc-r8a7790", "renesas,irqc";
172 #interrupt-cells = <2>; 183 #interrupt-cells = <2>;
173 interrupt-controller; 184 interrupt-controller;
174 reg = <0 0xe61c0000 0 0x200>; 185 reg = <0 0xe61c0000 0 0x200>;
175 interrupt-parent = <&gic>; 186 interrupt-parent = <&gic>;
176 interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>; 187 interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
188 <0 1 IRQ_TYPE_LEVEL_HIGH>,
189 <0 2 IRQ_TYPE_LEVEL_HIGH>,
190 <0 3 IRQ_TYPE_LEVEL_HIGH>;
177 }; 191 };
178 192
179 i2c0: i2c@e6508000 { 193 i2c0: i2c@e6508000 {
@@ -182,7 +196,8 @@
182 compatible = "renesas,i2c-r8a7790"; 196 compatible = "renesas,i2c-r8a7790";
183 reg = <0 0xe6508000 0 0x40>; 197 reg = <0 0xe6508000 0 0x40>;
184 interrupt-parent = <&gic>; 198 interrupt-parent = <&gic>;
185 interrupts = <0 287 0x4>; 199 interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
200 clocks = <&mstp9_clks R8A7790_CLK_I2C0>;
186 status = "disabled"; 201 status = "disabled";
187 }; 202 };
188 203
@@ -192,7 +207,8 @@
192 compatible = "renesas,i2c-r8a7790"; 207 compatible = "renesas,i2c-r8a7790";
193 reg = <0 0xe6518000 0 0x40>; 208 reg = <0 0xe6518000 0 0x40>;
194 interrupt-parent = <&gic>; 209 interrupt-parent = <&gic>;
195 interrupts = <0 288 0x4>; 210 interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>;
211 clocks = <&mstp9_clks R8A7790_CLK_I2C1>;
196 status = "disabled"; 212 status = "disabled";
197 }; 213 };
198 214
@@ -202,7 +218,8 @@
202 compatible = "renesas,i2c-r8a7790"; 218 compatible = "renesas,i2c-r8a7790";
203 reg = <0 0xe6530000 0 0x40>; 219 reg = <0 0xe6530000 0 0x40>;
204 interrupt-parent = <&gic>; 220 interrupt-parent = <&gic>;
205 interrupts = <0 286 0x4>; 221 interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>;
222 clocks = <&mstp9_clks R8A7790_CLK_I2C2>;
206 status = "disabled"; 223 status = "disabled";
207 }; 224 };
208 225
@@ -212,24 +229,27 @@
212 compatible = "renesas,i2c-r8a7790"; 229 compatible = "renesas,i2c-r8a7790";
213 reg = <0 0xe6540000 0 0x40>; 230 reg = <0 0xe6540000 0 0x40>;
214 interrupt-parent = <&gic>; 231 interrupt-parent = <&gic>;
215 interrupts = <0 290 0x4>; 232 interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>;
233 clocks = <&mstp9_clks R8A7790_CLK_I2C3>;
216 status = "disabled"; 234 status = "disabled";
217 }; 235 };
218 236
219 mmcif0: mmcif@ee200000 { 237 mmcif0: mmcif@ee200000 {
220 compatible = "renesas,sh-mmcif"; 238 compatible = "renesas,mmcif-r8a7790", "renesas,sh-mmcif";
221 reg = <0 0xee200000 0 0x80>; 239 reg = <0 0xee200000 0 0x80>;
222 interrupt-parent = <&gic>; 240 interrupt-parent = <&gic>;
223 interrupts = <0 169 0x4>; 241 interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
242 clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>;
224 reg-io-width = <4>; 243 reg-io-width = <4>;
225 status = "disabled"; 244 status = "disabled";
226 }; 245 };
227 246
228 mmcif1: mmcif@ee220000 { 247 mmcif1: mmc@ee220000 {
229 compatible = "renesas,sh-mmcif"; 248 compatible = "renesas,mmcif-r8a7790", "renesas,sh-mmcif";
230 reg = <0 0xee220000 0 0x80>; 249 reg = <0 0xee220000 0 0x80>;
231 interrupt-parent = <&gic>; 250 interrupt-parent = <&gic>;
232 interrupts = <0 170 0x4>; 251 interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>;
252 clocks = <&mstp3_clks R8A7790_CLK_MMCIF1>;
233 reg-io-width = <4>; 253 reg-io-width = <4>;
234 status = "disabled"; 254 status = "disabled";
235 }; 255 };
@@ -239,39 +259,372 @@
239 reg = <0 0xe6060000 0 0x250>; 259 reg = <0 0xe6060000 0 0x250>;
240 }; 260 };
241 261
242 sdhi0: sdhi@ee100000 { 262 sdhi0: sd@ee100000 {
243 compatible = "renesas,sdhi-r8a7790"; 263 compatible = "renesas,sdhi-r8a7790";
244 reg = <0 0xee100000 0 0x200>; 264 reg = <0 0xee100000 0 0x200>;
245 interrupt-parent = <&gic>; 265 interrupt-parent = <&gic>;
246 interrupts = <0 165 4>; 266 interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>;
267 clocks = <&mstp3_clks R8A7790_CLK_SDHI0>;
247 cap-sd-highspeed; 268 cap-sd-highspeed;
248 status = "disabled"; 269 status = "disabled";
249 }; 270 };
250 271
251 sdhi1: sdhi@ee120000 { 272 sdhi1: sd@ee120000 {
252 compatible = "renesas,sdhi-r8a7790"; 273 compatible = "renesas,sdhi-r8a7790";
253 reg = <0 0xee120000 0 0x200>; 274 reg = <0 0xee120000 0 0x200>;
254 interrupt-parent = <&gic>; 275 interrupt-parent = <&gic>;
255 interrupts = <0 166 4>; 276 interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>;
277 clocks = <&mstp3_clks R8A7790_CLK_SDHI1>;
256 cap-sd-highspeed; 278 cap-sd-highspeed;
257 status = "disabled"; 279 status = "disabled";
258 }; 280 };
259 281
260 sdhi2: sdhi@ee140000 { 282 sdhi2: sd@ee140000 {
261 compatible = "renesas,sdhi-r8a7790"; 283 compatible = "renesas,sdhi-r8a7790";
262 reg = <0 0xee140000 0 0x100>; 284 reg = <0 0xee140000 0 0x100>;
263 interrupt-parent = <&gic>; 285 interrupt-parent = <&gic>;
264 interrupts = <0 167 4>; 286 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>;
287 clocks = <&mstp3_clks R8A7790_CLK_SDHI2>;
265 cap-sd-highspeed; 288 cap-sd-highspeed;
266 status = "disabled"; 289 status = "disabled";
267 }; 290 };
268 291
269 sdhi3: sdhi@ee160000 { 292 sdhi3: sd@ee160000 {
270 compatible = "renesas,sdhi-r8a7790"; 293 compatible = "renesas,sdhi-r8a7790";
271 reg = <0 0xee160000 0 0x100>; 294 reg = <0 0xee160000 0 0x100>;
272 interrupt-parent = <&gic>; 295 interrupt-parent = <&gic>;
273 interrupts = <0 168 4>; 296 interrupts = <0 168 IRQ_TYPE_LEVEL_HIGH>;
297 clocks = <&mstp3_clks R8A7790_CLK_SDHI3>;
274 cap-sd-highspeed; 298 cap-sd-highspeed;
275 status = "disabled"; 299 status = "disabled";
276 }; 300 };
301
302 clocks {
303 #address-cells = <2>;
304 #size-cells = <2>;
305 ranges;
306
307 /* External root clock */
308 extal_clk: extal_clk {
309 compatible = "fixed-clock";
310 #clock-cells = <0>;
311 /* This value must be overriden by the board. */
312 clock-frequency = <0>;
313 clock-output-names = "extal";
314 };
315
316 /* Special CPG clocks */
317 cpg_clocks: cpg_clocks@e6150000 {
318 compatible = "renesas,r8a7790-cpg-clocks",
319 "renesas,rcar-gen2-cpg-clocks";
320 reg = <0 0xe6150000 0 0x1000>;
321 clocks = <&extal_clk>;
322 #clock-cells = <1>;
323 clock-output-names = "main", "pll0", "pll1", "pll3",
324 "lb", "qspi", "sdh", "sd0", "sd1",
325 "z";
326 };
327
328 /* Variable factor clocks */
329 sd2_clk: sd2_clk@e6150078 {
330 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
331 reg = <0 0xe6150078 0 4>;
332 clocks = <&pll1_div2_clk>;
333 #clock-cells = <0>;
334 clock-output-names = "sd2";
335 };
336 sd3_clk: sd3_clk@e615007c {
337 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
338 reg = <0 0xe615007c 0 4>;
339 clocks = <&pll1_div2_clk>;
340 #clock-cells = <0>;
341 clock-output-names = "sd3";
342 };
343 mmc0_clk: mmc0_clk@e6150240 {
344 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
345 reg = <0 0xe6150240 0 4>;
346 clocks = <&pll1_div2_clk>;
347 #clock-cells = <0>;
348 clock-output-names = "mmc0";
349 };
350 mmc1_clk: mmc1_clk@e6150244 {
351 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
352 reg = <0 0xe6150244 0 4>;
353 clocks = <&pll1_div2_clk>;
354 #clock-cells = <0>;
355 clock-output-names = "mmc1";
356 };
357 ssp_clk: ssp_clk@e6150248 {
358 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
359 reg = <0 0xe6150248 0 4>;
360 clocks = <&pll1_div2_clk>;
361 #clock-cells = <0>;
362 clock-output-names = "ssp";
363 };
364 ssprs_clk: ssprs_clk@e615024c {
365 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
366 reg = <0 0xe615024c 0 4>;
367 clocks = <&pll1_div2_clk>;
368 #clock-cells = <0>;
369 clock-output-names = "ssprs";
370 };
371
372 /* Fixed factor clocks */
373 pll1_div2_clk: pll1_div2_clk {
374 compatible = "fixed-factor-clock";
375 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
376 #clock-cells = <0>;
377 clock-div = <2>;
378 clock-mult = <1>;
379 clock-output-names = "pll1_div2";
380 };
381 z2_clk: z2_clk {
382 compatible = "fixed-factor-clock";
383 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
384 #clock-cells = <0>;
385 clock-div = <2>;
386 clock-mult = <1>;
387 clock-output-names = "z2";
388 };
389 zg_clk: zg_clk {
390 compatible = "fixed-factor-clock";
391 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
392 #clock-cells = <0>;
393 clock-div = <3>;
394 clock-mult = <1>;
395 clock-output-names = "zg";
396 };
397 zx_clk: zx_clk {
398 compatible = "fixed-factor-clock";
399 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
400 #clock-cells = <0>;
401 clock-div = <3>;
402 clock-mult = <1>;
403 clock-output-names = "zx";
404 };
405 zs_clk: zs_clk {
406 compatible = "fixed-factor-clock";
407 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
408 #clock-cells = <0>;
409 clock-div = <6>;
410 clock-mult = <1>;
411 clock-output-names = "zs";
412 };
413 hp_clk: hp_clk {
414 compatible = "fixed-factor-clock";
415 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
416 #clock-cells = <0>;
417 clock-div = <12>;
418 clock-mult = <1>;
419 clock-output-names = "hp";
420 };
421 i_clk: i_clk {
422 compatible = "fixed-factor-clock";
423 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
424 #clock-cells = <0>;
425 clock-div = <2>;
426 clock-mult = <1>;
427 clock-output-names = "i";
428 };
429 b_clk: b_clk {
430 compatible = "fixed-factor-clock";
431 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
432 #clock-cells = <0>;
433 clock-div = <12>;
434 clock-mult = <1>;
435 clock-output-names = "b";
436 };
437 p_clk: p_clk {
438 compatible = "fixed-factor-clock";
439 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
440 #clock-cells = <0>;
441 clock-div = <24>;
442 clock-mult = <1>;
443 clock-output-names = "p";
444 };
445 cl_clk: cl_clk {
446 compatible = "fixed-factor-clock";
447 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
448 #clock-cells = <0>;
449 clock-div = <48>;
450 clock-mult = <1>;
451 clock-output-names = "cl";
452 };
453 m2_clk: m2_clk {
454 compatible = "fixed-factor-clock";
455 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
456 #clock-cells = <0>;
457 clock-div = <8>;
458 clock-mult = <1>;
459 clock-output-names = "m2";
460 };
461 imp_clk: imp_clk {
462 compatible = "fixed-factor-clock";
463 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
464 #clock-cells = <0>;
465 clock-div = <4>;
466 clock-mult = <1>;
467 clock-output-names = "imp";
468 };
469 rclk_clk: rclk_clk {
470 compatible = "fixed-factor-clock";
471 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
472 #clock-cells = <0>;
473 clock-div = <(48 * 1024)>;
474 clock-mult = <1>;
475 clock-output-names = "rclk";
476 };
477 oscclk_clk: oscclk_clk {
478 compatible = "fixed-factor-clock";
479 clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
480 #clock-cells = <0>;
481 clock-div = <(12 * 1024)>;
482 clock-mult = <1>;
483 clock-output-names = "oscclk";
484 };
485 zb3_clk: zb3_clk {
486 compatible = "fixed-factor-clock";
487 clocks = <&cpg_clocks R8A7790_CLK_PLL3>;
488 #clock-cells = <0>;
489 clock-div = <4>;
490 clock-mult = <1>;
491 clock-output-names = "zb3";
492 };
493 zb3d2_clk: zb3d2_clk {
494 compatible = "fixed-factor-clock";
495 clocks = <&cpg_clocks R8A7790_CLK_PLL3>;
496 #clock-cells = <0>;
497 clock-div = <8>;
498 clock-mult = <1>;
499 clock-output-names = "zb3d2";
500 };
501 ddr_clk: ddr_clk {
502 compatible = "fixed-factor-clock";
503 clocks = <&cpg_clocks R8A7790_CLK_PLL3>;
504 #clock-cells = <0>;
505 clock-div = <8>;
506 clock-mult = <1>;
507 clock-output-names = "ddr";
508 };
509 mp_clk: mp_clk {
510 compatible = "fixed-factor-clock";
511 clocks = <&pll1_div2_clk>;
512 #clock-cells = <0>;
513 clock-div = <15>;
514 clock-mult = <1>;
515 clock-output-names = "mp";
516 };
517 cp_clk: cp_clk {
518 compatible = "fixed-factor-clock";
519 clocks = <&extal_clk>;
520 #clock-cells = <0>;
521 clock-div = <2>;
522 clock-mult = <1>;
523 clock-output-names = "cp";
524 };
525
526 /* Gate clocks */
527 mstp0_clks: mstp0_clks@e6150130 {
528 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
529 reg = <0 0xe6150130 0 4>, <0 0xe6150030 0 4>;
530 clocks = <&mp_clk>;
531 #clock-cells = <1>;
532 renesas,clock-indices = <R8A7790_CLK_MSIOF0>;
533 clock-output-names = "msiof0";
534 };
535 mstp1_clks: mstp1_clks@e6150134 {
536 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
537 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
538 clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
539 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>,
540 <&zs_clk>;
541 #clock-cells = <1>;
542 renesas,clock-indices = <
543 R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2
544 R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1
545 R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_RT R8A7790_CLK_VSP1_SY
546 >;
547 clock-output-names =
548 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
549 "vsp1-du0", "vsp1-rt", "vsp1-sy";
550 };
551 mstp2_clks: mstp2_clks@e6150138 {
552 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
553 reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
554 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
555 <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>;
556 #clock-cells = <1>;
557 renesas,clock-indices = <
558 R8A7790_CLK_SCIFA2 R8A7790_CLK_SCIFA1 R8A7790_CLK_SCIFA0
559 R8A7790_CLK_MSIOF2 R8A7790_CLK_SCIFB0 R8A7790_CLK_SCIFB1
560 R8A7790_CLK_MSIOF1 R8A7790_CLK_MSIOF3 R8A7790_CLK_SCIFB2
561 >;
562 clock-output-names =
563 "scifa2", "scifa1", "scifa0", "msiof2", "scifb0",
564 "scifb1", "msiof1", "msiof3", "scifb2";
565 };
566 mstp3_clks: mstp3_clks@e615013c {
567 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
568 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
569 clocks = <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, <&sd2_clk>,
570 <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>,
571 <&mmc0_clk>, <&rclk_clk>;
572 #clock-cells = <1>;
573 renesas,clock-indices = <
574 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
575 R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
576 R8A7790_CLK_MMCIF0 R8A7790_CLK_CMT1
577 >;
578 clock-output-names =
579 "tpu0", "mmcif1", "sdhi3", "sdhi2",
580 "sdhi1", "sdhi0", "mmcif0", "cmt1";
581 };
582 mstp5_clks: mstp5_clks@e6150144 {
583 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
584 reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
585 clocks = <&extal_clk>, <&p_clk>;
586 #clock-cells = <1>;
587 renesas,clock-indices = <R8A7790_CLK_THERMAL R8A7790_CLK_PWM>;
588 clock-output-names = "thermal", "pwm";
589 };
590 mstp7_clks: mstp7_clks@e615014c {
591 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
592 reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
593 clocks = <&mp_clk>, <&mp_clk>, <&zs_clk>, <&zs_clk>, <&p_clk>,
594 <&p_clk>, <&zx_clk>, <&zx_clk>, <&zx_clk>, <&zx_clk>,
595 <&zx_clk>;
596 #clock-cells = <1>;
597 renesas,clock-indices = <
598 R8A7790_CLK_EHCI R8A7790_CLK_HSUSB R8A7790_CLK_HSCIF1
599 R8A7790_CLK_HSCIF0 R8A7790_CLK_SCIF1 R8A7790_CLK_SCIF0
600 R8A7790_CLK_DU2 R8A7790_CLK_DU1 R8A7790_CLK_DU0
601 R8A7790_CLK_LVDS1 R8A7790_CLK_LVDS0
602 >;
603 clock-output-names =
604 "ehci", "hsusb", "hscif1", "hscif0", "scif1",
605 "scif0", "du2", "du1", "du0", "lvds1", "lvds0";
606 };
607 mstp8_clks: mstp8_clks@e6150990 {
608 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
609 reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
610 clocks = <&p_clk>;
611 #clock-cells = <1>;
612 renesas,clock-indices = <R8A7790_CLK_ETHER>;
613 clock-output-names = "ether";
614 };
615 mstp9_clks: mstp9_clks@e6150994 {
616 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
617 reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>;
618 clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7790_CLK_QSPI>,
619 <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>;
620 #clock-cells = <1>;
621 renesas,clock-indices = <
622 R8A7790_CLK_RCAN1 R8A7790_CLK_RCAN0 R8A7790_CLK_QSPI_MOD
623 R8A7790_CLK_I2C3 R8A7790_CLK_I2C2 R8A7790_CLK_I2C1
624 R8A7790_CLK_I2C0
625 >;
626 clock-output-names =
627 "rcan1", "rcan0", "qspi_mod", "i2c3", "i2c2", "i2c1", "i2c0";
628 };
629 };
277}; 630};
diff --git a/arch/arm/boot/dts/r8a7791-koelsch-reference.dts b/arch/arm/boot/dts/r8a7791-koelsch-reference.dts
new file mode 100644
index 000000000000..588ca17ea1f0
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7791-koelsch-reference.dts
@@ -0,0 +1,115 @@
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#include <dt-bindings/gpio/gpio.h>
15
16/ {
17 model = "Koelsch";
18 compatible = "renesas,koelsch-reference", "renesas,r8a7791";
19
20 chosen {
21 bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
22 };
23
24 memory@40000000 {
25 device_type = "memory";
26 reg = <0 0x40000000 0 0x80000000>;
27 };
28
29 lbsc {
30 #address-cells = <1>;
31 #size-cells = <1>;
32 };
33
34 gpio-keys {
35 compatible = "gpio-keys";
36
37 key-a {
38 gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
39 linux,code = <30>;
40 label = "SW30";
41 gpio-key,wakeup;
42 debounce-interval = <20>;
43 };
44 key-b {
45 gpios = <&gpio7 1 GPIO_ACTIVE_LOW>;
46 linux,code = <48>;
47 label = "SW31";
48 gpio-key,wakeup;
49 debounce-interval = <20>;
50 };
51 key-c {
52 gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
53 linux,code = <46>;
54 label = "SW32";
55 gpio-key,wakeup;
56 debounce-interval = <20>;
57 };
58 key-d {
59 gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
60 linux,code = <32>;
61 label = "SW33";
62 gpio-key,wakeup;
63 debounce-interval = <20>;
64 };
65 key-e {
66 gpios = <&gpio7 4 GPIO_ACTIVE_LOW>;
67 linux,code = <18>;
68 label = "SW34";
69 gpio-key,wakeup;
70 debounce-interval = <20>;
71 };
72 key-f {
73 gpios = <&gpio7 5 GPIO_ACTIVE_LOW>;
74 linux,code = <33>;
75 label = "SW35";
76 gpio-key,wakeup;
77 debounce-interval = <20>;
78 };
79 key-g {
80 gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
81 linux,code = <34>;
82 label = "SW36";
83 gpio-key,wakeup;
84 debounce-interval = <20>;
85 };
86 };
87
88 leds {
89 compatible = "gpio-leds";
90 led6 {
91 gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
92 };
93 led7 {
94 gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
95 };
96 led8 {
97 gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
98 };
99 };
100};
101
102&pfc {
103 pinctrl-0 = <&scif0_pins &scif1_pins>;
104 pinctrl-names = "default";
105
106 scif0_pins: serial0 {
107 renesas,groups = "scif0_data_d";
108 renesas,function = "scif0";
109 };
110
111 scif1_pins: serial1 {
112 renesas,groups = "scif1_data_d";
113 renesas,function = "scif1";
114 };
115};
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 1ce5250ec278..fd556c3483e3 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -10,7 +10,8 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "r8a7791.dtsi" 13#include "r8a7791.dtsi"
14#include <dt-bindings/gpio/gpio.h>
14 15
15/ { 16/ {
16 model = "Koelsch"; 17 model = "Koelsch";
@@ -29,4 +30,36 @@
29 #address-cells = <1>; 30 #address-cells = <1>;
30 #size-cells = <1>; 31 #size-cells = <1>;
31 }; 32 };
33
34 leds {
35 compatible = "gpio-leds";
36 led6 {
37 gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
38 };
39 led7 {
40 gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
41 };
42 led8 {
43 gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
44 };
45 };
46};
47
48&extal_clk {
49 clock-frequency = <20000000>;
50};
51
52&pfc {
53 pinctrl-0 = <&scif0_pins &scif1_pins>;
54 pinctrl-names = "default";
55
56 scif0_pins: serial0 {
57 renesas,groups = "scif0_data_d";
58 renesas,function = "scif0";
59 };
60
61 scif1_pins: serial1 {
62 renesas,groups = "scif1_data_d";
63 renesas,function = "scif1";
64 };
32}; 65};
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index fea5cfef4691..19c65509a22d 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -9,6 +9,10 @@
9 * kind, whether express or implied. 9 * kind, whether express or implied.
10 */ 10 */
11 11
12#include <dt-bindings/clock/r8a7791-clock.h>
13#include <dt-bindings/interrupt-controller/arm-gic.h>
14#include <dt-bindings/interrupt-controller/irq.h>
15
12/ { 16/ {
13 compatible = "renesas,r8a7791"; 17 compatible = "renesas,r8a7791";
14 interrupt-parent = <&gic>; 18 interrupt-parent = <&gic>;
@@ -43,32 +47,463 @@
43 <0 0xf1002000 0 0x1000>, 47 <0 0xf1002000 0 0x1000>,
44 <0 0xf1004000 0 0x2000>, 48 <0 0xf1004000 0 0x2000>,
45 <0 0xf1006000 0 0x2000>; 49 <0 0xf1006000 0 0x2000>;
46 interrupts = <1 9 0xf04>; 50 interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
51 };
52
53 gpio0: gpio@e6050000 {
54 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
55 reg = <0 0xe6050000 0 0x50>;
56 interrupt-parent = <&gic>;
57 interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
58 #gpio-cells = <2>;
59 gpio-controller;
60 gpio-ranges = <&pfc 0 0 32>;
61 #interrupt-cells = <2>;
62 interrupt-controller;
63 };
64
65 gpio1: gpio@e6051000 {
66 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
67 reg = <0 0xe6051000 0 0x50>;
68 interrupt-parent = <&gic>;
69 interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>;
70 #gpio-cells = <2>;
71 gpio-controller;
72 gpio-ranges = <&pfc 0 32 32>;
73 #interrupt-cells = <2>;
74 interrupt-controller;
75 };
76
77 gpio2: gpio@e6052000 {
78 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
79 reg = <0 0xe6052000 0 0x50>;
80 interrupt-parent = <&gic>;
81 interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
82 #gpio-cells = <2>;
83 gpio-controller;
84 gpio-ranges = <&pfc 0 64 32>;
85 #interrupt-cells = <2>;
86 interrupt-controller;
87 };
88
89 gpio3: gpio@e6053000 {
90 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
91 reg = <0 0xe6053000 0 0x50>;
92 interrupt-parent = <&gic>;
93 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
94 #gpio-cells = <2>;
95 gpio-controller;
96 gpio-ranges = <&pfc 0 96 32>;
97 #interrupt-cells = <2>;
98 interrupt-controller;
99 };
100
101 gpio4: gpio@e6054000 {
102 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
103 reg = <0 0xe6054000 0 0x50>;
104 interrupt-parent = <&gic>;
105 interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
106 #gpio-cells = <2>;
107 gpio-controller;
108 gpio-ranges = <&pfc 0 128 32>;
109 #interrupt-cells = <2>;
110 interrupt-controller;
111 };
112
113 gpio5: gpio@e6055000 {
114 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
115 reg = <0 0xe6055000 0 0x50>;
116 interrupt-parent = <&gic>;
117 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
118 #gpio-cells = <2>;
119 gpio-controller;
120 gpio-ranges = <&pfc 0 160 32>;
121 #interrupt-cells = <2>;
122 interrupt-controller;
123 };
124
125 gpio6: gpio@e6055400 {
126 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
127 reg = <0 0xe6055400 0 0x50>;
128 interrupt-parent = <&gic>;
129 interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
130 #gpio-cells = <2>;
131 gpio-controller;
132 gpio-ranges = <&pfc 0 192 32>;
133 #interrupt-cells = <2>;
134 interrupt-controller;
135 };
136
137 gpio7: gpio@e6055800 {
138 compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
139 reg = <0 0xe6055800 0 0x50>;
140 interrupt-parent = <&gic>;
141 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
142 #gpio-cells = <2>;
143 gpio-controller;
144 gpio-ranges = <&pfc 0 224 26>;
145 #interrupt-cells = <2>;
146 interrupt-controller;
147 };
148
149 thermal@e61f0000 {
150 compatible = "renesas,thermal-r8a7791", "renesas,rcar-thermal";
151 reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
152 interrupt-parent = <&gic>;
153 interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
47 }; 154 };
48 155
49 timer { 156 timer {
50 compatible = "arm,armv7-timer"; 157 compatible = "arm,armv7-timer";
51 interrupts = <1 13 0xf08>, 158 interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
52 <1 14 0xf08>, 159 <1 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
53 <1 11 0xf08>, 160 <1 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
54 <1 10 0xf08>; 161 <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
55 }; 162 };
56 163
57 irqc0: interrupt-controller@e61c0000 { 164 irqc0: interrupt-controller@e61c0000 {
58 compatible = "renesas,irqc"; 165 compatible = "renesas,irqc-r8a7791", "renesas,irqc";
59 #interrupt-cells = <2>; 166 #interrupt-cells = <2>;
60 interrupt-controller; 167 interrupt-controller;
61 reg = <0 0xe61c0000 0 0x200>; 168 reg = <0 0xe61c0000 0 0x200>;
62 interrupt-parent = <&gic>; 169 interrupt-parent = <&gic>;
63 interrupts = <0 0 4>, 170 interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
64 <0 1 4>, 171 <0 1 IRQ_TYPE_LEVEL_HIGH>,
65 <0 2 4>, 172 <0 2 IRQ_TYPE_LEVEL_HIGH>,
66 <0 3 4>, 173 <0 3 IRQ_TYPE_LEVEL_HIGH>,
67 <0 12 4>, 174 <0 12 IRQ_TYPE_LEVEL_HIGH>,
68 <0 13 4>, 175 <0 13 IRQ_TYPE_LEVEL_HIGH>,
69 <0 14 4>, 176 <0 14 IRQ_TYPE_LEVEL_HIGH>,
70 <0 15 4>, 177 <0 15 IRQ_TYPE_LEVEL_HIGH>,
71 <0 16 4>, 178 <0 16 IRQ_TYPE_LEVEL_HIGH>,
72 <0 17 4>; 179 <0 17 IRQ_TYPE_LEVEL_HIGH>;
180 };
181
182 pfc: pfc@e6060000 {
183 compatible = "renesas,pfc-r8a7791";
184 reg = <0 0xe6060000 0 0x250>;
185 #gpio-range-cells = <3>;
186 };
187
188 clocks {
189 #address-cells = <2>;
190 #size-cells = <2>;
191 ranges;
192
193 /* External root clock */
194 extal_clk: extal_clk {
195 compatible = "fixed-clock";
196 #clock-cells = <0>;
197 /* This value must be overriden by the board. */
198 clock-frequency = <0>;
199 clock-output-names = "extal";
200 };
201
202 /* Special CPG clocks */
203 cpg_clocks: cpg_clocks@e6150000 {
204 compatible = "renesas,r8a7791-cpg-clocks",
205 "renesas,rcar-gen2-cpg-clocks";
206 reg = <0 0xe6150000 0 0x1000>;
207 clocks = <&extal_clk>;
208 #clock-cells = <1>;
209 clock-output-names = "main", "pll0", "pll1", "pll3",
210 "lb", "qspi", "sdh", "sd0", "z";
211 };
212
213 /* Variable factor clocks */
214 sd1_clk: sd2_clk@e6150078 {
215 compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
216 reg = <0 0xe6150078 0 4>;
217 clocks = <&pll1_div2_clk>;
218 #clock-cells = <0>;
219 clock-output-names = "sd1";
220 };
221 sd2_clk: sd3_clk@e615007c {
222 compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
223 reg = <0 0xe615007c 0 4>;
224 clocks = <&pll1_div2_clk>;
225 #clock-cells = <0>;
226 clock-output-names = "sd2";
227 };
228 mmc0_clk: mmc0_clk@e6150240 {
229 compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
230 reg = <0 0xe6150240 0 4>;
231 clocks = <&pll1_div2_clk>;
232 #clock-cells = <0>;
233 clock-output-names = "mmc0";
234 };
235 ssp_clk: ssp_clk@e6150248 {
236 compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
237 reg = <0 0xe6150248 0 4>;
238 clocks = <&pll1_div2_clk>;
239 #clock-cells = <0>;
240 clock-output-names = "ssp";
241 };
242 ssprs_clk: ssprs_clk@e615024c {
243 compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
244 reg = <0 0xe615024c 0 4>;
245 clocks = <&pll1_div2_clk>;
246 #clock-cells = <0>;
247 clock-output-names = "ssprs";
248 };
249
250 /* Fixed factor clocks */
251 pll1_div2_clk: pll1_div2_clk {
252 compatible = "fixed-factor-clock";
253 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
254 #clock-cells = <0>;
255 clock-div = <2>;
256 clock-mult = <1>;
257 clock-output-names = "pll1_div2";
258 };
259 zg_clk: zg_clk {
260 compatible = "fixed-factor-clock";
261 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
262 #clock-cells = <0>;
263 clock-div = <3>;
264 clock-mult = <1>;
265 clock-output-names = "zg";
266 };
267 zx_clk: zx_clk {
268 compatible = "fixed-factor-clock";
269 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
270 #clock-cells = <0>;
271 clock-div = <3>;
272 clock-mult = <1>;
273 clock-output-names = "zx";
274 };
275 zs_clk: zs_clk {
276 compatible = "fixed-factor-clock";
277 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
278 #clock-cells = <0>;
279 clock-div = <6>;
280 clock-mult = <1>;
281 clock-output-names = "zs";
282 };
283 hp_clk: hp_clk {
284 compatible = "fixed-factor-clock";
285 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
286 #clock-cells = <0>;
287 clock-div = <12>;
288 clock-mult = <1>;
289 clock-output-names = "hp";
290 };
291 i_clk: i_clk {
292 compatible = "fixed-factor-clock";
293 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
294 #clock-cells = <0>;
295 clock-div = <2>;
296 clock-mult = <1>;
297 clock-output-names = "i";
298 };
299 b_clk: b_clk {
300 compatible = "fixed-factor-clock";
301 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
302 #clock-cells = <0>;
303 clock-div = <12>;
304 clock-mult = <1>;
305 clock-output-names = "b";
306 };
307 p_clk: p_clk {
308 compatible = "fixed-factor-clock";
309 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
310 #clock-cells = <0>;
311 clock-div = <24>;
312 clock-mult = <1>;
313 clock-output-names = "p";
314 };
315 cl_clk: cl_clk {
316 compatible = "fixed-factor-clock";
317 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
318 #clock-cells = <0>;
319 clock-div = <48>;
320 clock-mult = <1>;
321 clock-output-names = "cl";
322 };
323 m2_clk: m2_clk {
324 compatible = "fixed-factor-clock";
325 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
326 #clock-cells = <0>;
327 clock-div = <8>;
328 clock-mult = <1>;
329 clock-output-names = "m2";
330 };
331 imp_clk: imp_clk {
332 compatible = "fixed-factor-clock";
333 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
334 #clock-cells = <0>;
335 clock-div = <4>;
336 clock-mult = <1>;
337 clock-output-names = "imp";
338 };
339 rclk_clk: rclk_clk {
340 compatible = "fixed-factor-clock";
341 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
342 #clock-cells = <0>;
343 clock-div = <(48 * 1024)>;
344 clock-mult = <1>;
345 clock-output-names = "rclk";
346 };
347 oscclk_clk: oscclk_clk {
348 compatible = "fixed-factor-clock";
349 clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
350 #clock-cells = <0>;
351 clock-div = <(12 * 1024)>;
352 clock-mult = <1>;
353 clock-output-names = "oscclk";
354 };
355 zb3_clk: zb3_clk {
356 compatible = "fixed-factor-clock";
357 clocks = <&cpg_clocks R8A7791_CLK_PLL3>;
358 #clock-cells = <0>;
359 clock-div = <4>;
360 clock-mult = <1>;
361 clock-output-names = "zb3";
362 };
363 zb3d2_clk: zb3d2_clk {
364 compatible = "fixed-factor-clock";
365 clocks = <&cpg_clocks R8A7791_CLK_PLL3>;
366 #clock-cells = <0>;
367 clock-div = <8>;
368 clock-mult = <1>;
369 clock-output-names = "zb3d2";
370 };
371 ddr_clk: ddr_clk {
372 compatible = "fixed-factor-clock";
373 clocks = <&cpg_clocks R8A7791_CLK_PLL3>;
374 #clock-cells = <0>;
375 clock-div = <8>;
376 clock-mult = <1>;
377 clock-output-names = "ddr";
378 };
379 mp_clk: mp_clk {
380 compatible = "fixed-factor-clock";
381 clocks = <&pll1_div2_clk>;
382 #clock-cells = <0>;
383 clock-div = <15>;
384 clock-mult = <1>;
385 clock-output-names = "mp";
386 };
387 cp_clk: cp_clk {
388 compatible = "fixed-factor-clock";
389 clocks = <&extal_clk>;
390 #clock-cells = <0>;
391 clock-div = <2>;
392 clock-mult = <1>;
393 clock-output-names = "cp";
394 };
395
396 /* Gate clocks */
397 mstp0_clks: mstp0_clks@e6150130 {
398 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
399 reg = <0 0xe6150130 0 4>, <0 0xe6150030 0 4>;
400 clocks = <&mp_clk>;
401 #clock-cells = <1>;
402 renesas,clock-indices = <R8A7791_CLK_MSIOF0>;
403 clock-output-names = "msiof0";
404 };
405 mstp1_clks: mstp1_clks@e6150134 {
406 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
407 reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
408 clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
409 <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>;
410 #clock-cells = <1>;
411 renesas,clock-indices = <
412 R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2
413 R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1
414 R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_SY
415 >;
416 clock-output-names =
417 "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
418 "vsp1-du0", "vsp1-sy";
419 };
420 mstp2_clks: mstp2_clks@e6150138 {
421 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
422 reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
423 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
424 <&mp_clk>, <&mp_clk>, <&mp_clk>;
425 #clock-cells = <1>;
426 renesas,clock-indices = <
427 R8A7791_CLK_SCIFA2 R8A7791_CLK_SCIFA1 R8A7791_CLK_SCIFA0
428 R8A7791_CLK_MSIOF2 R8A7791_CLK_SCIFB0 R8A7791_CLK_SCIFB1
429 R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2
430 >;
431 clock-output-names =
432 "scifa2", "scifa1", "scifa0", "misof2", "scifb0",
433 "scifb1", "msiof1", "scifb2";
434 };
435 mstp3_clks: mstp3_clks@e615013c {
436 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
437 reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
438 clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>,
439 <&cpg_clocks R8A7791_CLK_SD0>, <&mmc0_clk>, <&rclk_clk>;
440 #clock-cells = <1>;
441 renesas,clock-indices = <
442 R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1
443 R8A7791_CLK_SDHI0 R8A7791_CLK_MMCIF0 R8A7791_CLK_CMT1
444 >;
445 clock-output-names =
446 "tpu0", "sdhi2", "sdhi1", "sdhi0", "mmcif0", "cmt1";
447 };
448 mstp5_clks: mstp5_clks@e6150144 {
449 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
450 reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
451 clocks = <&extal_clk>, <&p_clk>;
452 #clock-cells = <1>;
453 renesas,clock-indices = <R8A7791_CLK_THERMAL R8A7791_CLK_PWM>;
454 clock-output-names = "thermal", "pwm";
455 };
456 mstp7_clks: mstp7_clks@e615014c {
457 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
458 reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
459 clocks = <&mp_clk>, <&zs_clk>, <&p_clk>, <&p_clk>, <&zs_clk>,
460 <&zs_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
461 <&zx_clk>, <&zx_clk>, <&zx_clk>;
462 #clock-cells = <1>;
463 renesas,clock-indices = <
464 R8A7791_CLK_HSUSB R8A7791_CLK_HSCIF2 R8A7791_CLK_SCIF5
465 R8A7791_CLK_SCIF4 R8A7791_CLK_HSCIF1 R8A7791_CLK_HSCIF0
466 R8A7791_CLK_SCIF3 R8A7791_CLK_SCIF2 R8A7791_CLK_SCIF1
467 R8A7791_CLK_SCIF0 R8A7791_CLK_DU1 R8A7791_CLK_DU0
468 R8A7791_CLK_LVDS0
469 >;
470 clock-output-names =
471 "hsusb", "hscif2", "scif5", "scif4", "hscif1", "hscif0",
472 "scif3", "scif2", "scif1", "scif0", "du1", "du0", "lvds0";
473 };
474 mstp8_clks: mstp8_clks@e6150990 {
475 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
476 reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
477 clocks = <&p_clk>;
478 #clock-cells = <1>;
479 renesas,clock-indices = <R8A7791_CLK_ETHER>;
480 clock-output-names = "ether";
481 };
482 mstp9_clks: mstp9_clks@e6150994 {
483 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
484 reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>;
485 clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7791_CLK_QSPI>,
486 <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
487 <&p_clk>;
488 #clock-cells = <1>;
489 renesas,clock-indices = <
490 R8A7791_CLK_RCAN1 R8A7791_CLK_RCAN0 R8A7791_CLK_QSPI_MOD
491 R8A7791_CLK_I2C4 R8A7791_CLK_I2C4 R8A7791_CLK_I2C3
492 R8A7791_CLK_I2C2 R8A7791_CLK_I2C1 R8A7791_CLK_I2C0
493 >;
494 clock-output-names =
495 "rcan1", "rcan0", "qspi_mod", "i2c5", "i2c4", "i2c3",
496 "i2c2", "i2c1", "i2c0";
497 };
498 mstp11_clks: mstp11_clks@e615099c {
499 compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
500 reg = <0 0xe615099c 0 4>, <0 0xe61509ac 0 4>;
501 clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>;
502 #clock-cells = <1>;
503 renesas,clock-indices = <
504 R8A7791_CLK_SCIFA3 R8A7791_CLK_SCIFA4 R8A7791_CLK_SCIFA5
505 >;
506 clock-output-names = "scifa3", "scifa4", "scifa5";
507 };
73 }; 508 };
74}; 509};
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 5cdaba4cea86..52447c17537a 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1,6 +1,6 @@
1/* 1/*
2 * sama5d3.dtsi - Device Tree Include file for SAMA5D3 family SoC 2 * sama5d3.dtsi - Device Tree Include file for SAMA5D3 family SoC
3 * applies to SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35 SoC 3 * applies to SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36 SoC
4 * 4 *
5 * Copyright (C) 2013 Atmel, 5 * Copyright (C) 2013 Atmel,
6 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> 6 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
@@ -13,6 +13,7 @@
13#include <dt-bindings/pinctrl/at91.h> 13#include <dt-bindings/pinctrl/at91.h>
14#include <dt-bindings/interrupt-controller/irq.h> 14#include <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/gpio/gpio.h> 15#include <dt-bindings/gpio/gpio.h>
16#include <dt-bindings/clk/at91.h>
16 17
17/ { 18/ {
18 model = "Atmel SAMA5D3 family SoC"; 19 model = "Atmel SAMA5D3 family SoC";
@@ -36,6 +37,7 @@
36 i2c2 = &i2c2; 37 i2c2 = &i2c2;
37 ssc0 = &ssc0; 38 ssc0 = &ssc0;
38 ssc1 = &ssc1; 39 ssc1 = &ssc1;
40 pwm0 = &pwm0;
39 }; 41 };
40 cpus { 42 cpus {
41 #address-cells = <1>; 43 #address-cells = <1>;
@@ -56,6 +58,14 @@
56 reg = <0x20000000 0x8000000>; 58 reg = <0x20000000 0x8000000>;
57 }; 59 };
58 60
61 clocks {
62 adc_op_clk: adc_op_clk{
63 compatible = "fixed-clock";
64 #clock-cells = <0>;
65 clock-frequency = <20000000>;
66 };
67 };
68
59 ahb { 69 ahb {
60 compatible = "simple-bus"; 70 compatible = "simple-bus";
61 #address-cells = <1>; 71 #address-cells = <1>;
@@ -79,6 +89,8 @@
79 status = "disabled"; 89 status = "disabled";
80 #address-cells = <1>; 90 #address-cells = <1>;
81 #size-cells = <0>; 91 #size-cells = <0>;
92 clocks = <&mci0_clk>;
93 clock-names = "mci_clk";
82 }; 94 };
83 95
84 spi0: spi@f0004000 { 96 spi0: spi@f0004000 {
@@ -92,6 +104,8 @@
92 dma-names = "tx", "rx"; 104 dma-names = "tx", "rx";
93 pinctrl-names = "default"; 105 pinctrl-names = "default";
94 pinctrl-0 = <&pinctrl_spi0>; 106 pinctrl-0 = <&pinctrl_spi0>;
107 clocks = <&spi0_clk>;
108 clock-names = "spi_clk";
95 status = "disabled"; 109 status = "disabled";
96 }; 110 };
97 111
@@ -101,6 +115,8 @@
101 interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>; 115 interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>;
102 pinctrl-names = "default"; 116 pinctrl-names = "default";
103 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 117 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
118 clocks = <&ssc0_clk>;
119 clock-names = "pclk";
104 status = "disabled"; 120 status = "disabled";
105 }; 121 };
106 122
@@ -108,6 +124,8 @@
108 compatible = "atmel,at91sam9x5-tcb"; 124 compatible = "atmel,at91sam9x5-tcb";
109 reg = <0xf0010000 0x100>; 125 reg = <0xf0010000 0x100>;
110 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>; 126 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
127 clocks = <&tcb0_clk>;
128 clock-names = "t0_clk";
111 }; 129 };
112 130
113 i2c0: i2c@f0014000 { 131 i2c0: i2c@f0014000 {
@@ -121,6 +139,7 @@
121 pinctrl-0 = <&pinctrl_i2c0>; 139 pinctrl-0 = <&pinctrl_i2c0>;
122 #address-cells = <1>; 140 #address-cells = <1>;
123 #size-cells = <0>; 141 #size-cells = <0>;
142 clocks = <&twi0_clk>;
124 status = "disabled"; 143 status = "disabled";
125 }; 144 };
126 145
@@ -135,6 +154,7 @@
135 pinctrl-0 = <&pinctrl_i2c1>; 154 pinctrl-0 = <&pinctrl_i2c1>;
136 #address-cells = <1>; 155 #address-cells = <1>;
137 #size-cells = <0>; 156 #size-cells = <0>;
157 clocks = <&twi1_clk>;
138 status = "disabled"; 158 status = "disabled";
139 }; 159 };
140 160
@@ -144,6 +164,8 @@
144 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; 164 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
145 pinctrl-names = "default"; 165 pinctrl-names = "default";
146 pinctrl-0 = <&pinctrl_usart0>; 166 pinctrl-0 = <&pinctrl_usart0>;
167 clocks = <&usart0_clk>;
168 clock-names = "usart";
147 status = "disabled"; 169 status = "disabled";
148 }; 170 };
149 171
@@ -153,6 +175,17 @@
153 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>; 175 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>;
154 pinctrl-names = "default"; 176 pinctrl-names = "default";
155 pinctrl-0 = <&pinctrl_usart1>; 177 pinctrl-0 = <&pinctrl_usart1>;
178 clocks = <&usart1_clk>;
179 clock-names = "usart";
180 status = "disabled";
181 };
182
183 pwm0: pwm@f002c000 {
184 compatible = "atmel,sama5d3-pwm";
185 reg = <0xf002c000 0x300>;
186 interrupts = <28 IRQ_TYPE_LEVEL_HIGH 4>;
187 #pwm-cells = <3>;
188 clocks = <&pwm_clk>;
156 status = "disabled"; 189 status = "disabled";
157 }; 190 };
158 191
@@ -174,6 +207,8 @@
174 status = "disabled"; 207 status = "disabled";
175 #address-cells = <1>; 208 #address-cells = <1>;
176 #size-cells = <0>; 209 #size-cells = <0>;
210 clocks = <&mci1_clk>;
211 clock-names = "mci_clk";
177 }; 212 };
178 213
179 spi1: spi@f8008000 { 214 spi1: spi@f8008000 {
@@ -187,6 +222,8 @@
187 dma-names = "tx", "rx"; 222 dma-names = "tx", "rx";
188 pinctrl-names = "default"; 223 pinctrl-names = "default";
189 pinctrl-0 = <&pinctrl_spi1>; 224 pinctrl-0 = <&pinctrl_spi1>;
225 clocks = <&spi1_clk>;
226 clock-names = "spi_clk";
190 status = "disabled"; 227 status = "disabled";
191 }; 228 };
192 229
@@ -196,6 +233,8 @@
196 interrupts = <39 IRQ_TYPE_LEVEL_HIGH 4>; 233 interrupts = <39 IRQ_TYPE_LEVEL_HIGH 4>;
197 pinctrl-names = "default"; 234 pinctrl-names = "default";
198 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 235 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
236 clocks = <&ssc1_clk>;
237 clock-names = "pclk";
199 status = "disabled"; 238 status = "disabled";
200 }; 239 };
201 240
@@ -219,6 +258,9 @@
219 &pinctrl_adc0_ad10 258 &pinctrl_adc0_ad10
220 &pinctrl_adc0_ad11 259 &pinctrl_adc0_ad11
221 >; 260 >;
261 clocks = <&adc_clk>,
262 <&adc_op_clk>;
263 clock-names = "adc_clk", "adc_op_clk";
222 atmel,adc-channel-base = <0x50>; 264 atmel,adc-channel-base = <0x50>;
223 atmel,adc-channels-used = <0xfff>; 265 atmel,adc-channels-used = <0xfff>;
224 atmel,adc-drdy-mask = <0x1000000>; 266 atmel,adc-drdy-mask = <0x1000000>;
@@ -272,8 +314,11 @@
272 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(11)>, 314 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(11)>,
273 <&dma1 2 AT91_DMA_CFG_PER_ID(12)>; 315 <&dma1 2 AT91_DMA_CFG_PER_ID(12)>;
274 dma-names = "tx", "rx"; 316 dma-names = "tx", "rx";
317 pinctrl-names = "default";
318 pinctrl-0 = <&pinctrl_i2c2>;
275 #address-cells = <1>; 319 #address-cells = <1>;
276 #size-cells = <0>; 320 #size-cells = <0>;
321 clocks = <&twi2_clk>;
277 status = "disabled"; 322 status = "disabled";
278 }; 323 };
279 324
@@ -283,6 +328,8 @@
283 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; 328 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
284 pinctrl-names = "default"; 329 pinctrl-names = "default";
285 pinctrl-0 = <&pinctrl_usart2>; 330 pinctrl-0 = <&pinctrl_usart2>;
331 clocks = <&usart2_clk>;
332 clock-names = "usart";
286 status = "disabled"; 333 status = "disabled";
287 }; 334 };
288 335
@@ -292,25 +339,41 @@
292 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; 339 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
293 pinctrl-names = "default"; 340 pinctrl-names = "default";
294 pinctrl-0 = <&pinctrl_usart3>; 341 pinctrl-0 = <&pinctrl_usart3>;
342 clocks = <&usart3_clk>;
343 clock-names = "usart";
295 status = "disabled"; 344 status = "disabled";
296 }; 345 };
297 346
298 sha@f8034000 { 347 sha@f8034000 {
299 compatible = "atmel,sam9g46-sha"; 348 compatible = "atmel,at91sam9g46-sha";
300 reg = <0xf8034000 0x100>; 349 reg = <0xf8034000 0x100>;
301 interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>; 350 interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
351 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(17)>;
352 dma-names = "tx";
353 clocks = <&sha_clk>;
354 clock-names = "sha_clk";
302 }; 355 };
303 356
304 aes@f8038000 { 357 aes@f8038000 {
305 compatible = "atmel,sam9g46-aes"; 358 compatible = "atmel,at91sam9g46-aes";
306 reg = <0xf8038000 0x100>; 359 reg = <0xf8038000 0x100>;
307 interrupts = <43 4 0>; 360 interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
361 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(18)>,
362 <&dma1 2 AT91_DMA_CFG_PER_ID(19)>;
363 dma-names = "tx", "rx";
364 clocks = <&aes_clk>;
365 clock-names = "aes_clk";
308 }; 366 };
309 367
310 tdes@f803c000 { 368 tdes@f803c000 {
311 compatible = "atmel,sam9g46-tdes"; 369 compatible = "atmel,at91sam9g46-tdes";
312 reg = <0xf803c000 0x100>; 370 reg = <0xf803c000 0x100>;
313 interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>; 371 interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;
372 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(20)>,
373 <&dma1 2 AT91_DMA_CFG_PER_ID(21)>;
374 dma-names = "tx", "rx";
375 clocks = <&tdes_clk>;
376 clock-names = "tdes_clk";
314 }; 377 };
315 378
316 dma0: dma-controller@ffffe600 { 379 dma0: dma-controller@ffffe600 {
@@ -318,6 +381,8 @@
318 reg = <0xffffe600 0x200>; 381 reg = <0xffffe600 0x200>;
319 interrupts = <30 IRQ_TYPE_LEVEL_HIGH 0>; 382 interrupts = <30 IRQ_TYPE_LEVEL_HIGH 0>;
320 #dma-cells = <2>; 383 #dma-cells = <2>;
384 clocks = <&dma0_clk>;
385 clock-names = "dma_clk";
321 }; 386 };
322 387
323 dma1: dma-controller@ffffe800 { 388 dma1: dma-controller@ffffe800 {
@@ -325,6 +390,8 @@
325 reg = <0xffffe800 0x200>; 390 reg = <0xffffe800 0x200>;
326 interrupts = <31 IRQ_TYPE_LEVEL_HIGH 0>; 391 interrupts = <31 IRQ_TYPE_LEVEL_HIGH 0>;
327 #dma-cells = <2>; 392 #dma-cells = <2>;
393 clocks = <&dma1_clk>;
394 clock-names = "dma_clk";
328 }; 395 };
329 396
330 ramc0: ramc@ffffea00 { 397 ramc0: ramc@ffffea00 {
@@ -338,6 +405,8 @@
338 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; 405 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>;
339 pinctrl-names = "default"; 406 pinctrl-names = "default";
340 pinctrl-0 = <&pinctrl_dbgu>; 407 pinctrl-0 = <&pinctrl_dbgu>;
408 clocks = <&dbgu_clk>;
409 clock-names = "usart";
341 status = "disabled"; 410 status = "disabled";
342 }; 411 };
343 412
@@ -443,6 +512,14 @@
443 }; 512 };
444 }; 513 };
445 514
515 i2c2 {
516 pinctrl_i2c2: i2c2-0 {
517 atmel,pins =
518 <AT91_PIOA 18 AT91_PERIPH_B AT91_PINCTRL_NONE /* TWD2 pin, conflicts with LCDDAT18, ISI_D2 */
519 AT91_PIOA 19 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* TWCK2 pin, conflicts with LCDDAT19, ISI_D3 */
520 };
521 };
522
446 isi { 523 isi {
447 pinctrl_isi: isi-0 { 524 pinctrl_isi: isi-0 {
448 atmel,pins = 525 atmel,pins =
@@ -626,6 +703,7 @@
626 gpio-controller; 703 gpio-controller;
627 interrupt-controller; 704 interrupt-controller;
628 #interrupt-cells = <2>; 705 #interrupt-cells = <2>;
706 clocks = <&pioA_clk>;
629 }; 707 };
630 708
631 pioB: gpio@fffff400 { 709 pioB: gpio@fffff400 {
@@ -636,6 +714,7 @@
636 gpio-controller; 714 gpio-controller;
637 interrupt-controller; 715 interrupt-controller;
638 #interrupt-cells = <2>; 716 #interrupt-cells = <2>;
717 clocks = <&pioB_clk>;
639 }; 718 };
640 719
641 pioC: gpio@fffff600 { 720 pioC: gpio@fffff600 {
@@ -646,6 +725,7 @@
646 gpio-controller; 725 gpio-controller;
647 interrupt-controller; 726 interrupt-controller;
648 #interrupt-cells = <2>; 727 #interrupt-cells = <2>;
728 clocks = <&pioC_clk>;
649 }; 729 };
650 730
651 pioD: gpio@fffff800 { 731 pioD: gpio@fffff800 {
@@ -656,6 +736,7 @@
656 gpio-controller; 736 gpio-controller;
657 interrupt-controller; 737 interrupt-controller;
658 #interrupt-cells = <2>; 738 #interrupt-cells = <2>;
739 clocks = <&pioD_clk>;
659 }; 740 };
660 741
661 pioE: gpio@fffffa00 { 742 pioE: gpio@fffffa00 {
@@ -666,12 +747,334 @@
666 gpio-controller; 747 gpio-controller;
667 interrupt-controller; 748 interrupt-controller;
668 #interrupt-cells = <2>; 749 #interrupt-cells = <2>;
750 clocks = <&pioE_clk>;
669 }; 751 };
670 }; 752 };
671 753
672 pmc: pmc@fffffc00 { 754 pmc: pmc@fffffc00 {
673 compatible = "atmel,at91rm9200-pmc"; 755 compatible = "atmel,sama5d3-pmc";
674 reg = <0xfffffc00 0x120>; 756 reg = <0xfffffc00 0x120>;
757 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
758 interrupt-controller;
759 #address-cells = <1>;
760 #size-cells = <0>;
761 #interrupt-cells = <1>;
762
763 clk32k: slck {
764 compatible = "fixed-clock";
765 #clock-cells = <0>;
766 clock-frequency = <32768>;
767 };
768
769 main: mainck {
770 compatible = "atmel,at91rm9200-clk-main";
771 #clock-cells = <0>;
772 interrupt-parent = <&pmc>;
773 interrupts = <AT91_PMC_MOSCS>;
774 clocks = <&clk32k>;
775 };
776
777 plla: pllack {
778 compatible = "atmel,sama5d3-clk-pll";
779 #clock-cells = <0>;
780 interrupt-parent = <&pmc>;
781 interrupts = <AT91_PMC_LOCKA>;
782 clocks = <&main>;
783 reg = <0>;
784 atmel,clk-input-range = <8000000 50000000>;
785 #atmel,pll-clk-output-range-cells = <4>;
786 atmel,pll-clk-output-ranges = <400000000 1000000000 0 0>;
787 };
788
789 plladiv: plladivck {
790 compatible = "atmel,at91sam9x5-clk-plldiv";
791 #clock-cells = <0>;
792 clocks = <&plla>;
793 };
794
795 utmi: utmick {
796 compatible = "atmel,at91sam9x5-clk-utmi";
797 #clock-cells = <0>;
798 interrupt-parent = <&pmc>;
799 interrupts = <AT91_PMC_LOCKU>;
800 clocks = <&main>;
801 };
802
803 mck: masterck {
804 compatible = "atmel,at91sam9x5-clk-master";
805 #clock-cells = <0>;
806 interrupt-parent = <&pmc>;
807 interrupts = <AT91_PMC_MCKRDY>;
808 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>;
809 atmel,clk-output-range = <0 166000000>;
810 atmel,clk-divisors = <1 2 4 3>;
811 };
812
813 usb: usbck {
814 compatible = "atmel,at91sam9x5-clk-usb";
815 #clock-cells = <0>;
816 clocks = <&plladiv>, <&utmi>;
817 };
818
819 prog: progck {
820 compatible = "atmel,at91sam9x5-clk-programmable";
821 #address-cells = <1>;
822 #size-cells = <0>;
823 interrupt-parent = <&pmc>;
824 clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>;
825
826 prog0: prog0 {
827 #clock-cells = <0>;
828 reg = <0>;
829 interrupts = <AT91_PMC_PCKRDY(0)>;
830 };
831
832 prog1: prog1 {
833 #clock-cells = <0>;
834 reg = <1>;
835 interrupts = <AT91_PMC_PCKRDY(1)>;
836 };
837
838 prog2: prog2 {
839 #clock-cells = <0>;
840 reg = <2>;
841 interrupts = <AT91_PMC_PCKRDY(2)>;
842 };
843 };
844
845 smd: smdclk {
846 compatible = "atmel,at91sam9x5-clk-smd";
847 #clock-cells = <0>;
848 clocks = <&plladiv>, <&utmi>;
849 };
850
851 systemck {
852 compatible = "atmel,at91rm9200-clk-system";
853 #address-cells = <1>;
854 #size-cells = <0>;
855
856 ddrck: ddrck {
857 #clock-cells = <0>;
858 reg = <2>;
859 clocks = <&mck>;
860 };
861
862 smdck: smdck {
863 #clock-cells = <0>;
864 reg = <4>;
865 clocks = <&smd>;
866 };
867
868 uhpck: uhpck {
869 #clock-cells = <0>;
870 reg = <6>;
871 clocks = <&usb>;
872 };
873
874 udpck: udpck {
875 #clock-cells = <0>;
876 reg = <7>;
877 clocks = <&usb>;
878 };
879
880 pck0: pck0 {
881 #clock-cells = <0>;
882 reg = <8>;
883 clocks = <&prog0>;
884 };
885
886 pck1: pck1 {
887 #clock-cells = <0>;
888 reg = <9>;
889 clocks = <&prog1>;
890 };
891
892 pck2: pck2 {
893 #clock-cells = <0>;
894 reg = <10>;
895 clocks = <&prog2>;
896 };
897 };
898
899 periphck {
900 compatible = "atmel,at91sam9x5-clk-peripheral";
901 #address-cells = <1>;
902 #size-cells = <0>;
903 clocks = <&mck>;
904
905 dbgu_clk: dbgu_clk {
906 #clock-cells = <0>;
907 reg = <2>;
908 };
909
910 pioA_clk: pioA_clk {
911 #clock-cells = <0>;
912 reg = <6>;
913 };
914
915 pioB_clk: pioB_clk {
916 #clock-cells = <0>;
917 reg = <7>;
918 };
919
920 pioC_clk: pioC_clk {
921 #clock-cells = <0>;
922 reg = <8>;
923 };
924
925 pioD_clk: pioD_clk {
926 #clock-cells = <0>;
927 reg = <9>;
928 };
929
930 pioE_clk: pioE_clk {
931 #clock-cells = <0>;
932 reg = <10>;
933 };
934
935 usart0_clk: usart0_clk {
936 #clock-cells = <0>;
937 reg = <12>;
938 atmel,clk-output-range = <0 66000000>;
939 };
940
941 usart1_clk: usart1_clk {
942 #clock-cells = <0>;
943 reg = <13>;
944 atmel,clk-output-range = <0 66000000>;
945 };
946
947 usart2_clk: usart2_clk {
948 #clock-cells = <0>;
949 reg = <14>;
950 atmel,clk-output-range = <0 66000000>;
951 };
952
953 usart3_clk: usart3_clk {
954 #clock-cells = <0>;
955 reg = <15>;
956 atmel,clk-output-range = <0 66000000>;
957 };
958
959 twi0_clk: twi0_clk {
960 reg = <18>;
961 #clock-cells = <0>;
962 atmel,clk-output-range = <0 16625000>;
963 };
964
965 twi1_clk: twi1_clk {
966 #clock-cells = <0>;
967 reg = <19>;
968 atmel,clk-output-range = <0 16625000>;
969 };
970
971 twi2_clk: twi2_clk {
972 #clock-cells = <0>;
973 reg = <20>;
974 atmel,clk-output-range = <0 16625000>;
975 };
976
977 mci0_clk: mci0_clk {
978 #clock-cells = <0>;
979 reg = <21>;
980 };
981
982 mci1_clk: mci1_clk {
983 #clock-cells = <0>;
984 reg = <22>;
985 };
986
987 spi0_clk: spi0_clk {
988 #clock-cells = <0>;
989 reg = <24>;
990 atmel,clk-output-range = <0 133000000>;
991 };
992
993 spi1_clk: spi1_clk {
994 #clock-cells = <0>;
995 reg = <25>;
996 atmel,clk-output-range = <0 133000000>;
997 };
998
999 tcb0_clk: tcb0_clk {
1000 #clock-cells = <0>;
1001 reg = <26>;
1002 atmel,clk-output-range = <0 133000000>;
1003 };
1004
1005 pwm_clk: pwm_clk {
1006 #clock-cells = <0>;
1007 reg = <28>;
1008 };
1009
1010 adc_clk: adc_clk {
1011 #clock-cells = <0>;
1012 reg = <29>;
1013 atmel,clk-output-range = <0 66000000>;
1014 };
1015
1016 dma0_clk: dma0_clk {
1017 #clock-cells = <0>;
1018 reg = <30>;
1019 };
1020
1021 dma1_clk: dma1_clk {
1022 #clock-cells = <0>;
1023 reg = <31>;
1024 };
1025
1026 uhphs_clk: uhphs_clk {
1027 #clock-cells = <0>;
1028 reg = <32>;
1029 };
1030
1031 udphs_clk: udphs_clk {
1032 #clock-cells = <0>;
1033 reg = <33>;
1034 };
1035
1036 isi_clk: isi_clk {
1037 #clock-cells = <0>;
1038 reg = <37>;
1039 };
1040
1041 ssc0_clk: ssc0_clk {
1042 #clock-cells = <0>;
1043 reg = <38>;
1044 atmel,clk-output-range = <0 66000000>;
1045 };
1046
1047 ssc1_clk: ssc1_clk {
1048 #clock-cells = <0>;
1049 reg = <39>;
1050 atmel,clk-output-range = <0 66000000>;
1051 };
1052
1053 sha_clk: sha_clk {
1054 #clock-cells = <0>;
1055 reg = <42>;
1056 };
1057
1058 aes_clk: aes_clk {
1059 #clock-cells = <0>;
1060 reg = <43>;
1061 };
1062
1063 tdes_clk: tdes_clk {
1064 #clock-cells = <0>;
1065 reg = <44>;
1066 };
1067
1068 trng_clk: trng_clk {
1069 #clock-cells = <0>;
1070 reg = <45>;
1071 };
1072
1073 fuse_clk: fuse_clk {
1074 #clock-cells = <0>;
1075 reg = <48>;
1076 };
1077 };
675 }; 1078 };
676 1079
677 rstc@fffffe00 { 1080 rstc@fffffe00 {
@@ -683,11 +1086,17 @@
683 compatible = "atmel,at91sam9260-pit"; 1086 compatible = "atmel,at91sam9260-pit";
684 reg = <0xfffffe30 0xf>; 1087 reg = <0xfffffe30 0xf>;
685 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>; 1088 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>;
1089 clocks = <&mck>;
686 }; 1090 };
687 1091
688 watchdog@fffffe40 { 1092 watchdog@fffffe40 {
689 compatible = "atmel,at91sam9260-wdt"; 1093 compatible = "atmel,at91sam9260-wdt";
690 reg = <0xfffffe40 0x10>; 1094 reg = <0xfffffe40 0x10>;
1095 interrupts = <4 IRQ_TYPE_LEVEL_HIGH 7>;
1096 atmel,watchdog-type = "hardware";
1097 atmel,reset-type = "all";
1098 atmel,dbg-halt;
1099 atmel,idle-halt;
691 status = "disabled"; 1100 status = "disabled";
692 }; 1101 };
693 1102
@@ -705,6 +1114,8 @@
705 reg = <0x00500000 0x100000 1114 reg = <0x00500000 0x100000
706 0xf8030000 0x4000>; 1115 0xf8030000 0x4000>;
707 interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>; 1116 interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>;
1117 clocks = <&udphs_clk>, <&utmi>;
1118 clock-names = "pclk", "hclk";
708 status = "disabled"; 1119 status = "disabled";
709 1120
710 ep0 { 1121 ep0 {
@@ -817,6 +1228,9 @@
817 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 1228 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
818 reg = <0x00600000 0x100000>; 1229 reg = <0x00600000 0x100000>;
819 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; 1230 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>;
1231 clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>,
1232 <&uhpck>;
1233 clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
820 status = "disabled"; 1234 status = "disabled";
821 }; 1235 };
822 1236
@@ -824,6 +1238,8 @@
824 compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; 1238 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
825 reg = <0x00700000 0x100000>; 1239 reg = <0x00700000 0x100000>;
826 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; 1240 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>;
1241 clocks = <&usb>, <&uhphs_clk>, <&uhpck>;
1242 clock-names = "usb_clk", "ehci_clk", "uhpck";
827 status = "disabled"; 1243 status = "disabled";
828 }; 1244 };
829 1245
diff --git a/arch/arm/boot/dts/sama5d36.dtsi b/arch/arm/boot/dts/sama5d36.dtsi
new file mode 100644
index 000000000000..6c31c26e6cc0
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d36.dtsi
@@ -0,0 +1,20 @@
1/*
2 * sama5d36.dtsi - Device Tree Include file for SAMA5D36 SoC
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Josh Wu <josh.wu@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9#include "sama5d3.dtsi"
10#include "sama5d3_can.dtsi"
11#include "sama5d3_emac.dtsi"
12#include "sama5d3_gmac.dtsi"
13#include "sama5d3_lcd.dtsi"
14#include "sama5d3_mci2.dtsi"
15#include "sama5d3_tcb1.dtsi"
16#include "sama5d3_uart.dtsi"
17
18/ {
19 compatible = "atmel,samad36", "atmel,sama5d3", "atmel,sama5";
20};
diff --git a/arch/arm/boot/dts/sama5d36ek.dts b/arch/arm/boot/dts/sama5d36ek.dts
new file mode 100644
index 000000000000..59576c6f9826
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d36ek.dts
@@ -0,0 +1,53 @@
1/*
2 * sama5d36ek.dts - Device Tree file for SAMA5D36-EK board
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Josh Wu <josh.wu@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10#include "sama5d36.dtsi"
11#include "sama5d3xmb.dtsi"
12#include "sama5d3xdm.dtsi"
13
14/ {
15 model = "Atmel SAMA5D36-EK";
16 compatible = "atmel,sama5d36ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d36", "atmel,sama5d3", "atmel,sama5";
17
18 ahb {
19 apb {
20 spi0: spi@f0004000 {
21 status = "okay";
22 };
23
24 ssc0: ssc@f0008000 {
25 status = "okay";
26 };
27
28 can0: can@f000c000 {
29 status = "okay";
30 };
31
32 i2c0: i2c@f0014000 {
33 status = "okay";
34 };
35
36 i2c1: i2c@f0018000 {
37 status = "okay";
38 };
39
40 macb0: ethernet@f0028000 {
41 status = "okay";
42 };
43
44 macb1: ethernet@f802c000 {
45 status = "okay";
46 };
47 };
48 };
49
50 sound {
51 status = "okay";
52 };
53};
diff --git a/arch/arm/boot/dts/sama5d3_can.dtsi b/arch/arm/boot/dts/sama5d3_can.dtsi
index 8ed3260cef66..a0775851cce5 100644
--- a/arch/arm/boot/dts/sama5d3_can.dtsi
+++ b/arch/arm/boot/dts/sama5d3_can.dtsi
@@ -32,12 +32,30 @@
32 32
33 }; 33 };
34 34
35 pmc: pmc@fffffc00 {
36 periphck {
37 can0_clk: can0_clk {
38 #clock-cells = <0>;
39 reg = <40>;
40 atmel,clk-output-range = <0 66000000>;
41 };
42
43 can1_clk: can0_clk {
44 #clock-cells = <0>;
45 reg = <41>;
46 atmel,clk-output-range = <0 66000000>;
47 };
48 };
49 };
50
35 can0: can@f000c000 { 51 can0: can@f000c000 {
36 compatible = "atmel,at91sam9x5-can"; 52 compatible = "atmel,at91sam9x5-can";
37 reg = <0xf000c000 0x300>; 53 reg = <0xf000c000 0x300>;
38 interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>; 54 interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>;
39 pinctrl-names = "default"; 55 pinctrl-names = "default";
40 pinctrl-0 = <&pinctrl_can0_rx_tx>; 56 pinctrl-0 = <&pinctrl_can0_rx_tx>;
57 clocks = <&can0_clk>;
58 clock-names = "can_clk";
41 status = "disabled"; 59 status = "disabled";
42 }; 60 };
43 61
@@ -47,6 +65,8 @@
47 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>; 65 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>;
48 pinctrl-names = "default"; 66 pinctrl-names = "default";
49 pinctrl-0 = <&pinctrl_can1_rx_tx>; 67 pinctrl-0 = <&pinctrl_can1_rx_tx>;
68 clocks = <&can1_clk>;
69 clock-names = "can_clk";
50 status = "disabled"; 70 status = "disabled";
51 }; 71 };
52 }; 72 };
diff --git a/arch/arm/boot/dts/sama5d3_emac.dtsi b/arch/arm/boot/dts/sama5d3_emac.dtsi
index 4d4f351f1f9f..fe2af9276312 100644
--- a/arch/arm/boot/dts/sama5d3_emac.dtsi
+++ b/arch/arm/boot/dts/sama5d3_emac.dtsi
@@ -31,12 +31,23 @@
31 }; 31 };
32 }; 32 };
33 33
34 pmc: pmc@fffffc00 {
35 periphck {
36 macb1_clk: macb1_clk {
37 #clock-cells = <0>;
38 reg = <35>;
39 };
40 };
41 };
42
34 macb1: ethernet@f802c000 { 43 macb1: ethernet@f802c000 {
35 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 44 compatible = "cdns,at32ap7000-macb", "cdns,macb";
36 reg = <0xf802c000 0x100>; 45 reg = <0xf802c000 0x100>;
37 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>; 46 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
38 pinctrl-names = "default"; 47 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_macb1_rmii>; 48 pinctrl-0 = <&pinctrl_macb1_rmii>;
49 clocks = <&macb1_clk>, <&macb1_clk>;
50 clock-names = "hclk", "pclk";
40 status = "disabled"; 51 status = "disabled";
41 }; 52 };
42 }; 53 };
diff --git a/arch/arm/boot/dts/sama5d3_gmac.dtsi b/arch/arm/boot/dts/sama5d3_gmac.dtsi
index 0ba8be30ccd8..a6cb0508762f 100644
--- a/arch/arm/boot/dts/sama5d3_gmac.dtsi
+++ b/arch/arm/boot/dts/sama5d3_gmac.dtsi
@@ -64,12 +64,23 @@
64 }; 64 };
65 }; 65 };
66 66
67 pmc: pmc@fffffc00 {
68 periphck {
69 macb0_clk: macb0_clk {
70 #clock-cells = <0>;
71 reg = <34>;
72 };
73 };
74 };
75
67 macb0: ethernet@f0028000 { 76 macb0: ethernet@f0028000 {
68 compatible = "cdns,pc302-gem", "cdns,gem"; 77 compatible = "cdns,pc302-gem", "cdns,gem";
69 reg = <0xf0028000 0x100>; 78 reg = <0xf0028000 0x100>;
70 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>; 79 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>;
71 pinctrl-names = "default"; 80 pinctrl-names = "default";
72 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>; 81 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>;
82 clocks = <&macb0_clk>, <&macb0_clk>;
83 clock-names = "hclk", "pclk";
73 status = "disabled"; 84 status = "disabled";
74 }; 85 };
75 }; 86 };
diff --git a/arch/arm/boot/dts/sama5d3_lcd.dtsi b/arch/arm/boot/dts/sama5d3_lcd.dtsi
index 01f52a79f8ba..85d302701565 100644
--- a/arch/arm/boot/dts/sama5d3_lcd.dtsi
+++ b/arch/arm/boot/dts/sama5d3_lcd.dtsi
@@ -50,6 +50,23 @@
50 }; 50 };
51 }; 51 };
52 }; 52 };
53
54 pmc: pmc@fffffc00 {
55 periphck {
56 lcdc_clk: lcdc_clk {
57 #clock-cells = <0>;
58 reg = <36>;
59 };
60 };
61
62 systemck {
63 lcdck: lcdck {
64 #clock-cells = <0>;
65 reg = <3>;
66 clocks = <&mck>;
67 };
68 };
69 };
53 }; 70 };
54 }; 71 };
55}; 72};
diff --git a/arch/arm/boot/dts/sama5d3_mci2.dtsi b/arch/arm/boot/dts/sama5d3_mci2.dtsi
index 38e88e39e551..b029fe7ef17a 100644
--- a/arch/arm/boot/dts/sama5d3_mci2.dtsi
+++ b/arch/arm/boot/dts/sama5d3_mci2.dtsi
@@ -9,6 +9,7 @@
9 9
10#include <dt-bindings/pinctrl/at91.h> 10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h> 11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/clk/at91.h>
12 13
13/ { 14/ {
14 ahb { 15 ahb {
@@ -30,6 +31,15 @@
30 }; 31 };
31 }; 32 };
32 33
34 pmc: pmc@fffffc00 {
35 periphck {
36 mci2_clk: mci2_clk {
37 #clock-cells = <0>;
38 reg = <23>;
39 };
40 };
41 };
42
33 mmc2: mmc@f8004000 { 43 mmc2: mmc@f8004000 {
34 compatible = "atmel,hsmci"; 44 compatible = "atmel,hsmci";
35 reg = <0xf8004000 0x600>; 45 reg = <0xf8004000 0x600>;
@@ -38,6 +48,8 @@
38 dma-names = "rxtx"; 48 dma-names = "rxtx";
39 pinctrl-names = "default"; 49 pinctrl-names = "default";
40 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>; 50 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>;
51 clocks = <&mci2_clk>;
52 clock-names = "mci_clk";
41 status = "disabled"; 53 status = "disabled";
42 #address-cells = <1>; 54 #address-cells = <1>;
43 #size-cells = <0>; 55 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/sama5d3_tcb1.dtsi b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
index 5264bb4a6998..382b04431f66 100644
--- a/arch/arm/boot/dts/sama5d3_tcb1.dtsi
+++ b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
@@ -9,6 +9,7 @@
9 9
10#include <dt-bindings/pinctrl/at91.h> 10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h> 11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/clk/at91.h>
12 13
13/ { 14/ {
14 aliases { 15 aliases {
@@ -17,10 +18,21 @@
17 18
18 ahb { 19 ahb {
19 apb { 20 apb {
21 pmc: pmc@fffffc00 {
22 periphck {
23 tcb1_clk: tcb1_clk {
24 #clock-cells = <0>;
25 reg = <27>;
26 };
27 };
28 };
29
20 tcb1: timer@f8014000 { 30 tcb1: timer@f8014000 {
21 compatible = "atmel,at91sam9x5-tcb"; 31 compatible = "atmel,at91sam9x5-tcb";
22 reg = <0xf8014000 0x100>; 32 reg = <0xf8014000 0x100>;
23 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>; 33 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
34 clocks = <&tcb1_clk>;
35 clock-names = "t0_clk";
24 }; 36 };
25 }; 37 };
26 }; 38 };
diff --git a/arch/arm/boot/dts/sama5d3_uart.dtsi b/arch/arm/boot/dts/sama5d3_uart.dtsi
index 98fcb2d57446..a9fa75e41652 100644
--- a/arch/arm/boot/dts/sama5d3_uart.dtsi
+++ b/arch/arm/boot/dts/sama5d3_uart.dtsi
@@ -9,8 +9,14 @@
9 9
10#include <dt-bindings/pinctrl/at91.h> 10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h> 11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/clk/at91.h>
12 13
13/ { 14/ {
15 aliases {
16 serial5 = &uart0;
17 serial6 = &uart1;
18 };
19
14 ahb { 20 ahb {
15 apb { 21 apb {
16 pinctrl@fffff200 { 22 pinctrl@fffff200 {
@@ -31,12 +37,30 @@
31 }; 37 };
32 }; 38 };
33 39
40 pmc: pmc@fffffc00 {
41 periphck {
42 uart0_clk: uart0_clk {
43 #clock-cells = <0>;
44 reg = <16>;
45 atmel,clk-output-range = <0 66000000>;
46 };
47
48 uart1_clk: uart1_clk {
49 #clock-cells = <0>;
50 reg = <17>;
51 atmel,clk-output-range = <0 66000000>;
52 };
53 };
54 };
55
34 uart0: serial@f0024000 { 56 uart0: serial@f0024000 {
35 compatible = "atmel,at91sam9260-usart"; 57 compatible = "atmel,at91sam9260-usart";
36 reg = <0xf0024000 0x200>; 58 reg = <0xf0024000 0x200>;
37 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>; 59 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
38 pinctrl-names = "default"; 60 pinctrl-names = "default";
39 pinctrl-0 = <&pinctrl_uart0>; 61 pinctrl-0 = <&pinctrl_uart0>;
62 clocks = <&uart0_clk>;
63 clock-names = "usart";
40 status = "disabled"; 64 status = "disabled";
41 }; 65 };
42 66
@@ -46,6 +70,8 @@
46 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>; 70 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>;
47 pinctrl-names = "default"; 71 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_uart1>; 72 pinctrl-0 = <&pinctrl_uart1>;
73 clocks = <&uart1_clk>;
74 clock-names = "usart";
49 status = "disabled"; 75 status = "disabled";
50 }; 76 };
51 }; 77 };
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi
index 726a0f35100c..f55ed072c8e6 100644
--- a/arch/arm/boot/dts/sama5d3xcm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
@@ -18,17 +18,6 @@
18 reg = <0x20000000 0x20000000>; 18 reg = <0x20000000 0x20000000>;
19 }; 19 };
20 20
21 clocks {
22 #address-cells = <1>;
23 #size-cells = <1>;
24 ranges;
25
26 main_clock: clock@0 {
27 compatible = "atmel,osc", "fixed-clock";
28 clock-frequency = <12000000>;
29 };
30 };
31
32 ahb { 21 ahb {
33 apb { 22 apb {
34 spi0: spi@f0004000 { 23 spi0: spi@f0004000 {
@@ -38,6 +27,12 @@
38 macb0: ethernet@f0028000 { 27 macb0: ethernet@f0028000 {
39 phy-mode = "rgmii"; 28 phy-mode = "rgmii";
40 }; 29 };
30
31 pmc: pmc@fffffc00 {
32 main: mainck {
33 clock-frequency = <12000000>;
34 };
35 };
41 }; 36 };
42 37
43 nand0: nand@60000000 { 38 nand0: nand@60000000 {
diff --git a/arch/arm/boot/dts/sama5d3xdm.dtsi b/arch/arm/boot/dts/sama5d3xdm.dtsi
index 1c296d6b2f2a..f9bdde542ced 100644
--- a/arch/arm/boot/dts/sama5d3xdm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xdm.dtsi
@@ -18,6 +18,7 @@
18 interrupts = <31 0x0>; 18 interrupts = <31 0x0>;
19 pinctrl-names = "default"; 19 pinctrl-names = "default";
20 pinctrl-0 = <&pinctrl_qt1070_irq>; 20 pinctrl-0 = <&pinctrl_qt1070_irq>;
21 wakeup-source;
21 }; 22 };
22 }; 23 };
23 24
diff --git a/arch/arm/boot/dts/sh7372-mackerel.dts b/arch/arm/boot/dts/sh7372-mackerel.dts
index 8acf51e0cdae..a759a276c9a9 100644
--- a/arch/arm/boot/dts/sh7372-mackerel.dts
+++ b/arch/arm/boot/dts/sh7372-mackerel.dts
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "sh7372.dtsi" 12#include "sh7372.dtsi"
13 13
14/ { 14/ {
15 model = "Mackerel (AP4 EVM 2nd)"; 15 model = "Mackerel (AP4 EVM 2nd)";
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 8ee06dd81799..eb8886b535e4 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -12,8 +12,9 @@
12 */ 12 */
13 13
14/dts-v1/; 14/dts-v1/;
15/include/ "sh73a0.dtsi" 15#include "sh73a0.dtsi"
16#include <dt-bindings/gpio/gpio.h> 16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/interrupt-controller/irq.h>
17 18
18/ { 19/ {
19 model = "KZM-A9-GT"; 20 model = "KZM-A9-GT";
@@ -82,7 +83,7 @@
82 reg = <0x10000000 0x100>; 83 reg = <0x10000000 0x100>;
83 phy-mode = "mii"; 84 phy-mode = "mii";
84 interrupt-parent = <&irqpin0>; 85 interrupt-parent = <&irqpin0>;
85 interrupts = <3 0>; /* active low */ 86 interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
86 reg-io-width = <4>; 87 reg-io-width = <4>;
87 smsc,irq-push-pull; 88 smsc,irq-push-pull;
88 smsc,save-mac-address; 89 smsc,save-mac-address;
@@ -105,6 +106,66 @@
105 gpios = <&pfc 23 GPIO_ACTIVE_LOW>; 106 gpios = <&pfc 23 GPIO_ACTIVE_LOW>;
106 }; 107 };
107 }; 108 };
109
110 gpio-keys {
111 compatible = "gpio-keys";
112
113 back-key {
114 gpios = <&pcf8575 8 GPIO_ACTIVE_LOW>;
115 linux,code = <158>;
116 label = "SW3";
117 };
118
119 right-key {
120 gpios = <&pcf8575 9 GPIO_ACTIVE_LOW>;
121 linux,code = <106>;
122 label = "SW2-R";
123 };
124
125 left-key {
126 gpios = <&pcf8575 10 GPIO_ACTIVE_LOW>;
127 linux,code = <105>;
128 label = "SW2-L";
129 };
130
131 enter-key {
132 gpios = <&pcf8575 11 GPIO_ACTIVE_LOW>;
133 linux,code = <28>;
134 label = "SW2-P";
135 };
136
137 up-key {
138 gpios = <&pcf8575 12 GPIO_ACTIVE_LOW>;
139 linux,code = <103>;
140 label = "SW2-U";
141 };
142
143 down-key {
144 gpios = <&pcf8575 13 GPIO_ACTIVE_LOW>;
145 linux,code = <108>;
146 label = "SW2-D";
147 };
148
149 home-key {
150 gpios = <&pcf8575 14 GPIO_ACTIVE_LOW>;
151 linux,code = <102>;
152 label = "SW1";
153 };
154 };
155
156 sound {
157 compatible = "simple-audio-card";
158 simple-audio-card,format = "left_j";
159 simple-audio-card,cpu {
160 sound-dai = <&sh_fsi2 0>;
161 };
162 simple-audio-card,codec {
163 sound-dai = <&ak4648>;
164 bitclock-master;
165 frame-master;
166 system-clock-frequency = <11289600>;
167 };
168 };
108}; 169};
109 170
110&i2c0 { 171&i2c0 {
@@ -179,12 +240,29 @@
179 }; 240 };
180 }; 241 };
181 }; 242 };
243
244 ak4648: ak4648@0x12 {
245 #sound-dai-cells = <0>;
246 compatible = "asahi-kasei,ak4648";
247 reg = <0x12>;
248 };
182}; 249};
183 250
184&i2c3 { 251&i2c3 {
185 pinctrl-0 = <&i2c3_pins>; 252 pinctrl-0 = <&i2c3_pins>;
186 pinctrl-names = "default"; 253 pinctrl-names = "default";
187 status = "okay"; 254 status = "okay";
255
256 pcf8575: gpio@20 {
257 compatible = "nxp,pcf8575";
258 reg = <0x20>;
259 interrupt-parent = <&irqpin2>;
260 interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
261 gpio-controller;
262 #gpio-cells = <2>;
263 interrupt-controller;
264 #interrupt-cells = <2>;
265 };
188}; 266};
189 267
190&mmcif { 268&mmcif {
@@ -205,7 +283,7 @@
205 renesas,function = "i2c3"; 283 renesas,function = "i2c3";
206 }; 284 };
207 285
208 mmcif_pins: mmcif { 286 mmcif_pins: mmc {
209 mux { 287 mux {
210 renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0"; 288 renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0";
211 renesas,function = "mmc0"; 289 renesas,function = "mmc0";
@@ -217,20 +295,26 @@
217 }; 295 };
218 }; 296 };
219 297
220 scifa4_pins: scifa4 { 298 scifa4_pins: serial4 {
221 renesas,groups = "scifa4_data", "scifa4_ctrl"; 299 renesas,groups = "scifa4_data", "scifa4_ctrl";
222 renesas,function = "scifa4"; 300 renesas,function = "scifa4";
223 }; 301 };
224 302
225 sdhi0_pins: sdhi0 { 303 sdhi0_pins: sd0 {
226 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd", "sdhi0_wp"; 304 renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd", "sdhi0_wp";
227 renesas,function = "sdhi0"; 305 renesas,function = "sdhi0";
228 }; 306 };
229 307
230 sdhi2_pins: sdhi2 { 308 sdhi2_pins: sd2 {
231 renesas,groups = "sdhi2_data4", "sdhi2_ctrl"; 309 renesas,groups = "sdhi2_data4", "sdhi2_ctrl";
232 renesas,function = "sdhi2"; 310 renesas,function = "sdhi2";
233 }; 311 };
312
313 fsia_pins: sounda {
314 renesas,groups = "fsia_mclk_in", "fsia_sclk_in",
315 "fsia_data_in", "fsia_data_out";
316 renesas,function = "fsia";
317 };
234}; 318};
235 319
236&sdhi0 { 320&sdhi0 {
@@ -251,3 +335,10 @@
251 broken-cd; 335 broken-cd;
252 status = "okay"; 336 status = "okay";
253}; 337};
338
339&sh_fsi2 {
340 pinctrl-0 = <&fsia_pins>;
341 pinctrl-names = "default";
342
343 status = "okay";
344};
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g.dts b/arch/arm/boot/dts/sh73a0-kzm9g.dts
index 0f1ca7792c46..27c5f426d172 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g.dts
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "sh73a0.dtsi" 12#include "sh73a0.dtsi"
13 13
14/ { 14/ {
15 model = "KZM-A9-GT"; 15 model = "KZM-A9-GT";
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index fcf26889a8a0..b7bd3b9a6753 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -10,6 +10,8 @@
10 10
11/include/ "skeleton.dtsi" 11/include/ "skeleton.dtsi"
12 12
13#include <dt-bindings/interrupt-controller/irq.h>
14
13/ { 15/ {
14 compatible = "renesas,sh73a0"; 16 compatible = "renesas,sh73a0";
15 17
@@ -40,12 +42,12 @@
40 42
41 pmu { 43 pmu {
42 compatible = "arm,cortex-a9-pmu"; 44 compatible = "arm,cortex-a9-pmu";
43 interrupts = <0 55 4>, 45 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>,
44 <0 56 4>; 46 <0 56 IRQ_TYPE_LEVEL_HIGH>;
45 }; 47 };
46 48
47 irqpin0: irqpin@e6900000 { 49 irqpin0: irqpin@e6900000 {
48 compatible = "renesas,intc-irqpin"; 50 compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
49 #interrupt-cells = <2>; 51 #interrupt-cells = <2>;
50 interrupt-controller; 52 interrupt-controller;
51 reg = <0xe6900000 4>, 53 reg = <0xe6900000 4>,
@@ -54,18 +56,18 @@
54 <0xe6900040 1>, 56 <0xe6900040 1>,
55 <0xe6900060 1>; 57 <0xe6900060 1>;
56 interrupt-parent = <&gic>; 58 interrupt-parent = <&gic>;
57 interrupts = <0 1 0x4 59 interrupts = <0 1 IRQ_TYPE_LEVEL_HIGH
58 0 2 0x4 60 0 2 IRQ_TYPE_LEVEL_HIGH
59 0 3 0x4 61 0 3 IRQ_TYPE_LEVEL_HIGH
60 0 4 0x4 62 0 4 IRQ_TYPE_LEVEL_HIGH
61 0 5 0x4 63 0 5 IRQ_TYPE_LEVEL_HIGH
62 0 6 0x4 64 0 6 IRQ_TYPE_LEVEL_HIGH
63 0 7 0x4 65 0 7 IRQ_TYPE_LEVEL_HIGH
64 0 8 0x4>; 66 0 8 IRQ_TYPE_LEVEL_HIGH>;
65 }; 67 };
66 68
67 irqpin1: irqpin@e6900004 { 69 irqpin1: irqpin@e6900004 {
68 compatible = "renesas,intc-irqpin"; 70 compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
69 #interrupt-cells = <2>; 71 #interrupt-cells = <2>;
70 interrupt-controller; 72 interrupt-controller;
71 reg = <0xe6900004 4>, 73 reg = <0xe6900004 4>,
@@ -74,19 +76,19 @@
74 <0xe6900044 1>, 76 <0xe6900044 1>,
75 <0xe6900064 1>; 77 <0xe6900064 1>;
76 interrupt-parent = <&gic>; 78 interrupt-parent = <&gic>;
77 interrupts = <0 9 0x4 79 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH
78 0 10 0x4 80 0 10 IRQ_TYPE_LEVEL_HIGH
79 0 11 0x4 81 0 11 IRQ_TYPE_LEVEL_HIGH
80 0 12 0x4 82 0 12 IRQ_TYPE_LEVEL_HIGH
81 0 13 0x4 83 0 13 IRQ_TYPE_LEVEL_HIGH
82 0 14 0x4 84 0 14 IRQ_TYPE_LEVEL_HIGH
83 0 15 0x4 85 0 15 IRQ_TYPE_LEVEL_HIGH
84 0 16 0x4>; 86 0 16 IRQ_TYPE_LEVEL_HIGH>;
85 control-parent; 87 control-parent;
86 }; 88 };
87 89
88 irqpin2: irqpin@e6900008 { 90 irqpin2: irqpin@e6900008 {
89 compatible = "renesas,intc-irqpin"; 91 compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
90 #interrupt-cells = <2>; 92 #interrupt-cells = <2>;
91 interrupt-controller; 93 interrupt-controller;
92 reg = <0xe6900008 4>, 94 reg = <0xe6900008 4>,
@@ -95,18 +97,18 @@
95 <0xe6900048 1>, 97 <0xe6900048 1>,
96 <0xe6900068 1>; 98 <0xe6900068 1>;
97 interrupt-parent = <&gic>; 99 interrupt-parent = <&gic>;
98 interrupts = <0 17 0x4 100 interrupts = <0 17 IRQ_TYPE_LEVEL_HIGH
99 0 18 0x4 101 0 18 IRQ_TYPE_LEVEL_HIGH
100 0 19 0x4 102 0 19 IRQ_TYPE_LEVEL_HIGH
101 0 20 0x4 103 0 20 IRQ_TYPE_LEVEL_HIGH
102 0 21 0x4 104 0 21 IRQ_TYPE_LEVEL_HIGH
103 0 22 0x4 105 0 22 IRQ_TYPE_LEVEL_HIGH
104 0 23 0x4 106 0 23 IRQ_TYPE_LEVEL_HIGH
105 0 24 0x4>; 107 0 24 IRQ_TYPE_LEVEL_HIGH>;
106 }; 108 };
107 109
108 irqpin3: irqpin@e690000c { 110 irqpin3: irqpin@e690000c {
109 compatible = "renesas,intc-irqpin"; 111 compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
110 #interrupt-cells = <2>; 112 #interrupt-cells = <2>;
111 interrupt-controller; 113 interrupt-controller;
112 reg = <0xe690000c 4>, 114 reg = <0xe690000c 4>,
@@ -115,14 +117,14 @@
115 <0xe690004c 1>, 117 <0xe690004c 1>,
116 <0xe690006c 1>; 118 <0xe690006c 1>;
117 interrupt-parent = <&gic>; 119 interrupt-parent = <&gic>;
118 interrupts = <0 25 0x4 120 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH
119 0 26 0x4 121 0 26 IRQ_TYPE_LEVEL_HIGH
120 0 27 0x4 122 0 27 IRQ_TYPE_LEVEL_HIGH
121 0 28 0x4 123 0 28 IRQ_TYPE_LEVEL_HIGH
122 0 29 0x4 124 0 29 IRQ_TYPE_LEVEL_HIGH
123 0 30 0x4 125 0 30 IRQ_TYPE_LEVEL_HIGH
124 0 31 0x4 126 0 31 IRQ_TYPE_LEVEL_HIGH
125 0 32 0x4>; 127 0 32 IRQ_TYPE_LEVEL_HIGH>;
126 }; 128 };
127 129
128 i2c0: i2c@e6820000 { 130 i2c0: i2c@e6820000 {
@@ -131,10 +133,10 @@
131 compatible = "renesas,rmobile-iic"; 133 compatible = "renesas,rmobile-iic";
132 reg = <0xe6820000 0x425>; 134 reg = <0xe6820000 0x425>;
133 interrupt-parent = <&gic>; 135 interrupt-parent = <&gic>;
134 interrupts = <0 167 0x4 136 interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH
135 0 168 0x4 137 0 168 IRQ_TYPE_LEVEL_HIGH
136 0 169 0x4 138 0 169 IRQ_TYPE_LEVEL_HIGH
137 0 170 0x4>; 139 0 170 IRQ_TYPE_LEVEL_HIGH>;
138 status = "disabled"; 140 status = "disabled";
139 }; 141 };
140 142
@@ -144,10 +146,10 @@
144 compatible = "renesas,rmobile-iic"; 146 compatible = "renesas,rmobile-iic";
145 reg = <0xe6822000 0x425>; 147 reg = <0xe6822000 0x425>;
146 interrupt-parent = <&gic>; 148 interrupt-parent = <&gic>;
147 interrupts = <0 51 0x4 149 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH
148 0 52 0x4 150 0 52 IRQ_TYPE_LEVEL_HIGH
149 0 53 0x4 151 0 53 IRQ_TYPE_LEVEL_HIGH
150 0 54 0x4>; 152 0 54 IRQ_TYPE_LEVEL_HIGH>;
151 status = "disabled"; 153 status = "disabled";
152 }; 154 };
153 155
@@ -157,10 +159,10 @@
157 compatible = "renesas,rmobile-iic"; 159 compatible = "renesas,rmobile-iic";
158 reg = <0xe6824000 0x425>; 160 reg = <0xe6824000 0x425>;
159 interrupt-parent = <&gic>; 161 interrupt-parent = <&gic>;
160 interrupts = <0 171 0x4 162 interrupts = <0 171 IRQ_TYPE_LEVEL_HIGH
161 0 172 0x4 163 0 172 IRQ_TYPE_LEVEL_HIGH
162 0 173 0x4 164 0 173 IRQ_TYPE_LEVEL_HIGH
163 0 174 0x4>; 165 0 174 IRQ_TYPE_LEVEL_HIGH>;
164 status = "disabled"; 166 status = "disabled";
165 }; 167 };
166 168
@@ -170,10 +172,10 @@
170 compatible = "renesas,rmobile-iic"; 172 compatible = "renesas,rmobile-iic";
171 reg = <0xe6826000 0x425>; 173 reg = <0xe6826000 0x425>;
172 interrupt-parent = <&gic>; 174 interrupt-parent = <&gic>;
173 interrupts = <0 183 0x4 175 interrupts = <0 183 IRQ_TYPE_LEVEL_HIGH
174 0 184 0x4 176 0 184 IRQ_TYPE_LEVEL_HIGH
175 0 185 0x4 177 0 185 IRQ_TYPE_LEVEL_HIGH
176 0 186 0x4>; 178 0 186 IRQ_TYPE_LEVEL_HIGH>;
177 status = "disabled"; 179 status = "disabled";
178 }; 180 };
179 181
@@ -183,52 +185,52 @@
183 compatible = "renesas,rmobile-iic"; 185 compatible = "renesas,rmobile-iic";
184 reg = <0xe6828000 0x425>; 186 reg = <0xe6828000 0x425>;
185 interrupt-parent = <&gic>; 187 interrupt-parent = <&gic>;
186 interrupts = <0 187 0x4 188 interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH
187 0 188 0x4 189 0 188 IRQ_TYPE_LEVEL_HIGH
188 0 189 0x4 190 0 189 IRQ_TYPE_LEVEL_HIGH
189 0 190 0x4>; 191 0 190 IRQ_TYPE_LEVEL_HIGH>;
190 status = "disabled"; 192 status = "disabled";
191 }; 193 };
192 194
193 mmcif: mmcif@e6bd0000 { 195 mmcif: mmc@e6bd0000 {
194 compatible = "renesas,sh-mmcif"; 196 compatible = "renesas,sh-mmcif";
195 reg = <0xe6bd0000 0x100>; 197 reg = <0xe6bd0000 0x100>;
196 interrupt-parent = <&gic>; 198 interrupt-parent = <&gic>;
197 interrupts = <0 140 0x4 199 interrupts = <0 140 IRQ_TYPE_LEVEL_HIGH
198 0 141 0x4>; 200 0 141 IRQ_TYPE_LEVEL_HIGH>;
199 reg-io-width = <4>; 201 reg-io-width = <4>;
200 status = "disabled"; 202 status = "disabled";
201 }; 203 };
202 204
203 sdhi0: sdhi@ee100000 { 205 sdhi0: sd@ee100000 {
204 compatible = "renesas,sdhi-r8a7740"; 206 compatible = "renesas,sdhi-sh73a0";
205 reg = <0xee100000 0x100>; 207 reg = <0xee100000 0x100>;
206 interrupt-parent = <&gic>; 208 interrupt-parent = <&gic>;
207 interrupts = <0 83 4 209 interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH
208 0 84 4 210 0 84 IRQ_TYPE_LEVEL_HIGH
209 0 85 4>; 211 0 85 IRQ_TYPE_LEVEL_HIGH>;
210 cap-sd-highspeed; 212 cap-sd-highspeed;
211 status = "disabled"; 213 status = "disabled";
212 }; 214 };
213 215
214 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */ 216 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
215 sdhi1: sdhi@ee120000 { 217 sdhi1: sd@ee120000 {
216 compatible = "renesas,sdhi-r8a7740"; 218 compatible = "renesas,sdhi-sh73a0";
217 reg = <0xee120000 0x100>; 219 reg = <0xee120000 0x100>;
218 interrupt-parent = <&gic>; 220 interrupt-parent = <&gic>;
219 interrupts = <0 88 4 221 interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH
220 0 89 4>; 222 0 89 IRQ_TYPE_LEVEL_HIGH>;
221 toshiba,mmc-wrprotect-disable; 223 toshiba,mmc-wrprotect-disable;
222 cap-sd-highspeed; 224 cap-sd-highspeed;
223 status = "disabled"; 225 status = "disabled";
224 }; 226 };
225 227
226 sdhi2: sdhi@ee140000 { 228 sdhi2: sd@ee140000 {
227 compatible = "renesas,sdhi-r8a7740"; 229 compatible = "renesas,sdhi-sh73a0";
228 reg = <0xee140000 0x100>; 230 reg = <0xee140000 0x100>;
229 interrupt-parent = <&gic>; 231 interrupt-parent = <&gic>;
230 interrupts = <0 104 4 232 interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH
231 0 105 4>; 233 0 105 IRQ_TYPE_LEVEL_HIGH>;
232 toshiba,mmc-wrprotect-disable; 234 toshiba,mmc-wrprotect-disable;
233 cap-sd-highspeed; 235 cap-sd-highspeed;
234 status = "disabled"; 236 status = "disabled";
@@ -240,5 +242,23 @@
240 <0xe605801c 0x1c>; 242 <0xe605801c 0x1c>;
241 gpio-controller; 243 gpio-controller;
242 #gpio-cells = <2>; 244 #gpio-cells = <2>;
245 interrupts-extended =
246 <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>,
247 <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
248 <&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>,
249 <&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>,
250 <&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>,
251 <&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
252 <&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
253 <&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
254 };
255
256 sh_fsi2: sound@ec230000 {
257 #sound-dai-cells = <1>;
258 compatible = "renesas,sh_fsi2";
259 reg = <0xec230000 0x400>;
260 interrupt-parent = <&gic>;
261 interrupts = <0 146 0x4>;
262 status = "disabled";
243 }; 263 };
244}; 264};
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index f936476c2753..537f1a5c07f5 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -79,6 +79,8 @@
79 #dma-cells = <1>; 79 #dma-cells = <1>;
80 #dma-channels = <8>; 80 #dma-channels = <8>;
81 #dma-requests = <32>; 81 #dma-requests = <32>;
82 clocks = <&l4_main_clk>;
83 clock-names = "apb_pclk";
82 }; 84 };
83 }; 85 };
84 86
@@ -467,6 +469,8 @@
467 interrupts = <0 38 0x04>; 469 interrupts = <0 38 0x04>;
468 cache-unified; 470 cache-unified;
469 cache-level = <2>; 471 cache-level = <2>;
472 arm,tag-latency = <1 1 1>;
473 arm,data-latency = <2 1 1>;
470 }; 474 };
471 475
472 /* Local timer */ 476 /* Local timer */
diff --git a/arch/arm/boot/dts/st-pincfg.h b/arch/arm/boot/dts/st-pincfg.h
index 8c45d85ac13e..4851c387d52d 100644
--- a/arch/arm/boot/dts/st-pincfg.h
+++ b/arch/arm/boot/dts/st-pincfg.h
@@ -15,7 +15,7 @@
15/* Pull Up */ 15/* Pull Up */
16#define PU (1 << 26) 16#define PU (1 << 26)
17/* Open Drain */ 17/* Open Drain */
18#define OD (1 << 26) 18#define OD (1 << 25)
19#define RT (1 << 23) 19#define RT (1 << 23)
20#define INVERTCLK (1 << 22) 20#define INVERTCLK (1 << 22)
21#define CLKNOTDATA (1 << 21) 21#define CLKNOTDATA (1 << 21)
diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 7da99fe497e1..e0853ea02df2 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -913,6 +913,10 @@
913 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>; 913 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
914 v-ape-supply = <&db8500_vape_reg>; 914 v-ape-supply = <&db8500_vape_reg>;
915 915
916 dmas = <&dma 31 0 0x12>, /* Logical - DevToMem - HighPrio */
917 <&dma 31 0 0x10>; /* Logical - MemToDev - HighPrio */
918 dma-names = "rx", "tx";
919
916 clocks = <&prcc_kclk 1 3>, <&prcc_pclk 1 3>; 920 clocks = <&prcc_kclk 1 3>, <&prcc_pclk 1 3>;
917 clock-names = "msp", "apb_pclk"; 921 clock-names = "msp", "apb_pclk";
918 922
@@ -925,6 +929,9 @@
925 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>; 929 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
926 v-ape-supply = <&db8500_vape_reg>; 930 v-ape-supply = <&db8500_vape_reg>;
927 931
932 dmas = <&dma 30 0 0x10>; /* Logical - MemToDev - HighPrio */
933 dma-names = "tx";
934
928 clocks = <&prcc_kclk 1 4>, <&prcc_pclk 1 4>; 935 clocks = <&prcc_kclk 1 4>, <&prcc_pclk 1 4>;
929 clock-names = "msp", "apb_pclk"; 936 clock-names = "msp", "apb_pclk";
930 937
@@ -938,6 +945,11 @@
938 interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>; 945 interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
939 v-ape-supply = <&db8500_vape_reg>; 946 v-ape-supply = <&db8500_vape_reg>;
940 947
948 dmas = <&dma 14 0 0x12>, /* Logical - DevToMem - HighPrio */
949 <&dma 14 1 0x19>; /* Physical Chan 1 - MemToDev
950 HighPrio - Fixed */
951 dma-names = "rx", "tx";
952
941 clocks = <&prcc_kclk 2 3>, <&prcc_pclk 2 5>; 953 clocks = <&prcc_kclk 2 3>, <&prcc_pclk 2 5>;
942 clock-names = "msp", "apb_pclk"; 954 clock-names = "msp", "apb_pclk";
943 955
@@ -950,6 +962,9 @@
950 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>; 962 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
951 v-ape-supply = <&db8500_vape_reg>; 963 v-ape-supply = <&db8500_vape_reg>;
952 964
965 dmas = <&dma 30 0 0x12>; /* Logical - DevToMem - HighPrio */
966 dma-names = "rx";
967
953 clocks = <&prcc_kclk 1 10>, <&prcc_pclk 1 11>; 968 clocks = <&prcc_kclk 1 10>, <&prcc_pclk 1 11>;
954 clock-names = "msp", "apb_pclk"; 969 clock-names = "msp", "apb_pclk";
955 970
@@ -987,6 +1002,23 @@
987 status = "disabled"; 1002 status = "disabled";
988 }; 1003 };
989 1004
1005 mcde@a0350000 {
1006 compatible = "stericsson,mcde";
1007 reg = <0xa0350000 0x1000>, /* MCDE */
1008 <0xa0351000 0x1000>, /* DSI link 1 */
1009 <0xa0352000 0x1000>, /* DSI link 2 */
1010 <0xa0353000 0x1000>; /* DSI link 3 */
1011 interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
1012 clocks = <&prcmu_clk PRCMU_MCDECLK>, /* Main MCDE clock */
1013 <&prcmu_clk PRCMU_LCDCLK>, /* LCD clock */
1014 <&prcmu_clk PRCMU_PLLDSI>, /* HDMI clock */
1015 <&prcmu_clk PRCMU_DSI0CLK>, /* DSI 0 */
1016 <&prcmu_clk PRCMU_DSI1CLK>, /* DSI 1 */
1017 <&prcmu_clk PRCMU_DSI0ESCCLK>, /* TVout clock 0 */
1018 <&prcmu_clk PRCMU_DSI1ESCCLK>, /* TVout clock 1 */
1019 <&prcmu_clk PRCMU_DSI2ESCCLK>; /* TVout clock 2 */
1020 };
1021
990 cryp@a03cb000 { 1022 cryp@a03cb000 {
991 compatible = "stericsson,ux500-cryp"; 1023 compatible = "stericsson,ux500-cryp";
992 reg = <0xa03cb000 0x1000>; 1024 reg = <0xa03cb000 0x1000>;
diff --git a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
new file mode 100644
index 000000000000..addfcc7c2750
--- /dev/null
+++ b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
@@ -0,0 +1,745 @@
1/*
2 * Copyright 2013 Linaro Ltd.
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-nomadik-pinctrl.dtsi"
13
14/ {
15 soc {
16 pinctrl {
17 /* Settings for all UART default and sleep states */
18 uart0 {
19 uart0_default_mode: uart0_default {
20 default_mux {
21 ste,function = "u0";
22 ste,pins = "u0_a_1";
23 };
24 default_cfg1 {
25 ste,pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */
26 ste,config = <&in_pu>;
27 };
28
29 default_cfg2 {
30 ste,pins = "GPIO1_AJ3", "GPIO3_AH3"; /* RTS+TXD */
31 ste,config = <&out_hi>;
32 };
33 };
34
35 uart0_sleep_mode: uart0_sleep {
36 sleep_cfg1 {
37 ste,pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */
38 ste,config = <&slpm_in_wkup_pdis>;
39 };
40
41 sleep_cfg2 {
42 ste,pins = "GPIO1_AJ3"; /* RTS */
43 ste,config = <&slpm_out_hi_wkup_pdis>;
44 };
45
46 sleep_cfg3 {
47 ste,pins = "GPIO3_AH3"; /* TXD */
48 ste,config = <&slpm_out_wkup_pdis>;
49 };
50 };
51 };
52
53 uart1 {
54 uart1_default_mode: uart1_default {
55 default_mux {
56 ste,function = "u1";
57 ste,pins = "u1rxtx_a_1";
58 };
59 default_cfg1 {
60 ste,pins = "GPIO4_AH6"; /* RXD */
61 ste,config = <&in_pu>;
62 };
63
64 default_cfg2 {
65 ste,pins = "GPIO5_AG6"; /* TXD */
66 ste,config = <&out_hi>;
67 };
68 };
69
70 uart1_sleep_mode: uart1_sleep {
71 sleep_cfg1 {
72 ste,pins = "GPIO4_AH6"; /* RXD */
73 ste,config = <&slpm_in_wkup_pdis>;
74 };
75
76 sleep_cfg2 {
77 ste,pins = "GPIO5_AG6"; /* TXD */
78 ste,config = <&slpm_out_wkup_pdis>;
79 };
80 };
81 };
82
83 uart2 {
84 uart2_default_mode: uart2_default {
85 default_mux {
86 ste,function = "u2";
87 ste,pins = "u2rxtx_c_1";
88 };
89 default_cfg1 {
90 ste,pins = "GPIO29_W2"; /* RXD */
91 ste,config = <&in_pu>;
92 };
93
94 default_cfg2 {
95 ste,pins = "GPIO30_W3"; /* TXD */
96 ste,config = <&out_hi>;
97 };
98 };
99
100 uart2_sleep_mode: uart2_sleep {
101 sleep_cfg1 {
102 ste,pins = "GPIO29_W2"; /* RXD */
103 ste,config = <&in_wkup_pdis>;
104 };
105
106 sleep_cfg2 {
107 ste,pins = "GPIO30_W3"; /* TXD */
108 ste,config = <&out_wkup_pdis>;
109 };
110 };
111 };
112
113 /* Settings for all I2C default and sleep states */
114 i2c0 {
115 i2c0_default_mode: i2c_default {
116 default_mux {
117 ste,function = "i2c0";
118 ste,pins = "i2c0_a_1";
119 };
120 default_cfg1 {
121 ste,pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */
122 ste,config = <&in_pu>;
123 };
124 };
125
126 i2c0_sleep_mode: i2c_sleep {
127 sleep_cfg1 {
128 ste,pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */
129 ste,config = <&slpm_in_wkup_pdis>;
130 };
131 };
132 };
133
134 i2c1 {
135 i2c1_default_mode: i2c_default {
136 default_mux {
137 ste,function = "i2c1";
138 ste,pins = "i2c1_b_2";
139 };
140 default_cfg1 {
141 ste,pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */
142 ste,config = <&in_pu>;
143 };
144 };
145
146 i2c1_sleep_mode: i2c_sleep {
147 sleep_cfg1 {
148 ste,pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */
149 ste,config = <&slpm_in_wkup_pdis>;
150 };
151 };
152 };
153
154 i2c2 {
155 i2c2_default_mode: i2c_default {
156 default_mux {
157 ste,function = "i2c2";
158 ste,pins = "i2c2_b_2";
159 };
160 default_cfg1 {
161 ste,pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */
162 ste,config = <&in_pu>;
163 };
164 };
165
166 i2c2_sleep_mode: i2c_sleep {
167 sleep_cfg1 {
168 ste,pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */
169 ste,config = <&slpm_in_wkup_pdis>;
170 };
171 };
172 };
173
174 i2c3 {
175 i2c3_default_mode: i2c_default {
176 default_mux {
177 ste,function = "i2c3";
178 ste,pins = "i2c3_c_2";
179 };
180 default_cfg1 {
181 ste,pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */
182 ste,config = <&in_pu>;
183 };
184 };
185
186 i2c3_sleep_mode: i2c_sleep {
187 sleep_cfg1 {
188 ste,pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */
189 ste,config = <&slpm_in_wkup_pdis>;
190 };
191 };
192 };
193
194 /*
195 * Activating I2C4 will conflict with UART1 about the same pins so do not
196 * enable I2C4 and UART1 at the same time.
197 */
198 i2c4 {
199 i2c4_default_mode: i2c_default {
200 default_mux {
201 ste,function = "i2c4";
202 ste,pins = "i2c4_b_1";
203 };
204 default_cfg1 {
205 ste,pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */
206 ste,config = <&in_pu>;
207 };
208 };
209
210 i2c4_sleep_mode: i2c_sleep {
211 sleep_cfg1 {
212 ste,pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */
213 ste,config = <&slpm_in_wkup_pdis>;
214 };
215 };
216 };
217
218 /* Settings for all SPI default and sleep states */
219 spi2 {
220 spi2_default_mode: spi_default {
221 default_mux {
222 ste,function = "spi2";
223 ste,pins = "spi2_oc1_2";
224 };
225 default_cfg1 {
226 ste,pins = "GPIO216_AG12"; /* FRM */
227 ste,config = <&gpio_out_hi>;
228 };
229 default_cfg2 {
230 ste,pins = "GPIO218_AH11"; /* RXD */
231 ste,config = <&in_pd>;
232 };
233 default_cfg3 {
234 ste,pins =
235 "GPIO215_AH13", /* TXD */
236 "GPIO217_AH12"; /* CLK */
237 ste,config = <&out_lo>;
238 };
239 };
240
241 spi2_idle_mode: spi_idle {
242 /*
243 * The idle mode is basically sleep mode sans wakeups. Also
244 * note that we have muxes the pins off the function here
245 * as we do not state any muxing.
246 */
247 idle_cfg1 {
248 ste,pins = "GPIO218_AH11"; /* RXD */
249 ste,config = <&slpm_in_pdis>;
250 };
251 idle_cfg2 {
252 ste,pins = "GPIO215_AH13"; /* TXD */
253 ste,config = <&slpm_out_lo_pdis>;
254 };
255 idle_cfg3 {
256 ste,pins = "GPIO217_AH12"; /* CLK */
257 ste,config = <&slpm_pdis>;
258 };
259 };
260
261 spi2_sleep_mode: spi_sleep {
262 sleep_cfg1 {
263 ste,pins =
264 "GPIO216_AG12", /* FRM */
265 "GPIO218_AH11"; /* RXD */
266 ste,config = <&slpm_in_wkup_pdis>;
267 };
268 sleep_cfg2 {
269 ste,pins = "GPIO215_AH13"; /* TXD */
270 ste,config = <&slpm_out_lo_wkup_pdis>;
271 };
272 sleep_cfg3 {
273 ste,pins = "GPIO217_AH12"; /* CLK */
274 ste,config = <&slpm_wkup_pdis>;
275 };
276 };
277 };
278
279 /* Settings for all MMC/SD/SDIO default and sleep states */
280 sdi0 {
281 /* This is the external SD card slot, 4 bits wide */
282 sdi0_default_mode: sdi0_default {
283 default_mux {
284 ste,function = "mc0";
285 ste,pins = "mc0_a_1";
286 };
287 default_cfg1 {
288 ste,pins =
289 "GPIO18_AC2", /* CMDDIR */
290 "GPIO19_AC1", /* DAT0DIR */
291 "GPIO20_AB4"; /* DAT2DIR */
292 ste,config = <&out_hi>;
293 };
294 default_cfg2 {
295 ste,pins = "GPIO22_AA3"; /* FBCLK */
296 ste,config = <&in_nopull>;
297 };
298 default_cfg3 {
299 ste,pins = "GPIO23_AA4"; /* CLK */
300 ste,config = <&out_lo>;
301 };
302 default_cfg4 {
303 ste,pins =
304 "GPIO24_AB2", /* CMD */
305 "GPIO25_Y4", /* DAT0 */
306 "GPIO26_Y2", /* DAT1 */
307 "GPIO27_AA2", /* DAT2 */
308 "GPIO28_AA1"; /* DAT3 */
309 ste,config = <&in_pu>;
310 };
311 };
312
313 sdi0_sleep_mode: sdi0_sleep {
314 sleep_cfg1 {
315 ste,pins =
316 "GPIO18_AC2", /* CMDDIR */
317 "GPIO19_AC1", /* DAT0DIR */
318 "GPIO20_AB4"; /* DAT2DIR */
319 ste,config = <&slpm_out_hi_wkup_pdis>;
320 };
321 sleep_cfg2 {
322 ste,pins =
323 "GPIO22_AA3", /* FBCLK */
324 "GPIO24_AB2", /* CMD */
325 "GPIO25_Y4", /* DAT0 */
326 "GPIO26_Y2", /* DAT1 */
327 "GPIO27_AA2", /* DAT2 */
328 "GPIO28_AA1"; /* DAT3 */
329 ste,config = <&slpm_in_wkup_pdis>;
330 };
331 sleep_cfg3 {
332 ste,pins = "GPIO23_AA4"; /* CLK */
333 ste,config = <&slpm_out_lo_wkup_pdis>;
334 };
335 };
336 };
337
338 sdi1 {
339 /* This is the WLAN SDIO 4 bits wide */
340 sdi1_default_mode: sdi1_default {
341 default_mux {
342 ste,function = "mc1";
343 ste,pins = "mc1_a_1";
344 };
345 default_cfg1 {
346 ste,pins = "GPIO208_AH16"; /* CLK */
347 ste,config = <&out_lo>;
348 };
349 default_cfg2 {
350 ste,pins = "GPIO209_AG15"; /* FBCLK */
351 ste,config = <&in_nopull>;
352 };
353 default_cfg3 {
354 ste,pins =
355 "GPIO210_AJ15", /* CMD */
356 "GPIO211_AG14", /* DAT0 */
357 "GPIO212_AF13", /* DAT1 */
358 "GPIO213_AG13", /* DAT2 */
359 "GPIO214_AH15"; /* DAT3 */
360 ste,config = <&in_pu>;
361 };
362 };
363
364 sdi1_sleep_mode: sdi1_sleep {
365 sleep_cfg1 {
366 ste,pins = "GPIO208_AH16"; /* CLK */
367 ste,config = <&slpm_out_lo_wkup_pdis>;
368 };
369 sleep_cfg2 {
370 ste,pins =
371 "GPIO209_AG15", /* FBCLK */
372 "GPIO210_AJ15", /* CMD */
373 "GPIO211_AG14", /* DAT0 */
374 "GPIO212_AF13", /* DAT1 */
375 "GPIO213_AG13", /* DAT2 */
376 "GPIO214_AH15"; /* DAT3 */
377 ste,config = <&slpm_in_wkup_pdis>;
378 };
379 };
380 };
381
382 sdi2 {
383 /* This is the eMMC 8 bits wide, usually PoP eMMC */
384 sdi2_default_mode: sdi2_default {
385 default_mux {
386 ste,function = "mc2";
387 ste,pins = "mc2_a_1";
388 };
389 default_cfg1 {
390 ste,pins = "GPIO128_A5"; /* CLK */
391 ste,config = <&out_lo>;
392 };
393 default_cfg2 {
394 ste,pins = "GPIO130_C8"; /* FBCLK */
395 ste,config = <&in_nopull>;
396 };
397 default_cfg3 {
398 ste,pins =
399 "GPIO129_B4", /* CMD */
400 "GPIO131_A12", /* DAT0 */
401 "GPIO132_C10", /* DAT1 */
402 "GPIO133_B10", /* DAT2 */
403 "GPIO134_B9", /* DAT3 */
404 "GPIO135_A9", /* DAT4 */
405 "GPIO136_C7", /* DAT5 */
406 "GPIO137_A7", /* DAT6 */
407 "GPIO138_C5"; /* DAT7 */
408 ste,config = <&in_pu>;
409 };
410 };
411
412 sdi2_sleep_mode: sdi2_sleep {
413 sleep_cfg1 {
414 ste,pins = "GPIO128_A5"; /* CLK */
415 ste,config = <&out_lo_wkup_pdis>;
416 };
417 sleep_cfg2 {
418 ste,pins =
419 "GPIO130_C8", /* FBCLK */
420 "GPIO129_B4"; /* CMD */
421 ste,config = <&in_wkup_pdis_en>;
422 };
423 sleep_cfg3 {
424 ste,pins =
425 "GPIO131_A12", /* DAT0 */
426 "GPIO132_C10", /* DAT1 */
427 "GPIO133_B10", /* DAT2 */
428 "GPIO134_B9", /* DAT3 */
429 "GPIO135_A9", /* DAT4 */
430 "GPIO136_C7", /* DAT5 */
431 "GPIO137_A7", /* DAT6 */
432 "GPIO138_C5"; /* DAT7 */
433 ste,config = <&in_wkup_pdis>;
434 };
435 };
436 };
437
438 sdi4 {
439 /* This is the eMMC 8 bits wide, usually PCB-mounted eMMC */
440 sdi4_default_mode: sdi4_default {
441 default_mux {
442 ste,function = "mc4";
443 ste,pins = "mc4_a_1";
444 };
445 default_cfg1 {
446 ste,pins = "GPIO203_AE23"; /* CLK */
447 ste,config = <&out_lo>;
448 };
449 default_cfg2 {
450 ste,pins = "GPIO202_AF25"; /* FBCLK */
451 ste,config = <&in_nopull>;
452 };
453 default_cfg3 {
454 ste,pins =
455 "GPIO201_AF24", /* CMD */
456 "GPIO200_AH26", /* DAT0 */
457 "GPIO199_AH23", /* DAT1 */
458 "GPIO198_AG25", /* DAT2 */
459 "GPIO197_AH24", /* DAT3 */
460 "GPIO207_AJ23", /* DAT4 */
461 "GPIO206_AG24", /* DAT5 */
462 "GPIO205_AG23", /* DAT6 */
463 "GPIO204_AF23"; /* DAT7 */
464 ste,config = <&in_pu>;
465 };
466 };
467
468 sdi4_sleep_mode: sdi4_sleep {
469 sleep_cfg1 {
470 ste,pins = "GPIO203_AE23"; /* CLK */
471 ste,config = <&out_lo_wkup_pdis>;
472 };
473 sleep_cfg2 {
474 ste,pins =
475 "GPIO202_AF25", /* FBCLK */
476 "GPIO201_AF24", /* CMD */
477 "GPIO200_AH26", /* DAT0 */
478 "GPIO199_AH23", /* DAT1 */
479 "GPIO198_AG25", /* DAT2 */
480 "GPIO197_AH24", /* DAT3 */
481 "GPIO207_AJ23", /* DAT4 */
482 "GPIO206_AG24", /* DAT5 */
483 "GPIO205_AG23", /* DAT6 */
484 "GPIO204_AF23"; /* DAT7 */
485 ste,config = <&slpm_in_wkup_pdis>;
486 };
487 };
488 };
489
490 /*
491 * Multi-rate serial ports (MSPs) - MSP3 output is internal and
492 * cannot be muxed onto any pins.
493 */
494 msp0 {
495 msp0_default_mode: msp0_default {
496 default_msp0_mux {
497 ste,function = "msp0";
498 ste,pins = "msp0txrx_a_1", "msp0tfstck_a_1";
499 };
500 default_msp0_cfg {
501 ste,pins =
502 "GPIO12_AC4", /* TXD */
503 "GPIO15_AC3", /* RXD */
504 "GPIO13_AF3", /* TFS */
505 "GPIO14_AE3"; /* TCK */
506 ste,config = <&in_nopull>;
507 };
508 };
509 };
510
511 msp1 {
512 msp1_default_mode: msp1_default {
513 default_mux {
514 ste,function = "msp1";
515 ste,pins = "msp1txrx_a_1", "msp1_a_1";
516 };
517 default_cfg1 {
518 ste,pins = "GPIO33_AF2";
519 ste,config = <&out_lo>;
520 };
521 default_cfg2 {
522 ste,pins =
523 "GPIO34_AE1",
524 "GPIO35_AE2",
525 "GPIO36_AG2";
526 ste,config = <&in_nopull>;
527 };
528
529 };
530 };
531
532 msp2 {
533 msp2_default_mode: msp2_default {
534 /* MSP2 usually used for HDMI audio */
535 default_mux {
536 ste,function = "msp2";
537 ste,pins = "msp2_a_1";
538 };
539 default_cfg1 {
540 ste,pins =
541 "GPIO193_AH27", /* TXD */
542 "GPIO194_AF27", /* TCK */
543 "GPIO195_AG28"; /* TFS */
544 ste,config = <&in_pd>;
545 };
546 default_cfg2 {
547 ste,pins = "GPIO196_AG26"; /* RXD */
548 ste,config = <&out_lo>;
549 };
550 };
551 };
552
553
554 musb {
555 musb_default_mode: musb_default {
556 default_mux {
557 ste,function = "usb";
558 ste,pins = "usb_a_1";
559 };
560 default_cfg1 {
561 ste,pins =
562 "GPIO256_AF28", /* NXT */
563 "GPIO258_AD29", /* XCLK */
564 "GPIO259_AC29", /* DIR */
565 "GPIO260_AD28", /* DAT7 */
566 "GPIO261_AD26", /* DAT6 */
567 "GPIO262_AE26", /* DAT5 */
568 "GPIO263_AG29", /* DAT4 */
569 "GPIO264_AE27", /* DAT3 */
570 "GPIO265_AD27", /* DAT2 */
571 "GPIO266_AC28", /* DAT1 */
572 "GPIO267_AC27"; /* DAT0 */
573 ste,config = <&in_nopull>;
574 };
575 default_cfg2 {
576 ste,pins = "GPIO257_AE29"; /* STP */
577 ste,config = <&out_hi>;
578 };
579 };
580
581 musb_sleep_mode: musb_sleep {
582 sleep_cfg1 {
583 ste,pins =
584 "GPIO256_AF28", /* NXT */
585 "GPIO258_AD29", /* XCLK */
586 "GPIO259_AC29"; /* DIR */
587 ste,config = <&slpm_wkup_pdis_en>;
588 };
589 sleep_cfg2 {
590 ste,pins = "GPIO257_AE29"; /* STP */
591 ste,config = <&slpm_out_hi_wkup_pdis>;
592 };
593 sleep_cfg3 {
594 ste,pins =
595 "GPIO260_AD28", /* DAT7 */
596 "GPIO261_AD26", /* DAT6 */
597 "GPIO262_AE26", /* DAT5 */
598 "GPIO263_AG29", /* DAT4 */
599 "GPIO264_AE27", /* DAT3 */
600 "GPIO265_AD27", /* DAT2 */
601 "GPIO266_AC28", /* DAT1 */
602 "GPIO267_AC27"; /* DAT0 */
603 ste,config = <&slpm_in_wkup_pdis_en>;
604 };
605 };
606 };
607
608 mcde {
609 lcd_default_mode: lcd_default {
610 default_mux {
611 /* Mux in VSI0 and all the data lines */
612 ste,function = "lcd";
613 ste,pins =
614 "lcdvsi0_a_1", /* VSI0 for LCD */
615 "lcd_d0_d7_a_1", /* Data lines */
616 "lcd_d8_d11_a_1", /* TV-out */
617 "lcdaclk_b_1", /* Clock line for TV-out */
618 "lcdvsi1_a_1"; /* VSI1 for HDMI */
619 };
620 default_cfg1 {
621 ste,pins =
622 "GPIO68_E1", /* VSI0 */
623 "GPIO69_E2"; /* VSI1 */
624 ste,config = <&in_pu>;
625 };
626 };
627 lcd_sleep_mode: lcd_sleep {
628 sleep_cfg1 {
629 ste,pins = "GPIO69_E2"; /* VSI1 */
630 ste,config = <&slpm_in_wkup_pdis>;
631 };
632 };
633 };
634
635 ske {
636 /* SKE keys on position 2 in an 8x8 matrix */
637 ske_kpa2_default_mode: ske_kpa2_default {
638 default_mux {
639 ste,function = "kp";
640 ste,pins = "kp_a_2";
641 };
642 default_cfg1 {
643 ste,pins =
644 "GPIO153_B17", /* I7 */
645 "GPIO154_C16", /* I6 */
646 "GPIO155_C19", /* I5 */
647 "GPIO156_C17", /* I4 */
648 "GPIO161_D21", /* I3 */
649 "GPIO162_D20", /* I2 */
650 "GPIO163_C20", /* I1 */
651 "GPIO164_B21"; /* I0 */
652 ste,config = <&in_pd>;
653 };
654 default_cfg2 {
655 ste,pins =
656 "GPIO157_A18", /* O7 */
657 "GPIO158_C18", /* O6 */
658 "GPIO159_B19", /* O5 */
659 "GPIO160_B20", /* O4 */
660 "GPIO165_C21", /* O3 */
661 "GPIO166_A22", /* O2 */
662 "GPIO167_B24", /* O1 */
663 "GPIO168_C22"; /* O0 */
664 ste,config = <&out_lo>;
665 };
666 };
667 ske_kpa2_sleep_mode: ske_kpa2_sleep {
668 sleep_cfg1 {
669 ste,pins =
670 "GPIO153_B17", /* I7 */
671 "GPIO154_C16", /* I6 */
672 "GPIO155_C19", /* I5 */
673 "GPIO156_C17", /* I4 */
674 "GPIO161_D21", /* I3 */
675 "GPIO162_D20", /* I2 */
676 "GPIO163_C20", /* I1 */
677 "GPIO164_B21"; /* I0 */
678 ste,config = <&slpm_in_pu_wkup_pdis_en>;
679 };
680 sleep_cfg2 {
681 ste,pins =
682 "GPIO157_A18", /* O7 */
683 "GPIO158_C18", /* O6 */
684 "GPIO159_B19", /* O5 */
685 "GPIO160_B20", /* O4 */
686 "GPIO165_C21", /* O3 */
687 "GPIO166_A22", /* O2 */
688 "GPIO167_B24", /* O1 */
689 "GPIO168_C22"; /* O0 */
690 ste,config = <&slpm_out_lo_pdis>;
691 };
692 };
693 /*
694 * SKE keys on position 1 and "other C1" combi giving
695 * six rows of six keys.
696 */
697 ske_kpaoc1_default_mode: ske_kpaoc1_default {
698 default_mux {
699 ste,function = "kp";
700 ste,pins = "kp_a_1", "kp_oc1_1";
701 };
702 default_cfg1 {
703 ste,pins =
704 "GPIO91_B6", /* KP_O0 */
705 "GPIO90_A3", /* KP_O1 */
706 "GPIO87_B3", /* KP_O2 */
707 "GPIO86_C6", /* KP_O3 */
708 "GPIO96_D8", /* KP_O6 */
709 "GPIO94_D7"; /* KP_O7 */
710 ste,config = <&out_lo>;
711 };
712 default_cfg2 {
713 ste,pins =
714 "GPIO93_B7", /* KP_I0 */
715 "GPIO92_D6", /* KP_I1 */
716 "GPIO89_E6", /* KP_I2 */
717 "GPIO88_C4", /* KP_I3 */
718 "GPIO97_D9", /* KP_I6 */
719 "GPIO95_E8"; /* KP_I7 */
720 ste,config = <&in_pu>;
721 };
722 };
723 };
724
725 wlan {
726 wlan_default_mode: wlan_default {
727 /*
728 * Activate this mode with the WLAN chip.
729 * These are plain GPIO pins used by WLAN
730 */
731 default_cfg1 {
732 ste,pins =
733 "GPIO226_AF8", /* WLAN_PMU_EN */
734 "GPIO85_D5"; /* WLAN_ENA */
735 ste,config = <&gpio_out_lo>;
736 };
737 default_cfg2 {
738 ste,pins = "GPIO4_AH6"; /* WLAN_IRQ on UART1 */
739 ste,config = <&gpio_in_pu>;
740 };
741 };
742 };
743 };
744 };
745};
diff --git a/arch/arm/boot/dts/ste-href-stuib.dtsi b/arch/arm/boot/dts/ste-href-stuib.dtsi
index 76704ec0ffcc..1c3574435ea8 100644
--- a/arch/arm/boot/dts/ste-href-stuib.dtsi
+++ b/arch/arm/boot/dts/ste-href-stuib.dtsi
@@ -12,6 +12,28 @@
12#include <dt-bindings/interrupt-controller/irq.h> 12#include <dt-bindings/interrupt-controller/irq.h>
13 13
14/ { 14/ {
15 gpio_keys {
16 compatible = "gpio-keys";
17 #address-cells = <1>;
18 #size-cells = <0>;
19 vdd-supply = <&ab8500_ldo_aux1_reg>;
20 pinctrl-names = "default";
21 pinctrl-0 = <&prox_stuib_mode>, <&hall_stuib_mode>;
22
23 button@139 {
24 /* Proximity sensor */
25 gpios = <&gpio6 25 0x4>;
26 linux,code = <11>; /* SW_FRONT_PROXIMITY */
27 label = "SFH7741 Proximity Sensor";
28 };
29 button@145 {
30 /* Hall sensor */
31 gpios = <&gpio4 17 0x4>;
32 linux,code = <0>; /* SW_LID */
33 label = "HED54XXU11 Hall Effect Sensor";
34 };
35 };
36
15 soc { 37 soc {
16 i2c@80004000 { 38 i2c@80004000 {
17 stmpe1601: stmpe1601@40 { 39 stmpe1601: stmpe1601@40 {
@@ -74,5 +96,24 @@
74 rohm,flip-y; 96 rohm,flip-y;
75 }; 97 };
76 }; 98 };
99
100 pinctrl {
101 prox {
102 prox_stuib_mode: prox_stuib {
103 stuib_cfg {
104 ste,pins = "GPIO217_AH12";
105 ste,config = <&gpio_in_pu>;
106 };
107 };
108 };
109 hall {
110 hall_stuib_mode: stuib_tvk {
111 stuib_cfg {
112 ste,pins = "GPIO145_C13";
113 ste,config = <&gpio_in_pu>;
114 };
115 };
116 };
117 };
77 }; 118 };
78}; 119};
diff --git a/arch/arm/boot/dts/ste-href-tvk1281618.dtsi b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
index 76d3ef13175f..c40565320978 100644
--- a/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
+++ b/arch/arm/boot/dts/ste-href-tvk1281618.dtsi
@@ -14,27 +14,105 @@
14#include <dt-bindings/interrupt-controller/irq.h> 14#include <dt-bindings/interrupt-controller/irq.h>
15 15
16/ { 16/ {
17 gpio_keys {
18 compatible = "gpio-keys";
19 #address-cells = <1>;
20 #size-cells = <0>;
21 vdd-supply = <&ab8500_ldo_aux1_reg>;
22 pinctrl-names = "default";
23 pinctrl-0 = <&prox_tvk_mode>, <&hall_tvk_mode>;
24
25 button@139 {
26 /* Proximity sensor */
27 gpios = <&gpio6 25 0x4>;
28 linux,code = <11>; /* SW_FRONT_PROXIMITY */
29 label = "SFH7741 Proximity Sensor";
30 };
31 button@145 {
32 /* Hall sensor */
33 gpios = <&gpio4 17 0x4>;
34 linux,code = <0>; /* SW_LID */
35 label = "HED54XXU11 Hall Effect Sensor";
36 };
37 };
38
17 soc { 39 soc {
18 /* Add Synaptics touch screen, TC35892 keypad etc here */ 40 /* Add Synaptics touch screen, TC35893 keypad etc here */
19 i2c@80004000 { 41 i2c@80004000 {
20 tc3589x@44 { 42 tc35893@44 {
21 compatible = "tc3589x"; 43 compatible = "toshiba,tc35893";
22 reg = <0x44>; 44 reg = <0x44>;
23 interrupt-parent = <&gpio6>; 45 interrupt-parent = <&gpio6>;
24 interrupts = <26 IRQ_TYPE_EDGE_RISING>; 46 interrupts = <26 IRQ_TYPE_EDGE_RISING>;
47 pinctrl-names = "default";
48 pinctrl-0 = <&tc35893_tvk_mode>;
25 49
26 interrupt-controller; 50 interrupt-controller;
27 #interrupt-cells = <2>; 51 #interrupt-cells = <1>;
28 52
29 tc3589x_gpio { 53 tc3589x_gpio {
30 compatible = "tc3589x-gpio"; 54 compatible = "toshiba,tc3589x-gpio";
31 interrupts = <0 IRQ_TYPE_EDGE_RISING>; 55 interrupts = <0>;
32 56
33 interrupt-controller; 57 interrupt-controller;
34 #interrupt-cells = <2>; 58 #interrupt-cells = <2>;
35 gpio-controller; 59 gpio-controller;
36 #gpio-cells = <2>; 60 #gpio-cells = <2>;
37 }; 61 };
62 tc3589x_keypad {
63 compatible = "toshiba,tc3589x-keypad";
64 interrupts = <6>;
65 debounce-delay-ms = <4>;
66 keypad,num-columns = <8>;
67 keypad,num-rows = <8>;
68 linux,no-autorepeat;
69 linux,wakeup;
70 linux,keymap = <0x0301006b
71 0x04010066
72 0x06040072
73 0x040200d7
74 0x0303006a
75 0x0205000e
76 0x0607008b
77 0x0500001c
78 0x0403000b
79 0x03040034
80 0x05020067
81 0x0305006c
82 0x040500e7
83 0x0005009e
84 0x06020073
85 0x01030039
86 0x07060069
87 0x050500d9>;
88 };
89 };
90 };
91 pinctrl {
92 /* Pull up this GPIO pin */
93 tc35893 {
94 tc35893_tvk_mode: tc35893_tvk {
95 tvk_cfg {
96 ste,pins = "GPIO218_AH11";
97 ste,config = <&gpio_in_pu>;
98 };
99 };
100 };
101 prox {
102 prox_tvk_mode: prox_tvk {
103 tvk_cfg {
104 ste,pins = "GPIO217_AH12";
105 ste,config = <&gpio_in_pu>;
106 };
107 };
108 };
109 hall {
110 hall_tvk_mode: hall_tvk {
111 tvk_cfg {
112 ste,pins = "GPIO145_C13";
113 ste,config = <&gpio_in_pu>;
114 };
115 };
38 }; 116 };
39 }; 117 };
40 }; 118 };
diff --git a/arch/arm/boot/dts/ste-href.dtsi b/arch/arm/boot/dts/ste-href.dtsi
index aa3f02060fdd..0c1e8d871ed1 100644
--- a/arch/arm/boot/dts/ste-href.dtsi
+++ b/arch/arm/boot/dts/ste-href.dtsi
@@ -11,37 +11,57 @@
11 11
12#include <dt-bindings/interrupt-controller/irq.h> 12#include <dt-bindings/interrupt-controller/irq.h>
13#include "ste-dbx5x0.dtsi" 13#include "ste-dbx5x0.dtsi"
14#include "ste-href-family-pinctrl.dtsi"
14 15
15/ { 16/ {
16 memory { 17 memory {
17 reg = <0x00000000 0x20000000>; 18 reg = <0x00000000 0x20000000>;
18 }; 19 };
19 20
20 gpio_keys { 21 soc {
21 compatible = "gpio-keys"; 22 usb_per5@a03e0000 {
22 #address-cells = <1>; 23 pinctrl-names = "default", "sleep";
23 #size-cells = <0>; 24 pinctrl-0 = <&musb_default_mode>;
24 25 pinctrl-1 = <&musb_sleep_mode>;
25 button@1 {
26 linux,code = <11>;
27 label = "SFH7741 Proximity Sensor";
28 }; 26 };
29 };
30 27
31 soc {
32 uart@80120000 { 28 uart@80120000 {
29 pinctrl-names = "default", "sleep";
30 pinctrl-0 = <&uart0_default_mode>;
31 pinctrl-1 = <&uart0_sleep_mode>;
33 status = "okay"; 32 status = "okay";
34 }; 33 };
35 34
36 uart@80121000 { 35 uart@80121000 {
36 pinctrl-names = "default", "sleep";
37 pinctrl-0 = <&uart1_default_mode>;
38 pinctrl-1 = <&uart1_sleep_mode>;
37 status = "okay"; 39 status = "okay";
38 }; 40 };
39 41
40 uart@80007000 { 42 uart@80007000 {
43 pinctrl-names = "default", "sleep";
44 pinctrl-0 = <&uart2_default_mode>;
45 pinctrl-1 = <&uart2_sleep_mode>;
41 status = "okay"; 46 status = "okay";
42 }; 47 };
43 48
49 i2c@80004000 {
50 pinctrl-names = "default","sleep";
51 pinctrl-0 = <&i2c0_default_mode>;
52 pinctrl-1 = <&i2c0_sleep_mode>;
53 };
54
55 i2c@80122000 {
56 pinctrl-names = "default","sleep";
57 pinctrl-0 = <&i2c1_default_mode>;
58 pinctrl-1 = <&i2c1_sleep_mode>;
59 };
60
44 i2c@80128000 { 61 i2c@80128000 {
62 pinctrl-names = "default","sleep";
63 pinctrl-0 = <&i2c2_default_mode>;
64 pinctrl-1 = <&i2c2_sleep_mode>;
45 lp5521@33 { 65 lp5521@33 {
46 compatible = "national,lp5521"; 66 compatible = "national,lp5521";
47 reg = <0x33>; 67 reg = <0x33>;
@@ -85,6 +105,12 @@
85 }; 105 };
86 }; 106 };
87 107
108 i2c@80110000 {
109 pinctrl-names = "default","sleep";
110 pinctrl-0 = <&i2c3_default_mode>;
111 pinctrl-1 = <&i2c3_sleep_mode>;
112 };
113
88 // External Micro SD slot 114 // External Micro SD slot
89 sdi0_per1@80126000 { 115 sdi0_per1@80126000 {
90 arm,primecell-periphid = <0x10480180>; 116 arm,primecell-periphid = <0x10480180>;
@@ -94,8 +120,9 @@
94 mmc-cap-mmc-highspeed; 120 mmc-cap-mmc-highspeed;
95 vmmc-supply = <&ab8500_ldo_aux3_reg>; 121 vmmc-supply = <&ab8500_ldo_aux3_reg>;
96 vqmmc-supply = <&vmmci>; 122 vqmmc-supply = <&vmmci>;
97 123 pinctrl-names = "default", "sleep";
98 cd-gpios = <&tc3589x_gpio 3 0x4>; 124 pinctrl-0 = <&sdi0_default_mode>;
125 pinctrl-1 = <&sdi0_sleep_mode>;
99 126
100 status = "okay"; 127 status = "okay";
101 }; 128 };
@@ -105,6 +132,9 @@
105 arm,primecell-periphid = <0x10480180>; 132 arm,primecell-periphid = <0x10480180>;
106 max-frequency = <100000000>; 133 max-frequency = <100000000>;
107 bus-width = <4>; 134 bus-width = <4>;
135 pinctrl-names = "default", "sleep";
136 pinctrl-0 = <&sdi1_default_mode>;
137 pinctrl-1 = <&sdi1_sleep_mode>;
108 138
109 status = "okay"; 139 status = "okay";
110 }; 140 };
@@ -115,6 +145,9 @@
115 max-frequency = <100000000>; 145 max-frequency = <100000000>;
116 bus-width = <8>; 146 bus-width = <8>;
117 mmc-cap-mmc-highspeed; 147 mmc-cap-mmc-highspeed;
148 pinctrl-names = "default", "sleep";
149 pinctrl-0 = <&sdi2_default_mode>;
150 pinctrl-1 = <&sdi2_sleep_mode>;
118 151
119 status = "okay"; 152 status = "okay";
120 }; 153 };
@@ -126,6 +159,9 @@
126 bus-width = <8>; 159 bus-width = <8>;
127 mmc-cap-mmc-highspeed; 160 mmc-cap-mmc-highspeed;
128 vmmc-supply = <&ab8500_ldo_aux2_reg>; 161 vmmc-supply = <&ab8500_ldo_aux2_reg>;
162 pinctrl-names = "default", "sleep";
163 pinctrl-0 = <&sdi4_default_mode>;
164 pinctrl-1 = <&sdi4_sleep_mode>;
129 165
130 status = "okay"; 166 status = "okay";
131 }; 167 };
@@ -137,7 +173,21 @@
137 stericsson,audio-codec = <&codec>; 173 stericsson,audio-codec = <&codec>;
138 }; 174 };
139 175
176 msp0: msp@80123000 {
177 pinctrl-names = "default";
178 pinctrl-0 = <&msp0_default_mode>;
179 status = "okay";
180 };
181
140 msp1: msp@80124000 { 182 msp1: msp@80124000 {
183 pinctrl-names = "default";
184 pinctrl-0 = <&msp1_default_mode>;
185 status = "okay";
186 };
187
188 msp2: msp@80117000 {
189 pinctrl-names = "default";
190 pinctrl-0 = <&msp2_default_mode>;
141 status = "okay"; 191 status = "okay";
142 }; 192 };
143 193
@@ -198,5 +248,11 @@
198 }; 248 };
199 }; 249 };
200 }; 250 };
251
252 mcde@a0350000 {
253 pinctrl-names = "default", "sleep";
254 pinctrl-0 = <&lcd_default_mode>;
255 pinctrl-1 = <&lcd_sleep_mode>;
256 };
201 }; 257 };
202}; 258};
diff --git a/arch/arm/boot/dts/ste-hrefprev60.dtsi b/arch/arm/boot/dts/ste-hrefprev60.dtsi
index b2cd7bc2752f..40f0ecdf9303 100644
--- a/arch/arm/boot/dts/ste-hrefprev60.dtsi
+++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi
@@ -28,18 +28,20 @@
28 reg = <0x33>; 28 reg = <0x33>;
29 }; 29 };
30 30
31 tc3589x@42 { 31 tc35892@42 {
32 compatible = "tc3589x"; 32 compatible = "toshiba,tc35892";
33 reg = <0x42>; 33 reg = <0x42>;
34 interrupt-parent = <&gpio6>; 34 interrupt-parent = <&gpio6>;
35 interrupts = <25 IRQ_TYPE_EDGE_RISING>; 35 interrupts = <25 IRQ_TYPE_EDGE_RISING>;
36 pinctrl-names = "default";
37 pinctrl-0 = <&tc35892_hrefprev60_mode>;
36 38
37 interrupt-controller; 39 interrupt-controller;
38 #interrupt-cells = <2>; 40 #interrupt-cells = <1>;
39 41
40 tc3589x_gpio: tc3589x_gpio { 42 tc3589x_gpio: tc3589x_gpio {
41 compatible = "tc3589x-gpio"; 43 compatible = "tc3589x-gpio";
42 interrupts = <0 IRQ_TYPE_EDGE_RISING>; 44 interrupts = <0>;
43 45
44 interrupt-controller; 46 interrupt-controller;
45 #interrupt-cells = <2>; 47 #interrupt-cells = <2>;
@@ -49,11 +51,77 @@
49 }; 51 };
50 }; 52 };
51 53
54 ssp@80002000 {
55 /*
56 * On the first generation boards, this SSP/SPI port was connected
57 * to the AB8500.
58 */
59 pinctrl-names = "default";
60 pinctrl-0 = <&ssp0_hrefprev60_mode>;
61 };
62
63 // External Micro SD slot
64 sdi0_per1@80126000 {
65 cd-gpios = <&tc3589x_gpio 3 0x4>;
66 };
67
52 vmmci: regulator-gpio { 68 vmmci: regulator-gpio {
53 gpios = <&tc3589x_gpio 18 0x4>; 69 gpios = <&tc3589x_gpio 18 0x4>;
54 enable-gpio = <&tc3589x_gpio 17 0x4>; 70 enable-gpio = <&tc3589x_gpio 17 0x4>;
71 };
72
73 pinctrl {
74 /* Set this up using hogs */
75 pinctrl-names = "default";
76 pinctrl-0 = <&ipgpio_hrefprev60_mode>;
55 77
56 status = "okay"; 78 ssp0 {
79 ssp0_hrefprev60_mode: ssp0_hrefprev60_default {
80 hrefprev60_mux {
81 ste,function = "ssp0";
82 ste,pins = "ssp0_a_1";
83 };
84 hrefprev60_cfg1 {
85 ste,pins = "GPIO145_C13"; /* RXD */
86 ste,config = <&in_pd>;
87 };
88
89 };
90 };
91 sdi0 {
92 /* This additional pin needed on early MOP500 and HREFs previous to v60 */
93 sdi0_default_mode: sdi0_default {
94 hrefprev60_mux {
95 ste,function = "mc0";
96 ste,pins = "mc0dat31dir_a_1";
97 };
98 hrefprev60_cfg1 {
99 ste,pins = "GPIO21_AB3"; /* DAT31DIR */
100 ste,config = <&out_hi>;
101 };
102
103 };
104 };
105 tc35892 {
106 tc35892_hrefprev60_mode: tc35892_hrefprev60 {
107 hrefprev60_cfg {
108 ste,pins = "GPIO217_AH12";
109 ste,config = <&gpio_in_pu>;
110 };
111 };
112 };
113 ipgpio {
114 ipgpio_hrefprev60_mode: ipgpio_hrefprev60 {
115 hrefprev60_mux {
116 ste,function = "ipgpio";
117 ste,pins = "ipgpio0_c_1", "ipgpio1_c_1";
118 };
119 hrefprev60_cfg1 {
120 ste,pins = "GPIO6_AF6", "GPIO7_AG5";
121 ste,config = <&in_pu>;
122 };
123 };
124 };
57 }; 125 };
58 }; 126 };
59}; 127};
diff --git a/arch/arm/boot/dts/ste-hrefv60plus.dtsi b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
index aed511b47a9e..3b6d1181939b 100644
--- a/arch/arm/boot/dts/ste-hrefv60plus.dtsi
+++ b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
@@ -16,55 +16,226 @@
16 model = "ST-Ericsson HREF (v60+) platform with Device Tree"; 16 model = "ST-Ericsson HREF (v60+) platform with Device Tree";
17 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; 17 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
18 18
19 gpio_keys {
20 button@1 {
21 gpios = <&gpio5 25 0x4>;
22 };
23 };
24
25 soc { 19 soc {
26 // External Micro SD slot 20 // External Micro SD slot
27 sdi0_per1@80126000 { 21 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 22 cd-gpios = <&gpio2 31 0x4>; // 95
36
37 status = "okay";
38 }; 23 };
39 24
40 // WLAN SDIO channel 25 vmmci: regulator-gpio {
41 sdi1_per2@80118000 { 26 gpios = <&gpio0 5 0x4>;
42 arm,primecell-periphid = <0x10480180>; 27 enable-gpio = <&gpio5 9 0x4>;
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 }; 28 };
58 29
59 // On-board eMMC 30 pinctrl {
60 sdi4_per2@80114000 { 31 /*
61 arm,primecell-periphid = <0x10480180>; 32 * Set this up using hogs, as time goes by and as seems fit, these
62 max-frequency = <100000000>; 33 * can be moved over to being controlled by respective device.
63 bus-width = <8>; 34 */
64 mmc-cap-mmc-highspeed; 35 pinctrl-names = "default";
65 vmmc-supply = <&ab8500_ldo_aux2_reg>; 36 pinctrl-0 = <&ipgpio_hrefv60_mode>,
37 <&accel_hrefv60_mode>,
38 <&magneto_hrefv60_mode>,
39 <&etm_hrefv60_mode>,
40 <&nahj_hrefv60_mode>,
41 <&nfc_hrefv60_mode>,
42 <&force_hrefv60_mode>,
43 <&dipro_hrefv60_mode>,
44 <&vaudio_hf_hrefv60_mode>,
45 <&gbf_hrefv60_mode>,
46 <&hdtv_hrefv60_mode>,
47 <&touch_hrefv60_mode>;
66 48
67 status = "okay"; 49 sdi0 {
50 /* SD card detect GPIO pin, extend default state */
51 sdi0_default_mode: sdi0_default {
52 default_hrefv60_cfg1 {
53 ste,pins = "GPIO95_E8";
54 ste,config = <&gpio_in_pu>;
55 };
56 };
57 };
58 ipgpio {
59 /*
60 * XENON Flashgun on image processor GPIO (controlled from image
61 * processor firmware), mux in these image processor GPIO lines 0
62 * (XENON_FLASH_ID), 1 (XENON_READY) and there is an assistant
63 * LED on IP GPIO 4 (XENON_EN2) on altfunction C, that need bias
64 * from GPIO21 so pull up 0, 1 and drive 4 and GPIO21 low as output.
65 */
66 ipgpio_hrefv60_mode: ipgpio_hrefv60 {
67 hrefv60_mux {
68 ste,function = "ipgpio";
69 ste,pins = "ipgpio0_c_1", "ipgpio1_c_1", "ipgpio4_c_1";
70 };
71 hrefv60_cfg1 {
72 ste,pins = "GPIO6_AF6", "GPIO7_AG5";
73 ste,config = <&in_pu>;
74 };
75 hrefv60_cfg2 {
76 ste,pins = "GPIO21_AB3";
77 ste,config = <&gpio_out_lo>;
78 };
79 hrefv60_cfg3 {
80 ste,pins = "GPIO64_F3";
81 ste,config = <&out_lo>;
82 };
83 };
84 };
85 accelerometer {
86 accel_hrefv60_mode: accel_hrefv60 {
87 /* Accelerometer interrupt lines 1 & 2 */
88 hrefv60_cfg1 {
89 ste,pins = "GPIO82_C1", "GPIO83_D3";
90 ste,config = <&gpio_in_pu>;
91 };
92 };
93 };
94 magnetometer {
95 magneto_hrefv60_mode: magneto_hrefv60 {
96 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
97 hrefv60_cfg1 {
98 ste,pins = "GPIO31_V3";
99 ste,config = <&gpio_in_pu>;
100 };
101 hrefv60_cfg2 {
102 ste,pins = "GPIO32_V2";
103 ste,config = <&gpio_in_pd>;
104 };
105 };
106 };
107 etm {
108 /*
109 * Drive D19-D23 for the ETM PTM trace interface low,
110 * (presumably pins are unconnected therefore grounded here,
111 * the "other alt C1" setting enables these pins)
112 */
113 etm_hrefv60_mode: etm_hrefv60 {
114 hrefv60_cfg1 {
115 ste,pins =
116 "GPIO70_G5",
117 "GPIO71_G4",
118 "GPIO72_H4",
119 "GPIO73_H3",
120 "GPIO74_J3";
121 ste,config = <&gpio_out_lo>;
122 };
123 };
124 };
125 nahj {
126 nahj_hrefv60_mode: nahj_hrefv60 {
127 /* NAHJ CTRL on GPIO76 to low, CTRL_INV on GPIO216 to high */
128 hrefv60_cfg1 {
129 ste,pins = "GPIO76_J2";
130 ste,config = <&gpio_out_lo>;
131 };
132 hrefv60_cfg2 {
133 ste,pins = "GPIO216_AG12";
134 ste,config = <&gpio_out_hi>;
135 };
136 };
137 };
138 nfc {
139 nfc_hrefv60_mode: nfc_hrefv60 {
140 /* NFC ENA and RESET to low, pulldown IRQ line */
141 hrefv60_cfg1 {
142 ste,pins =
143 "GPIO77_H1", /* NFC_ENA */
144 "GPIO142_C11"; /* NFC_RESET */
145 ste,config = <&gpio_out_lo>;
146 };
147 hrefv60_cfg2 {
148 ste,pins = "GPIO144_B13"; /* NFC_IRQ */
149 ste,config = <&gpio_in_pd>;
150 };
151 };
152 };
153 force {
154 force_hrefv60_mode: force_hrefv60 {
155 hrefv60_cfg1 {
156 ste,pins = "GPIO91_B6"; /* FORCE_SENSING_INT */
157 ste,config = <&gpio_in_pu>;
158 };
159 hrefv60_cfg2 {
160 ste,pins =
161 "GPIO92_D6", /* FORCE_SENSING_RST */
162 "GPIO97_D9"; /* FORCE_SENSING_WU */
163 ste,config = <&gpio_out_lo>;
164 };
165 };
166 };
167 dipro {
168 dipro_hrefv60_mode: dipro_hrefv60 {
169 hrefv60_cfg1 {
170 ste,pins = "GPIO139_C9"; /* DIPRO_INT */
171 ste,config = <&gpio_in_pu>;
172 };
173 };
174 };
175 vaudio_hf {
176 vaudio_hf_hrefv60_mode: vaudio_hf_hrefv60 {
177 /* Audio Amplifier HF enable GPIO */
178 hrefv60_cfg1 {
179 ste,pins = "GPIO149_B14"; /* VAUDIO_HF_EN, enable MAX8968 */
180 ste,config = <&gpio_out_hi>;
181 };
182 };
183 };
184 gbf {
185 gbf_hrefv60_mode: gbf_hrefv60 {
186 /*
187 * GBF (GPS, Bluetooth, FM-radio) interface,
188 * pull low to reset state
189 */
190 hrefv60_cfg1 {
191 ste,pins = "GPIO171_D23"; /* GBF_ENA_RESET */
192 ste,config = <&gpio_out_lo>;
193 };
194 };
195 };
196 hdtv {
197 hdtv_hrefv60_mode: hdtv_hrefv60 {
198 /* MSP : HDTV INTERFACE GPIO line */
199 hrefv60_cfg1 {
200 ste,pins = "GPIO192_AJ27";
201 ste,config = <&gpio_in_pd>;
202 };
203 };
204 };
205 touch {
206 touch_hrefv60_mode: touch_hrefv60 {
207 /*
208 * Touch screen uses GPIO 143 for RST1, GPIO 146 for RST2 and
209 * GPIO 67 for interrupts. Pull-up the IRQ line and drive both
210 * reset signals low.
211 */
212 hrefv60_cfg1 {
213 ste,pins = "GPIO143_D12", "GPIO146_D13";
214 ste,config = <&gpio_out_lo>;
215 };
216 hrefv60_cfg2 {
217 ste,pins = "GPIO67_G2";
218 ste,config = <&gpio_in_pu>;
219 };
220 };
221 };
222 mcde {
223 lcd_hrefv60_mode: lcd_hrefv60 {
224 /*
225 * Display Interface 1 uses GPIO 65 for RST (reset).
226 * Display Interface 2 uses GPIO 66 for RST (reset).
227 * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
228 */
229 hrefv60_cfg1 {
230 ste,pins ="GPIO65_F1";
231 ste,config = <&gpio_out_hi>;
232 };
233 hrefv60_cfg2 {
234 ste,pins ="GPIO66_G3";
235 ste,config = <&gpio_out_lo>;
236 };
237 };
238 };
68 }; 239 };
69 }; 240 };
70}; 241};
diff --git a/arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi b/arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi
index efddee9403c4..e6f22b266420 100644
--- a/arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi
@@ -31,17 +31,57 @@
31 ste,output = <OUTPUT_LOW>; 31 ste,output = <OUTPUT_LOW>;
32 }; 32 };
33 33
34 gpio_in_pu: gpio_input_pull_up {
35 ste,gpio = <GPIOMODE_ENABLED>;
36 ste,input = <INPUT_PULLUP>;
37 };
38
39 gpio_in_pd: gpio_input_pull_down {
40 ste,gpio = <GPIOMODE_ENABLED>;
41 ste,input = <INPUT_PULLDOWN>;
42 };
43
34 gpio_out_lo: gpio_output_low { 44 gpio_out_lo: gpio_output_low {
35 ste,gpio = <GPIOMODE_ENABLED>; 45 ste,gpio = <GPIOMODE_ENABLED>;
36 ste,output = <OUTPUT_LOW>; 46 ste,output = <OUTPUT_LOW>;
37 }; 47 };
38 48
49 gpio_out_hi: gpio_output_high {
50 ste,gpio = <GPIOMODE_ENABLED>;
51 ste,output = <OUTPUT_HIGH>;
52 };
53
54 slpm_pdis: slpm_pdis {
55 ste,sleep = <SLPM_ENABLED>;
56 ste,sleep-wakeup = <SLPM_WAKEUP_DISABLE>;
57 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
58 };
59
60 slpm_wkup_pdis: slpm_wkup_pdis {
61 ste,sleep = <SLPM_ENABLED>;
62 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
63 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
64 };
65
66 slpm_wkup_pdis_en: slpm_wkup_pdis_en {
67 ste,sleep = <SLPM_ENABLED>;
68 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
69 ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
70 };
71
39 slpm_in_pu: slpm_in_pu { 72 slpm_in_pu: slpm_in_pu {
40 ste,sleep = <SLPM_ENABLED>; 73 ste,sleep = <SLPM_ENABLED>;
41 ste,sleep-input = <SLPM_INPUT_PULLUP>; 74 ste,sleep-input = <SLPM_INPUT_PULLUP>;
42 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>; 75 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
43 }; 76 };
44 77
78 slpm_in_pdis: slpm_in_pdis {
79 ste,sleep = <SLPM_ENABLED>;
80 ste,sleep-input = <SLPM_DIR_INPUT>;
81 ste,sleep-wakeup = <SLPM_WAKEUP_DISABLE>;
82 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
83 };
84
45 slpm_in_wkup_pdis: slpm_in_wkup_pdis { 85 slpm_in_wkup_pdis: slpm_in_wkup_pdis {
46 ste,sleep = <SLPM_ENABLED>; 86 ste,sleep = <SLPM_ENABLED>;
47 ste,sleep-input = <SLPM_DIR_INPUT>; 87 ste,sleep-input = <SLPM_DIR_INPUT>;
@@ -49,6 +89,20 @@
49 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>; 89 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
50 }; 90 };
51 91
92 slpm_in_wkup_pdis_en: slpm_in_wkup_pdis_en {
93 ste,sleep = <SLPM_ENABLED>;
94 ste,sleep-input = <SLPM_DIR_INPUT>;
95 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
96 ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
97 };
98
99 slpm_in_pu_wkup_pdis_en: slpm_in_wkup_pdis_en {
100 ste,sleep = <SLPM_ENABLED>;
101 ste,sleep-input = <SLPM_INPUT_PULLUP>;
102 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
103 ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
104 };
105
52 slpm_out_lo: slpm_out_lo { 106 slpm_out_lo: slpm_out_lo {
53 ste,sleep = <SLPM_ENABLED>; 107 ste,sleep = <SLPM_ENABLED>;
54 ste,sleep-output = <SLPM_OUTPUT_LOW>; 108 ste,sleep-output = <SLPM_OUTPUT_LOW>;
@@ -68,6 +122,20 @@
68 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>; 122 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
69 }; 123 };
70 124
125 slpm_out_lo_pdis: slpm_out_lo_pdis {
126 ste,sleep = <SLPM_ENABLED>;
127 ste,sleep-output = <SLPM_OUTPUT_LOW>;
128 ste,sleep-wakeup = <SLPM_WAKEUP_DISABLE>;
129 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
130 };
131
132 slpm_out_lo_wkup_pdis: slpm_out_lo_wkup_pdis {
133 ste,sleep = <SLPM_ENABLED>;
134 ste,sleep-output = <SLPM_OUTPUT_LOW>;
135 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
136 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
137 };
138
71 slpm_out_wkup_pdis: slpm_out_wkup_pdis { 139 slpm_out_wkup_pdis: slpm_out_wkup_pdis {
72 ste,sleep = <SLPM_ENABLED>; 140 ste,sleep = <SLPM_ENABLED>;
73 ste,sleep-output = <SLPM_DIR_OUTPUT>; 141 ste,sleep-output = <SLPM_DIR_OUTPUT>;
@@ -81,6 +149,18 @@
81 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>; 149 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
82 }; 150 };
83 151
152 in_wkup_pdis_en: in_wkup_pdis_en {
153 ste,sleep-input = <SLPM_DIR_INPUT>;
154 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
155 ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
156 };
157
158 out_lo_wkup_pdis: out_lo_wkup_pdis {
159 ste,sleep-output = <SLPM_OUTPUT_LOW>;
160 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
161 ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
162 };
163
84 out_hi_wkup_pdis: out_hi_wkup_pdis { 164 out_hi_wkup_pdis: out_hi_wkup_pdis {
85 ste,sleep-output = <SLPM_OUTPUT_HIGH>; 165 ste,sleep-output = <SLPM_OUTPUT_HIGH>;
86 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>; 166 ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
diff --git a/arch/arm/boot/dts/ste-nomadik-s8815.dts b/arch/arm/boot/dts/ste-nomadik-s8815.dts
index 16c3888b7b15..f557feb997f4 100644
--- a/arch/arm/boot/dts/ste-nomadik-s8815.dts
+++ b/arch/arm/boot/dts/ste-nomadik-s8815.dts
@@ -67,10 +67,6 @@
67 67
68 /* Custom board node with GPIO pins to active etc */ 68 /* Custom board node with GPIO pins to active etc */
69 usb-s8815 { 69 usb-s8815 {
70 /* The S8815 is using this very GPIO pin for the SMSC91x IRQs */
71 ethernet-gpio {
72 gpios = <&gpio3 8 0x1>;
73 };
74 /* This will bias the MMC/SD card detect line */ 70 /* This will bias the MMC/SD card detect line */
75 mmcsd-gpio { 71 mmcsd-gpio {
76 gpios = <&gpio3 16 0x1>; 72 gpios = <&gpio3 16 0x1>;
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index 79425e3836ce..5acc0449676a 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -769,14 +769,14 @@
769 #size-cells = <1>; 769 #size-cells = <1>;
770 ranges; 770 ranges;
771 771
772 vica: intc@0x10140000 { 772 vica: intc@10140000 {
773 compatible = "arm,versatile-vic"; 773 compatible = "arm,versatile-vic";
774 interrupt-controller; 774 interrupt-controller;
775 #interrupt-cells = <1>; 775 #interrupt-cells = <1>;
776 reg = <0x10140000 0x20>; 776 reg = <0x10140000 0x20>;
777 }; 777 };
778 778
779 vicb: intc@0x10140020 { 779 vicb: intc@10140020 {
780 compatible = "arm,versatile-vic"; 780 compatible = "arm,versatile-vic";
781 interrupt-controller; 781 interrupt-controller;
782 #interrupt-cells = <1>; 782 #interrupt-cells = <1>;
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index f0b39f835914..97d5d21b7db7 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -11,6 +11,7 @@
11 11
12/dts-v1/; 12/dts-v1/;
13#include "ste-dbx5x0.dtsi" 13#include "ste-dbx5x0.dtsi"
14#include "ste-href-family-pinctrl.dtsi"
14 15
15/ { 16/ {
16 model = "Calao Systems Snowball platform with device tree"; 17 model = "Calao Systems Snowball platform with device tree";
@@ -75,6 +76,8 @@
75 76
76 leds { 77 leds {
77 compatible = "gpio-leds"; 78 compatible = "gpio-leds";
79 pinctrl-names = "default";
80 pinctrl-0 = <&gpioled_snowball_mode>;
78 used-led { 81 used-led {
79 label = "user_led"; 82 label = "user_led";
80 gpios = <&gpio4 14 0x4>; 83 gpios = <&gpio4 14 0x4>;
@@ -84,6 +87,11 @@
84 }; 87 };
85 88
86 soc { 89 soc {
90 usb_per5@a03e0000 {
91 pinctrl-names = "default", "sleep";
92 pinctrl-0 = <&musb_default_mode>;
93 pinctrl-1 = <&musb_sleep_mode>;
94 };
87 95
88 sound { 96 sound {
89 compatible = "stericsson,snd-soc-mop500"; 97 compatible = "stericsson,snd-soc-mop500";
@@ -92,7 +100,21 @@
92 stericsson,audio-codec = <&codec>; 100 stericsson,audio-codec = <&codec>;
93 }; 101 };
94 102
103 msp0: msp@80123000 {
104 pinctrl-names = "default";
105 pinctrl-0 = <&msp0_default_mode>;
106 status = "okay";
107 };
108
95 msp1: msp@80124000 { 109 msp1: msp@80124000 {
110 pinctrl-names = "default";
111 pinctrl-0 = <&msp1_default_mode>;
112 status = "okay";
113 };
114
115 msp2: msp@80117000 {
116 pinctrl-names = "default";
117 pinctrl-0 = <&msp2_default_mode>;
96 status = "okay"; 118 status = "okay";
97 }; 119 };
98 120
@@ -110,6 +132,8 @@
110 interrupt-parent = <&gpio4>; 132 interrupt-parent = <&gpio4>;
111 vdd33a-supply = <&en_3v3_reg>; 133 vdd33a-supply = <&en_3v3_reg>;
112 vddvario-supply = <&db8500_vape_reg>; 134 vddvario-supply = <&db8500_vape_reg>;
135 pinctrl-names = "default";
136 pinctrl-0 = <&eth_snowball_mode>;
113 137
114 reg-shift = <1>; 138 reg-shift = <1>;
115 reg-io-width = <2>; 139 reg-io-width = <2>;
@@ -122,10 +146,8 @@
122 }; 146 };
123 147
124 vmmci: regulator-gpio { 148 vmmci: regulator-gpio {
125 gpios = <&gpio6 25 0x4>; 149 gpios = <&gpio7 4 0x4>;
126 enable-gpio = <&gpio7 4 0x4>; 150 enable-gpio = <&gpio6 25 0x4>;
127
128 status = "okay";
129 }; 151 };
130 152
131 // External Micro SD slot 153 // External Micro SD slot
@@ -136,6 +158,9 @@
136 mmc-cap-mmc-highspeed; 158 mmc-cap-mmc-highspeed;
137 vmmc-supply = <&ab8500_ldo_aux3_reg>; 159 vmmc-supply = <&ab8500_ldo_aux3_reg>;
138 vqmmc-supply = <&vmmci>; 160 vqmmc-supply = <&vmmci>;
161 pinctrl-names = "default", "sleep";
162 pinctrl-0 = <&sdi0_default_mode>;
163 pinctrl-1 = <&sdi0_sleep_mode>;
139 164
140 cd-gpios = <&gpio6 26 0x4>; // 218 165 cd-gpios = <&gpio6 26 0x4>; // 218
141 cd-inverted; 166 cd-inverted;
@@ -143,6 +168,27 @@
143 status = "okay"; 168 status = "okay";
144 }; 169 };
145 170
171 // WLAN SDIO channel
172 sdi1_per2@80118000 {
173 arm,primecell-periphid = <0x10480180>;
174 max-frequency = <100000000>;
175 bus-width = <4>;
176 pinctrl-names = "default", "sleep";
177 pinctrl-0 = <&sdi1_default_mode>;
178 pinctrl-1 = <&sdi1_sleep_mode>;
179
180 status = "okay";
181 };
182
183 // Unused PoP eMMC - register and put it to sleep by default */
184 sdi2_per3@80005000 {
185 arm,primecell-periphid = <0x10480180>;
186 pinctrl-names = "default";
187 pinctrl-0 = <&sdi2_sleep_mode>;
188
189 status = "okay";
190 };
191
146 // On-board eMMC 192 // On-board eMMC
147 sdi4_per2@80114000 { 193 sdi4_per2@80114000 {
148 arm,primecell-periphid = <0x10480180>; 194 arm,primecell-periphid = <0x10480180>;
@@ -150,22 +196,63 @@
150 bus-width = <8>; 196 bus-width = <8>;
151 mmc-cap-mmc-highspeed; 197 mmc-cap-mmc-highspeed;
152 vmmc-supply = <&ab8500_ldo_aux2_reg>; 198 vmmc-supply = <&ab8500_ldo_aux2_reg>;
199 pinctrl-names = "default", "sleep";
200 pinctrl-0 = <&sdi4_default_mode>;
201 pinctrl-1 = <&sdi4_sleep_mode>;
153 202
154 status = "okay"; 203 status = "okay";
155 }; 204 };
156 205
157 uart@80120000 { 206 uart@80120000 {
207 pinctrl-names = "default", "sleep";
208 pinctrl-0 = <&uart0_default_mode>;
209 pinctrl-1 = <&uart0_sleep_mode>;
158 status = "okay"; 210 status = "okay";
159 }; 211 };
160 212
161 uart@80121000 { 213 uart@80121000 {
214 pinctrl-names = "default", "sleep";
215 pinctrl-0 = <&uart1_default_mode>;
216 pinctrl-1 = <&uart1_sleep_mode>;
162 status = "okay"; 217 status = "okay";
163 }; 218 };
164 219
165 uart@80007000 { 220 uart@80007000 {
221 pinctrl-names = "default", "sleep";
222 pinctrl-0 = <&uart2_default_mode>;
223 pinctrl-1 = <&uart2_sleep_mode>;
166 status = "okay"; 224 status = "okay";
167 }; 225 };
168 226
227 i2c@80004000 {
228 pinctrl-names = "default","sleep";
229 pinctrl-0 = <&i2c0_default_mode>;
230 pinctrl-1 = <&i2c0_sleep_mode>;
231 };
232
233 i2c@80122000 {
234 pinctrl-names = "default","sleep";
235 pinctrl-0 = <&i2c1_default_mode>;
236 pinctrl-1 = <&i2c1_sleep_mode>;
237 };
238
239 i2c@80128000 {
240 pinctrl-names = "default","sleep";
241 pinctrl-0 = <&i2c2_default_mode>;
242 pinctrl-1 = <&i2c2_sleep_mode>;
243 };
244
245 i2c@80110000 {
246 pinctrl-names = "default","sleep";
247 pinctrl-0 = <&i2c3_default_mode>;
248 pinctrl-1 = <&i2c3_sleep_mode>;
249 };
250
251 ssp@80002000 {
252 pinctrl-names = "default";
253 pinctrl-0 = <&ssp0_snowball_mode>;
254 };
255
169 cpufreq-cooling { 256 cpufreq-cooling {
170 status = "okay"; 257 status = "okay";
171 }; 258 };
@@ -266,5 +353,141 @@
266 }; 353 };
267 }; 354 };
268 }; 355 };
356
357 pinctrl {
358 /*
359 * Set this up using hogs, as time goes by and as seems fit, these
360 * can be moved over to being controlled by respective device.
361 */
362 pinctrl-names = "default";
363 pinctrl-0 = <&accel_snowball_mode>,
364 <&magneto_snowball_mode>,
365 <&gbf_snowball_mode>,
366 <&wlan_snowball_mode>;
367
368 ethernet {
369 /*
370 * Mux in "SM" which is used for the
371 * SMSC911x Ethernet adapter
372 */
373 eth_snowball_mode: eth_snowball {
374 snowball_mux {
375 ste,function = "sm";
376 ste,pins = "sm_b_1";
377 };
378 /* LAN IRQ pin */
379 snowball_cfg1 {
380 ste,pins = "GPIO140_B11";
381 ste,config = <&in_nopull>;
382 };
383 /* LAN reset pin */
384 snowball_cfg2 {
385 ste,pins = "GPIO141_C12";
386 ste,config = <&gpio_out_hi>;
387 };
388
389 };
390 };
391 sdi0 {
392 sdi0_default_mode: sdi0_default {
393 snowball_mux {
394 ste,function = "mc0";
395 ste,pins = "mc0dat31dir_a_1";
396 };
397 snowball_cfg1 {
398 ste,pins = "GPIO21_AB3"; /* DAT31DIR */
399 ste,config = <&out_hi>;
400 };
401
402 };
403 };
404 ssp0 {
405 ssp0_snowball_mode: ssp0_snowball_default {
406 snowball_mux {
407 ste,function = "ssp0";
408 ste,pins = "ssp0_a_1";
409 };
410 snowball_cfg1 {
411 ste,pins = "GPIO144_B13"; /* FRM */
412 ste,config = <&gpio_out_hi>;
413 };
414 snowball_cfg2 {
415 ste,pins = "GPIO145_C13"; /* RXD */
416 ste,config = <&in_pd>;
417 };
418 snowball_cfg3 {
419 ste,pins =
420 "GPIO146_D13", /* TXD */
421 "GPIO143_D12"; /* CLK */
422 ste,config = <&out_lo>;
423 };
424
425 };
426 };
427 gpio_led {
428 gpioled_snowball_mode: gpioled_default {
429 snowball_cfg1 {
430 ste,pins = "GPIO142_C11";
431 ste,config = <&gpio_out_hi>;
432 };
433
434 };
435 };
436 accelerometer {
437 accel_snowball_mode: accel_snowball {
438 /* Accelerometer lines */
439 snowball_cfg1 {
440 ste,pins =
441 "GPIO163_C20", /* ACCEL_IRQ1 */
442 "GPIO164_B21"; /* ACCEL_IRQ2 */
443 ste,config = <&gpio_in_pu>;
444 };
445 };
446 };
447 magnetometer {
448 magneto_snowball_mode: magneto_snowball {
449 snowball_cfg1 {
450 ste,pins = "GPIO165_C21"; /* MAG_DRDY */
451 ste,config = <&gpio_in_pu>;
452 };
453 };
454 };
455 gbf {
456 gbf_snowball_mode: gbf_snowball {
457 /*
458 * GBF (GPS, Bluetooth, FM-radio) interface,
459 * pull low to reset state
460 */
461 snowball_cfg1 {
462 ste,pins = "GPIO171_D23"; /* GBF_ENA_RESET */
463 ste,config = <&gpio_out_lo>;
464 };
465 };
466 };
467 wlan {
468 wlan_snowball_mode: wlan_snowball {
469 /*
470 * Activate this mode with the WLAN chip.
471 * These are plain GPIO pins used by WLAN
472 */
473 snowball_cfg1 {
474 ste,pins =
475 "GPIO161_D21", /* WLAN_PMU_EN */
476 "GPIO215_AH13"; /* WLAN_ENA */
477 ste,config = <&gpio_out_lo>;
478 };
479 snowball_cfg2 {
480 ste,pins = "GPIO216_AG12"; /* WLAN_IRQ */
481 ste,config = <&gpio_in_pu>;
482 };
483 };
484 };
485 };
486
487 mcde@a0350000 {
488 pinctrl-names = "default", "sleep";
489 pinctrl-0 = <&lcd_default_mode>;
490 pinctrl-1 = <&lcd_sleep_mode>;
491 };
269 }; 492 };
270}; 493};
diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts
index 8a1032c1ffc9..a9da4800daf0 100644
--- a/arch/arm/boot/dts/ste-u300.dts
+++ b/arch/arm/boot/dts/ste-u300.dts
@@ -307,7 +307,7 @@
307 clocks = <&i2c0_clk>; 307 clocks = <&i2c0_clk>;
308 #address-cells = <1>; 308 #address-cells = <1>;
309 #size-cells = <0>; 309 #size-cells = <0>;
310 ab3100: ab3100@0x48 { 310 ab3100: ab3100@48 {
311 compatible = "stericsson,ab3100"; 311 compatible = "stericsson,ab3100";
312 reg = <0x48>; 312 reg = <0x48>;
313 interrupt-parent = <&vica>; 313 interrupt-parent = <&vica>;
@@ -385,10 +385,10 @@
385 clocks = <&i2c1_clk>; 385 clocks = <&i2c1_clk>;
386 #address-cells = <1>; 386 #address-cells = <1>;
387 #size-cells = <0>; 387 #size-cells = <0>;
388 fwcam0: fwcam@0x10 { 388 fwcam0: fwcam@10 {
389 reg = <0x10>; 389 reg = <0x10>;
390 }; 390 };
391 fwcam1: fwcam@0x5d { 391 fwcam1: fwcam@5d {
392 reg = <0x5d>; 392 reg = <0x5d>;
393 }; 393 };
394 }; 394 };
diff --git a/arch/arm/boot/dts/stih415-pinctrl.dtsi b/arch/arm/boot/dts/stih415-pinctrl.dtsi
index 1d322b24d1e4..e56449d41481 100644
--- a/arch/arm/boot/dts/stih415-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih415-pinctrl.dtsi
@@ -86,6 +86,24 @@
86 }; 86 };
87 }; 87 };
88 }; 88 };
89
90 sbc_i2c0 {
91 pinctrl_sbc_i2c0_default: sbc_i2c0-default {
92 st,pins {
93 sda = <&PIO4 6 ALT1 BIDIR>;
94 scl = <&PIO4 5 ALT1 BIDIR>;
95 };
96 };
97 };
98
99 sbc_i2c1 {
100 pinctrl_sbc_i2c1_default: sbc_i2c1-default {
101 st,pins {
102 sda = <&PIO3 2 ALT2 BIDIR>;
103 scl = <&PIO3 1 ALT2 BIDIR>;
104 };
105 };
106 };
89 }; 107 };
90 108
91 pin-controller-front { 109 pin-controller-front {
@@ -143,6 +161,24 @@
143 reg = <0x7000 0x100>; 161 reg = <0x7000 0x100>;
144 st,bank-name = "PIO12"; 162 st,bank-name = "PIO12";
145 }; 163 };
164
165 i2c0 {
166 pinctrl_i2c0_default: i2c0-default {
167 st,pins {
168 sda = <&PIO9 3 ALT1 BIDIR>;
169 scl = <&PIO9 2 ALT1 BIDIR>;
170 };
171 };
172 };
173
174 i2c1 {
175 pinctrl_i2c1_default: i2c1-default {
176 st,pins {
177 sda = <&PIO12 1 ALT1 BIDIR>;
178 scl = <&PIO12 0 ALT1 BIDIR>;
179 };
180 };
181 };
146 }; 182 };
147 183
148 pin-controller-rear { 184 pin-controller-rear {
diff --git a/arch/arm/boot/dts/stih415.dtsi b/arch/arm/boot/dts/stih415.dtsi
index 74ab8ded4b49..d9c7dd1d95a4 100644
--- a/arch/arm/boot/dts/stih415.dtsi
+++ b/arch/arm/boot/dts/stih415.dtsi
@@ -9,6 +9,7 @@
9#include "stih41x.dtsi" 9#include "stih41x.dtsi"
10#include "stih415-clock.dtsi" 10#include "stih415-clock.dtsi"
11#include "stih415-pinctrl.dtsi" 11#include "stih415-pinctrl.dtsi"
12#include <dt-bindings/interrupt-controller/arm-gic.h>
12/ { 13/ {
13 14
14 L2: cache-controller { 15 L2: cache-controller {
@@ -83,5 +84,57 @@
83 pinctrl-names = "default"; 84 pinctrl-names = "default";
84 pinctrl-0 = <&pinctrl_sbc_serial1>; 85 pinctrl-0 = <&pinctrl_sbc_serial1>;
85 }; 86 };
87
88 i2c@fed40000 {
89 compatible = "st,comms-ssc4-i2c";
90 reg = <0xfed40000 0x110>;
91 interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
92 clocks = <&CLKS_ICN_REG_0>;
93 clock-names = "ssc";
94 clock-frequency = <400000>;
95 pinctrl-names = "default";
96 pinctrl-0 = <&pinctrl_i2c0_default>;
97
98 status = "disabled";
99 };
100
101 i2c@fed41000 {
102 compatible = "st,comms-ssc4-i2c";
103 reg = <0xfed41000 0x110>;
104 interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
105 clocks = <&CLKS_ICN_REG_0>;
106 clock-names = "ssc";
107 clock-frequency = <400000>;
108 pinctrl-names = "default";
109 pinctrl-0 = <&pinctrl_i2c1_default>;
110
111 status = "disabled";
112 };
113
114 i2c@fe540000 {
115 compatible = "st,comms-ssc4-i2c";
116 reg = <0xfe540000 0x110>;
117 interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
118 clocks = <&CLK_SYSIN>;
119 clock-names = "ssc";
120 clock-frequency = <400000>;
121 pinctrl-names = "default";
122 pinctrl-0 = <&pinctrl_sbc_i2c0_default>;
123
124 status = "disabled";
125 };
126
127 i2c@fe541000 {
128 compatible = "st,comms-ssc4-i2c";
129 reg = <0xfe541000 0x110>;
130 interrupts = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>;
131 clocks = <&CLK_SYSIN>;
132 clock-names = "ssc";
133 clock-frequency = <400000>;
134 pinctrl-names = "default";
135 pinctrl-0 = <&pinctrl_sbc_i2c1_default>;
136
137 status = "disabled";
138 };
86 }; 139 };
87}; 140};
diff --git a/arch/arm/boot/dts/stih416-pinctrl.dtsi b/arch/arm/boot/dts/stih416-pinctrl.dtsi
index 0f246c979262..b29ff4ba542c 100644
--- a/arch/arm/boot/dts/stih416-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih416-pinctrl.dtsi
@@ -97,6 +97,24 @@
97 }; 97 };
98 }; 98 };
99 }; 99 };
100
101 sbc_i2c0 {
102 pinctrl_sbc_i2c0_default: sbc_i2c0-default {
103 st,pins {
104 sda = <&PIO4 6 ALT1 BIDIR>;
105 scl = <&PIO4 5 ALT1 BIDIR>;
106 };
107 };
108 };
109
110 sbc_i2c1 {
111 pinctrl_sbc_i2c1_default: sbc_i2c1-default {
112 st,pins {
113 sda = <&PIO3 2 ALT2 BIDIR>;
114 scl = <&PIO3 1 ALT2 BIDIR>;
115 };
116 };
117 };
100 }; 118 };
101 119
102 pin-controller-front { 120 pin-controller-front {
@@ -175,6 +193,23 @@
175 }; 193 };
176 }; 194 };
177 195
196 i2c0 {
197 pinctrl_i2c0_default: i2c0-default {
198 st,pins {
199 sda = <&PIO9 3 ALT1 BIDIR>;
200 scl = <&PIO9 2 ALT1 BIDIR>;
201 };
202 };
203 };
204
205 i2c1 {
206 pinctrl_i2c1_default: i2c1-default {
207 st,pins {
208 sda = <&PIO12 1 ALT1 BIDIR>;
209 scl = <&PIO12 0 ALT1 BIDIR>;
210 };
211 };
212 };
178 }; 213 };
179 214
180 pin-controller-rear { 215 pin-controller-rear {
diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi
index 1a0326ea7d07..b7ab47b95816 100644
--- a/arch/arm/boot/dts/stih416.dtsi
+++ b/arch/arm/boot/dts/stih416.dtsi
@@ -9,6 +9,7 @@
9#include "stih41x.dtsi" 9#include "stih41x.dtsi"
10#include "stih416-clock.dtsi" 10#include "stih416-clock.dtsi"
11#include "stih416-pinctrl.dtsi" 11#include "stih416-pinctrl.dtsi"
12#include <dt-bindings/interrupt-controller/arm-gic.h>
12/ { 13/ {
13 L2: cache-controller { 14 L2: cache-controller {
14 compatible = "arm,pl310-cache"; 15 compatible = "arm,pl310-cache";
@@ -92,5 +93,57 @@
92 pinctrl-0 = <&pinctrl_sbc_serial1>; 93 pinctrl-0 = <&pinctrl_sbc_serial1>;
93 clocks = <&CLK_SYSIN>; 94 clocks = <&CLK_SYSIN>;
94 }; 95 };
96
97 i2c@fed40000 {
98 compatible = "st,comms-ssc4-i2c";
99 reg = <0xfed40000 0x110>;
100 interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
101 clocks = <&CLK_S_ICN_REG_0>;
102 clock-names = "ssc";
103 clock-frequency = <400000>;
104 pinctrl-names = "default";
105 pinctrl-0 = <&pinctrl_i2c0_default>;
106
107 status = "disabled";
108 };
109
110 i2c@fed41000 {
111 compatible = "st,comms-ssc4-i2c";
112 reg = <0xfed41000 0x110>;
113 interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
114 clocks = <&CLK_S_ICN_REG_0>;
115 clock-names = "ssc";
116 clock-frequency = <400000>;
117 pinctrl-names = "default";
118 pinctrl-0 = <&pinctrl_i2c1_default>;
119
120 status = "disabled";
121 };
122
123 i2c@fe540000 {
124 compatible = "st,comms-ssc4-i2c";
125 reg = <0xfe540000 0x110>;
126 interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
127 clocks = <&CLK_SYSIN>;
128 clock-names = "ssc";
129 clock-frequency = <400000>;
130 pinctrl-names = "default";
131 pinctrl-0 = <&pinctrl_sbc_i2c0_default>;
132
133 status = "disabled";
134 };
135
136 i2c@fe541000 {
137 compatible = "st,comms-ssc4-i2c";
138 reg = <0xfe541000 0x110>;
139 interrupts = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>;
140 clocks = <&CLK_SYSIN>;
141 clock-names = "ssc";
142 clock-frequency = <400000>;
143 pinctrl-names = "default";
144 pinctrl-0 = <&pinctrl_sbc_i2c1_default>;
145
146 status = "disabled";
147 };
95 }; 148 };
96}; 149};
diff --git a/arch/arm/boot/dts/stih41x-b2000.dtsi b/arch/arm/boot/dts/stih41x-b2000.dtsi
index 8e694d2b8f5b..1e6aa92772f5 100644
--- a/arch/arm/boot/dts/stih41x-b2000.dtsi
+++ b/arch/arm/boot/dts/stih41x-b2000.dtsi
@@ -37,5 +37,14 @@
37 }; 37 };
38 }; 38 };
39 39
40 /* HDMI Tx I2C */
41 i2c@fed41000 {
42 /* HDMI V1.3a supports Standard mode only */
43 clock-frequency = <100000>;
44 i2c-min-scl-pulse-width-us = <0>;
45 i2c-min-sda-pulse-width-us = <5>;
46
47 status = "okay";
48 };
40 }; 49 };
41}; 50};
diff --git a/arch/arm/boot/dts/stih41x-b2020.dtsi b/arch/arm/boot/dts/stih41x-b2020.dtsi
index 133e18143b1b..0ef0a69df8ea 100644
--- a/arch/arm/boot/dts/stih41x-b2020.dtsi
+++ b/arch/arm/boot/dts/stih41x-b2020.dtsi
@@ -38,5 +38,27 @@
38 default-state = "off"; 38 default-state = "off";
39 }; 39 };
40 }; 40 };
41
42 i2c@fed40000 {
43 status = "okay";
44 };
45
46 /* HDMI Tx I2C */
47 i2c@fed41000 {
48 /* HDMI V1.3a supports Standard mode only */
49 clock-frequency = <100000>;
50 i2c-min-scl-pulse-width-us = <0>;
51 i2c-min-sda-pulse-width-us = <5>;
52
53 status = "okay";
54 };
55
56 i2c@fe540000 {
57 status = "okay";
58 };
59
60 i2c@fe541000 {
61 status = "okay";
62 };
41 }; 63 };
42}; 64};
diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index eb4d73b6a090..d4b081d6a167 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -18,10 +18,6 @@
18 model = "Mele A1000"; 18 model = "Mele A1000";
19 compatible = "mele,a1000", "allwinner,sun4i-a10"; 19 compatible = "mele,a1000", "allwinner,sun4i-a10";
20 20
21 aliases {
22 serial0 = &uart0;
23 };
24
25 soc@01c00000 { 21 soc@01c00000 {
26 emac: ethernet@01c0b000 { 22 emac: ethernet@01c0b000 {
27 pinctrl-names = "default"; 23 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 425a7db898c5..b139ee6bcf99 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -17,15 +17,6 @@
17 model = "Cubietech Cubieboard"; 17 model = "Cubietech Cubieboard";
18 compatible = "cubietech,a10-cubieboard", "allwinner,sun4i-a10"; 18 compatible = "cubietech,a10-cubieboard", "allwinner,sun4i-a10";
19 19
20 aliases {
21 serial0 = &uart0;
22 serial1 = &uart1;
23 };
24
25 chosen {
26 bootargs = "earlyprintk console=ttyS0,115200";
27 };
28
29 soc@01c00000 { 20 soc@01c00000 {
30 emac: ethernet@01c0b000 { 21 emac: ethernet@01c0b000 {
31 pinctrl-names = "default"; 22 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index b3ae51fa9372..3a1595f67823 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -18,10 +18,6 @@
18 model = "Miniand Hackberry"; 18 model = "Miniand Hackberry";
19 compatible = "miniand,hackberry", "allwinner,sun4i-a10"; 19 compatible = "miniand,hackberry", "allwinner,sun4i-a10";
20 20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
25 soc@01c00000 { 21 soc@01c00000 {
26 emac: ethernet@01c0b000 { 22 emac: ethernet@01c0b000 {
27 pinctrl-names = "default"; 23 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
index 0c1447c68059..70b3323caf1a 100644
--- a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -18,10 +18,6 @@
18 model = "PineRiver Mini X-Plus"; 18 model = "PineRiver Mini X-Plus";
19 compatible = "pineriver,mini-xplus", "allwinner,sun4i-a10"; 19 compatible = "pineriver,mini-xplus", "allwinner,sun4i-a10";
20 20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
25 soc@01c00000 { 21 soc@01c00000 {
26 uart0: serial@01c28000 { 22 uart0: serial@01c28000 {
27 pinctrl-names = "default"; 23 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 319cc6b509da..040bb0eba152 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -15,6 +15,12 @@
15/ { 15/ {
16 interrupt-parent = <&intc>; 16 interrupt-parent = <&intc>;
17 17
18 aliases {
19 ethernet0 = &emac;
20 serial0 = &uart0;
21 serial1 = &uart1;
22 };
23
18 cpus { 24 cpus {
19 #address-cells = <1>; 25 #address-cells = <1>;
20 #size-cells = <0>; 26 #size-cells = <0>;
@@ -66,6 +72,29 @@
66 clocks = <&osc24M>; 72 clocks = <&osc24M>;
67 }; 73 };
68 74
75 pll4: pll4@01c20018 {
76 #clock-cells = <0>;
77 compatible = "allwinner,sun4i-pll1-clk";
78 reg = <0x01c20018 0x4>;
79 clocks = <&osc24M>;
80 };
81
82 pll5: pll5@01c20020 {
83 #clock-cells = <1>;
84 compatible = "allwinner,sun4i-pll5-clk";
85 reg = <0x01c20020 0x4>;
86 clocks = <&osc24M>;
87 clock-output-names = "pll5_ddr", "pll5_other";
88 };
89
90 pll6: pll6@01c20028 {
91 #clock-cells = <1>;
92 compatible = "allwinner,sun4i-pll6-clk";
93 reg = <0x01c20028 0x4>;
94 clocks = <&osc24M>;
95 clock-output-names = "pll6_sata", "pll6_other", "pll6";
96 };
97
69 /* dummy is 200M */ 98 /* dummy is 200M */
70 cpu: cpu@01c20054 { 99 cpu: cpu@01c20054 {
71 #clock-cells = <0>; 100 #clock-cells = <0>;
@@ -131,12 +160,11 @@
131 "apb0_ir1", "apb0_keypad"; 160 "apb0_ir1", "apb0_keypad";
132 }; 161 };
133 162
134 /* dummy is pll62 */
135 apb1_mux: apb1_mux@01c20058 { 163 apb1_mux: apb1_mux@01c20058 {
136 #clock-cells = <0>; 164 #clock-cells = <0>;
137 compatible = "allwinner,sun4i-apb1-mux-clk"; 165 compatible = "allwinner,sun4i-apb1-mux-clk";
138 reg = <0x01c20058 0x4>; 166 reg = <0x01c20058 0x4>;
139 clocks = <&osc24M>, <&dummy>, <&osc32k>; 167 clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
140 }; 168 };
141 169
142 apb1: apb1@01c20058 { 170 apb1: apb1@01c20058 {
@@ -158,6 +186,126 @@
158 "apb1_uart4", "apb1_uart5", "apb1_uart6", 186 "apb1_uart4", "apb1_uart5", "apb1_uart6",
159 "apb1_uart7"; 187 "apb1_uart7";
160 }; 188 };
189
190 nand_clk: clk@01c20080 {
191 #clock-cells = <0>;
192 compatible = "allwinner,sun4i-mod0-clk";
193 reg = <0x01c20080 0x4>;
194 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
195 clock-output-names = "nand";
196 };
197
198 ms_clk: clk@01c20084 {
199 #clock-cells = <0>;
200 compatible = "allwinner,sun4i-mod0-clk";
201 reg = <0x01c20084 0x4>;
202 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
203 clock-output-names = "ms";
204 };
205
206 mmc0_clk: clk@01c20088 {
207 #clock-cells = <0>;
208 compatible = "allwinner,sun4i-mod0-clk";
209 reg = <0x01c20088 0x4>;
210 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
211 clock-output-names = "mmc0";
212 };
213
214 mmc1_clk: clk@01c2008c {
215 #clock-cells = <0>;
216 compatible = "allwinner,sun4i-mod0-clk";
217 reg = <0x01c2008c 0x4>;
218 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
219 clock-output-names = "mmc1";
220 };
221
222 mmc2_clk: clk@01c20090 {
223 #clock-cells = <0>;
224 compatible = "allwinner,sun4i-mod0-clk";
225 reg = <0x01c20090 0x4>;
226 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
227 clock-output-names = "mmc2";
228 };
229
230 mmc3_clk: clk@01c20094 {
231 #clock-cells = <0>;
232 compatible = "allwinner,sun4i-mod0-clk";
233 reg = <0x01c20094 0x4>;
234 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
235 clock-output-names = "mmc3";
236 };
237
238 ts_clk: clk@01c20098 {
239 #clock-cells = <0>;
240 compatible = "allwinner,sun4i-mod0-clk";
241 reg = <0x01c20098 0x4>;
242 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
243 clock-output-names = "ts";
244 };
245
246 ss_clk: clk@01c2009c {
247 #clock-cells = <0>;
248 compatible = "allwinner,sun4i-mod0-clk";
249 reg = <0x01c2009c 0x4>;
250 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
251 clock-output-names = "ss";
252 };
253
254 spi0_clk: clk@01c200a0 {
255 #clock-cells = <0>;
256 compatible = "allwinner,sun4i-mod0-clk";
257 reg = <0x01c200a0 0x4>;
258 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
259 clock-output-names = "spi0";
260 };
261
262 spi1_clk: clk@01c200a4 {
263 #clock-cells = <0>;
264 compatible = "allwinner,sun4i-mod0-clk";
265 reg = <0x01c200a4 0x4>;
266 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
267 clock-output-names = "spi1";
268 };
269
270 spi2_clk: clk@01c200a8 {
271 #clock-cells = <0>;
272 compatible = "allwinner,sun4i-mod0-clk";
273 reg = <0x01c200a8 0x4>;
274 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
275 clock-output-names = "spi2";
276 };
277
278 pata_clk: clk@01c200ac {
279 #clock-cells = <0>;
280 compatible = "allwinner,sun4i-mod0-clk";
281 reg = <0x01c200ac 0x4>;
282 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
283 clock-output-names = "pata";
284 };
285
286 ir0_clk: clk@01c200b0 {
287 #clock-cells = <0>;
288 compatible = "allwinner,sun4i-mod0-clk";
289 reg = <0x01c200b0 0x4>;
290 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
291 clock-output-names = "ir0";
292 };
293
294 ir1_clk: clk@01c200b4 {
295 #clock-cells = <0>;
296 compatible = "allwinner,sun4i-mod0-clk";
297 reg = <0x01c200b4 0x4>;
298 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
299 clock-output-names = "ir1";
300 };
301
302 spi3_clk: clk@01c200d4 {
303 #clock-cells = <0>;
304 compatible = "allwinner,sun4i-mod0-clk";
305 reg = <0x01c200d4 0x4>;
306 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
307 clock-output-names = "spi3";
308 };
161 }; 309 };
162 310
163 soc@01c00000 { 311 soc@01c00000 {
@@ -266,11 +414,23 @@
266 reg = <0x01c20c90 0x10>; 414 reg = <0x01c20c90 0x10>;
267 }; 415 };
268 416
417 rtc: rtc@01c20d00 {
418 compatible = "allwinner,sun4i-rtc";
419 reg = <0x01c20d00 0x20>;
420 interrupts = <24>;
421 };
422
269 sid: eeprom@01c23800 { 423 sid: eeprom@01c23800 {
270 compatible = "allwinner,sun4i-sid"; 424 compatible = "allwinner,sun4i-sid";
271 reg = <0x01c23800 0x10>; 425 reg = <0x01c23800 0x10>;
272 }; 426 };
273 427
428 rtp: rtp@01c25000 {
429 compatible = "allwinner,sun4i-ts";
430 reg = <0x01c25000 0x100>;
431 interrupts = <29>;
432 };
433
274 uart0: serial@01c28000 { 434 uart0: serial@01c28000 {
275 compatible = "snps,dw-apb-uart"; 435 compatible = "snps,dw-apb-uart";
276 reg = <0x01c28000 0x400>; 436 reg = <0x01c28000 0x400>;
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index e674c94c7206..ea16054857a4 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -16,6 +16,10 @@
16/ { 16/ {
17 interrupt-parent = <&intc>; 17 interrupt-parent = <&intc>;
18 18
19 aliases {
20 ethernet0 = &emac;
21 };
22
19 cpus { 23 cpus {
20 cpu@0 { 24 cpu@0 {
21 compatible = "arm,cortex-a8"; 25 compatible = "arm,cortex-a8";
@@ -63,6 +67,29 @@
63 clocks = <&osc24M>; 67 clocks = <&osc24M>;
64 }; 68 };
65 69
70 pll4: pll4@01c20018 {
71 #clock-cells = <0>;
72 compatible = "allwinner,sun4i-pll1-clk";
73 reg = <0x01c20018 0x4>;
74 clocks = <&osc24M>;
75 };
76
77 pll5: pll5@01c20020 {
78 #clock-cells = <1>;
79 compatible = "allwinner,sun4i-pll5-clk";
80 reg = <0x01c20020 0x4>;
81 clocks = <&osc24M>;
82 clock-output-names = "pll5_ddr", "pll5_other";
83 };
84
85 pll6: pll6@01c20028 {
86 #clock-cells = <1>;
87 compatible = "allwinner,sun4i-pll6-clk";
88 reg = <0x01c20028 0x4>;
89 clocks = <&osc24M>;
90 clock-output-names = "pll6_sata", "pll6_other", "pll6";
91 };
92
66 /* dummy is 200M */ 93 /* dummy is 200M */
67 cpu: cpu@01c20054 { 94 cpu: cpu@01c20054 {
68 #clock-cells = <0>; 95 #clock-cells = <0>;
@@ -123,12 +150,11 @@
123 "apb0_ir", "apb0_keypad"; 150 "apb0_ir", "apb0_keypad";
124 }; 151 };
125 152
126 /* dummy is pll62 */
127 apb1_mux: apb1_mux@01c20058 { 153 apb1_mux: apb1_mux@01c20058 {
128 #clock-cells = <0>; 154 #clock-cells = <0>;
129 compatible = "allwinner,sun4i-apb1-mux-clk"; 155 compatible = "allwinner,sun4i-apb1-mux-clk";
130 reg = <0x01c20058 0x4>; 156 reg = <0x01c20058 0x4>;
131 clocks = <&osc24M>, <&dummy>, <&osc32k>; 157 clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
132 }; 158 };
133 159
134 apb1: apb1@01c20058 { 160 apb1: apb1@01c20058 {
@@ -147,6 +173,102 @@
147 "apb1_i2c2", "apb1_uart0", "apb1_uart1", 173 "apb1_i2c2", "apb1_uart0", "apb1_uart1",
148 "apb1_uart2", "apb1_uart3"; 174 "apb1_uart2", "apb1_uart3";
149 }; 175 };
176
177 nand_clk: clk@01c20080 {
178 #clock-cells = <0>;
179 compatible = "allwinner,sun4i-mod0-clk";
180 reg = <0x01c20080 0x4>;
181 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
182 clock-output-names = "nand";
183 };
184
185 ms_clk: clk@01c20084 {
186 #clock-cells = <0>;
187 compatible = "allwinner,sun4i-mod0-clk";
188 reg = <0x01c20084 0x4>;
189 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
190 clock-output-names = "ms";
191 };
192
193 mmc0_clk: clk@01c20088 {
194 #clock-cells = <0>;
195 compatible = "allwinner,sun4i-mod0-clk";
196 reg = <0x01c20088 0x4>;
197 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
198 clock-output-names = "mmc0";
199 };
200
201 mmc1_clk: clk@01c2008c {
202 #clock-cells = <0>;
203 compatible = "allwinner,sun4i-mod0-clk";
204 reg = <0x01c2008c 0x4>;
205 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
206 clock-output-names = "mmc1";
207 };
208
209 mmc2_clk: clk@01c20090 {
210 #clock-cells = <0>;
211 compatible = "allwinner,sun4i-mod0-clk";
212 reg = <0x01c20090 0x4>;
213 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
214 clock-output-names = "mmc2";
215 };
216
217 ts_clk: clk@01c20098 {
218 #clock-cells = <0>;
219 compatible = "allwinner,sun4i-mod0-clk";
220 reg = <0x01c20098 0x4>;
221 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
222 clock-output-names = "ts";
223 };
224
225 ss_clk: clk@01c2009c {
226 #clock-cells = <0>;
227 compatible = "allwinner,sun4i-mod0-clk";
228 reg = <0x01c2009c 0x4>;
229 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
230 clock-output-names = "ss";
231 };
232
233 spi0_clk: clk@01c200a0 {
234 #clock-cells = <0>;
235 compatible = "allwinner,sun4i-mod0-clk";
236 reg = <0x01c200a0 0x4>;
237 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
238 clock-output-names = "spi0";
239 };
240
241 spi1_clk: clk@01c200a4 {
242 #clock-cells = <0>;
243 compatible = "allwinner,sun4i-mod0-clk";
244 reg = <0x01c200a4 0x4>;
245 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
246 clock-output-names = "spi1";
247 };
248
249 spi2_clk: clk@01c200a8 {
250 #clock-cells = <0>;
251 compatible = "allwinner,sun4i-mod0-clk";
252 reg = <0x01c200a8 0x4>;
253 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
254 clock-output-names = "spi2";
255 };
256
257 ir0_clk: clk@01c200b0 {
258 #clock-cells = <0>;
259 compatible = "allwinner,sun4i-mod0-clk";
260 reg = <0x01c200b0 0x4>;
261 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
262 clock-output-names = "ir0";
263 };
264
265 mbus_clk: clk@01c2015c {
266 #clock-cells = <0>;
267 compatible = "allwinner,sun4i-mod0-clk";
268 reg = <0x01c2015c 0x4>;
269 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
270 clock-output-names = "mbus";
271 };
150 }; 272 };
151 273
152 soc@01c00000 { 274 soc@01c00000 {
@@ -260,6 +382,12 @@
260 reg = <0x01c23800 0x10>; 382 reg = <0x01c23800 0x10>;
261 }; 383 };
262 384
385 rtp: rtp@01c25000 {
386 compatible = "allwinner,sun4i-ts";
387 reg = <0x01c25000 0x100>;
388 interrupts = <29>;
389 };
390
263 uart0: serial@01c28000 { 391 uart0: serial@01c28000 {
264 compatible = "snps,dw-apb-uart"; 392 compatible = "snps,dw-apb-uart";
265 reg = <0x01c28000 0x400>; 393 reg = <0x01c28000 0x400>;
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts
new file mode 100644
index 000000000000..fe2ce0acdb06
--- /dev/null
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts
@@ -0,0 +1,68 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 * Copyright 2013 Hans de Goede <hdegoede@redhat.com>
4 *
5 * Maxime Ripard <maxime.ripard@free-electrons.com>
6 *
7 * The code contained herein is licensed under the GNU General Public
8 * License. You may obtain a copy of the GNU General Public License
9 * Version 2 or later at the following locations:
10 *
11 * http://www.opensource.org/licenses/gpl-license.html
12 * http://www.gnu.org/copyleft/gpl.html
13 */
14
15/dts-v1/;
16/include/ "sun5i-a13.dtsi"
17
18/ {
19 model = "Olimex A13-Olinuxino Micro";
20 compatible = "olimex,a13-olinuxino-micro", "allwinner,sun5i-a13";
21
22 soc@01c00000 {
23 pinctrl@01c20800 {
24 led_pins_olinuxinom: led_pins@0 {
25 allwinner,pins = "PG9";
26 allwinner,function = "gpio_out";
27 allwinner,drive = <1>;
28 allwinner,pull = <0>;
29 };
30 };
31
32 uart1: serial@01c28400 {
33 pinctrl-names = "default";
34 pinctrl-0 = <&uart1_pins_b>;
35 status = "okay";
36 };
37
38 i2c0: i2c@01c2ac00 {
39 pinctrl-names = "default";
40 pinctrl-0 = <&i2c0_pins_a>;
41 status = "okay";
42 };
43
44 i2c1: i2c@01c2b000 {
45 pinctrl-names = "default";
46 pinctrl-0 = <&i2c1_pins_a>;
47 status = "okay";
48 };
49
50 i2c2: i2c@01c2b400 {
51 pinctrl-names = "default";
52 pinctrl-0 = <&i2c2_pins_a>;
53 status = "okay";
54 };
55 };
56
57 leds {
58 compatible = "gpio-leds";
59 pinctrl-names = "default";
60 pinctrl-0 = <&led_pins_olinuxinom>;
61
62 power {
63 label = "a13-olinuxino-micro:green:power";
64 gpios = <&pio 6 9 0>;
65 default-state = "on";
66 };
67 };
68};
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index 9e508dcc4245..a4ba5ff010cf 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -18,10 +18,6 @@
18 model = "Olimex A13-Olinuxino"; 18 model = "Olimex A13-Olinuxino";
19 compatible = "olimex,a13-olinuxino", "allwinner,sun5i-a13"; 19 compatible = "olimex,a13-olinuxino", "allwinner,sun5i-a13";
20 20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
25 soc@01c00000 { 21 soc@01c00000 {
26 pinctrl@01c20800 { 22 pinctrl@01c20800 {
27 led_pins_olinuxino: led_pins@0 { 23 led_pins_olinuxino: led_pins@0 {
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 1ccd75d37f49..320335abfccd 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -67,6 +67,29 @@
67 clocks = <&osc24M>; 67 clocks = <&osc24M>;
68 }; 68 };
69 69
70 pll4: pll4@01c20018 {
71 #clock-cells = <0>;
72 compatible = "allwinner,sun4i-pll1-clk";
73 reg = <0x01c20018 0x4>;
74 clocks = <&osc24M>;
75 };
76
77 pll5: pll5@01c20020 {
78 #clock-cells = <1>;
79 compatible = "allwinner,sun4i-pll5-clk";
80 reg = <0x01c20020 0x4>;
81 clocks = <&osc24M>;
82 clock-output-names = "pll5_ddr", "pll5_other";
83 };
84
85 pll6: pll6@01c20028 {
86 #clock-cells = <1>;
87 compatible = "allwinner,sun4i-pll6-clk";
88 reg = <0x01c20028 0x4>;
89 clocks = <&osc24M>;
90 clock-output-names = "pll6_sata", "pll6_other", "pll6";
91 };
92
70 /* dummy is 200M */ 93 /* dummy is 200M */
71 cpu: cpu@01c20054 { 94 cpu: cpu@01c20054 {
72 #clock-cells = <0>; 95 #clock-cells = <0>;
@@ -125,12 +148,11 @@
125 clock-output-names = "apb0_codec", "apb0_pio", "apb0_ir"; 148 clock-output-names = "apb0_codec", "apb0_pio", "apb0_ir";
126 }; 149 };
127 150
128 /* dummy is pll6 */
129 apb1_mux: apb1_mux@01c20058 { 151 apb1_mux: apb1_mux@01c20058 {
130 #clock-cells = <0>; 152 #clock-cells = <0>;
131 compatible = "allwinner,sun4i-apb1-mux-clk"; 153 compatible = "allwinner,sun4i-apb1-mux-clk";
132 reg = <0x01c20058 0x4>; 154 reg = <0x01c20058 0x4>;
133 clocks = <&osc24M>, <&dummy>, <&osc32k>; 155 clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
134 }; 156 };
135 157
136 apb1: apb1@01c20058 { 158 apb1: apb1@01c20058 {
@@ -148,6 +170,102 @@
148 clock-output-names = "apb1_i2c0", "apb1_i2c1", 170 clock-output-names = "apb1_i2c0", "apb1_i2c1",
149 "apb1_i2c2", "apb1_uart1", "apb1_uart3"; 171 "apb1_i2c2", "apb1_uart1", "apb1_uart3";
150 }; 172 };
173
174 nand_clk: clk@01c20080 {
175 #clock-cells = <0>;
176 compatible = "allwinner,sun4i-mod0-clk";
177 reg = <0x01c20080 0x4>;
178 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
179 clock-output-names = "nand";
180 };
181
182 ms_clk: clk@01c20084 {
183 #clock-cells = <0>;
184 compatible = "allwinner,sun4i-mod0-clk";
185 reg = <0x01c20084 0x4>;
186 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
187 clock-output-names = "ms";
188 };
189
190 mmc0_clk: clk@01c20088 {
191 #clock-cells = <0>;
192 compatible = "allwinner,sun4i-mod0-clk";
193 reg = <0x01c20088 0x4>;
194 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
195 clock-output-names = "mmc0";
196 };
197
198 mmc1_clk: clk@01c2008c {
199 #clock-cells = <0>;
200 compatible = "allwinner,sun4i-mod0-clk";
201 reg = <0x01c2008c 0x4>;
202 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
203 clock-output-names = "mmc1";
204 };
205
206 mmc2_clk: clk@01c20090 {
207 #clock-cells = <0>;
208 compatible = "allwinner,sun4i-mod0-clk";
209 reg = <0x01c20090 0x4>;
210 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
211 clock-output-names = "mmc2";
212 };
213
214 ts_clk: clk@01c20098 {
215 #clock-cells = <0>;
216 compatible = "allwinner,sun4i-mod0-clk";
217 reg = <0x01c20098 0x4>;
218 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
219 clock-output-names = "ts";
220 };
221
222 ss_clk: clk@01c2009c {
223 #clock-cells = <0>;
224 compatible = "allwinner,sun4i-mod0-clk";
225 reg = <0x01c2009c 0x4>;
226 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
227 clock-output-names = "ss";
228 };
229
230 spi0_clk: clk@01c200a0 {
231 #clock-cells = <0>;
232 compatible = "allwinner,sun4i-mod0-clk";
233 reg = <0x01c200a0 0x4>;
234 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
235 clock-output-names = "spi0";
236 };
237
238 spi1_clk: clk@01c200a4 {
239 #clock-cells = <0>;
240 compatible = "allwinner,sun4i-mod0-clk";
241 reg = <0x01c200a4 0x4>;
242 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
243 clock-output-names = "spi1";
244 };
245
246 spi2_clk: clk@01c200a8 {
247 #clock-cells = <0>;
248 compatible = "allwinner,sun4i-mod0-clk";
249 reg = <0x01c200a8 0x4>;
250 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
251 clock-output-names = "spi2";
252 };
253
254 ir0_clk: clk@01c200b0 {
255 #clock-cells = <0>;
256 compatible = "allwinner,sun4i-mod0-clk";
257 reg = <0x01c200b0 0x4>;
258 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
259 clock-output-names = "ir0";
260 };
261
262 mbus_clk: clk@01c2015c {
263 #clock-cells = <0>;
264 compatible = "allwinner,sun4i-mod0-clk";
265 reg = <0x01c2015c 0x4>;
266 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
267 clock-output-names = "mbus";
268 };
151 }; 269 };
152 270
153 soc@01c00000 { 271 soc@01c00000 {
@@ -227,6 +345,12 @@
227 reg = <0x01c23800 0x10>; 345 reg = <0x01c23800 0x10>;
228 }; 346 };
229 347
348 rtp: rtp@01c25000 {
349 compatible = "allwinner,sun4i-ts";
350 reg = <0x01c25000 0x100>;
351 interrupts = <29>;
352 };
353
230 uart1: serial@01c28400 { 354 uart1: serial@01c28400 {
231 compatible = "snps,dw-apb-uart"; 355 compatible = "snps,dw-apb-uart";
232 reg = <0x01c28400 0x400>; 356 reg = <0x01c28400 0x400>;
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 7f5878c2784a..5256ad9be52c 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -212,6 +212,24 @@
212 }; 212 };
213 }; 213 };
214 214
215 ahb1_rst: reset@01c202c0 {
216 #reset-cells = <1>;
217 compatible = "allwinner,sun6i-a31-ahb1-reset";
218 reg = <0x01c202c0 0xc>;
219 };
220
221 apb1_rst: reset@01c202d0 {
222 #reset-cells = <1>;
223 compatible = "allwinner,sun6i-a31-clock-reset";
224 reg = <0x01c202d0 0x4>;
225 };
226
227 apb2_rst: reset@01c202d8 {
228 #reset-cells = <1>;
229 compatible = "allwinner,sun6i-a31-clock-reset";
230 reg = <0x01c202d8 0x4>;
231 };
232
215 timer@01c20c00 { 233 timer@01c20c00 {
216 compatible = "allwinner,sun4i-timer"; 234 compatible = "allwinner,sun4i-timer";
217 reg = <0x01c20c00 0xa0>; 235 reg = <0x01c20c00 0xa0>;
@@ -235,6 +253,7 @@
235 reg-shift = <2>; 253 reg-shift = <2>;
236 reg-io-width = <4>; 254 reg-io-width = <4>;
237 clocks = <&apb2_gates 16>; 255 clocks = <&apb2_gates 16>;
256 resets = <&apb2_rst 16>;
238 status = "disabled"; 257 status = "disabled";
239 }; 258 };
240 259
@@ -245,6 +264,7 @@
245 reg-shift = <2>; 264 reg-shift = <2>;
246 reg-io-width = <4>; 265 reg-io-width = <4>;
247 clocks = <&apb2_gates 17>; 266 clocks = <&apb2_gates 17>;
267 resets = <&apb2_rst 17>;
248 status = "disabled"; 268 status = "disabled";
249 }; 269 };
250 270
@@ -255,6 +275,7 @@
255 reg-shift = <2>; 275 reg-shift = <2>;
256 reg-io-width = <4>; 276 reg-io-width = <4>;
257 clocks = <&apb2_gates 18>; 277 clocks = <&apb2_gates 18>;
278 resets = <&apb2_rst 18>;
258 status = "disabled"; 279 status = "disabled";
259 }; 280 };
260 281
@@ -265,6 +286,7 @@
265 reg-shift = <2>; 286 reg-shift = <2>;
266 reg-io-width = <4>; 287 reg-io-width = <4>;
267 clocks = <&apb2_gates 19>; 288 clocks = <&apb2_gates 19>;
289 resets = <&apb2_rst 19>;
268 status = "disabled"; 290 status = "disabled";
269 }; 291 };
270 292
@@ -275,6 +297,7 @@
275 reg-shift = <2>; 297 reg-shift = <2>;
276 reg-io-width = <4>; 298 reg-io-width = <4>;
277 clocks = <&apb2_gates 20>; 299 clocks = <&apb2_gates 20>;
300 resets = <&apb2_rst 20>;
278 status = "disabled"; 301 status = "disabled";
279 }; 302 };
280 303
@@ -285,6 +308,7 @@
285 reg-shift = <2>; 308 reg-shift = <2>;
286 reg-io-width = <4>; 309 reg-io-width = <4>;
287 clocks = <&apb2_gates 21>; 310 clocks = <&apb2_gates 21>;
311 resets = <&apb2_rst 21>;
288 status = "disabled"; 312 status = "disabled";
289 }; 313 };
290 314
@@ -298,5 +322,15 @@
298 #interrupt-cells = <3>; 322 #interrupt-cells = <3>;
299 interrupts = <1 9 0xf04>; 323 interrupts = <1 9 0xf04>;
300 }; 324 };
325
326 cpucfg@01f01c00 {
327 compatible = "allwinner,sun6i-a31-cpuconfig";
328 reg = <0x01f01c00 0x300>;
329 };
330
331 prcm@01f01c00 {
332 compatible = "allwinner,sun6i-a31-prcm";
333 reg = <0x01f01400 0x200>;
334 };
301 }; 335 };
302}; 336};
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index 8a1009d6c829..f9dcb61a5305 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -33,6 +33,24 @@
33 pinctrl-0 = <&uart0_pins_a>; 33 pinctrl-0 = <&uart0_pins_a>;
34 status = "okay"; 34 status = "okay";
35 }; 35 };
36
37 i2c0: i2c@01c2ac00 {
38 pinctrl-names = "default";
39 pinctrl-0 = <&i2c0_pins_a>;
40 status = "okay";
41 };
42
43 i2c1: i2c@01c2b000 {
44 pinctrl-names = "default";
45 pinctrl-0 = <&i2c1_pins_a>;
46 status = "okay";
47 };
48
49 i2c2: i2c@01c2b400 {
50 pinctrl-names = "default";
51 pinctrl-0 = <&i2c2_pins_a>;
52 status = "okay";
53 };
36 }; 54 };
37 55
38 leds { 56 leds {
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0135039eff96..119f066f0d98 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -16,6 +16,10 @@
16/ { 16/ {
17 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
18 18
19 aliases {
20 ethernet0 = &emac;
21 };
22
19 cpus { 23 cpus {
20 #address-cells = <1>; 24 #address-cells = <1>;
21 #size-cells = <0>; 25 #size-cells = <0>;
@@ -49,10 +53,11 @@
49 clock-frequency = <24000000>; 53 clock-frequency = <24000000>;
50 }; 54 };
51 55
52 osc32k: osc32k { 56 osc32k: clk@0 {
53 #clock-cells = <0>; 57 #clock-cells = <0>;
54 compatible = "fixed-clock"; 58 compatible = "fixed-clock";
55 clock-frequency = <32768>; 59 clock-frequency = <32768>;
60 clock-output-names = "osc32k";
56 }; 61 };
57 62
58 pll1: pll1@01c20000 { 63 pll1: pll1@01c20000 {
@@ -62,23 +67,34 @@
62 clocks = <&osc24M>; 67 clocks = <&osc24M>;
63 }; 68 };
64 69
65 /* 70 pll4: pll4@01c20018 {
66 * This is a dummy clock, to be used as placeholder on
67 * other mux clocks when a specific parent clock is not
68 * yet implemented. It should be dropped when the driver
69 * is complete.
70 */
71 pll6: pll6 {
72 #clock-cells = <0>; 71 #clock-cells = <0>;
73 compatible = "fixed-clock"; 72 compatible = "allwinner,sun4i-pll1-clk";
74 clock-frequency = <0>; 73 reg = <0x01c20018 0x4>;
74 clocks = <&osc24M>;
75 };
76
77 pll5: pll5@01c20020 {
78 #clock-cells = <1>;
79 compatible = "allwinner,sun4i-pll5-clk";
80 reg = <0x01c20020 0x4>;
81 clocks = <&osc24M>;
82 clock-output-names = "pll5_ddr", "pll5_other";
83 };
84
85 pll6: pll6@01c20028 {
86 #clock-cells = <1>;
87 compatible = "allwinner,sun4i-pll6-clk";
88 reg = <0x01c20028 0x4>;
89 clocks = <&osc24M>;
90 clock-output-names = "pll6_sata", "pll6_other", "pll6";
75 }; 91 };
76 92
77 cpu: cpu@01c20054 { 93 cpu: cpu@01c20054 {
78 #clock-cells = <0>; 94 #clock-cells = <0>;
79 compatible = "allwinner,sun4i-cpu-clk"; 95 compatible = "allwinner,sun4i-cpu-clk";
80 reg = <0x01c20054 0x4>; 96 reg = <0x01c20054 0x4>;
81 clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll6>; 97 clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll6 1>;
82 }; 98 };
83 99
84 axi: axi@01c20054 { 100 axi: axi@01c20054 {
@@ -137,7 +153,7 @@
137 #clock-cells = <0>; 153 #clock-cells = <0>;
138 compatible = "allwinner,sun4i-apb1-mux-clk"; 154 compatible = "allwinner,sun4i-apb1-mux-clk";
139 reg = <0x01c20058 0x4>; 155 reg = <0x01c20058 0x4>;
140 clocks = <&osc24M>, <&pll6>, <&osc32k>; 156 clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
141 }; 157 };
142 158
143 apb1: apb1@01c20058 { 159 apb1: apb1@01c20058 {
@@ -159,6 +175,162 @@
159 "apb1_uart2", "apb1_uart3", "apb1_uart4", 175 "apb1_uart2", "apb1_uart3", "apb1_uart4",
160 "apb1_uart5", "apb1_uart6", "apb1_uart7"; 176 "apb1_uart5", "apb1_uart6", "apb1_uart7";
161 }; 177 };
178
179 nand_clk: clk@01c20080 {
180 #clock-cells = <0>;
181 compatible = "allwinner,sun4i-mod0-clk";
182 reg = <0x01c20080 0x4>;
183 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
184 clock-output-names = "nand";
185 };
186
187 ms_clk: clk@01c20084 {
188 #clock-cells = <0>;
189 compatible = "allwinner,sun4i-mod0-clk";
190 reg = <0x01c20084 0x4>;
191 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
192 clock-output-names = "ms";
193 };
194
195 mmc0_clk: clk@01c20088 {
196 #clock-cells = <0>;
197 compatible = "allwinner,sun4i-mod0-clk";
198 reg = <0x01c20088 0x4>;
199 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
200 clock-output-names = "mmc0";
201 };
202
203 mmc1_clk: clk@01c2008c {
204 #clock-cells = <0>;
205 compatible = "allwinner,sun4i-mod0-clk";
206 reg = <0x01c2008c 0x4>;
207 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
208 clock-output-names = "mmc1";
209 };
210
211 mmc2_clk: clk@01c20090 {
212 #clock-cells = <0>;
213 compatible = "allwinner,sun4i-mod0-clk";
214 reg = <0x01c20090 0x4>;
215 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
216 clock-output-names = "mmc2";
217 };
218
219 mmc3_clk: clk@01c20094 {
220 #clock-cells = <0>;
221 compatible = "allwinner,sun4i-mod0-clk";
222 reg = <0x01c20094 0x4>;
223 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
224 clock-output-names = "mmc3";
225 };
226
227 ts_clk: clk@01c20098 {
228 #clock-cells = <0>;
229 compatible = "allwinner,sun4i-mod0-clk";
230 reg = <0x01c20098 0x4>;
231 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
232 clock-output-names = "ts";
233 };
234
235 ss_clk: clk@01c2009c {
236 #clock-cells = <0>;
237 compatible = "allwinner,sun4i-mod0-clk";
238 reg = <0x01c2009c 0x4>;
239 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
240 clock-output-names = "ss";
241 };
242
243 spi0_clk: clk@01c200a0 {
244 #clock-cells = <0>;
245 compatible = "allwinner,sun4i-mod0-clk";
246 reg = <0x01c200a0 0x4>;
247 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
248 clock-output-names = "spi0";
249 };
250
251 spi1_clk: clk@01c200a4 {
252 #clock-cells = <0>;
253 compatible = "allwinner,sun4i-mod0-clk";
254 reg = <0x01c200a4 0x4>;
255 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
256 clock-output-names = "spi1";
257 };
258
259 spi2_clk: clk@01c200a8 {
260 #clock-cells = <0>;
261 compatible = "allwinner,sun4i-mod0-clk";
262 reg = <0x01c200a8 0x4>;
263 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
264 clock-output-names = "spi2";
265 };
266
267 pata_clk: clk@01c200ac {
268 #clock-cells = <0>;
269 compatible = "allwinner,sun4i-mod0-clk";
270 reg = <0x01c200ac 0x4>;
271 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
272 clock-output-names = "pata";
273 };
274
275 ir0_clk: clk@01c200b0 {
276 #clock-cells = <0>;
277 compatible = "allwinner,sun4i-mod0-clk";
278 reg = <0x01c200b0 0x4>;
279 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
280 clock-output-names = "ir0";
281 };
282
283 ir1_clk: clk@01c200b4 {
284 #clock-cells = <0>;
285 compatible = "allwinner,sun4i-mod0-clk";
286 reg = <0x01c200b4 0x4>;
287 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
288 clock-output-names = "ir1";
289 };
290
291 spi3_clk: clk@01c200d4 {
292 #clock-cells = <0>;
293 compatible = "allwinner,sun4i-mod0-clk";
294 reg = <0x01c200d4 0x4>;
295 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
296 clock-output-names = "spi3";
297 };
298
299 mbus_clk: clk@01c2015c {
300 #clock-cells = <0>;
301 compatible = "allwinner,sun4i-mod0-clk";
302 reg = <0x01c2015c 0x4>;
303 clocks = <&osc24M>, <&pll6 2>, <&pll5 1>;
304 clock-output-names = "mbus";
305 };
306
307 /*
308 * Dummy clock used by output clocks
309 */
310 osc24M_32k: clk@1 {
311 #clock-cells = <0>;
312 compatible = "fixed-factor-clock";
313 clock-div = <750>;
314 clock-mult = <1>;
315 clocks = <&osc24M>;
316 clock-output-names = "osc24M_32k";
317 };
318
319 clk_out_a: clk@01c201f0 {
320 #clock-cells = <0>;
321 compatible = "allwinner,sun7i-a20-out-clk";
322 reg = <0x01c201f0 0x4>;
323 clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
324 clock-output-names = "clk_out_a";
325 };
326
327 clk_out_b: clk@01c201f4 {
328 #clock-cells = <0>;
329 compatible = "allwinner,sun7i-a20-out-clk";
330 reg = <0x01c201f4 0x4>;
331 clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
332 clock-output-names = "clk_out_b";
333 };
162 }; 334 };
163 335
164 soc@01c00000 { 336 soc@01c00000 {
@@ -246,6 +418,20 @@
246 allwinner,drive = <0>; 418 allwinner,drive = <0>;
247 allwinner,pull = <0>; 419 allwinner,pull = <0>;
248 }; 420 };
421
422 clk_out_a_pins_a: clk_out_a@0 {
423 allwinner,pins = "PI12";
424 allwinner,function = "clk_out_a";
425 allwinner,drive = <0>;
426 allwinner,pull = <0>;
427 };
428
429 clk_out_b_pins_a: clk_out_b@0 {
430 allwinner,pins = "PI13";
431 allwinner,function = "clk_out_b";
432 allwinner,drive = <0>;
433 allwinner,pull = <0>;
434 };
249 }; 435 };
250 436
251 timer@01c20c00 { 437 timer@01c20c00 {
@@ -265,11 +451,23 @@
265 reg = <0x01c20c90 0x10>; 451 reg = <0x01c20c90 0x10>;
266 }; 452 };
267 453
454 rtc: rtc@01c20d00 {
455 compatible = "allwinner,sun7i-a20-rtc";
456 reg = <0x01c20d00 0x20>;
457 interrupts = <0 24 1>;
458 };
459
268 sid: eeprom@01c23800 { 460 sid: eeprom@01c23800 {
269 compatible = "allwinner,sun7i-a20-sid"; 461 compatible = "allwinner,sun7i-a20-sid";
270 reg = <0x01c23800 0x200>; 462 reg = <0x01c23800 0x200>;
271 }; 463 };
272 464
465 rtp: rtp@01c25000 {
466 compatible = "allwinner,sun4i-ts";
467 reg = <0x01c25000 0x100>;
468 interrupts = <0 29 4>;
469 };
470
273 uart0: serial@01c28000 { 471 uart0: serial@01c28000 {
274 compatible = "snps,dw-apb-uart"; 472 compatible = "snps,dw-apb-uart";
275 reg = <0x01c28000 0x400>; 473 reg = <0x01c28000 0x400>;
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts
index cb5ec23b03a7..73aecfb57ccb 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -7,11 +7,42 @@
7 model = "NVIDIA Tegra114 Dalmore evaluation board"; 7 model = "NVIDIA Tegra114 Dalmore evaluation board";
8 compatible = "nvidia,dalmore", "nvidia,tegra114"; 8 compatible = "nvidia,dalmore", "nvidia,tegra114";
9 9
10 aliases {
11 rtc0 = "/i2c@7000d000/tps65913@58";
12 rtc1 = "/rtc@7000e000";
13 };
14
10 memory { 15 memory {
11 reg = <0x80000000 0x40000000>; 16 reg = <0x80000000 0x40000000>;
12 }; 17 };
13 18
14 pinmux { 19 host1x@50000000 {
20 hdmi@54280000 {
21 status = "okay";
22
23 vdd-supply = <&vdd_hdmi_reg>;
24 pll-supply = <&palmas_smps3_reg>;
25
26 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
27 nvidia,hpd-gpio =
28 <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
29 };
30
31 dsi@54300000 {
32 status = "okay";
33
34 panel@0 {
35 compatible = "panasonic,vvx10f004b00",
36 "simple-panel";
37 reg = <0>;
38
39 power-supply = <&avdd_lcd_reg>;
40 backlight = <&backlight>;
41 };
42 };
43 };
44
45 pinmux@70000868 {
15 pinctrl-names = "default"; 46 pinctrl-names = "default";
16 pinctrl-0 = <&state_default>; 47 pinctrl-0 = <&state_default>;
17 48
@@ -19,41 +50,41 @@
19 clk1_out_pw4 { 50 clk1_out_pw4 {
20 nvidia,pins = "clk1_out_pw4"; 51 nvidia,pins = "clk1_out_pw4";
21 nvidia,function = "extperiph1"; 52 nvidia,function = "extperiph1";
22 nvidia,pull = <0>; 53 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
23 nvidia,tristate = <0>; 54 nvidia,tristate = <TEGRA_PIN_DISABLE>;
24 nvidia,enable-input = <0>; 55 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
25 }; 56 };
26 dap1_din_pn1 { 57 dap1_din_pn1 {
27 nvidia,pins = "dap1_din_pn1"; 58 nvidia,pins = "dap1_din_pn1";
28 nvidia,function = "i2s0"; 59 nvidia,function = "i2s0";
29 nvidia,pull = <0>; 60 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
30 nvidia,tristate = <1>; 61 nvidia,tristate = <TEGRA_PIN_ENABLE>;
31 nvidia,enable-input = <1>; 62 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
32 }; 63 };
33 dap1_dout_pn2 { 64 dap1_dout_pn2 {
34 nvidia,pins = "dap1_dout_pn2", 65 nvidia,pins = "dap1_dout_pn2",
35 "dap1_fs_pn0", 66 "dap1_fs_pn0",
36 "dap1_sclk_pn3"; 67 "dap1_sclk_pn3";
37 nvidia,function = "i2s0"; 68 nvidia,function = "i2s0";
38 nvidia,pull = <0>; 69 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
39 nvidia,tristate = <0>; 70 nvidia,tristate = <TEGRA_PIN_DISABLE>;
40 nvidia,enable-input = <1>; 71 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
41 }; 72 };
42 dap2_din_pa4 { 73 dap2_din_pa4 {
43 nvidia,pins = "dap2_din_pa4"; 74 nvidia,pins = "dap2_din_pa4";
44 nvidia,function = "i2s1"; 75 nvidia,function = "i2s1";
45 nvidia,pull = <0>; 76 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
46 nvidia,tristate = <1>; 77 nvidia,tristate = <TEGRA_PIN_ENABLE>;
47 nvidia,enable-input = <1>; 78 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
48 }; 79 };
49 dap2_dout_pa5 { 80 dap2_dout_pa5 {
50 nvidia,pins = "dap2_dout_pa5", 81 nvidia,pins = "dap2_dout_pa5",
51 "dap2_fs_pa2", 82 "dap2_fs_pa2",
52 "dap2_sclk_pa3"; 83 "dap2_sclk_pa3";
53 nvidia,function = "i2s1"; 84 nvidia,function = "i2s1";
54 nvidia,pull = <0>; 85 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
55 nvidia,tristate = <0>; 86 nvidia,tristate = <TEGRA_PIN_DISABLE>;
56 nvidia,enable-input = <1>; 87 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
57 }; 88 };
58 dap4_din_pp5 { 89 dap4_din_pp5 {
59 nvidia,pins = "dap4_din_pp5", 90 nvidia,pins = "dap4_din_pp5",
@@ -61,17 +92,17 @@
61 "dap4_fs_pp4", 92 "dap4_fs_pp4",
62 "dap4_sclk_pp7"; 93 "dap4_sclk_pp7";
63 nvidia,function = "i2s3"; 94 nvidia,function = "i2s3";
64 nvidia,pull = <0>; 95 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
65 nvidia,tristate = <0>; 96 nvidia,tristate = <TEGRA_PIN_DISABLE>;
66 nvidia,enable-input = <1>; 97 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
67 }; 98 };
68 dvfs_pwm_px0 { 99 dvfs_pwm_px0 {
69 nvidia,pins = "dvfs_pwm_px0", 100 nvidia,pins = "dvfs_pwm_px0",
70 "dvfs_clk_px2"; 101 "dvfs_clk_px2";
71 nvidia,function = "cldvfs"; 102 nvidia,function = "cldvfs";
72 nvidia,pull = <0>; 103 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
73 nvidia,tristate = <0>; 104 nvidia,tristate = <TEGRA_PIN_DISABLE>;
74 nvidia,enable-input = <0>; 105 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
75 }; 106 };
76 ulpi_clk_py0 { 107 ulpi_clk_py0 {
77 nvidia,pins = "ulpi_clk_py0", 108 nvidia,pins = "ulpi_clk_py0",
@@ -84,128 +115,128 @@
84 "ulpi_data6_po7", 115 "ulpi_data6_po7",
85 "ulpi_data7_po0"; 116 "ulpi_data7_po0";
86 nvidia,function = "ulpi"; 117 nvidia,function = "ulpi";
87 nvidia,pull = <0>; 118 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
88 nvidia,tristate = <0>; 119 nvidia,tristate = <TEGRA_PIN_DISABLE>;
89 nvidia,enable-input = <1>; 120 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
90 }; 121 };
91 ulpi_dir_py1 { 122 ulpi_dir_py1 {
92 nvidia,pins = "ulpi_dir_py1", 123 nvidia,pins = "ulpi_dir_py1",
93 "ulpi_nxt_py2"; 124 "ulpi_nxt_py2";
94 nvidia,function = "ulpi"; 125 nvidia,function = "ulpi";
95 nvidia,pull = <0>; 126 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
96 nvidia,tristate = <1>; 127 nvidia,tristate = <TEGRA_PIN_ENABLE>;
97 nvidia,enable-input = <1>; 128 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
98 }; 129 };
99 ulpi_stp_py3 { 130 ulpi_stp_py3 {
100 nvidia,pins = "ulpi_stp_py3"; 131 nvidia,pins = "ulpi_stp_py3";
101 nvidia,function = "ulpi"; 132 nvidia,function = "ulpi";
102 nvidia,pull = <0>; 133 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
103 nvidia,tristate = <0>; 134 nvidia,tristate = <TEGRA_PIN_DISABLE>;
104 nvidia,enable-input = <0>; 135 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
105 }; 136 };
106 cam_i2c_scl_pbb1 { 137 cam_i2c_scl_pbb1 {
107 nvidia,pins = "cam_i2c_scl_pbb1", 138 nvidia,pins = "cam_i2c_scl_pbb1",
108 "cam_i2c_sda_pbb2"; 139 "cam_i2c_sda_pbb2";
109 nvidia,function = "i2c3"; 140 nvidia,function = "i2c3";
110 nvidia,pull = <0>; 141 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
111 nvidia,tristate = <0>; 142 nvidia,tristate = <TEGRA_PIN_DISABLE>;
112 nvidia,enable-input = <1>; 143 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
113 nvidia,lock = <0>; 144 nvidia,lock = <TEGRA_PIN_DISABLE>;
114 nvidia,open-drain = <0>; 145 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
115 }; 146 };
116 cam_mclk_pcc0 { 147 cam_mclk_pcc0 {
117 nvidia,pins = "cam_mclk_pcc0", 148 nvidia,pins = "cam_mclk_pcc0",
118 "pbb0"; 149 "pbb0";
119 nvidia,function = "vi_alt3"; 150 nvidia,function = "vi_alt3";
120 nvidia,pull = <0>; 151 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
121 nvidia,tristate = <0>; 152 nvidia,tristate = <TEGRA_PIN_DISABLE>;
122 nvidia,enable-input = <0>; 153 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
123 nvidia,lock = <0>; 154 nvidia,lock = <TEGRA_PIN_DISABLE>;
124 }; 155 };
125 gen2_i2c_scl_pt5 { 156 gen2_i2c_scl_pt5 {
126 nvidia,pins = "gen2_i2c_scl_pt5", 157 nvidia,pins = "gen2_i2c_scl_pt5",
127 "gen2_i2c_sda_pt6"; 158 "gen2_i2c_sda_pt6";
128 nvidia,function = "i2c2"; 159 nvidia,function = "i2c2";
129 nvidia,pull = <0>; 160 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
130 nvidia,tristate = <0>; 161 nvidia,tristate = <TEGRA_PIN_DISABLE>;
131 nvidia,enable-input = <1>; 162 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
132 nvidia,lock = <0>; 163 nvidia,lock = <TEGRA_PIN_DISABLE>;
133 nvidia,open-drain = <0>; 164 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
134 }; 165 };
135 gmi_a16_pj7 { 166 gmi_a16_pj7 {
136 nvidia,pins = "gmi_a16_pj7"; 167 nvidia,pins = "gmi_a16_pj7";
137 nvidia,function = "uartd"; 168 nvidia,function = "uartd";
138 nvidia,pull = <0>; 169 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
139 nvidia,tristate = <0>; 170 nvidia,tristate = <TEGRA_PIN_DISABLE>;
140 nvidia,enable-input = <0>; 171 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
141 }; 172 };
142 gmi_a17_pb0 { 173 gmi_a17_pb0 {
143 nvidia,pins = "gmi_a17_pb0", 174 nvidia,pins = "gmi_a17_pb0",
144 "gmi_a18_pb1"; 175 "gmi_a18_pb1";
145 nvidia,function = "uartd"; 176 nvidia,function = "uartd";
146 nvidia,pull = <0>; 177 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
147 nvidia,tristate = <1>; 178 nvidia,tristate = <TEGRA_PIN_ENABLE>;
148 nvidia,enable-input = <1>; 179 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
149 }; 180 };
150 gmi_a19_pk7 { 181 gmi_a19_pk7 {
151 nvidia,pins = "gmi_a19_pk7"; 182 nvidia,pins = "gmi_a19_pk7";
152 nvidia,function = "uartd"; 183 nvidia,function = "uartd";
153 nvidia,pull = <0>; 184 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
154 nvidia,tristate = <0>; 185 nvidia,tristate = <TEGRA_PIN_DISABLE>;
155 nvidia,enable-input = <0>; 186 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
156 }; 187 };
157 gmi_ad5_pg5 { 188 gmi_ad5_pg5 {
158 nvidia,pins = "gmi_ad5_pg5", 189 nvidia,pins = "gmi_ad5_pg5",
159 "gmi_cs6_n_pi3", 190 "gmi_cs6_n_pi3",
160 "gmi_wr_n_pi0"; 191 "gmi_wr_n_pi0";
161 nvidia,function = "spi4"; 192 nvidia,function = "spi4";
162 nvidia,pull = <0>; 193 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
163 nvidia,tristate = <0>; 194 nvidia,tristate = <TEGRA_PIN_DISABLE>;
164 nvidia,enable-input = <1>; 195 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
165 }; 196 };
166 gmi_ad6_pg6 { 197 gmi_ad6_pg6 {
167 nvidia,pins = "gmi_ad6_pg6", 198 nvidia,pins = "gmi_ad6_pg6",
168 "gmi_ad7_pg7"; 199 "gmi_ad7_pg7";
169 nvidia,function = "spi4"; 200 nvidia,function = "spi4";
170 nvidia,pull = <2>; 201 nvidia,pull = <TEGRA_PIN_PULL_UP>;
171 nvidia,tristate = <0>; 202 nvidia,tristate = <TEGRA_PIN_DISABLE>;
172 nvidia,enable-input = <1>; 203 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
173 }; 204 };
174 gmi_ad12_ph4 { 205 gmi_ad12_ph4 {
175 nvidia,pins = "gmi_ad12_ph4"; 206 nvidia,pins = "gmi_ad12_ph4";
176 nvidia,function = "rsvd4"; 207 nvidia,function = "rsvd4";
177 nvidia,pull = <0>; 208 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
178 nvidia,tristate = <0>; 209 nvidia,tristate = <TEGRA_PIN_DISABLE>;
179 nvidia,enable-input = <0>; 210 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
180 }; 211 };
181 gmi_ad9_ph1 { 212 gmi_ad9_ph1 {
182 nvidia,pins = "gmi_ad9_ph1"; 213 nvidia,pins = "gmi_ad9_ph1";
183 nvidia,function = "pwm1"; 214 nvidia,function = "pwm1";
184 nvidia,pull = <0>; 215 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
185 nvidia,tristate = <0>; 216 nvidia,tristate = <TEGRA_PIN_DISABLE>;
186 nvidia,enable-input = <0>; 217 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
187 }; 218 };
188 gmi_cs1_n_pj2 { 219 gmi_cs1_n_pj2 {
189 nvidia,pins = "gmi_cs1_n_pj2", 220 nvidia,pins = "gmi_cs1_n_pj2",
190 "gmi_oe_n_pi1"; 221 "gmi_oe_n_pi1";
191 nvidia,function = "soc"; 222 nvidia,function = "soc";
192 nvidia,pull = <0>; 223 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
193 nvidia,tristate = <1>; 224 nvidia,tristate = <TEGRA_PIN_ENABLE>;
194 nvidia,enable-input = <1>; 225 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
195 }; 226 };
196 clk2_out_pw5 { 227 clk2_out_pw5 {
197 nvidia,pins = "clk2_out_pw5"; 228 nvidia,pins = "clk2_out_pw5";
198 nvidia,function = "extperiph2"; 229 nvidia,function = "extperiph2";
199 nvidia,pull = <0>; 230 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
200 nvidia,tristate = <0>; 231 nvidia,tristate = <TEGRA_PIN_DISABLE>;
201 nvidia,enable-input = <0>; 232 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
202 }; 233 };
203 sdmmc1_clk_pz0 { 234 sdmmc1_clk_pz0 {
204 nvidia,pins = "sdmmc1_clk_pz0"; 235 nvidia,pins = "sdmmc1_clk_pz0";
205 nvidia,function = "sdmmc1"; 236 nvidia,function = "sdmmc1";
206 nvidia,pull = <0>; 237 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
207 nvidia,tristate = <0>; 238 nvidia,tristate = <TEGRA_PIN_DISABLE>;
208 nvidia,enable-input = <1>; 239 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
209 }; 240 };
210 sdmmc1_cmd_pz1 { 241 sdmmc1_cmd_pz1 {
211 nvidia,pins = "sdmmc1_cmd_pz1", 242 nvidia,pins = "sdmmc1_cmd_pz1",
@@ -214,23 +245,23 @@
214 "sdmmc1_dat2_py5", 245 "sdmmc1_dat2_py5",
215 "sdmmc1_dat3_py4"; 246 "sdmmc1_dat3_py4";
216 nvidia,function = "sdmmc1"; 247 nvidia,function = "sdmmc1";
217 nvidia,pull = <2>; 248 nvidia,pull = <TEGRA_PIN_PULL_UP>;
218 nvidia,tristate = <0>; 249 nvidia,tristate = <TEGRA_PIN_DISABLE>;
219 nvidia,enable-input = <1>; 250 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
220 }; 251 };
221 sdmmc1_wp_n_pv3 { 252 sdmmc1_wp_n_pv3 {
222 nvidia,pins = "sdmmc1_wp_n_pv3"; 253 nvidia,pins = "sdmmc1_wp_n_pv3";
223 nvidia,function = "spi4"; 254 nvidia,function = "spi4";
224 nvidia,pull = <2>; 255 nvidia,pull = <TEGRA_PIN_PULL_UP>;
225 nvidia,tristate = <0>; 256 nvidia,tristate = <TEGRA_PIN_DISABLE>;
226 nvidia,enable-input = <0>; 257 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
227 }; 258 };
228 sdmmc3_clk_pa6 { 259 sdmmc3_clk_pa6 {
229 nvidia,pins = "sdmmc3_clk_pa6"; 260 nvidia,pins = "sdmmc3_clk_pa6";
230 nvidia,function = "sdmmc3"; 261 nvidia,function = "sdmmc3";
231 nvidia,pull = <0>; 262 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
232 nvidia,tristate = <0>; 263 nvidia,tristate = <TEGRA_PIN_DISABLE>;
233 nvidia,enable-input = <1>; 264 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
234 }; 265 };
235 sdmmc3_cmd_pa7 { 266 sdmmc3_cmd_pa7 {
236 nvidia,pins = "sdmmc3_cmd_pa7", 267 nvidia,pins = "sdmmc3_cmd_pa7",
@@ -242,16 +273,16 @@
242 "sdmmc3_clk_lb_out_pee4", 273 "sdmmc3_clk_lb_out_pee4",
243 "sdmmc3_clk_lb_in_pee5"; 274 "sdmmc3_clk_lb_in_pee5";
244 nvidia,function = "sdmmc3"; 275 nvidia,function = "sdmmc3";
245 nvidia,pull = <2>; 276 nvidia,pull = <TEGRA_PIN_PULL_UP>;
246 nvidia,tristate = <0>; 277 nvidia,tristate = <TEGRA_PIN_DISABLE>;
247 nvidia,enable-input = <1>; 278 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
248 }; 279 };
249 sdmmc4_clk_pcc4 { 280 sdmmc4_clk_pcc4 {
250 nvidia,pins = "sdmmc4_clk_pcc4"; 281 nvidia,pins = "sdmmc4_clk_pcc4";
251 nvidia,function = "sdmmc4"; 282 nvidia,function = "sdmmc4";
252 nvidia,pull = <0>; 283 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
253 nvidia,tristate = <0>; 284 nvidia,tristate = <TEGRA_PIN_DISABLE>;
254 nvidia,enable-input = <1>; 285 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
255 }; 286 };
256 sdmmc4_cmd_pt7 { 287 sdmmc4_cmd_pt7 {
257 nvidia,pins = "sdmmc4_cmd_pt7", 288 nvidia,pins = "sdmmc4_cmd_pt7",
@@ -264,16 +295,16 @@
264 "sdmmc4_dat6_paa6", 295 "sdmmc4_dat6_paa6",
265 "sdmmc4_dat7_paa7"; 296 "sdmmc4_dat7_paa7";
266 nvidia,function = "sdmmc4"; 297 nvidia,function = "sdmmc4";
267 nvidia,pull = <2>; 298 nvidia,pull = <TEGRA_PIN_PULL_UP>;
268 nvidia,tristate = <0>; 299 nvidia,tristate = <TEGRA_PIN_DISABLE>;
269 nvidia,enable-input = <1>; 300 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
270 }; 301 };
271 clk_32k_out_pa0 { 302 clk_32k_out_pa0 {
272 nvidia,pins = "clk_32k_out_pa0"; 303 nvidia,pins = "clk_32k_out_pa0";
273 nvidia,function = "blink"; 304 nvidia,function = "blink";
274 nvidia,pull = <0>; 305 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
275 nvidia,tristate = <0>; 306 nvidia,tristate = <TEGRA_PIN_DISABLE>;
276 nvidia,enable-input = <0>; 307 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
277 }; 308 };
278 kb_col0_pq0 { 309 kb_col0_pq0 {
279 nvidia,pins = "kb_col0_pq0", 310 nvidia,pins = "kb_col0_pq0",
@@ -283,265 +314,265 @@
283 "kb_row1_pr1", 314 "kb_row1_pr1",
284 "kb_row2_pr2"; 315 "kb_row2_pr2";
285 nvidia,function = "kbc"; 316 nvidia,function = "kbc";
286 nvidia,pull = <2>; 317 nvidia,pull = <TEGRA_PIN_PULL_UP>;
287 nvidia,tristate = <0>; 318 nvidia,tristate = <TEGRA_PIN_DISABLE>;
288 nvidia,enable-input = <1>; 319 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
289 }; 320 };
290 dap3_din_pp1 { 321 dap3_din_pp1 {
291 nvidia,pins = "dap3_din_pp1", 322 nvidia,pins = "dap3_din_pp1",
292 "dap3_sclk_pp3"; 323 "dap3_sclk_pp3";
293 nvidia,function = "displayb"; 324 nvidia,function = "displayb";
294 nvidia,pull = <0>; 325 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
295 nvidia,tristate = <1>; 326 nvidia,tristate = <TEGRA_PIN_ENABLE>;
296 nvidia,enable-input = <0>; 327 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
297 }; 328 };
298 pv0 { 329 pv0 {
299 nvidia,pins = "pv0"; 330 nvidia,pins = "pv0";
300 nvidia,function = "rsvd4"; 331 nvidia,function = "rsvd4";
301 nvidia,pull = <0>; 332 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
302 nvidia,tristate = <1>; 333 nvidia,tristate = <TEGRA_PIN_ENABLE>;
303 nvidia,enable-input = <0>; 334 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
304 }; 335 };
305 kb_row7_pr7 { 336 kb_row7_pr7 {
306 nvidia,pins = "kb_row7_pr7"; 337 nvidia,pins = "kb_row7_pr7";
307 nvidia,function = "rsvd2"; 338 nvidia,function = "rsvd2";
308 nvidia,pull = <2>; 339 nvidia,pull = <TEGRA_PIN_PULL_UP>;
309 nvidia,tristate = <0>; 340 nvidia,tristate = <TEGRA_PIN_DISABLE>;
310 nvidia,enable-input = <1>; 341 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
311 }; 342 };
312 kb_row10_ps2 { 343 kb_row10_ps2 {
313 nvidia,pins = "kb_row10_ps2"; 344 nvidia,pins = "kb_row10_ps2";
314 nvidia,function = "uarta"; 345 nvidia,function = "uarta";
315 nvidia,pull = <0>; 346 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
316 nvidia,tristate = <1>; 347 nvidia,tristate = <TEGRA_PIN_ENABLE>;
317 nvidia,enable-input = <1>; 348 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
318 }; 349 };
319 kb_row9_ps1 { 350 kb_row9_ps1 {
320 nvidia,pins = "kb_row9_ps1"; 351 nvidia,pins = "kb_row9_ps1";
321 nvidia,function = "uarta"; 352 nvidia,function = "uarta";
322 nvidia,pull = <0>; 353 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
323 nvidia,tristate = <0>; 354 nvidia,tristate = <TEGRA_PIN_DISABLE>;
324 nvidia,enable-input = <0>; 355 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
325 }; 356 };
326 pwr_i2c_scl_pz6 { 357 pwr_i2c_scl_pz6 {
327 nvidia,pins = "pwr_i2c_scl_pz6", 358 nvidia,pins = "pwr_i2c_scl_pz6",
328 "pwr_i2c_sda_pz7"; 359 "pwr_i2c_sda_pz7";
329 nvidia,function = "i2cpwr"; 360 nvidia,function = "i2cpwr";
330 nvidia,pull = <0>; 361 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
331 nvidia,tristate = <0>; 362 nvidia,tristate = <TEGRA_PIN_DISABLE>;
332 nvidia,enable-input = <1>; 363 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
333 nvidia,lock = <0>; 364 nvidia,lock = <TEGRA_PIN_DISABLE>;
334 nvidia,open-drain = <0>; 365 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
335 }; 366 };
336 sys_clk_req_pz5 { 367 sys_clk_req_pz5 {
337 nvidia,pins = "sys_clk_req_pz5"; 368 nvidia,pins = "sys_clk_req_pz5";
338 nvidia,function = "sysclk"; 369 nvidia,function = "sysclk";
339 nvidia,pull = <0>; 370 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
340 nvidia,tristate = <0>; 371 nvidia,tristate = <TEGRA_PIN_DISABLE>;
341 nvidia,enable-input = <0>; 372 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
342 }; 373 };
343 core_pwr_req { 374 core_pwr_req {
344 nvidia,pins = "core_pwr_req"; 375 nvidia,pins = "core_pwr_req";
345 nvidia,function = "pwron"; 376 nvidia,function = "pwron";
346 nvidia,pull = <0>; 377 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
347 nvidia,tristate = <0>; 378 nvidia,tristate = <TEGRA_PIN_DISABLE>;
348 nvidia,enable-input = <0>; 379 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
349 }; 380 };
350 cpu_pwr_req { 381 cpu_pwr_req {
351 nvidia,pins = "cpu_pwr_req"; 382 nvidia,pins = "cpu_pwr_req";
352 nvidia,function = "cpu"; 383 nvidia,function = "cpu";
353 nvidia,pull = <0>; 384 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
354 nvidia,tristate = <0>; 385 nvidia,tristate = <TEGRA_PIN_DISABLE>;
355 nvidia,enable-input = <0>; 386 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
356 }; 387 };
357 pwr_int_n { 388 pwr_int_n {
358 nvidia,pins = "pwr_int_n"; 389 nvidia,pins = "pwr_int_n";
359 nvidia,function = "pmi"; 390 nvidia,function = "pmi";
360 nvidia,pull = <0>; 391 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
361 nvidia,tristate = <1>; 392 nvidia,tristate = <TEGRA_PIN_ENABLE>;
362 nvidia,enable-input = <1>; 393 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
363 }; 394 };
364 reset_out_n { 395 reset_out_n {
365 nvidia,pins = "reset_out_n"; 396 nvidia,pins = "reset_out_n";
366 nvidia,function = "reset_out_n"; 397 nvidia,function = "reset_out_n";
367 nvidia,pull = <0>; 398 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
368 nvidia,tristate = <0>; 399 nvidia,tristate = <TEGRA_PIN_DISABLE>;
369 nvidia,enable-input = <0>; 400 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
370 }; 401 };
371 clk3_out_pee0 { 402 clk3_out_pee0 {
372 nvidia,pins = "clk3_out_pee0"; 403 nvidia,pins = "clk3_out_pee0";
373 nvidia,function = "extperiph3"; 404 nvidia,function = "extperiph3";
374 nvidia,pull = <0>; 405 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
375 nvidia,tristate = <0>; 406 nvidia,tristate = <TEGRA_PIN_DISABLE>;
376 nvidia,enable-input = <0>; 407 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
377 }; 408 };
378 gen1_i2c_scl_pc4 { 409 gen1_i2c_scl_pc4 {
379 nvidia,pins = "gen1_i2c_scl_pc4", 410 nvidia,pins = "gen1_i2c_scl_pc4",
380 "gen1_i2c_sda_pc5"; 411 "gen1_i2c_sda_pc5";
381 nvidia,function = "i2c1"; 412 nvidia,function = "i2c1";
382 nvidia,pull = <0>; 413 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
383 nvidia,tristate = <0>; 414 nvidia,tristate = <TEGRA_PIN_DISABLE>;
384 nvidia,enable-input = <1>; 415 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
385 nvidia,lock = <0>; 416 nvidia,lock = <TEGRA_PIN_DISABLE>;
386 nvidia,open-drain = <0>; 417 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
387 }; 418 };
388 uart2_cts_n_pj5 { 419 uart2_cts_n_pj5 {
389 nvidia,pins = "uart2_cts_n_pj5"; 420 nvidia,pins = "uart2_cts_n_pj5";
390 nvidia,function = "uartb"; 421 nvidia,function = "uartb";
391 nvidia,pull = <0>; 422 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
392 nvidia,tristate = <1>; 423 nvidia,tristate = <TEGRA_PIN_ENABLE>;
393 nvidia,enable-input = <1>; 424 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
394 }; 425 };
395 uart2_rts_n_pj6 { 426 uart2_rts_n_pj6 {
396 nvidia,pins = "uart2_rts_n_pj6"; 427 nvidia,pins = "uart2_rts_n_pj6";
397 nvidia,function = "uartb"; 428 nvidia,function = "uartb";
398 nvidia,pull = <0>; 429 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
399 nvidia,tristate = <0>; 430 nvidia,tristate = <TEGRA_PIN_DISABLE>;
400 nvidia,enable-input = <0>; 431 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
401 }; 432 };
402 uart2_rxd_pc3 { 433 uart2_rxd_pc3 {
403 nvidia,pins = "uart2_rxd_pc3"; 434 nvidia,pins = "uart2_rxd_pc3";
404 nvidia,function = "irda"; 435 nvidia,function = "irda";
405 nvidia,pull = <0>; 436 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
406 nvidia,tristate = <1>; 437 nvidia,tristate = <TEGRA_PIN_ENABLE>;
407 nvidia,enable-input = <1>; 438 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
408 }; 439 };
409 uart2_txd_pc2 { 440 uart2_txd_pc2 {
410 nvidia,pins = "uart2_txd_pc2"; 441 nvidia,pins = "uart2_txd_pc2";
411 nvidia,function = "irda"; 442 nvidia,function = "irda";
412 nvidia,pull = <0>; 443 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
413 nvidia,tristate = <0>; 444 nvidia,tristate = <TEGRA_PIN_DISABLE>;
414 nvidia,enable-input = <0>; 445 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
415 }; 446 };
416 uart3_cts_n_pa1 { 447 uart3_cts_n_pa1 {
417 nvidia,pins = "uart3_cts_n_pa1", 448 nvidia,pins = "uart3_cts_n_pa1",
418 "uart3_rxd_pw7"; 449 "uart3_rxd_pw7";
419 nvidia,function = "uartc"; 450 nvidia,function = "uartc";
420 nvidia,pull = <0>; 451 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
421 nvidia,tristate = <1>; 452 nvidia,tristate = <TEGRA_PIN_ENABLE>;
422 nvidia,enable-input = <1>; 453 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
423 }; 454 };
424 uart3_rts_n_pc0 { 455 uart3_rts_n_pc0 {
425 nvidia,pins = "uart3_rts_n_pc0", 456 nvidia,pins = "uart3_rts_n_pc0",
426 "uart3_txd_pw6"; 457 "uart3_txd_pw6";
427 nvidia,function = "uartc"; 458 nvidia,function = "uartc";
428 nvidia,pull = <0>; 459 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
429 nvidia,tristate = <0>; 460 nvidia,tristate = <TEGRA_PIN_DISABLE>;
430 nvidia,enable-input = <0>; 461 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
431 }; 462 };
432 owr { 463 owr {
433 nvidia,pins = "owr"; 464 nvidia,pins = "owr";
434 nvidia,function = "owr"; 465 nvidia,function = "owr";
435 nvidia,pull = <0>; 466 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
436 nvidia,tristate = <0>; 467 nvidia,tristate = <TEGRA_PIN_DISABLE>;
437 nvidia,enable-input = <1>; 468 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
438 }; 469 };
439 hdmi_cec_pee3 { 470 hdmi_cec_pee3 {
440 nvidia,pins = "hdmi_cec_pee3"; 471 nvidia,pins = "hdmi_cec_pee3";
441 nvidia,function = "cec"; 472 nvidia,function = "cec";
442 nvidia,pull = <0>; 473 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
443 nvidia,tristate = <0>; 474 nvidia,tristate = <TEGRA_PIN_DISABLE>;
444 nvidia,enable-input = <1>; 475 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
445 nvidia,lock = <0>; 476 nvidia,lock = <TEGRA_PIN_DISABLE>;
446 nvidia,open-drain = <0>; 477 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
447 }; 478 };
448 ddc_scl_pv4 { 479 ddc_scl_pv4 {
449 nvidia,pins = "ddc_scl_pv4", 480 nvidia,pins = "ddc_scl_pv4",
450 "ddc_sda_pv5"; 481 "ddc_sda_pv5";
451 nvidia,function = "i2c4"; 482 nvidia,function = "i2c4";
452 nvidia,pull = <0>; 483 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
453 nvidia,tristate = <0>; 484 nvidia,tristate = <TEGRA_PIN_DISABLE>;
454 nvidia,enable-input = <1>; 485 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
455 nvidia,lock = <0>; 486 nvidia,lock = <TEGRA_PIN_DISABLE>;
456 nvidia,rcv-sel = <1>; 487 nvidia,rcv-sel = <TEGRA_PIN_ENABLE>;
457 }; 488 };
458 spdif_in_pk6 { 489 spdif_in_pk6 {
459 nvidia,pins = "spdif_in_pk6"; 490 nvidia,pins = "spdif_in_pk6";
460 nvidia,function = "usb"; 491 nvidia,function = "usb";
461 nvidia,pull = <2>; 492 nvidia,pull = <TEGRA_PIN_PULL_UP>;
462 nvidia,tristate = <0>; 493 nvidia,tristate = <TEGRA_PIN_DISABLE>;
463 nvidia,enable-input = <1>; 494 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
464 nvidia,lock = <0>; 495 nvidia,lock = <TEGRA_PIN_DISABLE>;
465 }; 496 };
466 usb_vbus_en0_pn4 { 497 usb_vbus_en0_pn4 {
467 nvidia,pins = "usb_vbus_en0_pn4"; 498 nvidia,pins = "usb_vbus_en0_pn4";
468 nvidia,function = "usb"; 499 nvidia,function = "usb";
469 nvidia,pull = <2>; 500 nvidia,pull = <TEGRA_PIN_PULL_UP>;
470 nvidia,tristate = <0>; 501 nvidia,tristate = <TEGRA_PIN_DISABLE>;
471 nvidia,enable-input = <1>; 502 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
472 nvidia,lock = <0>; 503 nvidia,lock = <TEGRA_PIN_DISABLE>;
473 nvidia,open-drain = <1>; 504 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
474 }; 505 };
475 gpio_x6_aud_px6 { 506 gpio_x6_aud_px6 {
476 nvidia,pins = "gpio_x6_aud_px6"; 507 nvidia,pins = "gpio_x6_aud_px6";
477 nvidia,function = "spi6"; 508 nvidia,function = "spi6";
478 nvidia,pull = <2>; 509 nvidia,pull = <TEGRA_PIN_PULL_UP>;
479 nvidia,tristate = <1>; 510 nvidia,tristate = <TEGRA_PIN_ENABLE>;
480 nvidia,enable-input = <1>; 511 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
481 }; 512 };
482 gpio_x4_aud_px4 { 513 gpio_x4_aud_px4 {
483 nvidia,pins = "gpio_x4_aud_px4", 514 nvidia,pins = "gpio_x4_aud_px4",
484 "gpio_x7_aud_px7"; 515 "gpio_x7_aud_px7";
485 nvidia,function = "rsvd1"; 516 nvidia,function = "rsvd1";
486 nvidia,pull = <1>; 517 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
487 nvidia,tristate = <0>; 518 nvidia,tristate = <TEGRA_PIN_DISABLE>;
488 nvidia,enable-input = <0>; 519 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
489 }; 520 };
490 gpio_x5_aud_px5 { 521 gpio_x5_aud_px5 {
491 nvidia,pins = "gpio_x5_aud_px5"; 522 nvidia,pins = "gpio_x5_aud_px5";
492 nvidia,function = "rsvd1"; 523 nvidia,function = "rsvd1";
493 nvidia,pull = <2>; 524 nvidia,pull = <TEGRA_PIN_PULL_UP>;
494 nvidia,tristate = <0>; 525 nvidia,tristate = <TEGRA_PIN_DISABLE>;
495 nvidia,enable-input = <1>; 526 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
496 }; 527 };
497 gpio_w2_aud_pw2 { 528 gpio_w2_aud_pw2 {
498 nvidia,pins = "gpio_w2_aud_pw2"; 529 nvidia,pins = "gpio_w2_aud_pw2";
499 nvidia,function = "rsvd2"; 530 nvidia,function = "rsvd2";
500 nvidia,pull = <2>; 531 nvidia,pull = <TEGRA_PIN_PULL_UP>;
501 nvidia,tristate = <0>; 532 nvidia,tristate = <TEGRA_PIN_DISABLE>;
502 nvidia,enable-input = <1>; 533 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
503 }; 534 };
504 gpio_w3_aud_pw3 { 535 gpio_w3_aud_pw3 {
505 nvidia,pins = "gpio_w3_aud_pw3"; 536 nvidia,pins = "gpio_w3_aud_pw3";
506 nvidia,function = "spi6"; 537 nvidia,function = "spi6";
507 nvidia,pull = <2>; 538 nvidia,pull = <TEGRA_PIN_PULL_UP>;
508 nvidia,tristate = <0>; 539 nvidia,tristate = <TEGRA_PIN_DISABLE>;
509 nvidia,enable-input = <1>; 540 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
510 }; 541 };
511 gpio_x1_aud_px1 { 542 gpio_x1_aud_px1 {
512 nvidia,pins = "gpio_x1_aud_px1"; 543 nvidia,pins = "gpio_x1_aud_px1";
513 nvidia,function = "rsvd4"; 544 nvidia,function = "rsvd4";
514 nvidia,pull = <1>; 545 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
515 nvidia,tristate = <0>; 546 nvidia,tristate = <TEGRA_PIN_DISABLE>;
516 nvidia,enable-input = <1>; 547 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
517 }; 548 };
518 gpio_x3_aud_px3 { 549 gpio_x3_aud_px3 {
519 nvidia,pins = "gpio_x3_aud_px3"; 550 nvidia,pins = "gpio_x3_aud_px3";
520 nvidia,function = "rsvd4"; 551 nvidia,function = "rsvd4";
521 nvidia,pull = <2>; 552 nvidia,pull = <TEGRA_PIN_PULL_UP>;
522 nvidia,tristate = <0>; 553 nvidia,tristate = <TEGRA_PIN_DISABLE>;
523 nvidia,enable-input = <1>; 554 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
524 }; 555 };
525 dap3_fs_pp0 { 556 dap3_fs_pp0 {
526 nvidia,pins = "dap3_fs_pp0"; 557 nvidia,pins = "dap3_fs_pp0";
527 nvidia,function = "i2s2"; 558 nvidia,function = "i2s2";
528 nvidia,pull = <1>; 559 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
529 nvidia,tristate = <0>; 560 nvidia,tristate = <TEGRA_PIN_DISABLE>;
530 nvidia,enable-input = <0>; 561 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
531 }; 562 };
532 dap3_dout_pp2 { 563 dap3_dout_pp2 {
533 nvidia,pins = "dap3_dout_pp2"; 564 nvidia,pins = "dap3_dout_pp2";
534 nvidia,function = "i2s2"; 565 nvidia,function = "i2s2";
535 nvidia,pull = <1>; 566 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
536 nvidia,tristate = <0>; 567 nvidia,tristate = <TEGRA_PIN_DISABLE>;
537 nvidia,enable-input = <0>; 568 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
538 }; 569 };
539 pv1 { 570 pv1 {
540 nvidia,pins = "pv1"; 571 nvidia,pins = "pv1";
541 nvidia,function = "rsvd1"; 572 nvidia,function = "rsvd1";
542 nvidia,pull = <0>; 573 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
543 nvidia,tristate = <0>; 574 nvidia,tristate = <TEGRA_PIN_DISABLE>;
544 nvidia,enable-input = <1>; 575 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
545 }; 576 };
546 pbb3 { 577 pbb3 {
547 nvidia,pins = "pbb3", 578 nvidia,pins = "pbb3",
@@ -549,25 +580,25 @@
549 "pbb6", 580 "pbb6",
550 "pbb7"; 581 "pbb7";
551 nvidia,function = "rsvd4"; 582 nvidia,function = "rsvd4";
552 nvidia,pull = <1>; 583 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
553 nvidia,tristate = <0>; 584 nvidia,tristate = <TEGRA_PIN_DISABLE>;
554 nvidia,enable-input = <0>; 585 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
555 }; 586 };
556 pcc1 { 587 pcc1 {
557 nvidia,pins = "pcc1", 588 nvidia,pins = "pcc1",
558 "pcc2"; 589 "pcc2";
559 nvidia,function = "rsvd4"; 590 nvidia,function = "rsvd4";
560 nvidia,pull = <1>; 591 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
561 nvidia,tristate = <0>; 592 nvidia,tristate = <TEGRA_PIN_DISABLE>;
562 nvidia,enable-input = <1>; 593 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
563 }; 594 };
564 gmi_ad0_pg0 { 595 gmi_ad0_pg0 {
565 nvidia,pins = "gmi_ad0_pg0", 596 nvidia,pins = "gmi_ad0_pg0",
566 "gmi_ad1_pg1"; 597 "gmi_ad1_pg1";
567 nvidia,function = "gmi"; 598 nvidia,function = "gmi";
568 nvidia,pull = <0>; 599 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
569 nvidia,tristate = <0>; 600 nvidia,tristate = <TEGRA_PIN_DISABLE>;
570 nvidia,enable-input = <0>; 601 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
571 }; 602 };
572 gmi_ad10_ph2 { 603 gmi_ad10_ph2 {
573 nvidia,pins = "gmi_ad10_ph2", 604 nvidia,pins = "gmi_ad10_ph2",
@@ -576,17 +607,17 @@
576 "gmi_ad8_ph0", 607 "gmi_ad8_ph0",
577 "gmi_clk_pk1"; 608 "gmi_clk_pk1";
578 nvidia,function = "gmi"; 609 nvidia,function = "gmi";
579 nvidia,pull = <1>; 610 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
580 nvidia,tristate = <0>; 611 nvidia,tristate = <TEGRA_PIN_DISABLE>;
581 nvidia,enable-input = <0>; 612 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
582 }; 613 };
583 gmi_ad2_pg2 { 614 gmi_ad2_pg2 {
584 nvidia,pins = "gmi_ad2_pg2", 615 nvidia,pins = "gmi_ad2_pg2",
585 "gmi_ad3_pg3"; 616 "gmi_ad3_pg3";
586 nvidia,function = "gmi"; 617 nvidia,function = "gmi";
587 nvidia,pull = <0>; 618 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
588 nvidia,tristate = <0>; 619 nvidia,tristate = <TEGRA_PIN_DISABLE>;
589 nvidia,enable-input = <1>; 620 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
590 }; 621 };
591 gmi_adv_n_pk0 { 622 gmi_adv_n_pk0 {
592 nvidia,pins = "gmi_adv_n_pk0", 623 nvidia,pins = "gmi_adv_n_pk0",
@@ -598,39 +629,39 @@
598 "gmi_iordy_pi5", 629 "gmi_iordy_pi5",
599 "gmi_wp_n_pc7"; 630 "gmi_wp_n_pc7";
600 nvidia,function = "gmi"; 631 nvidia,function = "gmi";
601 nvidia,pull = <2>; 632 nvidia,pull = <TEGRA_PIN_PULL_UP>;
602 nvidia,tristate = <0>; 633 nvidia,tristate = <TEGRA_PIN_DISABLE>;
603 nvidia,enable-input = <1>; 634 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
604 }; 635 };
605 gmi_cs3_n_pk4 { 636 gmi_cs3_n_pk4 {
606 nvidia,pins = "gmi_cs3_n_pk4"; 637 nvidia,pins = "gmi_cs3_n_pk4";
607 nvidia,function = "gmi"; 638 nvidia,function = "gmi";
608 nvidia,pull = <2>; 639 nvidia,pull = <TEGRA_PIN_PULL_UP>;
609 nvidia,tristate = <0>; 640 nvidia,tristate = <TEGRA_PIN_DISABLE>;
610 nvidia,enable-input = <0>; 641 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
611 }; 642 };
612 clk2_req_pcc5 { 643 clk2_req_pcc5 {
613 nvidia,pins = "clk2_req_pcc5"; 644 nvidia,pins = "clk2_req_pcc5";
614 nvidia,function = "rsvd4"; 645 nvidia,function = "rsvd4";
615 nvidia,pull = <0>; 646 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
616 nvidia,tristate = <0>; 647 nvidia,tristate = <TEGRA_PIN_DISABLE>;
617 nvidia,enable-input = <0>; 648 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
618 }; 649 };
619 kb_col3_pq3 { 650 kb_col3_pq3 {
620 nvidia,pins = "kb_col3_pq3", 651 nvidia,pins = "kb_col3_pq3",
621 "kb_col6_pq6", 652 "kb_col6_pq6",
622 "kb_col7_pq7"; 653 "kb_col7_pq7";
623 nvidia,function = "kbc"; 654 nvidia,function = "kbc";
624 nvidia,pull = <2>; 655 nvidia,pull = <TEGRA_PIN_PULL_UP>;
625 nvidia,tristate = <0>; 656 nvidia,tristate = <TEGRA_PIN_DISABLE>;
626 nvidia,enable-input = <0>; 657 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
627 }; 658 };
628 kb_col5_pq5 { 659 kb_col5_pq5 {
629 nvidia,pins = "kb_col5_pq5"; 660 nvidia,pins = "kb_col5_pq5";
630 nvidia,function = "kbc"; 661 nvidia,function = "kbc";
631 nvidia,pull = <2>; 662 nvidia,pull = <TEGRA_PIN_PULL_UP>;
632 nvidia,tristate = <0>; 663 nvidia,tristate = <TEGRA_PIN_DISABLE>;
633 nvidia,enable-input = <1>; 664 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
634 }; 665 };
635 kb_row3_pr3 { 666 kb_row3_pr3 {
636 nvidia,pins = "kb_row3_pr3", 667 nvidia,pins = "kb_row3_pr3",
@@ -638,77 +669,77 @@
638 "kb_row6_pr6", 669 "kb_row6_pr6",
639 "kb_row8_ps0"; 670 "kb_row8_ps0";
640 nvidia,function = "kbc"; 671 nvidia,function = "kbc";
641 nvidia,pull = <1>; 672 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
642 nvidia,tristate = <0>; 673 nvidia,tristate = <TEGRA_PIN_DISABLE>;
643 nvidia,enable-input = <1>; 674 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
644 }; 675 };
645 clk3_req_pee1 { 676 clk3_req_pee1 {
646 nvidia,pins = "clk3_req_pee1"; 677 nvidia,pins = "clk3_req_pee1";
647 nvidia,function = "rsvd4"; 678 nvidia,function = "rsvd4";
648 nvidia,pull = <0>; 679 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
649 nvidia,tristate = <0>; 680 nvidia,tristate = <TEGRA_PIN_DISABLE>;
650 nvidia,enable-input = <0>; 681 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
651 }; 682 };
652 pu4 { 683 pu4 {
653 nvidia,pins = "pu4"; 684 nvidia,pins = "pu4";
654 nvidia,function = "displayb"; 685 nvidia,function = "displayb";
655 nvidia,pull = <0>; 686 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
656 nvidia,tristate = <0>; 687 nvidia,tristate = <TEGRA_PIN_DISABLE>;
657 nvidia,enable-input = <0>; 688 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
658 }; 689 };
659 pu5 { 690 pu5 {
660 nvidia,pins = "pu5", 691 nvidia,pins = "pu5",
661 "pu6"; 692 "pu6";
662 nvidia,function = "displayb"; 693 nvidia,function = "displayb";
663 nvidia,pull = <0>; 694 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
664 nvidia,tristate = <0>; 695 nvidia,tristate = <TEGRA_PIN_DISABLE>;
665 nvidia,enable-input = <1>; 696 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
666 }; 697 };
667 hdmi_int_pn7 { 698 hdmi_int_pn7 {
668 nvidia,pins = "hdmi_int_pn7"; 699 nvidia,pins = "hdmi_int_pn7";
669 nvidia,function = "rsvd1"; 700 nvidia,function = "rsvd1";
670 nvidia,pull = <1>; 701 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
671 nvidia,tristate = <0>; 702 nvidia,tristate = <TEGRA_PIN_DISABLE>;
672 nvidia,enable-input = <1>; 703 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
673 }; 704 };
674 clk1_req_pee2 { 705 clk1_req_pee2 {
675 nvidia,pins = "clk1_req_pee2", 706 nvidia,pins = "clk1_req_pee2",
676 "usb_vbus_en1_pn5"; 707 "usb_vbus_en1_pn5";
677 nvidia,function = "rsvd4"; 708 nvidia,function = "rsvd4";
678 nvidia,pull = <1>; 709 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
679 nvidia,tristate = <1>; 710 nvidia,tristate = <TEGRA_PIN_ENABLE>;
680 nvidia,enable-input = <0>; 711 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
681 }; 712 };
682 713
683 drive_sdio1 { 714 drive_sdio1 {
684 nvidia,pins = "drive_sdio1"; 715 nvidia,pins = "drive_sdio1";
685 nvidia,high-speed-mode = <1>; 716 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
686 nvidia,schmitt = <0>; 717 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
687 nvidia,low-power-mode = <3>; 718 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
688 nvidia,pull-down-strength = <36>; 719 nvidia,pull-down-strength = <36>;
689 nvidia,pull-up-strength = <20>; 720 nvidia,pull-up-strength = <20>;
690 nvidia,slew-rate-rising = <2>; 721 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOW>;
691 nvidia,slew-rate-falling = <2>; 722 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOW>;
692 }; 723 };
693 drive_sdio3 { 724 drive_sdio3 {
694 nvidia,pins = "drive_sdio3"; 725 nvidia,pins = "drive_sdio3";
695 nvidia,high-speed-mode = <1>; 726 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
696 nvidia,schmitt = <0>; 727 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
697 nvidia,low-power-mode = <3>; 728 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
698 nvidia,pull-down-strength = <22>; 729 nvidia,pull-down-strength = <22>;
699 nvidia,pull-up-strength = <36>; 730 nvidia,pull-up-strength = <36>;
700 nvidia,slew-rate-rising = <0>; 731 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
701 nvidia,slew-rate-falling = <0>; 732 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
702 }; 733 };
703 drive_gma { 734 drive_gma {
704 nvidia,pins = "drive_gma"; 735 nvidia,pins = "drive_gma";
705 nvidia,high-speed-mode = <1>; 736 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
706 nvidia,schmitt = <0>; 737 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
707 nvidia,low-power-mode = <3>; 738 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
708 nvidia,pull-down-strength = <2>; 739 nvidia,pull-down-strength = <2>;
709 nvidia,pull-up-strength = <1>; 740 nvidia,pull-up-strength = <1>;
710 nvidia,slew-rate-rising = <0>; 741 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
711 nvidia,slew-rate-falling = <0>; 742 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
712 nvidia,drive-type = <1>; 743 nvidia,drive-type = <1>;
713 }; 744 };
714 }; 745 };
@@ -718,11 +749,15 @@
718 status = "okay"; 749 status = "okay";
719 }; 750 };
720 751
752 pwm@7000a000 {
753 status = "okay";
754 };
755
721 i2c@7000c000 { 756 i2c@7000c000 {
722 status = "okay"; 757 status = "okay";
723 clock-frequency = <100000>; 758 clock-frequency = <100000>;
724 759
725 battery: smart-battery { 760 battery: smart-battery@b {
726 compatible = "ti,bq20z45", "sbs,sbs-battery"; 761 compatible = "ti,bq20z45", "sbs,sbs-battery";
727 reg = <0xb>; 762 reg = <0xb>;
728 battery-name = "battery"; 763 battery-name = "battery";
@@ -731,7 +766,7 @@
731 power-supplies = <&charger>; 766 power-supplies = <&charger>;
732 }; 767 };
733 768
734 rt5640: rt5640 { 769 rt5640: rt5640@1c {
735 compatible = "realtek,rt5640"; 770 compatible = "realtek,rt5640";
736 reg = <0x1c>; 771 reg = <0x1c>;
737 interrupt-parent = <&gpio>; 772 interrupt-parent = <&gpio>;
@@ -749,11 +784,15 @@
749 }; 784 };
750 }; 785 };
751 786
787 hdmi_ddc: i2c@7000c700 {
788 status = "okay";
789 };
790
752 i2c@7000d000 { 791 i2c@7000d000 {
753 status = "okay"; 792 status = "okay";
754 clock-frequency = <400000>; 793 clock-frequency = <400000>;
755 794
756 tps51632 { 795 tps51632@43 {
757 compatible = "ti,tps51632"; 796 compatible = "ti,tps51632";
758 reg = <0x43>; 797 reg = <0x43>;
759 regulator-name = "vdd-cpu"; 798 regulator-name = "vdd-cpu";
@@ -763,7 +802,7 @@
763 regulator-always-on; 802 regulator-always-on;
764 }; 803 };
765 804
766 tps65090 { 805 tps65090@48 {
767 compatible = "ti,tps65090"; 806 compatible = "ti,tps65090";
768 reg = <0x48>; 807 reg = <0x48>;
769 interrupt-parent = <&gpio>; 808 interrupt-parent = <&gpio>;
@@ -806,7 +845,7 @@
806 regulator-boot-on; 845 regulator-boot-on;
807 }; 846 };
808 847
809 fet1 { 848 vdd_bl_reg: fet1 {
810 regulator-name = "vdd-lcd-bl"; 849 regulator-name = "vdd-lcd-bl";
811 }; 850 };
812 851
@@ -814,7 +853,7 @@
814 regulator-name = "vdd-modem-3v3"; 853 regulator-name = "vdd-modem-3v3";
815 }; 854 };
816 855
817 fet4 { 856 avdd_lcd_reg: fet4 {
818 regulator-name = "avdd-lcd"; 857 regulator-name = "avdd-lcd";
819 }; 858 };
820 859
@@ -846,7 +885,7 @@
846 }; 885 };
847 }; 886 };
848 887
849 palmas: tps65913 { 888 palmas: tps65913@58 {
850 compatible = "ti,palmas"; 889 compatible = "ti,palmas";
851 reg = <0x58>; 890 reg = <0x58>;
852 interrupts = <0 86 IRQ_TYPE_LEVEL_LOW>; 891 interrupts = <0 86 IRQ_TYPE_LEVEL_LOW>;
@@ -1046,7 +1085,7 @@
1046 }; 1085 };
1047 }; 1086 };
1048 1087
1049 pmc { 1088 pmc@7000e400 {
1050 nvidia,invert-interrupt; 1089 nvidia,invert-interrupt;
1051 nvidia,suspend-mode = <1>; 1090 nvidia,suspend-mode = <1>;
1052 nvidia,cpu-pwr-good-time = <500>; 1091 nvidia,cpu-pwr-good-time = <500>;
@@ -1057,7 +1096,7 @@
1057 nvidia,sys-clock-req-active-high; 1096 nvidia,sys-clock-req-active-high;
1058 }; 1097 };
1059 1098
1060 ahub { 1099 ahub@70080000 {
1061 i2s@70080400 { 1100 i2s@70080400 {
1062 status = "okay"; 1101 status = "okay";
1063 }; 1102 };
@@ -1084,12 +1123,23 @@
1084 vbus-supply = <&usb3_vbus_reg>; 1123 vbus-supply = <&usb3_vbus_reg>;
1085 }; 1124 };
1086 1125
1126 backlight: backlight {
1127 compatible = "pwm-backlight";
1128
1129 enable-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
1130 power-supply = <&vdd_bl_reg>;
1131 pwms = <&pwm 1 1000000>;
1132
1133 brightness-levels = <0 4 8 16 32 64 128 255>;
1134 default-brightness-level = <6>;
1135 };
1136
1087 clocks { 1137 clocks {
1088 compatible = "simple-bus"; 1138 compatible = "simple-bus";
1089 #address-cells = <1>; 1139 #address-cells = <1>;
1090 #size-cells = <0>; 1140 #size-cells = <0>;
1091 1141
1092 clk32k_in: clock { 1142 clk32k_in: clock@0 {
1093 compatible = "fixed-clock"; 1143 compatible = "fixed-clock";
1094 reg=<0>; 1144 reg=<0>;
1095 #clock-cells = <0>; 1145 #clock-cells = <0>;
@@ -1150,16 +1200,6 @@
1150 gpio = <&gpio TEGRA_GPIO(H, 5) GPIO_ACTIVE_HIGH>; 1200 gpio = <&gpio TEGRA_GPIO(H, 5) GPIO_ACTIVE_HIGH>;
1151 }; 1201 };
1152 1202
1153 lcd_bl_en_reg: regulator@2 {
1154 compatible = "regulator-fixed";
1155 reg = <2>;
1156 regulator-name = "lcd_bl_en";
1157 regulator-min-microvolt = <5000000>;
1158 regulator-max-microvolt = <5000000>;
1159 enable-active-high;
1160 gpio = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
1161 };
1162
1163 usb1_vbus_reg: regulator@3 { 1203 usb1_vbus_reg: regulator@3 {
1164 compatible = "regulator-fixed"; 1204 compatible = "regulator-fixed";
1165 reg = <3>; 1205 reg = <3>;
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 8d42787c8ff1..389e987ec281 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -1,5 +1,6 @@
1#include <dt-bindings/clock/tegra114-car.h> 1#include <dt-bindings/clock/tegra114-car.h>
2#include <dt-bindings/gpio/tegra-gpio.h> 2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/pinctrl/pinctrl-tegra.h>
3#include <dt-bindings/interrupt-controller/arm-gic.h> 4#include <dt-bindings/interrupt-controller/arm-gic.h>
4 5
5#include "skeleton.dtsi" 6#include "skeleton.dtsi"
@@ -15,7 +16,113 @@
15 serial3 = &uartd; 16 serial3 = &uartd;
16 }; 17 };
17 18
18 gic: interrupt-controller { 19 host1x@50000000 {
20 compatible = "nvidia,tegra114-host1x", "simple-bus";
21 reg = <0x50000000 0x00028000>;
22 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
23 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
24 clocks = <&tegra_car TEGRA114_CLK_HOST1X>;
25 resets = <&tegra_car 28>;
26 reset-names = "host1x";
27
28 #address-cells = <1>;
29 #size-cells = <1>;
30
31 ranges = <0x54000000 0x54000000 0x01000000>;
32
33 gr2d@54140000 {
34 compatible = "nvidia,tegra114-gr2d", "nvidia,tegra20-gr2d";
35 reg = <0x54140000 0x00040000>;
36 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
37 clocks = <&tegra_car TEGRA114_CLK_GR2D>;
38 resets = <&tegra_car 21>;
39 reset-names = "2d";
40 };
41
42 gr3d@54180000 {
43 compatible = "nvidia,tegra114-gr3d", "nvidia,tegra20-gr3d";
44 reg = <0x54180000 0x00040000>;
45 clocks = <&tegra_car TEGRA114_CLK_GR3D>;
46 resets = <&tegra_car 24>;
47 reset-names = "3d";
48 };
49
50 dc@54200000 {
51 compatible = "nvidia,tegra114-dc", "nvidia,tegra20-dc";
52 reg = <0x54200000 0x00040000>;
53 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
54 clocks = <&tegra_car TEGRA114_CLK_DISP1>,
55 <&tegra_car TEGRA114_CLK_PLL_P>;
56 clock-names = "dc", "parent";
57 resets = <&tegra_car 27>;
58 reset-names = "dc";
59
60 rgb {
61 status = "disabled";
62 };
63 };
64
65 dc@54240000 {
66 compatible = "nvidia,tegra114-dc", "nvidia,tegra20-dc";
67 reg = <0x54240000 0x00040000>;
68 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
69 clocks = <&tegra_car TEGRA114_CLK_DISP2>,
70 <&tegra_car TEGRA114_CLK_PLL_P>;
71 clock-names = "dc", "parent";
72 resets = <&tegra_car 26>;
73 reset-names = "dc";
74
75 rgb {
76 status = "disabled";
77 };
78 };
79
80 hdmi@54280000 {
81 compatible = "nvidia,tegra114-hdmi";
82 reg = <0x54280000 0x00040000>;
83 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
84 clocks = <&tegra_car TEGRA114_CLK_HDMI>,
85 <&tegra_car TEGRA114_CLK_PLL_D2_OUT0>;
86 clock-names = "hdmi", "parent";
87 resets = <&tegra_car 51>;
88 reset-names = "hdmi";
89 status = "disabled";
90 };
91
92 dsi@54300000 {
93 compatible = "nvidia,tegra114-dsi";
94 reg = <0x54300000 0x00040000>;
95 clocks = <&tegra_car TEGRA114_CLK_DSIA>,
96 <&tegra_car TEGRA114_CLK_DSIALP>,
97 <&tegra_car TEGRA114_CLK_PLL_D_OUT0>;
98 clock-names = "dsi", "lp", "parent";
99 resets = <&tegra_car 48>;
100 reset-names = "dsi";
101 nvidia,mipi-calibrate = <&mipi 0x060>; /* DSIA & DSIB pads */
102 status = "disabled";
103
104 #address-cells = <1>;
105 #size-cells = <0>;
106 };
107
108 dsi@54400000 {
109 compatible = "nvidia,tegra114-dsi";
110 reg = <0x54400000 0x00040000>;
111 clocks = <&tegra_car TEGRA114_CLK_DSIB>,
112 <&tegra_car TEGRA114_CLK_DSIBLP>,
113 <&tegra_car TEGRA114_CLK_PLL_D2_OUT0>;
114 clock-names = "dsi", "lp", "parent";
115 resets = <&tegra_car 82>;
116 reset-names = "dsi";
117 nvidia,mipi-calibrate = <&mipi 0x180>; /* DSIC & DSID pads */
118 status = "disabled";
119
120 #address-cells = <1>;
121 #size-cells = <0>;
122 };
123 };
124
125 gic: interrupt-controller@50041000 {
19 compatible = "arm,cortex-a15-gic"; 126 compatible = "arm,cortex-a15-gic";
20 #interrupt-cells = <3>; 127 #interrupt-cells = <3>;
21 interrupt-controller; 128 interrupt-controller;
@@ -39,13 +146,14 @@
39 clocks = <&tegra_car TEGRA114_CLK_TIMER>; 146 clocks = <&tegra_car TEGRA114_CLK_TIMER>;
40 }; 147 };
41 148
42 tegra_car: clock { 149 tegra_car: clock@60006000 {
43 compatible = "nvidia,tegra114-car"; 150 compatible = "nvidia,tegra114-car";
44 reg = <0x60006000 0x1000>; 151 reg = <0x60006000 0x1000>;
45 #clock-cells = <1>; 152 #clock-cells = <1>;
153 #reset-cells = <1>;
46 }; 154 };
47 155
48 apbdma: dma { 156 apbdma: dma@6000a000 {
49 compatible = "nvidia,tegra114-apbdma"; 157 compatible = "nvidia,tegra114-apbdma";
50 reg = <0x6000a000 0x1400>; 158 reg = <0x6000a000 0x1400>;
51 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, 159 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
@@ -81,14 +189,17 @@
81 <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, 189 <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
82 <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; 190 <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
83 clocks = <&tegra_car TEGRA114_CLK_APBDMA>; 191 clocks = <&tegra_car TEGRA114_CLK_APBDMA>;
192 resets = <&tegra_car 34>;
193 reset-names = "dma";
194 #dma-cells = <1>;
84 }; 195 };
85 196
86 ahb: ahb { 197 ahb: ahb@6000c004 {
87 compatible = "nvidia,tegra114-ahb", "nvidia,tegra30-ahb"; 198 compatible = "nvidia,tegra114-ahb", "nvidia,tegra30-ahb";
88 reg = <0x6000c004 0x14c>; 199 reg = <0x6000c004 0x14c>;
89 }; 200 };
90 201
91 gpio: gpio { 202 gpio: gpio@6000d000 {
92 compatible = "nvidia,tegra114-gpio", "nvidia,tegra30-gpio"; 203 compatible = "nvidia,tegra114-gpio", "nvidia,tegra30-gpio";
93 reg = <0x6000d000 0x1000>; 204 reg = <0x6000d000 0x1000>;
94 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, 205 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
@@ -105,7 +216,7 @@
105 interrupt-controller; 216 interrupt-controller;
106 }; 217 };
107 218
108 pinmux: pinmux { 219 pinmux: pinmux@70000868 {
109 compatible = "nvidia,tegra114-pinmux"; 220 compatible = "nvidia,tegra114-pinmux";
110 reg = <0x70000868 0x148 /* Pad control registers */ 221 reg = <0x70000868 0x148 /* Pad control registers */
111 0x70003000 0x40c>; /* Mux registers */ 222 0x70003000 0x40c>; /* Mux registers */
@@ -124,9 +235,12 @@
124 reg = <0x70006000 0x40>; 235 reg = <0x70006000 0x40>;
125 reg-shift = <2>; 236 reg-shift = <2>;
126 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; 237 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
127 nvidia,dma-request-selector = <&apbdma 8>;
128 status = "disabled";
129 clocks = <&tegra_car TEGRA114_CLK_UARTA>; 238 clocks = <&tegra_car TEGRA114_CLK_UARTA>;
239 resets = <&tegra_car 6>;
240 reset-names = "serial";
241 dmas = <&apbdma 8>, <&apbdma 8>;
242 dma-names = "rx", "tx";
243 status = "disabled";
130 }; 244 };
131 245
132 uartb: serial@70006040 { 246 uartb: serial@70006040 {
@@ -134,9 +248,12 @@
134 reg = <0x70006040 0x40>; 248 reg = <0x70006040 0x40>;
135 reg-shift = <2>; 249 reg-shift = <2>;
136 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; 250 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
137 nvidia,dma-request-selector = <&apbdma 9>;
138 status = "disabled";
139 clocks = <&tegra_car TEGRA114_CLK_UARTB>; 251 clocks = <&tegra_car TEGRA114_CLK_UARTB>;
252 resets = <&tegra_car 7>;
253 reset-names = "serial";
254 dmas = <&apbdma 9>, <&apbdma 9>;
255 dma-names = "rx", "tx";
256 status = "disabled";
140 }; 257 };
141 258
142 uartc: serial@70006200 { 259 uartc: serial@70006200 {
@@ -144,9 +261,12 @@
144 reg = <0x70006200 0x100>; 261 reg = <0x70006200 0x100>;
145 reg-shift = <2>; 262 reg-shift = <2>;
146 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 263 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
147 nvidia,dma-request-selector = <&apbdma 10>;
148 status = "disabled";
149 clocks = <&tegra_car TEGRA114_CLK_UARTC>; 264 clocks = <&tegra_car TEGRA114_CLK_UARTC>;
265 resets = <&tegra_car 55>;
266 reset-names = "serial";
267 dmas = <&apbdma 10>, <&apbdma 10>;
268 dma-names = "rx", "tx";
269 status = "disabled";
150 }; 270 };
151 271
152 uartd: serial@70006300 { 272 uartd: serial@70006300 {
@@ -154,16 +274,21 @@
154 reg = <0x70006300 0x100>; 274 reg = <0x70006300 0x100>;
155 reg-shift = <2>; 275 reg-shift = <2>;
156 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; 276 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
157 nvidia,dma-request-selector = <&apbdma 19>;
158 status = "disabled";
159 clocks = <&tegra_car TEGRA114_CLK_UARTD>; 277 clocks = <&tegra_car TEGRA114_CLK_UARTD>;
278 resets = <&tegra_car 65>;
279 reset-names = "serial";
280 dmas = <&apbdma 19>, <&apbdma 19>;
281 dma-names = "rx", "tx";
282 status = "disabled";
160 }; 283 };
161 284
162 pwm: pwm { 285 pwm: pwm@7000a000 {
163 compatible = "nvidia,tegra114-pwm", "nvidia,tegra20-pwm"; 286 compatible = "nvidia,tegra114-pwm", "nvidia,tegra20-pwm";
164 reg = <0x7000a000 0x100>; 287 reg = <0x7000a000 0x100>;
165 #pwm-cells = <2>; 288 #pwm-cells = <2>;
166 clocks = <&tegra_car TEGRA114_CLK_PWM>; 289 clocks = <&tegra_car TEGRA114_CLK_PWM>;
290 resets = <&tegra_car 17>;
291 reset-names = "pwm";
167 status = "disabled"; 292 status = "disabled";
168 }; 293 };
169 294
@@ -175,6 +300,10 @@
175 #size-cells = <0>; 300 #size-cells = <0>;
176 clocks = <&tegra_car TEGRA114_CLK_I2C1>; 301 clocks = <&tegra_car TEGRA114_CLK_I2C1>;
177 clock-names = "div-clk"; 302 clock-names = "div-clk";
303 resets = <&tegra_car 12>;
304 reset-names = "i2c";
305 dmas = <&apbdma 21>, <&apbdma 21>;
306 dma-names = "rx", "tx";
178 status = "disabled"; 307 status = "disabled";
179 }; 308 };
180 309
@@ -186,6 +315,10 @@
186 #size-cells = <0>; 315 #size-cells = <0>;
187 clocks = <&tegra_car TEGRA114_CLK_I2C2>; 316 clocks = <&tegra_car TEGRA114_CLK_I2C2>;
188 clock-names = "div-clk"; 317 clock-names = "div-clk";
318 resets = <&tegra_car 54>;
319 reset-names = "i2c";
320 dmas = <&apbdma 22>, <&apbdma 22>;
321 dma-names = "rx", "tx";
189 status = "disabled"; 322 status = "disabled";
190 }; 323 };
191 324
@@ -197,6 +330,10 @@
197 #size-cells = <0>; 330 #size-cells = <0>;
198 clocks = <&tegra_car TEGRA114_CLK_I2C3>; 331 clocks = <&tegra_car TEGRA114_CLK_I2C3>;
199 clock-names = "div-clk"; 332 clock-names = "div-clk";
333 resets = <&tegra_car 67>;
334 reset-names = "i2c";
335 dmas = <&apbdma 23>, <&apbdma 23>;
336 dma-names = "rx", "tx";
200 status = "disabled"; 337 status = "disabled";
201 }; 338 };
202 339
@@ -208,6 +345,10 @@
208 #size-cells = <0>; 345 #size-cells = <0>;
209 clocks = <&tegra_car TEGRA114_CLK_I2C4>; 346 clocks = <&tegra_car TEGRA114_CLK_I2C4>;
210 clock-names = "div-clk"; 347 clock-names = "div-clk";
348 resets = <&tegra_car 103>;
349 reset-names = "i2c";
350 dmas = <&apbdma 26>, <&apbdma 26>;
351 dma-names = "rx", "tx";
211 status = "disabled"; 352 status = "disabled";
212 }; 353 };
213 354
@@ -219,6 +360,10 @@
219 #size-cells = <0>; 360 #size-cells = <0>;
220 clocks = <&tegra_car TEGRA114_CLK_I2C5>; 361 clocks = <&tegra_car TEGRA114_CLK_I2C5>;
221 clock-names = "div-clk"; 362 clock-names = "div-clk";
363 resets = <&tegra_car 47>;
364 reset-names = "i2c";
365 dmas = <&apbdma 24>, <&apbdma 24>;
366 dma-names = "rx", "tx";
222 status = "disabled"; 367 status = "disabled";
223 }; 368 };
224 369
@@ -226,11 +371,14 @@
226 compatible = "nvidia,tegra114-spi"; 371 compatible = "nvidia,tegra114-spi";
227 reg = <0x7000d400 0x200>; 372 reg = <0x7000d400 0x200>;
228 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; 373 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
229 nvidia,dma-request-selector = <&apbdma 15>;
230 #address-cells = <1>; 374 #address-cells = <1>;
231 #size-cells = <0>; 375 #size-cells = <0>;
232 clocks = <&tegra_car TEGRA114_CLK_SBC1>; 376 clocks = <&tegra_car TEGRA114_CLK_SBC1>;
233 clock-names = "spi"; 377 clock-names = "spi";
378 resets = <&tegra_car 41>;
379 reset-names = "spi";
380 dmas = <&apbdma 15>, <&apbdma 15>;
381 dma-names = "rx", "tx";
234 status = "disabled"; 382 status = "disabled";
235 }; 383 };
236 384
@@ -238,11 +386,14 @@
238 compatible = "nvidia,tegra114-spi"; 386 compatible = "nvidia,tegra114-spi";
239 reg = <0x7000d600 0x200>; 387 reg = <0x7000d600 0x200>;
240 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; 388 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
241 nvidia,dma-request-selector = <&apbdma 16>;
242 #address-cells = <1>; 389 #address-cells = <1>;
243 #size-cells = <0>; 390 #size-cells = <0>;
244 clocks = <&tegra_car TEGRA114_CLK_SBC2>; 391 clocks = <&tegra_car TEGRA114_CLK_SBC2>;
245 clock-names = "spi"; 392 clock-names = "spi";
393 resets = <&tegra_car 44>;
394 reset-names = "spi";
395 dmas = <&apbdma 16>, <&apbdma 16>;
396 dma-names = "rx", "tx";
246 status = "disabled"; 397 status = "disabled";
247 }; 398 };
248 399
@@ -250,11 +401,14 @@
250 compatible = "nvidia,tegra114-spi"; 401 compatible = "nvidia,tegra114-spi";
251 reg = <0x7000d800 0x200>; 402 reg = <0x7000d800 0x200>;
252 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; 403 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
253 nvidia,dma-request-selector = <&apbdma 17>;
254 #address-cells = <1>; 404 #address-cells = <1>;
255 #size-cells = <0>; 405 #size-cells = <0>;
256 clocks = <&tegra_car TEGRA114_CLK_SBC3>; 406 clocks = <&tegra_car TEGRA114_CLK_SBC3>;
257 clock-names = "spi"; 407 clock-names = "spi";
408 resets = <&tegra_car 46>;
409 reset-names = "spi";
410 dmas = <&apbdma 17>, <&apbdma 17>;
411 dma-names = "rx", "tx";
258 status = "disabled"; 412 status = "disabled";
259 }; 413 };
260 414
@@ -262,11 +416,14 @@
262 compatible = "nvidia,tegra114-spi"; 416 compatible = "nvidia,tegra114-spi";
263 reg = <0x7000da00 0x200>; 417 reg = <0x7000da00 0x200>;
264 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; 418 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
265 nvidia,dma-request-selector = <&apbdma 18>;
266 #address-cells = <1>; 419 #address-cells = <1>;
267 #size-cells = <0>; 420 #size-cells = <0>;
268 clocks = <&tegra_car TEGRA114_CLK_SBC4>; 421 clocks = <&tegra_car TEGRA114_CLK_SBC4>;
269 clock-names = "spi"; 422 clock-names = "spi";
423 resets = <&tegra_car 68>;
424 reset-names = "spi";
425 dmas = <&apbdma 18>, <&apbdma 18>;
426 dma-names = "rx", "tx";
270 status = "disabled"; 427 status = "disabled";
271 }; 428 };
272 429
@@ -274,11 +431,14 @@
274 compatible = "nvidia,tegra114-spi"; 431 compatible = "nvidia,tegra114-spi";
275 reg = <0x7000dc00 0x200>; 432 reg = <0x7000dc00 0x200>;
276 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; 433 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
277 nvidia,dma-request-selector = <&apbdma 27>;
278 #address-cells = <1>; 434 #address-cells = <1>;
279 #size-cells = <0>; 435 #size-cells = <0>;
280 clocks = <&tegra_car TEGRA114_CLK_SBC5>; 436 clocks = <&tegra_car TEGRA114_CLK_SBC5>;
281 clock-names = "spi"; 437 clock-names = "spi";
438 resets = <&tegra_car 104>;
439 reset-names = "spi";
440 dmas = <&apbdma 27>, <&apbdma 27>;
441 dma-names = "rx", "tx";
282 status = "disabled"; 442 status = "disabled";
283 }; 443 };
284 444
@@ -286,37 +446,42 @@
286 compatible = "nvidia,tegra114-spi"; 446 compatible = "nvidia,tegra114-spi";
287 reg = <0x7000de00 0x200>; 447 reg = <0x7000de00 0x200>;
288 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; 448 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
289 nvidia,dma-request-selector = <&apbdma 28>;
290 #address-cells = <1>; 449 #address-cells = <1>;
291 #size-cells = <0>; 450 #size-cells = <0>;
292 clocks = <&tegra_car TEGRA114_CLK_SBC6>; 451 clocks = <&tegra_car TEGRA114_CLK_SBC6>;
293 clock-names = "spi"; 452 clock-names = "spi";
453 resets = <&tegra_car 105>;
454 reset-names = "spi";
455 dmas = <&apbdma 28>, <&apbdma 28>;
456 dma-names = "rx", "tx";
294 status = "disabled"; 457 status = "disabled";
295 }; 458 };
296 459
297 rtc { 460 rtc@7000e000 {
298 compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; 461 compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc";
299 reg = <0x7000e000 0x100>; 462 reg = <0x7000e000 0x100>;
300 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; 463 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
301 clocks = <&tegra_car TEGRA114_CLK_RTC>; 464 clocks = <&tegra_car TEGRA114_CLK_RTC>;
302 }; 465 };
303 466
304 kbc { 467 kbc@7000e200 {
305 compatible = "nvidia,tegra114-kbc"; 468 compatible = "nvidia,tegra114-kbc";
306 reg = <0x7000e200 0x100>; 469 reg = <0x7000e200 0x100>;
307 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; 470 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
308 clocks = <&tegra_car TEGRA114_CLK_KBC>; 471 clocks = <&tegra_car TEGRA114_CLK_KBC>;
472 resets = <&tegra_car 36>;
473 reset-names = "kbc";
309 status = "disabled"; 474 status = "disabled";
310 }; 475 };
311 476
312 pmc { 477 pmc@7000e400 {
313 compatible = "nvidia,tegra114-pmc"; 478 compatible = "nvidia,tegra114-pmc";
314 reg = <0x7000e400 0x400>; 479 reg = <0x7000e400 0x400>;
315 clocks = <&tegra_car TEGRA114_CLK_PCLK>, <&clk32k_in>; 480 clocks = <&tegra_car TEGRA114_CLK_PCLK>, <&clk32k_in>;
316 clock-names = "pclk", "clk32k_in"; 481 clock-names = "pclk", "clk32k_in";
317 }; 482 };
318 483
319 iommu { 484 iommu@70019010 {
320 compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu"; 485 compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu";
321 reg = <0x70019010 0x02c 486 reg = <0x70019010 0x02c
322 0x700191f0 0x010 487 0x700191f0 0x010
@@ -327,32 +492,45 @@
327 nvidia,ahb = <&ahb>; 492 nvidia,ahb = <&ahb>;
328 }; 493 };
329 494
330 ahub { 495 ahub@70080000 {
331 compatible = "nvidia,tegra114-ahub"; 496 compatible = "nvidia,tegra114-ahub";
332 reg = <0x70080000 0x200>, 497 reg = <0x70080000 0x200>,
333 <0x70080200 0x100>, 498 <0x70080200 0x100>,
334 <0x70081000 0x200>; 499 <0x70081000 0x200>;
335 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; 500 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
336 nvidia,dma-request-selector = <&apbdma 1>, <&apbdma 2>,
337 <&apbdma 3>, <&apbdma 4>, <&apbdma 6>, <&apbdma 7>,
338 <&apbdma 12>, <&apbdma 13>, <&apbdma 14>,
339 <&apbdma 29>;
340 clocks = <&tegra_car TEGRA114_CLK_D_AUDIO>, 501 clocks = <&tegra_car TEGRA114_CLK_D_AUDIO>,
341 <&tegra_car TEGRA114_CLK_APBIF>, 502 <&tegra_car TEGRA114_CLK_APBIF>;
342 <&tegra_car TEGRA114_CLK_I2S0>, 503 clock-names = "d_audio", "apbif";
343 <&tegra_car TEGRA114_CLK_I2S1>, 504 resets = <&tegra_car 106>, /* d_audio */
344 <&tegra_car TEGRA114_CLK_I2S2>, 505 <&tegra_car 107>, /* apbif */
345 <&tegra_car TEGRA114_CLK_I2S3>, 506 <&tegra_car 30>, /* i2s0 */
346 <&tegra_car TEGRA114_CLK_I2S4>, 507 <&tegra_car 11>, /* i2s1 */
347 <&tegra_car TEGRA114_CLK_DAM0>, 508 <&tegra_car 18>, /* i2s2 */
348 <&tegra_car TEGRA114_CLK_DAM1>, 509 <&tegra_car 101>, /* i2s3 */
349 <&tegra_car TEGRA114_CLK_DAM2>, 510 <&tegra_car 102>, /* i2s4 */
350 <&tegra_car TEGRA114_CLK_SPDIF_IN>, 511 <&tegra_car 108>, /* dam0 */
351 <&tegra_car TEGRA114_CLK_AMX>, 512 <&tegra_car 109>, /* dam1 */
352 <&tegra_car TEGRA114_CLK_ADX>; 513 <&tegra_car 110>, /* dam2 */
353 clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", 514 <&tegra_car 10>, /* spdif */
515 <&tegra_car 153>, /* amx */
516 <&tegra_car 154>; /* adx */
517 reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
354 "i2s3", "i2s4", "dam0", "dam1", "dam2", 518 "i2s3", "i2s4", "dam0", "dam1", "dam2",
355 "spdif_in", "amx", "adx"; 519 "spdif", "amx", "adx";
520 dmas = <&apbdma 1>, <&apbdma 1>,
521 <&apbdma 2>, <&apbdma 2>,
522 <&apbdma 3>, <&apbdma 3>,
523 <&apbdma 4>, <&apbdma 4>,
524 <&apbdma 6>, <&apbdma 6>,
525 <&apbdma 7>, <&apbdma 7>,
526 <&apbdma 12>, <&apbdma 12>,
527 <&apbdma 13>, <&apbdma 13>,
528 <&apbdma 14>, <&apbdma 14>,
529 <&apbdma 29>, <&apbdma 29>;
530 dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2",
531 "rx3", "tx3", "rx4", "tx4", "rx5", "tx5",
532 "rx6", "tx6", "rx7", "tx7", "rx8", "tx8",
533 "rx9", "tx9";
356 ranges; 534 ranges;
357 #address-cells = <1>; 535 #address-cells = <1>;
358 #size-cells = <1>; 536 #size-cells = <1>;
@@ -362,6 +540,8 @@
362 reg = <0x70080300 0x100>; 540 reg = <0x70080300 0x100>;
363 nvidia,ahub-cif-ids = <4 4>; 541 nvidia,ahub-cif-ids = <4 4>;
364 clocks = <&tegra_car TEGRA114_CLK_I2S0>; 542 clocks = <&tegra_car TEGRA114_CLK_I2S0>;
543 resets = <&tegra_car 30>;
544 reset-names = "i2s";
365 status = "disabled"; 545 status = "disabled";
366 }; 546 };
367 547
@@ -370,6 +550,8 @@
370 reg = <0x70080400 0x100>; 550 reg = <0x70080400 0x100>;
371 nvidia,ahub-cif-ids = <5 5>; 551 nvidia,ahub-cif-ids = <5 5>;
372 clocks = <&tegra_car TEGRA114_CLK_I2S1>; 552 clocks = <&tegra_car TEGRA114_CLK_I2S1>;
553 resets = <&tegra_car 11>;
554 reset-names = "i2s";
373 status = "disabled"; 555 status = "disabled";
374 }; 556 };
375 557
@@ -378,6 +560,8 @@
378 reg = <0x70080500 0x100>; 560 reg = <0x70080500 0x100>;
379 nvidia,ahub-cif-ids = <6 6>; 561 nvidia,ahub-cif-ids = <6 6>;
380 clocks = <&tegra_car TEGRA114_CLK_I2S2>; 562 clocks = <&tegra_car TEGRA114_CLK_I2S2>;
563 resets = <&tegra_car 18>;
564 reset-names = "i2s";
381 status = "disabled"; 565 status = "disabled";
382 }; 566 };
383 567
@@ -386,6 +570,8 @@
386 reg = <0x70080600 0x100>; 570 reg = <0x70080600 0x100>;
387 nvidia,ahub-cif-ids = <7 7>; 571 nvidia,ahub-cif-ids = <7 7>;
388 clocks = <&tegra_car TEGRA114_CLK_I2S3>; 572 clocks = <&tegra_car TEGRA114_CLK_I2S3>;
573 resets = <&tegra_car 101>;
574 reset-names = "i2s";
389 status = "disabled"; 575 status = "disabled";
390 }; 576 };
391 577
@@ -394,15 +580,26 @@
394 reg = <0x70080700 0x100>; 580 reg = <0x70080700 0x100>;
395 nvidia,ahub-cif-ids = <8 8>; 581 nvidia,ahub-cif-ids = <8 8>;
396 clocks = <&tegra_car TEGRA114_CLK_I2S4>; 582 clocks = <&tegra_car TEGRA114_CLK_I2S4>;
583 resets = <&tegra_car 102>;
584 reset-names = "i2s";
397 status = "disabled"; 585 status = "disabled";
398 }; 586 };
399 }; 587 };
400 588
589 mipi: mipi@700e3000 {
590 compatible = "nvidia,tegra114-mipi";
591 reg = <0x700e3000 0x100>;
592 clocks = <&tegra_car TEGRA114_CLK_MIPI_CAL>;
593 #nvidia,mipi-calibrate-cells = <1>;
594 };
595
401 sdhci@78000000 { 596 sdhci@78000000 {
402 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; 597 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci";
403 reg = <0x78000000 0x200>; 598 reg = <0x78000000 0x200>;
404 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 599 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
405 clocks = <&tegra_car TEGRA114_CLK_SDMMC1>; 600 clocks = <&tegra_car TEGRA114_CLK_SDMMC1>;
601 resets = <&tegra_car 14>;
602 reset-names = "sdhci";
406 status = "disable"; 603 status = "disable";
407 }; 604 };
408 605
@@ -411,6 +608,8 @@
411 reg = <0x78000200 0x200>; 608 reg = <0x78000200 0x200>;
412 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; 609 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
413 clocks = <&tegra_car TEGRA114_CLK_SDMMC2>; 610 clocks = <&tegra_car TEGRA114_CLK_SDMMC2>;
611 resets = <&tegra_car 9>;
612 reset-names = "sdhci";
414 status = "disable"; 613 status = "disable";
415 }; 614 };
416 615
@@ -419,6 +618,8 @@
419 reg = <0x78000400 0x200>; 618 reg = <0x78000400 0x200>;
420 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; 619 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
421 clocks = <&tegra_car TEGRA114_CLK_SDMMC3>; 620 clocks = <&tegra_car TEGRA114_CLK_SDMMC3>;
621 resets = <&tegra_car 69>;
622 reset-names = "sdhci";
422 status = "disable"; 623 status = "disable";
423 }; 624 };
424 625
@@ -427,6 +628,8 @@
427 reg = <0x78000600 0x200>; 628 reg = <0x78000600 0x200>;
428 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; 629 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
429 clocks = <&tegra_car TEGRA114_CLK_SDMMC4>; 630 clocks = <&tegra_car TEGRA114_CLK_SDMMC4>;
631 resets = <&tegra_car 15>;
632 reset-names = "sdhci";
430 status = "disable"; 633 status = "disable";
431 }; 634 };
432 635
@@ -436,6 +639,8 @@
436 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; 639 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
437 phy_type = "utmi"; 640 phy_type = "utmi";
438 clocks = <&tegra_car TEGRA114_CLK_USBD>; 641 clocks = <&tegra_car TEGRA114_CLK_USBD>;
642 resets = <&tegra_car 22>;
643 reset-names = "usb";
439 nvidia,phy = <&phy1>; 644 nvidia,phy = <&phy1>;
440 status = "disabled"; 645 status = "disabled";
441 }; 646 };
@@ -467,6 +672,8 @@
467 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; 672 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
468 phy_type = "utmi"; 673 phy_type = "utmi";
469 clocks = <&tegra_car TEGRA114_CLK_USB3>; 674 clocks = <&tegra_car TEGRA114_CLK_USB3>;
675 resets = <&tegra_car 59>;
676 reset-names = "usb";
470 nvidia,phy = <&phy3>; 677 nvidia,phy = <&phy3>;
471 status = "disabled"; 678 status = "disabled";
472 }; 679 };
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts b/arch/arm/boot/dts/tegra124-venice2.dts
index 431d67a2b413..c6dcef513e5d 100644
--- a/arch/arm/boot/dts/tegra124-venice2.dts
+++ b/arch/arm/boot/dts/tegra124-venice2.dts
@@ -1,19 +1,917 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra124.dtsi" 4#include "tegra124.dtsi"
4 5
5/ { 6/ {
6 model = "NVIDIA Tegra124 Venice2"; 7 model = "NVIDIA Tegra124 Venice2";
7 compatible = "nvidia,venice2", "nvidia,tegra124"; 8 compatible = "nvidia,venice2", "nvidia,tegra124";
8 9
10 aliases {
11 rtc0 = "/i2c@7000d000/as3722@40";
12 rtc1 = "/rtc@7000e000";
13 };
14
9 memory { 15 memory {
10 reg = <0x80000000 0x80000000>; 16 reg = <0x80000000 0x80000000>;
11 }; 17 };
12 18
19 pinmux: pinmux@70000868 {
20 pinctrl-names = "default";
21 pinctrl-0 = <&pinmux_default>;
22
23 pinmux_default: common {
24 dap_mclk1_pw4 {
25 nvidia,pins = "dap_mclk1_pw4";
26 nvidia,function = "extperiph1";
27 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
28 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
29 nvidia,tristate = <TEGRA_PIN_DISABLE>;
30 };
31 dap1_din_pn1 {
32 nvidia,pins = "dap1_din_pn1";
33 nvidia,function = "i2s0";
34 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
35 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
36 nvidia,tristate = <TEGRA_PIN_ENABLE>;
37 };
38 dap1_dout_pn2 {
39 nvidia,pins = "dap1_dout_pn2",
40 "dap1_fs_pn0",
41 "dap1_sclk_pn3";
42 nvidia,function = "i2s0";
43 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
44 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
45 nvidia,tristate = <TEGRA_PIN_ENABLE>;
46 };
47 dap2_din_pa4 {
48 nvidia,pins = "dap2_din_pa4";
49 nvidia,function = "i2s1";
50 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
51 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
52 nvidia,tristate = <TEGRA_PIN_DISABLE>;
53 };
54 dap2_dout_pa5 {
55 nvidia,pins = "dap2_dout_pa5",
56 "dap2_fs_pa2",
57 "dap2_sclk_pa3";
58 nvidia,function = "i2s1";
59 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
60 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
61 nvidia,tristate = <TEGRA_PIN_DISABLE>;
62 };
63 dvfs_pwm_px0 {
64 nvidia,pins = "dvfs_pwm_px0",
65 "dvfs_clk_px2";
66 nvidia,function = "cldvfs";
67 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
68 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
69 nvidia,tristate = <TEGRA_PIN_DISABLE>;
70 };
71 ulpi_clk_py0 {
72 nvidia,pins = "ulpi_clk_py0",
73 "ulpi_nxt_py2",
74 "ulpi_stp_py3";
75 nvidia,function = "spi1";
76 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
77 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
78 nvidia,tristate = <TEGRA_PIN_DISABLE>;
79 };
80 ulpi_dir_py1 {
81 nvidia,pins = "ulpi_dir_py1";
82 nvidia,function = "spi1";
83 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
84 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
85 nvidia,tristate = <TEGRA_PIN_DISABLE>;
86 };
87 cam_i2c_scl_pbb1 {
88 nvidia,pins = "cam_i2c_scl_pbb1",
89 "cam_i2c_sda_pbb2";
90 nvidia,function = "i2c3";
91 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
92 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
93 nvidia,tristate = <TEGRA_PIN_DISABLE>;
94 nvidia,lock = <TEGRA_PIN_DISABLE>;
95 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
96 };
97 gen2_i2c_scl_pt5 {
98 nvidia,pins = "gen2_i2c_scl_pt5",
99 "gen2_i2c_sda_pt6";
100 nvidia,function = "i2c2";
101 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
102 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
103 nvidia,tristate = <TEGRA_PIN_DISABLE>;
104 nvidia,lock = <TEGRA_PIN_DISABLE>;
105 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
106 };
107 pg4 {
108 nvidia,pins = "pg4",
109 "pg5",
110 "pg6",
111 "pi3";
112 nvidia,function = "spi4";
113 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
114 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
115 nvidia,tristate = <TEGRA_PIN_DISABLE>;
116 };
117 pg7 {
118 nvidia,pins = "pg7";
119 nvidia,function = "spi4";
120 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
121 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
122 nvidia,tristate = <TEGRA_PIN_DISABLE>;
123 };
124 ph1 {
125 nvidia,pins = "ph1";
126 nvidia,function = "pwm1";
127 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
128 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
129 nvidia,tristate = <TEGRA_PIN_DISABLE>;
130 };
131 pk0 {
132 nvidia,pins = "pk0",
133 "kb_row15_ps7",
134 "clk_32k_out_pa0";
135 nvidia,function = "soc";
136 nvidia,pull = <TEGRA_PIN_PULL_UP>;
137 nvidia,tristate = <TEGRA_PIN_DISABLE>;
138 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
139 };
140 sdmmc1_clk_pz0 {
141 nvidia,pins = "sdmmc1_clk_pz0",
142 "sdmmc1_cmd_pz1",
143 "sdmmc1_dat0_py7",
144 "sdmmc1_dat1_py6",
145 "sdmmc1_dat2_py5",
146 "sdmmc1_dat3_py4";
147 nvidia,function = "sdmmc1";
148 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
149 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
150 nvidia,tristate = <TEGRA_PIN_DISABLE>;
151 };
152 sdmmc1_cmd_pz1 {
153 nvidia,pins = "sdmmc1_cmd_pz1",
154 "sdmmc1_dat0_py7",
155 "sdmmc1_dat1_py6",
156 "sdmmc1_dat2_py5",
157 "sdmmc1_dat3_py4";
158 nvidia,function = "sdmmc1";
159 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
160 nvidia,pull = <TEGRA_PIN_PULL_UP>;
161 nvidia,tristate = <TEGRA_PIN_DISABLE>;
162 };
163 sdmmc3_clk_pa6 {
164 nvidia,pins = "sdmmc3_clk_pa6";
165 nvidia,function = "sdmmc3";
166 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
167 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
168 nvidia,tristate = <TEGRA_PIN_DISABLE>;
169 };
170 sdmmc3_cmd_pa7 {
171 nvidia,pins = "sdmmc3_cmd_pa7",
172 "sdmmc3_dat0_pb7",
173 "sdmmc3_dat1_pb6",
174 "sdmmc3_dat2_pb5",
175 "sdmmc3_dat3_pb4",
176 "sdmmc3_clk_lb_out_pee4",
177 "sdmmc3_clk_lb_in_pee5";
178 nvidia,function = "sdmmc3";
179 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
180 nvidia,pull = <TEGRA_PIN_PULL_UP>;
181 nvidia,tristate = <TEGRA_PIN_DISABLE>;
182 };
183 sdmmc4_clk_pcc4 {
184 nvidia,pins = "sdmmc4_clk_pcc4";
185 nvidia,function = "sdmmc4";
186 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
187 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
188 nvidia,tristate = <TEGRA_PIN_DISABLE>;
189 };
190 sdmmc4_cmd_pt7 {
191 nvidia,pins = "sdmmc4_cmd_pt7",
192 "sdmmc4_dat0_paa0",
193 "sdmmc4_dat1_paa1",
194 "sdmmc4_dat2_paa2",
195 "sdmmc4_dat3_paa3",
196 "sdmmc4_dat4_paa4",
197 "sdmmc4_dat5_paa5",
198 "sdmmc4_dat6_paa6",
199 "sdmmc4_dat7_paa7";
200 nvidia,function = "sdmmc4";
201 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
202 nvidia,pull = <TEGRA_PIN_PULL_UP>;
203 nvidia,tristate = <TEGRA_PIN_DISABLE>;
204 };
205 pwr_i2c_scl_pz6 {
206 nvidia,pins = "pwr_i2c_scl_pz6",
207 "pwr_i2c_sda_pz7";
208 nvidia,function = "i2cpwr";
209 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
210 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
211 nvidia,tristate = <TEGRA_PIN_DISABLE>;
212 nvidia,lock = <TEGRA_PIN_DISABLE>;
213 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
214 };
215 jtag_rtck {
216 nvidia,pins = "jtag_rtck";
217 nvidia,function = "rtck";
218 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
219 nvidia,pull = <TEGRA_PIN_PULL_UP>;
220 nvidia,tristate = <TEGRA_PIN_DISABLE>;
221 };
222 clk_32k_in {
223 nvidia,pins = "clk_32k_in";
224 nvidia,function = "clk";
225 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
226 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
227 nvidia,tristate = <TEGRA_PIN_DISABLE>;
228 };
229 core_pwr_req {
230 nvidia,pins = "core_pwr_req";
231 nvidia,function = "pwron";
232 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
233 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
234 nvidia,tristate = <TEGRA_PIN_DISABLE>;
235 };
236 cpu_pwr_req {
237 nvidia,pins = "cpu_pwr_req";
238 nvidia,function = "cpu";
239 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
240 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
241 nvidia,tristate = <TEGRA_PIN_DISABLE>;
242 };
243 pwr_int_n {
244 nvidia,pins = "pwr_int_n";
245 nvidia,function = "pmi";
246 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
247 nvidia,pull = <TEGRA_PIN_PULL_UP>;
248 nvidia,tristate = <TEGRA_PIN_DISABLE>;
249 };
250 reset_out_n {
251 nvidia,pins = "reset_out_n";
252 nvidia,function = "reset_out_n";
253 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
254 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
255 nvidia,tristate = <TEGRA_PIN_DISABLE>;
256 };
257 clk3_out_pee0 {
258 nvidia,pins = "clk3_out_pee0";
259 nvidia,function = "extperiph3";
260 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
261 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
262 nvidia,tristate = <TEGRA_PIN_DISABLE>;
263 };
264 dap4_din_pp5 {
265 nvidia,pins = "dap4_din_pp5";
266 nvidia,function = "i2s3";
267 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
268 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
269 nvidia,tristate = <TEGRA_PIN_ENABLE>;
270 };
271 dap4_dout_pp6 {
272 nvidia,pins = "dap4_dout_pp6",
273 "dap4_fs_pp4",
274 "dap4_sclk_pp7";
275 nvidia,function = "i2s3";
276 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
277 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
278 nvidia,tristate = <TEGRA_PIN_ENABLE>;
279 };
280 gen1_i2c_sda_pc5 {
281 nvidia,pins = "gen1_i2c_sda_pc5",
282 "gen1_i2c_scl_pc4";
283 nvidia,function = "i2c1";
284 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
285 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
286 nvidia,tristate = <TEGRA_PIN_DISABLE>;
287 nvidia,lock = <TEGRA_PIN_DISABLE>;
288 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
289 };
290 uart2_cts_n_pj5 {
291 nvidia,pins = "uart2_cts_n_pj5";
292 nvidia,function = "uartb";
293 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
294 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
295 nvidia,tristate = <TEGRA_PIN_DISABLE>;
296 };
297 uart2_rts_n_pj6 {
298 nvidia,pins = "uart2_rts_n_pj6";
299 nvidia,function = "uartb";
300 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
301 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
302 nvidia,tristate = <TEGRA_PIN_DISABLE>;
303 };
304 uart2_rxd_pc3 {
305 nvidia,pins = "uart2_rxd_pc3";
306 nvidia,function = "irda";
307 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
308 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
309 nvidia,tristate = <TEGRA_PIN_DISABLE>;
310 };
311 uart2_txd_pc2 {
312 nvidia,pins = "uart2_txd_pc2";
313 nvidia,function = "irda";
314 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
315 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
316 nvidia,tristate = <TEGRA_PIN_DISABLE>;
317 };
318 uart3_cts_n_pa1 {
319 nvidia,pins = "uart3_cts_n_pa1",
320 "uart3_rxd_pw7";
321 nvidia,function = "uartc";
322 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
323 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
324 nvidia,tristate = <TEGRA_PIN_DISABLE>;
325 };
326 uart3_rts_n_pc0 {
327 nvidia,pins = "uart3_rts_n_pc0",
328 "uart3_txd_pw6";
329 nvidia,function = "uartc";
330 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
331 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
332 nvidia,tristate = <TEGRA_PIN_DISABLE>;
333 };
334 hdmi_cec_pee3 {
335 nvidia,pins = "hdmi_cec_pee3";
336 nvidia,function = "cec";
337 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
338 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
339 nvidia,tristate = <TEGRA_PIN_DISABLE>;
340 nvidia,lock = <TEGRA_PIN_DISABLE>;
341 nvidia,open-drain = <TEGRA_PIN_DISABLE>;
342 };
343 hdmi_int_pn7 {
344 nvidia,pins = "hdmi_int_pn7";
345 nvidia,function = "rsvd1";
346 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
347 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
348 nvidia,tristate = <TEGRA_PIN_DISABLE>;
349 };
350 ddc_scl_pv4 {
351 nvidia,pins = "ddc_scl_pv4",
352 "ddc_sda_pv5";
353 nvidia,function = "i2c4";
354 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
355 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
356 nvidia,tristate = <TEGRA_PIN_DISABLE>;
357 nvidia,lock = <TEGRA_PIN_DISABLE>;
358 nvidia,rcv-sel = <TEGRA_PIN_ENABLE>;
359 };
360 pj7 {
361 nvidia,pins = "pj7",
362 "pk7";
363 nvidia,function = "uartd";
364 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
365 nvidia,tristate = <TEGRA_PIN_DISABLE>;
366 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
367 };
368 pb0 {
369 nvidia,pins = "pb0",
370 "pb1";
371 nvidia,function = "uartd";
372 nvidia,pull = <TEGRA_PIN_PULL_UP>;
373 nvidia,tristate = <TEGRA_PIN_DISABLE>;
374 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
375 };
376 ph0 {
377 nvidia,pins = "ph0";
378 nvidia,function = "pwm0";
379 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
380 nvidia,tristate = <TEGRA_PIN_DISABLE>;
381 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
382 };
383 kb_row10_ps2 {
384 nvidia,pins = "kb_row10_ps2";
385 nvidia,function = "uarta";
386 nvidia,pull = <TEGRA_PIN_PULL_UP>;
387 nvidia,tristate = <TEGRA_PIN_DISABLE>;
388 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
389 };
390 kb_row9_ps1 {
391 nvidia,pins = "kb_row9_ps1";
392 nvidia,function = "uarta";
393 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
394 nvidia,tristate = <TEGRA_PIN_DISABLE>;
395 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
396 };
397 kb_row6_pr6 {
398 nvidia,pins = "kb_row6_pr6";
399 nvidia,function = "displaya_alt";
400 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
401 nvidia,tristate = <TEGRA_PIN_DISABLE>;
402 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
403 };
404 usb_vbus_en0_pn4 {
405 nvidia,pins = "usb_vbus_en0_pn4";
406 nvidia,function = "usb";
407 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
408 nvidia,pull = <TEGRA_PIN_PULL_UP>;
409 nvidia,tristate = <TEGRA_PIN_DISABLE>;
410 nvidia,lock = <TEGRA_PIN_DISABLE>;
411 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
412 };
413 usb_vbus_en1_pn5 {
414 nvidia,pins = "usb_vbus_en1_pn5";
415 nvidia,function = "usb";
416 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
417 nvidia,pull = <TEGRA_PIN_PULL_UP>;
418 nvidia,tristate = <TEGRA_PIN_DISABLE>;
419 nvidia,lock = <TEGRA_PIN_DISABLE>;
420 nvidia,open-drain = <TEGRA_PIN_ENABLE>;
421 };
422 drive_sdio1 {
423 nvidia,pins = "drive_sdio1";
424 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
425 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
426 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
427 nvidia,pull-down-strength = <32>;
428 nvidia,pull-up-strength = <42>;
429 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
430 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
431 };
432 drive_sdio3 {
433 nvidia,pins = "drive_sdio3";
434 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
435 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
436 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
437 nvidia,pull-down-strength = <20>;
438 nvidia,pull-up-strength = <36>;
439 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
440 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
441 };
442 drive_gma {
443 nvidia,pins = "drive_gma";
444 nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
445 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
446 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
447 nvidia,pull-down-strength = <1>;
448 nvidia,pull-up-strength = <2>;
449 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
450 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
451 nvidia,drive-type = <1>;
452 };
453 als_irq_l {
454 nvidia,pins = "gpio_x3_aud_px3";
455 nvidia,function = "gmi";
456 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
457 nvidia,tristate = <TEGRA_PIN_ENABLE>;
458 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
459 };
460 codec_irq_l {
461 nvidia,pins = "ph4";
462 nvidia,function = "gmi";
463 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
464 nvidia,tristate = <TEGRA_PIN_DISABLE>;
465 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
466 };
467 lcd_bl_en {
468 nvidia,pins = "ph2";
469 nvidia,function = "gmi";
470 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
471 nvidia,tristate = <TEGRA_PIN_DISABLE>;
472 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
473 };
474 touch_irq_l {
475 nvidia,pins = "gpio_w3_aud_pw3";
476 nvidia,function = "spi6";
477 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
478 nvidia,tristate = <TEGRA_PIN_ENABLE>;
479 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
480 };
481 tpm_davint_l {
482 nvidia,pins = "ph6";
483 nvidia,function = "gmi";
484 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
485 nvidia,tristate = <TEGRA_PIN_ENABLE>;
486 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
487 };
488 ts_irq_l {
489 nvidia,pins = "pk2";
490 nvidia,function = "gmi";
491 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
492 nvidia,tristate = <TEGRA_PIN_ENABLE>;
493 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
494 };
495 ts_reset_l {
496 nvidia,pins = "pk4";
497 nvidia,function = "gmi";
498 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
499 nvidia,tristate = <TEGRA_PIN_DISABLE>;
500 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
501 };
502 ts_shdn_l {
503 nvidia,pins = "pk1";
504 nvidia,function = "gmi";
505 nvidia,pull = <TEGRA_PIN_PULL_UP>;
506 nvidia,tristate = <TEGRA_PIN_DISABLE>;
507 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
508 };
509 ph7 {
510 nvidia,pins = "ph7";
511 nvidia,function = "gmi";
512 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
513 nvidia,tristate = <TEGRA_PIN_DISABLE>;
514 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
515 };
516 kb_col0_ap {
517 nvidia,pins = "kb_col0_pq0";
518 nvidia,function = "rsvd4";
519 nvidia,pull = <TEGRA_PIN_PULL_UP>;
520 nvidia,tristate = <TEGRA_PIN_DISABLE>;
521 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
522 };
523 lid_open {
524 nvidia,pins = "kb_row4_pr4";
525 nvidia,function = "rsvd3";
526 nvidia,pull = <TEGRA_PIN_PULL_UP>;
527 nvidia,tristate = <TEGRA_PIN_DISABLE>;
528 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
529 };
530 en_vdd_sd {
531 nvidia,pins = "kb_row0_pr0";
532 nvidia,function = "rsvd4";
533 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
534 nvidia,tristate = <TEGRA_PIN_DISABLE>;
535 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
536 };
537 ac_ok {
538 nvidia,pins = "pj0";
539 nvidia,function = "gmi";
540 nvidia,pull = <TEGRA_PIN_PULL_UP>;
541 nvidia,tristate = <TEGRA_PIN_ENABLE>;
542 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
543 };
544 sensor_irq_l {
545 nvidia,pins = "pi6";
546 nvidia,function = "gmi";
547 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
548 nvidia,tristate = <TEGRA_PIN_DISABLE>;
549 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
550 };
551 wifi_en {
552 nvidia,pins = "gpio_x7_aud_px7";
553 nvidia,function = "rsvd4";
554 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
555 nvidia,tristate = <TEGRA_PIN_DISABLE>;
556 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
557 };
558 wifi_rst_l {
559 nvidia,pins = "clk2_req_pcc5";
560 nvidia,function = "dap";
561 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
562 nvidia,tristate = <TEGRA_PIN_DISABLE>;
563 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
564 };
565 hp_det_l {
566 nvidia,pins = "ulpi_data1_po2";
567 nvidia,function = "spi3";
568 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
569 nvidia,tristate = <TEGRA_PIN_DISABLE>;
570 nvidia,enable-input = <TEGRA_PIN_ENABLE>;
571 };
572 };
573 };
574
13 serial@70006000 { 575 serial@70006000 {
14 status = "okay"; 576 status = "okay";
15 }; 577 };
16 578
579 pwm: pwm@7000a000 {
580 status = "okay";
581 };
582
583 i2c@7000c000 {
584 status = "okay";
585 clock-frequency = <100000>;
586
587 acodec: audio-codec@10 {
588 compatible = "maxim,max98090";
589 reg = <0x10>;
590 interrupt-parent = <&gpio>;
591 interrupts = <TEGRA_GPIO(H, 4) GPIO_ACTIVE_HIGH>;
592 };
593 };
594
595 i2c@7000c400 {
596 status = "okay";
597 clock-frequency = <100000>;
598 };
599
600 i2c@7000c500 {
601 status = "okay";
602 clock-frequency = <100000>;
603 };
604
605 i2c@7000c700 {
606 status = "okay";
607 clock-frequency = <100000>;
608 };
609
610 i2c@7000d000 {
611 status = "okay";
612 clock-frequency = <400000>;
613
614 as3722: as3722@40 {
615 compatible = "ams,as3722";
616 reg = <0x40>;
617 interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
618
619 #interrupt-cells = <2>;
620 interrupt-controller;
621
622 gpio-controller;
623 #gpio-cells = <2>;
624
625 pinctrl-names = "default";
626 pinctrl-0 = <&as3722_default>;
627
628 as3722_default: pinmux {
629 gpio0 {
630 pins = "gpio0";
631 function = "gpio";
632 bias-pull-down;
633 };
634
635 gpio1_2_4_7 {
636 pins = "gpio1", "gpio2", "gpio4", "gpio7";
637 function = "gpio";
638 bias-pull-up;
639 };
640
641 gpio3_6 {
642 pins = "gpio3", "gpio6";
643 bias-high-impedance;
644 };
645
646 gpio5 {
647 pins = "gpio5";
648 function = "clk32k-out";
649 };
650 };
651
652 regulators {
653 vsup-sd2-supply = <&vdd_ac_bat_reg>;
654 vsup-sd3-supply = <&vdd_ac_bat_reg>;
655 vsup-sd4-supply = <&vdd_ac_bat_reg>;
656 vsup-sd5-supply = <&vdd_ac_bat_reg>;
657 vin-ldo0-supply = <&as3722_sd2>;
658 vin-ldo1-6-supply = <&vdd_ac_bat_reg>;
659 vin-ldo2-5-7-supply = <&as3722_sd5>;
660 vin-ldo3-4-supply = <&vdd_ac_bat_reg>;
661 vin-ldo9-10-supply = <&vdd_ac_bat_reg>;
662 vin-ldo11-supply = <&vdd_ac_bat_reg>;
663
664 sd0 {
665 regulator-name = "vdd-cpu";
666 regulator-min-microvolt = <700000>;
667 regulator-max-microvolt = <1400000>;
668 regulator-min-microamp = <3500000>;
669 regulator-max-microamp = <3500000>;
670 regulator-always-on;
671 regulator-boot-on;
672 ams,external-control = <2>;
673 };
674
675 sd1 {
676 regulator-name = "vdd-core";
677 regulator-min-microvolt = <700000>;
678 regulator-max-microvolt = <1350000>;
679 regulator-min-microamp = <2500000>;
680 regulator-max-microamp = <2500000>;
681 regulator-always-on;
682 regulator-boot-on;
683 ams,external-control = <1>;
684 };
685
686 as3722_sd2: sd2 {
687 regulator-name = "vddio-ddr";
688 regulator-min-microvolt = <1350000>;
689 regulator-max-microvolt = <1350000>;
690 regulator-always-on;
691 regulator-boot-on;
692 };
693
694 sd3 {
695 regulator-name = "vddio-ddr-2phase";
696 regulator-min-microvolt = <1350000>;
697 regulator-max-microvolt = <1350000>;
698 regulator-always-on;
699 regulator-boot-on;
700 };
701
702 sd4 {
703 regulator-name = "avdd-pex-sata";
704 regulator-min-microvolt = <1050000>;
705 regulator-max-microvolt = <1050000>;
706 regulator-boot-on;
707 regulator-always-on;
708 };
709
710 as3722_sd5: sd5 {
711 regulator-name = "vddio-sys";
712 regulator-min-microvolt = <1800000>;
713 regulator-max-microvolt = <1800000>;
714 regulator-boot-on;
715 regulator-always-on;
716 };
717
718 sd6 {
719 regulator-name = "vdd-gpu";
720 regulator-min-microvolt = <650000>;
721 regulator-max-microvolt = <1200000>;
722 regulator-min-microamp = <3500000>;
723 regulator-max-microamp = <3500000>;
724 regulator-boot-on;
725 regulator-always-on;
726 };
727
728 ldo0 {
729 regulator-name = "avdd_pll";
730 regulator-min-microvolt = <1050000>;
731 regulator-max-microvolt = <1050000>;
732 regulator-boot-on;
733 regulator-always-on;
734 ams,external-control = <1>;
735 };
736
737 ldo1 {
738 regulator-name = "run-cam-1.8";
739 regulator-min-microvolt = <1800000>;
740 regulator-max-microvolt = <1800000>;
741 };
742
743 ldo2 {
744 regulator-name = "gen-avdd,vddio-hsic";
745 regulator-min-microvolt = <1200000>;
746 regulator-max-microvolt = <1200000>;
747 regulator-boot-on;
748 regulator-always-on;
749 };
750
751 ldo3 {
752 regulator-name = "vdd-rtc";
753 regulator-min-microvolt = <1000000>;
754 regulator-max-microvolt = <1000000>;
755 regulator-boot-on;
756 regulator-always-on;
757 ams,enable-tracking;
758 };
759
760 ldo4 {
761 regulator-name = "vdd-cam";
762 regulator-min-microvolt = <2800000>;
763 regulator-max-microvolt = <2800000>;
764 regulator-boot-on;
765 regulator-always-on;
766 };
767
768 ldo5 {
769 regulator-name = "vdd-cam-front";
770 regulator-min-microvolt = <1200000>;
771 regulator-max-microvolt = <1200000>;
772 };
773
774 ldo6 {
775 regulator-name = "vddio-sdmmc3";
776 regulator-min-microvolt = <1800000>;
777 regulator-max-microvolt = <3300000>;
778 regulator-boot-on;
779 regulator-always-on;
780 };
781
782 ldo7 {
783 regulator-name = "vdd-cam-rear";
784 regulator-min-microvolt = <1050000>;
785 regulator-max-microvolt = <1050000>;
786 };
787
788 ldo9 {
789 regulator-name = "vdd-touch";
790 regulator-min-microvolt = <2800000>;
791 regulator-max-microvolt = <2800000>;
792 };
793
794 ldo10 {
795 regulator-name = "vdd-cam-af";
796 regulator-min-microvolt = <2800000>;
797 regulator-max-microvolt = <2800000>;
798 };
799
800 ldo11 {
801 regulator-name = "vpp-fuse";
802 regulator-min-microvolt = <1800000>;
803 regulator-max-microvolt = <1800000>;
804 };
805 };
806 };
807 };
808
809 spi@7000d400 {
810 status = "okay";
811
812 cros-ec@0 {
813 compatible = "google,cros-ec-spi";
814 spi-max-frequency = <4000000>;
815 interrupt-parent = <&gpio>;
816 interrupts = <TEGRA_GPIO(C, 7) IRQ_TYPE_LEVEL_LOW>;
817 reg = <0>;
818
819 google,cros-ec-spi-msg-delay = <2000>;
820
821 cros-ec-keyb {
822 compatible = "google,cros-ec-keyb";
823 keypad,num-rows = <8>;
824 keypad,num-columns = <13>;
825 google,needs-ghost-filter;
826
827 linux,keymap = <
828 MATRIX_KEY(0x00, 0x01, KEY_LEFTMETA)
829 MATRIX_KEY(0x00, 0x02, KEY_F1)
830 MATRIX_KEY(0x00, 0x03, KEY_B)
831 MATRIX_KEY(0x00, 0x04, KEY_F10)
832 MATRIX_KEY(0x00, 0x06, KEY_N)
833 MATRIX_KEY(0x00, 0x08, KEY_EQUAL)
834 MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT)
835
836 MATRIX_KEY(0x01, 0x01, KEY_ESC)
837 MATRIX_KEY(0x01, 0x02, KEY_F4)
838 MATRIX_KEY(0x01, 0x03, KEY_G)
839 MATRIX_KEY(0x01, 0x04, KEY_F7)
840 MATRIX_KEY(0x01, 0x06, KEY_H)
841 MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE)
842 MATRIX_KEY(0x01, 0x09, KEY_F9)
843 MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE)
844
845 MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL)
846 MATRIX_KEY(0x02, 0x01, KEY_TAB)
847 MATRIX_KEY(0x02, 0x02, KEY_F3)
848 MATRIX_KEY(0x02, 0x03, KEY_T)
849 MATRIX_KEY(0x02, 0x04, KEY_F6)
850 MATRIX_KEY(0x02, 0x05, KEY_RIGHTBRACE)
851 MATRIX_KEY(0x02, 0x06, KEY_Y)
852 MATRIX_KEY(0x02, 0x07, KEY_102ND)
853 MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE)
854 MATRIX_KEY(0x02, 0x09, KEY_F8)
855
856 MATRIX_KEY(0x03, 0x01, KEY_GRAVE)
857 MATRIX_KEY(0x03, 0x02, KEY_F2)
858 MATRIX_KEY(0x03, 0x03, KEY_5)
859 MATRIX_KEY(0x03, 0x04, KEY_F5)
860 MATRIX_KEY(0x03, 0x06, KEY_6)
861 MATRIX_KEY(0x03, 0x08, KEY_MINUS)
862 MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH)
863
864 MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL)
865 MATRIX_KEY(0x04, 0x01, KEY_A)
866 MATRIX_KEY(0x04, 0x02, KEY_D)
867 MATRIX_KEY(0x04, 0x03, KEY_F)
868 MATRIX_KEY(0x04, 0x04, KEY_S)
869 MATRIX_KEY(0x04, 0x05, KEY_K)
870 MATRIX_KEY(0x04, 0x06, KEY_J)
871 MATRIX_KEY(0x04, 0x08, KEY_SEMICOLON)
872 MATRIX_KEY(0x04, 0x09, KEY_L)
873 MATRIX_KEY(0x04, 0x0a, KEY_BACKSLASH)
874 MATRIX_KEY(0x04, 0x0b, KEY_ENTER)
875
876 MATRIX_KEY(0x05, 0x01, KEY_Z)
877 MATRIX_KEY(0x05, 0x02, KEY_C)
878 MATRIX_KEY(0x05, 0x03, KEY_V)
879 MATRIX_KEY(0x05, 0x04, KEY_X)
880 MATRIX_KEY(0x05, 0x05, KEY_COMMA)
881 MATRIX_KEY(0x05, 0x06, KEY_M)
882 MATRIX_KEY(0x05, 0x07, KEY_LEFTSHIFT)
883 MATRIX_KEY(0x05, 0x08, KEY_SLASH)
884 MATRIX_KEY(0x05, 0x09, KEY_DOT)
885 MATRIX_KEY(0x05, 0x0b, KEY_SPACE)
886
887 MATRIX_KEY(0x06, 0x01, KEY_1)
888 MATRIX_KEY(0x06, 0x02, KEY_3)
889 MATRIX_KEY(0x06, 0x03, KEY_4)
890 MATRIX_KEY(0x06, 0x04, KEY_2)
891 MATRIX_KEY(0x06, 0x05, KEY_8)
892 MATRIX_KEY(0x06, 0x06, KEY_7)
893 MATRIX_KEY(0x06, 0x08, KEY_0)
894 MATRIX_KEY(0x06, 0x09, KEY_9)
895 MATRIX_KEY(0x06, 0x0a, KEY_LEFTALT)
896 MATRIX_KEY(0x06, 0x0b, KEY_DOWN)
897 MATRIX_KEY(0x06, 0x0c, KEY_RIGHT)
898
899 MATRIX_KEY(0x07, 0x01, KEY_Q)
900 MATRIX_KEY(0x07, 0x02, KEY_E)
901 MATRIX_KEY(0x07, 0x03, KEY_R)
902 MATRIX_KEY(0x07, 0x04, KEY_W)
903 MATRIX_KEY(0x07, 0x05, KEY_I)
904 MATRIX_KEY(0x07, 0x06, KEY_U)
905 MATRIX_KEY(0x07, 0x07, KEY_RIGHTSHIFT)
906 MATRIX_KEY(0x07, 0x08, KEY_P)
907 MATRIX_KEY(0x07, 0x09, KEY_O)
908 MATRIX_KEY(0x07, 0x0b, KEY_UP)
909 MATRIX_KEY(0x07, 0x0c, KEY_LEFT)
910 >;
911 };
912 };
913 };
914
17 pmc@7000e400 { 915 pmc@7000e400 {
18 nvidia,invert-interrupt; 916 nvidia,invert-interrupt;
19 nvidia,suspend-mode = <1>; 917 nvidia,suspend-mode = <1>;
@@ -24,4 +922,170 @@
24 nvidia,core-power-req-active-high; 922 nvidia,core-power-req-active-high;
25 nvidia,sys-clock-req-active-high; 923 nvidia,sys-clock-req-active-high;
26 }; 924 };
925
926 sdhci@700b0400 {
927 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
928 power-gpios = <&gpio TEGRA_GPIO(R, 0) GPIO_ACTIVE_HIGH>;
929 status = "okay";
930 bus-width = <4>;
931 };
932
933 sdhci@700b0600 {
934 status = "okay";
935 bus-width = <8>;
936 };
937
938 ahub@70300000 {
939 i2s@70301100 {
940 status = "okay";
941 };
942 };
943
944 clocks {
945 compatible = "simple-bus";
946 #address-cells = <1>;
947 #size-cells = <0>;
948
949 clk32k_in: clock@0 {
950 compatible = "fixed-clock";
951 reg=<0>;
952 #clock-cells = <0>;
953 clock-frequency = <32768>;
954 };
955 };
956
957 gpio-keys {
958 compatible = "gpio-keys";
959
960 power {
961 label = "Power";
962 gpios = <&gpio TEGRA_GPIO(Q, 0) GPIO_ACTIVE_LOW>;
963 linux,code = <KEY_POWER>;
964 debounce-interval = <10>;
965 gpio-key,wakeup;
966 };
967 };
968
969 regulators {
970 compatible = "simple-bus";
971 #address-cells = <1>;
972 #size-cells = <0>;
973
974 vdd_ac_bat_reg: regulator@0 {
975 compatible = "regulator-fixed";
976 reg = <0>;
977 regulator-name = "vdd_ac_bat";
978 regulator-min-microvolt = <5000000>;
979 regulator-max-microvolt = <5000000>;
980 regulator-always-on;
981 };
982
983 vdd_3v3_reg: regulator@1 {
984 compatible = "regulator-fixed";
985 reg = <1>;
986 regulator-name = "vdd_3v3";
987 regulator-min-microvolt = <3300000>;
988 regulator-max-microvolt = <3300000>;
989 regulator-always-on;
990 regulator-boot-on;
991 enable-active-high;
992 gpio = <&as3722 1 GPIO_ACTIVE_HIGH>;
993 };
994
995 vdd_3v3_modem_reg: regulator@2 {
996 compatible = "regulator-fixed";
997 reg = <2>;
998 regulator-name = "vdd-modem-3v3";
999 regulator-min-microvolt = <3300000>;
1000 regulator-max-microvolt = <3300000>;
1001 enable-active-high;
1002 gpio = <&as3722 2 GPIO_ACTIVE_HIGH>;
1003 };
1004
1005 vdd_hdmi_5v0_reg: regulator@3 {
1006 compatible = "regulator-fixed";
1007 reg = <3>;
1008 regulator-name = "vdd-hdmi-5v0";
1009 regulator-min-microvolt = <5000000>;
1010 regulator-max-microvolt = <5000000>;
1011 enable-active-high;
1012 gpio = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_HIGH>;
1013 };
1014
1015 vdd_bl_reg: regulator@4 {
1016 compatible = "regulator-fixed";
1017 reg = <4>;
1018 regulator-name = "vdd-bl";
1019 regulator-min-microvolt = <3300000>;
1020 regulator-max-microvolt = <3300000>;
1021 gpio = <&gpio TEGRA_GPIO(P, 2) GPIO_ACTIVE_LOW>;
1022 };
1023
1024 vdd_ts_sw_5v0: regulator@5 {
1025 compatible = "regulator-fixed";
1026 reg = <5>;
1027 regulator-name = "vdd_ts_sw";
1028 regulator-min-microvolt = <5000000>;
1029 regulator-max-microvolt = <5000000>;
1030 enable-active-high;
1031 regulator-boot-on;
1032 gpio = <&gpio TEGRA_GPIO(K, 1) GPIO_ACTIVE_LOW>;
1033 };
1034
1035 usb1_vbus_reg: regulator@6 {
1036 compatible = "regulator-fixed";
1037 reg = <6>;
1038 regulator-name = "usb1_vbus";
1039 regulator-min-microvolt = <5000000>;
1040 regulator-max-microvolt = <5000000>;
1041 regulator-boot-on;
1042 enable-active-high;
1043 gpio = <&gpio TEGRA_GPIO(N, 4) GPIO_ACTIVE_HIGH>;
1044 gpio-open-drain;
1045 };
1046
1047 usb3_vbus_reg: regulator@7 {
1048 compatible = "regulator-fixed";
1049 reg = <7>;
1050 regulator-name = "usb3_vbus";
1051 regulator-min-microvolt = <5000000>;
1052 regulator-max-microvolt = <5000000>;
1053 regulator-boot-on;
1054 enable-active-high;
1055 gpio = <&gpio TEGRA_GPIO(N, 5) GPIO_ACTIVE_HIGH>;
1056 gpio-open-drain;
1057 };
1058
1059 panel_3v3_reg: regulator@8 {
1060 compatible = "regulator-fixed";
1061 reg = <8>;
1062 regulator-name = "panel_3v3";
1063 regulator-min-microvolt = <3300000>;
1064 regulator-max-microvolt = <3300000>;
1065 enable-active-high;
1066 gpio = <&as3722 4 GPIO_ACTIVE_HIGH>;
1067 };
1068 };
1069
1070 sound {
1071 compatible = "nvidia,tegra-audio-max98090-venice2",
1072 "nvidia,tegra-audio-max98090";
1073 nvidia,model = "NVIDIA Tegra Venice2";
1074
1075 nvidia,audio-routing =
1076 "Headphones", "HPR",
1077 "Headphones", "HPL",
1078 "Speakers", "SPKR",
1079 "Speakers", "SPKL",
1080 "Mic Jack", "MICBIAS",
1081 "IN34", "Mic Jack";
1082
1083 nvidia,i2s-controller = <&tegra_i2s1>;
1084 nvidia,audio-codec = <&acodec>;
1085
1086 clocks = <&tegra_car TEGRA124_CLK_PLL_A>,
1087 <&tegra_car TEGRA124_CLK_PLL_A_OUT0>,
1088 <&tegra_car TEGRA124_CLK_EXTERN1>;
1089 clock-names = "pll_a", "pll_a_out0", "mclk";
1090 };
27}; 1091};
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi
index b7413004ee77..ec0698a8354a 100644
--- a/arch/arm/boot/dts/tegra124.dtsi
+++ b/arch/arm/boot/dts/tegra124.dtsi
@@ -1,4 +1,6 @@
1#include <dt-bindings/clock/tegra124-car.h>
1#include <dt-bindings/gpio/tegra-gpio.h> 2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/pinctrl/pinctrl-tegra.h>
2#include <dt-bindings/interrupt-controller/arm-gic.h> 4#include <dt-bindings/interrupt-controller/arm-gic.h>
3 5
4#include "skeleton.dtsi" 6#include "skeleton.dtsi"
@@ -28,6 +30,14 @@
28 <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>, 30 <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
29 <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, 31 <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
30 <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>; 32 <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
33 clocks = <&tegra_car TEGRA124_CLK_TIMER>;
34 };
35
36 tegra_car: clock@60006000 {
37 compatible = "nvidia,tegra124-car";
38 reg = <0x60006000 0x1000>;
39 #clock-cells = <1>;
40 #reset-cells = <1>;
31 }; 41 };
32 42
33 gpio: gpio@6000d000 { 43 gpio: gpio@6000d000 {
@@ -47,6 +57,53 @@
47 interrupt-controller; 57 interrupt-controller;
48 }; 58 };
49 59
60 apbdma: dma@60020000 {
61 compatible = "nvidia,tegra124-apbdma", "nvidia,tegra148-apbdma";
62 reg = <0x60020000 0x1400>;
63 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
64 <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
65 <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
66 <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>,
67 <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
68 <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
69 <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
70 <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
71 <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
72 <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
73 <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
74 <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
75 <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
76 <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
77 <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
78 <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
79 <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>,
80 <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>,
81 <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>,
82 <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
83 <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>,
84 <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>,
85 <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
86 <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
87 <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>,
88 <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>,
89 <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>,
90 <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>,
91 <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
92 <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
93 <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
94 <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
95 clocks = <&tegra_car TEGRA124_CLK_APBDMA>;
96 resets = <&tegra_car 34>;
97 reset-names = "dma";
98 #dma-cells = <1>;
99 };
100
101 pinmux: pinmux@70000868 {
102 compatible = "nvidia,tegra124-pinmux";
103 reg = <0x70000868 0x164>, /* Pad control registers */
104 <0x70003000 0x434>; /* Mux registers */
105 };
106
50 /* 107 /*
51 * There are two serial driver i.e. 8250 based simple serial 108 * There are two serial driver i.e. 8250 based simple serial
52 * driver and APB DMA based serial driver for higher baudrate 109 * driver and APB DMA based serial driver for higher baudrate
@@ -60,6 +117,11 @@
60 reg = <0x70006000 0x40>; 117 reg = <0x70006000 0x40>;
61 reg-shift = <2>; 118 reg-shift = <2>;
62 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; 119 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
120 clocks = <&tegra_car TEGRA124_CLK_UARTA>;
121 resets = <&tegra_car 6>;
122 reset-names = "serial";
123 dmas = <&apbdma 8>, <&apbdma 8>;
124 dma-names = "rx", "tx";
63 status = "disabled"; 125 status = "disabled";
64 }; 126 };
65 127
@@ -68,6 +130,11 @@
68 reg = <0x70006040 0x40>; 130 reg = <0x70006040 0x40>;
69 reg-shift = <2>; 131 reg-shift = <2>;
70 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; 132 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
133 clocks = <&tegra_car TEGRA124_CLK_UARTB>;
134 resets = <&tegra_car 7>;
135 reset-names = "serial";
136 dmas = <&apbdma 9>, <&apbdma 9>;
137 dma-names = "rx", "tx";
71 status = "disabled"; 138 status = "disabled";
72 }; 139 };
73 140
@@ -76,6 +143,11 @@
76 reg = <0x70006200 0x40>; 143 reg = <0x70006200 0x40>;
77 reg-shift = <2>; 144 reg-shift = <2>;
78 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 145 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
146 clocks = <&tegra_car TEGRA124_CLK_UARTC>;
147 resets = <&tegra_car 55>;
148 reset-names = "serial";
149 dmas = <&apbdma 10>, <&apbdma 10>;
150 dma-names = "rx", "tx";
79 status = "disabled"; 151 status = "disabled";
80 }; 152 };
81 153
@@ -84,6 +156,11 @@
84 reg = <0x70006300 0x40>; 156 reg = <0x70006300 0x40>;
85 reg-shift = <2>; 157 reg-shift = <2>;
86 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; 158 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
159 clocks = <&tegra_car TEGRA124_CLK_UARTD>;
160 resets = <&tegra_car 65>;
161 reset-names = "serial";
162 dmas = <&apbdma 19>, <&apbdma 19>;
163 dma-names = "rx", "tx";
87 status = "disabled"; 164 status = "disabled";
88 }; 165 };
89 166
@@ -92,6 +169,201 @@
92 reg = <0x70006400 0x40>; 169 reg = <0x70006400 0x40>;
93 reg-shift = <2>; 170 reg-shift = <2>;
94 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; 171 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
172 clocks = <&tegra_car TEGRA124_CLK_UARTE>;
173 resets = <&tegra_car 66>;
174 reset-names = "serial";
175 dmas = <&apbdma 20>, <&apbdma 20>;
176 dma-names = "rx", "tx";
177 status = "disabled";
178 };
179
180 pwm@7000a000 {
181 compatible = "nvidia,tegra124-pwm", "nvidia,tegra20-pwm";
182 reg = <0x7000a000 0x100>;
183 #pwm-cells = <2>;
184 clocks = <&tegra_car TEGRA124_CLK_PWM>;
185 resets = <&tegra_car 17>;
186 reset-names = "pwm";
187 status = "disabled";
188 };
189
190 i2c@7000c000 {
191 compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
192 reg = <0x7000c000 0x100>;
193 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
194 #address-cells = <1>;
195 #size-cells = <0>;
196 clocks = <&tegra_car TEGRA124_CLK_I2C1>;
197 clock-names = "div-clk";
198 resets = <&tegra_car 12>;
199 reset-names = "i2c";
200 dmas = <&apbdma 21>, <&apbdma 21>;
201 dma-names = "rx", "tx";
202 status = "disabled";
203 };
204
205 i2c@7000c400 {
206 compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
207 reg = <0x7000c400 0x100>;
208 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
209 #address-cells = <1>;
210 #size-cells = <0>;
211 clocks = <&tegra_car TEGRA124_CLK_I2C2>;
212 clock-names = "div-clk";
213 resets = <&tegra_car 54>;
214 reset-names = "i2c";
215 dmas = <&apbdma 22>, <&apbdma 22>;
216 dma-names = "rx", "tx";
217 status = "disabled";
218 };
219
220 i2c@7000c500 {
221 compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
222 reg = <0x7000c500 0x100>;
223 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
224 #address-cells = <1>;
225 #size-cells = <0>;
226 clocks = <&tegra_car TEGRA124_CLK_I2C3>;
227 clock-names = "div-clk";
228 resets = <&tegra_car 67>;
229 reset-names = "i2c";
230 dmas = <&apbdma 23>, <&apbdma 23>;
231 dma-names = "rx", "tx";
232 status = "disabled";
233 };
234
235 i2c@7000c700 {
236 compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
237 reg = <0x7000c700 0x100>;
238 interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
239 #address-cells = <1>;
240 #size-cells = <0>;
241 clocks = <&tegra_car TEGRA124_CLK_I2C4>;
242 clock-names = "div-clk";
243 resets = <&tegra_car 103>;
244 reset-names = "i2c";
245 dmas = <&apbdma 26>, <&apbdma 26>;
246 dma-names = "rx", "tx";
247 status = "disabled";
248 };
249
250 i2c@7000d000 {
251 compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
252 reg = <0x7000d000 0x100>;
253 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
254 #address-cells = <1>;
255 #size-cells = <0>;
256 clocks = <&tegra_car TEGRA124_CLK_I2C5>;
257 clock-names = "div-clk";
258 resets = <&tegra_car 47>;
259 reset-names = "i2c";
260 dmas = <&apbdma 24>, <&apbdma 24>;
261 dma-names = "rx", "tx";
262 status = "disabled";
263 };
264
265 i2c@7000d100 {
266 compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
267 reg = <0x7000d100 0x100>;
268 interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
269 #address-cells = <1>;
270 #size-cells = <0>;
271 clocks = <&tegra_car TEGRA124_CLK_I2C6>;
272 clock-names = "div-clk";
273 resets = <&tegra_car 166>;
274 reset-names = "i2c";
275 dmas = <&apbdma 30>, <&apbdma 30>;
276 dma-names = "rx", "tx";
277 status = "disabled";
278 };
279
280 spi@7000d400 {
281 compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
282 reg = <0x7000d400 0x200>;
283 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
284 #address-cells = <1>;
285 #size-cells = <0>;
286 clocks = <&tegra_car TEGRA124_CLK_SBC1>;
287 clock-names = "spi";
288 resets = <&tegra_car 41>;
289 reset-names = "spi";
290 dmas = <&apbdma 15>, <&apbdma 15>;
291 dma-names = "rx", "tx";
292 status = "disabled";
293 };
294
295 spi@7000d600 {
296 compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
297 reg = <0x7000d600 0x200>;
298 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
299 #address-cells = <1>;
300 #size-cells = <0>;
301 clocks = <&tegra_car TEGRA124_CLK_SBC2>;
302 clock-names = "spi";
303 resets = <&tegra_car 44>;
304 reset-names = "spi";
305 dmas = <&apbdma 16>, <&apbdma 16>;
306 dma-names = "rx", "tx";
307 status = "disabled";
308 };
309
310 spi@7000d800 {
311 compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
312 reg = <0x7000d800 0x200>;
313 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
314 #address-cells = <1>;
315 #size-cells = <0>;
316 clocks = <&tegra_car TEGRA124_CLK_SBC3>;
317 clock-names = "spi";
318 resets = <&tegra_car 46>;
319 reset-names = "spi";
320 dmas = <&apbdma 17>, <&apbdma 17>;
321 dma-names = "rx", "tx";
322 status = "disabled";
323 };
324
325 spi@7000da00 {
326 compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
327 reg = <0x7000da00 0x200>;
328 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
329 #address-cells = <1>;
330 #size-cells = <0>;
331 clocks = <&tegra_car TEGRA124_CLK_SBC4>;
332 clock-names = "spi";
333 resets = <&tegra_car 68>;
334 reset-names = "spi";
335 dmas = <&apbdma 18>, <&apbdma 18>;
336 dma-names = "rx", "tx";
337 status = "disabled";
338 };
339
340 spi@7000dc00 {
341 compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
342 reg = <0x7000dc00 0x200>;
343 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
344 #address-cells = <1>;
345 #size-cells = <0>;
346 clocks = <&tegra_car TEGRA124_CLK_SBC5>;
347 clock-names = "spi";
348 resets = <&tegra_car 104>;
349 reset-names = "spi";
350 dmas = <&apbdma 27>, <&apbdma 27>;
351 dma-names = "rx", "tx";
352 status = "disabled";
353 };
354
355 spi@7000de00 {
356 compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
357 reg = <0x7000de00 0x200>;
358 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
359 #address-cells = <1>;
360 #size-cells = <0>;
361 clocks = <&tegra_car TEGRA124_CLK_SBC6>;
362 clock-names = "spi";
363 resets = <&tegra_car 105>;
364 reset-names = "spi";
365 dmas = <&apbdma 28>, <&apbdma 28>;
366 dma-names = "rx", "tx";
95 status = "disabled"; 367 status = "disabled";
96 }; 368 };
97 369
@@ -99,11 +371,157 @@
99 compatible = "nvidia,tegra124-rtc", "nvidia,tegra20-rtc"; 371 compatible = "nvidia,tegra124-rtc", "nvidia,tegra20-rtc";
100 reg = <0x7000e000 0x100>; 372 reg = <0x7000e000 0x100>;
101 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; 373 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
374 clocks = <&tegra_car TEGRA124_CLK_RTC>;
102 }; 375 };
103 376
104 pmc@7000e400 { 377 pmc@7000e400 {
105 compatible = "nvidia,tegra124-pmc"; 378 compatible = "nvidia,tegra124-pmc";
106 reg = <0x7000e400 0x400>; 379 reg = <0x7000e400 0x400>;
380 clocks = <&tegra_car TEGRA124_CLK_PCLK>, <&clk32k_in>;
381 clock-names = "pclk", "clk32k_in";
382 };
383
384 sdhci@700b0000 {
385 compatible = "nvidia,tegra124-sdhci";
386 reg = <0x700b0000 0x200>;
387 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
388 clocks = <&tegra_car TEGRA124_CLK_SDMMC1>;
389 resets = <&tegra_car 14>;
390 reset-names = "sdhci";
391 status = "disable";
392 };
393
394 sdhci@700b0200 {
395 compatible = "nvidia,tegra124-sdhci";
396 reg = <0x700b0200 0x200>;
397 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
398 clocks = <&tegra_car TEGRA124_CLK_SDMMC2>;
399 resets = <&tegra_car 9>;
400 reset-names = "sdhci";
401 status = "disable";
402 };
403
404 sdhci@700b0400 {
405 compatible = "nvidia,tegra124-sdhci";
406 reg = <0x700b0400 0x200>;
407 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
408 clocks = <&tegra_car TEGRA124_CLK_SDMMC3>;
409 resets = <&tegra_car 69>;
410 reset-names = "sdhci";
411 status = "disable";
412 };
413
414 sdhci@700b0600 {
415 compatible = "nvidia,tegra124-sdhci";
416 reg = <0x700b0600 0x200>;
417 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
418 clocks = <&tegra_car TEGRA124_CLK_SDMMC4>;
419 resets = <&tegra_car 15>;
420 reset-names = "sdhci";
421 status = "disable";
422 };
423
424 ahub@70300000 {
425 compatible = "nvidia,tegra124-ahub";
426 reg = <0x70300000 0x200>,
427 <0x70300800 0x800>,
428 <0x70300200 0x600>;
429 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
430 clocks = <&tegra_car TEGRA124_CLK_D_AUDIO>,
431 <&tegra_car TEGRA124_CLK_APBIF>;
432 clock-names = "d_audio", "apbif";
433 resets = <&tegra_car 106>, /* d_audio */
434 <&tegra_car 107>, /* apbif */
435 <&tegra_car 30>, /* i2s0 */
436 <&tegra_car 11>, /* i2s1 */
437 <&tegra_car 18>, /* i2s2 */
438 <&tegra_car 101>, /* i2s3 */
439 <&tegra_car 102>, /* i2s4 */
440 <&tegra_car 108>, /* dam0 */
441 <&tegra_car 109>, /* dam1 */
442 <&tegra_car 110>, /* dam2 */
443 <&tegra_car 10>, /* spdif */
444 <&tegra_car 153>, /* amx */
445 <&tegra_car 185>, /* amx1 */
446 <&tegra_car 154>, /* adx */
447 <&tegra_car 180>, /* adx1 */
448 <&tegra_car 186>, /* afc0 */
449 <&tegra_car 187>, /* afc1 */
450 <&tegra_car 188>, /* afc2 */
451 <&tegra_car 189>, /* afc3 */
452 <&tegra_car 190>, /* afc4 */
453 <&tegra_car 191>; /* afc5 */
454 reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
455 "i2s3", "i2s4", "dam0", "dam1", "dam2",
456 "spdif", "amx", "amx1", "adx", "adx1",
457 "afc0", "afc1", "afc2", "afc3", "afc4", "afc5";
458 dmas = <&apbdma 1>, <&apbdma 1>,
459 <&apbdma 2>, <&apbdma 2>,
460 <&apbdma 3>, <&apbdma 3>,
461 <&apbdma 4>, <&apbdma 4>,
462 <&apbdma 6>, <&apbdma 6>,
463 <&apbdma 7>, <&apbdma 7>,
464 <&apbdma 12>, <&apbdma 12>,
465 <&apbdma 13>, <&apbdma 13>,
466 <&apbdma 14>, <&apbdma 14>,
467 <&apbdma 29>, <&apbdma 29>;
468 dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2",
469 "rx3", "tx3", "rx4", "tx4", "rx5", "tx5",
470 "rx6", "tx6", "rx7", "tx7", "rx8", "tx8",
471 "rx9", "tx9";
472 ranges;
473 #address-cells = <1>;
474 #size-cells = <1>;
475
476 tegra_i2s0: i2s@70301000 {
477 compatible = "nvidia,tegra124-i2s";
478 reg = <0x70301000 0x100>;
479 nvidia,ahub-cif-ids = <4 4>;
480 clocks = <&tegra_car TEGRA124_CLK_I2S0>;
481 resets = <&tegra_car 30>;
482 reset-names = "i2s";
483 status = "disabled";
484 };
485
486 tegra_i2s1: i2s@70301100 {
487 compatible = "nvidia,tegra124-i2s";
488 reg = <0x70301100 0x100>;
489 nvidia,ahub-cif-ids = <5 5>;
490 clocks = <&tegra_car TEGRA124_CLK_I2S1>;
491 resets = <&tegra_car 11>;
492 reset-names = "i2s";
493 status = "disabled";
494 };
495
496 tegra_i2s2: i2s@70301200 {
497 compatible = "nvidia,tegra124-i2s";
498 reg = <0x70301200 0x100>;
499 nvidia,ahub-cif-ids = <6 6>;
500 clocks = <&tegra_car TEGRA124_CLK_I2S2>;
501 resets = <&tegra_car 18>;
502 reset-names = "i2s";
503 status = "disabled";
504 };
505
506 tegra_i2s3: i2s@70301300 {
507 compatible = "nvidia,tegra124-i2s";
508 reg = <0x70301300 0x100>;
509 nvidia,ahub-cif-ids = <7 7>;
510 clocks = <&tegra_car TEGRA124_CLK_I2S3>;
511 resets = <&tegra_car 101>;
512 reset-names = "i2s";
513 status = "disabled";
514 };
515
516 tegra_i2s4: i2s@70301400 {
517 compatible = "nvidia,tegra124-i2s";
518 reg = <0x70301400 0x100>;
519 nvidia,ahub-cif-ids = <8 8>;
520 clocks = <&tegra_car TEGRA124_CLK_I2S4>;
521 resets = <&tegra_car 102>;
522 reset-names = "i2s";
523 status = "disabled";
524 };
107 }; 525 };
108 526
109 cpus { 527 cpus {
diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
index d5c9bca01232..8e0066ad9628 100644
--- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi
+++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
@@ -4,12 +4,17 @@
4 model = "Toradex Colibri T20 512MB"; 4 model = "Toradex Colibri T20 512MB";
5 compatible = "toradex,colibri_t20-512", "nvidia,tegra20"; 5 compatible = "toradex,colibri_t20-512", "nvidia,tegra20";
6 6
7 aliases {
8 rtc0 = "/i2c@7000d000/tps6586x@34";
9 rtc1 = "/rtc@7000e000";
10 };
11
7 memory { 12 memory {
8 reg = <0x00000000 0x20000000>; 13 reg = <0x00000000 0x20000000>;
9 }; 14 };
10 15
11 host1x { 16 host1x@50000000 {
12 hdmi { 17 hdmi@54280000 {
13 vdd-supply = <&hdmi_vdd_reg>; 18 vdd-supply = <&hdmi_vdd_reg>;
14 pll-supply = <&hdmi_pll_reg>; 19 pll-supply = <&hdmi_pll_reg>;
15 20
@@ -19,7 +24,7 @@
19 }; 24 };
20 }; 25 };
21 26
22 pinmux { 27 pinmux@70000014 {
23 pinctrl-names = "default"; 28 pinctrl-names = "default";
24 pinctrl-0 = <&state_default>; 29 pinctrl-0 = <&state_default>;
25 30
@@ -27,20 +32,20 @@
27 audio_refclk { 32 audio_refclk {
28 nvidia,pins = "cdev1"; 33 nvidia,pins = "cdev1";
29 nvidia,function = "plla_out"; 34 nvidia,function = "plla_out";
30 nvidia,pull = <0>; 35 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
31 nvidia,tristate = <0>; 36 nvidia,tristate = <TEGRA_PIN_DISABLE>;
32 }; 37 };
33 crt { 38 crt {
34 nvidia,pins = "crtp"; 39 nvidia,pins = "crtp";
35 nvidia,function = "crt"; 40 nvidia,function = "crt";
36 nvidia,pull = <0>; 41 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
37 nvidia,tristate = <1>; 42 nvidia,tristate = <TEGRA_PIN_ENABLE>;
38 }; 43 };
39 dap3 { 44 dap3 {
40 nvidia,pins = "dap3"; 45 nvidia,pins = "dap3";
41 nvidia,function = "dap3"; 46 nvidia,function = "dap3";
42 nvidia,pull = <0>; 47 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
43 nvidia,tristate = <0>; 48 nvidia,tristate = <TEGRA_PIN_DISABLE>;
44 }; 49 };
45 displaya { 50 displaya {
46 nvidia,pins = "ld0", "ld1", "ld2", "ld3", 51 nvidia,pins = "ld0", "ld1", "ld2", "ld3",
@@ -50,155 +55,163 @@
50 "lhs", "lpw0", "lpw2", "lsc0", 55 "lhs", "lpw0", "lpw2", "lsc0",
51 "lsc1", "lsck", "lsda", "lspi", "lvs"; 56 "lsc1", "lsck", "lsda", "lspi", "lvs";
52 nvidia,function = "displaya"; 57 nvidia,function = "displaya";
53 nvidia,tristate = <1>; 58 nvidia,tristate = <TEGRA_PIN_ENABLE>;
54 }; 59 };
55 gpio_dte { 60 gpio_dte {
56 nvidia,pins = "dte"; 61 nvidia,pins = "dte";
57 nvidia,function = "rsvd1"; 62 nvidia,function = "rsvd1";
58 nvidia,pull = <0>; 63 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
59 nvidia,tristate = <0>; 64 nvidia,tristate = <TEGRA_PIN_DISABLE>;
60 }; 65 };
61 gpio_gmi { 66 gpio_gmi {
62 nvidia,pins = "ata", "atc", "atd", "ate", 67 nvidia,pins = "ata", "atc", "atd", "ate",
63 "dap1", "dap2", "dap4", "gpu", "irrx", 68 "dap1", "dap2", "dap4", "gpu", "irrx",
64 "irtx", "spia", "spib", "spic"; 69 "irtx", "spia", "spib", "spic";
65 nvidia,function = "gmi"; 70 nvidia,function = "gmi";
66 nvidia,pull = <0>; 71 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
67 nvidia,tristate = <0>; 72 nvidia,tristate = <TEGRA_PIN_DISABLE>;
68 }; 73 };
69 gpio_pta { 74 gpio_pta {
70 nvidia,pins = "pta"; 75 nvidia,pins = "pta";
71 nvidia,function = "rsvd4"; 76 nvidia,function = "rsvd4";
72 nvidia,pull = <0>; 77 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
73 nvidia,tristate = <0>; 78 nvidia,tristate = <TEGRA_PIN_DISABLE>;
74 }; 79 };
75 gpio_uac { 80 gpio_uac {
76 nvidia,pins = "uac"; 81 nvidia,pins = "uac";
77 nvidia,function = "rsvd2"; 82 nvidia,function = "rsvd2";
78 nvidia,pull = <0>; 83 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
79 nvidia,tristate = <0>; 84 nvidia,tristate = <TEGRA_PIN_DISABLE>;
80 }; 85 };
81 hdint { 86 hdint {
82 nvidia,pins = "hdint"; 87 nvidia,pins = "hdint";
83 nvidia,function = "hdmi"; 88 nvidia,function = "hdmi";
84 nvidia,tristate = <1>; 89 nvidia,tristate = <TEGRA_PIN_ENABLE>;
85 }; 90 };
86 i2c1 { 91 i2c1 {
87 nvidia,pins = "rm"; 92 nvidia,pins = "rm";
88 nvidia,function = "i2c1"; 93 nvidia,function = "i2c1";
89 nvidia,pull = <0>; 94 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
90 nvidia,tristate = <1>; 95 nvidia,tristate = <TEGRA_PIN_ENABLE>;
91 }; 96 };
92 i2c3 { 97 i2c3 {
93 nvidia,pins = "dtf"; 98 nvidia,pins = "dtf";
94 nvidia,function = "i2c3"; 99 nvidia,function = "i2c3";
95 nvidia,pull = <0>; 100 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
96 nvidia,tristate = <1>; 101 nvidia,tristate = <TEGRA_PIN_ENABLE>;
97 }; 102 };
98 i2cddc { 103 i2cddc {
99 nvidia,pins = "ddc"; 104 nvidia,pins = "ddc";
100 nvidia,function = "i2c2"; 105 nvidia,function = "i2c2";
101 nvidia,pull = <2>; 106 nvidia,pull = <TEGRA_PIN_PULL_UP>;
102 nvidia,tristate = <1>; 107 nvidia,tristate = <TEGRA_PIN_ENABLE>;
103 }; 108 };
104 i2cp { 109 i2cp {
105 nvidia,pins = "i2cp"; 110 nvidia,pins = "i2cp";
106 nvidia,function = "i2cp"; 111 nvidia,function = "i2cp";
107 nvidia,pull = <0>; 112 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
108 nvidia,tristate = <0>; 113 nvidia,tristate = <TEGRA_PIN_DISABLE>;
109 }; 114 };
110 irda { 115 irda {
111 nvidia,pins = "uad"; 116 nvidia,pins = "uad";
112 nvidia,function = "irda"; 117 nvidia,function = "irda";
113 nvidia,pull = <0>; 118 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
114 nvidia,tristate = <1>; 119 nvidia,tristate = <TEGRA_PIN_ENABLE>;
115 }; 120 };
116 nand { 121 nand {
117 nvidia,pins = "kbca", "kbcc", "kbcd", 122 nvidia,pins = "kbca", "kbcc", "kbcd",
118 "kbce", "kbcf"; 123 "kbce", "kbcf";
119 nvidia,function = "nand"; 124 nvidia,function = "nand";
120 nvidia,pull = <0>; 125 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
121 nvidia,tristate = <0>; 126 nvidia,tristate = <TEGRA_PIN_DISABLE>;
122 }; 127 };
123 owc { 128 owc {
124 nvidia,pins = "owc"; 129 nvidia,pins = "owc";
125 nvidia,function = "owr"; 130 nvidia,function = "owr";
126 nvidia,pull = <0>; 131 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
127 nvidia,tristate = <1>; 132 nvidia,tristate = <TEGRA_PIN_ENABLE>;
128 }; 133 };
129 pmc { 134 pmc {
130 nvidia,pins = "pmc"; 135 nvidia,pins = "pmc";
131 nvidia,function = "pwr_on"; 136 nvidia,function = "pwr_on";
132 nvidia,tristate = <0>; 137 nvidia,tristate = <TEGRA_PIN_DISABLE>;
133 }; 138 };
134 pwm { 139 pwm {
135 nvidia,pins = "sdb", "sdc", "sdd"; 140 nvidia,pins = "sdb", "sdc", "sdd";
136 nvidia,function = "pwm"; 141 nvidia,function = "pwm";
137 nvidia,tristate = <1>; 142 nvidia,tristate = <TEGRA_PIN_ENABLE>;
138 }; 143 };
139 sdio4 { 144 sdio4 {
140 nvidia,pins = "atb", "gma", "gme"; 145 nvidia,pins = "atb", "gma", "gme";
141 nvidia,function = "sdio4"; 146 nvidia,function = "sdio4";
142 nvidia,pull = <0>; 147 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
143 nvidia,tristate = <1>; 148 nvidia,tristate = <TEGRA_PIN_ENABLE>;
144 }; 149 };
145 spi1 { 150 spi1 {
146 nvidia,pins = "spid", "spie", "spif"; 151 nvidia,pins = "spid", "spie", "spif";
147 nvidia,function = "spi1"; 152 nvidia,function = "spi1";
148 nvidia,pull = <0>; 153 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
149 nvidia,tristate = <1>; 154 nvidia,tristate = <TEGRA_PIN_ENABLE>;
150 }; 155 };
151 spi4 { 156 spi4 {
152 nvidia,pins = "slxa", "slxc", "slxd", "slxk"; 157 nvidia,pins = "slxa", "slxc", "slxd", "slxk";
153 nvidia,function = "spi4"; 158 nvidia,function = "spi4";
154 nvidia,pull = <0>; 159 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
155 nvidia,tristate = <1>; 160 nvidia,tristate = <TEGRA_PIN_ENABLE>;
156 }; 161 };
157 uarta { 162 uarta {
158 nvidia,pins = "sdio1"; 163 nvidia,pins = "sdio1";
159 nvidia,function = "uarta"; 164 nvidia,function = "uarta";
160 nvidia,pull = <0>; 165 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
161 nvidia,tristate = <1>; 166 nvidia,tristate = <TEGRA_PIN_ENABLE>;
162 }; 167 };
163 uartd { 168 uartd {
164 nvidia,pins = "gmc"; 169 nvidia,pins = "gmc";
165 nvidia,function = "uartd"; 170 nvidia,function = "uartd";
166 nvidia,pull = <0>; 171 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
167 nvidia,tristate = <1>; 172 nvidia,tristate = <TEGRA_PIN_ENABLE>;
168 }; 173 };
169 ulpi { 174 ulpi {
170 nvidia,pins = "uaa", "uab", "uda"; 175 nvidia,pins = "uaa", "uab", "uda";
171 nvidia,function = "ulpi"; 176 nvidia,function = "ulpi";
172 nvidia,pull = <0>; 177 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
173 nvidia,tristate = <0>; 178 nvidia,tristate = <TEGRA_PIN_DISABLE>;
174 }; 179 };
175 ulpi_refclk { 180 ulpi_refclk {
176 nvidia,pins = "cdev2"; 181 nvidia,pins = "cdev2";
177 nvidia,function = "pllp_out4"; 182 nvidia,function = "pllp_out4";
178 nvidia,pull = <0>; 183 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
179 nvidia,tristate = <0>; 184 nvidia,tristate = <TEGRA_PIN_DISABLE>;
180 }; 185 };
181 usb_gpio { 186 usb_gpio {
182 nvidia,pins = "spig", "spih"; 187 nvidia,pins = "spig", "spih";
183 nvidia,function = "spi2_alt"; 188 nvidia,function = "spi2_alt";
184 nvidia,pull = <0>; 189 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
185 nvidia,tristate = <0>; 190 nvidia,tristate = <TEGRA_PIN_DISABLE>;
186 }; 191 };
187 vi { 192 vi {
188 nvidia,pins = "dta", "dtb", "dtc", "dtd"; 193 nvidia,pins = "dta", "dtb", "dtc", "dtd";
189 nvidia,function = "vi"; 194 nvidia,function = "vi";
190 nvidia,pull = <0>; 195 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
191 nvidia,tristate = <1>; 196 nvidia,tristate = <TEGRA_PIN_ENABLE>;
192 }; 197 };
193 vi_sc { 198 vi_sc {
194 nvidia,pins = "csus"; 199 nvidia,pins = "csus";
195 nvidia,function = "vi_sensor_clk"; 200 nvidia,function = "vi_sensor_clk";
196 nvidia,pull = <0>; 201 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
197 nvidia,tristate = <1>; 202 nvidia,tristate = <TEGRA_PIN_ENABLE>;
198 }; 203 };
199 }; 204 };
200 }; 205 };
201 206
207 ac97: ac97@70002000 {
208 status = "okay";
209 nvidia,codec-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
210 GPIO_ACTIVE_HIGH>;
211 nvidia,codec-sync-gpio = <&gpio TEGRA_GPIO(P, 0)
212 GPIO_ACTIVE_HIGH>;
213 };
214
202 i2c@7000c000 { 215 i2c@7000c000 {
203 clock-frequency = <400000>; 216 clock-frequency = <400000>;
204 }; 217 };
@@ -225,15 +238,15 @@
225 #gpio-cells = <2>; 238 #gpio-cells = <2>;
226 gpio-controller; 239 gpio-controller;
227 240
228 sys-supply = <&vdd_5v0_reg>; 241 sys-supply = <&vdd_3v3_reg>;
229 vin-sm0-supply = <&sys_reg>; 242 vin-sm0-supply = <&sys_reg>;
230 vin-sm1-supply = <&sys_reg>; 243 vin-sm1-supply = <&sys_reg>;
231 vin-sm2-supply = <&sys_reg>; 244 vin-sm2-supply = <&sys_reg>;
232 vinldo01-supply = <&sm2_reg>; 245 vinldo01-supply = <&sm2_reg>;
233 vinldo23-supply = <&sm2_reg>; 246 vinldo23-supply = <&vdd_3v3_reg>;
234 vinldo4-supply = <&sm2_reg>; 247 vinldo4-supply = <&vdd_3v3_reg>;
235 vinldo678-supply = <&sm2_reg>; 248 vinldo678-supply = <&vdd_3v3_reg>;
236 vinldo9-supply = <&sm2_reg>; 249 vinldo9-supply = <&vdd_3v3_reg>;
237 250
238 regulators { 251 regulators {
239 #address-cells = <1>; 252 #address-cells = <1>;
@@ -250,8 +263,8 @@
250 reg = <1>; 263 reg = <1>;
251 regulator-compatible = "sm0"; 264 regulator-compatible = "sm0";
252 regulator-name = "vdd_sm0,vdd_core"; 265 regulator-name = "vdd_sm0,vdd_core";
253 regulator-min-microvolt = <1275000>; 266 regulator-min-microvolt = <1200000>;
254 regulator-max-microvolt = <1275000>; 267 regulator-max-microvolt = <1200000>;
255 regulator-always-on; 268 regulator-always-on;
256 }; 269 };
257 270
@@ -259,8 +272,8 @@
259 reg = <2>; 272 reg = <2>;
260 regulator-compatible = "sm1"; 273 regulator-compatible = "sm1";
261 regulator-name = "vdd_sm1,vdd_cpu"; 274 regulator-name = "vdd_sm1,vdd_cpu";
262 regulator-min-microvolt = <1100000>; 275 regulator-min-microvolt = <1000000>;
263 regulator-max-microvolt = <1100000>; 276 regulator-max-microvolt = <1000000>;
264 regulator-always-on; 277 regulator-always-on;
265 }; 278 };
266 279
@@ -268,8 +281,8 @@
268 reg = <3>; 281 reg = <3>;
269 regulator-compatible = "sm2"; 282 regulator-compatible = "sm2";
270 regulator-name = "vdd_sm2,vin_ldo*"; 283 regulator-name = "vdd_sm2,vin_ldo*";
271 regulator-min-microvolt = <3700000>; 284 regulator-min-microvolt = <1800000>;
272 regulator-max-microvolt = <3700000>; 285 regulator-max-microvolt = <1800000>;
273 regulator-always-on; 286 regulator-always-on;
274 }; 287 };
275 288
@@ -316,8 +329,8 @@
316 reg = <10>; 329 reg = <10>;
317 regulator-compatible = "ldo6"; 330 regulator-compatible = "ldo6";
318 regulator-name = "vdd_ldo6,avdd_vdac,vddio_vi,vddio_cam"; 331 regulator-name = "vdd_ldo6,avdd_vdac,vddio_vi,vddio_cam";
319 regulator-min-microvolt = <1800000>; 332 regulator-min-microvolt = <2850000>;
320 regulator-max-microvolt = <1800000>; 333 regulator-max-microvolt = <2850000>;
321 }; 334 };
322 335
323 hdmi_vdd_reg: regulator@11 { 336 hdmi_vdd_reg: regulator@11 {
@@ -362,7 +375,7 @@
362 }; 375 };
363 }; 376 };
364 377
365 pmc { 378 pmc@7000e400 {
366 nvidia,suspend-mode = <1>; 379 nvidia,suspend-mode = <1>;
367 nvidia,cpu-pwr-good-time = <5000>; 380 nvidia,cpu-pwr-good-time = <5000>;
368 nvidia,cpu-pwr-off-time = <5000>; 381 nvidia,cpu-pwr-off-time = <5000>;
@@ -442,14 +455,6 @@
442 }; 455 };
443 }; 456 };
444 457
445 ac97: ac97 {
446 status = "okay";
447 nvidia,codec-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
448 GPIO_ACTIVE_HIGH>;
449 nvidia,codec-sync-gpio = <&gpio TEGRA_GPIO(P, 0)
450 GPIO_ACTIVE_HIGH>;
451 };
452
453 usb@c5004000 { 458 usb@c5004000 {
454 status = "okay"; 459 status = "okay";
455 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1) 460 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
@@ -471,7 +476,7 @@
471 #address-cells = <1>; 476 #address-cells = <1>;
472 #size-cells = <0>; 477 #size-cells = <0>;
473 478
474 clk32k_in: clock { 479 clk32k_in: clock@0 {
475 compatible = "fixed-clock"; 480 compatible = "fixed-clock";
476 reg=<0>; 481 reg=<0>;
477 #clock-cells = <0>; 482 #clock-cells = <0>;
@@ -479,37 +484,17 @@
479 }; 484 };
480 }; 485 };
481 486
482 sound {
483 compatible = "nvidia,tegra-audio-wm9712-colibri_t20",
484 "nvidia,tegra-audio-wm9712";
485 nvidia,model = "Colibri T20 AC97 Audio";
486
487 nvidia,audio-routing =
488 "Headphone", "HPOUTL",
489 "Headphone", "HPOUTR",
490 "LineIn", "LINEINL",
491 "LineIn", "LINEINR",
492 "Mic", "MIC1";
493
494 nvidia,ac97-controller = <&ac97>;
495
496 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
497 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
498 <&tegra_car TEGRA20_CLK_CDEV1>;
499 clock-names = "pll_a", "pll_a_out0", "mclk";
500 };
501
502 regulators { 487 regulators {
503 compatible = "simple-bus"; 488 compatible = "simple-bus";
504 #address-cells = <1>; 489 #address-cells = <1>;
505 #size-cells = <0>; 490 #size-cells = <0>;
506 491
507 vdd_5v0_reg: regulator@100 { 492 vdd_3v3_reg: regulator@100 {
508 compatible = "regulator-fixed"; 493 compatible = "regulator-fixed";
509 reg = <100>; 494 reg = <100>;
510 regulator-name = "vdd_5v0"; 495 regulator-name = "vdd_3v3";
511 regulator-min-microvolt = <5000000>; 496 regulator-min-microvolt = <3300000>;
512 regulator-max-microvolt = <5000000>; 497 regulator-max-microvolt = <3300000>;
513 regulator-always-on; 498 regulator-always-on;
514 }; 499 };
515 500
@@ -525,4 +510,24 @@
525 gpio = <&gpio TEGRA_GPIO(BB, 1) GPIO_ACTIVE_HIGH>; 510 gpio = <&gpio TEGRA_GPIO(BB, 1) GPIO_ACTIVE_HIGH>;
526 }; 511 };
527 }; 512 };
513
514 sound {
515 compatible = "nvidia,tegra-audio-wm9712-colibri_t20",
516 "nvidia,tegra-audio-wm9712";
517 nvidia,model = "Colibri T20 AC97 Audio";
518
519 nvidia,audio-routing =
520 "Headphone", "HPOUTL",
521 "Headphone", "HPOUTR",
522 "LineIn", "LINEINL",
523 "LineIn", "LINEINR",
524 "Mic", "MIC1";
525
526 nvidia,ac97-controller = <&ac97>;
527
528 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
529 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
530 <&tegra_car TEGRA20_CLK_CDEV1>;
531 clock-names = "pll_a", "pll_a_out0", "mclk";
532 };
528}; 533};
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index e156ab30e763..3fb1f50f6d46 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -1,17 +1,31 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra20.dtsi" 4#include "tegra20.dtsi"
4 5
5/ { 6/ {
6 model = "NVIDIA Tegra20 Harmony evaluation board"; 7 model = "NVIDIA Tegra20 Harmony evaluation board";
7 compatible = "nvidia,harmony", "nvidia,tegra20"; 8 compatible = "nvidia,harmony", "nvidia,tegra20";
8 9
10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000";
13 };
14
9 memory { 15 memory {
10 reg = <0x00000000 0x40000000>; 16 reg = <0x00000000 0x40000000>;
11 }; 17 };
12 18
13 host1x { 19 host1x@50000000 {
14 hdmi { 20 dc@54200000 {
21 rgb {
22 status = "okay";
23
24 nvidia,panel = <&panel>;
25 };
26 };
27
28 hdmi@54280000 {
15 status = "okay"; 29 status = "okay";
16 30
17 vdd-supply = <&hdmi_vdd_reg>; 31 vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +37,7 @@
23 }; 37 };
24 }; 38 };
25 39
26 pinmux { 40 pinmux@70000014 {
27 pinctrl-names = "default"; 41 pinctrl-names = "default";
28 pinctrl-0 = <&state_default>; 42 pinctrl-0 = <&state_default>;
29 43
@@ -184,50 +198,50 @@
184 "gmb", "gmc", "gmd", "gme", "gpu7", 198 "gmb", "gmc", "gmd", "gme", "gpu7",
185 "gpv", "i2cp", "pta", "rm", "slxa", 199 "gpv", "i2cp", "pta", "rm", "slxa",
186 "slxk", "spia", "spib", "uac"; 200 "slxk", "spia", "spib", "uac";
187 nvidia,pull = <0>; 201 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
188 nvidia,tristate = <0>; 202 nvidia,tristate = <TEGRA_PIN_DISABLE>;
189 }; 203 };
190 conf_ck32 { 204 conf_ck32 {
191 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb", 205 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
192 "pmcc", "pmcd", "pmce", "xm2c", "xm2d"; 206 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
193 nvidia,pull = <0>; 207 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
194 }; 208 };
195 conf_csus { 209 conf_csus {
196 nvidia,pins = "csus", "spid", "spif"; 210 nvidia,pins = "csus", "spid", "spif";
197 nvidia,pull = <1>; 211 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
198 nvidia,tristate = <1>; 212 nvidia,tristate = <TEGRA_PIN_ENABLE>;
199 }; 213 };
200 conf_crtp { 214 conf_crtp {
201 nvidia,pins = "crtp", "dap2", "dap3", "dap4", 215 nvidia,pins = "crtp", "dap2", "dap3", "dap4",
202 "dtc", "dte", "dtf", "gpu", "sdio1", 216 "dtc", "dte", "dtf", "gpu", "sdio1",
203 "slxc", "slxd", "spdi", "spdo", "spig", 217 "slxc", "slxd", "spdi", "spdo", "spig",
204 "uda"; 218 "uda";
205 nvidia,pull = <0>; 219 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
206 nvidia,tristate = <1>; 220 nvidia,tristate = <TEGRA_PIN_ENABLE>;
207 }; 221 };
208 conf_ddc { 222 conf_ddc {
209 nvidia,pins = "ddc", "dta", "dtd", "kbca", 223 nvidia,pins = "ddc", "dta", "dtd", "kbca",
210 "kbcb", "kbcc", "kbcd", "kbce", "kbcf", 224 "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
211 "sdc"; 225 "sdc";
212 nvidia,pull = <2>; 226 nvidia,pull = <TEGRA_PIN_PULL_UP>;
213 nvidia,tristate = <0>; 227 nvidia,tristate = <TEGRA_PIN_DISABLE>;
214 }; 228 };
215 conf_hdint { 229 conf_hdint {
216 nvidia,pins = "hdint", "lcsn", "ldc", "lm1", 230 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
217 "lpw1", "lsc1", "lsck", "lsda", "lsdi", 231 "lpw1", "lsc1", "lsck", "lsda", "lsdi",
218 "lvp0", "owc", "sdb"; 232 "lvp0", "owc", "sdb";
219 nvidia,tristate = <1>; 233 nvidia,tristate = <TEGRA_PIN_ENABLE>;
220 }; 234 };
221 conf_irrx { 235 conf_irrx {
222 nvidia,pins = "irrx", "irtx", "sdd", "spic", 236 nvidia,pins = "irrx", "irtx", "sdd", "spic",
223 "spie", "spih", "uaa", "uab", "uad", 237 "spie", "spih", "uaa", "uab", "uad",
224 "uca", "ucb"; 238 "uca", "ucb";
225 nvidia,pull = <2>; 239 nvidia,pull = <TEGRA_PIN_PULL_UP>;
226 nvidia,tristate = <1>; 240 nvidia,tristate = <TEGRA_PIN_ENABLE>;
227 }; 241 };
228 conf_lc { 242 conf_lc {
229 nvidia,pins = "lc", "ls"; 243 nvidia,pins = "lc", "ls";
230 nvidia,pull = <2>; 244 nvidia,pull = <TEGRA_PIN_PULL_UP>;
231 }; 245 };
232 conf_ld0 { 246 conf_ld0 {
233 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4", 247 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
@@ -237,12 +251,12 @@
237 "lhp1", "lhp2", "lhs", "lm0", "lpp", 251 "lhp1", "lhp2", "lhs", "lm0", "lpp",
238 "lpw0", "lpw2", "lsc0", "lspi", "lvp1", 252 "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
239 "lvs", "pmc"; 253 "lvs", "pmc";
240 nvidia,tristate = <0>; 254 nvidia,tristate = <TEGRA_PIN_DISABLE>;
241 }; 255 };
242 conf_ld17_0 { 256 conf_ld17_0 {
243 nvidia,pins = "ld17_0", "ld19_18", "ld21_20", 257 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
244 "ld23_22"; 258 "ld23_22";
245 nvidia,pull = <1>; 259 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
246 }; 260 };
247 }; 261 };
248 }; 262 };
@@ -255,6 +269,10 @@
255 status = "okay"; 269 status = "okay";
256 }; 270 };
257 271
272 pwm: pwm@7000a000 {
273 status = "okay";
274 };
275
258 i2c@7000c000 { 276 i2c@7000c000 {
259 status = "okay"; 277 status = "okay";
260 clock-frequency = <400000>; 278 clock-frequency = <400000>;
@@ -415,7 +433,124 @@
415 }; 433 };
416 }; 434 };
417 435
418 pmc { 436 kbc@7000e200 {
437 status = "okay";
438 nvidia,debounce-delay-ms = <2>;
439 nvidia,repeat-delay-ms = <160>;
440 nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>;
441 nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>;
442 linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_W)
443 MATRIX_KEY(0x00, 0x03, KEY_S)
444 MATRIX_KEY(0x00, 0x04, KEY_A)
445 MATRIX_KEY(0x00, 0x05, KEY_Z)
446 MATRIX_KEY(0x00, 0x07, KEY_FN)
447 MATRIX_KEY(0x01, 0x07, KEY_MENU)
448 MATRIX_KEY(0x02, 0x06, KEY_LEFTALT)
449 MATRIX_KEY(0x02, 0x07, KEY_RIGHTALT)
450 MATRIX_KEY(0x03, 0x00, KEY_5)
451 MATRIX_KEY(0x03, 0x01, KEY_4)
452 MATRIX_KEY(0x03, 0x02, KEY_R)
453 MATRIX_KEY(0x03, 0x03, KEY_E)
454 MATRIX_KEY(0x03, 0x04, KEY_F)
455 MATRIX_KEY(0x03, 0x05, KEY_D)
456 MATRIX_KEY(0x03, 0x06, KEY_X)
457 MATRIX_KEY(0x04, 0x00, KEY_7)
458 MATRIX_KEY(0x04, 0x01, KEY_6)
459 MATRIX_KEY(0x04, 0x02, KEY_T)
460 MATRIX_KEY(0x04, 0x03, KEY_H)
461 MATRIX_KEY(0x04, 0x04, KEY_G)
462 MATRIX_KEY(0x04, 0x05, KEY_V)
463 MATRIX_KEY(0x04, 0x06, KEY_C)
464 MATRIX_KEY(0x04, 0x07, KEY_SPACE)
465 MATRIX_KEY(0x05, 0x00, KEY_9)
466 MATRIX_KEY(0x05, 0x01, KEY_8)
467 MATRIX_KEY(0x05, 0x02, KEY_U)
468 MATRIX_KEY(0x05, 0x03, KEY_Y)
469 MATRIX_KEY(0x05, 0x04, KEY_J)
470 MATRIX_KEY(0x05, 0x05, KEY_N)
471 MATRIX_KEY(0x05, 0x06, KEY_B)
472 MATRIX_KEY(0x05, 0x07, KEY_BACKSLASH)
473 MATRIX_KEY(0x06, 0x00, KEY_MINUS)
474 MATRIX_KEY(0x06, 0x01, KEY_0)
475 MATRIX_KEY(0x06, 0x02, KEY_O)
476 MATRIX_KEY(0x06, 0x03, KEY_I)
477 MATRIX_KEY(0x06, 0x04, KEY_L)
478 MATRIX_KEY(0x06, 0x05, KEY_K)
479 MATRIX_KEY(0x06, 0x06, KEY_COMMA)
480 MATRIX_KEY(0x06, 0x07, KEY_M)
481 MATRIX_KEY(0x07, 0x01, KEY_EQUAL)
482 MATRIX_KEY(0x07, 0x02, KEY_RIGHTBRACE)
483 MATRIX_KEY(0x07, 0x03, KEY_ENTER)
484 MATRIX_KEY(0x07, 0x07, KEY_MENU)
485 MATRIX_KEY(0x08, 0x04, KEY_LEFTSHIFT)
486 MATRIX_KEY(0x08, 0x05, KEY_RIGHTSHIFT)
487 MATRIX_KEY(0x09, 0x05, KEY_LEFTCTRL)
488 MATRIX_KEY(0x09, 0x07, KEY_RIGHTCTRL)
489 MATRIX_KEY(0x0B, 0x00, KEY_LEFTBRACE)
490 MATRIX_KEY(0x0B, 0x01, KEY_P)
491 MATRIX_KEY(0x0B, 0x02, KEY_APOSTROPHE)
492 MATRIX_KEY(0x0B, 0x03, KEY_SEMICOLON)
493 MATRIX_KEY(0x0B, 0x04, KEY_SLASH)
494 MATRIX_KEY(0x0B, 0x05, KEY_DOT)
495 MATRIX_KEY(0x0C, 0x00, KEY_F10)
496 MATRIX_KEY(0x0C, 0x01, KEY_F9)
497 MATRIX_KEY(0x0C, 0x02, KEY_BACKSPACE)
498 MATRIX_KEY(0x0C, 0x03, KEY_3)
499 MATRIX_KEY(0x0C, 0x04, KEY_2)
500 MATRIX_KEY(0x0C, 0x05, KEY_UP)
501 MATRIX_KEY(0x0C, 0x06, KEY_PRINT)
502 MATRIX_KEY(0x0C, 0x07, KEY_PAUSE)
503 MATRIX_KEY(0x0D, 0x00, KEY_INSERT)
504 MATRIX_KEY(0x0D, 0x01, KEY_DELETE)
505 MATRIX_KEY(0x0D, 0x03, KEY_PAGEUP )
506 MATRIX_KEY(0x0D, 0x04, KEY_PAGEDOWN)
507 MATRIX_KEY(0x0D, 0x05, KEY_RIGHT)
508 MATRIX_KEY(0x0D, 0x06, KEY_DOWN)
509 MATRIX_KEY(0x0D, 0x07, KEY_LEFT)
510 MATRIX_KEY(0x0E, 0x00, KEY_F11)
511 MATRIX_KEY(0x0E, 0x01, KEY_F12)
512 MATRIX_KEY(0x0E, 0x02, KEY_F8)
513 MATRIX_KEY(0x0E, 0x03, KEY_Q)
514 MATRIX_KEY(0x0E, 0x04, KEY_F4)
515 MATRIX_KEY(0x0E, 0x05, KEY_F3)
516 MATRIX_KEY(0x0E, 0x06, KEY_1)
517 MATRIX_KEY(0x0E, 0x07, KEY_F7)
518 MATRIX_KEY(0x0F, 0x00, KEY_ESC)
519 MATRIX_KEY(0x0F, 0x01, KEY_GRAVE)
520 MATRIX_KEY(0x0F, 0x02, KEY_F5)
521 MATRIX_KEY(0x0F, 0x03, KEY_TAB)
522 MATRIX_KEY(0x0F, 0x04, KEY_F1)
523 MATRIX_KEY(0x0F, 0x05, KEY_F2)
524 MATRIX_KEY(0x0F, 0x06, KEY_CAPSLOCK)
525 MATRIX_KEY(0x0F, 0x07, KEY_F6)
526 MATRIX_KEY(0x14, 0x00, KEY_KP7)
527 MATRIX_KEY(0x15, 0x00, KEY_KP9)
528 MATRIX_KEY(0x15, 0x01, KEY_KP8)
529 MATRIX_KEY(0x15, 0x02, KEY_KP4)
530 MATRIX_KEY(0x15, 0x04, KEY_KP1)
531 MATRIX_KEY(0x16, 0x01, KEY_KPSLASH)
532 MATRIX_KEY(0x16, 0x02, KEY_KP6)
533 MATRIX_KEY(0x16, 0x03, KEY_KP5)
534 MATRIX_KEY(0x16, 0x04, KEY_KP3)
535 MATRIX_KEY(0x16, 0x05, KEY_KP2)
536 MATRIX_KEY(0x16, 0x07, KEY_KP0)
537 MATRIX_KEY(0x1B, 0x01, KEY_KPASTERISK)
538 MATRIX_KEY(0x1B, 0x03, KEY_KPMINUS)
539 MATRIX_KEY(0x1B, 0x04, KEY_KPPLUS)
540 MATRIX_KEY(0x1B, 0x05, KEY_KPDOT)
541 MATRIX_KEY(0x1C, 0x05, KEY_VOLUMEUP)
542 MATRIX_KEY(0x1D, 0x03, KEY_HOME)
543 MATRIX_KEY(0x1D, 0x04, KEY_END)
544 MATRIX_KEY(0x1D, 0x05, KEY_BRIGHTNESSUP)
545 MATRIX_KEY(0x1D, 0x06, KEY_VOLUMEDOWN)
546 MATRIX_KEY(0x1D, 0x07, KEY_BRIGHTNESSDOWN)
547 MATRIX_KEY(0x1E, 0x00, KEY_NUMLOCK)
548 MATRIX_KEY(0x1E, 0x01, KEY_SCROLLLOCK)
549 MATRIX_KEY(0x1E, 0x02, KEY_MUTE)
550 MATRIX_KEY(0x1F, 0x04, KEY_QUESTION)>;
551 };
552
553 pmc@7000e400 {
419 nvidia,invert-interrupt; 554 nvidia,invert-interrupt;
420 nvidia,suspend-mode = <1>; 555 nvidia,suspend-mode = <1>;
421 nvidia,cpu-pwr-good-time = <5000>; 556 nvidia,cpu-pwr-good-time = <5000>;
@@ -425,7 +560,7 @@
425 nvidia,sys-clock-req-active-high; 560 nvidia,sys-clock-req-active-high;
426 }; 561 };
427 562
428 pcie-controller { 563 pcie-controller@80003000 {
429 pex-clk-supply = <&pci_clk_reg>; 564 pex-clk-supply = <&pci_clk_reg>;
430 vdd-supply = <&pci_vdd_reg>; 565 vdd-supply = <&pci_vdd_reg>;
431 status = "okay"; 566 status = "okay";
@@ -483,12 +618,23 @@
483 bus-width = <8>; 618 bus-width = <8>;
484 }; 619 };
485 620
621 backlight: backlight {
622 compatible = "pwm-backlight";
623
624 enable-gpios = <&gpio TEGRA_GPIO(B, 5) GPIO_ACTIVE_HIGH>;
625 power-supply = <&vdd_bl_reg>;
626 pwms = <&pwm 0 5000000>;
627
628 brightness-levels = <0 4 8 16 32 64 128 255>;
629 default-brightness-level = <6>;
630 };
631
486 clocks { 632 clocks {
487 compatible = "simple-bus"; 633 compatible = "simple-bus";
488 #address-cells = <1>; 634 #address-cells = <1>;
489 #size-cells = <0>; 635 #size-cells = <0>;
490 636
491 clk32k_in: clock { 637 clk32k_in: clock@0 {
492 compatible = "fixed-clock"; 638 compatible = "fixed-clock";
493 reg=<0>; 639 reg=<0>;
494 #clock-cells = <0>; 640 #clock-cells = <0>;
@@ -502,126 +648,18 @@
502 power { 648 power {
503 label = "Power"; 649 label = "Power";
504 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; 650 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
505 linux,code = <116>; /* KEY_POWER */ 651 linux,code = <KEY_POWER>;
506 gpio-key,wakeup; 652 gpio-key,wakeup;
507 }; 653 };
508 }; 654 };
509 655
510 kbc { 656 panel: panel {
511 status = "okay"; 657 compatible = "auo,b101aw03", "simple-panel";
512 nvidia,debounce-delay-ms = <2>; 658
513 nvidia,repeat-delay-ms = <160>; 659 power-supply = <&vdd_pnl_reg>;
514 nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>; 660 enable-gpios = <&gpio TEGRA_GPIO(B, 2) GPIO_ACTIVE_HIGH>;
515 nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>; 661
516 linux,keymap = <0x00020011 /* KEY_W */ 662 backlight = <&backlight>;
517 0x0003001F /* KEY_S */
518 0x0004001E /* KEY_A */
519 0x0005002C /* KEY_Z */
520 0x000701D0 /* KEY_FN */
521 0x0107008B /* KEY_MENU */
522 0x02060038 /* KEY_LEFTALT */
523 0x02070064 /* KEY_RIGHTALT */
524 0x03000006 /* KEY_5 */
525 0x03010005 /* KEY_4 */
526 0x03020013 /* KEY_R */
527 0x03030012 /* KEY_E */
528 0x03040021 /* KEY_F */
529 0x03050020 /* KEY_D */
530 0x0306002D /* KEY_X */
531 0x04000008 /* KEY_7 */
532 0x04010007 /* KEY_6 */
533 0x04020014 /* KEY_T */
534 0x04030023 /* KEY_H */
535 0x04040022 /* KEY_G */
536 0x0405002F /* KEY_V */
537 0x0406002E /* KEY_C */
538 0x04070039 /* KEY_SPACE */
539 0x0500000A /* KEY_9 */
540 0x05010009 /* KEY_8 */
541 0x05020016 /* KEY_U */
542 0x05030015 /* KEY_Y */
543 0x05040024 /* KEY_J */
544 0x05050031 /* KEY_N */
545 0x05060030 /* KEY_B */
546 0x0507002B /* KEY_BACKSLASH */
547 0x0600000C /* KEY_MINUS */
548 0x0601000B /* KEY_0 */
549 0x06020018 /* KEY_O */
550 0x06030017 /* KEY_I */
551 0x06040026 /* KEY_L */
552 0x06050025 /* KEY_K */
553 0x06060033 /* KEY_COMMA */
554 0x06070032 /* KEY_M */
555 0x0701000D /* KEY_EQUAL */
556 0x0702001B /* KEY_RIGHTBRACE */
557 0x0703001C /* KEY_ENTER */
558 0x0707008B /* KEY_MENU */
559 0x0804002A /* KEY_LEFTSHIFT */
560 0x08050036 /* KEY_RIGHTSHIFT */
561 0x0905001D /* KEY_LEFTCTRL */
562 0x09070061 /* KEY_RIGHTCTRL */
563 0x0B00001A /* KEY_LEFTBRACE */
564 0x0B010019 /* KEY_P */
565 0x0B020028 /* KEY_APOSTROPHE */
566 0x0B030027 /* KEY_SEMICOLON */
567 0x0B040035 /* KEY_SLASH */
568 0x0B050034 /* KEY_DOT */
569 0x0C000044 /* KEY_F10 */
570 0x0C010043 /* KEY_F9 */
571 0x0C02000E /* KEY_BACKSPACE */
572 0x0C030004 /* KEY_3 */
573 0x0C040003 /* KEY_2 */
574 0x0C050067 /* KEY_UP */
575 0x0C0600D2 /* KEY_PRINT */
576 0x0C070077 /* KEY_PAUSE */
577 0x0D00006E /* KEY_INSERT */
578 0x0D01006F /* KEY_DELETE */
579 0x0D030068 /* KEY_PAGEUP */
580 0x0D04006D /* KEY_PAGEDOWN */
581 0x0D05006A /* KEY_RIGHT */
582 0x0D06006C /* KEY_DOWN */
583 0x0D070069 /* KEY_LEFT */
584 0x0E000057 /* KEY_F11 */
585 0x0E010058 /* KEY_F12 */
586 0x0E020042 /* KEY_F8 */
587 0x0E030010 /* KEY_Q */
588 0x0E04003E /* KEY_F4 */
589 0x0E05003D /* KEY_F3 */
590 0x0E060002 /* KEY_1 */
591 0x0E070041 /* KEY_F7 */
592 0x0F000001 /* KEY_ESC */
593 0x0F010029 /* KEY_GRAVE */
594 0x0F02003F /* KEY_F5 */
595 0x0F03000F /* KEY_TAB */
596 0x0F04003B /* KEY_F1 */
597 0x0F05003C /* KEY_F2 */
598 0x0F06003A /* KEY_CAPSLOCK */
599 0x0F070040 /* KEY_F6 */
600 0x14000047 /* KEY_KP7 */
601 0x15000049 /* KEY_KP9 */
602 0x15010048 /* KEY_KP8 */
603 0x1502004B /* KEY_KP4 */
604 0x1504004F /* KEY_KP1 */
605 0x1601004E /* KEY_KPSLASH */
606 0x1602004D /* KEY_KP6 */
607 0x1603004C /* KEY_KP5 */
608 0x16040051 /* KEY_KP3 */
609 0x16050050 /* KEY_KP2 */
610 0x16070052 /* KEY_KP0 */
611 0x1B010037 /* KEY_KPASTERISK */
612 0x1B03004A /* KEY_KPMINUS */
613 0x1B04004E /* KEY_KPPLUS */
614 0x1B050053 /* KEY_KPDOT */
615 0x1C050073 /* KEY_VOLUMEUP */
616 0x1D030066 /* KEY_HOME */
617 0x1D04006B /* KEY_END */
618 0x1D0500E1 /* KEY_BRIGHTNESSUP */
619 0x1D060072 /* KEY_VOLUMEDOWN */
620 0x1D0700E0 /* KEY_BRIGHTNESSDOWN */
621 0x1E000045 /* KEY_NUMLOCK */
622 0x1E010046 /* KEY_SCROLLLOCK */
623 0x1E020071 /* KEY_MUTE */
624 0x1F0400D6>; /* KEY_QUESTION */
625 }; 663 };
626 664
627 regulators { 665 regulators {
@@ -667,7 +705,7 @@
667 enable-active-high; 705 enable-active-high;
668 }; 706 };
669 707
670 regulator@4 { 708 vdd_pnl_reg: regulator@4 {
671 compatible = "regulator-fixed"; 709 compatible = "regulator-fixed";
672 reg = <4>; 710 reg = <4>;
673 regulator-name = "vdd_pnl"; 711 regulator-name = "vdd_pnl";
@@ -677,7 +715,7 @@
677 enable-active-high; 715 enable-active-high;
678 }; 716 };
679 717
680 regulator@5 { 718 vdd_bl_reg: regulator@5 {
681 compatible = "regulator-fixed"; 719 compatible = "regulator-fixed";
682 reg = <5>; 720 reg = <5>;
683 regulator-name = "vdd_bl"; 721 regulator-name = "vdd_bl";
diff --git a/arch/arm/boot/dts/tegra20-iris-512.dts b/arch/arm/boot/dts/tegra20-iris-512.dts
index f2222bd74eab..8cfb83f42e1f 100644
--- a/arch/arm/boot/dts/tegra20-iris-512.dts
+++ b/arch/arm/boot/dts/tegra20-iris-512.dts
@@ -6,61 +6,61 @@
6 model = "Toradex Colibri T20 512MB on Iris"; 6 model = "Toradex Colibri T20 512MB on Iris";
7 compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20"; 7 compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20";
8 8
9 host1x { 9 host1x@50000000 {
10 hdmi { 10 hdmi@54280000 {
11 status = "okay"; 11 status = "okay";
12 }; 12 };
13 }; 13 };
14 14
15 pinmux { 15 pinmux@70000014 {
16 state_default: pinmux { 16 state_default: pinmux {
17 hdint { 17 hdint {
18 nvidia,tristate = <0>; 18 nvidia,tristate = <TEGRA_PIN_DISABLE>;
19 }; 19 };
20 20
21 i2cddc { 21 i2cddc {
22 nvidia,tristate = <0>; 22 nvidia,tristate = <TEGRA_PIN_DISABLE>;
23 }; 23 };
24 24
25 sdio4 { 25 sdio4 {
26 nvidia,tristate = <0>; 26 nvidia,tristate = <TEGRA_PIN_DISABLE>;
27 }; 27 };
28 28
29 uarta { 29 uarta {
30 nvidia,tristate = <0>; 30 nvidia,tristate = <TEGRA_PIN_DISABLE>;
31 }; 31 };
32 32
33 uartd { 33 uartd {
34 nvidia,tristate = <0>; 34 nvidia,tristate = <TEGRA_PIN_DISABLE>;
35 }; 35 };
36 }; 36 };
37 }; 37 };
38 38
39 usb@c5000000 { 39 serial@70006000 {
40 status = "okay"; 40 status = "okay";
41 }; 41 };
42 42
43 usb-phy@c5000000 { 43 serial@70006300 {
44 status = "okay"; 44 status = "okay";
45 }; 45 };
46 46
47 usb@c5008000 { 47 i2c_ddc: i2c@7000c400 {
48 status = "okay"; 48 status = "okay";
49 }; 49 };
50 50
51 usb-phy@c5008000 { 51 usb@c5000000 {
52 status = "okay"; 52 status = "okay";
53 }; 53 };
54 54
55 serial@70006000 { 55 usb-phy@c5000000 {
56 status = "okay"; 56 status = "okay";
57 }; 57 };
58 58
59 serial@70006300 { 59 usb@c5008000 {
60 status = "okay"; 60 status = "okay";
61 }; 61 };
62 62
63 i2c_ddc: i2c@7000c400 { 63 usb-phy@c5008000 {
64 status = "okay"; 64 status = "okay";
65 }; 65 };
66 66
diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts
index 7580578903cf..6d3a4cbc36cc 100644
--- a/arch/arm/boot/dts/tegra20-medcom-wide.dts
+++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts
@@ -6,7 +6,7 @@
6 model = "Avionic Design Medcom-Wide board"; 6 model = "Avionic Design Medcom-Wide board";
7 compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20"; 7 compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20";
8 8
9 pwm { 9 pwm@7000a000 {
10 status = "okay"; 10 status = "okay";
11 }; 11 };
12 12
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index 8d71fc9d8a2f..c7cd8e6802d7 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -1,17 +1,23 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra20.dtsi" 4#include "tegra20.dtsi"
4 5
5/ { 6/ {
6 model = "Toshiba AC100 / Dynabook AZ"; 7 model = "Toshiba AC100 / Dynabook AZ";
7 compatible = "compal,paz00", "nvidia,tegra20"; 8 compatible = "compal,paz00", "nvidia,tegra20";
8 9
10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000";
13 };
14
9 memory { 15 memory {
10 reg = <0x00000000 0x20000000>; 16 reg = <0x00000000 0x20000000>;
11 }; 17 };
12 18
13 host1x { 19 host1x@50000000 {
14 hdmi { 20 hdmi@54280000 {
15 status = "okay"; 21 status = "okay";
16 22
17 vdd-supply = <&hdmi_vdd_reg>; 23 vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
23 }; 29 };
24 }; 30 };
25 31
26 pinmux { 32 pinmux@70000014 {
27 pinctrl-names = "default"; 33 pinctrl-names = "default";
28 pinctrl-0 = <&state_default>; 34 pinctrl-0 = <&state_default>;
29 35
@@ -177,39 +183,39 @@
177 "gpu", "gpu7", "gpv", "i2cp", "pta", 183 "gpu", "gpu7", "gpv", "i2cp", "pta",
178 "rm", "sdio1", "slxk", "spdo", "uac", 184 "rm", "sdio1", "slxk", "spdo", "uac",
179 "uda"; 185 "uda";
180 nvidia,pull = <0>; 186 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
181 nvidia,tristate = <0>; 187 nvidia,tristate = <TEGRA_PIN_DISABLE>;
182 }; 188 };
183 conf_ck32 { 189 conf_ck32 {
184 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb", 190 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
185 "pmcc", "pmcd", "pmce", "xm2c", "xm2d"; 191 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
186 nvidia,pull = <0>; 192 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
187 }; 193 };
188 conf_crtp { 194 conf_crtp {
189 nvidia,pins = "crtp", "dap3", "dap4", "dtb", 195 nvidia,pins = "crtp", "dap3", "dap4", "dtb",
190 "dtc", "dte", "slxa", "slxc", "slxd", 196 "dtc", "dte", "slxa", "slxc", "slxd",
191 "spdi"; 197 "spdi";
192 nvidia,pull = <0>; 198 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
193 nvidia,tristate = <1>; 199 nvidia,tristate = <TEGRA_PIN_ENABLE>;
194 }; 200 };
195 conf_csus { 201 conf_csus {
196 nvidia,pins = "csus", "spia", "spib", "spid", 202 nvidia,pins = "csus", "spia", "spib", "spid",
197 "spif"; 203 "spif";
198 nvidia,pull = <1>; 204 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
199 nvidia,tristate = <1>; 205 nvidia,tristate = <TEGRA_PIN_ENABLE>;
200 }; 206 };
201 conf_ddc { 207 conf_ddc {
202 nvidia,pins = "ddc", "irrx", "irtx", "kbca", 208 nvidia,pins = "ddc", "irrx", "irtx", "kbca",
203 "kbcb", "kbcc", "kbcd", "kbce", "kbcf", 209 "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
204 "spic", "spig", "uaa", "uab"; 210 "spic", "spig", "uaa", "uab";
205 nvidia,pull = <2>; 211 nvidia,pull = <TEGRA_PIN_PULL_UP>;
206 nvidia,tristate = <0>; 212 nvidia,tristate = <TEGRA_PIN_DISABLE>;
207 }; 213 };
208 conf_dta { 214 conf_dta {
209 nvidia,pins = "dta", "dtd", "owc", "sdc", "sdd", 215 nvidia,pins = "dta", "dtd", "owc", "sdc", "sdd",
210 "spie", "spih", "uad", "uca", "ucb"; 216 "spie", "spih", "uad", "uca", "ucb";
211 nvidia,pull = <2>; 217 nvidia,pull = <TEGRA_PIN_PULL_UP>;
212 nvidia,tristate = <1>; 218 nvidia,tristate = <TEGRA_PIN_ENABLE>;
213 }; 219 };
214 conf_hdint { 220 conf_hdint {
215 nvidia,pins = "hdint", "ld0", "ld1", "ld2", 221 nvidia,pins = "hdint", "ld0", "ld1", "ld2",
@@ -218,23 +224,23 @@
218 "ld13", "ld14", "ld15", "ld16", "ld17", 224 "ld13", "ld14", "ld15", "ld16", "ld17",
219 "ldc", "ldi", "lhs", "lsc0", "lspi", 225 "ldc", "ldi", "lhs", "lsc0", "lspi",
220 "lvs", "pmc"; 226 "lvs", "pmc";
221 nvidia,tristate = <0>; 227 nvidia,tristate = <TEGRA_PIN_DISABLE>;
222 }; 228 };
223 conf_lc { 229 conf_lc {
224 nvidia,pins = "lc", "ls"; 230 nvidia,pins = "lc", "ls";
225 nvidia,pull = <2>; 231 nvidia,pull = <TEGRA_PIN_PULL_UP>;
226 }; 232 };
227 conf_lcsn { 233 conf_lcsn {
228 nvidia,pins = "lcsn", "lhp0", "lhp1", "lhp2", 234 nvidia,pins = "lcsn", "lhp0", "lhp1", "lhp2",
229 "lm0", "lm1", "lpp", "lpw0", "lpw1", 235 "lm0", "lm1", "lpp", "lpw0", "lpw1",
230 "lpw2", "lsc1", "lsck", "lsda", "lsdi", 236 "lpw2", "lsc1", "lsck", "lsda", "lsdi",
231 "lvp0", "lvp1", "sdb"; 237 "lvp0", "lvp1", "sdb";
232 nvidia,tristate = <1>; 238 nvidia,tristate = <TEGRA_PIN_ENABLE>;
233 }; 239 };
234 conf_ld17_0 { 240 conf_ld17_0 {
235 nvidia,pins = "ld17_0", "ld19_18", "ld21_20", 241 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
236 "ld23_22"; 242 "ld23_22";
237 nvidia,pull = <1>; 243 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
238 }; 244 };
239 }; 245 };
240 }; 246 };
@@ -268,7 +274,7 @@
268 clock-frequency = <100000>; 274 clock-frequency = <100000>;
269 }; 275 };
270 276
271 nvec { 277 nvec@7000c500 {
272 compatible = "nvidia,nvec"; 278 compatible = "nvidia,nvec";
273 reg = <0x7000c500 0x100>; 279 reg = <0x7000c500 0x100>;
274 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>; 280 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
@@ -280,6 +286,8 @@
280 clocks = <&tegra_car TEGRA20_CLK_I2C3>, 286 clocks = <&tegra_car TEGRA20_CLK_I2C3>,
281 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; 287 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
282 clock-names = "div-clk", "fast-clk"; 288 clock-names = "div-clk", "fast-clk";
289 resets = <&tegra_car 67>;
290 reset-names = "i2c";
283 }; 291 };
284 292
285 i2c@7000d000 { 293 i2c@7000d000 {
@@ -415,7 +423,7 @@
415 }; 423 };
416 }; 424 };
417 425
418 pmc { 426 pmc@7000e400 {
419 nvidia,invert-interrupt; 427 nvidia,invert-interrupt;
420 nvidia,suspend-mode = <1>; 428 nvidia,suspend-mode = <1>;
421 nvidia,cpu-pwr-good-time = <2000>; 429 nvidia,cpu-pwr-good-time = <2000>;
@@ -472,7 +480,7 @@
472 #address-cells = <1>; 480 #address-cells = <1>;
473 #size-cells = <0>; 481 #size-cells = <0>;
474 482
475 clk32k_in: clock { 483 clk32k_in: clock@0 {
476 compatible = "fixed-clock"; 484 compatible = "fixed-clock";
477 reg=<0>; 485 reg=<0>;
478 #clock-cells = <0>; 486 #clock-cells = <0>;
@@ -486,7 +494,7 @@
486 power { 494 power {
487 label = "Power"; 495 label = "Power";
488 gpios = <&gpio TEGRA_GPIO(J, 7) GPIO_ACTIVE_LOW>; 496 gpios = <&gpio TEGRA_GPIO(J, 7) GPIO_ACTIVE_LOW>;
489 linux,code = <116>; /* KEY_POWER */ 497 linux,code = <KEY_POWER>;
490 gpio-key,wakeup; 498 gpio-key,wakeup;
491 }; 499 };
492 }; 500 };
diff --git a/arch/arm/boot/dts/tegra20-plutux.dts b/arch/arm/boot/dts/tegra20-plutux.dts
index d7a358a6a647..29051a2ae0ae 100644
--- a/arch/arm/boot/dts/tegra20-plutux.dts
+++ b/arch/arm/boot/dts/tegra20-plutux.dts
@@ -6,8 +6,8 @@
6 model = "Avionic Design Plutux board"; 6 model = "Avionic Design Plutux board";
7 compatible = "ad,plutux", "ad,tamonten", "nvidia,tegra20"; 7 compatible = "ad,plutux", "ad,tamonten", "nvidia,tegra20";
8 8
9 host1x { 9 host1x@50000000 {
10 hdmi { 10 hdmi@54280000 {
11 status = "okay"; 11 status = "okay";
12 }; 12 };
13 }; 13 };
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index 315aae26c3cd..a11b6e7b4759 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -1,17 +1,23 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra20.dtsi" 4#include "tegra20.dtsi"
4 5
5/ { 6/ {
6 model = "NVIDIA Seaboard"; 7 model = "NVIDIA Seaboard";
7 compatible = "nvidia,seaboard", "nvidia,tegra20"; 8 compatible = "nvidia,seaboard", "nvidia,tegra20";
8 9
10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000";
13 };
14
9 memory { 15 memory {
10 reg = <0x00000000 0x40000000>; 16 reg = <0x00000000 0x40000000>;
11 }; 17 };
12 18
13 host1x { 19 host1x@50000000 {
14 hdmi { 20 hdmi@54280000 {
15 status = "okay"; 21 status = "okay";
16 22
17 vdd-supply = <&hdmi_vdd_reg>; 23 vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
23 }; 29 };
24 }; 30 };
25 31
26 pinmux { 32 pinmux@70000014 {
27 pinctrl-names = "default"; 33 pinctrl-names = "default";
28 pinctrl-0 = <&state_default>; 34 pinctrl-0 = <&state_default>;
29 35
@@ -189,53 +195,53 @@
189 "irtx", "pta", "rm", "sdc", "sdd", 195 "irtx", "pta", "rm", "sdc", "sdd",
190 "slxd", "slxk", "spdi", "spdo", "uac", 196 "slxd", "slxk", "spdi", "spdo", "uac",
191 "uad", "uca", "ucb", "uda"; 197 "uad", "uca", "ucb", "uda";
192 nvidia,pull = <0>; 198 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
193 nvidia,tristate = <0>; 199 nvidia,tristate = <TEGRA_PIN_DISABLE>;
194 }; 200 };
195 conf_ate { 201 conf_ate {
196 nvidia,pins = "ate", "csus", "dap3", 202 nvidia,pins = "ate", "csus", "dap3",
197 "gpv", "owc", "slxc", "spib", "spid", 203 "gpv", "owc", "slxc", "spib", "spid",
198 "spie"; 204 "spie";
199 nvidia,pull = <0>; 205 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
200 nvidia,tristate = <1>; 206 nvidia,tristate = <TEGRA_PIN_ENABLE>;
201 }; 207 };
202 conf_ck32 { 208 conf_ck32 {
203 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb", 209 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
204 "pmcc", "pmcd", "pmce", "xm2c", "xm2d"; 210 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
205 nvidia,pull = <0>; 211 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
206 }; 212 };
207 conf_crtp { 213 conf_crtp {
208 nvidia,pins = "crtp", "gmb", "slxa", "spia", 214 nvidia,pins = "crtp", "gmb", "slxa", "spia",
209 "spig", "spih"; 215 "spig", "spih";
210 nvidia,pull = <2>; 216 nvidia,pull = <TEGRA_PIN_PULL_UP>;
211 nvidia,tristate = <1>; 217 nvidia,tristate = <TEGRA_PIN_ENABLE>;
212 }; 218 };
213 conf_dta { 219 conf_dta {
214 nvidia,pins = "dta", "dtb", "dtc", "dtd"; 220 nvidia,pins = "dta", "dtb", "dtc", "dtd";
215 nvidia,pull = <1>; 221 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
216 nvidia,tristate = <0>; 222 nvidia,tristate = <TEGRA_PIN_DISABLE>;
217 }; 223 };
218 conf_dte { 224 conf_dte {
219 nvidia,pins = "dte", "spif"; 225 nvidia,pins = "dte", "spif";
220 nvidia,pull = <1>; 226 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
221 nvidia,tristate = <1>; 227 nvidia,tristate = <TEGRA_PIN_ENABLE>;
222 }; 228 };
223 conf_hdint { 229 conf_hdint {
224 nvidia,pins = "hdint", "lcsn", "ldc", "lm1", 230 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
225 "lpw1", "lsc1", "lsck", "lsda", "lsdi", 231 "lpw1", "lsc1", "lsck", "lsda", "lsdi",
226 "lvp0"; 232 "lvp0";
227 nvidia,tristate = <1>; 233 nvidia,tristate = <TEGRA_PIN_ENABLE>;
228 }; 234 };
229 conf_kbca { 235 conf_kbca {
230 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd", 236 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
231 "kbce", "kbcf", "sdio1", "spic", "uaa", 237 "kbce", "kbcf", "sdio1", "spic", "uaa",
232 "uab"; 238 "uab";
233 nvidia,pull = <2>; 239 nvidia,pull = <TEGRA_PIN_PULL_UP>;
234 nvidia,tristate = <0>; 240 nvidia,tristate = <TEGRA_PIN_DISABLE>;
235 }; 241 };
236 conf_lc { 242 conf_lc {
237 nvidia,pins = "lc", "ls"; 243 nvidia,pins = "lc", "ls";
238 nvidia,pull = <2>; 244 nvidia,pull = <TEGRA_PIN_PULL_UP>;
239 }; 245 };
240 conf_ld0 { 246 conf_ld0 {
241 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4", 247 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
@@ -245,22 +251,22 @@
245 "lhp1", "lhp2", "lhs", "lm0", "lpp", 251 "lhp1", "lhp2", "lhs", "lm0", "lpp",
246 "lpw0", "lpw2", "lsc0", "lspi", "lvp1", 252 "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
247 "lvs", "pmc", "sdb"; 253 "lvs", "pmc", "sdb";
248 nvidia,tristate = <0>; 254 nvidia,tristate = <TEGRA_PIN_DISABLE>;
249 }; 255 };
250 conf_ld17_0 { 256 conf_ld17_0 {
251 nvidia,pins = "ld17_0", "ld19_18", "ld21_20", 257 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
252 "ld23_22"; 258 "ld23_22";
253 nvidia,pull = <1>; 259 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
254 }; 260 };
255 drive_sdio1 { 261 drive_sdio1 {
256 nvidia,pins = "drive_sdio1"; 262 nvidia,pins = "drive_sdio1";
257 nvidia,high-speed-mode = <0>; 263 nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
258 nvidia,schmitt = <0>; 264 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
259 nvidia,low-power-mode = <3>; 265 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
260 nvidia,pull-down-strength = <31>; 266 nvidia,pull-down-strength = <31>;
261 nvidia,pull-up-strength = <31>; 267 nvidia,pull-up-strength = <31>;
262 nvidia,slew-rate-rising = <3>; 268 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
263 nvidia,slew-rate-falling = <3>; 269 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
264 }; 270 };
265 }; 271 };
266 272
@@ -386,6 +392,13 @@
386 status = "okay"; 392 status = "okay";
387 clock-frequency = <400000>; 393 clock-frequency = <400000>;
388 394
395 magnetometer@c {
396 compatible = "ak,ak8975";
397 reg = <0xc>;
398 interrupt-parent = <&gpio>;
399 interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>;
400 };
401
389 pmic: tps6586x@34 { 402 pmic: tps6586x@34 {
390 compatible = "ti,tps6586x"; 403 compatible = "ti,tps6586x";
391 reg = <0x34>; 404 reg = <0x34>;
@@ -507,16 +520,149 @@
507 compatible = "onnn,nct1008"; 520 compatible = "onnn,nct1008";
508 reg = <0x4c>; 521 reg = <0x4c>;
509 }; 522 };
523 };
510 524
511 magnetometer@c { 525 kbc@7000e200 {
512 compatible = "ak,ak8975"; 526 status = "okay";
513 reg = <0xc>; 527 nvidia,debounce-delay-ms = <32>;
514 interrupt-parent = <&gpio>; 528 nvidia,repeat-delay-ms = <160>;
515 interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>; 529 nvidia,ghost-filter;
516 }; 530 nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>;
531 nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>;
532 linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_W)
533 MATRIX_KEY(0x00, 0x03, KEY_S)
534 MATRIX_KEY(0x00, 0x04, KEY_A)
535 MATRIX_KEY(0x00, 0x05, KEY_Z)
536 MATRIX_KEY(0x00, 0x07, KEY_FN)
537
538 MATRIX_KEY(0x01, 0x07, KEY_LEFTMETA)
539 MATRIX_KEY(0x02, 0x06, KEY_RIGHTALT)
540 MATRIX_KEY(0x02, 0x07, KEY_LEFTALT)
541
542 MATRIX_KEY(0x03, 0x00, KEY_5)
543 MATRIX_KEY(0x03, 0x01, KEY_4)
544 MATRIX_KEY(0x03, 0x02, KEY_R)
545 MATRIX_KEY(0x03, 0x03, KEY_E)
546 MATRIX_KEY(0x03, 0x04, KEY_F)
547 MATRIX_KEY(0x03, 0x05, KEY_D)
548 MATRIX_KEY(0x03, 0x06, KEY_X)
549
550 MATRIX_KEY(0x04, 0x00, KEY_7)
551 MATRIX_KEY(0x04, 0x01, KEY_6)
552 MATRIX_KEY(0x04, 0x02, KEY_T)
553 MATRIX_KEY(0x04, 0x03, KEY_H)
554 MATRIX_KEY(0x04, 0x04, KEY_G)
555 MATRIX_KEY(0x04, 0x05, KEY_V)
556 MATRIX_KEY(0x04, 0x06, KEY_C)
557 MATRIX_KEY(0x04, 0x07, KEY_SPACE)
558
559 MATRIX_KEY(0x05, 0x00, KEY_9)
560 MATRIX_KEY(0x05, 0x01, KEY_8)
561 MATRIX_KEY(0x05, 0x02, KEY_U)
562 MATRIX_KEY(0x05, 0x03, KEY_Y)
563 MATRIX_KEY(0x05, 0x04, KEY_J)
564 MATRIX_KEY(0x05, 0x05, KEY_N)
565 MATRIX_KEY(0x05, 0x06, KEY_B)
566 MATRIX_KEY(0x05, 0x07, KEY_BACKSLASH)
567
568 MATRIX_KEY(0x06, 0x00, KEY_MINUS)
569 MATRIX_KEY(0x06, 0x01, KEY_0)
570 MATRIX_KEY(0x06, 0x02, KEY_O)
571 MATRIX_KEY(0x06, 0x03, KEY_I)
572 MATRIX_KEY(0x06, 0x04, KEY_L)
573 MATRIX_KEY(0x06, 0x05, KEY_K)
574 MATRIX_KEY(0x06, 0x06, KEY_COMMA)
575 MATRIX_KEY(0x06, 0x07, KEY_M)
576
577 MATRIX_KEY(0x07, 0x01, KEY_EQUAL)
578 MATRIX_KEY(0x07, 0x02, KEY_RIGHTBRACE)
579 MATRIX_KEY(0x07, 0x03, KEY_ENTER)
580 MATRIX_KEY(0x07, 0x07, KEY_MENU)
581
582 MATRIX_KEY(0x08, 0x04, KEY_RIGHTSHIFT)
583 MATRIX_KEY(0x08, 0x05, KEY_LEFTSHIFT)
584
585 MATRIX_KEY(0x09, 0x05, KEY_RIGHTCTRL)
586 MATRIX_KEY(0x09, 0x07, KEY_LEFTCTRL)
587
588 MATRIX_KEY(0x0B, 0x00, KEY_LEFTBRACE)
589 MATRIX_KEY(0x0B, 0x01, KEY_P)
590 MATRIX_KEY(0x0B, 0x02, KEY_APOSTROPHE)
591 MATRIX_KEY(0x0B, 0x03, KEY_SEMICOLON)
592 MATRIX_KEY(0x0B, 0x04, KEY_SLASH)
593 MATRIX_KEY(0x0B, 0x05, KEY_DOT)
594
595 MATRIX_KEY(0x0C, 0x00, KEY_F10)
596 MATRIX_KEY(0x0C, 0x01, KEY_F9)
597 MATRIX_KEY(0x0C, 0x02, KEY_BACKSPACE)
598 MATRIX_KEY(0x0C, 0x03, KEY_3)
599 MATRIX_KEY(0x0C, 0x04, KEY_2)
600 MATRIX_KEY(0x0C, 0x05, KEY_UP)
601 MATRIX_KEY(0x0C, 0x06, KEY_PRINT)
602 MATRIX_KEY(0x0C, 0x07, KEY_PAUSE)
603
604 MATRIX_KEY(0x0D, 0x00, KEY_INSERT)
605 MATRIX_KEY(0x0D, 0x01, KEY_DELETE)
606 MATRIX_KEY(0x0D, 0x03, KEY_PAGEUP )
607 MATRIX_KEY(0x0D, 0x04, KEY_PAGEDOWN)
608 MATRIX_KEY(0x0D, 0x05, KEY_RIGHT)
609 MATRIX_KEY(0x0D, 0x06, KEY_DOWN)
610 MATRIX_KEY(0x0D, 0x07, KEY_LEFT)
611
612 MATRIX_KEY(0x0E, 0x00, KEY_F11)
613 MATRIX_KEY(0x0E, 0x01, KEY_F12)
614 MATRIX_KEY(0x0E, 0x02, KEY_F8)
615 MATRIX_KEY(0x0E, 0x03, KEY_Q)
616 MATRIX_KEY(0x0E, 0x04, KEY_F4)
617 MATRIX_KEY(0x0E, 0x05, KEY_F3)
618 MATRIX_KEY(0x0E, 0x06, KEY_1)
619 MATRIX_KEY(0x0E, 0x07, KEY_F7)
620
621 MATRIX_KEY(0x0F, 0x00, KEY_ESC)
622 MATRIX_KEY(0x0F, 0x01, KEY_GRAVE)
623 MATRIX_KEY(0x0F, 0x02, KEY_F5)
624 MATRIX_KEY(0x0F, 0x03, KEY_TAB)
625 MATRIX_KEY(0x0F, 0x04, KEY_F1)
626 MATRIX_KEY(0x0F, 0x05, KEY_F2)
627 MATRIX_KEY(0x0F, 0x06, KEY_CAPSLOCK)
628 MATRIX_KEY(0x0F, 0x07, KEY_F6)
629
630 /* Software Handled Function Keys */
631 MATRIX_KEY(0x14, 0x00, KEY_KP7)
632
633 MATRIX_KEY(0x15, 0x00, KEY_KP9)
634 MATRIX_KEY(0x15, 0x01, KEY_KP8)
635 MATRIX_KEY(0x15, 0x02, KEY_KP4)
636 MATRIX_KEY(0x15, 0x04, KEY_KP1)
637
638 MATRIX_KEY(0x16, 0x01, KEY_KPSLASH)
639 MATRIX_KEY(0x16, 0x02, KEY_KP6)
640 MATRIX_KEY(0x16, 0x03, KEY_KP5)
641 MATRIX_KEY(0x16, 0x04, KEY_KP3)
642 MATRIX_KEY(0x16, 0x05, KEY_KP2)
643 MATRIX_KEY(0x16, 0x07, KEY_KP0)
644
645 MATRIX_KEY(0x1B, 0x01, KEY_KPASTERISK)
646 MATRIX_KEY(0x1B, 0x03, KEY_KPMINUS)
647 MATRIX_KEY(0x1B, 0x04, KEY_KPPLUS)
648 MATRIX_KEY(0x1B, 0x05, KEY_KPDOT)
649
650 MATRIX_KEY(0x1C, 0x05, KEY_VOLUMEUP)
651
652 MATRIX_KEY(0x1D, 0x03, KEY_HOME)
653 MATRIX_KEY(0x1D, 0x04, KEY_END)
654 MATRIX_KEY(0x1D, 0x05, KEY_BRIGHTNESSDOWN)
655 MATRIX_KEY(0x1D, 0x06, KEY_VOLUMEDOWN)
656 MATRIX_KEY(0x1D, 0x07, KEY_BRIGHTNESSUP)
657
658 MATRIX_KEY(0x1E, 0x00, KEY_NUMLOCK)
659 MATRIX_KEY(0x1E, 0x01, KEY_SCROLLLOCK)
660 MATRIX_KEY(0x1E, 0x02, KEY_MUTE)
661
662 MATRIX_KEY(0x1F, 0x04, KEY_HELP)>;
517 }; 663 };
518 664
519 pmc { 665 pmc@7000e400 {
520 nvidia,invert-interrupt; 666 nvidia,invert-interrupt;
521 nvidia,suspend-mode = <1>; 667 nvidia,suspend-mode = <1>;
522 nvidia,cpu-pwr-good-time = <5000>; 668 nvidia,cpu-pwr-good-time = <5000>;
@@ -621,7 +767,7 @@
621 #address-cells = <1>; 767 #address-cells = <1>;
622 #size-cells = <0>; 768 #size-cells = <0>;
623 769
624 clk32k_in: clock { 770 clk32k_in: clock@0 {
625 compatible = "fixed-clock"; 771 compatible = "fixed-clock";
626 reg=<0>; 772 reg=<0>;
627 #clock-cells = <0>; 773 #clock-cells = <0>;
@@ -635,7 +781,7 @@
635 power { 781 power {
636 label = "Power"; 782 label = "Power";
637 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; 783 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
638 linux,code = <116>; /* KEY_POWER */ 784 linux,code = <KEY_POWER>;
639 gpio-key,wakeup; 785 gpio-key,wakeup;
640 }; 786 };
641 787
@@ -649,145 +795,6 @@
649 }; 795 };
650 }; 796 };
651 797
652 kbc {
653 status = "okay";
654 nvidia,debounce-delay-ms = <32>;
655 nvidia,repeat-delay-ms = <160>;
656 nvidia,ghost-filter;
657 nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>;
658 nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>;
659 linux,keymap = <0x00020011 /* KEY_W */
660 0x0003001F /* KEY_S */
661 0x0004001E /* KEY_A */
662 0x0005002C /* KEY_Z */
663 0x000701d0 /* KEY_FN */
664
665 0x0107007D /* KEY_LEFTMETA */
666 0x02060064 /* KEY_RIGHTALT */
667 0x02070038 /* KEY_LEFTALT */
668
669 0x03000006 /* KEY_5 */
670 0x03010005 /* KEY_4 */
671 0x03020013 /* KEY_R */
672 0x03030012 /* KEY_E */
673 0x03040021 /* KEY_F */
674 0x03050020 /* KEY_D */
675 0x0306002D /* KEY_X */
676
677 0x04000008 /* KEY_7 */
678 0x04010007 /* KEY_6 */
679 0x04020014 /* KEY_T */
680 0x04030023 /* KEY_H */
681 0x04040022 /* KEY_G */
682 0x0405002F /* KEY_V */
683 0x0406002E /* KEY_C */
684 0x04070039 /* KEY_SPACE */
685
686 0x0500000A /* KEY_9 */
687 0x05010009 /* KEY_8 */
688 0x05020016 /* KEY_U */
689 0x05030015 /* KEY_Y */
690 0x05040024 /* KEY_J */
691 0x05050031 /* KEY_N */
692 0x05060030 /* KEY_B */
693 0x0507002B /* KEY_BACKSLASH */
694
695 0x0600000C /* KEY_MINUS */
696 0x0601000B /* KEY_0 */
697 0x06020018 /* KEY_O */
698 0x06030017 /* KEY_I */
699 0x06040026 /* KEY_L */
700 0x06050025 /* KEY_K */
701 0x06060033 /* KEY_COMMA */
702 0x06070032 /* KEY_M */
703
704 0x0701000D /* KEY_EQUAL */
705 0x0702001B /* KEY_RIGHTBRACE */
706 0x0703001C /* KEY_ENTER */
707 0x0707008B /* KEY_MENU */
708
709 0x08040036 /* KEY_RIGHTSHIFT */
710 0x0805002A /* KEY_LEFTSHIFT */
711
712 0x09050061 /* KEY_RIGHTCTRL */
713 0x0907001D /* KEY_LEFTCTRL */
714
715 0x0B00001A /* KEY_LEFTBRACE */
716 0x0B010019 /* KEY_P */
717 0x0B020028 /* KEY_APOSTROPHE */
718 0x0B030027 /* KEY_SEMICOLON */
719 0x0B040035 /* KEY_SLASH */
720 0x0B050034 /* KEY_DOT */
721
722 0x0C000044 /* KEY_F10 */
723 0x0C010043 /* KEY_F9 */
724 0x0C02000E /* KEY_BACKSPACE */
725 0x0C030004 /* KEY_3 */
726 0x0C040003 /* KEY_2 */
727 0x0C050067 /* KEY_UP */
728 0x0C0600D2 /* KEY_PRINT */
729 0x0C070077 /* KEY_PAUSE */
730
731 0x0D00006E /* KEY_INSERT */
732 0x0D01006F /* KEY_DELETE */
733 0x0D030068 /* KEY_PAGEUP */
734 0x0D04006D /* KEY_PAGEDOWN */
735 0x0D05006A /* KEY_RIGHT */
736 0x0D06006C /* KEY_DOWN */
737 0x0D070069 /* KEY_LEFT */
738
739 0x0E000057 /* KEY_F11 */
740 0x0E010058 /* KEY_F12 */
741 0x0E020042 /* KEY_F8 */
742 0x0E030010 /* KEY_Q */
743 0x0E04003E /* KEY_F4 */
744 0x0E05003D /* KEY_F3 */
745 0x0E060002 /* KEY_1 */
746 0x0E070041 /* KEY_F7 */
747
748 0x0F000001 /* KEY_ESC */
749 0x0F010029 /* KEY_GRAVE */
750 0x0F02003F /* KEY_F5 */
751 0x0F03000F /* KEY_TAB */
752 0x0F04003B /* KEY_F1 */
753 0x0F05003C /* KEY_F2 */
754 0x0F06003A /* KEY_CAPSLOCK */
755 0x0F070040 /* KEY_F6 */
756
757 /* Software Handled Function Keys */
758 0x14000047 /* KEY_KP7 */
759
760 0x15000049 /* KEY_KP9 */
761 0x15010048 /* KEY_KP8 */
762 0x1502004B /* KEY_KP4 */
763 0x1504004F /* KEY_KP1 */
764
765 0x1601004E /* KEY_KPSLASH */
766 0x1602004D /* KEY_KP6 */
767 0x1603004C /* KEY_KP5 */
768 0x16040051 /* KEY_KP3 */
769 0x16050050 /* KEY_KP2 */
770 0x16070052 /* KEY_KP0 */
771
772 0x1B010037 /* KEY_KPASTERISK */
773 0x1B03004A /* KEY_KPMINUS */
774 0x1B04004E /* KEY_KPPLUS */
775 0x1B050053 /* KEY_KPDOT */
776
777 0x1C050073 /* KEY_VOLUMEUP */
778
779 0x1D030066 /* KEY_HOME */
780 0x1D04006B /* KEY_END */
781 0x1D0500E0 /* KEY_BRIGHTNESSDOWN */
782 0x1D060072 /* KEY_VOLUMEDOWN */
783 0x1D0700E1 /* KEY_BRIGHTNESSUP */
784
785 0x1E000045 /* KEY_NUMLOCK */
786 0x1E010046 /* KEY_SCROLLLOCK */
787 0x1E020071 /* KEY_MUTE */
788
789 0x1F04008A>; /* KEY_HELP */
790 };
791 regulators { 798 regulators {
792 compatible = "simple-bus"; 799 compatible = "simple-bus";
793 #address-cells = <1>; 800 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
index 7726dab3d08d..a1b0d965757f 100644
--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
@@ -4,12 +4,17 @@
4 model = "Avionic Design Tamonten SOM"; 4 model = "Avionic Design Tamonten SOM";
5 compatible = "ad,tamonten", "nvidia,tegra20"; 5 compatible = "ad,tamonten", "nvidia,tegra20";
6 6
7 aliases {
8 rtc0 = "/i2c@7000d000/tps6586x@34";
9 rtc1 = "/rtc@7000e000";
10 };
11
7 memory { 12 memory {
8 reg = <0x00000000 0x20000000>; 13 reg = <0x00000000 0x20000000>;
9 }; 14 };
10 15
11 host1x { 16 host1x@50000000 {
12 hdmi { 17 hdmi@54280000 {
13 vdd-supply = <&hdmi_vdd_reg>; 18 vdd-supply = <&hdmi_vdd_reg>;
14 pll-supply = <&hdmi_pll_reg>; 19 pll-supply = <&hdmi_pll_reg>;
15 20
@@ -19,7 +24,7 @@
19 }; 24 };
20 }; 25 };
21 26
22 pinmux { 27 pinmux@70000014 {
23 pinctrl-names = "default"; 28 pinctrl-names = "default";
24 pinctrl-0 = <&state_default>; 29 pinctrl-0 = <&state_default>;
25 30
@@ -176,50 +181,50 @@
176 "gmb", "gmc", "gmd", "gme", "gpu7", 181 "gmb", "gmc", "gmd", "gme", "gpu7",
177 "gpv", "i2cp", "pta", "rm", "slxa", 182 "gpv", "i2cp", "pta", "rm", "slxa",
178 "slxk", "spia", "spib", "uac"; 183 "slxk", "spia", "spib", "uac";
179 nvidia,pull = <0>; 184 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
180 nvidia,tristate = <0>; 185 nvidia,tristate = <TEGRA_PIN_DISABLE>;
181 }; 186 };
182 conf_ck32 { 187 conf_ck32 {
183 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb", 188 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
184 "pmcc", "pmcd", "pmce", "xm2c", "xm2d"; 189 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
185 nvidia,pull = <0>; 190 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
186 }; 191 };
187 conf_csus { 192 conf_csus {
188 nvidia,pins = "csus", "spid", "spif"; 193 nvidia,pins = "csus", "spid", "spif";
189 nvidia,pull = <1>; 194 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
190 nvidia,tristate = <1>; 195 nvidia,tristate = <TEGRA_PIN_ENABLE>;
191 }; 196 };
192 conf_crtp { 197 conf_crtp {
193 nvidia,pins = "crtp", "dap2", "dap3", "dap4", 198 nvidia,pins = "crtp", "dap2", "dap3", "dap4",
194 "dtc", "dte", "dtf", "gpu", "sdio1", 199 "dtc", "dte", "dtf", "gpu", "sdio1",
195 "slxc", "slxd", "spdi", "spdo", "spig", 200 "slxc", "slxd", "spdi", "spdo", "spig",
196 "uda"; 201 "uda";
197 nvidia,pull = <0>; 202 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
198 nvidia,tristate = <1>; 203 nvidia,tristate = <TEGRA_PIN_ENABLE>;
199 }; 204 };
200 conf_ddc { 205 conf_ddc {
201 nvidia,pins = "ddc", "dta", "dtd", "kbca", 206 nvidia,pins = "ddc", "dta", "dtd", "kbca",
202 "kbcb", "kbcc", "kbcd", "kbce", "kbcf", 207 "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
203 "sdc"; 208 "sdc";
204 nvidia,pull = <2>; 209 nvidia,pull = <TEGRA_PIN_PULL_UP>;
205 nvidia,tristate = <0>; 210 nvidia,tristate = <TEGRA_PIN_DISABLE>;
206 }; 211 };
207 conf_hdint { 212 conf_hdint {
208 nvidia,pins = "hdint", "lcsn", "ldc", "lm1", 213 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
209 "lpw1", "lsc1", "lsck", "lsda", "lsdi", 214 "lpw1", "lsc1", "lsck", "lsda", "lsdi",
210 "lvp0", "owc", "sdb"; 215 "lvp0", "owc", "sdb";
211 nvidia,tristate = <1>; 216 nvidia,tristate = <TEGRA_PIN_ENABLE>;
212 }; 217 };
213 conf_irrx { 218 conf_irrx {
214 nvidia,pins = "irrx", "irtx", "sdd", "spic", 219 nvidia,pins = "irrx", "irtx", "sdd", "spic",
215 "spie", "spih", "uaa", "uab", "uad", 220 "spie", "spih", "uaa", "uab", "uad",
216 "uca", "ucb"; 221 "uca", "ucb";
217 nvidia,pull = <2>; 222 nvidia,pull = <TEGRA_PIN_PULL_UP>;
218 nvidia,tristate = <1>; 223 nvidia,tristate = <TEGRA_PIN_ENABLE>;
219 }; 224 };
220 conf_lc { 225 conf_lc {
221 nvidia,pins = "lc", "ls"; 226 nvidia,pins = "lc", "ls";
222 nvidia,pull = <2>; 227 nvidia,pull = <TEGRA_PIN_PULL_UP>;
223 }; 228 };
224 conf_ld0 { 229 conf_ld0 {
225 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4", 230 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
@@ -229,12 +234,12 @@
229 "lhp1", "lhp2", "lhs", "lm0", "lpp", 234 "lhp1", "lhp2", "lhs", "lm0", "lpp",
230 "lpw0", "lpw2", "lsc0", "lspi", "lvp1", 235 "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
231 "lvs", "pmc"; 236 "lvs", "pmc";
232 nvidia,tristate = <0>; 237 nvidia,tristate = <TEGRA_PIN_DISABLE>;
233 }; 238 };
234 conf_ld17_0 { 239 conf_ld17_0 {
235 nvidia,pins = "ld17_0", "ld19_18", "ld21_20", 240 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
236 "ld23_22"; 241 "ld23_22";
237 nvidia,pull = <1>; 242 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
238 }; 243 };
239 }; 244 };
240 245
@@ -457,7 +462,7 @@
457 }; 462 };
458 }; 463 };
459 464
460 pmc { 465 pmc@7000e400 {
461 nvidia,invert-interrupt; 466 nvidia,invert-interrupt;
462 nvidia,suspend-mode = <1>; 467 nvidia,suspend-mode = <1>;
463 nvidia,cpu-pwr-good-time = <5000>; 468 nvidia,cpu-pwr-good-time = <5000>;
@@ -467,7 +472,7 @@
467 nvidia,sys-clock-req-active-high; 472 nvidia,sys-clock-req-active-high;
468 }; 473 };
469 474
470 pcie-controller { 475 pcie-controller@80003000 {
471 pex-clk-supply = <&pci_clk_reg>; 476 pex-clk-supply = <&pci_clk_reg>;
472 vdd-supply = <&pci_vdd_reg>; 477 vdd-supply = <&pci_vdd_reg>;
473 }; 478 };
@@ -492,7 +497,7 @@
492 #address-cells = <1>; 497 #address-cells = <1>;
493 #size-cells = <0>; 498 #size-cells = <0>;
494 499
495 clk32k_in: clock { 500 clk32k_in: clock@0 {
496 compatible = "fixed-clock"; 501 compatible = "fixed-clock";
497 reg=<0>; 502 reg=<0>;
498 #clock-cells = <0>; 503 #clock-cells = <0>;
diff --git a/arch/arm/boot/dts/tegra20-tec.dts b/arch/arm/boot/dts/tegra20-tec.dts
index 3ada3cb67f07..890562c667fb 100644
--- a/arch/arm/boot/dts/tegra20-tec.dts
+++ b/arch/arm/boot/dts/tegra20-tec.dts
@@ -6,8 +6,8 @@
6 model = "Avionic Design Tamonten Evaluation Carrier"; 6 model = "Avionic Design Tamonten Evaluation Carrier";
7 compatible = "ad,tec", "ad,tamonten", "nvidia,tegra20"; 7 compatible = "ad,tec", "ad,tamonten", "nvidia,tegra20";
8 8
9 host1x { 9 host1x@50000000 {
10 hdmi { 10 hdmi@54280000 {
11 status = "okay"; 11 status = "okay";
12 }; 12 };
13 }; 13 };
@@ -32,7 +32,7 @@
32 }; 32 };
33 }; 33 };
34 34
35 pcie-controller { 35 pcie-controller@80003000 {
36 status = "okay"; 36 status = "okay";
37 37
38 pci@1,0 { 38 pci@1,0 {
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index 78deea5c0d21..216fa6d50c65 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -1,17 +1,23 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra20.dtsi" 4#include "tegra20.dtsi"
4 5
5/ { 6/ {
6 model = "Compulab TrimSlice board"; 7 model = "Compulab TrimSlice board";
7 compatible = "compulab,trimslice", "nvidia,tegra20"; 8 compatible = "compulab,trimslice", "nvidia,tegra20";
8 9
10 aliases {
11 rtc0 = "/i2c@7000c500/rtc@56";
12 rtc1 = "/rtc@7000e000";
13 };
14
9 memory { 15 memory {
10 reg = <0x00000000 0x40000000>; 16 reg = <0x00000000 0x40000000>;
11 }; 17 };
12 18
13 host1x { 19 host1x@50000000 {
14 hdmi { 20 hdmi@54280000 {
15 status = "okay"; 21 status = "okay";
16 22
17 vdd-supply = <&hdmi_vdd_reg>; 23 vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
23 }; 29 };
24 }; 30 };
25 31
26 pinmux { 32 pinmux@70000014 {
27 pinctrl-names = "default"; 33 pinctrl-names = "default";
28 pinctrl-0 = <&state_default>; 34 pinctrl-0 = <&state_default>;
29 35
@@ -191,49 +197,49 @@
191 "dtb", "dtc", "dtd", "dte", "gmb", 197 "dtb", "dtc", "dtd", "dte", "gmb",
192 "gme", "i2cp", "pta", "slxc", "slxd", 198 "gme", "i2cp", "pta", "slxc", "slxd",
193 "spdi", "spdo", "uda"; 199 "spdi", "spdo", "uda";
194 nvidia,pull = <0>; 200 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
195 nvidia,tristate = <1>; 201 nvidia,tristate = <TEGRA_PIN_ENABLE>;
196 }; 202 };
197 conf_atb { 203 conf_atb {
198 nvidia,pins = "atb", "cdev1", "cdev2", "dap1", 204 nvidia,pins = "atb", "cdev1", "cdev2", "dap1",
199 "gma", "gmc", "gmd", "gpu", "gpu7", 205 "gma", "gmc", "gmd", "gpu", "gpu7",
200 "gpv", "sdio1", "slxa", "slxk", "uac"; 206 "gpv", "sdio1", "slxa", "slxk", "uac";
201 nvidia,pull = <0>; 207 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
202 nvidia,tristate = <0>; 208 nvidia,tristate = <TEGRA_PIN_DISABLE>;
203 }; 209 };
204 conf_ck32 { 210 conf_ck32 {
205 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb", 211 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
206 "pmcc", "pmcd", "pmce", "xm2c", "xm2d"; 212 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
207 nvidia,pull = <0>; 213 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
208 }; 214 };
209 conf_csus { 215 conf_csus {
210 nvidia,pins = "csus", "spia", "spib", 216 nvidia,pins = "csus", "spia", "spib",
211 "spid", "spif"; 217 "spid", "spif";
212 nvidia,pull = <1>; 218 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
213 nvidia,tristate = <1>; 219 nvidia,tristate = <TEGRA_PIN_ENABLE>;
214 }; 220 };
215 conf_ddc { 221 conf_ddc {
216 nvidia,pins = "ddc", "dtf", "rm", "sdc", "sdd"; 222 nvidia,pins = "ddc", "dtf", "rm", "sdc", "sdd";
217 nvidia,pull = <2>; 223 nvidia,pull = <TEGRA_PIN_PULL_UP>;
218 nvidia,tristate = <0>; 224 nvidia,tristate = <TEGRA_PIN_DISABLE>;
219 }; 225 };
220 conf_hdint { 226 conf_hdint {
221 nvidia,pins = "hdint", "lcsn", "ldc", "lm1", 227 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
222 "lpw1", "lsc1", "lsck", "lsda", "lsdi", 228 "lpw1", "lsc1", "lsck", "lsda", "lsdi",
223 "lvp0", "pmc"; 229 "lvp0", "pmc";
224 nvidia,tristate = <1>; 230 nvidia,tristate = <TEGRA_PIN_ENABLE>;
225 }; 231 };
226 conf_irrx { 232 conf_irrx {
227 nvidia,pins = "irrx", "irtx", "kbca", "kbcb", 233 nvidia,pins = "irrx", "irtx", "kbca", "kbcb",
228 "kbcc", "kbcd", "kbce", "kbcf", "owc", 234 "kbcc", "kbcd", "kbce", "kbcf", "owc",
229 "spic", "spie", "spig", "spih", "uaa", 235 "spic", "spie", "spig", "spih", "uaa",
230 "uab", "uad", "uca", "ucb"; 236 "uab", "uad", "uca", "ucb";
231 nvidia,pull = <2>; 237 nvidia,pull = <TEGRA_PIN_PULL_UP>;
232 nvidia,tristate = <1>; 238 nvidia,tristate = <TEGRA_PIN_ENABLE>;
233 }; 239 };
234 conf_lc { 240 conf_lc {
235 nvidia,pins = "lc", "ls"; 241 nvidia,pins = "lc", "ls";
236 nvidia,pull = <2>; 242 nvidia,pull = <TEGRA_PIN_PULL_UP>;
237 }; 243 };
238 conf_ld0 { 244 conf_ld0 {
239 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4", 245 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
@@ -243,17 +249,17 @@
243 "lhp1", "lhp2", "lhs", "lm0", "lpp", 249 "lhp1", "lhp2", "lhs", "lm0", "lpp",
244 "lpw0", "lpw2", "lsc0", "lspi", "lvp1", 250 "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
245 "lvs", "sdb"; 251 "lvs", "sdb";
246 nvidia,tristate = <0>; 252 nvidia,tristate = <TEGRA_PIN_DISABLE>;
247 }; 253 };
248 conf_ld17_0 { 254 conf_ld17_0 {
249 nvidia,pins = "ld17_0", "ld19_18", "ld21_20", 255 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
250 "ld23_22"; 256 "ld23_22";
251 nvidia,pull = <1>; 257 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
252 }; 258 };
253 conf_spif { 259 conf_spif {
254 nvidia,pins = "spif"; 260 nvidia,pins = "spif";
255 nvidia,pull = <1>; 261 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
256 nvidia,tristate = <0>; 262 nvidia,tristate = <TEGRA_PIN_DISABLE>;
257 }; 263 };
258 }; 264 };
259 }; 265 };
@@ -301,7 +307,7 @@
301 }; 307 };
302 }; 308 };
303 309
304 pmc { 310 pmc@7000e400 {
305 nvidia,suspend-mode = <1>; 311 nvidia,suspend-mode = <1>;
306 nvidia,cpu-pwr-good-time = <5000>; 312 nvidia,cpu-pwr-good-time = <5000>;
307 nvidia,cpu-pwr-off-time = <5000>; 313 nvidia,cpu-pwr-off-time = <5000>;
@@ -310,7 +316,7 @@
310 nvidia,sys-clock-req-active-high; 316 nvidia,sys-clock-req-active-high;
311 }; 317 };
312 318
313 pcie-controller { 319 pcie-controller@80003000 {
314 status = "okay"; 320 status = "okay";
315 pex-clk-supply = <&pci_clk_reg>; 321 pex-clk-supply = <&pci_clk_reg>;
316 vdd-supply = <&pci_vdd_reg>; 322 vdd-supply = <&pci_vdd_reg>;
@@ -366,7 +372,7 @@
366 #address-cells = <1>; 372 #address-cells = <1>;
367 #size-cells = <0>; 373 #size-cells = <0>;
368 374
369 clk32k_in: clock { 375 clk32k_in: clock@0 {
370 compatible = "fixed-clock"; 376 compatible = "fixed-clock";
371 reg=<0>; 377 reg=<0>;
372 #clock-cells = <0>; 378 #clock-cells = <0>;
@@ -380,7 +386,7 @@
380 power { 386 power {
381 label = "Power"; 387 label = "Power";
382 gpios = <&gpio TEGRA_GPIO(X, 6) GPIO_ACTIVE_LOW>; 388 gpios = <&gpio TEGRA_GPIO(X, 6) GPIO_ACTIVE_LOW>;
383 linux,code = <116>; /* KEY_POWER */ 389 linux,code = <KEY_POWER>;
384 gpio-key,wakeup; 390 gpio-key,wakeup;
385 }; 391 };
386 }; 392 };
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts
index aab872cd0530..571d12e6ac2d 100644
--- a/arch/arm/boot/dts/tegra20-ventana.dts
+++ b/arch/arm/boot/dts/tegra20-ventana.dts
@@ -1,17 +1,23 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra20.dtsi" 4#include "tegra20.dtsi"
4 5
5/ { 6/ {
6 model = "NVIDIA Tegra20 Ventana evaluation board"; 7 model = "NVIDIA Tegra20 Ventana evaluation board";
7 compatible = "nvidia,ventana", "nvidia,tegra20"; 8 compatible = "nvidia,ventana", "nvidia,tegra20";
8 9
10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000";
13 };
14
9 memory { 15 memory {
10 reg = <0x00000000 0x40000000>; 16 reg = <0x00000000 0x40000000>;
11 }; 17 };
12 18
13 host1x { 19 host1x@50000000 {
14 hdmi { 20 hdmi@54280000 {
15 status = "okay"; 21 status = "okay";
16 22
17 vdd-supply = <&hdmi_vdd_reg>; 23 vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
23 }; 29 };
24 }; 30 };
25 31
26 pinmux { 32 pinmux@70000014 {
27 pinctrl-names = "default"; 33 pinctrl-names = "default";
28 pinctrl-0 = <&state_default>; 34 pinctrl-0 = <&state_default>;
29 35
@@ -189,50 +195,50 @@
189 "irtx", "pta", "rm", "sdc", "sdd", 195 "irtx", "pta", "rm", "sdc", "sdd",
190 "slxc", "slxd", "slxk", "spdi", "spdo", 196 "slxc", "slxd", "slxk", "spdi", "spdo",
191 "uac", "uad", "uca", "ucb", "uda"; 197 "uac", "uad", "uca", "ucb", "uda";
192 nvidia,pull = <0>; 198 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
193 nvidia,tristate = <0>; 199 nvidia,tristate = <TEGRA_PIN_DISABLE>;
194 }; 200 };
195 conf_ate { 201 conf_ate {
196 nvidia,pins = "ate", "csus", "dap3", "gmd", 202 nvidia,pins = "ate", "csus", "dap3", "gmd",
197 "gpv", "owc", "spia", "spib", "spic", 203 "gpv", "owc", "spia", "spib", "spic",
198 "spid", "spie", "spig"; 204 "spid", "spie", "spig";
199 nvidia,pull = <0>; 205 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
200 nvidia,tristate = <1>; 206 nvidia,tristate = <TEGRA_PIN_ENABLE>;
201 }; 207 };
202 conf_ck32 { 208 conf_ck32 {
203 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb", 209 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
204 "pmcc", "pmcd", "pmce", "xm2c", "xm2d"; 210 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
205 nvidia,pull = <0>; 211 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
206 }; 212 };
207 conf_crtp { 213 conf_crtp {
208 nvidia,pins = "crtp", "gmb", "slxa", "spih"; 214 nvidia,pins = "crtp", "gmb", "slxa", "spih";
209 nvidia,pull = <2>; 215 nvidia,pull = <TEGRA_PIN_PULL_UP>;
210 nvidia,tristate = <1>; 216 nvidia,tristate = <TEGRA_PIN_ENABLE>;
211 }; 217 };
212 conf_dta { 218 conf_dta {
213 nvidia,pins = "dta", "dtb", "dtc", "dtd"; 219 nvidia,pins = "dta", "dtb", "dtc", "dtd";
214 nvidia,pull = <1>; 220 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
215 nvidia,tristate = <0>; 221 nvidia,tristate = <TEGRA_PIN_DISABLE>;
216 }; 222 };
217 conf_dte { 223 conf_dte {
218 nvidia,pins = "dte", "spif"; 224 nvidia,pins = "dte", "spif";
219 nvidia,pull = <1>; 225 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
220 nvidia,tristate = <1>; 226 nvidia,tristate = <TEGRA_PIN_ENABLE>;
221 }; 227 };
222 conf_hdint { 228 conf_hdint {
223 nvidia,pins = "hdint", "lcsn", "ldc", "lm1", 229 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
224 "lpw1", "lsck", "lsda", "lsdi", "lvp0"; 230 "lpw1", "lsck", "lsda", "lsdi", "lvp0";
225 nvidia,tristate = <1>; 231 nvidia,tristate = <TEGRA_PIN_ENABLE>;
226 }; 232 };
227 conf_kbca { 233 conf_kbca {
228 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd", 234 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
229 "kbce", "kbcf", "sdio1", "uaa", "uab"; 235 "kbce", "kbcf", "sdio1", "uaa", "uab";
230 nvidia,pull = <2>; 236 nvidia,pull = <TEGRA_PIN_PULL_UP>;
231 nvidia,tristate = <0>; 237 nvidia,tristate = <TEGRA_PIN_DISABLE>;
232 }; 238 };
233 conf_lc { 239 conf_lc {
234 nvidia,pins = "lc", "ls"; 240 nvidia,pins = "lc", "ls";
235 nvidia,pull = <2>; 241 nvidia,pull = <TEGRA_PIN_PULL_UP>;
236 }; 242 };
237 conf_ld0 { 243 conf_ld0 {
238 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4", 244 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
@@ -242,22 +248,22 @@
242 "lhp1", "lhp2", "lhs", "lm0", "lpp", 248 "lhp1", "lhp2", "lhs", "lm0", "lpp",
243 "lpw0", "lpw2", "lsc0", "lsc1", "lspi", 249 "lpw0", "lpw2", "lsc0", "lsc1", "lspi",
244 "lvp1", "lvs", "pmc", "sdb"; 250 "lvp1", "lvs", "pmc", "sdb";
245 nvidia,tristate = <0>; 251 nvidia,tristate = <TEGRA_PIN_DISABLE>;
246 }; 252 };
247 conf_ld17_0 { 253 conf_ld17_0 {
248 nvidia,pins = "ld17_0", "ld19_18", "ld21_20", 254 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
249 "ld23_22"; 255 "ld23_22";
250 nvidia,pull = <1>; 256 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
251 }; 257 };
252 drive_sdio1 { 258 drive_sdio1 {
253 nvidia,pins = "drive_sdio1"; 259 nvidia,pins = "drive_sdio1";
254 nvidia,high-speed-mode = <0>; 260 nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
255 nvidia,schmitt = <1>; 261 nvidia,schmitt = <TEGRA_PIN_ENABLE>;
256 nvidia,low-power-mode = <3>; 262 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
257 nvidia,pull-down-strength = <31>; 263 nvidia,pull-down-strength = <31>;
258 nvidia,pull-up-strength = <31>; 264 nvidia,pull-up-strength = <31>;
259 nvidia,slew-rate-rising = <3>; 265 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
260 nvidia,slew-rate-falling = <3>; 266 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
261 }; 267 };
262 }; 268 };
263 269
@@ -492,7 +498,7 @@
492 }; 498 };
493 }; 499 };
494 500
495 pmc { 501 pmc@7000e400 {
496 nvidia,invert-interrupt; 502 nvidia,invert-interrupt;
497 nvidia,suspend-mode = <1>; 503 nvidia,suspend-mode = <1>;
498 nvidia,cpu-pwr-good-time = <2000>; 504 nvidia,cpu-pwr-good-time = <2000>;
@@ -556,7 +562,7 @@
556 #address-cells = <1>; 562 #address-cells = <1>;
557 #size-cells = <0>; 563 #size-cells = <0>;
558 564
559 clk32k_in: clock { 565 clk32k_in: clock@0 {
560 compatible = "fixed-clock"; 566 compatible = "fixed-clock";
561 reg=<0>; 567 reg=<0>;
562 #clock-cells = <0>; 568 #clock-cells = <0>;
@@ -570,7 +576,7 @@
570 power { 576 power {
571 label = "Power"; 577 label = "Power";
572 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; 578 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
573 linux,code = <116>; /* KEY_POWER */ 579 linux,code = <KEY_POWER>;
574 gpio-key,wakeup; 580 gpio-key,wakeup;
575 }; 581 };
576 }; 582 };
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts
index d33a73cf167c..1843725785c9 100644
--- a/arch/arm/boot/dts/tegra20-whistler.dts
+++ b/arch/arm/boot/dts/tegra20-whistler.dts
@@ -1,17 +1,23 @@
1/dts-v1/; 1/dts-v1/;
2 2
3#include <dt-bindings/input/input.h>
3#include "tegra20.dtsi" 4#include "tegra20.dtsi"
4 5
5/ { 6/ {
6 model = "NVIDIA Tegra20 Whistler evaluation board"; 7 model = "NVIDIA Tegra20 Whistler evaluation board";
7 compatible = "nvidia,whistler", "nvidia,tegra20"; 8 compatible = "nvidia,whistler", "nvidia,tegra20";
8 9
10 aliases {
11 rtc0 = "/i2c@7000d000/max8907@3c";
12 rtc1 = "/rtc@7000e000";
13 };
14
9 memory { 15 memory {
10 reg = <0x00000000 0x20000000>; 16 reg = <0x00000000 0x20000000>;
11 }; 17 };
12 18
13 host1x { 19 host1x@50000000 {
14 hdmi { 20 hdmi@54280000 {
15 status = "okay"; 21 status = "okay";
16 22
17 vdd-supply = <&hdmi_vdd_reg>; 23 vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
23 }; 29 };
24 }; 30 };
25 31
26 pinmux { 32 pinmux@70000014 {
27 pinctrl-names = "default"; 33 pinctrl-names = "default";
28 pinctrl-0 = <&state_default>; 34 pinctrl-0 = <&state_default>;
29 35
@@ -189,8 +195,8 @@
189 "kbcf", "sdc", "sdd", "spie", "spig", 195 "kbcf", "sdc", "sdd", "spie", "spig",
190 "spih", "uaa", "uab", "uad", "uca", 196 "spih", "uaa", "uab", "uad", "uca",
191 "ucb"; 197 "ucb";
192 nvidia,pull = <2>; 198 nvidia,pull = <TEGRA_PIN_PULL_UP>;
193 nvidia,tristate = <0>; 199 nvidia,tristate = <TEGRA_PIN_DISABLE>;
194 }; 200 };
195 conf_atd { 201 conf_atd {
196 nvidia,pins = "atd", "ate", "cdev1", "csus", 202 nvidia,pins = "atd", "ate", "cdev1", "csus",
@@ -198,54 +204,54 @@
198 "dtf", "gpu", "gpu7", "gpv", "i2cp", 204 "dtf", "gpu", "gpu7", "gpv", "i2cp",
199 "rm", "sdio1", "slxa", "slxc", "slxd", 205 "rm", "sdio1", "slxa", "slxc", "slxd",
200 "slxk", "spdi", "spdo", "uac", "uda"; 206 "slxk", "spdi", "spdo", "uac", "uda";
201 nvidia,pull = <0>; 207 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
202 nvidia,tristate = <0>; 208 nvidia,tristate = <TEGRA_PIN_DISABLE>;
203 }; 209 };
204 conf_cdev2 { 210 conf_cdev2 {
205 nvidia,pins = "cdev2", "spia", "spib"; 211 nvidia,pins = "cdev2", "spia", "spib";
206 nvidia,pull = <1>; 212 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
207 nvidia,tristate = <1>; 213 nvidia,tristate = <TEGRA_PIN_ENABLE>;
208 }; 214 };
209 conf_ck32 { 215 conf_ck32 {
210 nvidia,pins = "ck32", "ddrc", "lc", "pmca", 216 nvidia,pins = "ck32", "ddrc", "lc", "pmca",
211 "pmcb", "pmcc", "pmcd", "xm2c", 217 "pmcb", "pmcc", "pmcd", "xm2c",
212 "xm2d"; 218 "xm2d";
213 nvidia,pull = <0>; 219 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
214 }; 220 };
215 conf_crtp { 221 conf_crtp {
216 nvidia,pins = "crtp"; 222 nvidia,pins = "crtp";
217 nvidia,pull = <0>; 223 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
218 nvidia,tristate = <1>; 224 nvidia,tristate = <TEGRA_PIN_ENABLE>;
219 }; 225 };
220 conf_dta { 226 conf_dta {
221 nvidia,pins = "dta", "dtb", "dtc", "dtd", 227 nvidia,pins = "dta", "dtb", "dtc", "dtd",
222 "spid", "spif"; 228 "spid", "spif";
223 nvidia,pull = <1>; 229 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
224 nvidia,tristate = <0>; 230 nvidia,tristate = <TEGRA_PIN_DISABLE>;
225 }; 231 };
226 conf_gme { 232 conf_gme {
227 nvidia,pins = "gme", "owc", "pta", "spic"; 233 nvidia,pins = "gme", "owc", "pta", "spic";
228 nvidia,pull = <2>; 234 nvidia,pull = <TEGRA_PIN_PULL_UP>;
229 nvidia,tristate = <1>; 235 nvidia,tristate = <TEGRA_PIN_ENABLE>;
230 }; 236 };
231 conf_ld17_0 { 237 conf_ld17_0 {
232 nvidia,pins = "ld17_0", "ld19_18", "ld21_20", 238 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
233 "ld23_22"; 239 "ld23_22";
234 nvidia,pull = <1>; 240 nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
235 }; 241 };
236 conf_ls { 242 conf_ls {
237 nvidia,pins = "ls", "pmce"; 243 nvidia,pins = "ls", "pmce";
238 nvidia,pull = <2>; 244 nvidia,pull = <TEGRA_PIN_PULL_UP>;
239 }; 245 };
240 drive_dap1 { 246 drive_dap1 {
241 nvidia,pins = "drive_dap1"; 247 nvidia,pins = "drive_dap1";
242 nvidia,high-speed-mode = <0>; 248 nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
243 nvidia,schmitt = <1>; 249 nvidia,schmitt = <TEGRA_PIN_ENABLE>;
244 nvidia,low-power-mode = <0>; 250 nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_8>;
245 nvidia,pull-down-strength = <0>; 251 nvidia,pull-down-strength = <0>;
246 nvidia,pull-up-strength = <0>; 252 nvidia,pull-up-strength = <0>;
247 nvidia,slew-rate-rising = <0>; 253 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
248 nvidia,slew-rate-falling = <0>; 254 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
249 }; 255 };
250 }; 256 };
251 }; 257 };
@@ -495,7 +501,20 @@
495 }; 501 };
496 }; 502 };
497 503
498 pmc { 504 kbc@7000e200 {
505 status = "okay";
506 nvidia,debounce-delay-ms = <20>;
507 nvidia,repeat-delay-ms = <160>;
508 nvidia,kbc-row-pins = <0 1 2>;
509 nvidia,kbc-col-pins = <16 17>;
510 nvidia,wakeup-source;
511 linux,keymap = <MATRIX_KEY(0x00, 0x00, KEY_POWER)
512 MATRIX_KEY(0x01, 0x00, KEY_HOME)
513 MATRIX_KEY(0x01, 0x01, KEY_BACK)
514 MATRIX_KEY(0x02, 0x01, KEY_MENU)>;
515 };
516
517 pmc@7000e400 {
499 nvidia,invert-interrupt; 518 nvidia,invert-interrupt;
500 nvidia,suspend-mode = <1>; 519 nvidia,suspend-mode = <1>;
501 nvidia,cpu-pwr-good-time = <2000>; 520 nvidia,cpu-pwr-good-time = <2000>;
@@ -543,7 +562,7 @@
543 #address-cells = <1>; 562 #address-cells = <1>;
544 #size-cells = <0>; 563 #size-cells = <0>;
545 564
546 clk32k_in: clock { 565 clk32k_in: clock@0 {
547 compatible = "fixed-clock"; 566 compatible = "fixed-clock";
548 reg=<0>; 567 reg=<0>;
549 #clock-cells = <0>; 568 #clock-cells = <0>;
@@ -551,25 +570,12 @@
551 }; 570 };
552 }; 571 };
553 572
554 kbc {
555 status = "okay";
556 nvidia,debounce-delay-ms = <20>;
557 nvidia,repeat-delay-ms = <160>;
558 nvidia,kbc-row-pins = <0 1 2>;
559 nvidia,kbc-col-pins = <16 17>;
560 nvidia,wakeup-source;
561 linux,keymap = <0x00000074 /* KEY_POWER */
562 0x01000066 /* KEY_HOME */
563 0x0101009E /* KEY_BACK */
564 0x0201008B>; /* KEY_MENU */
565 };
566
567 regulators { 573 regulators {
568 compatible = "simple-bus"; 574 compatible = "simple-bus";
569 #address-cells = <1>; 575 #address-cells = <1>;
570 #size-cells = <0>; 576 #size-cells = <0>;
571 577
572 usb0_vbus_reg: regulator { 578 usb0_vbus_reg: regulator@0 {
573 compatible = "regulator-fixed"; 579 compatible = "regulator-fixed";
574 reg = <0>; 580 reg = <0>;
575 regulator-name = "usb0_vbus"; 581 regulator-name = "usb0_vbus";
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index df40b54fd8bc..480ecda3416b 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -1,5 +1,6 @@
1#include <dt-bindings/clock/tegra20-car.h> 1#include <dt-bindings/clock/tegra20-car.h>
2#include <dt-bindings/gpio/tegra-gpio.h> 2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/pinctrl/pinctrl-tegra.h>
3#include <dt-bindings/interrupt-controller/arm-gic.h> 4#include <dt-bindings/interrupt-controller/arm-gic.h>
4 5
5#include "skeleton.dtsi" 6#include "skeleton.dtsi"
@@ -16,57 +17,71 @@
16 serial4 = &uarte; 17 serial4 = &uarte;
17 }; 18 };
18 19
19 host1x { 20 host1x@50000000 {
20 compatible = "nvidia,tegra20-host1x", "simple-bus"; 21 compatible = "nvidia,tegra20-host1x", "simple-bus";
21 reg = <0x50000000 0x00024000>; 22 reg = <0x50000000 0x00024000>;
22 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */ 23 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
23 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */ 24 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
24 clocks = <&tegra_car TEGRA20_CLK_HOST1X>; 25 clocks = <&tegra_car TEGRA20_CLK_HOST1X>;
26 resets = <&tegra_car 28>;
27 reset-names = "host1x";
25 28
26 #address-cells = <1>; 29 #address-cells = <1>;
27 #size-cells = <1>; 30 #size-cells = <1>;
28 31
29 ranges = <0x54000000 0x54000000 0x04000000>; 32 ranges = <0x54000000 0x54000000 0x04000000>;
30 33
31 mpe { 34 mpe@54040000 {
32 compatible = "nvidia,tegra20-mpe"; 35 compatible = "nvidia,tegra20-mpe";
33 reg = <0x54040000 0x00040000>; 36 reg = <0x54040000 0x00040000>;
34 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; 37 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
35 clocks = <&tegra_car TEGRA20_CLK_MPE>; 38 clocks = <&tegra_car TEGRA20_CLK_MPE>;
39 resets = <&tegra_car 60>;
40 reset-names = "mpe";
36 }; 41 };
37 42
38 vi { 43 vi@54080000 {
39 compatible = "nvidia,tegra20-vi"; 44 compatible = "nvidia,tegra20-vi";
40 reg = <0x54080000 0x00040000>; 45 reg = <0x54080000 0x00040000>;
41 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; 46 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
42 clocks = <&tegra_car TEGRA20_CLK_VI>; 47 clocks = <&tegra_car TEGRA20_CLK_VI>;
48 resets = <&tegra_car 20>;
49 reset-names = "vi";
43 }; 50 };
44 51
45 epp { 52 epp@540c0000 {
46 compatible = "nvidia,tegra20-epp"; 53 compatible = "nvidia,tegra20-epp";
47 reg = <0x540c0000 0x00040000>; 54 reg = <0x540c0000 0x00040000>;
48 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; 55 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
49 clocks = <&tegra_car TEGRA20_CLK_EPP>; 56 clocks = <&tegra_car TEGRA20_CLK_EPP>;
57 resets = <&tegra_car 19>;
58 reset-names = "epp";
50 }; 59 };
51 60
52 isp { 61 isp@54100000 {
53 compatible = "nvidia,tegra20-isp"; 62 compatible = "nvidia,tegra20-isp";
54 reg = <0x54100000 0x00040000>; 63 reg = <0x54100000 0x00040000>;
55 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; 64 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
56 clocks = <&tegra_car TEGRA20_CLK_ISP>; 65 clocks = <&tegra_car TEGRA20_CLK_ISP>;
66 resets = <&tegra_car 23>;
67 reset-names = "isp";
57 }; 68 };
58 69
59 gr2d { 70 gr2d@54140000 {
60 compatible = "nvidia,tegra20-gr2d"; 71 compatible = "nvidia,tegra20-gr2d";
61 reg = <0x54140000 0x00040000>; 72 reg = <0x54140000 0x00040000>;
62 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; 73 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
63 clocks = <&tegra_car TEGRA20_CLK_GR2D>; 74 clocks = <&tegra_car TEGRA20_CLK_GR2D>;
75 resets = <&tegra_car 21>;
76 reset-names = "2d";
64 }; 77 };
65 78
66 gr3d { 79 gr3d@54140000 {
67 compatible = "nvidia,tegra20-gr3d"; 80 compatible = "nvidia,tegra20-gr3d";
68 reg = <0x54180000 0x00040000>; 81 reg = <0x54140000 0x00040000>;
69 clocks = <&tegra_car TEGRA20_CLK_GR3D>; 82 clocks = <&tegra_car TEGRA20_CLK_GR3D>;
83 resets = <&tegra_car 24>;
84 reset-names = "3d";
70 }; 85 };
71 86
72 dc@54200000 { 87 dc@54200000 {
@@ -75,7 +90,9 @@
75 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; 90 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
76 clocks = <&tegra_car TEGRA20_CLK_DISP1>, 91 clocks = <&tegra_car TEGRA20_CLK_DISP1>,
77 <&tegra_car TEGRA20_CLK_PLL_P>; 92 <&tegra_car TEGRA20_CLK_PLL_P>;
78 clock-names = "disp1", "parent"; 93 clock-names = "dc", "parent";
94 resets = <&tegra_car 27>;
95 reset-names = "dc";
79 96
80 rgb { 97 rgb {
81 status = "disabled"; 98 status = "disabled";
@@ -88,24 +105,28 @@
88 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; 105 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
89 clocks = <&tegra_car TEGRA20_CLK_DISP2>, 106 clocks = <&tegra_car TEGRA20_CLK_DISP2>,
90 <&tegra_car TEGRA20_CLK_PLL_P>; 107 <&tegra_car TEGRA20_CLK_PLL_P>;
91 clock-names = "disp2", "parent"; 108 clock-names = "dc", "parent";
109 resets = <&tegra_car 26>;
110 reset-names = "dc";
92 111
93 rgb { 112 rgb {
94 status = "disabled"; 113 status = "disabled";
95 }; 114 };
96 }; 115 };
97 116
98 hdmi { 117 hdmi@54280000 {
99 compatible = "nvidia,tegra20-hdmi"; 118 compatible = "nvidia,tegra20-hdmi";
100 reg = <0x54280000 0x00040000>; 119 reg = <0x54280000 0x00040000>;
101 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; 120 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
102 clocks = <&tegra_car TEGRA20_CLK_HDMI>, 121 clocks = <&tegra_car TEGRA20_CLK_HDMI>,
103 <&tegra_car TEGRA20_CLK_PLL_D_OUT0>; 122 <&tegra_car TEGRA20_CLK_PLL_D_OUT0>;
104 clock-names = "hdmi", "parent"; 123 clock-names = "hdmi", "parent";
124 resets = <&tegra_car 51>;
125 reset-names = "hdmi";
105 status = "disabled"; 126 status = "disabled";
106 }; 127 };
107 128
108 tvo { 129 tvo@542c0000 {
109 compatible = "nvidia,tegra20-tvo"; 130 compatible = "nvidia,tegra20-tvo";
110 reg = <0x542c0000 0x00040000>; 131 reg = <0x542c0000 0x00040000>;
111 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>; 132 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
@@ -113,10 +134,12 @@
113 status = "disabled"; 134 status = "disabled";
114 }; 135 };
115 136
116 dsi { 137 dsi@542c0000 {
117 compatible = "nvidia,tegra20-dsi"; 138 compatible = "nvidia,tegra20-dsi";
118 reg = <0x54300000 0x00040000>; 139 reg = <0x542c0000 0x00040000>;
119 clocks = <&tegra_car TEGRA20_CLK_DSI>; 140 clocks = <&tegra_car TEGRA20_CLK_DSI>;
141 resets = <&tegra_car 48>;
142 reset-names = "dsi";
120 status = "disabled"; 143 status = "disabled";
121 }; 144 };
122 }; 145 };
@@ -129,7 +152,7 @@
129 clocks = <&tegra_car TEGRA20_CLK_TWD>; 152 clocks = <&tegra_car TEGRA20_CLK_TWD>;
130 }; 153 };
131 154
132 intc: interrupt-controller { 155 intc: interrupt-controller@50041000 {
133 compatible = "arm,cortex-a9-gic"; 156 compatible = "arm,cortex-a9-gic";
134 reg = <0x50041000 0x1000 157 reg = <0x50041000 0x1000
135 0x50040100 0x0100>; 158 0x50040100 0x0100>;
@@ -137,7 +160,7 @@
137 #interrupt-cells = <3>; 160 #interrupt-cells = <3>;
138 }; 161 };
139 162
140 cache-controller { 163 cache-controller@50043000 {
141 compatible = "arm,pl310-cache"; 164 compatible = "arm,pl310-cache";
142 reg = <0x50043000 0x1000>; 165 reg = <0x50043000 0x1000>;
143 arm,data-latency = <5 5 2>; 166 arm,data-latency = <5 5 2>;
@@ -156,13 +179,14 @@
156 clocks = <&tegra_car TEGRA20_CLK_TIMER>; 179 clocks = <&tegra_car TEGRA20_CLK_TIMER>;
157 }; 180 };
158 181
159 tegra_car: clock { 182 tegra_car: clock@60006000 {
160 compatible = "nvidia,tegra20-car"; 183 compatible = "nvidia,tegra20-car";
161 reg = <0x60006000 0x1000>; 184 reg = <0x60006000 0x1000>;
162 #clock-cells = <1>; 185 #clock-cells = <1>;
186 #reset-cells = <1>;
163 }; 187 };
164 188
165 apbdma: dma { 189 apbdma: dma@6000a000 {
166 compatible = "nvidia,tegra20-apbdma"; 190 compatible = "nvidia,tegra20-apbdma";
167 reg = <0x6000a000 0x1200>; 191 reg = <0x6000a000 0x1200>;
168 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, 192 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
@@ -182,14 +206,17 @@
182 <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>, 206 <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
183 <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; 207 <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
184 clocks = <&tegra_car TEGRA20_CLK_APBDMA>; 208 clocks = <&tegra_car TEGRA20_CLK_APBDMA>;
209 resets = <&tegra_car 34>;
210 reset-names = "dma";
211 #dma-cells = <1>;
185 }; 212 };
186 213
187 ahb { 214 ahb@6000c004 {
188 compatible = "nvidia,tegra20-ahb"; 215 compatible = "nvidia,tegra20-ahb";
189 reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */ 216 reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */
190 }; 217 };
191 218
192 gpio: gpio { 219 gpio: gpio@6000d000 {
193 compatible = "nvidia,tegra20-gpio"; 220 compatible = "nvidia,tegra20-gpio";
194 reg = <0x6000d000 0x1000>; 221 reg = <0x6000d000 0x1000>;
195 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, 222 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
@@ -205,7 +232,7 @@
205 interrupt-controller; 232 interrupt-controller;
206 }; 233 };
207 234
208 pinmux: pinmux { 235 pinmux: pinmux@70000014 {
209 compatible = "nvidia,tegra20-pinmux"; 236 compatible = "nvidia,tegra20-pinmux";
210 reg = <0x70000014 0x10 /* Tri-state registers */ 237 reg = <0x70000014 0x10 /* Tri-state registers */
211 0x70000080 0x20 /* Mux registers */ 238 0x70000080 0x20 /* Mux registers */
@@ -213,17 +240,20 @@
213 0x70000868 0xa8>; /* Pad control registers */ 240 0x70000868 0xa8>; /* Pad control registers */
214 }; 241 };
215 242
216 das { 243 das@70000c00 {
217 compatible = "nvidia,tegra20-das"; 244 compatible = "nvidia,tegra20-das";
218 reg = <0x70000c00 0x80>; 245 reg = <0x70000c00 0x80>;
219 }; 246 };
220 247
221 tegra_ac97: ac97 { 248 tegra_ac97: ac97@70002000 {
222 compatible = "nvidia,tegra20-ac97"; 249 compatible = "nvidia,tegra20-ac97";
223 reg = <0x70002000 0x200>; 250 reg = <0x70002000 0x200>;
224 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; 251 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
225 nvidia,dma-request-selector = <&apbdma 12>;
226 clocks = <&tegra_car TEGRA20_CLK_AC97>; 252 clocks = <&tegra_car TEGRA20_CLK_AC97>;
253 resets = <&tegra_car 3>;
254 reset-names = "ac97";
255 dmas = <&apbdma 12>, <&apbdma 12>;
256 dma-names = "rx", "tx";
227 status = "disabled"; 257 status = "disabled";
228 }; 258 };
229 259
@@ -231,8 +261,11 @@
231 compatible = "nvidia,tegra20-i2s"; 261 compatible = "nvidia,tegra20-i2s";
232 reg = <0x70002800 0x200>; 262 reg = <0x70002800 0x200>;
233 interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; 263 interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
234 nvidia,dma-request-selector = <&apbdma 2>;
235 clocks = <&tegra_car TEGRA20_CLK_I2S1>; 264 clocks = <&tegra_car TEGRA20_CLK_I2S1>;
265 resets = <&tegra_car 11>;
266 reset-names = "i2s";
267 dmas = <&apbdma 2>, <&apbdma 2>;
268 dma-names = "rx", "tx";
236 status = "disabled"; 269 status = "disabled";
237 }; 270 };
238 271
@@ -240,8 +273,11 @@
240 compatible = "nvidia,tegra20-i2s"; 273 compatible = "nvidia,tegra20-i2s";
241 reg = <0x70002a00 0x200>; 274 reg = <0x70002a00 0x200>;
242 interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; 275 interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
243 nvidia,dma-request-selector = <&apbdma 1>;
244 clocks = <&tegra_car TEGRA20_CLK_I2S2>; 276 clocks = <&tegra_car TEGRA20_CLK_I2S2>;
277 resets = <&tegra_car 18>;
278 reset-names = "i2s";
279 dmas = <&apbdma 1>, <&apbdma 1>;
280 dma-names = "rx", "tx";
245 status = "disabled"; 281 status = "disabled";
246 }; 282 };
247 283
@@ -257,8 +293,11 @@
257 reg = <0x70006000 0x40>; 293 reg = <0x70006000 0x40>;
258 reg-shift = <2>; 294 reg-shift = <2>;
259 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; 295 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
260 nvidia,dma-request-selector = <&apbdma 8>;
261 clocks = <&tegra_car TEGRA20_CLK_UARTA>; 296 clocks = <&tegra_car TEGRA20_CLK_UARTA>;
297 resets = <&tegra_car 6>;
298 reset-names = "serial";
299 dmas = <&apbdma 8>, <&apbdma 8>;
300 dma-names = "rx", "tx";
262 status = "disabled"; 301 status = "disabled";
263 }; 302 };
264 303
@@ -267,8 +306,11 @@
267 reg = <0x70006040 0x40>; 306 reg = <0x70006040 0x40>;
268 reg-shift = <2>; 307 reg-shift = <2>;
269 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; 308 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
270 nvidia,dma-request-selector = <&apbdma 9>;
271 clocks = <&tegra_car TEGRA20_CLK_UARTB>; 309 clocks = <&tegra_car TEGRA20_CLK_UARTB>;
310 resets = <&tegra_car 7>;
311 reset-names = "serial";
312 dmas = <&apbdma 9>, <&apbdma 9>;
313 dma-names = "rx", "tx";
272 status = "disabled"; 314 status = "disabled";
273 }; 315 };
274 316
@@ -277,8 +319,11 @@
277 reg = <0x70006200 0x100>; 319 reg = <0x70006200 0x100>;
278 reg-shift = <2>; 320 reg-shift = <2>;
279 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 321 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
280 nvidia,dma-request-selector = <&apbdma 10>;
281 clocks = <&tegra_car TEGRA20_CLK_UARTC>; 322 clocks = <&tegra_car TEGRA20_CLK_UARTC>;
323 resets = <&tegra_car 55>;
324 reset-names = "serial";
325 dmas = <&apbdma 10>, <&apbdma 10>;
326 dma-names = "rx", "tx";
282 status = "disabled"; 327 status = "disabled";
283 }; 328 };
284 329
@@ -287,8 +332,11 @@
287 reg = <0x70006300 0x100>; 332 reg = <0x70006300 0x100>;
288 reg-shift = <2>; 333 reg-shift = <2>;
289 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; 334 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
290 nvidia,dma-request-selector = <&apbdma 19>;
291 clocks = <&tegra_car TEGRA20_CLK_UARTD>; 335 clocks = <&tegra_car TEGRA20_CLK_UARTD>;
336 resets = <&tegra_car 65>;
337 reset-names = "serial";
338 dmas = <&apbdma 19>, <&apbdma 19>;
339 dma-names = "rx", "tx";
292 status = "disabled"; 340 status = "disabled";
293 }; 341 };
294 342
@@ -297,20 +345,25 @@
297 reg = <0x70006400 0x100>; 345 reg = <0x70006400 0x100>;
298 reg-shift = <2>; 346 reg-shift = <2>;
299 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; 347 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
300 nvidia,dma-request-selector = <&apbdma 20>;
301 clocks = <&tegra_car TEGRA20_CLK_UARTE>; 348 clocks = <&tegra_car TEGRA20_CLK_UARTE>;
349 resets = <&tegra_car 66>;
350 reset-names = "serial";
351 dmas = <&apbdma 20>, <&apbdma 20>;
352 dma-names = "rx", "tx";
302 status = "disabled"; 353 status = "disabled";
303 }; 354 };
304 355
305 pwm: pwm { 356 pwm: pwm@7000a000 {
306 compatible = "nvidia,tegra20-pwm"; 357 compatible = "nvidia,tegra20-pwm";
307 reg = <0x7000a000 0x100>; 358 reg = <0x7000a000 0x100>;
308 #pwm-cells = <2>; 359 #pwm-cells = <2>;
309 clocks = <&tegra_car TEGRA20_CLK_PWM>; 360 clocks = <&tegra_car TEGRA20_CLK_PWM>;
361 resets = <&tegra_car 17>;
362 reset-names = "pwm";
310 status = "disabled"; 363 status = "disabled";
311 }; 364 };
312 365
313 rtc { 366 rtc@7000e000 {
314 compatible = "nvidia,tegra20-rtc"; 367 compatible = "nvidia,tegra20-rtc";
315 reg = <0x7000e000 0x100>; 368 reg = <0x7000e000 0x100>;
316 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; 369 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
@@ -326,6 +379,10 @@
326 clocks = <&tegra_car TEGRA20_CLK_I2C1>, 379 clocks = <&tegra_car TEGRA20_CLK_I2C1>,
327 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; 380 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
328 clock-names = "div-clk", "fast-clk"; 381 clock-names = "div-clk", "fast-clk";
382 resets = <&tegra_car 12>;
383 reset-names = "i2c";
384 dmas = <&apbdma 21>, <&apbdma 21>;
385 dma-names = "rx", "tx";
329 status = "disabled"; 386 status = "disabled";
330 }; 387 };
331 388
@@ -333,10 +390,13 @@
333 compatible = "nvidia,tegra20-sflash"; 390 compatible = "nvidia,tegra20-sflash";
334 reg = <0x7000c380 0x80>; 391 reg = <0x7000c380 0x80>;
335 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; 392 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
336 nvidia,dma-request-selector = <&apbdma 11>;
337 #address-cells = <1>; 393 #address-cells = <1>;
338 #size-cells = <0>; 394 #size-cells = <0>;
339 clocks = <&tegra_car TEGRA20_CLK_SPI>; 395 clocks = <&tegra_car TEGRA20_CLK_SPI>;
396 resets = <&tegra_car 43>;
397 reset-names = "spi";
398 dmas = <&apbdma 11>, <&apbdma 11>;
399 dma-names = "rx", "tx";
340 status = "disabled"; 400 status = "disabled";
341 }; 401 };
342 402
@@ -349,6 +409,10 @@
349 clocks = <&tegra_car TEGRA20_CLK_I2C2>, 409 clocks = <&tegra_car TEGRA20_CLK_I2C2>,
350 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; 410 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
351 clock-names = "div-clk", "fast-clk"; 411 clock-names = "div-clk", "fast-clk";
412 resets = <&tegra_car 54>;
413 reset-names = "i2c";
414 dmas = <&apbdma 22>, <&apbdma 22>;
415 dma-names = "rx", "tx";
352 status = "disabled"; 416 status = "disabled";
353 }; 417 };
354 418
@@ -361,6 +425,10 @@
361 clocks = <&tegra_car TEGRA20_CLK_I2C3>, 425 clocks = <&tegra_car TEGRA20_CLK_I2C3>,
362 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; 426 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
363 clock-names = "div-clk", "fast-clk"; 427 clock-names = "div-clk", "fast-clk";
428 resets = <&tegra_car 67>;
429 reset-names = "i2c";
430 dmas = <&apbdma 23>, <&apbdma 23>;
431 dma-names = "rx", "tx";
364 status = "disabled"; 432 status = "disabled";
365 }; 433 };
366 434
@@ -373,6 +441,10 @@
373 clocks = <&tegra_car TEGRA20_CLK_DVC>, 441 clocks = <&tegra_car TEGRA20_CLK_DVC>,
374 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>; 442 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
375 clock-names = "div-clk", "fast-clk"; 443 clock-names = "div-clk", "fast-clk";
444 resets = <&tegra_car 47>;
445 reset-names = "i2c";
446 dmas = <&apbdma 24>, <&apbdma 24>;
447 dma-names = "rx", "tx";
376 status = "disabled"; 448 status = "disabled";
377 }; 449 };
378 450
@@ -380,10 +452,13 @@
380 compatible = "nvidia,tegra20-slink"; 452 compatible = "nvidia,tegra20-slink";
381 reg = <0x7000d400 0x200>; 453 reg = <0x7000d400 0x200>;
382 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; 454 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
383 nvidia,dma-request-selector = <&apbdma 15>;
384 #address-cells = <1>; 455 #address-cells = <1>;
385 #size-cells = <0>; 456 #size-cells = <0>;
386 clocks = <&tegra_car TEGRA20_CLK_SBC1>; 457 clocks = <&tegra_car TEGRA20_CLK_SBC1>;
458 resets = <&tegra_car 41>;
459 reset-names = "spi";
460 dmas = <&apbdma 15>, <&apbdma 15>;
461 dma-names = "rx", "tx";
387 status = "disabled"; 462 status = "disabled";
388 }; 463 };
389 464
@@ -391,10 +466,13 @@
391 compatible = "nvidia,tegra20-slink"; 466 compatible = "nvidia,tegra20-slink";
392 reg = <0x7000d600 0x200>; 467 reg = <0x7000d600 0x200>;
393 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; 468 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
394 nvidia,dma-request-selector = <&apbdma 16>;
395 #address-cells = <1>; 469 #address-cells = <1>;
396 #size-cells = <0>; 470 #size-cells = <0>;
397 clocks = <&tegra_car TEGRA20_CLK_SBC2>; 471 clocks = <&tegra_car TEGRA20_CLK_SBC2>;
472 resets = <&tegra_car 44>;
473 reset-names = "spi";
474 dmas = <&apbdma 16>, <&apbdma 16>;
475 dma-names = "rx", "tx";
398 status = "disabled"; 476 status = "disabled";
399 }; 477 };
400 478
@@ -402,10 +480,13 @@
402 compatible = "nvidia,tegra20-slink"; 480 compatible = "nvidia,tegra20-slink";
403 reg = <0x7000d800 0x200>; 481 reg = <0x7000d800 0x200>;
404 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; 482 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
405 nvidia,dma-request-selector = <&apbdma 17>;
406 #address-cells = <1>; 483 #address-cells = <1>;
407 #size-cells = <0>; 484 #size-cells = <0>;
408 clocks = <&tegra_car TEGRA20_CLK_SBC3>; 485 clocks = <&tegra_car TEGRA20_CLK_SBC3>;
486 resets = <&tegra_car 46>;
487 reset-names = "spi";
488 dmas = <&apbdma 17>, <&apbdma 17>;
489 dma-names = "rx", "tx";
409 status = "disabled"; 490 status = "disabled";
410 }; 491 };
411 492
@@ -413,22 +494,27 @@
413 compatible = "nvidia,tegra20-slink"; 494 compatible = "nvidia,tegra20-slink";
414 reg = <0x7000da00 0x200>; 495 reg = <0x7000da00 0x200>;
415 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; 496 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
416 nvidia,dma-request-selector = <&apbdma 18>;
417 #address-cells = <1>; 497 #address-cells = <1>;
418 #size-cells = <0>; 498 #size-cells = <0>;
419 clocks = <&tegra_car TEGRA20_CLK_SBC4>; 499 clocks = <&tegra_car TEGRA20_CLK_SBC4>;
500 resets = <&tegra_car 68>;
501 reset-names = "spi";
502 dmas = <&apbdma 18>, <&apbdma 18>;
503 dma-names = "rx", "tx";
420 status = "disabled"; 504 status = "disabled";
421 }; 505 };
422 506
423 kbc { 507 kbc@7000e200 {
424 compatible = "nvidia,tegra20-kbc"; 508 compatible = "nvidia,tegra20-kbc";
425 reg = <0x7000e200 0x100>; 509 reg = <0x7000e200 0x100>;
426 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; 510 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
427 clocks = <&tegra_car TEGRA20_CLK_KBC>; 511 clocks = <&tegra_car TEGRA20_CLK_KBC>;
512 resets = <&tegra_car 36>;
513 reset-names = "kbc";
428 status = "disabled"; 514 status = "disabled";
429 }; 515 };
430 516
431 pmc { 517 pmc@7000e400 {
432 compatible = "nvidia,tegra20-pmc"; 518 compatible = "nvidia,tegra20-pmc";
433 reg = <0x7000e400 0x400>; 519 reg = <0x7000e400 0x400>;
434 clocks = <&tegra_car TEGRA20_CLK_PCLK>, <&clk32k_in>; 520 clocks = <&tegra_car TEGRA20_CLK_PCLK>, <&clk32k_in>;
@@ -442,7 +528,7 @@
442 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; 528 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
443 }; 529 };
444 530
445 iommu { 531 iommu@7000f024 {
446 compatible = "nvidia,tegra20-gart"; 532 compatible = "nvidia,tegra20-gart";
447 reg = <0x7000f024 0x00000018 /* controller registers */ 533 reg = <0x7000f024 0x00000018 /* controller registers */
448 0x58000000 0x02000000>; /* GART aperture */ 534 0x58000000 0x02000000>; /* GART aperture */
@@ -455,7 +541,7 @@
455 #size-cells = <0>; 541 #size-cells = <0>;
456 }; 542 };
457 543
458 pcie-controller { 544 pcie-controller@80003000 {
459 compatible = "nvidia,tegra20-pcie"; 545 compatible = "nvidia,tegra20-pcie";
460 device_type = "pci"; 546 device_type = "pci";
461 reg = <0x80003000 0x00000800 /* PADS registers */ 547 reg = <0x80003000 0x00000800 /* PADS registers */
@@ -478,9 +564,12 @@
478 564
479 clocks = <&tegra_car TEGRA20_CLK_PEX>, 565 clocks = <&tegra_car TEGRA20_CLK_PEX>,
480 <&tegra_car TEGRA20_CLK_AFI>, 566 <&tegra_car TEGRA20_CLK_AFI>,
481 <&tegra_car TEGRA20_CLK_PCIE_XCLK>,
482 <&tegra_car TEGRA20_CLK_PLL_E>; 567 <&tegra_car TEGRA20_CLK_PLL_E>;
483 clock-names = "pex", "afi", "pcie_xclk", "pll_e"; 568 clock-names = "pex", "afi", "pll_e";
569 resets = <&tegra_car 70>,
570 <&tegra_car 72>,
571 <&tegra_car 74>;
572 reset-names = "pex", "afi", "pcie_x";
484 status = "disabled"; 573 status = "disabled";
485 574
486 pci@1,0 { 575 pci@1,0 {
@@ -517,6 +606,8 @@
517 phy_type = "utmi"; 606 phy_type = "utmi";
518 nvidia,has-legacy-mode; 607 nvidia,has-legacy-mode;
519 clocks = <&tegra_car TEGRA20_CLK_USBD>; 608 clocks = <&tegra_car TEGRA20_CLK_USBD>;
609 resets = <&tegra_car 22>;
610 reset-names = "usb";
520 nvidia,needs-double-reset; 611 nvidia,needs-double-reset;
521 nvidia,phy = <&phy1>; 612 nvidia,phy = <&phy1>;
522 status = "disabled"; 613 status = "disabled";
@@ -548,6 +639,8 @@
548 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; 639 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
549 phy_type = "ulpi"; 640 phy_type = "ulpi";
550 clocks = <&tegra_car TEGRA20_CLK_USB2>; 641 clocks = <&tegra_car TEGRA20_CLK_USB2>;
642 resets = <&tegra_car 58>;
643 reset-names = "usb";
551 nvidia,phy = <&phy2>; 644 nvidia,phy = <&phy2>;
552 status = "disabled"; 645 status = "disabled";
553 }; 646 };
@@ -569,6 +662,8 @@
569 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; 662 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
570 phy_type = "utmi"; 663 phy_type = "utmi";
571 clocks = <&tegra_car TEGRA20_CLK_USB3>; 664 clocks = <&tegra_car TEGRA20_CLK_USB3>;
665 resets = <&tegra_car 59>;
666 reset-names = "usb";
572 nvidia,phy = <&phy3>; 667 nvidia,phy = <&phy3>;
573 status = "disabled"; 668 status = "disabled";
574 }; 669 };
@@ -597,6 +692,8 @@
597 reg = <0xc8000000 0x200>; 692 reg = <0xc8000000 0x200>;
598 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 693 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
599 clocks = <&tegra_car TEGRA20_CLK_SDMMC1>; 694 clocks = <&tegra_car TEGRA20_CLK_SDMMC1>;
695 resets = <&tegra_car 14>;
696 reset-names = "sdhci";
600 status = "disabled"; 697 status = "disabled";
601 }; 698 };
602 699
@@ -605,6 +702,8 @@
605 reg = <0xc8000200 0x200>; 702 reg = <0xc8000200 0x200>;
606 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; 703 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
607 clocks = <&tegra_car TEGRA20_CLK_SDMMC2>; 704 clocks = <&tegra_car TEGRA20_CLK_SDMMC2>;
705 resets = <&tegra_car 9>;
706 reset-names = "sdhci";
608 status = "disabled"; 707 status = "disabled";
609 }; 708 };
610 709
@@ -613,6 +712,8 @@
613 reg = <0xc8000400 0x200>; 712 reg = <0xc8000400 0x200>;
614 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; 713 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
615 clocks = <&tegra_car TEGRA20_CLK_SDMMC3>; 714 clocks = <&tegra_car TEGRA20_CLK_SDMMC3>;
715 resets = <&tegra_car 69>;
716 reset-names = "sdhci";
616 status = "disabled"; 717 status = "disabled";
617 }; 718 };
618 719
@@ -621,6 +722,8 @@
621 reg = <0xc8000600 0x200>; 722 reg = <0xc8000600 0x200>;
622 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; 723 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
623 clocks = <&tegra_car TEGRA20_CLK_SDMMC4>; 724 clocks = <&tegra_car TEGRA20_CLK_SDMMC4>;
725 resets = <&tegra_car 15>;
726 reset-names = "sdhci";
624 status = "disabled"; 727 status = "disabled";
625 }; 728 };
626 729
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts
index 08cad696e89f..e93fe45b7803 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -6,11 +6,16 @@
6 model = "NVIDIA Tegra30 Beaver evaluation board"; 6 model = "NVIDIA Tegra30 Beaver evaluation board";
7 compatible = "nvidia,beaver", "nvidia,tegra30"; 7 compatible = "nvidia,beaver", "nvidia,tegra30";
8 8
9 aliases {
10 rtc0 = "/i2c@7000d000/tps65911@2d";
11 rtc1 = "/rtc@7000e000";
12 };
13
9 memory { 14 memory {
10 reg = <0x80000000 0x7ff00000>; 15 reg = <0x80000000 0x7ff00000>;
11 }; 16 };
12 17
13 pcie-controller { 18 pcie-controller@00003000 {
14 status = "okay"; 19 status = "okay";
15 pex-clk-supply = <&sys_3v3_pexs_reg>; 20 pex-clk-supply = <&sys_3v3_pexs_reg>;
16 vdd-supply = <&ldo1_reg>; 21 vdd-supply = <&ldo1_reg>;
@@ -31,8 +36,8 @@
31 }; 36 };
32 }; 37 };
33 38
34 host1x { 39 host1x@50000000 {
35 hdmi { 40 hdmi@54280000 {
36 status = "okay"; 41 status = "okay";
37 42
38 vdd-supply = <&sys_3v3_reg>; 43 vdd-supply = <&sys_3v3_reg>;
@@ -44,7 +49,7 @@
44 }; 49 };
45 }; 50 };
46 51
47 pinmux { 52 pinmux@70000868 {
48 pinctrl-names = "default"; 53 pinctrl-names = "default";
49 pinctrl-0 = <&state_default>; 54 pinctrl-0 = <&state_default>;
50 55
@@ -52,8 +57,8 @@
52 sdmmc1_clk_pz0 { 57 sdmmc1_clk_pz0 {
53 nvidia,pins = "sdmmc1_clk_pz0"; 58 nvidia,pins = "sdmmc1_clk_pz0";
54 nvidia,function = "sdmmc1"; 59 nvidia,function = "sdmmc1";
55 nvidia,pull = <0>; 60 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
56 nvidia,tristate = <0>; 61 nvidia,tristate = <TEGRA_PIN_DISABLE>;
57 }; 62 };
58 sdmmc1_cmd_pz1 { 63 sdmmc1_cmd_pz1 {
59 nvidia,pins = "sdmmc1_cmd_pz1", 64 nvidia,pins = "sdmmc1_cmd_pz1",
@@ -62,14 +67,14 @@
62 "sdmmc1_dat2_py5", 67 "sdmmc1_dat2_py5",
63 "sdmmc1_dat3_py4"; 68 "sdmmc1_dat3_py4";
64 nvidia,function = "sdmmc1"; 69 nvidia,function = "sdmmc1";
65 nvidia,pull = <2>; 70 nvidia,pull = <TEGRA_PIN_PULL_UP>;
66 nvidia,tristate = <0>; 71 nvidia,tristate = <TEGRA_PIN_DISABLE>;
67 }; 72 };
68 sdmmc3_clk_pa6 { 73 sdmmc3_clk_pa6 {
69 nvidia,pins = "sdmmc3_clk_pa6"; 74 nvidia,pins = "sdmmc3_clk_pa6";
70 nvidia,function = "sdmmc3"; 75 nvidia,function = "sdmmc3";
71 nvidia,pull = <0>; 76 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
72 nvidia,tristate = <0>; 77 nvidia,tristate = <TEGRA_PIN_DISABLE>;
73 }; 78 };
74 sdmmc3_cmd_pa7 { 79 sdmmc3_cmd_pa7 {
75 nvidia,pins = "sdmmc3_cmd_pa7", 80 nvidia,pins = "sdmmc3_cmd_pa7",
@@ -78,15 +83,15 @@
78 "sdmmc3_dat2_pb5", 83 "sdmmc3_dat2_pb5",
79 "sdmmc3_dat3_pb4"; 84 "sdmmc3_dat3_pb4";
80 nvidia,function = "sdmmc3"; 85 nvidia,function = "sdmmc3";
81 nvidia,pull = <2>; 86 nvidia,pull = <TEGRA_PIN_PULL_UP>;
82 nvidia,tristate = <0>; 87 nvidia,tristate = <TEGRA_PIN_DISABLE>;
83 }; 88 };
84 sdmmc4_clk_pcc4 { 89 sdmmc4_clk_pcc4 {
85 nvidia,pins = "sdmmc4_clk_pcc4", 90 nvidia,pins = "sdmmc4_clk_pcc4",
86 "sdmmc4_rst_n_pcc3"; 91 "sdmmc4_rst_n_pcc3";
87 nvidia,function = "sdmmc4"; 92 nvidia,function = "sdmmc4";
88 nvidia,pull = <0>; 93 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
89 nvidia,tristate = <0>; 94 nvidia,tristate = <TEGRA_PIN_DISABLE>;
90 }; 95 };
91 sdmmc4_dat0_paa0 { 96 sdmmc4_dat0_paa0 {
92 nvidia,pins = "sdmmc4_dat0_paa0", 97 nvidia,pins = "sdmmc4_dat0_paa0",
@@ -98,8 +103,8 @@
98 "sdmmc4_dat6_paa6", 103 "sdmmc4_dat6_paa6",
99 "sdmmc4_dat7_paa7"; 104 "sdmmc4_dat7_paa7";
100 nvidia,function = "sdmmc4"; 105 nvidia,function = "sdmmc4";
101 nvidia,pull = <2>; 106 nvidia,pull = <TEGRA_PIN_PULL_UP>;
102 nvidia,tristate = <0>; 107 nvidia,tristate = <TEGRA_PIN_DISABLE>;
103 }; 108 };
104 dap2_fs_pa2 { 109 dap2_fs_pa2 {
105 nvidia,pins = "dap2_fs_pa2", 110 nvidia,pins = "dap2_fs_pa2",
@@ -107,18 +112,18 @@
107 "dap2_din_pa4", 112 "dap2_din_pa4",
108 "dap2_dout_pa5"; 113 "dap2_dout_pa5";
109 nvidia,function = "i2s1"; 114 nvidia,function = "i2s1";
110 nvidia,pull = <0>; 115 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
111 nvidia,tristate = <0>; 116 nvidia,tristate = <TEGRA_PIN_DISABLE>;
112 }; 117 };
113 pex_l1_prsnt_n_pdd4 { 118 pex_l1_prsnt_n_pdd4 {
114 nvidia,pins = "pex_l1_prsnt_n_pdd4", 119 nvidia,pins = "pex_l1_prsnt_n_pdd4",
115 "pex_l1_clkreq_n_pdd6"; 120 "pex_l1_clkreq_n_pdd6";
116 nvidia,pull = <2>; 121 nvidia,pull = <TEGRA_PIN_PULL_UP>;
117 }; 122 };
118 sdio3 { 123 sdio3 {
119 nvidia,pins = "drive_sdio3"; 124 nvidia,pins = "drive_sdio3";
120 nvidia,high-speed-mode = <0>; 125 nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
121 nvidia,schmitt = <0>; 126 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
122 nvidia,pull-down-strength = <46>; 127 nvidia,pull-down-strength = <46>;
123 nvidia,pull-up-strength = <42>; 128 nvidia,pull-up-strength = <42>;
124 nvidia,slew-rate-rising = <1>; 129 nvidia,slew-rate-rising = <1>;
@@ -159,7 +164,7 @@
159 status = "okay"; 164 status = "okay";
160 clock-frequency = <100000>; 165 clock-frequency = <100000>;
161 166
162 rt5640: rt5640 { 167 rt5640: rt5640@1c {
163 compatible = "realtek,rt5640"; 168 compatible = "realtek,rt5640";
164 reg = <0x1c>; 169 reg = <0x1c>;
165 interrupt-parent = <&gpio>; 170 interrupt-parent = <&gpio>;
@@ -168,19 +173,6 @@
168 <&gpio TEGRA_GPIO(X, 2) GPIO_ACTIVE_HIGH>; 173 <&gpio TEGRA_GPIO(X, 2) GPIO_ACTIVE_HIGH>;
169 }; 174 };
170 175
171 tps62361 {
172 compatible = "ti,tps62361";
173 reg = <0x60>;
174
175 regulator-name = "tps62361-vout";
176 regulator-min-microvolt = <500000>;
177 regulator-max-microvolt = <1500000>;
178 regulator-boot-on;
179 regulator-always-on;
180 ti,vsel0-state-high;
181 ti,vsel1-state-high;
182 };
183
184 pmic: tps65911@2d { 176 pmic: tps65911@2d {
185 compatible = "ti,tps65911"; 177 compatible = "ti,tps65911";
186 reg = <0x2d>; 178 reg = <0x2d>;
@@ -284,6 +276,19 @@
284 }; 276 };
285 }; 277 };
286 }; 278 };
279
280 tps62361@60 {
281 compatible = "ti,tps62361";
282 reg = <0x60>;
283
284 regulator-name = "tps62361-vout";
285 regulator-min-microvolt = <500000>;
286 regulator-max-microvolt = <1500000>;
287 regulator-boot-on;
288 regulator-always-on;
289 ti,vsel0-state-high;
290 ti,vsel1-state-high;
291 };
287 }; 292 };
288 293
289 spi@7000da00 { 294 spi@7000da00 {
@@ -296,13 +301,7 @@
296 }; 301 };
297 }; 302 };
298 303
299 ahub { 304 pmc@7000e400 {
300 i2s@70080400 {
301 status = "okay";
302 };
303 };
304
305 pmc {
306 status = "okay"; 305 status = "okay";
307 nvidia,invert-interrupt; 306 nvidia,invert-interrupt;
308 nvidia,suspend-mode = <1>; 307 nvidia,suspend-mode = <1>;
@@ -314,6 +313,12 @@
314 nvidia,sys-clock-req-active-high; 313 nvidia,sys-clock-req-active-high;
315 }; 314 };
316 315
316 ahub@70080000 {
317 i2s@70080400 {
318 status = "okay";
319 };
320 };
321
317 sdhci@78000000 { 322 sdhci@78000000 {
318 status = "okay"; 323 status = "okay";
319 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>; 324 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
@@ -328,6 +333,15 @@
328 non-removable; 333 non-removable;
329 }; 334 };
330 335
336 usb@7d004000 {
337 status = "okay";
338 };
339
340 phy2: usb-phy@7d004000 {
341 vbus-supply = <&sys_3v3_reg>;
342 status = "okay";
343 };
344
331 usb@7d008000 { 345 usb@7d008000 {
332 status = "okay"; 346 status = "okay";
333 }; 347 };
@@ -342,7 +356,7 @@
342 #address-cells = <1>; 356 #address-cells = <1>;
343 #size-cells = <0>; 357 #size-cells = <0>;
344 358
345 clk32k_in: clock { 359 clk32k_in: clock@0 {
346 compatible = "fixed-clock"; 360 compatible = "fixed-clock";
347 reg=<0>; 361 reg=<0>;
348 #clock-cells = <0>; 362 #clock-cells = <0>;
@@ -350,6 +364,19 @@
350 }; 364 };
351 }; 365 };
352 366
367 gpio-leds {
368 compatible = "gpio-leds";
369
370 gpled1 {
371 label = "LED1"; /* CR5A1 (blue) */
372 gpios = <&gpio TEGRA_GPIO(L, 1) GPIO_ACTIVE_HIGH>;
373 };
374 gpled2 {
375 label = "LED2"; /* CR4A2 (green) */
376 gpios = <&gpio TEGRA_GPIO(L, 0) GPIO_ACTIVE_HIGH>;
377 };
378 };
379
353 regulators { 380 regulators {
354 compatible = "simple-bus"; 381 compatible = "simple-bus";
355 #address-cells = <1>; 382 #address-cells = <1>;
@@ -453,19 +480,6 @@
453 }; 480 };
454 }; 481 };
455 482
456 gpio-leds {
457 compatible = "gpio-leds";
458
459 gpled1 {
460 label = "LED1"; /* CR5A1 (blue) */
461 gpios = <&gpio TEGRA_GPIO(L, 1) GPIO_ACTIVE_HIGH>;
462 };
463 gpled2 {
464 label = "LED2"; /* CR4A2 (green) */
465 gpios = <&gpio TEGRA_GPIO(L, 0) GPIO_ACTIVE_HIGH>;
466 };
467 };
468
469 sound { 483 sound {
470 compatible = "nvidia,tegra-audio-rt5640-beaver", 484 compatible = "nvidia,tegra-audio-rt5640-beaver",
471 "nvidia,tegra-audio-rt5640"; 485 "nvidia,tegra-audio-rt5640";
diff --git a/arch/arm/boot/dts/tegra30-cardhu-a02.dts b/arch/arm/boot/dts/tegra30-cardhu-a02.dts
index 1082c5ed90d1..c9bfedcca6ed 100644
--- a/arch/arm/boot/dts/tegra30-cardhu-a02.dts
+++ b/arch/arm/boot/dts/tegra30-cardhu-a02.dts
@@ -8,6 +8,13 @@
8 model = "NVIDIA Tegra30 Cardhu A02 evaluation board"; 8 model = "NVIDIA Tegra30 Cardhu A02 evaluation board";
9 compatible = "nvidia,cardhu-a02", "nvidia,cardhu", "nvidia,tegra30"; 9 compatible = "nvidia,cardhu-a02", "nvidia,cardhu", "nvidia,tegra30";
10 10
11 sdhci@78000400 {
12 status = "okay";
13 power-gpios = <&gpio TEGRA_GPIO(D, 4) GPIO_ACTIVE_HIGH>;
14 bus-width = <4>;
15 keep-power-in-suspend;
16 };
17
11 regulators { 18 regulators {
12 compatible = "simple-bus"; 19 compatible = "simple-bus";
13 #address-cells = <1>; 20 #address-cells = <1>;
@@ -83,12 +90,5 @@
83 gpio = <&gpio TEGRA_GPIO(K, 3) GPIO_ACTIVE_HIGH>; 90 gpio = <&gpio TEGRA_GPIO(K, 3) GPIO_ACTIVE_HIGH>;
84 }; 91 };
85 }; 92 };
86
87 sdhci@78000400 {
88 status = "okay";
89 power-gpios = <&gpio TEGRA_GPIO(D, 4) GPIO_ACTIVE_HIGH>;
90 bus-width = <4>;
91 keep-power-in-suspend;
92 };
93}; 93};
94 94
diff --git a/arch/arm/boot/dts/tegra30-cardhu-a04.dts b/arch/arm/boot/dts/tegra30-cardhu-a04.dts
index bf012bddaafb..fadf55e46b2b 100644
--- a/arch/arm/boot/dts/tegra30-cardhu-a04.dts
+++ b/arch/arm/boot/dts/tegra30-cardhu-a04.dts
@@ -8,6 +8,13 @@
8 model = "NVIDIA Tegra30 Cardhu A04 (A05, A06, A07) evaluation board"; 8 model = "NVIDIA Tegra30 Cardhu A04 (A05, A06, A07) evaluation board";
9 compatible = "nvidia,cardhu-a04", "nvidia,cardhu", "nvidia,tegra30"; 9 compatible = "nvidia,cardhu-a04", "nvidia,cardhu", "nvidia,tegra30";
10 10
11 sdhci@78000400 {
12 status = "okay";
13 power-gpios = <&gpio TEGRA_GPIO(D, 3) GPIO_ACTIVE_HIGH>;
14 bus-width = <4>;
15 keep-power-in-suspend;
16 };
17
11 regulators { 18 regulators {
12 compatible = "simple-bus"; 19 compatible = "simple-bus";
13 #address-cells = <1>; 20 #address-cells = <1>;
@@ -95,11 +102,4 @@
95 gpio = <&gpio TEGRA_GPIO(DD, 0) GPIO_ACTIVE_HIGH>; 102 gpio = <&gpio TEGRA_GPIO(DD, 0) GPIO_ACTIVE_HIGH>;
96 }; 103 };
97 }; 104 };
98
99 sdhci@78000400 {
100 status = "okay";
101 power-gpios = <&gpio TEGRA_GPIO(D, 3) GPIO_ACTIVE_HIGH>;
102 bus-width = <4>;
103 keep-power-in-suspend;
104 };
105}; 105};
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index 5ea7dfa4d9fa..9104224124ee 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -27,11 +27,16 @@
27 model = "NVIDIA Tegra30 Cardhu evaluation board"; 27 model = "NVIDIA Tegra30 Cardhu evaluation board";
28 compatible = "nvidia,cardhu", "nvidia,tegra30"; 28 compatible = "nvidia,cardhu", "nvidia,tegra30";
29 29
30 aliases {
31 rtc0 = "/i2c@7000d000/tps6586x@34";
32 rtc1 = "/rtc@7000e000";
33 };
34
30 memory { 35 memory {
31 reg = <0x80000000 0x40000000>; 36 reg = <0x80000000 0x40000000>;
32 }; 37 };
33 38
34 pcie-controller { 39 pcie-controller@00003000 {
35 status = "okay"; 40 status = "okay";
36 pex-clk-supply = <&pex_hvdd_3v3_reg>; 41 pex-clk-supply = <&pex_hvdd_3v3_reg>;
37 vdd-supply = <&ldo1_reg>; 42 vdd-supply = <&ldo1_reg>;
@@ -51,7 +56,17 @@
51 }; 56 };
52 }; 57 };
53 58
54 pinmux { 59 host1x@50000000 {
60 dc@54200000 {
61 rgb {
62 status = "okay";
63
64 nvidia,panel = <&panel>;
65 };
66 };
67 };
68
69 pinmux@70000868 {
55 pinctrl-names = "default"; 70 pinctrl-names = "default";
56 pinctrl-0 = <&state_default>; 71 pinctrl-0 = <&state_default>;
57 72
@@ -59,8 +74,8 @@
59 sdmmc1_clk_pz0 { 74 sdmmc1_clk_pz0 {
60 nvidia,pins = "sdmmc1_clk_pz0"; 75 nvidia,pins = "sdmmc1_clk_pz0";
61 nvidia,function = "sdmmc1"; 76 nvidia,function = "sdmmc1";
62 nvidia,pull = <0>; 77 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
63 nvidia,tristate = <0>; 78 nvidia,tristate = <TEGRA_PIN_DISABLE>;
64 }; 79 };
65 sdmmc1_cmd_pz1 { 80 sdmmc1_cmd_pz1 {
66 nvidia,pins = "sdmmc1_cmd_pz1", 81 nvidia,pins = "sdmmc1_cmd_pz1",
@@ -69,14 +84,14 @@
69 "sdmmc1_dat2_py5", 84 "sdmmc1_dat2_py5",
70 "sdmmc1_dat3_py4"; 85 "sdmmc1_dat3_py4";
71 nvidia,function = "sdmmc1"; 86 nvidia,function = "sdmmc1";
72 nvidia,pull = <2>; 87 nvidia,pull = <TEGRA_PIN_PULL_UP>;
73 nvidia,tristate = <0>; 88 nvidia,tristate = <TEGRA_PIN_DISABLE>;
74 }; 89 };
75 sdmmc3_clk_pa6 { 90 sdmmc3_clk_pa6 {
76 nvidia,pins = "sdmmc3_clk_pa6"; 91 nvidia,pins = "sdmmc3_clk_pa6";
77 nvidia,function = "sdmmc3"; 92 nvidia,function = "sdmmc3";
78 nvidia,pull = <0>; 93 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
79 nvidia,tristate = <0>; 94 nvidia,tristate = <TEGRA_PIN_DISABLE>;
80 }; 95 };
81 sdmmc3_cmd_pa7 { 96 sdmmc3_cmd_pa7 {
82 nvidia,pins = "sdmmc3_cmd_pa7", 97 nvidia,pins = "sdmmc3_cmd_pa7",
@@ -85,15 +100,15 @@
85 "sdmmc3_dat2_pb5", 100 "sdmmc3_dat2_pb5",
86 "sdmmc3_dat3_pb4"; 101 "sdmmc3_dat3_pb4";
87 nvidia,function = "sdmmc3"; 102 nvidia,function = "sdmmc3";
88 nvidia,pull = <2>; 103 nvidia,pull = <TEGRA_PIN_PULL_UP>;
89 nvidia,tristate = <0>; 104 nvidia,tristate = <TEGRA_PIN_DISABLE>;
90 }; 105 };
91 sdmmc4_clk_pcc4 { 106 sdmmc4_clk_pcc4 {
92 nvidia,pins = "sdmmc4_clk_pcc4", 107 nvidia,pins = "sdmmc4_clk_pcc4",
93 "sdmmc4_rst_n_pcc3"; 108 "sdmmc4_rst_n_pcc3";
94 nvidia,function = "sdmmc4"; 109 nvidia,function = "sdmmc4";
95 nvidia,pull = <0>; 110 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
96 nvidia,tristate = <0>; 111 nvidia,tristate = <TEGRA_PIN_DISABLE>;
97 }; 112 };
98 sdmmc4_dat0_paa0 { 113 sdmmc4_dat0_paa0 {
99 nvidia,pins = "sdmmc4_dat0_paa0", 114 nvidia,pins = "sdmmc4_dat0_paa0",
@@ -105,8 +120,8 @@
105 "sdmmc4_dat6_paa6", 120 "sdmmc4_dat6_paa6",
106 "sdmmc4_dat7_paa7"; 121 "sdmmc4_dat7_paa7";
107 nvidia,function = "sdmmc4"; 122 nvidia,function = "sdmmc4";
108 nvidia,pull = <2>; 123 nvidia,pull = <TEGRA_PIN_PULL_UP>;
109 nvidia,tristate = <0>; 124 nvidia,tristate = <TEGRA_PIN_DISABLE>;
110 }; 125 };
111 dap2_fs_pa2 { 126 dap2_fs_pa2 {
112 nvidia,pins = "dap2_fs_pa2", 127 nvidia,pins = "dap2_fs_pa2",
@@ -114,17 +129,17 @@
114 "dap2_din_pa4", 129 "dap2_din_pa4",
115 "dap2_dout_pa5"; 130 "dap2_dout_pa5";
116 nvidia,function = "i2s1"; 131 nvidia,function = "i2s1";
117 nvidia,pull = <0>; 132 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
118 nvidia,tristate = <0>; 133 nvidia,tristate = <TEGRA_PIN_DISABLE>;
119 }; 134 };
120 sdio3 { 135 sdio3 {
121 nvidia,pins = "drive_sdio3"; 136 nvidia,pins = "drive_sdio3";
122 nvidia,high-speed-mode = <0>; 137 nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
123 nvidia,schmitt = <0>; 138 nvidia,schmitt = <TEGRA_PIN_DISABLE>;
124 nvidia,pull-down-strength = <46>; 139 nvidia,pull-down-strength = <46>;
125 nvidia,pull-up-strength = <42>; 140 nvidia,pull-up-strength = <42>;
126 nvidia,slew-rate-rising = <1>; 141 nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FAST>;
127 nvidia,slew-rate-falling = <1>; 142 nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FAST>;
128 }; 143 };
129 uart3_txd_pw6 { 144 uart3_txd_pw6 {
130 nvidia,pins = "uart3_txd_pw6", 145 nvidia,pins = "uart3_txd_pw6",
@@ -132,8 +147,8 @@
132 "uart3_rts_n_pc0", 147 "uart3_rts_n_pc0",
133 "uart3_rxd_pw7"; 148 "uart3_rxd_pw7";
134 nvidia,function = "uartc"; 149 nvidia,function = "uartc";
135 nvidia,pull = <0>; 150 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
136 nvidia,tristate = <0>; 151 nvidia,tristate = <TEGRA_PIN_DISABLE>;
137 }; 152 };
138 }; 153 };
139 }; 154 };
@@ -147,7 +162,11 @@
147 status = "okay"; 162 status = "okay";
148 }; 163 };
149 164
150 i2c@7000c000 { 165 pwm@7000a000 {
166 status = "okay";
167 };
168
169 panelddc: i2c@7000c000 {
151 status = "okay"; 170 status = "okay";
152 clock-frequency = <100000>; 171 clock-frequency = <100000>;
153 }; 172 };
@@ -302,7 +321,7 @@
302 interrupts = <TEGRA_GPIO(CC, 2) IRQ_TYPE_LEVEL_LOW>; 321 interrupts = <TEGRA_GPIO(CC, 2) IRQ_TYPE_LEVEL_LOW>;
303 }; 322 };
304 323
305 tps62361 { 324 tps62361@60 {
306 compatible = "ti,tps62361"; 325 compatible = "ti,tps62361";
307 reg = <0x60>; 326 reg = <0x60>;
308 327
@@ -326,13 +345,7 @@
326 }; 345 };
327 }; 346 };
328 347
329 ahub { 348 pmc@7000e400 {
330 i2s@70080400 {
331 status = "okay";
332 };
333 };
334
335 pmc {
336 status = "okay"; 349 status = "okay";
337 nvidia,invert-interrupt; 350 nvidia,invert-interrupt;
338 nvidia,suspend-mode = <1>; 351 nvidia,suspend-mode = <1>;
@@ -344,6 +357,12 @@
344 nvidia,sys-clock-req-active-high; 357 nvidia,sys-clock-req-active-high;
345 }; 358 };
346 359
360 ahub@70080000 {
361 i2s@70080400 {
362 status = "okay";
363 };
364 };
365
347 sdhci@78000000 { 366 sdhci@78000000 {
348 status = "okay"; 367 status = "okay";
349 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>; 368 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
@@ -367,12 +386,23 @@
367 status = "okay"; 386 status = "okay";
368 }; 387 };
369 388
389 backlight: backlight {
390 compatible = "pwm-backlight";
391
392 enable-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
393 power-supply = <&vdd_bl_reg>;
394 pwms = <&pwm 0 5000000>;
395
396 brightness-levels = <0 4 8 16 32 64 128 255>;
397 default-brightness-level = <6>;
398 };
399
370 clocks { 400 clocks {
371 compatible = "simple-bus"; 401 compatible = "simple-bus";
372 #address-cells = <1>; 402 #address-cells = <1>;
373 #size-cells = <0>; 403 #size-cells = <0>;
374 404
375 clk32k_in: clock { 405 clk32k_in: clock@0 {
376 compatible = "fixed-clock"; 406 compatible = "fixed-clock";
377 reg=<0>; 407 reg=<0>;
378 #clock-cells = <0>; 408 #clock-cells = <0>;
@@ -380,6 +410,16 @@
380 }; 410 };
381 }; 411 };
382 412
413 panel: panel {
414 compatible = "chunghwa,claa101wb01", "simple-panel";
415 ddc-i2c-bus = <&panelddc>;
416
417 power-supply = <&vdd_pnl1_reg>;
418 enable-gpios = <&gpio TEGRA_GPIO(L, 2) GPIO_ACTIVE_HIGH>;
419
420 backlight = <&backlight>;
421 };
422
383 regulators { 423 regulators {
384 compatible = "simple-bus"; 424 compatible = "simple-bus";
385 #address-cells = <1>; 425 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index 2bd55cfd88ad..ed8e7700b46d 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -1,5 +1,6 @@
1#include <dt-bindings/clock/tegra30-car.h> 1#include <dt-bindings/clock/tegra30-car.h>
2#include <dt-bindings/gpio/tegra-gpio.h> 2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/pinctrl/pinctrl-tegra.h>
3#include <dt-bindings/interrupt-controller/arm-gic.h> 4#include <dt-bindings/interrupt-controller/arm-gic.h>
4 5
5#include "skeleton.dtsi" 6#include "skeleton.dtsi"
@@ -16,7 +17,7 @@
16 serial4 = &uarte; 17 serial4 = &uarte;
17 }; 18 };
18 19
19 pcie-controller { 20 pcie-controller@00003000 {
20 compatible = "nvidia,tegra30-pcie"; 21 compatible = "nvidia,tegra30-pcie";
21 device_type = "pci"; 22 device_type = "pci";
22 reg = <0x00003000 0x00000800 /* PADS registers */ 23 reg = <0x00003000 0x00000800 /* PADS registers */
@@ -40,10 +41,13 @@
40 41
41 clocks = <&tegra_car TEGRA30_CLK_PCIE>, 42 clocks = <&tegra_car TEGRA30_CLK_PCIE>,
42 <&tegra_car TEGRA30_CLK_AFI>, 43 <&tegra_car TEGRA30_CLK_AFI>,
43 <&tegra_car TEGRA30_CLK_PCIEX>,
44 <&tegra_car TEGRA30_CLK_PLL_E>, 44 <&tegra_car TEGRA30_CLK_PLL_E>,
45 <&tegra_car TEGRA30_CLK_CML0>; 45 <&tegra_car TEGRA30_CLK_CML0>;
46 clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml"; 46 clock-names = "pex", "afi", "pll_e", "cml";
47 resets = <&tegra_car 70>,
48 <&tegra_car 72>,
49 <&tegra_car 74>;
50 reset-names = "pex", "afi", "pcie_x";
47 status = "disabled"; 51 status = "disabled";
48 52
49 pci@1,0 { 53 pci@1,0 {
@@ -86,59 +90,74 @@
86 }; 90 };
87 }; 91 };
88 92
89 host1x { 93 host1x@50000000 {
90 compatible = "nvidia,tegra30-host1x", "simple-bus"; 94 compatible = "nvidia,tegra30-host1x", "simple-bus";
91 reg = <0x50000000 0x00024000>; 95 reg = <0x50000000 0x00024000>;
92 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */ 96 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
93 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */ 97 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
94 clocks = <&tegra_car TEGRA30_CLK_HOST1X>; 98 clocks = <&tegra_car TEGRA30_CLK_HOST1X>;
99 resets = <&tegra_car 28>;
100 reset-names = "host1x";
95 101
96 #address-cells = <1>; 102 #address-cells = <1>;
97 #size-cells = <1>; 103 #size-cells = <1>;
98 104
99 ranges = <0x54000000 0x54000000 0x04000000>; 105 ranges = <0x54000000 0x54000000 0x04000000>;
100 106
101 mpe { 107 mpe@54040000 {
102 compatible = "nvidia,tegra30-mpe"; 108 compatible = "nvidia,tegra30-mpe";
103 reg = <0x54040000 0x00040000>; 109 reg = <0x54040000 0x00040000>;
104 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>; 110 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
105 clocks = <&tegra_car TEGRA30_CLK_MPE>; 111 clocks = <&tegra_car TEGRA30_CLK_MPE>;
112 resets = <&tegra_car 60>;
113 reset-names = "mpe";
106 }; 114 };
107 115
108 vi { 116 vi@54080000 {
109 compatible = "nvidia,tegra30-vi"; 117 compatible = "nvidia,tegra30-vi";
110 reg = <0x54080000 0x00040000>; 118 reg = <0x54080000 0x00040000>;
111 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; 119 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
112 clocks = <&tegra_car TEGRA30_CLK_VI>; 120 clocks = <&tegra_car TEGRA30_CLK_VI>;
121 resets = <&tegra_car 20>;
122 reset-names = "vi";
113 }; 123 };
114 124
115 epp { 125 epp@540c0000 {
116 compatible = "nvidia,tegra30-epp"; 126 compatible = "nvidia,tegra30-epp";
117 reg = <0x540c0000 0x00040000>; 127 reg = <0x540c0000 0x00040000>;
118 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; 128 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
119 clocks = <&tegra_car TEGRA30_CLK_EPP>; 129 clocks = <&tegra_car TEGRA30_CLK_EPP>;
130 resets = <&tegra_car 19>;
131 reset-names = "epp";
120 }; 132 };
121 133
122 isp { 134 isp@54100000 {
123 compatible = "nvidia,tegra30-isp"; 135 compatible = "nvidia,tegra30-isp";
124 reg = <0x54100000 0x00040000>; 136 reg = <0x54100000 0x00040000>;
125 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; 137 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
126 clocks = <&tegra_car TEGRA30_CLK_ISP>; 138 clocks = <&tegra_car TEGRA30_CLK_ISP>;
139 resets = <&tegra_car 23>;
140 reset-names = "isp";
127 }; 141 };
128 142
129 gr2d { 143 gr2d@54140000 {
130 compatible = "nvidia,tegra30-gr2d"; 144 compatible = "nvidia,tegra30-gr2d";
131 reg = <0x54140000 0x00040000>; 145 reg = <0x54140000 0x00040000>;
132 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; 146 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
147 resets = <&tegra_car 21>;
148 reset-names = "2d";
133 clocks = <&tegra_car TEGRA30_CLK_GR2D>; 149 clocks = <&tegra_car TEGRA30_CLK_GR2D>;
134 }; 150 };
135 151
136 gr3d { 152 gr3d@54180000 {
137 compatible = "nvidia,tegra30-gr3d"; 153 compatible = "nvidia,tegra30-gr3d";
138 reg = <0x54180000 0x00040000>; 154 reg = <0x54180000 0x00040000>;
139 clocks = <&tegra_car TEGRA30_CLK_GR3D 155 clocks = <&tegra_car TEGRA30_CLK_GR3D
140 &tegra_car TEGRA30_CLK_GR3D2>; 156 &tegra_car TEGRA30_CLK_GR3D2>;
141 clock-names = "3d", "3d2"; 157 clock-names = "3d", "3d2";
158 resets = <&tegra_car 24>,
159 <&tegra_car 98>;
160 reset-names = "3d", "3d2";
142 }; 161 };
143 162
144 dc@54200000 { 163 dc@54200000 {
@@ -147,7 +166,9 @@
147 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; 166 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
148 clocks = <&tegra_car TEGRA30_CLK_DISP1>, 167 clocks = <&tegra_car TEGRA30_CLK_DISP1>,
149 <&tegra_car TEGRA30_CLK_PLL_P>; 168 <&tegra_car TEGRA30_CLK_PLL_P>;
150 clock-names = "disp1", "parent"; 169 clock-names = "dc", "parent";
170 resets = <&tegra_car 27>;
171 reset-names = "dc";
151 172
152 rgb { 173 rgb {
153 status = "disabled"; 174 status = "disabled";
@@ -160,24 +181,28 @@
160 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>; 181 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
161 clocks = <&tegra_car TEGRA30_CLK_DISP2>, 182 clocks = <&tegra_car TEGRA30_CLK_DISP2>,
162 <&tegra_car TEGRA30_CLK_PLL_P>; 183 <&tegra_car TEGRA30_CLK_PLL_P>;
163 clock-names = "disp2", "parent"; 184 clock-names = "dc", "parent";
185 resets = <&tegra_car 26>;
186 reset-names = "dc";
164 187
165 rgb { 188 rgb {
166 status = "disabled"; 189 status = "disabled";
167 }; 190 };
168 }; 191 };
169 192
170 hdmi { 193 hdmi@54280000 {
171 compatible = "nvidia,tegra30-hdmi"; 194 compatible = "nvidia,tegra30-hdmi";
172 reg = <0x54280000 0x00040000>; 195 reg = <0x54280000 0x00040000>;
173 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>; 196 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
174 clocks = <&tegra_car TEGRA30_CLK_HDMI>, 197 clocks = <&tegra_car TEGRA30_CLK_HDMI>,
175 <&tegra_car TEGRA30_CLK_PLL_D2_OUT0>; 198 <&tegra_car TEGRA30_CLK_PLL_D2_OUT0>;
176 clock-names = "hdmi", "parent"; 199 clock-names = "hdmi", "parent";
200 resets = <&tegra_car 51>;
201 reset-names = "hdmi";
177 status = "disabled"; 202 status = "disabled";
178 }; 203 };
179 204
180 tvo { 205 tvo@542c0000 {
181 compatible = "nvidia,tegra30-tvo"; 206 compatible = "nvidia,tegra30-tvo";
182 reg = <0x542c0000 0x00040000>; 207 reg = <0x542c0000 0x00040000>;
183 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>; 208 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
@@ -185,10 +210,12 @@
185 status = "disabled"; 210 status = "disabled";
186 }; 211 };
187 212
188 dsi { 213 dsi@54300000 {
189 compatible = "nvidia,tegra30-dsi"; 214 compatible = "nvidia,tegra30-dsi";
190 reg = <0x54300000 0x00040000>; 215 reg = <0x54300000 0x00040000>;
191 clocks = <&tegra_car TEGRA30_CLK_DSIA>; 216 clocks = <&tegra_car TEGRA30_CLK_DSIA>;
217 resets = <&tegra_car 48>;
218 reset-names = "dsi";
192 status = "disabled"; 219 status = "disabled";
193 }; 220 };
194 }; 221 };
@@ -201,7 +228,7 @@
201 clocks = <&tegra_car TEGRA30_CLK_TWD>; 228 clocks = <&tegra_car TEGRA30_CLK_TWD>;
202 }; 229 };
203 230
204 intc: interrupt-controller { 231 intc: interrupt-controller@50041000 {
205 compatible = "arm,cortex-a9-gic"; 232 compatible = "arm,cortex-a9-gic";
206 reg = <0x50041000 0x1000 233 reg = <0x50041000 0x1000
207 0x50040100 0x0100>; 234 0x50040100 0x0100>;
@@ -209,7 +236,7 @@
209 #interrupt-cells = <3>; 236 #interrupt-cells = <3>;
210 }; 237 };
211 238
212 cache-controller { 239 cache-controller@50043000 {
213 compatible = "arm,pl310-cache"; 240 compatible = "arm,pl310-cache";
214 reg = <0x50043000 0x1000>; 241 reg = <0x50043000 0x1000>;
215 arm,data-latency = <6 6 2>; 242 arm,data-latency = <6 6 2>;
@@ -230,13 +257,14 @@
230 clocks = <&tegra_car TEGRA30_CLK_TIMER>; 257 clocks = <&tegra_car TEGRA30_CLK_TIMER>;
231 }; 258 };
232 259
233 tegra_car: clock { 260 tegra_car: clock@60006000 {
234 compatible = "nvidia,tegra30-car"; 261 compatible = "nvidia,tegra30-car";
235 reg = <0x60006000 0x1000>; 262 reg = <0x60006000 0x1000>;
236 #clock-cells = <1>; 263 #clock-cells = <1>;
264 #reset-cells = <1>;
237 }; 265 };
238 266
239 apbdma: dma { 267 apbdma: dma@6000a000 {
240 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma"; 268 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma";
241 reg = <0x6000a000 0x1400>; 269 reg = <0x6000a000 0x1400>;
242 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, 270 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
@@ -272,14 +300,17 @@
272 <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, 300 <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
273 <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; 301 <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
274 clocks = <&tegra_car TEGRA30_CLK_APBDMA>; 302 clocks = <&tegra_car TEGRA30_CLK_APBDMA>;
303 resets = <&tegra_car 34>;
304 reset-names = "dma";
305 #dma-cells = <1>;
275 }; 306 };
276 307
277 ahb: ahb { 308 ahb: ahb@6000c004 {
278 compatible = "nvidia,tegra30-ahb"; 309 compatible = "nvidia,tegra30-ahb";
279 reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */ 310 reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */
280 }; 311 };
281 312
282 gpio: gpio { 313 gpio: gpio@6000d000 {
283 compatible = "nvidia,tegra30-gpio"; 314 compatible = "nvidia,tegra30-gpio";
284 reg = <0x6000d000 0x1000>; 315 reg = <0x6000d000 0x1000>;
285 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, 316 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
@@ -296,7 +327,7 @@
296 interrupt-controller; 327 interrupt-controller;
297 }; 328 };
298 329
299 pinmux: pinmux { 330 pinmux: pinmux@70000868 {
300 compatible = "nvidia,tegra30-pinmux"; 331 compatible = "nvidia,tegra30-pinmux";
301 reg = <0x70000868 0xd4 /* Pad control registers */ 332 reg = <0x70000868 0xd4 /* Pad control registers */
302 0x70003000 0x3e4>; /* Mux registers */ 333 0x70003000 0x3e4>; /* Mux registers */
@@ -315,8 +346,11 @@
315 reg = <0x70006000 0x40>; 346 reg = <0x70006000 0x40>;
316 reg-shift = <2>; 347 reg-shift = <2>;
317 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; 348 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
318 nvidia,dma-request-selector = <&apbdma 8>;
319 clocks = <&tegra_car TEGRA30_CLK_UARTA>; 349 clocks = <&tegra_car TEGRA30_CLK_UARTA>;
350 resets = <&tegra_car 6>;
351 reset-names = "serial";
352 dmas = <&apbdma 8>, <&apbdma 8>;
353 dma-names = "rx", "tx";
320 status = "disabled"; 354 status = "disabled";
321 }; 355 };
322 356
@@ -325,8 +359,11 @@
325 reg = <0x70006040 0x40>; 359 reg = <0x70006040 0x40>;
326 reg-shift = <2>; 360 reg-shift = <2>;
327 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; 361 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
328 nvidia,dma-request-selector = <&apbdma 9>;
329 clocks = <&tegra_car TEGRA30_CLK_UARTB>; 362 clocks = <&tegra_car TEGRA30_CLK_UARTB>;
363 resets = <&tegra_car 7>;
364 reset-names = "serial";
365 dmas = <&apbdma 9>, <&apbdma 9>;
366 dma-names = "rx", "tx";
330 status = "disabled"; 367 status = "disabled";
331 }; 368 };
332 369
@@ -335,8 +372,11 @@
335 reg = <0x70006200 0x100>; 372 reg = <0x70006200 0x100>;
336 reg-shift = <2>; 373 reg-shift = <2>;
337 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; 374 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
338 nvidia,dma-request-selector = <&apbdma 10>;
339 clocks = <&tegra_car TEGRA30_CLK_UARTC>; 375 clocks = <&tegra_car TEGRA30_CLK_UARTC>;
376 resets = <&tegra_car 55>;
377 reset-names = "serial";
378 dmas = <&apbdma 10>, <&apbdma 10>;
379 dma-names = "rx", "tx";
340 status = "disabled"; 380 status = "disabled";
341 }; 381 };
342 382
@@ -345,8 +385,11 @@
345 reg = <0x70006300 0x100>; 385 reg = <0x70006300 0x100>;
346 reg-shift = <2>; 386 reg-shift = <2>;
347 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; 387 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
348 nvidia,dma-request-selector = <&apbdma 19>;
349 clocks = <&tegra_car TEGRA30_CLK_UARTD>; 388 clocks = <&tegra_car TEGRA30_CLK_UARTD>;
389 resets = <&tegra_car 65>;
390 reset-names = "serial";
391 dmas = <&apbdma 19>, <&apbdma 19>;
392 dma-names = "rx", "tx";
350 status = "disabled"; 393 status = "disabled";
351 }; 394 };
352 395
@@ -355,20 +398,25 @@
355 reg = <0x70006400 0x100>; 398 reg = <0x70006400 0x100>;
356 reg-shift = <2>; 399 reg-shift = <2>;
357 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; 400 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
358 nvidia,dma-request-selector = <&apbdma 20>;
359 clocks = <&tegra_car TEGRA30_CLK_UARTE>; 401 clocks = <&tegra_car TEGRA30_CLK_UARTE>;
402 resets = <&tegra_car 66>;
403 reset-names = "serial";
404 dmas = <&apbdma 20>, <&apbdma 20>;
405 dma-names = "rx", "tx";
360 status = "disabled"; 406 status = "disabled";
361 }; 407 };
362 408
363 pwm: pwm { 409 pwm: pwm@7000a000 {
364 compatible = "nvidia,tegra30-pwm", "nvidia,tegra20-pwm"; 410 compatible = "nvidia,tegra30-pwm", "nvidia,tegra20-pwm";
365 reg = <0x7000a000 0x100>; 411 reg = <0x7000a000 0x100>;
366 #pwm-cells = <2>; 412 #pwm-cells = <2>;
367 clocks = <&tegra_car TEGRA30_CLK_PWM>; 413 clocks = <&tegra_car TEGRA30_CLK_PWM>;
414 resets = <&tegra_car 17>;
415 reset-names = "pwm";
368 status = "disabled"; 416 status = "disabled";
369 }; 417 };
370 418
371 rtc { 419 rtc@7000e000 {
372 compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc"; 420 compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc";
373 reg = <0x7000e000 0x100>; 421 reg = <0x7000e000 0x100>;
374 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; 422 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
@@ -384,6 +432,10 @@
384 clocks = <&tegra_car TEGRA30_CLK_I2C1>, 432 clocks = <&tegra_car TEGRA30_CLK_I2C1>,
385 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; 433 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
386 clock-names = "div-clk", "fast-clk"; 434 clock-names = "div-clk", "fast-clk";
435 resets = <&tegra_car 12>;
436 reset-names = "i2c";
437 dmas = <&apbdma 21>, <&apbdma 21>;
438 dma-names = "rx", "tx";
387 status = "disabled"; 439 status = "disabled";
388 }; 440 };
389 441
@@ -396,6 +448,10 @@
396 clocks = <&tegra_car TEGRA30_CLK_I2C2>, 448 clocks = <&tegra_car TEGRA30_CLK_I2C2>,
397 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; 449 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
398 clock-names = "div-clk", "fast-clk"; 450 clock-names = "div-clk", "fast-clk";
451 resets = <&tegra_car 54>;
452 reset-names = "i2c";
453 dmas = <&apbdma 22>, <&apbdma 22>;
454 dma-names = "rx", "tx";
399 status = "disabled"; 455 status = "disabled";
400 }; 456 };
401 457
@@ -408,6 +464,10 @@
408 clocks = <&tegra_car TEGRA30_CLK_I2C3>, 464 clocks = <&tegra_car TEGRA30_CLK_I2C3>,
409 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; 465 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
410 clock-names = "div-clk", "fast-clk"; 466 clock-names = "div-clk", "fast-clk";
467 resets = <&tegra_car 67>;
468 reset-names = "i2c";
469 dmas = <&apbdma 23>, <&apbdma 23>;
470 dma-names = "rx", "tx";
411 status = "disabled"; 471 status = "disabled";
412 }; 472 };
413 473
@@ -419,7 +479,11 @@
419 #size-cells = <0>; 479 #size-cells = <0>;
420 clocks = <&tegra_car TEGRA30_CLK_I2C4>, 480 clocks = <&tegra_car TEGRA30_CLK_I2C4>,
421 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; 481 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
482 resets = <&tegra_car 103>;
483 reset-names = "i2c";
422 clock-names = "div-clk", "fast-clk"; 484 clock-names = "div-clk", "fast-clk";
485 dmas = <&apbdma 26>, <&apbdma 26>;
486 dma-names = "rx", "tx";
423 status = "disabled"; 487 status = "disabled";
424 }; 488 };
425 489
@@ -432,6 +496,10 @@
432 clocks = <&tegra_car TEGRA30_CLK_I2C5>, 496 clocks = <&tegra_car TEGRA30_CLK_I2C5>,
433 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>; 497 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
434 clock-names = "div-clk", "fast-clk"; 498 clock-names = "div-clk", "fast-clk";
499 resets = <&tegra_car 47>;
500 reset-names = "i2c";
501 dmas = <&apbdma 24>, <&apbdma 24>;
502 dma-names = "rx", "tx";
435 status = "disabled"; 503 status = "disabled";
436 }; 504 };
437 505
@@ -439,10 +507,13 @@
439 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 507 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
440 reg = <0x7000d400 0x200>; 508 reg = <0x7000d400 0x200>;
441 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>; 509 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
442 nvidia,dma-request-selector = <&apbdma 15>;
443 #address-cells = <1>; 510 #address-cells = <1>;
444 #size-cells = <0>; 511 #size-cells = <0>;
445 clocks = <&tegra_car TEGRA30_CLK_SBC1>; 512 clocks = <&tegra_car TEGRA30_CLK_SBC1>;
513 resets = <&tegra_car 41>;
514 reset-names = "spi";
515 dmas = <&apbdma 15>, <&apbdma 15>;
516 dma-names = "rx", "tx";
446 status = "disabled"; 517 status = "disabled";
447 }; 518 };
448 519
@@ -450,10 +521,13 @@
450 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 521 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
451 reg = <0x7000d600 0x200>; 522 reg = <0x7000d600 0x200>;
452 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; 523 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
453 nvidia,dma-request-selector = <&apbdma 16>;
454 #address-cells = <1>; 524 #address-cells = <1>;
455 #size-cells = <0>; 525 #size-cells = <0>;
456 clocks = <&tegra_car TEGRA30_CLK_SBC2>; 526 clocks = <&tegra_car TEGRA30_CLK_SBC2>;
527 resets = <&tegra_car 44>;
528 reset-names = "spi";
529 dmas = <&apbdma 16>, <&apbdma 16>;
530 dma-names = "rx", "tx";
457 status = "disabled"; 531 status = "disabled";
458 }; 532 };
459 533
@@ -461,10 +535,13 @@
461 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 535 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
462 reg = <0x7000d800 0x200>; 536 reg = <0x7000d800 0x200>;
463 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; 537 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
464 nvidia,dma-request-selector = <&apbdma 17>;
465 #address-cells = <1>; 538 #address-cells = <1>;
466 #size-cells = <0>; 539 #size-cells = <0>;
467 clocks = <&tegra_car TEGRA30_CLK_SBC3>; 540 clocks = <&tegra_car TEGRA30_CLK_SBC3>;
541 resets = <&tegra_car 46>;
542 reset-names = "spi";
543 dmas = <&apbdma 17>, <&apbdma 17>;
544 dma-names = "rx", "tx";
468 status = "disabled"; 545 status = "disabled";
469 }; 546 };
470 547
@@ -472,10 +549,13 @@
472 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 549 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
473 reg = <0x7000da00 0x200>; 550 reg = <0x7000da00 0x200>;
474 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>; 551 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
475 nvidia,dma-request-selector = <&apbdma 18>;
476 #address-cells = <1>; 552 #address-cells = <1>;
477 #size-cells = <0>; 553 #size-cells = <0>;
478 clocks = <&tegra_car TEGRA30_CLK_SBC4>; 554 clocks = <&tegra_car TEGRA30_CLK_SBC4>;
555 resets = <&tegra_car 68>;
556 reset-names = "spi";
557 dmas = <&apbdma 18>, <&apbdma 18>;
558 dma-names = "rx", "tx";
479 status = "disabled"; 559 status = "disabled";
480 }; 560 };
481 561
@@ -483,10 +563,13 @@
483 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 563 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
484 reg = <0x7000dc00 0x200>; 564 reg = <0x7000dc00 0x200>;
485 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; 565 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
486 nvidia,dma-request-selector = <&apbdma 27>;
487 #address-cells = <1>; 566 #address-cells = <1>;
488 #size-cells = <0>; 567 #size-cells = <0>;
489 clocks = <&tegra_car TEGRA30_CLK_SBC5>; 568 clocks = <&tegra_car TEGRA30_CLK_SBC5>;
569 resets = <&tegra_car 104>;
570 reset-names = "spi";
571 dmas = <&apbdma 27>, <&apbdma 27>;
572 dma-names = "rx", "tx";
490 status = "disabled"; 573 status = "disabled";
491 }; 574 };
492 575
@@ -494,29 +577,34 @@
494 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 577 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
495 reg = <0x7000de00 0x200>; 578 reg = <0x7000de00 0x200>;
496 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>; 579 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
497 nvidia,dma-request-selector = <&apbdma 28>;
498 #address-cells = <1>; 580 #address-cells = <1>;
499 #size-cells = <0>; 581 #size-cells = <0>;
500 clocks = <&tegra_car TEGRA30_CLK_SBC6>; 582 clocks = <&tegra_car TEGRA30_CLK_SBC6>;
583 resets = <&tegra_car 106>;
584 reset-names = "spi";
585 dmas = <&apbdma 28>, <&apbdma 28>;
586 dma-names = "rx", "tx";
501 status = "disabled"; 587 status = "disabled";
502 }; 588 };
503 589
504 kbc { 590 kbc@7000e200 {
505 compatible = "nvidia,tegra30-kbc", "nvidia,tegra20-kbc"; 591 compatible = "nvidia,tegra30-kbc", "nvidia,tegra20-kbc";
506 reg = <0x7000e200 0x100>; 592 reg = <0x7000e200 0x100>;
507 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; 593 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
508 clocks = <&tegra_car TEGRA30_CLK_KBC>; 594 clocks = <&tegra_car TEGRA30_CLK_KBC>;
595 resets = <&tegra_car 36>;
596 reset-names = "kbc";
509 status = "disabled"; 597 status = "disabled";
510 }; 598 };
511 599
512 pmc { 600 pmc@7000e400 {
513 compatible = "nvidia,tegra30-pmc"; 601 compatible = "nvidia,tegra30-pmc";
514 reg = <0x7000e400 0x400>; 602 reg = <0x7000e400 0x400>;
515 clocks = <&tegra_car TEGRA30_CLK_PCLK>, <&clk32k_in>; 603 clocks = <&tegra_car TEGRA30_CLK_PCLK>, <&clk32k_in>;
516 clock-names = "pclk", "clk32k_in"; 604 clock-names = "pclk", "clk32k_in";
517 }; 605 };
518 606
519 memory-controller { 607 memory-controller@7000f000 {
520 compatible = "nvidia,tegra30-mc"; 608 compatible = "nvidia,tegra30-mc";
521 reg = <0x7000f000 0x010 609 reg = <0x7000f000 0x010
522 0x7000f03c 0x1b4 610 0x7000f03c 0x1b4
@@ -525,7 +613,7 @@
525 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; 613 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
526 }; 614 };
527 615
528 iommu { 616 iommu@7000f010 {
529 compatible = "nvidia,tegra30-smmu"; 617 compatible = "nvidia,tegra30-smmu";
530 reg = <0x7000f010 0x02c 618 reg = <0x7000f010 0x02c
531 0x7000f1f0 0x010 619 0x7000f1f0 0x010
@@ -535,26 +623,34 @@
535 nvidia,ahb = <&ahb>; 623 nvidia,ahb = <&ahb>;
536 }; 624 };
537 625
538 ahub { 626 ahub@70080000 {
539 compatible = "nvidia,tegra30-ahub"; 627 compatible = "nvidia,tegra30-ahub";
540 reg = <0x70080000 0x200 628 reg = <0x70080000 0x200
541 0x70080200 0x100>; 629 0x70080200 0x100>;
542 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; 630 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
543 nvidia,dma-request-selector = <&apbdma 1>;
544 clocks = <&tegra_car TEGRA30_CLK_D_AUDIO>, 631 clocks = <&tegra_car TEGRA30_CLK_D_AUDIO>,
545 <&tegra_car TEGRA30_CLK_APBIF>, 632 <&tegra_car TEGRA30_CLK_APBIF>;
546 <&tegra_car TEGRA30_CLK_I2S0>, 633 clock-names = "d_audio", "apbif";
547 <&tegra_car TEGRA30_CLK_I2S1>, 634 resets = <&tegra_car 106>, /* d_audio */
548 <&tegra_car TEGRA30_CLK_I2S2>, 635 <&tegra_car 107>, /* apbif */
549 <&tegra_car TEGRA30_CLK_I2S3>, 636 <&tegra_car 30>, /* i2s0 */
550 <&tegra_car TEGRA30_CLK_I2S4>, 637 <&tegra_car 11>, /* i2s1 */
551 <&tegra_car TEGRA30_CLK_DAM0>, 638 <&tegra_car 18>, /* i2s2 */
552 <&tegra_car TEGRA30_CLK_DAM1>, 639 <&tegra_car 101>, /* i2s3 */
553 <&tegra_car TEGRA30_CLK_DAM2>, 640 <&tegra_car 102>, /* i2s4 */
554 <&tegra_car TEGRA30_CLK_SPDIF_IN>; 641 <&tegra_car 108>, /* dam0 */
555 clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", 642 <&tegra_car 109>, /* dam1 */
643 <&tegra_car 110>, /* dam2 */
644 <&tegra_car 10>; /* spdif */
645 reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
556 "i2s3", "i2s4", "dam0", "dam1", "dam2", 646 "i2s3", "i2s4", "dam0", "dam1", "dam2",
557 "spdif_in"; 647 "spdif";
648 dmas = <&apbdma 1>, <&apbdma 1>,
649 <&apbdma 2>, <&apbdma 2>,
650 <&apbdma 3>, <&apbdma 3>,
651 <&apbdma 4>, <&apbdma 4>;
652 dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2",
653 "rx3", "tx3";
558 ranges; 654 ranges;
559 #address-cells = <1>; 655 #address-cells = <1>;
560 #size-cells = <1>; 656 #size-cells = <1>;
@@ -564,6 +660,8 @@
564 reg = <0x70080300 0x100>; 660 reg = <0x70080300 0x100>;
565 nvidia,ahub-cif-ids = <4 4>; 661 nvidia,ahub-cif-ids = <4 4>;
566 clocks = <&tegra_car TEGRA30_CLK_I2S0>; 662 clocks = <&tegra_car TEGRA30_CLK_I2S0>;
663 resets = <&tegra_car 30>;
664 reset-names = "i2s";
567 status = "disabled"; 665 status = "disabled";
568 }; 666 };
569 667
@@ -572,6 +670,8 @@
572 reg = <0x70080400 0x100>; 670 reg = <0x70080400 0x100>;
573 nvidia,ahub-cif-ids = <5 5>; 671 nvidia,ahub-cif-ids = <5 5>;
574 clocks = <&tegra_car TEGRA30_CLK_I2S1>; 672 clocks = <&tegra_car TEGRA30_CLK_I2S1>;
673 resets = <&tegra_car 11>;
674 reset-names = "i2s";
575 status = "disabled"; 675 status = "disabled";
576 }; 676 };
577 677
@@ -580,6 +680,8 @@
580 reg = <0x70080500 0x100>; 680 reg = <0x70080500 0x100>;
581 nvidia,ahub-cif-ids = <6 6>; 681 nvidia,ahub-cif-ids = <6 6>;
582 clocks = <&tegra_car TEGRA30_CLK_I2S2>; 682 clocks = <&tegra_car TEGRA30_CLK_I2S2>;
683 resets = <&tegra_car 18>;
684 reset-names = "i2s";
583 status = "disabled"; 685 status = "disabled";
584 }; 686 };
585 687
@@ -588,6 +690,8 @@
588 reg = <0x70080600 0x100>; 690 reg = <0x70080600 0x100>;
589 nvidia,ahub-cif-ids = <7 7>; 691 nvidia,ahub-cif-ids = <7 7>;
590 clocks = <&tegra_car TEGRA30_CLK_I2S3>; 692 clocks = <&tegra_car TEGRA30_CLK_I2S3>;
693 resets = <&tegra_car 101>;
694 reset-names = "i2s";
591 status = "disabled"; 695 status = "disabled";
592 }; 696 };
593 697
@@ -596,6 +700,8 @@
596 reg = <0x70080700 0x100>; 700 reg = <0x70080700 0x100>;
597 nvidia,ahub-cif-ids = <8 8>; 701 nvidia,ahub-cif-ids = <8 8>;
598 clocks = <&tegra_car TEGRA30_CLK_I2S4>; 702 clocks = <&tegra_car TEGRA30_CLK_I2S4>;
703 resets = <&tegra_car 102>;
704 reset-names = "i2s";
599 status = "disabled"; 705 status = "disabled";
600 }; 706 };
601 }; 707 };
@@ -605,6 +711,8 @@
605 reg = <0x78000000 0x200>; 711 reg = <0x78000000 0x200>;
606 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 712 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
607 clocks = <&tegra_car TEGRA30_CLK_SDMMC1>; 713 clocks = <&tegra_car TEGRA30_CLK_SDMMC1>;
714 resets = <&tegra_car 14>;
715 reset-names = "sdhci";
608 status = "disabled"; 716 status = "disabled";
609 }; 717 };
610 718
@@ -613,6 +721,8 @@
613 reg = <0x78000200 0x200>; 721 reg = <0x78000200 0x200>;
614 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; 722 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
615 clocks = <&tegra_car TEGRA30_CLK_SDMMC2>; 723 clocks = <&tegra_car TEGRA30_CLK_SDMMC2>;
724 resets = <&tegra_car 9>;
725 reset-names = "sdhci";
616 status = "disabled"; 726 status = "disabled";
617 }; 727 };
618 728
@@ -621,6 +731,8 @@
621 reg = <0x78000400 0x200>; 731 reg = <0x78000400 0x200>;
622 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; 732 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
623 clocks = <&tegra_car TEGRA30_CLK_SDMMC3>; 733 clocks = <&tegra_car TEGRA30_CLK_SDMMC3>;
734 resets = <&tegra_car 69>;
735 reset-names = "sdhci";
624 status = "disabled"; 736 status = "disabled";
625 }; 737 };
626 738
@@ -629,6 +741,8 @@
629 reg = <0x78000600 0x200>; 741 reg = <0x78000600 0x200>;
630 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; 742 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
631 clocks = <&tegra_car TEGRA30_CLK_SDMMC4>; 743 clocks = <&tegra_car TEGRA30_CLK_SDMMC4>;
744 resets = <&tegra_car 15>;
745 reset-names = "sdhci";
632 status = "disabled"; 746 status = "disabled";
633 }; 747 };
634 748
@@ -638,6 +752,8 @@
638 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; 752 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
639 phy_type = "utmi"; 753 phy_type = "utmi";
640 clocks = <&tegra_car TEGRA30_CLK_USBD>; 754 clocks = <&tegra_car TEGRA30_CLK_USBD>;
755 resets = <&tegra_car 22>;
756 reset-names = "usb";
641 nvidia,needs-double-reset; 757 nvidia,needs-double-reset;
642 nvidia,phy = <&phy1>; 758 nvidia,phy = <&phy1>;
643 status = "disabled"; 759 status = "disabled";
@@ -669,20 +785,33 @@
669 compatible = "nvidia,tegra30-ehci", "usb-ehci"; 785 compatible = "nvidia,tegra30-ehci", "usb-ehci";
670 reg = <0x7d004000 0x4000>; 786 reg = <0x7d004000 0x4000>;
671 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; 787 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
672 phy_type = "ulpi"; 788 phy_type = "utmi";
673 clocks = <&tegra_car TEGRA30_CLK_USB2>; 789 clocks = <&tegra_car TEGRA30_CLK_USB2>;
790 resets = <&tegra_car 58>;
791 reset-names = "usb";
674 nvidia,phy = <&phy2>; 792 nvidia,phy = <&phy2>;
675 status = "disabled"; 793 status = "disabled";
676 }; 794 };
677 795
678 phy2: usb-phy@7d004000 { 796 phy2: usb-phy@7d004000 {
679 compatible = "nvidia,tegra30-usb-phy"; 797 compatible = "nvidia,tegra30-usb-phy";
680 reg = <0x7d004000 0x4000>; 798 reg = <0x7d004000 0x4000 0x7d000000 0x4000>;
681 phy_type = "ulpi"; 799 phy_type = "utmi";
682 clocks = <&tegra_car TEGRA30_CLK_USB2>, 800 clocks = <&tegra_car TEGRA30_CLK_USB2>,
683 <&tegra_car TEGRA30_CLK_PLL_U>, 801 <&tegra_car TEGRA30_CLK_PLL_U>,
684 <&tegra_car TEGRA30_CLK_CDEV2>; 802 <&tegra_car TEGRA30_CLK_USBD>;
685 clock-names = "reg", "pll_u", "ulpi-link"; 803 clock-names = "reg", "pll_u", "utmi-pads";
804 nvidia,hssync-start-delay = <9>;
805 nvidia,idle-wait-delay = <17>;
806 nvidia,elastic-limit = <16>;
807 nvidia,term-range-adj = <6>;
808 nvidia,xcvr-setup = <51>;
809 nvidia.xcvr-setup-use-fuses;
810 nvidia,xcvr-lsfslew = <2>;
811 nvidia,xcvr-lsrslew = <2>;
812 nvidia,xcvr-hsslew = <32>;
813 nvidia,hssquelch-level = <2>;
814 nvidia,hsdiscon-level = <5>;
686 status = "disabled"; 815 status = "disabled";
687 }; 816 };
688 817
@@ -692,6 +821,8 @@
692 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; 821 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
693 phy_type = "utmi"; 822 phy_type = "utmi";
694 clocks = <&tegra_car TEGRA30_CLK_USB3>; 823 clocks = <&tegra_car TEGRA30_CLK_USB3>;
824 resets = <&tegra_car 59>;
825 reset-names = "usb";
695 nvidia,phy = <&phy3>; 826 nvidia,phy = <&phy3>;
696 status = "disabled"; 827 status = "disabled";
697 }; 828 };
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index e7f73b2e4550..8b67b19392ec 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -15,6 +15,25 @@
15/ { 15/ {
16 compatible = "xlnx,zynq-7000"; 16 compatible = "xlnx,zynq-7000";
17 17
18 cpus {
19 #address-cells = <1>;
20 #size-cells = <0>;
21
22 cpu@0 {
23 compatible = "arm,cortex-a9";
24 device_type = "cpu";
25 reg = <0>;
26 clocks = <&clkc 3>;
27 };
28
29 cpu@1 {
30 compatible = "arm,cortex-a9";
31 device_type = "cpu";
32 reg = <1>;
33 clocks = <&clkc 3>;
34 };
35 };
36
18 pmu { 37 pmu {
19 compatible = "arm,cortex-a9-pmu"; 38 compatible = "arm,cortex-a9-pmu";
20 interrupts = <0 5 4>, <0 6 4>; 39 interrupts = <0 5 4>, <0 6 4>;
@@ -65,6 +84,44 @@
65 interrupts = <0 50 4>; 84 interrupts = <0 50 4>;
66 }; 85 };
67 86
87 gem0: ethernet@e000b000 {
88 compatible = "cdns,gem";
89 reg = <0xe000b000 0x4000>;
90 status = "disabled";
91 interrupts = <0 22 4>;
92 clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
93 clock-names = "pclk", "hclk", "tx_clk";
94 };
95
96 gem1: ethernet@e000c000 {
97 compatible = "cdns,gem";
98 reg = <0xe000c000 0x4000>;
99 status = "disabled";
100 interrupts = <0 45 4>;
101 clocks = <&clkc 31>, <&clkc 31>, <&clkc 14>;
102 clock-names = "pclk", "hclk", "tx_clk";
103 };
104
105 sdhci0: ps7-sdhci@e0100000 {
106 compatible = "arasan,sdhci-8.9a";
107 status = "disabled";
108 clock-names = "clk_xin", "clk_ahb";
109 clocks = <&clkc 21>, <&clkc 32>;
110 interrupt-parent = <&intc>;
111 interrupts = <0 24 4>;
112 reg = <0xe0100000 0x1000>;
113 } ;
114
115 sdhci1: ps7-sdhci@e0101000 {
116 compatible = "arasan,sdhci-8.9a";
117 status = "disabled";
118 clock-names = "clk_xin", "clk_ahb";
119 clocks = <&clkc 22>, <&clkc 33>;
120 interrupt-parent = <&intc>;
121 interrupts = <0 47 4>;
122 reg = <0xe0101000 0x1000>;
123 } ;
124
68 slcr: slcr@f8000000 { 125 slcr: slcr@f8000000 {
69 compatible = "xlnx,zynq-slcr"; 126 compatible = "xlnx,zynq-slcr";
70 reg = <0xF8000000 0x1000>; 127 reg = <0xF8000000 0x1000>;
@@ -106,7 +163,6 @@
106 compatible = "cdns,ttc"; 163 compatible = "cdns,ttc";
107 clocks = <&clkc 6>; 164 clocks = <&clkc 6>;
108 reg = <0xF8001000 0x1000>; 165 reg = <0xF8001000 0x1000>;
109 clock-ranges;
110 }; 166 };
111 167
112 ttc1: ttc1@f8002000 { 168 ttc1: ttc1@f8002000 {
@@ -115,7 +171,6 @@
115 compatible = "cdns,ttc"; 171 compatible = "cdns,ttc";
116 clocks = <&clkc 6>; 172 clocks = <&clkc 6>;
117 reg = <0xF8002000 0x1000>; 173 reg = <0xF8002000 0x1000>;
118 clock-ranges;
119 }; 174 };
120 scutimer: scutimer@f8f00600 { 175 scutimer: scutimer@f8f00600 {
121 interrupt-parent = <&intc>; 176 interrupt-parent = <&intc>;
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 21aea99a067b..c913f77a21eb 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -29,6 +29,15 @@
29 29
30}; 30};
31 31
32&gem0 {
33 status = "okay";
34 phy-mode = "rgmii";
35};
36
37&sdhci0 {
38 status = "okay";
39};
40
32&uart1 { 41&uart1 {
33 status = "okay"; 42 status = "okay";
34}; 43};
diff --git a/arch/arm/boot/dts/zynq-zc706.dts b/arch/arm/boot/dts/zynq-zc706.dts
index 79009e0b74b9..88f62c50382e 100644
--- a/arch/arm/boot/dts/zynq-zc706.dts
+++ b/arch/arm/boot/dts/zynq-zc706.dts
@@ -30,6 +30,15 @@
30 30
31}; 31};
32 32
33&gem0 {
34 status = "okay";
35 phy-mode = "rgmii";
36};
37
38&sdhci0 {
39 status = "okay";
40};
41
33&uart1 { 42&uart1 {
34 status = "okay"; 43 status = "okay";
35}; 44};
diff --git a/arch/arm/boot/dts/zynq-zed.dts b/arch/arm/boot/dts/zynq-zed.dts
index d6acf2b1cdf4..82d7ef1a9a9c 100644
--- a/arch/arm/boot/dts/zynq-zed.dts
+++ b/arch/arm/boot/dts/zynq-zed.dts
@@ -30,6 +30,15 @@
30 30
31}; 31};
32 32
33&gem0 {
34 status = "okay";
35 phy-mode = "rgmii";
36};
37
38&sdhci0 {
39 status = "okay";
40};
41
33&uart1 { 42&uart1 {
34 status = "okay"; 43 status = "okay";
35}; 44};
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index 001f4913799c..5114b68e99d5 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -257,7 +257,7 @@ static int it8152_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t s
257 */ 257 */
258static int it8152_pci_platform_notify(struct device *dev) 258static int it8152_pci_platform_notify(struct device *dev)
259{ 259{
260 if (dev->bus == &pci_bus_type) { 260 if (dev_is_pci(dev)) {
261 if (dev->dma_mask) 261 if (dev->dma_mask)
262 *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET; 262 *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
263 dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET; 263 dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
@@ -268,7 +268,7 @@ static int it8152_pci_platform_notify(struct device *dev)
268 268
269static int it8152_pci_platform_notify_remove(struct device *dev) 269static int it8152_pci_platform_notify_remove(struct device *dev)
270{ 270{
271 if (dev->bus == &pci_bus_type) 271 if (dev_is_pci(dev))
272 dmabounce_unregister_dev(dev); 272 dmabounce_unregister_dev(dev);
273 273
274 return 0; 274 return 0;
diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
index 26020a03f659..1e361abc29eb 100644
--- a/arch/arm/common/mcpm_entry.c
+++ b/arch/arm/common/mcpm_entry.c
@@ -35,8 +35,7 @@ void mcpm_set_early_poke(unsigned cpu, unsigned cluster,
35 unsigned long *poke = &mcpm_entry_early_pokes[cluster][cpu][0]; 35 unsigned long *poke = &mcpm_entry_early_pokes[cluster][cpu][0];
36 poke[0] = poke_phys_addr; 36 poke[0] = poke_phys_addr;
37 poke[1] = poke_val; 37 poke[1] = poke_val;
38 __cpuc_flush_dcache_area((void *)poke, 8); 38 __sync_cache_range_w(poke, 2 * sizeof(*poke));
39 outer_clean_range(__pa(poke), __pa(poke + 2));
40} 39}
41 40
42static const struct mcpm_platform_ops *platform_ops; 41static const struct mcpm_platform_ops *platform_ops;
@@ -167,7 +166,7 @@ void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster)
167 dmb(); 166 dmb();
168 mcpm_sync.clusters[cluster].cpus[cpu].cpu = CPU_DOWN; 167 mcpm_sync.clusters[cluster].cpus[cpu].cpu = CPU_DOWN;
169 sync_cache_w(&mcpm_sync.clusters[cluster].cpus[cpu].cpu); 168 sync_cache_w(&mcpm_sync.clusters[cluster].cpus[cpu].cpu);
170 dsb_sev(); 169 sev();
171} 170}
172 171
173/* 172/*
@@ -183,7 +182,7 @@ void __mcpm_outbound_leave_critical(unsigned int cluster, int state)
183 dmb(); 182 dmb();
184 mcpm_sync.clusters[cluster].cluster = state; 183 mcpm_sync.clusters[cluster].cluster = state;
185 sync_cache_w(&mcpm_sync.clusters[cluster].cluster); 184 sync_cache_w(&mcpm_sync.clusters[cluster].cluster);
186 dsb_sev(); 185 sev();
187} 186}
188 187
189/* 188/*
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index ce922d0ea7aa..53c6a26b633d 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -66,7 +66,7 @@ static long __init sp804_get_clock_rate(struct clk *clk)
66 66
67static void __iomem *sched_clock_base; 67static void __iomem *sched_clock_base;
68 68
69static u32 sp804_read(void) 69static u64 notrace sp804_read(void)
70{ 70{
71 return ~readl_relaxed(sched_clock_base + TIMER_VALUE); 71 return ~readl_relaxed(sched_clock_base + TIMER_VALUE);
72} 72}
@@ -104,7 +104,7 @@ void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
104 104
105 if (use_sched_clock) { 105 if (use_sched_clock) {
106 sched_clock_base = base; 106 sched_clock_base = base;
107 setup_sched_clock(sp804_read, 32, rate); 107 sched_clock_register(sp804_read, 32, rate);
108 } 108 }
109} 109}
110 110
diff --git a/arch/arm/configs/ape6evm_defconfig b/arch/arm/configs/ape6evm_defconfig
index 1ce39940795d..cb26c62dc722 100644
--- a/arch/arm/configs/ape6evm_defconfig
+++ b/arch/arm/configs/ape6evm_defconfig
@@ -13,7 +13,7 @@ CONFIG_EMBEDDED=y
13CONFIG_PERF_EVENTS=y 13CONFIG_PERF_EVENTS=y
14CONFIG_SLAB=y 14CONFIG_SLAB=y
15# CONFIG_BLOCK is not set 15# CONFIG_BLOCK is not set
16CONFIG_ARCH_SHMOBILE=y 16CONFIG_ARCH_SHMOBILE_LEGACY=y
17CONFIG_ARCH_R8A73A4=y 17CONFIG_ARCH_R8A73A4=y
18CONFIG_MACH_APE6EVM=y 18CONFIG_MACH_APE6EVM=y
19# CONFIG_ARM_THUMB is not set 19# CONFIG_ARM_THUMB is not set
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
index fae939d3d7f0..9287a62de830 100644
--- a/arch/arm/configs/armadillo800eva_defconfig
+++ b/arch/arm/configs/armadillo800eva_defconfig
@@ -15,7 +15,7 @@ CONFIG_MODULE_FORCE_UNLOAD=y
15# CONFIG_BLK_DEV_BSG is not set 15# CONFIG_BLK_DEV_BSG is not set
16# CONFIG_IOSCHED_DEADLINE is not set 16# CONFIG_IOSCHED_DEADLINE is not set
17# CONFIG_IOSCHED_CFQ is not set 17# CONFIG_IOSCHED_CFQ is not set
18CONFIG_ARCH_SHMOBILE=y 18CONFIG_ARCH_SHMOBILE_LEGACY=y
19CONFIG_ARCH_R8A7740=y 19CONFIG_ARCH_R8A7740=y
20CONFIG_MACH_ARMADILLO800EVA=y 20CONFIG_MACH_ARMADILLO800EVA=y
21# CONFIG_SH_TIMER_TMU is not set 21# CONFIG_SH_TIMER_TMU is not set
@@ -105,6 +105,7 @@ CONFIG_FB=y
105CONFIG_FB_SH_MOBILE_LCDC=y 105CONFIG_FB_SH_MOBILE_LCDC=y
106CONFIG_FB_SH_MOBILE_HDMI=y 106CONFIG_FB_SH_MOBILE_HDMI=y
107CONFIG_LCD_CLASS_DEVICE=y 107CONFIG_LCD_CLASS_DEVICE=y
108CONFIG_BACKLIGHT_PWM=y
108CONFIG_FRAMEBUFFER_CONSOLE=y 109CONFIG_FRAMEBUFFER_CONSOLE=y
109CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 110CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
110CONFIG_LOGO=y 111CONFIG_LOGO=y
@@ -130,6 +131,8 @@ CONFIG_DMADEVICES=y
130CONFIG_SH_DMAE=y 131CONFIG_SH_DMAE=y
131CONFIG_UIO=y 132CONFIG_UIO=y
132CONFIG_UIO_PDRV_GENIRQ=y 133CONFIG_UIO_PDRV_GENIRQ=y
134CONFIG_PWM=y
135CONFIG_PWM_RENESAS_TPU=y
133# CONFIG_DNOTIFY is not set 136# CONFIG_DNOTIFY is not set
134CONFIG_MSDOS_FS=y 137CONFIG_MSDOS_FS=y
135CONFIG_VFAT_FS=y 138CONFIG_VFAT_FS=y
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 690e89273230..0b4e9b5210d8 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y
22CONFIG_SOC_AT91SAM9N12=y 22CONFIG_SOC_AT91SAM9N12=y
23CONFIG_MACH_AT91RM9200_DT=y 23CONFIG_MACH_AT91RM9200_DT=y
24CONFIG_MACH_AT91SAM9_DT=y 24CONFIG_MACH_AT91SAM9_DT=y
25CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
26CONFIG_AT91_TIMER_HZ=128 25CONFIG_AT91_TIMER_HZ=128
27CONFIG_AEABI=y 26CONFIG_AEABI=y
28# CONFIG_OABI_COMPAT is not set 27# CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
index 75502c4d222c..bf057719dab0 100644
--- a/arch/arm/configs/at91rm9200_defconfig
+++ b/arch/arm/configs/at91rm9200_defconfig
@@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y
31CONFIG_MACH_CPUAT91=y 31CONFIG_MACH_CPUAT91=y
32CONFIG_MACH_ECO920=y 32CONFIG_MACH_ECO920=y
33CONFIG_MTD_AT91_DATAFLASH_CARD=y 33CONFIG_MTD_AT91_DATAFLASH_CARD=y
34CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
35CONFIG_AT91_TIMER_HZ=100 34CONFIG_AT91_TIMER_HZ=100
36# CONFIG_ARM_THUMB is not set 35# CONFIG_ARM_THUMB is not set
37CONFIG_PCCARD=y 36CONFIG_PCCARD=y
diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
index 69b6928d3d9d..2cd832918e9c 100644
--- a/arch/arm/configs/at91sam9260_9g20_defconfig
+++ b/arch/arm/configs/at91sam9260_9g20_defconfig
@@ -15,7 +15,6 @@ CONFIG_MACH_AT91SAM9260EK=y
15CONFIG_MACH_CAM60=y 15CONFIG_MACH_CAM60=y
16CONFIG_MACH_SAM9_L9260=y 16CONFIG_MACH_SAM9_L9260=y
17CONFIG_MACH_AFEB9260=y 17CONFIG_MACH_AFEB9260=y
18CONFIG_MACH_QIL_A9260=y
19CONFIG_MACH_CPU9260=y 18CONFIG_MACH_CPU9260=y
20CONFIG_MACH_FLEXIBITY=y 19CONFIG_MACH_FLEXIBITY=y
21CONFIG_MACH_AT91SAM9G20EK=y 20CONFIG_MACH_AT91SAM9G20EK=y
@@ -28,7 +27,6 @@ CONFIG_MACH_PCONTROL_G20=y
28CONFIG_MACH_GSIA18S=y 27CONFIG_MACH_GSIA18S=y
29CONFIG_MACH_SNAPPER_9260=y 28CONFIG_MACH_SNAPPER_9260=y
30CONFIG_MACH_AT91SAM9_DT=y 29CONFIG_MACH_AT91SAM9_DT=y
31CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
32CONFIG_AT91_SLOW_CLOCK=y 30CONFIG_AT91_SLOW_CLOCK=y
33# CONFIG_ARM_THUMB is not set 31# CONFIG_ARM_THUMB is not set
34CONFIG_AEABI=y 32CONFIG_AEABI=y
diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
index 9d35cd81c611..f80e993b04ce 100644
--- a/arch/arm/configs/at91sam9261_9g10_defconfig
+++ b/arch/arm/configs/at91sam9261_9g10_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
18CONFIG_ARCH_AT91SAM9261=y 18CONFIG_ARCH_AT91SAM9261=y
19CONFIG_MACH_AT91SAM9261EK=y 19CONFIG_MACH_AT91SAM9261EK=y
20CONFIG_MACH_AT91SAM9G10EK=y 20CONFIG_MACH_AT91SAM9G10EK=y
21CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
22# CONFIG_ARM_THUMB is not set 21# CONFIG_ARM_THUMB is not set
23CONFIG_AEABI=y 22CONFIG_AEABI=y
24# CONFIG_OABI_COMPAT is not set 23# CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index 08166cd4e7d6..e181a50fd65a 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
18CONFIG_ARCH_AT91SAM9G45=y 18CONFIG_ARCH_AT91SAM9G45=y
19CONFIG_MACH_AT91SAM9M10G45EK=y 19CONFIG_MACH_AT91SAM9M10G45EK=y
20CONFIG_MACH_AT91SAM9_DT=y 20CONFIG_MACH_AT91SAM9_DT=y
21CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
22CONFIG_AT91_SLOW_CLOCK=y 21CONFIG_AT91_SLOW_CLOCK=y
23CONFIG_AEABI=y 22CONFIG_AEABI=y
24# CONFIG_OABI_COMPAT is not set 23# CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index 7cf87856d63c..7b6f131cecd6 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y
13CONFIG_ARCH_AT91=y 13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9RL=y 14CONFIG_ARCH_AT91SAM9RL=y
15CONFIG_MACH_AT91SAM9RLEK=y 15CONFIG_MACH_AT91SAM9RLEK=y
16CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
17# CONFIG_ARM_THUMB is not set 16# CONFIG_ARM_THUMB is not set
18CONFIG_ZBOOT_ROM_TEXT=0x0 17CONFIG_ZBOOT_ROM_TEXT=0x0
19CONFIG_ZBOOT_ROM_BSS=0x0 18CONFIG_ZBOOT_ROM_BSS=0x0
diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig
index 34e9780e63ba..f43392dc2dcf 100644
--- a/arch/arm/configs/bcm2835_defconfig
+++ b/arch/arm/configs/bcm2835_defconfig
@@ -44,17 +44,26 @@ CONFIG_VFP=y
44# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 44# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
45# CONFIG_SUSPEND is not set 45# CONFIG_SUSPEND is not set
46CONFIG_NET=y 46CONFIG_NET=y
47CONFIG_PACKET=y
47CONFIG_UNIX=y 48CONFIG_UNIX=y
48CONFIG_INET=y 49CONFIG_INET=y
49CONFIG_NETWORK_SECMARK=y 50CONFIG_NETWORK_SECMARK=y
50# CONFIG_WIRELESS is not set 51CONFIG_NETFILTER=y
52CONFIG_CFG80211=y
53CONFIG_MAC80211=y
51CONFIG_DEVTMPFS=y 54CONFIG_DEVTMPFS=y
52CONFIG_DEVTMPFS_MOUNT=y 55CONFIG_DEVTMPFS_MOUNT=y
53# CONFIG_STANDALONE is not set 56# CONFIG_STANDALONE is not set
54# CONFIG_INPUT_MOUSEDEV is not set 57CONFIG_SCSI=y
55# CONFIG_INPUT_KEYBOARD is not set 58CONFIG_BLK_DEV_SD=y
56# CONFIG_INPUT_MOUSE is not set 59CONFIG_SCSI_MULTI_LUN=y
57# CONFIG_SERIO is not set 60CONFIG_SCSI_CONSTANTS=y
61CONFIG_SCSI_SCAN_ASYNC=y
62CONFIG_NETDEVICES=y
63CONFIG_USB_USBNET=y
64CONFIG_USB_NET_SMSC95XX=y
65CONFIG_ZD1211RW=y
66CONFIG_INPUT_EVDEV=y
58# CONFIG_LEGACY_PTYS is not set 67# CONFIG_LEGACY_PTYS is not set
59# CONFIG_DEVKMEM is not set 68# CONFIG_DEVKMEM is not set
60CONFIG_SERIAL_AMBA_PL011=y 69CONFIG_SERIAL_AMBA_PL011=y
@@ -71,15 +80,13 @@ CONFIG_FB=y
71CONFIG_FB_SIMPLE=y 80CONFIG_FB_SIMPLE=y
72CONFIG_FRAMEBUFFER_CONSOLE=y 81CONFIG_FRAMEBUFFER_CONSOLE=y
73CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 82CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
74# CONFIG_USB_SUPPORT is not set 83CONFIG_USB=y
84CONFIG_USB_STORAGE=y
75CONFIG_MMC=y 85CONFIG_MMC=y
76CONFIG_MMC_SDHCI=y 86CONFIG_MMC_SDHCI=y
77CONFIG_MMC_SDHCI_PLTFM=y 87CONFIG_MMC_SDHCI_PLTFM=y
78CONFIG_MMC_SDHCI_BCM2835=y 88CONFIG_MMC_SDHCI_BCM2835=y
79CONFIG_NEW_LEDS=y
80CONFIG_LEDS_CLASS=y
81CONFIG_LEDS_GPIO=y 89CONFIG_LEDS_GPIO=y
82CONFIG_LEDS_TRIGGERS=y
83CONFIG_LEDS_TRIGGER_TIMER=y 90CONFIG_LEDS_TRIGGER_TIMER=y
84CONFIG_LEDS_TRIGGER_ONESHOT=y 91CONFIG_LEDS_TRIGGER_ONESHOT=y
85CONFIG_LEDS_TRIGGER_HEARTBEAT=y 92CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -88,6 +95,8 @@ CONFIG_LEDS_TRIGGER_GPIO=y
88CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 95CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
89CONFIG_LEDS_TRIGGER_TRANSIENT=y 96CONFIG_LEDS_TRIGGER_TRANSIENT=y
90CONFIG_LEDS_TRIGGER_CAMERA=y 97CONFIG_LEDS_TRIGGER_CAMERA=y
98CONFIG_STAGING=y
99CONFIG_USB_DWC2=y
91# CONFIG_IOMMU_SUPPORT is not set 100# CONFIG_IOMMU_SUPPORT is not set
92CONFIG_EXT2_FS=y 101CONFIG_EXT2_FS=y
93CONFIG_EXT2_FS_XATTR=y 102CONFIG_EXT2_FS_XATTR=y
@@ -109,20 +118,20 @@ CONFIG_NLS_ASCII=y
109CONFIG_NLS_ISO8859_1=y 118CONFIG_NLS_ISO8859_1=y
110CONFIG_NLS_UTF8=y 119CONFIG_NLS_UTF8=y
111CONFIG_PRINTK_TIME=y 120CONFIG_PRINTK_TIME=y
121CONFIG_BOOT_PRINTK_DELAY=y
122CONFIG_DYNAMIC_DEBUG=y
123CONFIG_DEBUG_INFO=y
112# CONFIG_ENABLE_WARN_DEPRECATED is not set 124# CONFIG_ENABLE_WARN_DEPRECATED is not set
113# CONFIG_ENABLE_MUST_CHECK is not set 125# CONFIG_ENABLE_MUST_CHECK is not set
114CONFIG_UNUSED_SYMBOLS=y 126CONFIG_UNUSED_SYMBOLS=y
115CONFIG_LOCKUP_DETECTOR=y
116CONFIG_DEBUG_INFO=y
117CONFIG_DEBUG_MEMORY_INIT=y 127CONFIG_DEBUG_MEMORY_INIT=y
118CONFIG_BOOT_PRINTK_DELAY=y 128CONFIG_LOCKUP_DETECTOR=y
119CONFIG_SCHED_TRACER=y 129CONFIG_SCHED_TRACER=y
120CONFIG_STACK_TRACER=y 130CONFIG_STACK_TRACER=y
121CONFIG_FUNCTION_PROFILER=y 131CONFIG_FUNCTION_PROFILER=y
122CONFIG_DYNAMIC_DEBUG=y 132CONFIG_TEST_KSTRTOX=y
123CONFIG_KGDB=y 133CONFIG_KGDB=y
124CONFIG_KGDB_KDB=y 134CONFIG_KGDB_KDB=y
125CONFIG_TEST_KSTRTOX=y
126CONFIG_STRICT_DEVMEM=y 135CONFIG_STRICT_DEVMEM=y
127CONFIG_DEBUG_LL=y 136CONFIG_DEBUG_LL=y
128CONFIG_EARLY_PRINTK=y 137CONFIG_EARLY_PRINTK=y
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index 287ac1d7aac7..2519d6de0640 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -29,11 +29,9 @@ CONFIG_ARCH_BCM_MOBILE=y
29CONFIG_ARM_THUMBEE=y 29CONFIG_ARM_THUMBEE=y
30CONFIG_PREEMPT=y 30CONFIG_PREEMPT=y
31CONFIG_AEABI=y 31CONFIG_AEABI=y
32# CONFIG_OABI_COMPAT is not set
33# CONFIG_COMPACTION is not set 32# CONFIG_COMPACTION is not set
34CONFIG_ZBOOT_ROM_TEXT=0x0 33CONFIG_ZBOOT_ROM_TEXT=0x0
35CONFIG_ZBOOT_ROM_BSS=0x0 34CONFIG_ZBOOT_ROM_BSS=0x0
36CONFIG_ARM_APPENDED_DTB=y
37CONFIG_CMDLINE="console=ttyS0,115200n8 mem=128M" 35CONFIG_CMDLINE="console=ttyS0,115200n8 mem=128M"
38CONFIG_CPU_IDLE=y 36CONFIG_CPU_IDLE=y
39CONFIG_VFP=y 37CONFIG_VFP=y
@@ -120,9 +118,14 @@ CONFIG_DETECT_HUNG_TASK=y
120CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=110 118CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=110
121CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y 119CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
122# CONFIG_FTRACE is not set 120# CONFIG_FTRACE is not set
121# CONFIG_CRYPTO_ANSI_CPRNG is not set
123CONFIG_CRC_CCITT=y 122CONFIG_CRC_CCITT=y
124CONFIG_CRC_T10DIF=y 123CONFIG_CRC_T10DIF=y
125CONFIG_CRC_ITU_T=y 124CONFIG_CRC_ITU_T=y
126CONFIG_CRC7=y 125CONFIG_CRC7=y
127CONFIG_XZ_DEC=y 126CONFIG_XZ_DEC=y
128CONFIG_AVERAGE=y 127CONFIG_AVERAGE=y
128CONFIG_PINCTRL_CAPRI=y
129CONFIG_WATCHDOG=y
130CONFIG_BCM_KONA_WDT=y
131CONFIG_BCM_KONA_WDT_DEBUG=y
diff --git a/arch/arm/configs/bockw_defconfig b/arch/arm/configs/bockw_defconfig
index b38cd107f82d..80cff50beb34 100644
--- a/arch/arm/configs/bockw_defconfig
+++ b/arch/arm/configs/bockw_defconfig
@@ -8,7 +8,7 @@ CONFIG_SYSCTL_SYSCALL=y
8CONFIG_EMBEDDED=y 8CONFIG_EMBEDDED=y
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10# CONFIG_IOSCHED_CFQ is not set 10# CONFIG_IOSCHED_CFQ is not set
11CONFIG_ARCH_SHMOBILE=y 11CONFIG_ARCH_SHMOBILE_LEGACY=y
12CONFIG_ARCH_R8A7778=y 12CONFIG_ARCH_R8A7778=y
13CONFIG_MACH_BOCKW=y 13CONFIG_MACH_BOCKW=y
14CONFIG_MEMORY_START=0x60000000 14CONFIG_MEMORY_START=0x60000000
@@ -27,12 +27,12 @@ CONFIG_HIGHMEM=y
27CONFIG_ZBOOT_ROM_TEXT=0x0 27CONFIG_ZBOOT_ROM_TEXT=0x0
28CONFIG_ZBOOT_ROM_BSS=0x0 28CONFIG_ZBOOT_ROM_BSS=0x0
29CONFIG_ARM_APPENDED_DTB=y 29CONFIG_ARM_APPENDED_DTB=y
30CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp" 30CONFIG_VFP=y
31CONFIG_CMDLINE_FORCE=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33# CONFIG_SUSPEND is not set 32# CONFIG_SUSPEND is not set
34CONFIG_PM_RUNTIME=y 33CONFIG_PM_RUNTIME=y
35CONFIG_NET=y 34CONFIG_NET=y
35CONFIG_PACKET=y
36CONFIG_UNIX=y 36CONFIG_UNIX=y
37CONFIG_INET=y 37CONFIG_INET=y
38CONFIG_IP_PNP=y 38CONFIG_IP_PNP=y
@@ -44,8 +44,6 @@ CONFIG_IP_PNP_DHCP=y
44# CONFIG_INET_DIAG is not set 44# CONFIG_INET_DIAG is not set
45# CONFIG_IPV6 is not set 45# CONFIG_IPV6 is not set
46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
47CONFIG_DEVTMPFS=y
48CONFIG_DEVTMPFS_MOUNT=y
49# CONFIG_STANDALONE is not set 47# CONFIG_STANDALONE is not set
50# CONFIG_PREVENT_FIRMWARE_BUILD is not set 48# CONFIG_PREVENT_FIRMWARE_BUILD is not set
51# CONFIG_FW_LOADER is not set 49# CONFIG_FW_LOADER is not set
@@ -82,6 +80,7 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
82# CONFIG_HWMON is not set 80# CONFIG_HWMON is not set
83CONFIG_I2C=y 81CONFIG_I2C=y
84CONFIG_I2C_RCAR=y 82CONFIG_I2C_RCAR=y
83CONFIG_REGULATOR=y
85CONFIG_MEDIA_SUPPORT=y 84CONFIG_MEDIA_SUPPORT=y
86CONFIG_MEDIA_CAMERA_SUPPORT=y 85CONFIG_MEDIA_CAMERA_SUPPORT=y
87CONFIG_V4L_PLATFORM_DRIVERS=y 86CONFIG_V4L_PLATFORM_DRIVERS=y
@@ -108,11 +107,12 @@ CONFIG_MMC_SDHI=y
108CONFIG_MMC_SH_MMCIF=y 107CONFIG_MMC_SH_MMCIF=y
109CONFIG_RTC_CLASS=y 108CONFIG_RTC_CLASS=y
110CONFIG_RTC_DRV_RX8581=y 109CONFIG_RTC_DRV_RX8581=y
110CONFIG_DMADEVICES=y
111CONFIG_RCAR_HPB_DMAE=y
111CONFIG_UIO=y 112CONFIG_UIO=y
112CONFIG_UIO_PDRV_GENIRQ=y 113CONFIG_UIO_PDRV_GENIRQ=y
113# CONFIG_IOMMU_SUPPORT is not set 114# CONFIG_IOMMU_SUPPORT is not set
114# CONFIG_DNOTIFY is not set 115# CONFIG_DNOTIFY is not set
115# CONFIG_INOTIFY_USER is not set
116CONFIG_TMPFS=y 116CONFIG_TMPFS=y
117# CONFIG_MISC_FILESYSTEMS is not set 117# CONFIG_MISC_FILESYSTEMS is not set
118CONFIG_NFS_FS=y 118CONFIG_NFS_FS=y
diff --git a/arch/arm/configs/efm32_defconfig b/arch/arm/configs/efm32_defconfig
new file mode 100644
index 000000000000..f59fffb3d0c6
--- /dev/null
+++ b/arch/arm/configs/efm32_defconfig
@@ -0,0 +1,102 @@
1CONFIG_HIGH_RES_TIMERS=y
2CONFIG_LOG_BUF_SHIFT=12
3CONFIG_CC_OPTIMIZE_FOR_SIZE=y
4# CONFIG_UID16 is not set
5# CONFIG_BASE_FULL is not set
6# CONFIG_FUTEX is not set
7# CONFIG_EPOLL is not set
8# CONFIG_SIGNALFD is not set
9# CONFIG_EVENTFD is not set
10# CONFIG_AIO is not set
11CONFIG_EMBEDDED=y
12# CONFIG_VM_EVENT_COUNTERS is not set
13# CONFIG_SLUB_DEBUG is not set
14# CONFIG_LBDAF is not set
15# CONFIG_BLK_DEV_BSG is not set
16# CONFIG_IOSCHED_DEADLINE is not set
17# CONFIG_IOSCHED_CFQ is not set
18# CONFIG_MMU is not set
19CONFIG_ARCH_EFM32=y
20# CONFIG_KUSER_HELPERS is not set
21CONFIG_SET_MEM_PARAM=y
22CONFIG_DRAM_BASE=0x88000000
23CONFIG_DRAM_SIZE=0x00400000
24CONFIG_FLASH_MEM_BASE=0x8c000000
25CONFIG_FLASH_SIZE=0x01000000
26CONFIG_PREEMPT=y
27CONFIG_ZBOOT_ROM_TEXT=0x0
28CONFIG_ZBOOT_ROM_BSS=0x0
29CONFIG_XIP_KERNEL=y
30CONFIG_XIP_PHYS_ADDR=0x8c000000
31CONFIG_BINFMT_FLAT=y
32CONFIG_BINFMT_SHARED_FLAT=y
33# CONFIG_COREDUMP is not set
34CONFIG_NET=y
35CONFIG_PACKET=y
36CONFIG_UNIX=y
37CONFIG_INET=y
38# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
39# CONFIG_INET_XFRM_MODE_TUNNEL is not set
40# CONFIG_INET_XFRM_MODE_BEET is not set
41# CONFIG_INET_LRO is not set
42# CONFIG_INET_DIAG is not set
43# CONFIG_IPV6 is not set
44# CONFIG_WIRELESS is not set
45CONFIG_DEVTMPFS=y
46CONFIG_DEVTMPFS_MOUNT=y
47# CONFIG_FW_LOADER is not set
48CONFIG_MTD=y
49CONFIG_MTD_BLOCK_RO=y
50CONFIG_MTD_ROM=y
51CONFIG_MTD_UCLINUX=y
52CONFIG_PROC_DEVICETREE=y
53# CONFIG_BLK_DEV is not set
54CONFIG_NETDEVICES=y
55# CONFIG_NET_VENDOR_ARC is not set
56# CONFIG_NET_CADENCE is not set
57# CONFIG_NET_VENDOR_BROADCOM is not set
58# CONFIG_NET_VENDOR_CIRRUS is not set
59# CONFIG_NET_VENDOR_FARADAY is not set
60# CONFIG_NET_VENDOR_INTEL is not set
61# CONFIG_NET_VENDOR_MARVELL is not set
62CONFIG_KS8851=y
63# CONFIG_NET_VENDOR_MICROCHIP is not set
64# CONFIG_NET_VENDOR_NATSEMI is not set
65# CONFIG_NET_VENDOR_SEEQ is not set
66# CONFIG_NET_VENDOR_SMSC is not set
67# CONFIG_NET_VENDOR_STMICRO is not set
68# CONFIG_NET_VENDOR_VIA is not set
69# CONFIG_NET_VENDOR_WIZNET is not set
70# CONFIG_WLAN is not set
71# CONFIG_INPUT is not set
72# CONFIG_SERIO is not set
73# CONFIG_VT is not set
74# CONFIG_UNIX98_PTYS is not set
75# CONFIG_LEGACY_PTYS is not set
76CONFIG_SERIAL_NONSTANDARD=y
77# CONFIG_DEVKMEM is not set
78CONFIG_SERIAL_EFM32_UART=y
79CONFIG_SERIAL_EFM32_UART_CONSOLE=y
80# CONFIG_HW_RANDOM is not set
81CONFIG_SPI=y
82CONFIG_SPI_EFM32=y
83CONFIG_GPIO_SYSFS=y
84# CONFIG_USB_SUPPORT is not set
85CONFIG_MMC=y
86CONFIG_MMC_SPI=y
87# CONFIG_IOMMU_SUPPORT is not set
88CONFIG_EXT2_FS=y
89# CONFIG_FILE_LOCKING is not set
90# CONFIG_DNOTIFY is not set
91# CONFIG_INOTIFY_USER is not set
92CONFIG_ROMFS_FS=y
93CONFIG_ROMFS_BACKED_BY_MTD=y
94# CONFIG_NETWORK_FILESYSTEMS is not set
95CONFIG_PRINTK_TIME=y
96CONFIG_DEBUG_INFO=y
97# CONFIG_ENABLE_WARN_DEPRECATED is not set
98# CONFIG_ENABLE_MUST_CHECK is not set
99CONFIG_MAGIC_SYSRQ=y
100# CONFIG_SCHED_DEBUG is not set
101# CONFIG_DEBUG_BUGVERBOSE is not set
102# CONFIG_FTRACE is not set
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index ad7dfbbafa45..dbe1f1c47bb0 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -13,7 +13,7 @@ CONFIG_S3C24XX_PWM=y
13CONFIG_ARCH_EXYNOS5=y 13CONFIG_ARCH_EXYNOS5=y
14CONFIG_MACH_EXYNOS4_DT=y 14CONFIG_MACH_EXYNOS4_DT=y
15CONFIG_SMP=y 15CONFIG_SMP=y
16CONFIG_NR_CPUS=2 16CONFIG_NR_CPUS=8
17CONFIG_PREEMPT=y 17CONFIG_PREEMPT=y
18CONFIG_AEABI=y 18CONFIG_AEABI=y
19CONFIG_HIGHMEM=y 19CONFIG_HIGHMEM=y
@@ -79,6 +79,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
79CONFIG_REGULATOR_GPIO=y 79CONFIG_REGULATOR_GPIO=y
80CONFIG_REGULATOR_MAX8997=y 80CONFIG_REGULATOR_MAX8997=y
81CONFIG_REGULATOR_MAX77686=y 81CONFIG_REGULATOR_MAX77686=y
82CONFIG_REGULATOR_S2MPS11=y
82CONFIG_REGULATOR_S5M8767=y 83CONFIG_REGULATOR_S5M8767=y
83CONFIG_REGULATOR_TPS65090=y 84CONFIG_REGULATOR_TPS65090=y
84CONFIG_FB=y 85CONFIG_FB=y
diff --git a/arch/arm/configs/genmai_defconfig b/arch/arm/configs/genmai_defconfig
new file mode 100644
index 000000000000..aa0b704f48af
--- /dev/null
+++ b/arch/arm/configs/genmai_defconfig
@@ -0,0 +1,116 @@
1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_CC_OPTIMIZE_FOR_SIZE=y
7CONFIG_SYSCTL_SYSCALL=y
8CONFIG_EMBEDDED=y
9CONFIG_PERF_EVENTS=y
10CONFIG_SLAB=y
11# CONFIG_LBDAF is not set
12# CONFIG_BLK_DEV_BSG is not set
13# CONFIG_IOSCHED_DEADLINE is not set
14# CONFIG_IOSCHED_CFQ is not set
15CONFIG_ARCH_SHMOBILE_LEGACY=y
16CONFIG_ARCH_R7S72100=y
17CONFIG_MACH_GENMAI=y
18# CONFIG_SH_TIMER_CMT is not set
19# CONFIG_SH_TIMER_MTU2 is not set
20# CONFIG_SH_TIMER_TMU is not set
21# CONFIG_EM_TIMER_STI is not set
22CONFIG_ARM_ERRATA_430973=y
23CONFIG_ARM_ERRATA_458693=y
24CONFIG_ARM_ERRATA_460075=y
25CONFIG_ARM_ERRATA_743622=y
26CONFIG_ARM_ERRATA_754322=y
27CONFIG_AEABI=y
28# CONFIG_OABI_COMPAT is not set
29CONFIG_FORCE_MAX_ZONEORDER=13
30CONFIG_ZBOOT_ROM_TEXT=0x0
31CONFIG_ZBOOT_ROM_BSS=0x0
32CONFIG_ARM_APPENDED_DTB=y
33CONFIG_KEXEC=y
34CONFIG_AUTO_ZRELADDR=y
35CONFIG_VFP=y
36CONFIG_NEON=y
37# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
38CONFIG_PM_RUNTIME=y
39CONFIG_NET=y
40CONFIG_PACKET=y
41CONFIG_UNIX=y
42CONFIG_INET=y
43CONFIG_IP_PNP=y
44CONFIG_IP_PNP_DHCP=y
45# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
46# CONFIG_INET_XFRM_MODE_TUNNEL is not set
47# CONFIG_INET_XFRM_MODE_BEET is not set
48# CONFIG_INET_LRO is not set
49# CONFIG_INET_DIAG is not set
50# CONFIG_IPV6 is not set
51# CONFIG_WIRELESS is not set
52CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
53CONFIG_NETDEVICES=y
54# CONFIG_NET_CORE is not set
55# CONFIG_NET_VENDOR_ARC is not set
56# CONFIG_NET_CADENCE is not set
57# CONFIG_NET_VENDOR_BROADCOM is not set
58# CONFIG_NET_VENDOR_CIRRUS is not set
59# CONFIG_NET_VENDOR_FARADAY is not set
60# CONFIG_NET_VENDOR_INTEL is not set
61# CONFIG_NET_VENDOR_MARVELL is not set
62# CONFIG_NET_VENDOR_MICREL is not set
63# CONFIG_NET_VENDOR_NATSEMI is not set
64CONFIG_SH_ETH=y
65# CONFIG_NET_VENDOR_SEEQ is not set
66# CONFIG_NET_VENDOR_SMSC is not set
67# CONFIG_NET_VENDOR_STMICRO is not set
68# CONFIG_NET_VENDOR_VIA is not set
69# CONFIG_NET_VENDOR_WIZNET is not set
70# CONFIG_WLAN is not set
71# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
72CONFIG_INPUT_EVDEV=y
73# CONFIG_KEYBOARD_ATKBD is not set
74# CONFIG_INPUT_MOUSE is not set
75# CONFIG_SERIO is not set
76# CONFIG_LEGACY_PTYS is not set
77CONFIG_SERIAL_SH_SCI=y
78CONFIG_SERIAL_SH_SCI_NR_UARTS=10
79CONFIG_SERIAL_SH_SCI_CONSOLE=y
80# CONFIG_HW_RANDOM is not set
81CONFIG_I2C_SH_MOBILE=y
82# CONFIG_HWMON is not set
83CONFIG_THERMAL=y
84CONFIG_RCAR_THERMAL=y
85CONFIG_REGULATOR=y
86CONFIG_REGULATOR_FIXED_VOLTAGE=y
87CONFIG_DRM=y
88CONFIG_DRM_RCAR_DU=y
89# CONFIG_USB_SUPPORT is not set
90CONFIG_MMC=y
91CONFIG_MMC_SDHI=y
92CONFIG_MMC_SH_MMCIF=y
93CONFIG_NEW_LEDS=y
94CONFIG_LEDS_CLASS=y
95CONFIG_RTC_CLASS=y
96CONFIG_DMADEVICES=y
97CONFIG_SH_DMAE=y
98# CONFIG_IOMMU_SUPPORT is not set
99# CONFIG_DNOTIFY is not set
100CONFIG_MSDOS_FS=y
101CONFIG_VFAT_FS=y
102CONFIG_TMPFS=y
103CONFIG_CONFIGFS_FS=y
104# CONFIG_MISC_FILESYSTEMS is not set
105CONFIG_NFS_FS=y
106CONFIG_NFS_V3_ACL=y
107CONFIG_NFS_V4=y
108CONFIG_NFS_V4_1=y
109CONFIG_ROOT_NFS=y
110CONFIG_NLS_CODEPAGE_437=y
111CONFIG_NLS_ISO8859_1=y
112# CONFIG_ENABLE_WARN_DEPRECATED is not set
113# CONFIG_ENABLE_MUST_CHECK is not set
114# CONFIG_ARM_UNWIND is not set
115# CONFIG_CRYPTO_ANSI_CPRNG is not set
116# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/configs/hi3xxx_defconfig b/arch/arm/configs/hi3xxx_defconfig
new file mode 100644
index 000000000000..f186bdfa2369
--- /dev/null
+++ b/arch/arm/configs/hi3xxx_defconfig
@@ -0,0 +1,56 @@
1CONFIG_IRQ_DOMAIN_DEBUG=y
2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BLK_DEV_INITRD=y
5CONFIG_RD_LZMA=y
6CONFIG_ARCH_HI3xxx=y
7CONFIG_SMP=y
8CONFIG_PREEMPT=y
9CONFIG_AEABI=y
10CONFIG_ARM_APPENDED_DTB=y
11CONFIG_NET=y
12CONFIG_UNIX=y
13CONFIG_INET=y
14CONFIG_IP_PNP=y
15CONFIG_IP_PNP_DHCP=y
16CONFIG_DEVTMPFS=y
17CONFIG_DEVTMPFS_MOUNT=y
18CONFIG_BLK_DEV_SD=y
19CONFIG_ATA=y
20CONFIG_SATA_AHCI_PLATFORM=y
21CONFIG_NETDEVICES=y
22CONFIG_SERIAL_AMBA_PL011=y
23CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
24CONFIG_SERIAL_OF_PLATFORM=y
25CONFIG_I2C_DESIGNWARE_PLATFORM=y
26CONFIG_SPI=y
27CONFIG_SPI_PL022=y
28CONFIG_PINCTRL_SINGLE=y
29CONFIG_GPIO_GENERIC_PLATFORM=y
30CONFIG_REGULATOR_GPIO=y
31CONFIG_DRM=y
32CONFIG_FB_SIMPLE=y
33CONFIG_USB=y
34CONFIG_USB_XHCI_HCD=y
35CONFIG_USB_EHCI_HCD=y
36CONFIG_USB_EHCI_MXC=y
37CONFIG_USB_EHCI_HCD_PLATFORM=y
38CONFIG_USB_STORAGE=y
39CONFIG_NOP_USB_XCEIV=y
40CONFIG_MMC=y
41CONFIG_RTC_CLASS=y
42CONFIG_RTC_DRV_PL031=y
43CONFIG_DMADEVICES=y
44CONFIG_DW_DMAC=y
45CONFIG_PL330_DMA=y
46CONFIG_PWM=y
47CONFIG_EXT4_FS=y
48CONFIG_TMPFS=y
49CONFIG_NFS_FS=y
50CONFIG_NFS_V3_ACL=y
51CONFIG_NFS_V4=y
52CONFIG_ROOT_NFS=y
53CONFIG_PRINTK_TIME=y
54CONFIG_DEBUG_FS=y
55CONFIG_DEBUG_KERNEL=y
56CONFIG_LOCKUP_DETECTOR=y
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index e958ebe79779..6309ee52ccfc 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -91,6 +91,7 @@ CONFIG_SMSC911X=y
91CONFIG_SMSC_PHY=y 91CONFIG_SMSC_PHY=y
92# CONFIG_INPUT_MOUSEDEV is not set 92# CONFIG_INPUT_MOUSEDEV is not set
93CONFIG_INPUT_EVDEV=y 93CONFIG_INPUT_EVDEV=y
94CONFIG_KEYBOARD_GPIO=y
94CONFIG_KEYBOARD_IMX=y 95CONFIG_KEYBOARD_IMX=y
95# CONFIG_INPUT_MOUSE is not set 96# CONFIG_INPUT_MOUSE is not set
96CONFIG_INPUT_TOUCHSCREEN=y 97CONFIG_INPUT_TOUCHSCREEN=y
@@ -118,6 +119,7 @@ CONFIG_IMX2_WDT=y
118CONFIG_MFD_MC13XXX_SPI=y 119CONFIG_MFD_MC13XXX_SPI=y
119CONFIG_REGULATOR=y 120CONFIG_REGULATOR=y
120CONFIG_REGULATOR_FIXED_VOLTAGE=y 121CONFIG_REGULATOR_FIXED_VOLTAGE=y
122CONFIG_REGULATOR_GPIO=y
121CONFIG_REGULATOR_MC13783=y 123CONFIG_REGULATOR_MC13783=y
122CONFIG_REGULATOR_MC13892=y 124CONFIG_REGULATOR_MC13892=y
123CONFIG_MEDIA_SUPPORT=y 125CONFIG_MEDIA_SUPPORT=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 8d0c5a018ed7..53e82c2523eb 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -28,11 +28,13 @@ CONFIG_MACH_QONG=y
28CONFIG_MACH_ARMADILLO5X0=y 28CONFIG_MACH_ARMADILLO5X0=y
29CONFIG_MACH_KZM_ARM11_01=y 29CONFIG_MACH_KZM_ARM11_01=y
30CONFIG_MACH_IMX31_DT=y 30CONFIG_MACH_IMX31_DT=y
31CONFIG_MACH_IMX35_DT=y
31CONFIG_MACH_PCM043=y 32CONFIG_MACH_PCM043=y
32CONFIG_MACH_MX35_3DS=y 33CONFIG_MACH_MX35_3DS=y
33CONFIG_MACH_VPR200=y 34CONFIG_MACH_VPR200=y
34CONFIG_MACH_IMX51_DT=y 35CONFIG_MACH_IMX51_DT=y
35CONFIG_MACH_EUKREA_CPUIMX51SD=y 36CONFIG_MACH_EUKREA_CPUIMX51SD=y
37CONFIG_SOC_IMX50=y
36CONFIG_SOC_IMX53=y 38CONFIG_SOC_IMX53=y
37CONFIG_SOC_IMX6Q=y 39CONFIG_SOC_IMX6Q=y
38CONFIG_SOC_IMX6SL=y 40CONFIG_SOC_IMX6SL=y
@@ -41,7 +43,7 @@ CONFIG_SMP=y
41CONFIG_VMSPLIT_2G=y 43CONFIG_VMSPLIT_2G=y
42CONFIG_PREEMPT_VOLUNTARY=y 44CONFIG_PREEMPT_VOLUNTARY=y
43CONFIG_AEABI=y 45CONFIG_AEABI=y
44# CONFIG_OABI_COMPAT is not set 46CONFIG_HIGHMEM=y
45CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" 47CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
46CONFIG_VFP=y 48CONFIG_VFP=y
47CONFIG_NEON=y 49CONFIG_NEON=y
@@ -89,7 +91,6 @@ CONFIG_MTD_UBI=y
89CONFIG_BLK_DEV_LOOP=y 91CONFIG_BLK_DEV_LOOP=y
90CONFIG_BLK_DEV_RAM=y 92CONFIG_BLK_DEV_RAM=y
91CONFIG_BLK_DEV_RAM_SIZE=65536 93CONFIG_BLK_DEV_RAM_SIZE=65536
92CONFIG_SRAM=y
93CONFIG_EEPROM_AT24=y 94CONFIG_EEPROM_AT24=y
94CONFIG_EEPROM_AT25=y 95CONFIG_EEPROM_AT25=y
95# CONFIG_SCSI_PROC_FS is not set 96# CONFIG_SCSI_PROC_FS is not set
@@ -118,6 +119,7 @@ CONFIG_SMC91X=y
118CONFIG_SMC911X=y 119CONFIG_SMC911X=y
119CONFIG_SMSC911X=y 120CONFIG_SMSC911X=y
120# CONFIG_NET_VENDOR_STMICRO is not set 121# CONFIG_NET_VENDOR_STMICRO is not set
122CONFIG_AT803X_PHY=y
121CONFIG_BRCMFMAC=m 123CONFIG_BRCMFMAC=m
122# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 124# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
123CONFIG_INPUT_EVDEV=y 125CONFIG_INPUT_EVDEV=y
@@ -129,6 +131,8 @@ CONFIG_MOUSE_PS2_ELANTECH=y
129CONFIG_INPUT_TOUCHSCREEN=y 131CONFIG_INPUT_TOUCHSCREEN=y
130CONFIG_TOUCHSCREEN_EGALAX=y 132CONFIG_TOUCHSCREEN_EGALAX=y
131CONFIG_TOUCHSCREEN_MC13783=y 133CONFIG_TOUCHSCREEN_MC13783=y
134CONFIG_TOUCHSCREEN_TSC2007=y
135CONFIG_TOUCHSCREEN_STMPE=y
132CONFIG_INPUT_MISC=y 136CONFIG_INPUT_MISC=y
133CONFIG_INPUT_MMA8450=y 137CONFIG_INPUT_MMA8450=y
134CONFIG_SERIO_SERPORT=m 138CONFIG_SERIO_SERPORT=m
@@ -156,14 +160,19 @@ CONFIG_IMX2_WDT=y
156CONFIG_MFD_DA9052_I2C=y 160CONFIG_MFD_DA9052_I2C=y
157CONFIG_MFD_MC13XXX_SPI=y 161CONFIG_MFD_MC13XXX_SPI=y
158CONFIG_MFD_MC13XXX_I2C=y 162CONFIG_MFD_MC13XXX_I2C=y
163CONFIG_MFD_STMPE=y
159CONFIG_REGULATOR=y 164CONFIG_REGULATOR=y
160CONFIG_REGULATOR_FIXED_VOLTAGE=y 165CONFIG_REGULATOR_FIXED_VOLTAGE=y
161CONFIG_REGULATOR_ANATOP=y 166CONFIG_REGULATOR_ANATOP=y
162CONFIG_REGULATOR_DA9052=y 167CONFIG_REGULATOR_DA9052=y
163CONFIG_REGULATOR_MC13783=y 168CONFIG_REGULATOR_MC13783=y
164CONFIG_REGULATOR_MC13892=y 169CONFIG_REGULATOR_MC13892=y
170CONFIG_REGULATOR_PFUZE100=y
165CONFIG_MEDIA_SUPPORT=y 171CONFIG_MEDIA_SUPPORT=y
166CONFIG_MEDIA_CAMERA_SUPPORT=y 172CONFIG_MEDIA_CAMERA_SUPPORT=y
173CONFIG_MEDIA_RC_SUPPORT=y
174CONFIG_RC_DEVICES=y
175CONFIG_IR_GPIO_CIR=y
167CONFIG_V4L_PLATFORM_DRIVERS=y 176CONFIG_V4L_PLATFORM_DRIVERS=y
168CONFIG_SOC_CAMERA=y 177CONFIG_SOC_CAMERA=y
169CONFIG_VIDEO_MX3=y 178CONFIG_VIDEO_MX3=y
diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig
index 9943e5da74f1..4582e160feab 100644
--- a/arch/arm/configs/keystone_defconfig
+++ b/arch/arm/configs/keystone_defconfig
@@ -115,6 +115,8 @@ CONFIG_MTD_UBI=y
115CONFIG_PROC_DEVICETREE=y 115CONFIG_PROC_DEVICETREE=y
116CONFIG_BLK_DEV_LOOP=y 116CONFIG_BLK_DEV_LOOP=y
117CONFIG_EEPROM_AT24=y 117CONFIG_EEPROM_AT24=y
118CONFIG_SCSI=y
119CONFIG_BLK_DEV_SD=y
118CONFIG_NETDEVICES=y 120CONFIG_NETDEVICES=y
119CONFIG_SERIAL_8250=y 121CONFIG_SERIAL_8250=y
120CONFIG_SERIAL_8250_CONSOLE=y 122CONFIG_SERIAL_8250_CONSOLE=y
@@ -129,10 +131,25 @@ CONFIG_SPI_DAVINCI=y
129CONFIG_SPI_SPIDEV=y 131CONFIG_SPI_SPIDEV=y
130# CONFIG_HWMON is not set 132# CONFIG_HWMON is not set
131CONFIG_WATCHDOG=y 133CONFIG_WATCHDOG=y
132# CONFIG_USB_SUPPORT is not set 134CONFIG_USB=y
135CONFIG_USB_DEBUG=y
136CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
137CONFIG_USB_MON=y
138CONFIG_USB_XHCI_HCD=y
139CONFIG_USB_STORAGE=y
140CONFIG_USB_DWC3=y
141CONFIG_USB_DWC3_DEBUG=y
142CONFIG_USB_DWC3_VERBOSE=y
143CONFIG_KEYSTONE_USB_PHY=y
133CONFIG_DMADEVICES=y 144CONFIG_DMADEVICES=y
145CONFIG_TI_EDMA=y
134CONFIG_COMMON_CLK_DEBUG=y 146CONFIG_COMMON_CLK_DEBUG=y
135CONFIG_MEMORY=y 147CONFIG_MEMORY=y
148CONFIG_EXT4_FS=y
149CONFIG_EXT4_FS_POSIX_ACL=y
150CONFIG_MSDOS_FS=y
151CONFIG_VFAT_FS=y
152CONFIG_NTFS_FS=y
136CONFIG_TMPFS=y 153CONFIG_TMPFS=y
137CONFIG_JFFS2_FS=y 154CONFIG_JFFS2_FS=y
138CONFIG_JFFS2_FS_WBUF_VERIFY=y 155CONFIG_JFFS2_FS_WBUF_VERIFY=y
@@ -144,6 +161,8 @@ CONFIG_ROOT_NFS=y
144CONFIG_NFSD=y 161CONFIG_NFSD=y
145CONFIG_NFSD_V3=y 162CONFIG_NFSD_V3=y
146CONFIG_NFSD_V3_ACL=y 163CONFIG_NFSD_V3_ACL=y
164CONFIG_NLS_CODEPAGE_437=y
165CONFIG_NLS_ISO8859_1=y
147CONFIG_PRINTK_TIME=y 166CONFIG_PRINTK_TIME=y
148CONFIG_DEBUG_SHIRQ=y 167CONFIG_DEBUG_SHIRQ=y
149CONFIG_DEBUG_INFO=y 168CONFIG_DEBUG_INFO=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 0ae0eaebf6b2..2e762d94e94b 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -27,6 +27,7 @@ CONFIG_PCI_MVEBU=y
27CONFIG_PREEMPT=y 27CONFIG_PREEMPT=y
28CONFIG_AEABI=y 28CONFIG_AEABI=y
29# CONFIG_OABI_COMPAT is not set 29# CONFIG_OABI_COMPAT is not set
30CONFIG_HIGHMEM=y
30CONFIG_ZBOOT_ROM_TEXT=0x0 31CONFIG_ZBOOT_ROM_TEXT=0x0
31CONFIG_ZBOOT_ROM_BSS=0x0 32CONFIG_ZBOOT_ROM_BSS=0x0
32CONFIG_CPU_FREQ=y 33CONFIG_CPU_FREQ=y
diff --git a/arch/arm/configs/koelsch_defconfig b/arch/arm/configs/koelsch_defconfig
index 825c16dee8a0..e248f49d5549 100644
--- a/arch/arm/configs/koelsch_defconfig
+++ b/arch/arm/configs/koelsch_defconfig
@@ -9,7 +9,7 @@ CONFIG_EMBEDDED=y
9CONFIG_PERF_EVENTS=y 9CONFIG_PERF_EVENTS=y
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11# CONFIG_BLOCK is not set 11# CONFIG_BLOCK is not set
12CONFIG_ARCH_SHMOBILE=y 12CONFIG_ARCH_SHMOBILE_LEGACY=y
13CONFIG_ARCH_R8A7791=y 13CONFIG_ARCH_R8A7791=y
14CONFIG_MACH_KOELSCH=y 14CONFIG_MACH_KOELSCH=y
15# CONFIG_SWP_EMULATE is not set 15# CONFIG_SWP_EMULATE is not set
@@ -29,7 +29,29 @@ CONFIG_VFP=y
29CONFIG_NEON=y 29CONFIG_NEON=y
30# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 30# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
31CONFIG_PM_RUNTIME=y 31CONFIG_PM_RUNTIME=y
32CONFIG_NET=y
33CONFIG_PACKET=y
34CONFIG_UNIX=y
35CONFIG_INET=y
36CONFIG_IP_PNP=y
37CONFIG_IP_PNP_DHCP=y
32CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 38CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
39CONFIG_NETDEVICES=y
40# CONFIG_NET_VENDOR_ARC is not set
41# CONFIG_NET_CADENCE is not set
42# CONFIG_NET_VENDOR_BROADCOM is not set
43# CONFIG_NET_VENDOR_CIRRUS is not set
44# CONFIG_NET_VENDOR_FARADAY is not set
45# CONFIG_NET_VENDOR_INTEL is not set
46# CONFIG_NET_VENDOR_MARVELL is not set
47# CONFIG_NET_VENDOR_MICREL is not set
48# CONFIG_NET_VENDOR_NATSEMI is not set
49CONFIG_SH_ETH=y
50# CONFIG_NET_VENDOR_SEEQ is not set
51# CONFIG_NET_VENDOR_SMSC is not set
52# CONFIG_NET_VENDOR_STMICRO is not set
53# CONFIG_NET_VENDOR_VIA is not set
54# CONFIG_NET_VENDOR_WIZNET is not set
33# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 55# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
34# CONFIG_INPUT_MOUSE is not set 56# CONFIG_INPUT_MOUSE is not set
35# CONFIG_LEGACY_PTYS is not set 57# CONFIG_LEGACY_PTYS is not set
@@ -45,10 +67,11 @@ CONFIG_NEW_LEDS=y
45CONFIG_LEDS_CLASS=y 67CONFIG_LEDS_CLASS=y
46# CONFIG_IOMMU_SUPPORT is not set 68# CONFIG_IOMMU_SUPPORT is not set
47# CONFIG_DNOTIFY is not set 69# CONFIG_DNOTIFY is not set
48# CONFIG_INOTIFY_USER is not set
49CONFIG_TMPFS=y 70CONFIG_TMPFS=y
50CONFIG_CONFIGFS_FS=y 71CONFIG_CONFIGFS_FS=y
51# CONFIG_MISC_FILESYSTEMS is not set 72# CONFIG_MISC_FILESYSTEMS is not set
73CONFIG_NFS_FS=y
74CONFIG_ROOT_NFS=y
52# CONFIG_ENABLE_WARN_DEPRECATED is not set 75# CONFIG_ENABLE_WARN_DEPRECATED is not set
53# CONFIG_ENABLE_MUST_CHECK is not set 76# CONFIG_ENABLE_MUST_CHECK is not set
54# CONFIG_ARM_UNWIND is not set 77# CONFIG_ARM_UNWIND is not set
diff --git a/arch/arm/configs/kzm9d_defconfig b/arch/arm/configs/kzm9d_defconfig
index 6c37f4a98eb8..e42ce3756af3 100644
--- a/arch/arm/configs/kzm9d_defconfig
+++ b/arch/arm/configs/kzm9d_defconfig
@@ -13,7 +13,7 @@ CONFIG_SLAB=y
13# CONFIG_BLK_DEV_BSG is not set 13# CONFIG_BLK_DEV_BSG is not set
14# CONFIG_IOSCHED_DEADLINE is not set 14# CONFIG_IOSCHED_DEADLINE is not set
15# CONFIG_IOSCHED_CFQ is not set 15# CONFIG_IOSCHED_CFQ is not set
16CONFIG_ARCH_SHMOBILE=y 16CONFIG_ARCH_SHMOBILE_LEGACY=y
17CONFIG_ARCH_EMEV2=y 17CONFIG_ARCH_EMEV2=y
18CONFIG_MACH_KZM9D=y 18CONFIG_MACH_KZM9D=y
19CONFIG_MEMORY_START=0x40000000 19CONFIG_MEMORY_START=0x40000000
@@ -32,6 +32,7 @@ CONFIG_FORCE_MAX_ZONEORDER=13
32CONFIG_ZBOOT_ROM_TEXT=0x0 32CONFIG_ZBOOT_ROM_TEXT=0x0
33CONFIG_ZBOOT_ROM_BSS=0x0 33CONFIG_ZBOOT_ROM_BSS=0x0
34CONFIG_ARM_APPENDED_DTB=y 34CONFIG_ARM_APPENDED_DTB=y
35CONFIG_AUTO_ZRELADDR=y
35CONFIG_VFP=y 36CONFIG_VFP=y
36# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 37# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
37CONFIG_PM_RUNTIME=y 38CONFIG_PM_RUNTIME=y
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
index 1ad028023a64..9934dbc23d64 100644
--- a/arch/arm/configs/kzm9g_defconfig
+++ b/arch/arm/configs/kzm9g_defconfig
@@ -22,7 +22,7 @@ CONFIG_MODULE_UNLOAD=y
22# CONFIG_BLK_DEV_BSG is not set 22# CONFIG_BLK_DEV_BSG is not set
23# CONFIG_IOSCHED_DEADLINE is not set 23# CONFIG_IOSCHED_DEADLINE is not set
24# CONFIG_IOSCHED_CFQ is not set 24# CONFIG_IOSCHED_CFQ is not set
25CONFIG_ARCH_SHMOBILE=y 25CONFIG_ARCH_SHMOBILE_LEGACY=y
26CONFIG_ARCH_SH73A0=y 26CONFIG_ARCH_SH73A0=y
27CONFIG_MACH_KZM9G=y 27CONFIG_MACH_KZM9G=y
28CONFIG_MEMORY_START=0x41000000 28CONFIG_MEMORY_START=0x41000000
diff --git a/arch/arm/configs/lager_defconfig b/arch/arm/configs/lager_defconfig
index 35bff5e0d57a..883443f8f4f3 100644
--- a/arch/arm/configs/lager_defconfig
+++ b/arch/arm/configs/lager_defconfig
@@ -12,7 +12,7 @@ CONFIG_SLAB=y
12# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
13# CONFIG_IOSCHED_DEADLINE is not set 13# CONFIG_IOSCHED_DEADLINE is not set
14# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
15CONFIG_ARCH_SHMOBILE=y 15CONFIG_ARCH_SHMOBILE_LEGACY=y
16CONFIG_ARCH_R8A7790=y 16CONFIG_ARCH_R8A7790=y
17CONFIG_MACH_LAGER=y 17CONFIG_MACH_LAGER=y
18# CONFIG_SH_TIMER_TMU is not set 18# CONFIG_SH_TIMER_TMU is not set
@@ -80,7 +80,7 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
80# CONFIG_HW_RANDOM is not set 80# CONFIG_HW_RANDOM is not set
81CONFIG_I2C=y 81CONFIG_I2C=y
82CONFIG_I2C_GPIO=y 82CONFIG_I2C_GPIO=y
83CONFIG_I2C_SH_MOBILE=y 83CONFIG_I2C_RCAR=y
84CONFIG_GPIO_SH_PFC=y 84CONFIG_GPIO_SH_PFC=y
85CONFIG_GPIOLIB=y 85CONFIG_GPIOLIB=y
86CONFIG_GPIO_RCAR=y 86CONFIG_GPIO_RCAR=y
@@ -89,6 +89,7 @@ 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_REGULATOR_GPIO=y
92CONFIG_DRM=y 93CONFIG_DRM=y
93CONFIG_DRM_RCAR_DU=y 94CONFIG_DRM_RCAR_DU=y
94# CONFIG_USB_SUPPORT is not set 95# CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/configs/mackerel_defconfig b/arch/arm/configs/mackerel_defconfig
index 9fb11895b2e2..a61e1653fc5e 100644
--- a/arch/arm/configs/mackerel_defconfig
+++ b/arch/arm/configs/mackerel_defconfig
@@ -14,7 +14,7 @@ CONFIG_MODULE_UNLOAD=y
14# CONFIG_BLK_DEV_BSG is not set 14# CONFIG_BLK_DEV_BSG is not set
15# CONFIG_IOSCHED_DEADLINE is not set 15# CONFIG_IOSCHED_DEADLINE is not set
16# CONFIG_IOSCHED_CFQ is not set 16# CONFIG_IOSCHED_CFQ is not set
17CONFIG_ARCH_SHMOBILE=y 17CONFIG_ARCH_SHMOBILE_LEGACY=y
18CONFIG_ARCH_SH7372=y 18CONFIG_ARCH_SH7372=y
19CONFIG_MACH_MACKEREL=y 19CONFIG_MACH_MACKEREL=y
20CONFIG_MEMORY_SIZE=0x10000000 20CONFIG_MEMORY_SIZE=0x10000000
diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
index 5cc6360340b1..f21bd405cc2a 100644
--- a/arch/arm/configs/marzen_defconfig
+++ b/arch/arm/configs/marzen_defconfig
@@ -9,7 +9,7 @@ CONFIG_SYSCTL_SYSCALL=y
9CONFIG_EMBEDDED=y 9CONFIG_EMBEDDED=y
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11# CONFIG_IOSCHED_CFQ is not set 11# CONFIG_IOSCHED_CFQ is not set
12CONFIG_ARCH_SHMOBILE=y 12CONFIG_ARCH_SHMOBILE_LEGACY=y
13CONFIG_ARCH_R8A7779=y 13CONFIG_ARCH_R8A7779=y
14CONFIG_MACH_MARZEN=y 14CONFIG_MACH_MARZEN=y
15CONFIG_MEMORY_START=0x60000000 15CONFIG_MEMORY_START=0x60000000
@@ -30,12 +30,12 @@ CONFIG_HIGHMEM=y
30CONFIG_ZBOOT_ROM_TEXT=0x0 30CONFIG_ZBOOT_ROM_TEXT=0x0
31CONFIG_ZBOOT_ROM_BSS=0x0 31CONFIG_ZBOOT_ROM_BSS=0x0
32CONFIG_ARM_APPENDED_DTB=y 32CONFIG_ARM_APPENDED_DTB=y
33CONFIG_CMDLINE="console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on" 33CONFIG_VFP=y
34CONFIG_CMDLINE_FORCE=y
35CONFIG_KEXEC=y 34CONFIG_KEXEC=y
36# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
37CONFIG_PM_RUNTIME=y 36CONFIG_PM_RUNTIME=y
38CONFIG_NET=y 37CONFIG_NET=y
38CONFIG_PACKET=y
39CONFIG_UNIX=y 39CONFIG_UNIX=y
40CONFIG_INET=y 40CONFIG_INET=y
41CONFIG_IP_PNP=y 41CONFIG_IP_PNP=y
@@ -43,8 +43,6 @@ CONFIG_IP_PNP_DHCP=y
43# CONFIG_IPV6 is not set 43# CONFIG_IPV6 is not set
44# CONFIG_WIRELESS is not set 44# CONFIG_WIRELESS is not set
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46CONFIG_DEVTMPFS=y
47CONFIG_DEVTMPFS_MOUNT=y
48# CONFIG_STANDALONE is not set 46# CONFIG_STANDALONE is not set
49# CONFIG_PREVENT_FIRMWARE_BUILD is not set 47# CONFIG_PREVENT_FIRMWARE_BUILD is not set
50# CONFIG_FW_LOADER is not set 48# CONFIG_FW_LOADER is not set
@@ -61,7 +59,6 @@ CONFIG_NETDEVICES=y
61# CONFIG_NET_VENDOR_MICREL is not set 59# CONFIG_NET_VENDOR_MICREL is not set
62# CONFIG_NET_VENDOR_NATSEMI is not set 60# CONFIG_NET_VENDOR_NATSEMI is not set
63# CONFIG_NET_VENDOR_SEEQ is not set 61# CONFIG_NET_VENDOR_SEEQ is not set
64CONFIG_SMC911X=y
65CONFIG_SMSC911X=y 62CONFIG_SMSC911X=y
66# CONFIG_NET_VENDOR_STMICRO is not set 63# CONFIG_NET_VENDOR_STMICRO is not set
67# CONFIG_WLAN is not set 64# CONFIG_WLAN is not set
@@ -106,11 +103,12 @@ CONFIG_USB_STORAGE=y
106CONFIG_NEW_LEDS=y 103CONFIG_NEW_LEDS=y
107CONFIG_LEDS_CLASS=y 104CONFIG_LEDS_CLASS=y
108CONFIG_LEDS_GPIO=y 105CONFIG_LEDS_GPIO=y
106CONFIG_DMADEVICES=y
107CONFIG_RCAR_HPB_DMAE=y
109CONFIG_UIO=y 108CONFIG_UIO=y
110CONFIG_UIO_PDRV_GENIRQ=y 109CONFIG_UIO_PDRV_GENIRQ=y
111# CONFIG_IOMMU_SUPPORT is not set 110# CONFIG_IOMMU_SUPPORT is not set
112# CONFIG_DNOTIFY is not set 111# CONFIG_DNOTIFY is not set
113# CONFIG_INOTIFY_USER is not set
114CONFIG_TMPFS=y 112CONFIG_TMPFS=y
115# CONFIG_MISC_FILESYSTEMS is not set 113# CONFIG_MISC_FILESYSTEMS is not set
116CONFIG_NFS_FS=y 114CONFIG_NFS_FS=y
diff --git a/arch/arm/configs/moxart_defconfig b/arch/arm/configs/moxart_defconfig
new file mode 100644
index 000000000000..a3cb76cfb828
--- /dev/null
+++ b/arch/arm/configs/moxart_defconfig
@@ -0,0 +1,149 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_NO_HZ=y
5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y
7CONFIG_SYSCTL_SYSCALL=y
8# CONFIG_ELF_CORE is not set
9# CONFIG_BASE_FULL is not set
10# CONFIG_SIGNALFD is not set
11# CONFIG_TIMERFD is not set
12# CONFIG_EVENTFD is not set
13# CONFIG_AIO is not set
14CONFIG_EMBEDDED=y
15# CONFIG_VM_EVENT_COUNTERS is not set
16# CONFIG_SLUB_DEBUG is not set
17# CONFIG_COMPAT_BRK is not set
18# CONFIG_LBDAF is not set
19# CONFIG_BLK_DEV_BSG is not set
20# CONFIG_IOSCHED_DEADLINE is not set
21CONFIG_ARCH_MULTI_V4T=y
22# CONFIG_ARCH_MULTI_V7 is not set
23CONFIG_KEYBOARD_GPIO_POLLED=y
24CONFIG_ARCH_MOXART=y
25CONFIG_MACH_UC7112LX=y
26CONFIG_PREEMPT=y
27CONFIG_AEABI=y
28# CONFIG_ATAGS is not set
29CONFIG_ARM_APPENDED_DTB=y
30CONFIG_NET=y
31CONFIG_PACKET=y
32CONFIG_UNIX=y
33CONFIG_INET=y
34CONFIG_IP_MULTICAST=y
35CONFIG_IP_PNP=y
36CONFIG_IP_PNP_DHCP=y
37# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
38# CONFIG_INET_XFRM_MODE_TUNNEL is not set
39# CONFIG_INET_XFRM_MODE_BEET is not set
40# CONFIG_INET_LRO is not set
41# CONFIG_INET_DIAG is not set
42# CONFIG_IPV6 is not set
43# CONFIG_WIRELESS is not set
44CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
45CONFIG_DEVTMPFS=y
46CONFIG_DEVTMPFS_MOUNT=y
47# CONFIG_PREVENT_FIRMWARE_BUILD is not set
48# CONFIG_FW_LOADER is not set
49CONFIG_MTD=y
50CONFIG_MTD_BLOCK=y
51CONFIG_MTD_CFI=y
52CONFIG_MTD_CFI_ADV_OPTIONS=y
53CONFIG_MTD_CFI_GEOMETRY=y
54CONFIG_MTD_CFI_INTELEXT=y
55CONFIG_MTD_COMPLEX_MAPPINGS=y
56CONFIG_MTD_PHYSMAP=y
57CONFIG_MTD_PHYSMAP_OF=y
58CONFIG_PROC_DEVICETREE=y
59CONFIG_NETDEVICES=y
60CONFIG_NETCONSOLE=y
61CONFIG_NETCONSOLE_DYNAMIC=y
62# CONFIG_NET_VENDOR_ARC is not set
63# CONFIG_NET_CADENCE is not set
64# CONFIG_NET_VENDOR_BROADCOM is not set
65# CONFIG_NET_VENDOR_CIRRUS is not set
66# CONFIG_NET_VENDOR_FARADAY is not set
67# CONFIG_NET_VENDOR_INTEL is not set
68# CONFIG_NET_VENDOR_MARVELL is not set
69# CONFIG_NET_VENDOR_MICREL is not set
70CONFIG_ARM_MOXART_ETHER=y
71# CONFIG_NET_VENDOR_NATSEMI is not set
72# CONFIG_NET_VENDOR_SEEQ is not set
73# CONFIG_NET_VENDOR_SMSC is not set
74# CONFIG_NET_VENDOR_STMICRO is not set
75# CONFIG_NET_VENDOR_VIA is not set
76# CONFIG_NET_VENDOR_WIZNET is not set
77CONFIG_REALTEK_PHY=y
78CONFIG_MDIO_MOXART=y
79# CONFIG_WLAN is not set
80# CONFIG_INPUT_MOUSEDEV is not set
81CONFIG_INPUT_EVDEV=y
82CONFIG_INPUT_EVBUG=y
83# CONFIG_KEYBOARD_ATKBD is not set
84# CONFIG_INPUT_MOUSE is not set
85# CONFIG_SERIO is not set
86# CONFIG_VT is not set
87# CONFIG_LEGACY_PTYS is not set
88# CONFIG_DEVKMEM is not set
89CONFIG_SERIAL_8250=y
90CONFIG_SERIAL_8250_CONSOLE=y
91CONFIG_SERIAL_8250_NR_UARTS=1
92CONFIG_SERIAL_8250_RUNTIME_UARTS=1
93CONFIG_SERIAL_8250_EXTENDED=y
94CONFIG_SERIAL_8250_SHARE_IRQ=y
95CONFIG_SERIAL_OF_PLATFORM=y
96# CONFIG_HW_RANDOM is not set
97CONFIG_DEBUG_GPIO=y
98CONFIG_GPIO_SYSFS=y
99CONFIG_GPIO_MOXART=y
100CONFIG_POWER_SUPPLY=y
101CONFIG_POWER_RESET=y
102CONFIG_POWER_RESET_GPIO=y
103# CONFIG_HWMON is not set
104CONFIG_WATCHDOG=y
105CONFIG_WATCHDOG_CORE=y
106CONFIG_WATCHDOG_NOWAYOUT=y
107CONFIG_MOXART_WDT=y
108# CONFIG_USB_SUPPORT is not set
109CONFIG_MMC=y
110CONFIG_MMC_SDHCI_MOXART=y
111CONFIG_NEW_LEDS=y
112CONFIG_LEDS_CLASS=y
113CONFIG_LEDS_GPIO=y
114CONFIG_LEDS_TRIGGER_TIMER=y
115CONFIG_LEDS_TRIGGER_ONESHOT=y
116CONFIG_LEDS_TRIGGER_HEARTBEAT=y
117CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
118CONFIG_RTC_CLASS=y
119CONFIG_RTC_DRV_MOXART=y
120CONFIG_DMADEVICES=y
121CONFIG_MOXART_DMA=y
122# CONFIG_IOMMU_SUPPORT is not set
123CONFIG_EXT3_FS=y
124CONFIG_TMPFS=y
125CONFIG_CONFIGFS_FS=y
126CONFIG_JFFS2_FS=y
127CONFIG_PRINTK_TIME=y
128CONFIG_DEBUG_INFO=y
129# CONFIG_ENABLE_WARN_DEPRECATED is not set
130# CONFIG_ENABLE_MUST_CHECK is not set
131CONFIG_DEBUG_PAGEALLOC=y
132CONFIG_DEBUG_OBJECTS=y
133CONFIG_DEBUG_KMEMLEAK=y
134CONFIG_DEBUG_STACK_USAGE=y
135CONFIG_DEBUG_MEMORY_INIT=y
136CONFIG_DEBUG_SHIRQ=y
137CONFIG_DETECT_HUNG_TASK=y
138# CONFIG_SCHED_DEBUG is not set
139# CONFIG_DEBUG_PREEMPT is not set
140CONFIG_PROVE_LOCKING=y
141CONFIG_DMA_API_DEBUG=y
142CONFIG_KGDB=y
143CONFIG_DEBUG_LL=y
144CONFIG_DEBUG_LL_UART_8250=y
145CONFIG_DEBUG_UART_PHYS=0x98200000
146CONFIG_DEBUG_UART_VIRT=0xf9820000
147CONFIG_EARLY_PRINTK=y
148CONFIG_KEYS=y
149CONFIG_CRC32_BIT=y
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index 690b5f9c7462..c5858b9eb516 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -17,9 +17,10 @@ CONFIG_MODULE_UNLOAD=y
17CONFIG_MODULE_FORCE_UNLOAD=y 17CONFIG_MODULE_FORCE_UNLOAD=y
18CONFIG_MODVERSIONS=y 18CONFIG_MODVERSIONS=y
19CONFIG_PARTITION_ADVANCED=y 19CONFIG_PARTITION_ADVANCED=y
20CONFIG_ARCH_MSM=y 20CONFIG_ARCH_MSM_DT=y
21CONFIG_ARCH_MSM8X60=y 21CONFIG_ARCH_MSM8X60=y
22CONFIG_ARCH_MSM8960=y 22CONFIG_ARCH_MSM8960=y
23CONFIG_ARCH_MSM8974=y
23CONFIG_SMP=y 24CONFIG_SMP=y
24CONFIG_PREEMPT=y 25CONFIG_PREEMPT=y
25CONFIG_AEABI=y 26CONFIG_AEABI=y
@@ -29,7 +30,6 @@ CONFIG_CLEANCACHE=y
29CONFIG_CC_STACKPROTECTOR=y 30CONFIG_CC_STACKPROTECTOR=y
30CONFIG_ARM_APPENDED_DTB=y 31CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y 32CONFIG_ARM_ATAG_DTB_COMPAT=y
32CONFIG_AUTO_ZRELADDR=y
33CONFIG_VFP=y 33CONFIG_VFP=y
34CONFIG_NEON=y 34CONFIG_NEON=y
35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
@@ -62,7 +62,6 @@ CONFIG_SCSI_LOGGING=y
62CONFIG_SCSI_SCAN_ASYNC=y 62CONFIG_SCSI_SCAN_ASYNC=y
63CONFIG_NETDEVICES=y 63CONFIG_NETDEVICES=y
64CONFIG_DUMMY=y 64CONFIG_DUMMY=y
65CONFIG_PHYLIB=y
66CONFIG_SLIP=y 65CONFIG_SLIP=y
67CONFIG_SLIP_COMPRESSED=y 66CONFIG_SLIP_COMPRESSED=y
68CONFIG_SLIP_MODE_SLIP6=y 67CONFIG_SLIP_MODE_SLIP6=y
@@ -81,13 +80,15 @@ CONFIG_SERIO_LIBPS2=y
81CONFIG_SERIAL_MSM=y 80CONFIG_SERIAL_MSM=y
82CONFIG_SERIAL_MSM_CONSOLE=y 81CONFIG_SERIAL_MSM_CONSOLE=y
83CONFIG_HW_RANDOM=y 82CONFIG_HW_RANDOM=y
83CONFIG_HW_RANDOM_MSM=y
84CONFIG_I2C=y 84CONFIG_I2C=y
85CONFIG_I2C_CHARDEV=y 85CONFIG_I2C_CHARDEV=y
86CONFIG_SPI=y 86CONFIG_SPI=y
87CONFIG_SSBI=y
88CONFIG_DEBUG_GPIO=y 87CONFIG_DEBUG_GPIO=y
89CONFIG_GPIO_SYSFS=y 88CONFIG_GPIO_SYSFS=y
90CONFIG_POWER_SUPPLY=y 89CONFIG_POWER_SUPPLY=y
90CONFIG_POWER_RESET=y
91CONFIG_POWER_RESET_MSM=y
91CONFIG_THERMAL=y 92CONFIG_THERMAL=y
92CONFIG_REGULATOR=y 93CONFIG_REGULATOR=y
93CONFIG_MEDIA_SUPPORT=y 94CONFIG_MEDIA_SUPPORT=y
@@ -101,7 +102,6 @@ CONFIG_SND_DYNAMIC_MINORS=y
101CONFIG_SND_SOC=y 102CONFIG_SND_SOC=y
102CONFIG_HID_BATTERY_STRENGTH=y 103CONFIG_HID_BATTERY_STRENGTH=y
103CONFIG_USB=y 104CONFIG_USB=y
104CONFIG_USB_PHY=y
105CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 105CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
106CONFIG_USB_MON=y 106CONFIG_USB_MON=y
107CONFIG_USB_EHCI_HCD=y 107CONFIG_USB_EHCI_HCD=y
@@ -114,6 +114,10 @@ CONFIG_USB_GADGET_VBUS_DRAW=500
114CONFIG_NEW_LEDS=y 114CONFIG_NEW_LEDS=y
115CONFIG_RTC_CLASS=y 115CONFIG_RTC_CLASS=y
116CONFIG_STAGING=y 116CONFIG_STAGING=y
117CONFIG_COMMON_CLK_QCOM=y
118CONFIG_MSM_GCC_8660=y
119CONFIG_MSM_MMCC_8960=y
120CONFIG_MSM_MMCC_8974=y
117CONFIG_MSM_IOMMU=y 121CONFIG_MSM_IOMMU=y
118CONFIG_EXT2_FS=y 122CONFIG_EXT2_FS=y
119CONFIG_EXT2_FS_XATTR=y 123CONFIG_EXT2_FS_XATTR=y
@@ -128,10 +132,10 @@ CONFIG_NFS_V3_ACL=y
128CONFIG_NFS_V4=y 132CONFIG_NFS_V4=y
129CONFIG_CIFS=y 133CONFIG_CIFS=y
130CONFIG_PRINTK_TIME=y 134CONFIG_PRINTK_TIME=y
135CONFIG_DYNAMIC_DEBUG=y
136CONFIG_DEBUG_INFO=y
131CONFIG_MAGIC_SYSRQ=y 137CONFIG_MAGIC_SYSRQ=y
132CONFIG_LOCKUP_DETECTOR=y 138CONFIG_LOCKUP_DETECTOR=y
133# CONFIG_DETECT_HUNG_TASK is not set 139# CONFIG_DETECT_HUNG_TASK is not set
134# CONFIG_SCHED_DEBUG is not set 140# CONFIG_SCHED_DEBUG is not set
135CONFIG_TIMER_STATS=y 141CONFIG_TIMER_STATS=y
136CONFIG_DEBUG_INFO=y
137CONFIG_DYNAMIC_DEBUG=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index c1df4e9db140..845bc745706b 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -1,14 +1,23 @@
1CONFIG_SYSVIPC=y
1CONFIG_IRQ_DOMAIN_DEBUG=y 2CONFIG_IRQ_DOMAIN_DEBUG=y
2CONFIG_NO_HZ=y 3CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 4CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y
7CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y
9CONFIG_PARTITION_ADVANCED=y
5CONFIG_ARCH_MVEBU=y 10CONFIG_ARCH_MVEBU=y
6CONFIG_MACH_ARMADA_370=y 11CONFIG_MACH_ARMADA_370=y
7CONFIG_MACH_ARMADA_XP=y 12CONFIG_MACH_ARMADA_XP=y
8CONFIG_ARCH_BCM=y 13CONFIG_ARCH_BCM=y
9CONFIG_ARCH_BCM_MOBILE=y 14CONFIG_ARCH_BCM_MOBILE=y
15CONFIG_ARCH_BERLIN=y
16CONFIG_MACH_BERLIN_BG2=y
17CONFIG_MACH_BERLIN_BG2CD=y
10CONFIG_GPIO_PCA953X=y 18CONFIG_GPIO_PCA953X=y
11CONFIG_ARCH_HIGHBANK=y 19CONFIG_ARCH_HIGHBANK=y
20CONFIG_ARCH_HI3xxx=y
12CONFIG_ARCH_KEYSTONE=y 21CONFIG_ARCH_KEYSTONE=y
13CONFIG_ARCH_MXC=y 22CONFIG_ARCH_MXC=y
14CONFIG_MACH_IMX51_DT=y 23CONFIG_MACH_IMX51_DT=y
@@ -34,7 +43,7 @@ CONFIG_ARCH_TEGRA=y
34CONFIG_ARCH_TEGRA_2x_SOC=y 43CONFIG_ARCH_TEGRA_2x_SOC=y
35CONFIG_ARCH_TEGRA_3x_SOC=y 44CONFIG_ARCH_TEGRA_3x_SOC=y
36CONFIG_ARCH_TEGRA_114_SOC=y 45CONFIG_ARCH_TEGRA_114_SOC=y
37CONFIG_TEGRA_PCI=y 46CONFIG_ARCH_TEGRA_124_SOC=y
38CONFIG_TEGRA_EMC_SCALING_ENABLE=y 47CONFIG_TEGRA_EMC_SCALING_ENABLE=y
39CONFIG_ARCH_U8500=y 48CONFIG_ARCH_U8500=y
40CONFIG_MACH_HREFV60=y 49CONFIG_MACH_HREFV60=y
@@ -45,19 +54,55 @@ CONFIG_ARCH_VEXPRESS_CA9X4=y
45CONFIG_ARCH_VIRT=y 54CONFIG_ARCH_VIRT=y
46CONFIG_ARCH_WM8850=y 55CONFIG_ARCH_WM8850=y
47CONFIG_ARCH_ZYNQ=y 56CONFIG_ARCH_ZYNQ=y
57CONFIG_TRUSTED_FOUNDATIONS=y
58CONFIG_PCI=y
59CONFIG_PCI_MSI=y
60CONFIG_PCI_MVEBU=y
61CONFIG_PCI_TEGRA=y
48CONFIG_SMP=y 62CONFIG_SMP=y
49CONFIG_HIGHPTE=y 63CONFIG_HIGHPTE=y
64CONFIG_CMA=y
50CONFIG_ARM_APPENDED_DTB=y 65CONFIG_ARM_APPENDED_DTB=y
51CONFIG_ARM_ATAG_DTB_COMPAT=y 66CONFIG_ARM_ATAG_DTB_COMPAT=y
67CONFIG_KEXEC=y
68CONFIG_CPU_FREQ=y
69CONFIG_CPU_FREQ_STAT_DETAILS=y
70CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
71CONFIG_CPU_IDLE=y
52CONFIG_NET=y 72CONFIG_NET=y
73CONFIG_PACKET=y
53CONFIG_UNIX=y 74CONFIG_UNIX=y
54CONFIG_INET=y 75CONFIG_INET=y
55CONFIG_IP_PNP=y 76CONFIG_IP_PNP=y
56CONFIG_IP_PNP_DHCP=y 77CONFIG_IP_PNP_DHCP=y
78CONFIG_IP_PNP_BOOTP=y
79CONFIG_IP_PNP_RARP=y
80CONFIG_IPV6_ROUTER_PREF=y
81CONFIG_IPV6_OPTIMISTIC_DAD=y
82CONFIG_INET6_AH=m
83CONFIG_INET6_ESP=m
84CONFIG_INET6_IPCOMP=m
85CONFIG_IPV6_MIP6=m
86CONFIG_IPV6_TUNNEL=m
87CONFIG_IPV6_MULTIPLE_TABLES=y
88CONFIG_CFG80211=m
89CONFIG_MAC80211=m
90CONFIG_RFKILL=y
91CONFIG_RFKILL_INPUT=y
92CONFIG_RFKILL_GPIO=y
57CONFIG_DEVTMPFS=y 93CONFIG_DEVTMPFS=y
58CONFIG_DEVTMPFS_MOUNT=y 94CONFIG_DEVTMPFS_MOUNT=y
95CONFIG_DMA_CMA=y
59CONFIG_OMAP_OCP2SCP=y 96CONFIG_OMAP_OCP2SCP=y
97CONFIG_MTD=y
98CONFIG_MTD_M25P80=y
99CONFIG_BLK_DEV_LOOP=y
100CONFIG_ICS932S401=y
101CONFIG_APDS9802ALS=y
102CONFIG_ISL29003=y
60CONFIG_BLK_DEV_SD=y 103CONFIG_BLK_DEV_SD=y
104CONFIG_BLK_DEV_SR=y
105CONFIG_SCSI_MULTI_LUN=y
61CONFIG_ATA=y 106CONFIG_ATA=y
62CONFIG_SATA_AHCI_PLATFORM=y 107CONFIG_SATA_AHCI_PLATFORM=y
63CONFIG_SATA_HIGHBANK=y 108CONFIG_SATA_HIGHBANK=y
@@ -65,12 +110,30 @@ CONFIG_SATA_MV=y
65CONFIG_NETDEVICES=y 110CONFIG_NETDEVICES=y
66CONFIG_SUN4I_EMAC=y 111CONFIG_SUN4I_EMAC=y
67CONFIG_NET_CALXEDA_XGMAC=y 112CONFIG_NET_CALXEDA_XGMAC=y
113CONFIG_MVNETA=y
68CONFIG_KS8851=y 114CONFIG_KS8851=y
115CONFIG_R8169=y
69CONFIG_SMSC911X=y 116CONFIG_SMSC911X=y
70CONFIG_STMMAC_ETH=y 117CONFIG_STMMAC_ETH=y
71CONFIG_MDIO_SUN4I=y
72CONFIG_TI_CPSW=y 118CONFIG_TI_CPSW=y
119CONFIG_AT803X_PHY=y
120CONFIG_MARVELL_PHY=y
121CONFIG_ICPLUS_PHY=y
122CONFIG_USB_PEGASUS=y
123CONFIG_USB_USBNET=y
124CONFIG_USB_NET_SMSC75XX=y
125CONFIG_USB_NET_SMSC95XX=y
126CONFIG_BRCMFMAC=m
127CONFIG_RT2X00=m
128CONFIG_RT2800USB=m
129CONFIG_INPUT_EVDEV=y
130CONFIG_KEYBOARD_GPIO=y
131CONFIG_KEYBOARD_TEGRA=y
73CONFIG_KEYBOARD_SPEAR=y 132CONFIG_KEYBOARD_SPEAR=y
133CONFIG_KEYBOARD_CROS_EC=y
134CONFIG_MOUSE_PS2_ELANTECH=y
135CONFIG_INPUT_MISC=y
136CONFIG_INPUT_MPU3050=y
74CONFIG_SERIO_AMBAKMI=y 137CONFIG_SERIO_AMBAKMI=y
75CONFIG_SERIAL_8250=y 138CONFIG_SERIAL_8250=y
76CONFIG_SERIAL_8250_CONSOLE=y 139CONFIG_SERIAL_8250_CONSOLE=y
@@ -91,30 +154,83 @@ CONFIG_SERIAL_XILINX_PS_UART=y
91CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y 154CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
92CONFIG_SERIAL_FSL_LPUART=y 155CONFIG_SERIAL_FSL_LPUART=y
93CONFIG_SERIAL_FSL_LPUART_CONSOLE=y 156CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
157CONFIG_SERIAL_ST_ASC=y
158CONFIG_SERIAL_ST_ASC_CONSOLE=y
159CONFIG_I2C_CHARDEV=y
160CONFIG_I2C_MUX=y
161CONFIG_I2C_MUX_PINCTRL=y
94CONFIG_I2C_DESIGNWARE_PLATFORM=y 162CONFIG_I2C_DESIGNWARE_PLATFORM=y
163CONFIG_I2C_MV64XXX=y
95CONFIG_I2C_SIRF=y 164CONFIG_I2C_SIRF=y
96CONFIG_I2C_TEGRA=y 165CONFIG_I2C_TEGRA=y
97CONFIG_SPI=y 166CONFIG_SPI=y
98CONFIG_SPI_OMAP24XX=y 167CONFIG_SPI_OMAP24XX=y
168CONFIG_SPI_ORION=y
99CONFIG_SPI_PL022=y 169CONFIG_SPI_PL022=y
100CONFIG_SPI_SIRF=y 170CONFIG_SPI_SIRF=y
101CONFIG_SPI_TEGRA114=y 171CONFIG_SPI_TEGRA114=y
172CONFIG_SPI_TEGRA20_SFLASH=y
102CONFIG_SPI_TEGRA20_SLINK=y 173CONFIG_SPI_TEGRA20_SLINK=y
103CONFIG_PINCTRL_SINGLE=y 174CONFIG_PINCTRL_AS3722=y
175CONFIG_PINCTRL_PALMAS=y
176CONFIG_GPIO_SYSFS=y
104CONFIG_GPIO_GENERIC_PLATFORM=y 177CONFIG_GPIO_GENERIC_PLATFORM=y
178CONFIG_GPIO_PCA953X_IRQ=y
105CONFIG_GPIO_TWL4030=y 179CONFIG_GPIO_TWL4030=y
106CONFIG_REGULATOR_GPIO=y 180CONFIG_GPIO_PALMAS=y
181CONFIG_GPIO_TPS6586X=y
182CONFIG_GPIO_TPS65910=y
183CONFIG_BATTERY_SBS=y
184CONFIG_CHARGER_TPS65090=y
185CONFIG_POWER_RESET_AS3722=y
186CONFIG_POWER_RESET_GPIO=y
187CONFIG_SENSORS_LM90=y
188CONFIG_THERMAL=y
189CONFIG_ARMADA_THERMAL=y
190CONFIG_MFD_AS3722=y
191CONFIG_MFD_CROS_EC=y
192CONFIG_MFD_CROS_EC_SPI=y
193CONFIG_MFD_MAX8907=y
194CONFIG_MFD_PALMAS=y
195CONFIG_MFD_TPS65090=y
196CONFIG_MFD_TPS6586X=y
197CONFIG_MFD_TPS65910=y
198CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
107CONFIG_REGULATOR_AB8500=y 199CONFIG_REGULATOR_AB8500=y
200CONFIG_REGULATOR_AS3722=y
201CONFIG_REGULATOR_GPIO=y
202CONFIG_REGULATOR_MAX8907=y
203CONFIG_REGULATOR_PALMAS=y
108CONFIG_REGULATOR_TPS51632=y 204CONFIG_REGULATOR_TPS51632=y
109CONFIG_REGULATOR_TPS62360=y 205CONFIG_REGULATOR_TPS62360=y
206CONFIG_REGULATOR_TPS65090=y
207CONFIG_REGULATOR_TPS6586X=y
208CONFIG_REGULATOR_TPS65910=y
110CONFIG_REGULATOR_TWL4030=y 209CONFIG_REGULATOR_TWL4030=y
111CONFIG_REGULATOR_VEXPRESS=y 210CONFIG_REGULATOR_VEXPRESS=y
211CONFIG_MEDIA_SUPPORT=y
212CONFIG_MEDIA_CAMERA_SUPPORT=y
213CONFIG_MEDIA_USB_SUPPORT=y
112CONFIG_DRM=y 214CONFIG_DRM=y
113CONFIG_TEGRA_HOST1X=y
114CONFIG_DRM_TEGRA=y 215CONFIG_DRM_TEGRA=y
216CONFIG_DRM_PANEL_SIMPLE=y
115CONFIG_FB_ARMCLCD=y 217CONFIG_FB_ARMCLCD=y
116CONFIG_FB_WM8505=y 218CONFIG_FB_WM8505=y
117CONFIG_FB_SIMPLE=y 219CONFIG_FB_SIMPLE=y
220CONFIG_BACKLIGHT_LCD_SUPPORT=y
221CONFIG_BACKLIGHT_CLASS_DEVICE=y
222CONFIG_BACKLIGHT_PWM=y
223CONFIG_FRAMEBUFFER_CONSOLE=y
224CONFIG_SOUND=y
225CONFIG_SND=y
226CONFIG_SND_SOC=y
227CONFIG_SND_SOC_TEGRA=y
228CONFIG_SND_SOC_TEGRA_RT5640=y
229CONFIG_SND_SOC_TEGRA_WM8753=y
230CONFIG_SND_SOC_TEGRA_WM8903=y
231CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
232CONFIG_SND_SOC_TEGRA_ALC5632=y
233CONFIG_SND_SOC_TEGRA_MAX98090=y
118CONFIG_USB=y 234CONFIG_USB=y
119CONFIG_USB_XHCI_HCD=y 235CONFIG_USB_XHCI_HCD=y
120CONFIG_USB_EHCI_HCD=y 236CONFIG_USB_EHCI_HCD=y
@@ -125,8 +241,6 @@ CONFIG_USB_STORAGE=y
125CONFIG_USB_CHIPIDEA=y 241CONFIG_USB_CHIPIDEA=y
126CONFIG_USB_CHIPIDEA_HOST=y 242CONFIG_USB_CHIPIDEA_HOST=y
127CONFIG_AB8500_USB=y 243CONFIG_AB8500_USB=y
128CONFIG_NOP_USB_XCEIV=y
129CONFIG_OMAP_USB2=y
130CONFIG_OMAP_USB3=y 244CONFIG_OMAP_USB3=y
131CONFIG_SAMSUNG_USB2PHY=y 245CONFIG_SAMSUNG_USB2PHY=y
132CONFIG_SAMSUNG_USB3PHY=y 246CONFIG_SAMSUNG_USB3PHY=y
@@ -137,24 +251,32 @@ CONFIG_MMC=y
137CONFIG_MMC_BLOCK_MINORS=16 251CONFIG_MMC_BLOCK_MINORS=16
138CONFIG_MMC_ARMMMCI=y 252CONFIG_MMC_ARMMMCI=y
139CONFIG_MMC_SDHCI=y 253CONFIG_MMC_SDHCI=y
140CONFIG_MMC_SDHCI_PLTFM=y
141CONFIG_MMC_SDHCI_ESDHC_IMX=y 254CONFIG_MMC_SDHCI_ESDHC_IMX=y
142CONFIG_MMC_SDHCI_TEGRA=y 255CONFIG_MMC_SDHCI_TEGRA=y
143CONFIG_MMC_SDHCI_SPEAR=y 256CONFIG_MMC_SDHCI_SPEAR=y
144CONFIG_MMC_SDHCI_BCM_KONA=y 257CONFIG_MMC_SDHCI_BCM_KONA=y
145CONFIG_MMC_OMAP=y 258CONFIG_MMC_OMAP=y
146CONFIG_MMC_OMAP_HS=y 259CONFIG_MMC_OMAP_HS=y
260CONFIG_MMC_MVSDIO=y
147CONFIG_EDAC=y 261CONFIG_EDAC=y
148CONFIG_EDAC_MM_EDAC=y 262CONFIG_EDAC_MM_EDAC=y
149CONFIG_EDAC_HIGHBANK_MC=y 263CONFIG_EDAC_HIGHBANK_MC=y
150CONFIG_EDAC_HIGHBANK_L2=y 264CONFIG_EDAC_HIGHBANK_L2=y
151CONFIG_RTC_CLASS=y 265CONFIG_RTC_CLASS=y
266CONFIG_RTC_DRV_AS3722=y
267CONFIG_RTC_DRV_MAX8907=y
268CONFIG_RTC_DRV_PALMAS=y
152CONFIG_RTC_DRV_TWL4030=y 269CONFIG_RTC_DRV_TWL4030=y
270CONFIG_RTC_DRV_TPS6586X=y
271CONFIG_RTC_DRV_TPS65910=y
272CONFIG_RTC_DRV_EM3027=y
153CONFIG_RTC_DRV_PL031=y 273CONFIG_RTC_DRV_PL031=y
154CONFIG_RTC_DRV_VT8500=y 274CONFIG_RTC_DRV_VT8500=y
275CONFIG_RTC_DRV_MV=y
155CONFIG_RTC_DRV_TEGRA=y 276CONFIG_RTC_DRV_TEGRA=y
156CONFIG_DMADEVICES=y 277CONFIG_DMADEVICES=y
157CONFIG_DW_DMAC=y 278CONFIG_DW_DMAC=y
279CONFIG_MV_XOR=y
158CONFIG_TEGRA20_APB_DMA=y 280CONFIG_TEGRA20_APB_DMA=y
159CONFIG_STE_DMA40=y 281CONFIG_STE_DMA40=y
160CONFIG_SIRF_DMA=y 282CONFIG_SIRF_DMA=y
@@ -164,15 +286,34 @@ CONFIG_IMX_SDMA=y
164CONFIG_IMX_DMA=y 286CONFIG_IMX_DMA=y
165CONFIG_MXS_DMA=y 287CONFIG_MXS_DMA=y
166CONFIG_DMA_OMAP=y 288CONFIG_DMA_OMAP=y
289CONFIG_STAGING=y
290CONFIG_SENSORS_ISL29018=y
291CONFIG_SENSORS_ISL29028=y
292CONFIG_MFD_NVEC=y
293CONFIG_KEYBOARD_NVEC=y
294CONFIG_SERIO_NVEC_PS2=y
295CONFIG_NVEC_POWER=y
296CONFIG_TEGRA_IOMMU_GART=y
297CONFIG_TEGRA_IOMMU_SMMU=y
298CONFIG_MEMORY=y
299CONFIG_IIO=y
300CONFIG_AK8975=y
167CONFIG_PWM=y 301CONFIG_PWM=y
302CONFIG_PWM_TEGRA=y
168CONFIG_PWM_VT8500=y 303CONFIG_PWM_VT8500=y
304CONFIG_OMAP_USB2=y
169CONFIG_EXT4_FS=y 305CONFIG_EXT4_FS=y
306CONFIG_VFAT_FS=y
170CONFIG_TMPFS=y 307CONFIG_TMPFS=y
308CONFIG_SQUASHFS=y
309CONFIG_SQUASHFS_LZO=y
310CONFIG_SQUASHFS_XZ=y
171CONFIG_NFS_FS=y 311CONFIG_NFS_FS=y
172CONFIG_NFS_V3_ACL=y 312CONFIG_NFS_V3_ACL=y
173CONFIG_NFS_V4=y 313CONFIG_NFS_V4=y
174CONFIG_ROOT_NFS=y 314CONFIG_ROOT_NFS=y
175CONFIG_PRINTK_TIME=y 315CONFIG_PRINTK_TIME=y
176CONFIG_DEBUG_FS=y 316CONFIG_DEBUG_FS=y
177CONFIG_DEBUG_KERNEL=y 317CONFIG_MAGIC_SYSRQ=y
178CONFIG_LOCKUP_DETECTOR=y 318CONFIG_LOCKUP_DETECTOR=y
319CONFIG_CRYPTO_DEV_TEGRA_AES=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 594d706b641f..0f4511d2849f 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -55,6 +55,8 @@ CONFIG_MTD_CFI_INTELEXT=y
55CONFIG_MTD_CFI_AMDSTD=y 55CONFIG_MTD_CFI_AMDSTD=y
56CONFIG_MTD_CFI_STAA=y 56CONFIG_MTD_CFI_STAA=y
57CONFIG_MTD_PHYSMAP_OF=y 57CONFIG_MTD_PHYSMAP_OF=y
58CONFIG_MTD_NAND=y
59CONFIG_MTD_NAND_PXA3xx=y
58CONFIG_SERIAL_8250_DW=y 60CONFIG_SERIAL_8250_DW=y
59CONFIG_GPIOLIB=y 61CONFIG_GPIOLIB=y
60CONFIG_GPIO_SYSFS=y 62CONFIG_GPIO_SYSFS=y
@@ -69,6 +71,7 @@ CONFIG_USB_XHCI_HCD=y
69CONFIG_MMC=y 71CONFIG_MMC=y
70CONFIG_MMC_MVSDIO=y 72CONFIG_MMC_MVSDIO=y
71CONFIG_NEW_LEDS=y 73CONFIG_NEW_LEDS=y
74CONFIG_LEDS_GPIO=y
72CONFIG_LEDS_CLASS=m 75CONFIG_LEDS_CLASS=m
73CONFIG_LEDS_TRIGGERS=y 76CONFIG_LEDS_TRIGGERS=y
74CONFIG_LEDS_TRIGGER_TIMER=y 77CONFIG_LEDS_TRIGGER_TIMER=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index bfa80a11e8c7..3a0b53d225e7 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -208,6 +208,8 @@ CONFIG_SND_DEBUG=y
208CONFIG_SND_USB_AUDIO=m 208CONFIG_SND_USB_AUDIO=m
209CONFIG_SND_SOC=m 209CONFIG_SND_SOC=m
210CONFIG_SND_OMAP_SOC=m 210CONFIG_SND_OMAP_SOC=m
211CONFIG_SND_AM33XX_SOC_EVM=m
212CONFIG_SND_DAVINCI_SOC=m
211CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m 213CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m
212CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m 214CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m
213CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m 215CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
@@ -222,6 +224,7 @@ CONFIG_USB_TEST=y
222CONFIG_NOP_USB_XCEIV=y 224CONFIG_NOP_USB_XCEIV=y
223CONFIG_OMAP_USB2=y 225CONFIG_OMAP_USB2=y
224CONFIG_OMAP_USB3=y 226CONFIG_OMAP_USB3=y
227CONFIG_AM335X_PHY_USB=y
225CONFIG_USB_GADGET=y 228CONFIG_USB_GADGET=y
226CONFIG_USB_GADGET_DEBUG=y 229CONFIG_USB_GADGET_DEBUG=y
227CONFIG_USB_GADGET_DEBUG_FILES=y 230CONFIG_USB_GADGET_DEBUG_FILES=y
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index f6e78f83c3c3..dc3881e07630 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y
20CONFIG_SOC_SAM_V7=y 20CONFIG_SOC_SAM_V7=y
21CONFIG_SOC_SAMA5D3=y 21CONFIG_SOC_SAMA5D3=y
22CONFIG_MACH_SAMA5_DT=y 22CONFIG_MACH_SAMA5_DT=y
23CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
24CONFIG_AEABI=y 23CONFIG_AEABI=y
25# CONFIG_OABI_COMPAT is not set 24# CONFIG_OABI_COMPAT is not set
26CONFIG_UACCESS_WITH_MEMCPY=y 25CONFIG_UACCESS_WITH_MEMCPY=y
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 4934295bb4f0..00fe9e9710fd 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -29,6 +29,7 @@ CONFIG_ARCH_TEGRA_3x_SOC=y
29CONFIG_ARCH_TEGRA_114_SOC=y 29CONFIG_ARCH_TEGRA_114_SOC=y
30CONFIG_ARCH_TEGRA_124_SOC=y 30CONFIG_ARCH_TEGRA_124_SOC=y
31CONFIG_TEGRA_EMC_SCALING_ENABLE=y 31CONFIG_TEGRA_EMC_SCALING_ENABLE=y
32CONFIG_TRUSTED_FOUNDATIONS=y
32CONFIG_PCI=y 33CONFIG_PCI=y
33CONFIG_PCI_MSI=y 34CONFIG_PCI_MSI=y
34CONFIG_PCI_TEGRA=y 35CONFIG_PCI_TEGRA=y
@@ -36,8 +37,8 @@ CONFIG_PCIEPORTBUS=y
36CONFIG_SMP=y 37CONFIG_SMP=y
37CONFIG_PREEMPT=y 38CONFIG_PREEMPT=y
38CONFIG_AEABI=y 39CONFIG_AEABI=y
39# CONFIG_OABI_COMPAT is not set
40CONFIG_HIGHMEM=y 40CONFIG_HIGHMEM=y
41CONFIG_CMA=y
41CONFIG_ZBOOT_ROM_TEXT=0x0 42CONFIG_ZBOOT_ROM_TEXT=0x0
42CONFIG_ZBOOT_ROM_BSS=0x0 43CONFIG_ZBOOT_ROM_BSS=0x0
43CONFIG_KEXEC=y 44CONFIG_KEXEC=y
@@ -63,7 +64,6 @@ CONFIG_INET_ESP=y
63# CONFIG_INET_LRO is not set 64# CONFIG_INET_LRO is not set
64# CONFIG_INET_DIAG is not set 65# CONFIG_INET_DIAG is not set
65CONFIG_IPV6=y 66CONFIG_IPV6=y
66CONFIG_IPV6_PRIVACY=y
67CONFIG_IPV6_ROUTER_PREF=y 67CONFIG_IPV6_ROUTER_PREF=y
68CONFIG_IPV6_OPTIMISTIC_DAD=y 68CONFIG_IPV6_OPTIMISTIC_DAD=y
69CONFIG_INET6_AH=y 69CONFIG_INET6_AH=y
@@ -85,7 +85,6 @@ CONFIG_RFKILL_GPIO=y
85CONFIG_DEVTMPFS=y 85CONFIG_DEVTMPFS=y
86CONFIG_DEVTMPFS_MOUNT=y 86CONFIG_DEVTMPFS_MOUNT=y
87# CONFIG_FIRMWARE_IN_KERNEL is not set 87# CONFIG_FIRMWARE_IN_KERNEL is not set
88CONFIG_CMA=y
89CONFIG_DMA_CMA=y 88CONFIG_DMA_CMA=y
90CONFIG_MTD=y 89CONFIG_MTD=y
91CONFIG_MTD_M25P80=y 90CONFIG_MTD_M25P80=y
@@ -114,6 +113,7 @@ CONFIG_RT2800USB=m
114CONFIG_INPUT_EVDEV=y 113CONFIG_INPUT_EVDEV=y
115CONFIG_KEYBOARD_GPIO=y 114CONFIG_KEYBOARD_GPIO=y
116CONFIG_KEYBOARD_TEGRA=y 115CONFIG_KEYBOARD_TEGRA=y
116CONFIG_KEYBOARD_CROS_EC=y
117CONFIG_MOUSE_PS2_ELANTECH=y 117CONFIG_MOUSE_PS2_ELANTECH=y
118CONFIG_INPUT_MISC=y 118CONFIG_INPUT_MISC=y
119CONFIG_INPUT_MPU3050=y 119CONFIG_INPUT_MPU3050=y
@@ -125,13 +125,13 @@ CONFIG_SERIAL_TEGRA=y
125CONFIG_SERIAL_OF_PLATFORM=y 125CONFIG_SERIAL_OF_PLATFORM=y
126# CONFIG_HW_RANDOM is not set 126# CONFIG_HW_RANDOM is not set
127# CONFIG_I2C_COMPAT is not set 127# CONFIG_I2C_COMPAT is not set
128CONFIG_I2C_MUX=y
129CONFIG_I2C_MUX_PINCTRL=y 128CONFIG_I2C_MUX_PINCTRL=y
130CONFIG_I2C_TEGRA=y 129CONFIG_I2C_TEGRA=y
131CONFIG_SPI=y 130CONFIG_SPI=y
132CONFIG_SPI_TEGRA114=y 131CONFIG_SPI_TEGRA114=y
133CONFIG_SPI_TEGRA20_SFLASH=y 132CONFIG_SPI_TEGRA20_SFLASH=y
134CONFIG_SPI_TEGRA20_SLINK=y 133CONFIG_SPI_TEGRA20_SLINK=y
134CONFIG_PINCTRL_AS3722=y
135CONFIG_PINCTRL_PALMAS=y 135CONFIG_PINCTRL_PALMAS=y
136CONFIG_GPIO_PCA953X_IRQ=y 136CONFIG_GPIO_PCA953X_IRQ=y
137CONFIG_GPIO_PALMAS=y 137CONFIG_GPIO_PALMAS=y
@@ -143,6 +143,9 @@ CONFIG_CHARGER_TPS65090=y
143CONFIG_POWER_RESET=y 143CONFIG_POWER_RESET=y
144CONFIG_POWER_RESET_GPIO=y 144CONFIG_POWER_RESET_GPIO=y
145CONFIG_SENSORS_LM90=y 145CONFIG_SENSORS_LM90=y
146CONFIG_MFD_AS3722=y
147CONFIG_MFD_CROS_EC=y
148CONFIG_MFD_CROS_EC_SPI=y
146CONFIG_MFD_MAX8907=y 149CONFIG_MFD_MAX8907=y
147CONFIG_MFD_PALMAS=y 150CONFIG_MFD_PALMAS=y
148CONFIG_MFD_TPS65090=y 151CONFIG_MFD_TPS65090=y
@@ -151,6 +154,7 @@ CONFIG_MFD_TPS65910=y
151CONFIG_REGULATOR=y 154CONFIG_REGULATOR=y
152CONFIG_REGULATOR_FIXED_VOLTAGE=y 155CONFIG_REGULATOR_FIXED_VOLTAGE=y
153CONFIG_REGULATOR_VIRTUAL_CONSUMER=y 156CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
157CONFIG_REGULATOR_AS3722=y
154CONFIG_REGULATOR_GPIO=y 158CONFIG_REGULATOR_GPIO=y
155CONFIG_REGULATOR_MAX8907=y 159CONFIG_REGULATOR_MAX8907=y
156CONFIG_REGULATOR_PALMAS=y 160CONFIG_REGULATOR_PALMAS=y
@@ -164,8 +168,8 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y
164CONFIG_MEDIA_USB_SUPPORT=y 168CONFIG_MEDIA_USB_SUPPORT=y
165CONFIG_USB_VIDEO_CLASS=m 169CONFIG_USB_VIDEO_CLASS=m
166CONFIG_DRM=y 170CONFIG_DRM=y
167CONFIG_TEGRA_HOST1X=y
168CONFIG_DRM_TEGRA=y 171CONFIG_DRM_TEGRA=y
172CONFIG_DRM_PANEL_SIMPLE=y
169CONFIG_BACKLIGHT_LCD_SUPPORT=y 173CONFIG_BACKLIGHT_LCD_SUPPORT=y
170# CONFIG_LCD_CLASS_DEVICE is not set 174# CONFIG_LCD_CLASS_DEVICE is not set
171CONFIG_BACKLIGHT_CLASS_DEVICE=y 175CONFIG_BACKLIGHT_CLASS_DEVICE=y
@@ -187,6 +191,7 @@ CONFIG_SND_SOC_TEGRA_WM8753=y
187CONFIG_SND_SOC_TEGRA_WM8903=y 191CONFIG_SND_SOC_TEGRA_WM8903=y
188CONFIG_SND_SOC_TEGRA_TRIMSLICE=y 192CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
189CONFIG_SND_SOC_TEGRA_ALC5632=y 193CONFIG_SND_SOC_TEGRA_ALC5632=y
194CONFIG_SND_SOC_TEGRA_MAX98090=y
190CONFIG_USB=y 195CONFIG_USB=y
191CONFIG_USB_XHCI_HCD=y 196CONFIG_USB_XHCI_HCD=y
192CONFIG_USB_EHCI_HCD=y 197CONFIG_USB_EHCI_HCD=y
@@ -199,10 +204,7 @@ CONFIG_MMC_BLOCK_MINORS=16
199CONFIG_MMC_SDHCI=y 204CONFIG_MMC_SDHCI=y
200CONFIG_MMC_SDHCI_PLTFM=y 205CONFIG_MMC_SDHCI_PLTFM=y
201CONFIG_MMC_SDHCI_TEGRA=y 206CONFIG_MMC_SDHCI_TEGRA=y
202CONFIG_NEW_LEDS=y
203CONFIG_LEDS_CLASS=y
204CONFIG_LEDS_GPIO=y 207CONFIG_LEDS_GPIO=y
205CONFIG_LEDS_TRIGGERS=y
206CONFIG_LEDS_TRIGGER_TIMER=y 208CONFIG_LEDS_TRIGGER_TIMER=y
207CONFIG_LEDS_TRIGGER_ONESHOT=y 209CONFIG_LEDS_TRIGGER_ONESHOT=y
208CONFIG_LEDS_TRIGGER_HEARTBEAT=y 210CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -211,6 +213,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
211CONFIG_LEDS_TRIGGER_TRANSIENT=y 213CONFIG_LEDS_TRIGGER_TRANSIENT=y
212CONFIG_LEDS_TRIGGER_CAMERA=y 214CONFIG_LEDS_TRIGGER_CAMERA=y
213CONFIG_RTC_CLASS=y 215CONFIG_RTC_CLASS=y
216CONFIG_RTC_DRV_AS3722=y
214CONFIG_RTC_DRV_MAX8907=y 217CONFIG_RTC_DRV_MAX8907=y
215CONFIG_RTC_DRV_PALMAS=y 218CONFIG_RTC_DRV_PALMAS=y
216CONFIG_RTC_DRV_TPS6586X=y 219CONFIG_RTC_DRV_TPS6586X=y
@@ -227,7 +230,6 @@ CONFIG_KEYBOARD_NVEC=y
227CONFIG_SERIO_NVEC_PS2=y 230CONFIG_SERIO_NVEC_PS2=y
228CONFIG_NVEC_POWER=y 231CONFIG_NVEC_POWER=y
229CONFIG_NVEC_PAZ00=y 232CONFIG_NVEC_PAZ00=y
230CONFIG_COMMON_CLK_DEBUG=y
231CONFIG_TEGRA_IOMMU_GART=y 233CONFIG_TEGRA_IOMMU_GART=y
232CONFIG_TEGRA_IOMMU_SMMU=y 234CONFIG_TEGRA_IOMMU_SMMU=y
233CONFIG_MEMORY=y 235CONFIG_MEMORY=y
@@ -256,16 +258,16 @@ CONFIG_ROOT_NFS=y
256CONFIG_NLS_CODEPAGE_437=y 258CONFIG_NLS_CODEPAGE_437=y
257CONFIG_NLS_ISO8859_1=y 259CONFIG_NLS_ISO8859_1=y
258CONFIG_PRINTK_TIME=y 260CONFIG_PRINTK_TIME=y
259CONFIG_MAGIC_SYSRQ=y 261CONFIG_DEBUG_INFO=y
260CONFIG_DEBUG_FS=y 262CONFIG_DEBUG_FS=y
263CONFIG_MAGIC_SYSRQ=y
264CONFIG_DEBUG_SLAB=y
265CONFIG_DEBUG_VM=y
261CONFIG_DETECT_HUNG_TASK=y 266CONFIG_DETECT_HUNG_TASK=y
262CONFIG_SCHEDSTATS=y 267CONFIG_SCHEDSTATS=y
263CONFIG_TIMER_STATS=y 268CONFIG_TIMER_STATS=y
264CONFIG_DEBUG_SLAB=y
265# CONFIG_DEBUG_PREEMPT is not set 269# CONFIG_DEBUG_PREEMPT is not set
266CONFIG_DEBUG_MUTEXES=y 270CONFIG_DEBUG_MUTEXES=y
267CONFIG_DEBUG_INFO=y
268CONFIG_DEBUG_VM=y
269CONFIG_DEBUG_SG=y 271CONFIG_DEBUG_SG=y
270CONFIG_DEBUG_LL=y 272CONFIG_DEBUG_LL=y
271CONFIG_EARLY_PRINTK=y 273CONFIG_EARLY_PRINTK=y
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index c6ebc184bf68..65f77885c167 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -119,6 +119,7 @@ CONFIG_NFS_FS=y
119CONFIG_ROOT_NFS=y 119CONFIG_ROOT_NFS=y
120CONFIG_NLS_CODEPAGE_437=y 120CONFIG_NLS_CODEPAGE_437=y
121CONFIG_NLS_ISO8859_1=y 121CONFIG_NLS_ISO8859_1=y
122CONFIG_PRINTK_TIME=y
122CONFIG_DEBUG_INFO=y 123CONFIG_DEBUG_INFO=y
123CONFIG_DEBUG_FS=y 124CONFIG_DEBUG_FS=y
124CONFIG_MAGIC_SYSRQ=y 125CONFIG_MAGIC_SYSRQ=y
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index 2ba9e63d0f17..073541a50e23 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -1,5 +1,3 @@
1CONFIG_ARCH_VERSATILE=y
2CONFIG_EXPERIMENTAL=y
3# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
4CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
@@ -7,15 +5,16 @@ CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y 5CONFIG_SLAB=y
8CONFIG_MODULES=y 6CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 7CONFIG_MODULE_UNLOAD=y
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_ARCH_VERSATILE=y
10CONFIG_MACH_VERSATILE_AB=y 10CONFIG_MACH_VERSATILE_AB=y
11CONFIG_LEDS=y 11CONFIG_AEABI=y
12CONFIG_LEDS_CPU=y 12CONFIG_OABI_COMPAT=y
13CONFIG_ZBOOT_ROM_TEXT=0x0 13CONFIG_ZBOOT_ROM_TEXT=0x0
14CONFIG_ZBOOT_ROM_BSS=0x0 14CONFIG_ZBOOT_ROM_BSS=0x0
15CONFIG_CMDLINE="root=1f03 mem=32M" 15CONFIG_CMDLINE="root=1f03 mem=32M"
16CONFIG_FPE_NWFPE=y 16CONFIG_FPE_NWFPE=y
17CONFIG_VFP=y 17CONFIG_VFP=y
18CONFIG_PM=y
19CONFIG_NET=y 18CONFIG_NET=y
20CONFIG_PACKET=y 19CONFIG_PACKET=y
21CONFIG_UNIX=y 20CONFIG_UNIX=y
@@ -26,9 +25,7 @@ CONFIG_IP_PNP_BOOTP=y
26# CONFIG_INET_DIAG is not set 25# CONFIG_INET_DIAG is not set
27# CONFIG_IPV6 is not set 26# CONFIG_IPV6 is not set
28CONFIG_MTD=y 27CONFIG_MTD=y
29CONFIG_MTD_PARTITIONS=y
30CONFIG_MTD_CMDLINE_PARTS=y 28CONFIG_MTD_CMDLINE_PARTS=y
31CONFIG_MTD_CHAR=y
32CONFIG_MTD_BLOCK=y 29CONFIG_MTD_BLOCK=y
33CONFIG_MTD_CFI=y 30CONFIG_MTD_CFI=y
34CONFIG_MTD_CFI_ADV_OPTIONS=y 31CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -37,10 +34,10 @@ CONFIG_MTD_PHYSMAP=y
37CONFIG_BLK_DEV_RAM=y 34CONFIG_BLK_DEV_RAM=y
38CONFIG_EEPROM_LEGACY=m 35CONFIG_EEPROM_LEGACY=m
39CONFIG_NETDEVICES=y 36CONFIG_NETDEVICES=y
40CONFIG_NET_ETHERNET=y
41CONFIG_SMC91X=y 37CONFIG_SMC91X=y
42# CONFIG_SERIO_SERPORT is not set 38# CONFIG_SERIO_SERPORT is not set
43CONFIG_SERIO_AMBAKMI=y 39CONFIG_SERIO_AMBAKMI=y
40CONFIG_LEGACY_PTY_COUNT=16
44CONFIG_SERIAL_8250=m 41CONFIG_SERIAL_8250=m
45CONFIG_SERIAL_8250_EXTENDED=y 42CONFIG_SERIAL_8250_EXTENDED=y
46CONFIG_SERIAL_8250_MANY_PORTS=y 43CONFIG_SERIAL_8250_MANY_PORTS=y
@@ -48,15 +45,14 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
48CONFIG_SERIAL_8250_RSA=y 45CONFIG_SERIAL_8250_RSA=y
49CONFIG_SERIAL_AMBA_PL011=y 46CONFIG_SERIAL_AMBA_PL011=y
50CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 47CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
51CONFIG_LEGACY_PTY_COUNT=16
52CONFIG_I2C=y 48CONFIG_I2C=y
53CONFIG_I2C_CHARDEV=m 49CONFIG_I2C_CHARDEV=m
50CONFIG_GPIOLIB=y
51CONFIG_GPIO_PL061=y
54# CONFIG_HWMON is not set 52# CONFIG_HWMON is not set
55CONFIG_FB=y 53CONFIG_FB=y
56CONFIG_FB_ARMCLCD=y 54CONFIG_FB_ARMCLCD=y
57CONFIG_FRAMEBUFFER_CONSOLE=y 55CONFIG_FRAMEBUFFER_CONSOLE=y
58CONFIG_FONTS=y
59CONFIG_FONT_ACORN_8x8=y
60CONFIG_SOUND=y 56CONFIG_SOUND=y
61CONFIG_SND=m 57CONFIG_SND=m
62CONFIG_SND_MIXER_OSS=m 58CONFIG_SND_MIXER_OSS=m
@@ -64,6 +60,9 @@ CONFIG_SND_PCM_OSS=m
64CONFIG_SND_ARMAACI=m 60CONFIG_SND_ARMAACI=m
65CONFIG_MMC=y 61CONFIG_MMC=y
66CONFIG_MMC_ARMMMCI=m 62CONFIG_MMC_ARMMMCI=m
63CONFIG_NEW_LEDS=y
64CONFIG_LEDS_TRIGGER_HEARTBEAT=y
65CONFIG_LEDS_TRIGGER_CPU=y
67CONFIG_EXT2_FS=y 66CONFIG_EXT2_FS=y
68CONFIG_VFAT_FS=m 67CONFIG_VFAT_FS=m
69CONFIG_JFFS2_FS=y 68CONFIG_JFFS2_FS=y
@@ -71,15 +70,14 @@ CONFIG_CRAMFS=y
71CONFIG_MINIX_FS=y 70CONFIG_MINIX_FS=y
72CONFIG_ROMFS_FS=y 71CONFIG_ROMFS_FS=y
73CONFIG_NFS_FS=y 72CONFIG_NFS_FS=y
74CONFIG_NFS_V3=y
75CONFIG_ROOT_NFS=y 73CONFIG_ROOT_NFS=y
76CONFIG_NFSD=y 74CONFIG_NFSD=y
77CONFIG_NFSD_V3=y 75CONFIG_NFSD_V3=y
78CONFIG_PARTITION_ADVANCED=y
79CONFIG_NLS_CODEPAGE_850=m 76CONFIG_NLS_CODEPAGE_850=m
80CONFIG_NLS_ISO8859_1=m 77CONFIG_NLS_ISO8859_1=m
81CONFIG_MAGIC_SYSRQ=y 78CONFIG_MAGIC_SYSRQ=y
82CONFIG_DEBUG_KERNEL=y 79CONFIG_DEBUG_KERNEL=y
83CONFIG_DEBUG_USER=y 80CONFIG_DEBUG_USER=y
84CONFIG_DEBUG_ERRORS=y
85CONFIG_DEBUG_LL=y 81CONFIG_DEBUG_LL=y
82CONFIG_FONTS=y
83CONFIG_FONT_ACORN_8x8=y
diff --git a/arch/arm/firmware/Kconfig b/arch/arm/firmware/Kconfig
new file mode 100644
index 000000000000..bb00ccf00d66
--- /dev/null
+++ b/arch/arm/firmware/Kconfig
@@ -0,0 +1,28 @@
1config ARCH_SUPPORTS_FIRMWARE
2 bool
3
4config ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
5 bool
6 select ARCH_SUPPORTS_FIRMWARE
7
8menu "Firmware options"
9 depends on ARCH_SUPPORTS_FIRMWARE
10
11config TRUSTED_FOUNDATIONS
12 bool "Trusted Foundations secure monitor support"
13 depends on ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
14 help
15 Some devices (including most Tegra-based consumer devices on the
16 market) are booted with the Trusted Foundations secure monitor
17 active, requiring some core operations to be performed by the secure
18 monitor instead of the kernel.
19
20 This option allows the kernel to invoke the secure monitor whenever
21 required on devices using Trusted Foundations. See
22 arch/arm/include/asm/trusted_foundations.h or the
23 tl,trusted-foundations device tree binding documentation for details
24 on how to use it.
25
26 Say n if you don't know what this is about.
27
28endmenu
diff --git a/arch/arm/firmware/Makefile b/arch/arm/firmware/Makefile
new file mode 100644
index 000000000000..a71f16536b6c
--- /dev/null
+++ b/arch/arm/firmware/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o
diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c
new file mode 100644
index 000000000000..ef1e3d8f4af0
--- /dev/null
+++ b/arch/arm/firmware/trusted_foundations.c
@@ -0,0 +1,81 @@
1/*
2 * Trusted Foundations support for ARM CPUs
3 *
4 * Copyright (c) 2013, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that 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 for
14 * more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/of.h>
20#include <asm/firmware.h>
21#include <asm/trusted_foundations.h>
22
23#define TF_SET_CPU_BOOT_ADDR_SMC 0xfffff200
24
25static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2)
26{
27 asm volatile(
28 ".arch_extension sec\n\t"
29 "stmfd sp!, {r4 - r11, lr}\n\t"
30 __asmeq("%0", "r0")
31 __asmeq("%1", "r1")
32 __asmeq("%2", "r2")
33 "mov r3, #0\n\t"
34 "mov r4, #0\n\t"
35 "smc #0\n\t"
36 "ldmfd sp!, {r4 - r11, pc}"
37 :
38 : "r" (type), "r" (arg1), "r" (arg2)
39 : "memory");
40}
41
42static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
43{
44 tf_generic_smc(TF_SET_CPU_BOOT_ADDR_SMC, boot_addr, 0);
45
46 return 0;
47}
48
49static const struct firmware_ops trusted_foundations_ops = {
50 .set_cpu_boot_addr = tf_set_cpu_boot_addr,
51};
52
53void register_trusted_foundations(struct trusted_foundations_platform_data *pd)
54{
55 /*
56 * we are not using version information for now since currently
57 * supported SMCs are compatible with all TF releases
58 */
59 register_firmware_ops(&trusted_foundations_ops);
60}
61
62void of_register_trusted_foundations(void)
63{
64 struct device_node *node;
65 struct trusted_foundations_platform_data pdata;
66 int err;
67
68 node = of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations");
69 if (!node)
70 return;
71
72 err = of_property_read_u32(node, "tlm,version-major",
73 &pdata.version_major);
74 if (err != 0)
75 panic("Trusted Foundation: missing version-major property\n");
76 err = of_property_read_u32(node, "tlm,version-minor",
77 &pdata.version_minor);
78 if (err != 0)
79 panic("Trusted Foundation: missing version-minor property\n");
80 register_trusted_foundations(&pdata);
81}
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index c38b58c80202..3278afe2c3ab 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -34,3 +34,4 @@ generic-y += timex.h
34generic-y += trace_clock.h 34generic-y += trace_clock.h
35generic-y += unaligned.h 35generic-y += unaligned.h
36generic-y += preempt.h 36generic-y += preempt.h
37generic-y += hash.h
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index e691ec91e4d3..b2e298a90d76 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -254,25 +254,59 @@ static inline int constant_fls(int x)
254} 254}
255 255
256/* 256/*
257 * On ARMv5 and above those functions can be implemented around 257 * On ARMv5 and above those functions can be implemented around the
258 * the clz instruction for much better code efficiency. 258 * clz instruction for much better code efficiency. __clz returns
259 * the number of leading zeros, zero input will return 32, and
260 * 0x80000000 will return 0.
259 */ 261 */
262static inline unsigned int __clz(unsigned int x)
263{
264 unsigned int ret;
265
266 asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
260 267
268 return ret;
269}
270
271/*
272 * fls() returns zero if the input is zero, otherwise returns the bit
273 * position of the last set bit, where the LSB is 1 and MSB is 32.
274 */
261static inline int fls(int x) 275static inline int fls(int x)
262{ 276{
263 int ret;
264
265 if (__builtin_constant_p(x)) 277 if (__builtin_constant_p(x))
266 return constant_fls(x); 278 return constant_fls(x);
267 279
268 asm("clz\t%0, %1" : "=r" (ret) : "r" (x)); 280 return 32 - __clz(x);
269 ret = 32 - ret; 281}
270 return ret; 282
283/*
284 * __fls() returns the bit position of the last bit set, where the
285 * LSB is 0 and MSB is 31. Zero input is undefined.
286 */
287static inline unsigned long __fls(unsigned long x)
288{
289 return fls(x) - 1;
290}
291
292/*
293 * ffs() returns zero if the input was zero, otherwise returns the bit
294 * position of the first set bit, where the LSB is 1 and MSB is 32.
295 */
296static inline int ffs(int x)
297{
298 return fls(x & -x);
299}
300
301/*
302 * __ffs() returns the bit position of the first bit set, where the
303 * LSB is 0 and MSB is 31. Zero input is undefined.
304 */
305static inline unsigned long __ffs(unsigned long x)
306{
307 return ffs(x) - 1;
271} 308}
272 309
273#define __fls(x) (fls(x) - 1)
274#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
275#define __ffs(x) (ffs(x) - 1)
276#define ffz(x) __ffs( ~(x) ) 310#define ffz(x) __ffs( ~(x) )
277 311
278#endif 312#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index ee753f1749cd..e9a49fe0284e 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -481,4 +481,9 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size)
481 : : : "r0","r1","r2","r3","r4","r5","r6","r7", \ 481 : : : "r0","r1","r2","r3","r4","r5","r6","r7", \
482 "r9","r10","lr","memory" ) 482 "r9","r10","lr","memory" )
483 483
484int set_memory_ro(unsigned long addr, int numpages);
485int set_memory_rw(unsigned long addr, int numpages);
486int set_memory_x(unsigned long addr, int numpages);
487int set_memory_nx(unsigned long addr, int numpages);
488
484#endif 489#endif
diff --git a/arch/arm/include/asm/checksum.h b/arch/arm/include/asm/checksum.h
index 6dcc16430868..523315115478 100644
--- a/arch/arm/include/asm/checksum.h
+++ b/arch/arm/include/asm/checksum.h
@@ -87,19 +87,33 @@ static inline __wsum
87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
88 unsigned short proto, __wsum sum) 88 unsigned short proto, __wsum sum)
89{ 89{
90 __asm__( 90 u32 lenprot = len | proto << 16;
91 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\ 91 if (__builtin_constant_p(sum) && sum == 0) {
92 adcs %0, %0, %3 \n" 92 __asm__(
93 "adds %0, %1, %2 @ csum_tcpudp_nofold0 \n\t"
93#ifdef __ARMEB__ 94#ifdef __ARMEB__
94 "adcs %0, %0, %4 \n" 95 "adcs %0, %0, %3 \n\t"
95#else 96#else
96 "adcs %0, %0, %4, lsl #8 \n" 97 "adcs %0, %0, %3, ror #8 \n\t"
97#endif 98#endif
98 "adcs %0, %0, %5 \n\ 99 "adc %0, %0, #0"
99 adc %0, %0, #0" 100 : "=&r" (sum)
100 : "=&r"(sum) 101 : "r" (daddr), "r" (saddr), "r" (lenprot)
101 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto)) 102 : "cc");
102 : "cc"); 103 } else {
104 __asm__(
105 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\t"
106 "adcs %0, %0, %3 \n\t"
107#ifdef __ARMEB__
108 "adcs %0, %0, %4 \n\t"
109#else
110 "adcs %0, %0, %4, ror #8 \n\t"
111#endif
112 "adc %0, %0, #0"
113 : "=&r"(sum)
114 : "r" (sum), "r" (daddr), "r" (saddr), "r" (lenprot)
115 : "cc");
116 }
103 return sum; 117 return sum;
104} 118}
105/* 119/*
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
index 80751c15c300..4e8a4b27d7c7 100644
--- a/arch/arm/include/asm/clkdev.h
+++ b/arch/arm/include/asm/clkdev.h
@@ -14,12 +14,14 @@
14 14
15#include <linux/slab.h> 15#include <linux/slab.h>
16 16
17#ifndef CONFIG_COMMON_CLK
17#ifdef CONFIG_HAVE_MACH_CLKDEV 18#ifdef CONFIG_HAVE_MACH_CLKDEV
18#include <mach/clkdev.h> 19#include <mach/clkdev.h>
19#else 20#else
20#define __clk_get(clk) ({ 1; }) 21#define __clk_get(clk) ({ 1; })
21#define __clk_put(clk) do { } while (0) 22#define __clk_put(clk) do { } while (0)
22#endif 23#endif
24#endif
23 25
24static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) 26static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
25{ 27{
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 58b8c6a0ab1f..99084431d6ae 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -8,8 +8,8 @@
8#define MAX_DMA_ADDRESS 0xffffffffUL 8#define MAX_DMA_ADDRESS 0xffffffffUL
9#else 9#else
10#define MAX_DMA_ADDRESS ({ \ 10#define MAX_DMA_ADDRESS ({ \
11 extern unsigned long arm_dma_zone_size; \ 11 extern phys_addr_t arm_dma_zone_size; \
12 arm_dma_zone_size ? \ 12 arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \
13 (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; }) 13 (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
14#endif 14#endif
15 15
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 3b2c40b5bfa2..6795ff743b3d 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -131,6 +131,7 @@ struct l2x0_regs {
131 unsigned long prefetch_ctrl; 131 unsigned long prefetch_ctrl;
132 unsigned long pwr_ctrl; 132 unsigned long pwr_ctrl;
133 unsigned long ctrl; 133 unsigned long ctrl;
134 unsigned long aux2_ctrl;
134}; 135};
135 136
136extern struct l2x0_regs l2x0_saved_regs; 137extern struct l2x0_regs l2x0_saved_regs;
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index fbeb39c869e9..8aa4cca74501 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -38,6 +38,12 @@
38#define isa_bus_to_virt phys_to_virt 38#define isa_bus_to_virt phys_to_virt
39 39
40/* 40/*
41 * Atomic MMIO-wide IO modify
42 */
43extern void atomic_io_modify(void __iomem *reg, u32 mask, u32 set);
44extern void atomic_io_modify_relaxed(void __iomem *reg, u32 mask, u32 set);
45
46/*
41 * Generic IO read/write. These perform native-endian accesses. Note 47 * Generic IO read/write. These perform native-endian accesses. Note
42 * that some architectures will want to re-define __raw_{read,write}w. 48 * that some architectures will want to re-define __raw_{read,write}w.
43 */ 49 */
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 8a6f6db14ee4..098f7dd6d564 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -225,4 +225,7 @@ static inline int kvm_arch_dev_ioctl_check_extension(long ext)
225int kvm_perf_init(void); 225int kvm_perf_init(void);
226int kvm_perf_teardown(void); 226int kvm_perf_teardown(void);
227 227
228u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
229int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
230
228#endif /* __ARM_KVM_HOST_H__ */ 231#endif /* __ARM_KVM_HOST_H__ */
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 77de4a41cc50..2d122adcdb22 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -140,6 +140,7 @@ static inline void coherent_icache_guest_page(struct kvm *kvm, hva_t hva,
140} 140}
141 141
142#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l)) 142#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l))
143#define kvm_virt_to_phys(x) virt_to_idmap((unsigned long)(x))
143 144
144#endif /* !__ASSEMBLY__ */ 145#endif /* !__ASSEMBLY__ */
145 146
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index 2fe141fcc8d6..f98c7f32c9c8 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -22,18 +22,21 @@ struct map_desc {
22}; 22};
23 23
24/* types 0-3 are defined in asm/io.h */ 24/* types 0-3 are defined in asm/io.h */
25#define MT_UNCACHED 4 25enum {
26#define MT_CACHECLEAN 5 26 MT_UNCACHED = 4,
27#define MT_MINICLEAN 6 27 MT_CACHECLEAN,
28#define MT_LOW_VECTORS 7 28 MT_MINICLEAN,
29#define MT_HIGH_VECTORS 8 29 MT_LOW_VECTORS,
30#define MT_MEMORY 9 30 MT_HIGH_VECTORS,
31#define MT_ROM 10 31 MT_MEMORY_RWX,
32#define MT_MEMORY_NONCACHED 11 32 MT_MEMORY_RW,
33#define MT_MEMORY_DTCM 12 33 MT_ROM,
34#define MT_MEMORY_ITCM 13 34 MT_MEMORY_RWX_NONCACHED,
35#define MT_MEMORY_SO 14 35 MT_MEMORY_RW_DTCM,
36#define MT_MEMORY_DMA_READY 15 36 MT_MEMORY_RWX_ITCM,
37 MT_MEMORY_RW_SO,
38 MT_MEMORY_DMA_READY,
39};
37 40
38#ifdef CONFIG_MMU 41#ifdef CONFIG_MMU
39extern void iotable_init(struct map_desc *, int); 42extern void iotable_init(struct map_desc *, int);
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index a98a2e112fae..680a83e94467 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -57,12 +57,9 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 57extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
58 enum pci_mmap_state mmap_state, int write_combine); 58 enum pci_mmap_state mmap_state, int write_combine);
59 59
60/*
61 * Dummy implementation; always return 0.
62 */
63static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 60static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
64{ 61{
65 return 0; 62 return channel ? 15 : 14;
66} 63}
67 64
68#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 86a659a19526..dfff709fda3c 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -160,6 +160,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
160 return (pmd_t *)pud; 160 return (pmd_t *)pud;
161} 161}
162 162
163#define pmd_large(pmd) (pmd_val(pmd) & 2)
163#define pmd_bad(pmd) (pmd_val(pmd) & 2) 164#define pmd_bad(pmd) (pmd_val(pmd) & 2)
164 165
165#define copy_pmd(pmdpd,pmdps) \ 166#define copy_pmd(pmdpd,pmdps) \
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 4f9503908dca..03243f7eeddf 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -142,6 +142,7 @@
142 PMD_TYPE_TABLE) 142 PMD_TYPE_TABLE)
143#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ 143#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
144 PMD_TYPE_SECT) 144 PMD_TYPE_SECT)
145#define pmd_large(pmd) pmd_sect(pmd)
145 146
146#define pud_clear(pudp) \ 147#define pud_clear(pudp) \
147 do { \ 148 do { \
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 1571d126e9dd..7d59b524f2af 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -254,6 +254,8 @@ PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY);
254PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); 254PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
255PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); 255PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG);
256PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); 256PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
257PTE_BIT_FUNC(mkexec, &= ~L_PTE_XN);
258PTE_BIT_FUNC(mknexec, |= L_PTE_XN);
257 259
258static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 260static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
259 261
diff --git a/arch/arm/include/asm/trusted_foundations.h b/arch/arm/include/asm/trusted_foundations.h
new file mode 100644
index 000000000000..3bd36e2c5f2e
--- /dev/null
+++ b/arch/arm/include/asm/trusted_foundations.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright (c) 2013, NVIDIA Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 */
14
15/*
16 * Support for the Trusted Foundations secure monitor.
17 *
18 * Trusted Foundation comes active on some ARM consumer devices (most
19 * Tegra-based devices sold on the market are concerned). Such devices can only
20 * perform some basic operations, like setting the CPU reset vector, through
21 * SMC calls to the secure monitor. The calls are completely specific to
22 * Trusted Foundations, and do *not* follow the SMC calling convention or the
23 * PSCI standard.
24 */
25
26#ifndef __ASM_ARM_TRUSTED_FOUNDATIONS_H
27#define __ASM_ARM_TRUSTED_FOUNDATIONS_H
28
29#include <linux/kconfig.h>
30#include <linux/printk.h>
31#include <linux/bug.h>
32#include <linux/of.h>
33
34struct trusted_foundations_platform_data {
35 unsigned int version_major;
36 unsigned int version_minor;
37};
38
39#if IS_ENABLED(CONFIG_TRUSTED_FOUNDATIONS)
40
41void register_trusted_foundations(struct trusted_foundations_platform_data *pd);
42void of_register_trusted_foundations(void);
43
44#else /* CONFIG_TRUSTED_FOUNDATIONS */
45
46static inline void register_trusted_foundations(
47 struct trusted_foundations_platform_data *pd)
48{
49 /*
50 * If we try to register TF, this means the system needs it to continue.
51 * Its absence if thus a fatal error.
52 */
53 panic("No support for Trusted Foundations, stopping...\n");
54}
55
56static inline void of_register_trusted_foundations(void)
57{
58 /*
59 * If we find the target should enable TF but does not support it,
60 * fail as the system won't be able to do much anyway
61 */
62 if (of_find_compatible_node(NULL, NULL, "tl,trusted-foundations"))
63 register_trusted_foundations(NULL);
64}
65#endif /* CONFIG_TRUSTED_FOUNDATIONS */
66
67#endif
diff --git a/arch/arm/include/asm/word-at-a-time.h b/arch/arm/include/asm/word-at-a-time.h
index 4d52f92967a6..a6d0a29861e7 100644
--- a/arch/arm/include/asm/word-at-a-time.h
+++ b/arch/arm/include/asm/word-at-a-time.h
@@ -48,10 +48,14 @@ static inline unsigned long find_zero(unsigned long mask)
48 return ret; 48 return ret;
49} 49}
50 50
51#ifdef CONFIG_DCACHE_WORD_ACCESS
52
53#define zero_bytemask(mask) (mask) 51#define zero_bytemask(mask) (mask)
54 52
53#else /* __ARMEB__ */
54#include <asm-generic/word-at-a-time.h>
55#endif
56
57#ifdef CONFIG_DCACHE_WORD_ACCESS
58
55/* 59/*
56 * Load an unaligned word from kernel space. 60 * Load an unaligned word from kernel space.
57 * 61 *
@@ -73,7 +77,11 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
73 " bic %2, %2, #0x3\n" 77 " bic %2, %2, #0x3\n"
74 " ldr %0, [%2]\n" 78 " ldr %0, [%2]\n"
75 " lsl %1, %1, #0x3\n" 79 " lsl %1, %1, #0x3\n"
80#ifndef __ARMEB__
76 " lsr %0, %0, %1\n" 81 " lsr %0, %0, %1\n"
82#else
83 " lsl %0, %0, %1\n"
84#endif
77 " b 2b\n" 85 " b 2b\n"
78 " .popsection\n" 86 " .popsection\n"
79 " .pushsection __ex_table,\"a\"\n" 87 " .pushsection __ex_table,\"a\"\n"
@@ -86,11 +94,5 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
86 return ret; 94 return ret;
87} 95}
88 96
89
90#endif /* DCACHE_WORD_ACCESS */ 97#endif /* DCACHE_WORD_ACCESS */
91
92#else /* __ARMEB__ */
93#include <asm-generic/word-at-a-time.h>
94#endif
95
96#endif /* __ASM_ARM_WORD_AT_A_TIME_H */ 98#endif /* __ASM_ARM_WORD_AT_A_TIME_H */
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 3759cacdd7f8..e0965abacb7d 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -117,6 +117,7 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
117 return __set_phys_to_machine(pfn, mfn); 117 return __set_phys_to_machine(pfn, mfn);
118} 118}
119 119
120#define xen_remap(cookie, size) ioremap_cache((cookie), (size)); 120#define xen_remap(cookie, size) ioremap_cache((cookie), (size))
121#define xen_unmap(cookie) iounmap((cookie))
121 122
122#endif /* _ASM_ARM_XEN_PAGE_H */ 123#endif /* _ASM_ARM_XEN_PAGE_H */
diff --git a/arch/arm/include/debug/imx-uart.h b/arch/arm/include/debug/imx-uart.h
index 29da84e183f4..42b823cd2d22 100644
--- a/arch/arm/include/debug/imx-uart.h
+++ b/arch/arm/include/debug/imx-uart.h
@@ -43,6 +43,14 @@
43#define IMX35_UART_BASE_ADDR(n) IMX35_UART##n##_BASE_ADDR 43#define IMX35_UART_BASE_ADDR(n) IMX35_UART##n##_BASE_ADDR
44#define IMX35_UART_BASE(n) IMX35_UART_BASE_ADDR(n) 44#define IMX35_UART_BASE(n) IMX35_UART_BASE_ADDR(n)
45 45
46#define IMX50_UART1_BASE_ADDR 0x53fbc000
47#define IMX50_UART2_BASE_ADDR 0x53fc0000
48#define IMX50_UART3_BASE_ADDR 0x5000c000
49#define IMX50_UART4_BASE_ADDR 0x53ff0000
50#define IMX50_UART5_BASE_ADDR 0x63f90000
51#define IMX50_UART_BASE_ADDR(n) IMX50_UART##n##_BASE_ADDR
52#define IMX50_UART_BASE(n) IMX50_UART_BASE_ADDR(n)
53
46#define IMX51_UART1_BASE_ADDR 0x73fbc000 54#define IMX51_UART1_BASE_ADDR 0x73fbc000
47#define IMX51_UART2_BASE_ADDR 0x73fc0000 55#define IMX51_UART2_BASE_ADDR 0x73fc0000
48#define IMX51_UART3_BASE_ADDR 0x7000c000 56#define IMX51_UART3_BASE_ADDR 0x7000c000
@@ -85,6 +93,8 @@
85#define UART_PADDR IMX_DEBUG_UART_BASE(IMX31) 93#define UART_PADDR IMX_DEBUG_UART_BASE(IMX31)
86#elif defined(CONFIG_DEBUG_IMX35_UART) 94#elif defined(CONFIG_DEBUG_IMX35_UART)
87#define UART_PADDR IMX_DEBUG_UART_BASE(IMX35) 95#define UART_PADDR IMX_DEBUG_UART_BASE(IMX35)
96#elif defined(CONFIG_DEBUG_IMX50_UART)
97#define UART_PADDR IMX_DEBUG_UART_BASE(IMX50)
88#elif defined(CONFIG_DEBUG_IMX51_UART) 98#elif defined(CONFIG_DEBUG_IMX51_UART)
89#define UART_PADDR IMX_DEBUG_UART_BASE(IMX51) 99#define UART_PADDR IMX_DEBUG_UART_BASE(IMX51)
90#elif defined(CONFIG_DEBUG_IMX53_UART) 100#elif defined(CONFIG_DEBUG_IMX53_UART)
diff --git a/arch/arm/include/debug/tegra.S b/arch/arm/include/debug/tegra.S
index be6a720dd183..f98763f0bc17 100644
--- a/arch/arm/include/debug/tegra.S
+++ b/arch/arm/include/debug/tegra.S
@@ -46,10 +46,10 @@
46#define TEGRA_APB_MISC_GP_HIDREV (TEGRA_APB_MISC_BASE + 0x804) 46#define TEGRA_APB_MISC_GP_HIDREV (TEGRA_APB_MISC_BASE + 0x804)
47 47
48/* 48/*
49 * Must be 1MB-aligned since a 1MB mapping is used early on. 49 * Must be section-aligned since a section mapping is used early on.
50 * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[]. 50 * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[].
51 */ 51 */
52#define UART_VIRTUAL_BASE 0xfe100000 52#define UART_VIRTUAL_BASE 0xfe800000
53 53
54#define checkuart(rp, rv, lhu, bit, uart) \ 54#define checkuart(rp, rv, lhu, bit, uart) \
55 /* Load address of CLK_RST register */ \ 55 /* Load address of CLK_RST register */ \
@@ -156,28 +156,6 @@
15692: and \rv, \rp, #0xffffff @ offset within 1MB section 15692: and \rv, \rp, #0xffffff @ offset within 1MB section
157 add \rv, \rv, #UART_VIRTUAL_BASE 157 add \rv, \rv, #UART_VIRTUAL_BASE
158 str \rv, [\tmp, #8] @ Store in tegra_uart_virt 158 str \rv, [\tmp, #8] @ Store in tegra_uart_virt
159 movw \rv, #TEGRA_APB_MISC_GP_HIDREV & 0xffff
160 movt \rv, #TEGRA_APB_MISC_GP_HIDREV >> 16
161 ldr \rv, [\rv, #0] @ Load HIDREV
162 ubfx \rv, \rv, #8, #8 @ 15:8 are SoC version
163 cmp \rv, #0x20 @ Tegra20?
164 moveq \rv, #0x75 @ Tegra20 divisor
165 movne \rv, #0xdd @ Tegra30 divisor
166 str \rv, [\tmp, #12] @ Save divisor to scratch
167 /* uart[UART_LCR] = UART_LCR_WLEN8 | UART_LCR_DLAB; */
168 mov \rv, #UART_LCR_WLEN8 | UART_LCR_DLAB
169 str \rv, [\rp, #UART_LCR << UART_SHIFT]
170 /* uart[UART_DLL] = div & 0xff; */
171 ldr \rv, [\tmp, #12]
172 and \rv, \rv, #0xff
173 str \rv, [\rp, #UART_DLL << UART_SHIFT]
174 /* uart[UART_DLM] = div >> 8; */
175 ldr \rv, [\tmp, #12]
176 lsr \rv, \rv, #8
177 str \rv, [\rp, #UART_DLM << UART_SHIFT]
178 /* uart[UART_LCR] = UART_LCR_WLEN8; */
179 mov \rv, #UART_LCR_WLEN8
180 str \rv, [\rp, #UART_LCR << UART_SHIFT]
181 b 100f 159 b 100f
182 160
183 .align 161 .align
@@ -205,8 +183,8 @@
205 cmp \rx, #0 183 cmp \rx, #0
206 beq 1002f 184 beq 1002f
2071001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] 1851001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
208 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE 186 and \rd, \rd, #UART_LSR_THRE
209 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE 187 teq \rd, #UART_LSR_THRE
210 bne 1001b 188 bne 1001b
2111002: 1891002:
212 .endm 190 .endm
@@ -225,7 +203,7 @@
225/* 203/*
226 * Storage for the state maintained by the macros above. 204 * Storage for the state maintained by the macros above.
227 * 205 *
228 * In the kernel proper, this data is located in arch/arm/mach-tegra/common.c. 206 * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c.
229 * That's because this header is included from multiple files, and we only 207 * That's because this header is included from multiple files, and we only
230 * want a single copy of the data. In particular, the UART probing code above 208 * want a single copy of the data. In particular, the UART probing code above
231 * assumes it's running using physical addresses. This is true when this file 209 * assumes it's running using physical addresses. This is true when this file
@@ -247,6 +225,4 @@ tegra_uart_config:
247 .word 0 225 .word 0
248 /* Debug UART virtual address */ 226 /* Debug UART virtual address */
249 .word 0 227 .word 0
250 /* Scratch space for debug macro */
251 .word 0
252#endif 228#endif
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
index c498b60c0505..ef0c8785ba16 100644
--- a/arch/arm/include/uapi/asm/kvm.h
+++ b/arch/arm/include/uapi/asm/kvm.h
@@ -119,6 +119,26 @@ struct kvm_arch_memory_slot {
119#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800 119#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800
120#define KVM_REG_ARM_32_CRN_SHIFT 11 120#define KVM_REG_ARM_32_CRN_SHIFT 11
121 121
122#define ARM_CP15_REG_SHIFT_MASK(x,n) \
123 (((x) << KVM_REG_ARM_ ## n ## _SHIFT) & KVM_REG_ARM_ ## n ## _MASK)
124
125#define __ARM_CP15_REG(op1,crn,crm,op2) \
126 (KVM_REG_ARM | (15 << KVM_REG_ARM_COPROC_SHIFT) | \
127 ARM_CP15_REG_SHIFT_MASK(op1, OPC1) | \
128 ARM_CP15_REG_SHIFT_MASK(crn, 32_CRN) | \
129 ARM_CP15_REG_SHIFT_MASK(crm, CRM) | \
130 ARM_CP15_REG_SHIFT_MASK(op2, 32_OPC2))
131
132#define ARM_CP15_REG32(...) (__ARM_CP15_REG(__VA_ARGS__) | KVM_REG_SIZE_U32)
133
134#define __ARM_CP15_REG64(op1,crm) \
135 (__ARM_CP15_REG(op1, 0, crm, 0) | KVM_REG_SIZE_U64)
136#define ARM_CP15_REG64(...) __ARM_CP15_REG64(__VA_ARGS__)
137
138#define KVM_REG_ARM_TIMER_CTL ARM_CP15_REG32(0, 14, 3, 1)
139#define KVM_REG_ARM_TIMER_CNT ARM_CP15_REG64(1, 14)
140#define KVM_REG_ARM_TIMER_CVAL ARM_CP15_REG64(3, 14)
141
122/* Normal registers are mapped as coprocessor 16. */ 142/* Normal registers are mapped as coprocessor 16. */
123#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT) 143#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT)
124#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4) 144#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4)
@@ -143,6 +163,14 @@ struct kvm_arch_memory_slot {
143#define KVM_REG_ARM_VFP_FPINST 0x1009 163#define KVM_REG_ARM_VFP_FPINST 0x1009
144#define KVM_REG_ARM_VFP_FPINST2 0x100A 164#define KVM_REG_ARM_VFP_FPINST2 0x100A
145 165
166/* Device Control API: ARM VGIC */
167#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
168#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
169#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
170#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32
171#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT)
172#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0
173#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
146 174
147/* KVM_IRQ_LINE irq field index values */ 175/* KVM_IRQ_LINE irq field index values */
148#define KVM_ARM_IRQ_TYPE_SHIFT 24 176#define KVM_ARM_IRQ_TYPE_SHIFT 24
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 1f031ddd0667..85e664b6a5f1 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -35,6 +35,8 @@ extern void __ucmpdi2(void);
35extern void __udivsi3(void); 35extern void __udivsi3(void);
36extern void __umodsi3(void); 36extern void __umodsi3(void);
37extern void __do_div64(void); 37extern void __do_div64(void);
38extern void __bswapsi2(void);
39extern void __bswapdi2(void);
38 40
39extern void __aeabi_idiv(void); 41extern void __aeabi_idiv(void);
40extern void __aeabi_idivmod(void); 42extern void __aeabi_idivmod(void);
@@ -114,6 +116,8 @@ EXPORT_SYMBOL(__ucmpdi2);
114EXPORT_SYMBOL(__udivsi3); 116EXPORT_SYMBOL(__udivsi3);
115EXPORT_SYMBOL(__umodsi3); 117EXPORT_SYMBOL(__umodsi3);
116EXPORT_SYMBOL(__do_div64); 118EXPORT_SYMBOL(__do_div64);
119EXPORT_SYMBOL(__bswapsi2);
120EXPORT_SYMBOL(__bswapdi2);
117 121
118#ifdef CONFIG_AEABI 122#ifdef CONFIG_AEABI
119EXPORT_SYMBOL(__aeabi_idiv); 123EXPORT_SYMBOL(__aeabi_idiv);
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 34d5fd585bbb..f751714d52c1 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -33,7 +33,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
33 33
34void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) 34void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
35{ 35{
36 return alloc_bootmem_align(size, align); 36 return memblock_virt_alloc(size, align);
37} 37}
38 38
39void __init arm_dt_memblock_reserve(void) 39void __init arm_dt_memblock_reserve(void)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index b3fb8c9e1ff2..1879e8dd2acc 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -451,9 +451,11 @@ __und_usr_thumb:
451 .arch armv6t2 451 .arch armv6t2
452#endif 452#endif
4532: ldrht r5, [r4] 4532: ldrht r5, [r4]
454ARM_BE8(rev16 r5, r5) @ little endian instruction
454 cmp r5, #0xe800 @ 32bit instruction if xx != 0 455 cmp r5, #0xe800 @ 32bit instruction if xx != 0
455 blo __und_usr_fault_16 @ 16bit undefined instruction 456 blo __und_usr_fault_16 @ 16bit undefined instruction
4563: ldrht r0, [r2] 4573: ldrht r0, [r2]
458ARM_BE8(rev16 r0, r0) @ little endian instruction
457 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4 459 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
458 str r2, [sp, #S_PC] @ it's a 2x16bit instr, update 460 str r2, [sp, #S_PC] @ it's a 2x16bit instr, update
459 orr r0, r0, r5, lsl #16 461 orr r0, r0, r5, lsl #16
diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S
index 52b26432c9a9..2260f1855820 100644
--- a/arch/arm/kernel/entry-v7m.S
+++ b/arch/arm/kernel/entry-v7m.S
@@ -14,8 +14,6 @@
14#include <asm/thread_notify.h> 14#include <asm/thread_notify.h>
15#include <asm/v7m.h> 15#include <asm/v7m.h>
16 16
17#include <mach/entry-macro.S>
18
19#include "entry-header.S" 17#include "entry-header.S"
20 18
21#ifdef CONFIG_TRACE_IRQFLAGS 19#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
index 8ff0ecdc637f..131a6ab5f355 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -385,7 +385,6 @@ out:
385 return ret; 385 return ret;
386 386
387out_unmap: 387out_unmap:
388 amba_set_drvdata(dev, NULL);
389 iounmap(t->etb_regs); 388 iounmap(t->etb_regs);
390 389
391out_release: 390out_release:
@@ -398,8 +397,6 @@ static int etb_remove(struct amba_device *dev)
398{ 397{
399 struct tracectx *t = amba_get_drvdata(dev); 398 struct tracectx *t = amba_get_drvdata(dev);
400 399
401 amba_set_drvdata(dev, NULL);
402
403 iounmap(t->etb_regs); 400 iounmap(t->etb_regs);
404 t->etb_regs = NULL; 401 t->etb_regs = NULL;
405 402
@@ -588,7 +585,6 @@ out:
588 return ret; 585 return ret;
589 586
590out_unmap: 587out_unmap:
591 amba_set_drvdata(dev, NULL);
592 iounmap(t->etm_regs); 588 iounmap(t->etm_regs);
593 589
594out_release: 590out_release:
@@ -601,8 +597,6 @@ static int etm_remove(struct amba_device *dev)
601{ 597{
602 struct tracectx *t = amba_get_drvdata(dev); 598 struct tracectx *t = amba_get_drvdata(dev);
603 599
604 amba_set_drvdata(dev, NULL);
605
606 iounmap(t->etm_regs); 600 iounmap(t->etm_regs);
607 t->etm_regs = NULL; 601 t->etm_regs = NULL;
608 602
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 32f317e5828a..914616e0bdcd 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -52,7 +52,8 @@
52 .equ swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE 52 .equ swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE
53 53
54 .macro pgtbl, rd, phys 54 .macro pgtbl, rd, phys
55 add \rd, \phys, #TEXT_OFFSET - PG_DIR_SIZE 55 add \rd, \phys, #TEXT_OFFSET
56 sub \rd, \rd, #PG_DIR_SIZE
56 .endm 57 .endm
57 58
58/* 59/*
diff --git a/arch/arm/kernel/io.c b/arch/arm/kernel/io.c
index dcd5b4d86143..9203cf883330 100644
--- a/arch/arm/kernel/io.c
+++ b/arch/arm/kernel/io.c
@@ -1,6 +1,41 @@
1#include <linux/export.h> 1#include <linux/export.h>
2#include <linux/types.h> 2#include <linux/types.h>
3#include <linux/io.h> 3#include <linux/io.h>
4#include <linux/spinlock.h>
5
6static DEFINE_RAW_SPINLOCK(__io_lock);
7
8/*
9 * Generic atomic MMIO modify.
10 *
11 * Allows thread-safe access to registers shared by unrelated subsystems.
12 * The access is protected by a single MMIO-wide lock.
13 */
14void atomic_io_modify_relaxed(void __iomem *reg, u32 mask, u32 set)
15{
16 unsigned long flags;
17 u32 value;
18
19 raw_spin_lock_irqsave(&__io_lock, flags);
20 value = readl_relaxed(reg) & ~mask;
21 value |= (set & mask);
22 writel_relaxed(value, reg);
23 raw_spin_unlock_irqrestore(&__io_lock, flags);
24}
25EXPORT_SYMBOL(atomic_io_modify_relaxed);
26
27void atomic_io_modify(void __iomem *reg, u32 mask, u32 set)
28{
29 unsigned long flags;
30 u32 value;
31
32 raw_spin_lock_irqsave(&__io_lock, flags);
33 value = readl_relaxed(reg) & ~mask;
34 value |= (set & mask);
35 writel(value, reg);
36 raw_spin_unlock_irqrestore(&__io_lock, flags);
37}
38EXPORT_SYMBOL(atomic_io_modify);
4 39
5/* 40/*
6 * Copy data from IO memory space to "real" memory space. 41 * Copy data from IO memory space to "real" memory space.
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 987a7f5bce5f..b0df9761de6d 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -334,7 +334,7 @@ static void __init cacheid_init(void)
334 cacheid = CACHEID_VIVT; 334 cacheid = CACHEID_VIVT;
335 } 335 }
336 336
337 printk("CPU: %s data cache, %s instruction cache\n", 337 pr_info("CPU: %s data cache, %s instruction cache\n",
338 cache_is_vivt() ? "VIVT" : 338 cache_is_vivt() ? "VIVT" :
339 cache_is_vipt_aliasing() ? "VIPT aliasing" : 339 cache_is_vipt_aliasing() ? "VIPT aliasing" :
340 cache_is_vipt_nonaliasing() ? "PIPT / VIPT nonaliasing" : "unknown", 340 cache_is_vipt_nonaliasing() ? "PIPT / VIPT nonaliasing" : "unknown",
@@ -416,7 +416,7 @@ void notrace cpu_init(void)
416 struct stack *stk = &stacks[cpu]; 416 struct stack *stk = &stacks[cpu];
417 417
418 if (cpu >= NR_CPUS) { 418 if (cpu >= NR_CPUS) {
419 printk(KERN_CRIT "CPU%u: bad primary CPU number\n", cpu); 419 pr_crit("CPU%u: bad primary CPU number\n", cpu);
420 BUG(); 420 BUG();
421 } 421 }
422 422
@@ -484,7 +484,7 @@ void __init smp_setup_processor_id(void)
484 */ 484 */
485 set_my_cpu_offset(0); 485 set_my_cpu_offset(0);
486 486
487 printk(KERN_INFO "Booting Linux on physical CPU 0x%x\n", mpidr); 487 pr_info("Booting Linux on physical CPU 0x%x\n", mpidr);
488} 488}
489 489
490struct mpidr_hash mpidr_hash; 490struct mpidr_hash mpidr_hash;
@@ -564,8 +564,8 @@ static void __init setup_processor(void)
564 */ 564 */
565 list = lookup_processor_type(read_cpuid_id()); 565 list = lookup_processor_type(read_cpuid_id());
566 if (!list) { 566 if (!list) {
567 printk("CPU configuration botched (ID %08x), unable " 567 pr_err("CPU configuration botched (ID %08x), unable to continue.\n",
568 "to continue.\n", read_cpuid_id()); 568 read_cpuid_id());
569 while (1); 569 while (1);
570 } 570 }
571 571
@@ -585,9 +585,9 @@ static void __init setup_processor(void)
585 cpu_cache = *list->cache; 585 cpu_cache = *list->cache;
586#endif 586#endif
587 587
588 printk("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n", 588 pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
589 cpu_name, read_cpuid_id(), read_cpuid_id() & 15, 589 cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
590 proc_arch[cpu_architecture()], cr_alignment); 590 proc_arch[cpu_architecture()], cr_alignment);
591 591
592 snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c", 592 snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
593 list->arch_name, ENDIANNESS); 593 list->arch_name, ENDIANNESS);
@@ -629,8 +629,8 @@ int __init arm_add_memory(u64 start, u64 size)
629 u64 aligned_start; 629 u64 aligned_start;
630 630
631 if (meminfo.nr_banks >= NR_BANKS) { 631 if (meminfo.nr_banks >= NR_BANKS) {
632 printk(KERN_CRIT "NR_BANKS too low, " 632 pr_crit("NR_BANKS too low, ignoring memory at 0x%08llx\n",
633 "ignoring memory at 0x%08llx\n", (long long)start); 633 (long long)start);
634 return -EINVAL; 634 return -EINVAL;
635 } 635 }
636 636
@@ -643,14 +643,14 @@ int __init arm_add_memory(u64 start, u64 size)
643 643
644#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT 644#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
645 if (aligned_start > ULONG_MAX) { 645 if (aligned_start > ULONG_MAX) {
646 printk(KERN_CRIT "Ignoring memory at 0x%08llx outside " 646 pr_crit("Ignoring memory at 0x%08llx outside 32-bit physical address space\n",
647 "32-bit physical address space\n", (long long)start); 647 (long long)start);
648 return -EINVAL; 648 return -EINVAL;
649 } 649 }
650 650
651 if (aligned_start + size > ULONG_MAX) { 651 if (aligned_start + size > ULONG_MAX) {
652 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " 652 pr_crit("Truncating memory at 0x%08llx to fit in 32-bit physical address space\n",
653 "32-bit physical address space\n", (long long)start); 653 (long long)start);
654 /* 654 /*
655 * To ensure bank->start + bank->size is representable in 655 * To ensure bank->start + bank->size is representable in
656 * 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.
@@ -660,6 +660,20 @@ int __init arm_add_memory(u64 start, u64 size)
660 } 660 }
661#endif 661#endif
662 662
663 if (aligned_start < PHYS_OFFSET) {
664 if (aligned_start + size <= PHYS_OFFSET) {
665 pr_info("Ignoring memory below PHYS_OFFSET: 0x%08llx-0x%08llx\n",
666 aligned_start, aligned_start + size);
667 return -EINVAL;
668 }
669
670 pr_info("Ignoring memory below PHYS_OFFSET: 0x%08llx-0x%08llx\n",
671 aligned_start, (u64)PHYS_OFFSET);
672
673 size -= PHYS_OFFSET - aligned_start;
674 aligned_start = PHYS_OFFSET;
675 }
676
663 bank->start = aligned_start; 677 bank->start = aligned_start;
664 bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1); 678 bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1);
665 679
@@ -717,7 +731,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
717 kernel_data.end = virt_to_phys(_end - 1); 731 kernel_data.end = virt_to_phys(_end - 1);
718 732
719 for_each_memblock(memory, region) { 733 for_each_memblock(memory, region) {
720 res = alloc_bootmem_low(sizeof(*res)); 734 res = memblock_virt_alloc_low(sizeof(*res), 0);
721 res->name = "System RAM"; 735 res->name = "System RAM";
722 res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region)); 736 res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
723 res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1; 737 res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
@@ -817,18 +831,17 @@ static void __init reserve_crashkernel(void)
817 if (ret) 831 if (ret)
818 return; 832 return;
819 833
820 ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE); 834 ret = memblock_reserve(crash_base, crash_size);
821 if (ret < 0) { 835 if (ret < 0) {
822 printk(KERN_WARNING "crashkernel reservation failed - " 836 pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n",
823 "memory is in use (0x%lx)\n", (unsigned long)crash_base); 837 (unsigned long)crash_base);
824 return; 838 return;
825 } 839 }
826 840
827 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " 841 pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: %ldMB)\n",
828 "for crashkernel (System RAM: %ldMB)\n", 842 (unsigned long)(crash_size >> 20),
829 (unsigned long)(crash_size >> 20), 843 (unsigned long)(crash_base >> 20),
830 (unsigned long)(crash_base >> 20), 844 (unsigned long)(total_mem >> 20));
831 (unsigned long)(total_mem >> 20));
832 845
833 crashk_res.start = crash_base; 846 crashk_res.start = crash_base;
834 crashk_res.end = crash_base + crash_size - 1; 847 crashk_res.end = crash_base + crash_size - 1;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index dc894ab3622b..b7b4c86e338b 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -105,8 +105,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
105 secondary_data.pgdir = get_arch_pgd(idmap_pgd); 105 secondary_data.pgdir = get_arch_pgd(idmap_pgd);
106 secondary_data.swapper_pg_dir = get_arch_pgd(swapper_pg_dir); 106 secondary_data.swapper_pg_dir = get_arch_pgd(swapper_pg_dir);
107#endif 107#endif
108 __cpuc_flush_dcache_area(&secondary_data, sizeof(secondary_data)); 108 sync_cache_w(&secondary_data);
109 outer_clean_range(__pa(&secondary_data), __pa(&secondary_data + 1));
110 109
111 /* 110 /*
112 * Now bring the CPU into our world. 111 * Now bring the CPU into our world.
@@ -294,6 +293,9 @@ void __ref cpu_die(void)
294 if (smp_ops.cpu_die) 293 if (smp_ops.cpu_die)
295 smp_ops.cpu_die(cpu); 294 smp_ops.cpu_die(cpu);
296 295
296 pr_warn("CPU%u: smp_ops.cpu_die() returned, trying to resuscitate\n",
297 cpu);
298
297 /* 299 /*
298 * Do not return to the idle loop - jump back to the secondary 300 * Do not return to the idle loop - jump back to the secondary
299 * cpu initialisation. There's some initialisation which needs 301 * cpu initialisation. There's some initialisation which needs
diff --git a/arch/arm/kernel/tcm.c b/arch/arm/kernel/tcm.c
index f50f19e5c138..7a3be1d4d0b1 100644
--- a/arch/arm/kernel/tcm.c
+++ b/arch/arm/kernel/tcm.c
@@ -52,7 +52,7 @@ static struct map_desc dtcm_iomap[] __initdata = {
52 .virtual = DTCM_OFFSET, 52 .virtual = DTCM_OFFSET,
53 .pfn = __phys_to_pfn(DTCM_OFFSET), 53 .pfn = __phys_to_pfn(DTCM_OFFSET),
54 .length = 0, 54 .length = 0,
55 .type = MT_MEMORY_DTCM 55 .type = MT_MEMORY_RW_DTCM
56 } 56 }
57}; 57};
58 58
@@ -61,7 +61,7 @@ static struct map_desc itcm_iomap[] __initdata = {
61 .virtual = ITCM_OFFSET, 61 .virtual = ITCM_OFFSET,
62 .pfn = __phys_to_pfn(ITCM_OFFSET), 62 .pfn = __phys_to_pfn(ITCM_OFFSET),
63 .length = 0, 63 .length = 0,
64 .type = MT_MEMORY_ITCM 64 .type = MT_MEMORY_RWX_ITCM,
65 } 65 }
66}; 66};
67 67
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 85a87370f144..0bc94b1fd1ae 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -68,16 +68,16 @@ struct cpu_efficiency {
68 * Processors that are not defined in the table, 68 * Processors that are not defined in the table,
69 * use the default SCHED_POWER_SCALE value for cpu_scale. 69 * use the default SCHED_POWER_SCALE value for cpu_scale.
70 */ 70 */
71struct cpu_efficiency table_efficiency[] = { 71static const struct cpu_efficiency table_efficiency[] = {
72 {"arm,cortex-a15", 3891}, 72 {"arm,cortex-a15", 3891},
73 {"arm,cortex-a7", 2048}, 73 {"arm,cortex-a7", 2048},
74 {NULL, }, 74 {NULL, },
75}; 75};
76 76
77unsigned long *__cpu_capacity; 77static unsigned long *__cpu_capacity;
78#define cpu_capacity(cpu) __cpu_capacity[cpu] 78#define cpu_capacity(cpu) __cpu_capacity[cpu]
79 79
80unsigned long middle_capacity = 1; 80static unsigned long middle_capacity = 1;
81 81
82/* 82/*
83 * Iterate all CPUs' descriptor in DT and compute the efficiency 83 * Iterate all CPUs' descriptor in DT and compute the efficiency
@@ -89,7 +89,7 @@ unsigned long middle_capacity = 1;
89 */ 89 */
90static void __init parse_dt_topology(void) 90static void __init parse_dt_topology(void)
91{ 91{
92 struct cpu_efficiency *cpu_eff; 92 const struct cpu_efficiency *cpu_eff;
93 struct device_node *cn = NULL; 93 struct device_node *cn = NULL;
94 unsigned long min_capacity = (unsigned long)(-1); 94 unsigned long min_capacity = (unsigned long)(-1);
95 unsigned long max_capacity = 0; 95 unsigned long max_capacity = 0;
@@ -158,7 +158,7 @@ static void __init parse_dt_topology(void)
158 * boot. The update of all CPUs is in O(n^2) for heteregeneous system but the 158 * boot. The update of all CPUs is in O(n^2) for heteregeneous system but the
159 * function returns directly for SMP system. 159 * function returns directly for SMP system.
160 */ 160 */
161void update_cpu_power(unsigned int cpu) 161static void update_cpu_power(unsigned int cpu)
162{ 162{
163 if (!cpu_capacity(cpu)) 163 if (!cpu_capacity(cpu))
164 return; 164 return;
@@ -185,7 +185,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
185 return &cpu_topology[cpu].core_sibling; 185 return &cpu_topology[cpu].core_sibling;
186} 186}
187 187
188void update_siblings_masks(unsigned int cpuid) 188static void update_siblings_masks(unsigned int cpuid)
189{ 189{
190 struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid]; 190 struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid];
191 int cpu; 191 int cpu;
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 4636d56af2db..172ee18ff124 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -62,7 +62,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
62void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) 62void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
63{ 63{
64#ifdef CONFIG_KALLSYMS 64#ifdef CONFIG_KALLSYMS
65 printk("[<%08lx>] (%pS) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from); 65 printk("[<%08lx>] (%ps) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from);
66#else 66#else
67 printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); 67 printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from);
68#endif 68#endif
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 2a700e00528d..1d8248ea5669 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/cpu_pm.h>
20#include <linux/errno.h> 21#include <linux/errno.h>
21#include <linux/err.h> 22#include <linux/err.h>
22#include <linux/kvm_host.h> 23#include <linux/kvm_host.h>
@@ -137,6 +138,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
137 if (ret) 138 if (ret)
138 goto out_free_stage2_pgd; 139 goto out_free_stage2_pgd;
139 140
141 kvm_timer_init(kvm);
142
140 /* Mark the initial VMID generation invalid */ 143 /* Mark the initial VMID generation invalid */
141 kvm->arch.vmid_gen = 0; 144 kvm->arch.vmid_gen = 0;
142 145
@@ -188,6 +191,7 @@ int kvm_dev_ioctl_check_extension(long ext)
188 case KVM_CAP_IRQCHIP: 191 case KVM_CAP_IRQCHIP:
189 r = vgic_present; 192 r = vgic_present;
190 break; 193 break;
194 case KVM_CAP_DEVICE_CTRL:
191 case KVM_CAP_USER_MEMORY: 195 case KVM_CAP_USER_MEMORY:
192 case KVM_CAP_SYNC_MMU: 196 case KVM_CAP_SYNC_MMU:
193 case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: 197 case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
@@ -339,6 +343,13 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
339 343
340void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 344void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
341{ 345{
346 /*
347 * The arch-generic KVM code expects the cpu field of a vcpu to be -1
348 * if the vcpu is no longer assigned to a cpu. This is used for the
349 * optimized make_all_cpus_request path.
350 */
351 vcpu->cpu = -1;
352
342 kvm_arm_set_running_vcpu(NULL); 353 kvm_arm_set_running_vcpu(NULL);
343} 354}
344 355
@@ -462,6 +473,8 @@ static void update_vttbr(struct kvm *kvm)
462 473
463static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) 474static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu)
464{ 475{
476 int ret;
477
465 if (likely(vcpu->arch.has_run_once)) 478 if (likely(vcpu->arch.has_run_once))
466 return 0; 479 return 0;
467 480
@@ -471,22 +484,12 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu)
471 * Initialize the VGIC before running a vcpu the first time on 484 * Initialize the VGIC before running a vcpu the first time on
472 * this VM. 485 * this VM.
473 */ 486 */
474 if (irqchip_in_kernel(vcpu->kvm) && 487 if (unlikely(!vgic_initialized(vcpu->kvm))) {
475 unlikely(!vgic_initialized(vcpu->kvm))) { 488 ret = kvm_vgic_init(vcpu->kvm);
476 int ret = kvm_vgic_init(vcpu->kvm);
477 if (ret) 489 if (ret)
478 return ret; 490 return ret;
479 } 491 }
480 492
481 /*
482 * Handle the "start in power-off" case by calling into the
483 * PSCI code.
484 */
485 if (test_and_clear_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features)) {
486 *vcpu_reg(vcpu, 0) = KVM_PSCI_FN_CPU_OFF;
487 kvm_psci_call(vcpu);
488 }
489
490 return 0; 493 return 0;
491} 494}
492 495
@@ -700,6 +703,24 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
700 return -EINVAL; 703 return -EINVAL;
701} 704}
702 705
706static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
707 struct kvm_vcpu_init *init)
708{
709 int ret;
710
711 ret = kvm_vcpu_set_target(vcpu, init);
712 if (ret)
713 return ret;
714
715 /*
716 * Handle the "start in power-off" case by marking the VCPU as paused.
717 */
718 if (__test_and_clear_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features))
719 vcpu->arch.pause = true;
720
721 return 0;
722}
723
703long kvm_arch_vcpu_ioctl(struct file *filp, 724long kvm_arch_vcpu_ioctl(struct file *filp,
704 unsigned int ioctl, unsigned long arg) 725 unsigned int ioctl, unsigned long arg)
705{ 726{
@@ -713,8 +734,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
713 if (copy_from_user(&init, argp, sizeof(init))) 734 if (copy_from_user(&init, argp, sizeof(init)))
714 return -EFAULT; 735 return -EFAULT;
715 736
716 return kvm_vcpu_set_target(vcpu, &init); 737 return kvm_arch_vcpu_ioctl_vcpu_init(vcpu, &init);
717
718 } 738 }
719 case KVM_SET_ONE_REG: 739 case KVM_SET_ONE_REG:
720 case KVM_GET_ONE_REG: { 740 case KVM_GET_ONE_REG: {
@@ -772,7 +792,7 @@ static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm,
772 case KVM_ARM_DEVICE_VGIC_V2: 792 case KVM_ARM_DEVICE_VGIC_V2:
773 if (!vgic_present) 793 if (!vgic_present)
774 return -ENXIO; 794 return -ENXIO;
775 return kvm_vgic_set_addr(kvm, type, dev_addr->addr); 795 return kvm_vgic_addr(kvm, type, &dev_addr->addr, true);
776 default: 796 default:
777 return -ENODEV; 797 return -ENODEV;
778 } 798 }
@@ -853,6 +873,33 @@ static struct notifier_block hyp_init_cpu_nb = {
853 .notifier_call = hyp_init_cpu_notify, 873 .notifier_call = hyp_init_cpu_notify,
854}; 874};
855 875
876#ifdef CONFIG_CPU_PM
877static int hyp_init_cpu_pm_notifier(struct notifier_block *self,
878 unsigned long cmd,
879 void *v)
880{
881 if (cmd == CPU_PM_EXIT) {
882 cpu_init_hyp_mode(NULL);
883 return NOTIFY_OK;
884 }
885
886 return NOTIFY_DONE;
887}
888
889static struct notifier_block hyp_init_cpu_pm_nb = {
890 .notifier_call = hyp_init_cpu_pm_notifier,
891};
892
893static void __init hyp_cpu_pm_init(void)
894{
895 cpu_pm_register_notifier(&hyp_init_cpu_pm_nb);
896}
897#else
898static inline void hyp_cpu_pm_init(void)
899{
900}
901#endif
902
856/** 903/**
857 * Inits Hyp-mode on all online CPUs 904 * Inits Hyp-mode on all online CPUs
858 */ 905 */
@@ -1013,6 +1060,8 @@ int kvm_arch_init(void *opaque)
1013 goto out_err; 1060 goto out_err;
1014 } 1061 }
1015 1062
1063 hyp_cpu_pm_init();
1064
1016 kvm_coproc_table_init(); 1065 kvm_coproc_table_init();
1017 return 0; 1066 return 0;
1018out_err: 1067out_err:
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index 20f8d97904af..2786eae10c0d 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -109,6 +109,83 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
109 return -EINVAL; 109 return -EINVAL;
110} 110}
111 111
112#ifndef CONFIG_KVM_ARM_TIMER
113
114#define NUM_TIMER_REGS 0
115
116static int copy_timer_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
117{
118 return 0;
119}
120
121static bool is_timer_reg(u64 index)
122{
123 return false;
124}
125
126int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
127{
128 return 0;
129}
130
131u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
132{
133 return 0;
134}
135
136#else
137
138#define NUM_TIMER_REGS 3
139
140static bool is_timer_reg(u64 index)
141{
142 switch (index) {
143 case KVM_REG_ARM_TIMER_CTL:
144 case KVM_REG_ARM_TIMER_CNT:
145 case KVM_REG_ARM_TIMER_CVAL:
146 return true;
147 }
148 return false;
149}
150
151static int copy_timer_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
152{
153 if (put_user(KVM_REG_ARM_TIMER_CTL, uindices))
154 return -EFAULT;
155 uindices++;
156 if (put_user(KVM_REG_ARM_TIMER_CNT, uindices))
157 return -EFAULT;
158 uindices++;
159 if (put_user(KVM_REG_ARM_TIMER_CVAL, uindices))
160 return -EFAULT;
161
162 return 0;
163}
164
165#endif
166
167static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
168{
169 void __user *uaddr = (void __user *)(long)reg->addr;
170 u64 val;
171 int ret;
172
173 ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
174 if (ret != 0)
175 return ret;
176
177 return kvm_arm_timer_set_reg(vcpu, reg->id, val);
178}
179
180static int get_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
181{
182 void __user *uaddr = (void __user *)(long)reg->addr;
183 u64 val;
184
185 val = kvm_arm_timer_get_reg(vcpu, reg->id);
186 return copy_to_user(uaddr, &val, KVM_REG_SIZE(reg->id));
187}
188
112static unsigned long num_core_regs(void) 189static unsigned long num_core_regs(void)
113{ 190{
114 return sizeof(struct kvm_regs) / sizeof(u32); 191 return sizeof(struct kvm_regs) / sizeof(u32);
@@ -121,7 +198,8 @@ static unsigned long num_core_regs(void)
121 */ 198 */
122unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu) 199unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu)
123{ 200{
124 return num_core_regs() + kvm_arm_num_coproc_regs(vcpu); 201 return num_core_regs() + kvm_arm_num_coproc_regs(vcpu)
202 + NUM_TIMER_REGS;
125} 203}
126 204
127/** 205/**
@@ -133,6 +211,7 @@ int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
133{ 211{
134 unsigned int i; 212 unsigned int i;
135 const u64 core_reg = KVM_REG_ARM | KVM_REG_SIZE_U32 | KVM_REG_ARM_CORE; 213 const u64 core_reg = KVM_REG_ARM | KVM_REG_SIZE_U32 | KVM_REG_ARM_CORE;
214 int ret;
136 215
137 for (i = 0; i < sizeof(struct kvm_regs)/sizeof(u32); i++) { 216 for (i = 0; i < sizeof(struct kvm_regs)/sizeof(u32); i++) {
138 if (put_user(core_reg | i, uindices)) 217 if (put_user(core_reg | i, uindices))
@@ -140,6 +219,11 @@ int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
140 uindices++; 219 uindices++;
141 } 220 }
142 221
222 ret = copy_timer_indices(vcpu, uindices);
223 if (ret)
224 return ret;
225 uindices += NUM_TIMER_REGS;
226
143 return kvm_arm_copy_coproc_indices(vcpu, uindices); 227 return kvm_arm_copy_coproc_indices(vcpu, uindices);
144} 228}
145 229
@@ -153,6 +237,9 @@ int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
153 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) 237 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
154 return get_core_reg(vcpu, reg); 238 return get_core_reg(vcpu, reg);
155 239
240 if (is_timer_reg(reg->id))
241 return get_timer_reg(vcpu, reg);
242
156 return kvm_arm_coproc_get_reg(vcpu, reg); 243 return kvm_arm_coproc_get_reg(vcpu, reg);
157} 244}
158 245
@@ -166,6 +253,9 @@ int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
166 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE) 253 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
167 return set_core_reg(vcpu, reg); 254 return set_core_reg(vcpu, reg);
168 255
256 if (is_timer_reg(reg->id))
257 return set_timer_reg(vcpu, reg);
258
169 return kvm_arm_coproc_set_reg(vcpu, reg); 259 return kvm_arm_coproc_set_reg(vcpu, reg);
170} 260}
171 261
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c
index a92079011a83..0de91fc6de0f 100644
--- a/arch/arm/kvm/handle_exit.c
+++ b/arch/arm/kvm/handle_exit.c
@@ -26,8 +26,6 @@
26 26
27#include "trace.h" 27#include "trace.h"
28 28
29#include "trace.h"
30
31typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *); 29typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *);
32 30
33static int handle_svc_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run) 31static int handle_svc_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 580906989db1..7789857d1470 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -667,14 +667,16 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
667 gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT; 667 gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT;
668 } else { 668 } else {
669 /* 669 /*
670 * Pages belonging to VMAs not aligned to the PMD mapping 670 * Pages belonging to memslots that don't have the same
671 * granularity cannot be mapped using block descriptors even 671 * alignment for userspace and IPA cannot be mapped using
672 * if the pages belong to a THP for the process, because the 672 * block descriptors even if the pages belong to a THP for
673 * stage-2 block descriptor will cover more than a single THP 673 * the process, because the stage-2 block descriptor will
674 * and we loose atomicity for unmapping, updates, and splits 674 * cover more than a single THP and we loose atomicity for
675 * of the THP or other pages in the stage-2 block range. 675 * unmapping, updates, and splits of the THP or other pages
676 * in the stage-2 block range.
676 */ 677 */
677 if (vma->vm_start & ~PMD_MASK) 678 if ((memslot->userspace_addr & ~PMD_MASK) !=
679 ((memslot->base_gfn << PAGE_SHIFT) & ~PMD_MASK))
678 force_pte = true; 680 force_pte = true;
679 } 681 }
680 up_read(&current->mm->mmap_sem); 682 up_read(&current->mm->mmap_sem);
@@ -916,9 +918,9 @@ int kvm_mmu_init(void)
916{ 918{
917 int err; 919 int err;
918 920
919 hyp_idmap_start = virt_to_phys(__hyp_idmap_text_start); 921 hyp_idmap_start = kvm_virt_to_phys(__hyp_idmap_text_start);
920 hyp_idmap_end = virt_to_phys(__hyp_idmap_text_end); 922 hyp_idmap_end = kvm_virt_to_phys(__hyp_idmap_text_end);
921 hyp_idmap_vector = virt_to_phys(__kvm_hyp_init); 923 hyp_idmap_vector = kvm_virt_to_phys(__kvm_hyp_init);
922 924
923 if ((hyp_idmap_start ^ hyp_idmap_end) & PAGE_MASK) { 925 if ((hyp_idmap_start ^ hyp_idmap_end) & PAGE_MASK) {
924 /* 926 /*
@@ -945,7 +947,7 @@ int kvm_mmu_init(void)
945 */ 947 */
946 kvm_flush_dcache_to_poc(init_bounce_page, len); 948 kvm_flush_dcache_to_poc(init_bounce_page, len);
947 949
948 phys_base = virt_to_phys(init_bounce_page); 950 phys_base = kvm_virt_to_phys(init_bounce_page);
949 hyp_idmap_vector += phys_base - hyp_idmap_start; 951 hyp_idmap_vector += phys_base - hyp_idmap_start;
950 hyp_idmap_start = phys_base; 952 hyp_idmap_start = phys_base;
951 hyp_idmap_end = phys_base + len; 953 hyp_idmap_end = phys_base + len;
diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c
index 0881bf169fbc..448f60e8d23c 100644
--- a/arch/arm/kvm/psci.c
+++ b/arch/arm/kvm/psci.c
@@ -54,15 +54,15 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
54 } 54 }
55 } 55 }
56 56
57 if (!vcpu) 57 /*
58 * Make sure the caller requested a valid CPU and that the CPU is
59 * turned off.
60 */
61 if (!vcpu || !vcpu->arch.pause)
58 return KVM_PSCI_RET_INVAL; 62 return KVM_PSCI_RET_INVAL;
59 63
60 target_pc = *vcpu_reg(source_vcpu, 2); 64 target_pc = *vcpu_reg(source_vcpu, 2);
61 65
62 wq = kvm_arch_vcpu_wq(vcpu);
63 if (!waitqueue_active(wq))
64 return KVM_PSCI_RET_INVAL;
65
66 kvm_reset_vcpu(vcpu); 66 kvm_reset_vcpu(vcpu);
67 67
68 /* Gracefully handle Thumb2 entry point */ 68 /* Gracefully handle Thumb2 entry point */
@@ -79,6 +79,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
79 vcpu->arch.pause = false; 79 vcpu->arch.pause = false;
80 smp_mb(); /* Make sure the above is visible */ 80 smp_mb(); /* Make sure the above is visible */
81 81
82 wq = kvm_arch_vcpu_wq(vcpu);
82 wake_up_interruptible(wq); 83 wake_up_interruptible(wq);
83 84
84 return KVM_PSCI_RET_SUCCESS; 85 return KVM_PSCI_RET_SUCCESS;
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 47d7338561de..0573faab96ad 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -13,7 +13,7 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
13 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 13 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
14 ucmpdi2.o lib1funcs.o div64.o \ 14 ucmpdi2.o lib1funcs.o div64.o \
15 io-readsb.o io-writesb.o io-readsl.o io-writesl.o \ 15 io-readsb.o io-writesb.o io-readsl.o io-writesl.o \
16 call_with_stack.o 16 call_with_stack.o bswapsdi2.o
17 17
18mmu-y := clear_user.o copy_page.o getuser.o putuser.o 18mmu-y := clear_user.o copy_page.o getuser.o putuser.o
19 19
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S
index cd07b5814c23..4102be617fce 100644
--- a/arch/arm/lib/backtrace.S
+++ b/arch/arm/lib/backtrace.S
@@ -80,14 +80,14 @@ for_each_frame: tst frame, mask @ Check for address exceptions
80 80
81 ldr r1, [sv_pc, #-4] @ if stmfd sp!, {args} exists, 81 ldr r1, [sv_pc, #-4] @ if stmfd sp!, {args} exists,
82 ldr r3, .Ldsi+4 82 ldr r3, .Ldsi+4
83 teq r3, r1, lsr #10 83 teq r3, r1, lsr #11
84 ldreq r0, [frame, #-8] @ get sp 84 ldreq r0, [frame, #-8] @ get sp
85 subeq r0, r0, #4 @ point at the last arg 85 subeq r0, r0, #4 @ point at the last arg
86 bleq .Ldumpstm @ dump saved registers 86 bleq .Ldumpstm @ dump saved registers
87 87
881004: ldr r1, [sv_pc, #0] @ if stmfd sp!, {..., fp, ip, lr, pc} 881004: ldr r1, [sv_pc, #0] @ if stmfd sp!, {..., fp, ip, lr, pc}
89 ldr r3, .Ldsi @ instruction exists, 89 ldr r3, .Ldsi @ instruction exists,
90 teq r3, r1, lsr #10 90 teq r3, r1, lsr #11
91 subeq r0, frame, #16 91 subeq r0, frame, #16
92 bleq .Ldumpstm @ dump saved registers 92 bleq .Ldumpstm @ dump saved registers
93 93
@@ -128,11 +128,11 @@ ENDPROC(c_backtrace)
128 beq 2f 128 beq 2f
129 add r7, r7, #1 129 add r7, r7, #1
130 teq r7, #6 130 teq r7, #6
131 moveq r7, #1 131 moveq r7, #0
132 moveq r1, #'\n' 132 adr r3, .Lcr
133 movne r1, #' ' 133 addne r3, r3, #1 @ skip newline
134 ldr r3, [stack], #-4 134 ldr r2, [stack], #-4
135 mov r2, reg 135 mov r1, reg
136 adr r0, .Lfp 136 adr r0, .Lfp
137 bl printk 137 bl printk
1382: subs reg, reg, #1 1382: subs reg, reg, #1
@@ -142,11 +142,11 @@ ENDPROC(c_backtrace)
142 blne printk 142 blne printk
143 ldmfd sp!, {instr, reg, stack, r7, pc} 143 ldmfd sp!, {instr, reg, stack, r7, pc}
144 144
145.Lfp: .asciz "%cr%d:%08x" 145.Lfp: .asciz " r%d:%08x%s"
146.Lcr: .asciz "\n" 146.Lcr: .asciz "\n"
147.Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n" 147.Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n"
148 .align 148 .align
149.Ldsi: .word 0xe92dd800 >> 10 @ stmfd sp!, {... fp, ip, lr, pc} 149.Ldsi: .word 0xe92dd800 >> 11 @ stmfd sp!, {... fp, ip, lr, pc}
150 .word 0xe92d0000 >> 10 @ stmfd sp!, {} 150 .word 0xe92d0000 >> 11 @ stmfd sp!, {}
151 151
152#endif 152#endif
diff --git a/arch/arm/lib/bswapsdi2.S b/arch/arm/lib/bswapsdi2.S
new file mode 100644
index 000000000000..9fcdd154eff9
--- /dev/null
+++ b/arch/arm/lib/bswapsdi2.S
@@ -0,0 +1,36 @@
1#include <linux/linkage.h>
2
3#if __LINUX_ARM_ARCH__ >= 6
4ENTRY(__bswapsi2)
5 rev r0, r0
6 bx lr
7ENDPROC(__bswapsi2)
8
9ENTRY(__bswapdi2)
10 rev r3, r0
11 rev r0, r1
12 mov r1, r3
13 bx lr
14ENDPROC(__bswapdi2)
15#else
16ENTRY(__bswapsi2)
17 eor r3, r0, r0, ror #16
18 mov r3, r3, lsr #8
19 bic r3, r3, #0xff00
20 eor r0, r3, r0, ror #8
21 mov pc, lr
22ENDPROC(__bswapsi2)
23
24ENTRY(__bswapdi2)
25 mov ip, r1
26 eor r3, ip, ip, ror #16
27 eor r1, r0, r0, ror #16
28 mov r1, r1, lsr #8
29 mov r3, r3, lsr #8
30 bic r3, r3, #0xff00
31 bic r1, r1, #0xff00
32 eor r1, r1, r0, ror #8
33 eor r0, r3, ip, ror #8
34 mov pc, lr
35ENDPROC(__bswapdi2)
36#endif
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 699b71e7f7ec..4f0e800e7e71 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -1,15 +1,33 @@
1if ARCH_AT91 1if ARCH_AT91
2 2
3config HAVE_AT91_UTMI
4 bool
5
6config HAVE_AT91_USB_CLK
7 bool
8
3config HAVE_AT91_DBGU0 9config HAVE_AT91_DBGU0
4 bool 10 bool
5 11
6config HAVE_AT91_DBGU1 12config HAVE_AT91_DBGU1
7 bool 13 bool
8 14
15config AT91_USE_OLD_CLK
16 bool
17
9config AT91_PMC_UNIT 18config AT91_PMC_UNIT
10 bool 19 bool
11 default !ARCH_AT91X40 20 default !ARCH_AT91X40
12 21
22config COMMON_CLK_AT91
23 bool
24 default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK
25 select COMMON_CLK
26
27config OLD_CLK_AT91
28 bool
29 default AT91_PMC_UNIT && AT91_USE_OLD_CLK
30
13config AT91_SAM9_ALT_RESET 31config AT91_SAM9_ALT_RESET
14 bool 32 bool
15 default !ARCH_AT91X40 33 default !ARCH_AT91X40
@@ -21,6 +39,9 @@ config AT91_SAM9G45_RESET
21config AT91_SAM9_TIME 39config AT91_SAM9_TIME
22 bool 40 bool
23 41
42config HAVE_AT91_SMD
43 bool
44
24config SOC_AT91SAM9 45config SOC_AT91SAM9
25 bool 46 bool
26 select AT91_SAM9_TIME 47 select AT91_SAM9_TIME
@@ -61,13 +82,15 @@ comment "Atmel AT91 Processor"
61if SOC_SAM_V7 82if SOC_SAM_V7
62config SOC_SAMA5D3 83config SOC_SAMA5D3
63 bool "SAMA5D3 family" 84 bool "SAMA5D3 family"
64 depends on SOC_SAM_V7
65 select SOC_SAMA5 85 select SOC_SAMA5
66 select HAVE_FB_ATMEL 86 select HAVE_FB_ATMEL
67 select HAVE_AT91_DBGU1 87 select HAVE_AT91_DBGU1
88 select HAVE_AT91_UTMI
89 select HAVE_AT91_SMD
90 select HAVE_AT91_USB_CLK
68 help 91 help
69 Select this if you are using one of Atmel's SAMA5D3 family SoC. 92 Select this if you are using one of Atmel's SAMA5D3 family SoC.
70 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. 93 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36.
71endif 94endif
72 95
73if SOC_SAM_V4_V5 96if SOC_SAM_V4_V5
@@ -78,11 +101,15 @@ config SOC_AT91RM9200
78 select HAVE_AT91_DBGU0 101 select HAVE_AT91_DBGU0
79 select MULTI_IRQ_HANDLER 102 select MULTI_IRQ_HANDLER
80 select SPARSE_IRQ 103 select SPARSE_IRQ
104 select AT91_USE_OLD_CLK
105 select HAVE_AT91_USB_CLK
81 106
82config SOC_AT91SAM9260 107config SOC_AT91SAM9260
83 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" 108 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
84 select HAVE_AT91_DBGU0 109 select HAVE_AT91_DBGU0
85 select SOC_AT91SAM9 110 select SOC_AT91SAM9
111 select AT91_USE_OLD_CLK
112 select HAVE_AT91_USB_CLK
86 help 113 help
87 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE 114 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
88 or AT91SAM9G20 SoC. 115 or AT91SAM9G20 SoC.
@@ -92,6 +119,8 @@ config SOC_AT91SAM9261
92 select HAVE_AT91_DBGU0 119 select HAVE_AT91_DBGU0
93 select HAVE_FB_ATMEL 120 select HAVE_FB_ATMEL
94 select SOC_AT91SAM9 121 select SOC_AT91SAM9
122 select AT91_USE_OLD_CLK
123 select HAVE_AT91_USB_CLK
95 help 124 help
96 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC. 125 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC.
97 126
@@ -100,18 +129,25 @@ config SOC_AT91SAM9263
100 select HAVE_AT91_DBGU1 129 select HAVE_AT91_DBGU1
101 select HAVE_FB_ATMEL 130 select HAVE_FB_ATMEL
102 select SOC_AT91SAM9 131 select SOC_AT91SAM9
132 select AT91_USE_OLD_CLK
133 select HAVE_AT91_USB_CLK
103 134
104config SOC_AT91SAM9RL 135config SOC_AT91SAM9RL
105 bool "AT91SAM9RL" 136 bool "AT91SAM9RL"
106 select HAVE_AT91_DBGU0 137 select HAVE_AT91_DBGU0
107 select HAVE_FB_ATMEL 138 select HAVE_FB_ATMEL
108 select SOC_AT91SAM9 139 select SOC_AT91SAM9
140 select AT91_USE_OLD_CLK
141 select HAVE_AT91_UTMI
109 142
110config SOC_AT91SAM9G45 143config SOC_AT91SAM9G45
111 bool "AT91SAM9G45 or AT91SAM9M10 families" 144 bool "AT91SAM9G45 or AT91SAM9M10 families"
112 select HAVE_AT91_DBGU1 145 select HAVE_AT91_DBGU1
113 select HAVE_FB_ATMEL 146 select HAVE_FB_ATMEL
114 select SOC_AT91SAM9 147 select SOC_AT91SAM9
148 select AT91_USE_OLD_CLK
149 select HAVE_AT91_UTMI
150 select HAVE_AT91_USB_CLK
115 help 151 help
116 Select this if you are using one of Atmel's AT91SAM9G45 family SoC. 152 Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
117 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. 153 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
@@ -121,6 +157,10 @@ config SOC_AT91SAM9X5
121 select HAVE_AT91_DBGU0 157 select HAVE_AT91_DBGU0
122 select HAVE_FB_ATMEL 158 select HAVE_FB_ATMEL
123 select SOC_AT91SAM9 159 select SOC_AT91SAM9
160 select AT91_USE_OLD_CLK
161 select HAVE_AT91_UTMI
162 select HAVE_AT91_SMD
163 select HAVE_AT91_USB_CLK
124 help 164 help
125 Select this if you are using one of Atmel's AT91SAM9x5 family SoC. 165 Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
126 This means that your SAM9 name finishes with a '5' (except if it is 166 This means that your SAM9 name finishes with a '5' (except if it is
@@ -133,6 +173,8 @@ config SOC_AT91SAM9N12
133 select HAVE_AT91_DBGU0 173 select HAVE_AT91_DBGU0
134 select HAVE_FB_ATMEL 174 select HAVE_FB_ATMEL
135 select SOC_AT91SAM9 175 select SOC_AT91SAM9
176 select AT91_USE_OLD_CLK
177 select HAVE_AT91_USB_CLK
136 help 178 help
137 Select this if you are using Atmel's AT91SAM9N12 SoC. 179 Select this if you are using Atmel's AT91SAM9N12 SoC.
138 180
@@ -172,12 +214,6 @@ config MACH_SAMA5_DT
172 214
173comment "AT91 Feature Selections" 215comment "AT91 Feature Selections"
174 216
175config AT91_PROGRAMMABLE_CLOCKS
176 bool "Programmable Clocks"
177 help
178 Select this if you need to program one or more of the PCK0..PCK3
179 programmable clock outputs.
180
181config AT91_SLOW_CLOCK 217config AT91_SLOW_CLOCK
182 bool "Suspend-to-RAM disables main oscillator" 218 bool "Suspend-to-RAM disables main oscillator"
183 depends on SUSPEND 219 depends on SUSPEND
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
index ca900be144ce..1f73e9b527da 100644
--- a/arch/arm/mach-at91/Kconfig.non_dt
+++ b/arch/arm/mach-at91/Kconfig.non_dt
@@ -12,26 +12,32 @@ config ARCH_AT91_NONE
12config ARCH_AT91RM9200 12config ARCH_AT91RM9200
13 bool "AT91RM9200" 13 bool "AT91RM9200"
14 select SOC_AT91RM9200 14 select SOC_AT91RM9200
15 select AT91_USE_OLD_CLK
15 16
16config ARCH_AT91SAM9260 17config ARCH_AT91SAM9260
17 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20" 18 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
18 select SOC_AT91SAM9260 19 select SOC_AT91SAM9260
20 select AT91_USE_OLD_CLK
19 21
20config ARCH_AT91SAM9261 22config ARCH_AT91SAM9261
21 bool "AT91SAM9261 or AT91SAM9G10" 23 bool "AT91SAM9261 or AT91SAM9G10"
22 select SOC_AT91SAM9261 24 select SOC_AT91SAM9261
25 select AT91_USE_OLD_CLK
23 26
24config ARCH_AT91SAM9263 27config ARCH_AT91SAM9263
25 bool "AT91SAM9263" 28 bool "AT91SAM9263"
26 select SOC_AT91SAM9263 29 select SOC_AT91SAM9263
30 select AT91_USE_OLD_CLK
27 31
28config ARCH_AT91SAM9RL 32config ARCH_AT91SAM9RL
29 bool "AT91SAM9RL" 33 bool "AT91SAM9RL"
30 select SOC_AT91SAM9RL 34 select SOC_AT91SAM9RL
35 select AT91_USE_OLD_CLK
31 36
32config ARCH_AT91SAM9G45 37config ARCH_AT91SAM9G45
33 bool "AT91SAM9G45" 38 bool "AT91SAM9G45"
34 select SOC_AT91SAM9G45 39 select SOC_AT91SAM9G45
40 select AT91_USE_OLD_CLK
35 41
36config ARCH_AT91X40 42config ARCH_AT91X40
37 bool "AT91x40" 43 bool "AT91x40"
@@ -176,12 +182,6 @@ config MACH_AFEB9260
176 <svn://194.85.238.22/home/users/george/svn/arm9eb> 182 <svn://194.85.238.22/home/users/george/svn/arm9eb>
177 <http://groups.google.com/group/arm9fpga-evolution-board> 183 <http://groups.google.com/group/arm9fpga-evolution-board>
178 184
179config MACH_QIL_A9260
180 bool "CALAO QIL-A9260 board"
181 help
182 Select this if you are using a Calao Systems QIL-A9260 Board.
183 <http://www.calao-systems.com>
184
185config MACH_CPU9260 185config MACH_CPU9260
186 bool "Eukrea CPU9260 board" 186 bool "Eukrea CPU9260 board"
187 help 187 help
@@ -241,7 +241,7 @@ config MACH_PCONTROL_G20
241 bool "PControl G20 CPU module" 241 bool "PControl G20 CPU module"
242 help 242 help
243 Select this if you are using taskit's Stamp9G20 CPU module on this 243 Select this if you are using taskit's Stamp9G20 CPU module on this
244 carrier board, beeing the decentralized unit of a building automation 244 carrier board, being the decentralized unit of a building automation
245 system; featuring nvram, eth-switch, iso-rs485, display, io 245 system; featuring nvram, eth-switch, iso-rs485, display, io
246 246
247config MACH_GSIA18S 247config MACH_GSIA18S
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 90aab2d5a07f..78e9cec282f4 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -7,7 +7,7 @@ obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
9 9
10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o 10obj-$(CONFIG_OLD_CLK_AT91) += clock.o
11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o 11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o 12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o
13obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o 13obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o
@@ -52,7 +52,6 @@ obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o
52obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 52obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
53obj-$(CONFIG_MACH_CAM60) += board-cam60.o 53obj-$(CONFIG_MACH_CAM60) += board-cam60.o
54obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 54obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
55obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
56obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o 55obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
57obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o 56obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o
58obj-$(CONFIG_MACH_FLEXIBITY) += board-flexibity.o 57obj-$(CONFIG_MACH_FLEXIBITY) += board-flexibity.o
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 25805f2f6010..e47f5fd232f5 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -12,13 +12,13 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/reboot.h> 14#include <linux/reboot.h>
15#include <linux/clk/at91_pmc.h>
15 16
16#include <asm/irq.h> 17#include <asm/irq.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/at91rm9200.h> 21#include <mach/at91rm9200.h>
21#include <mach/at91_pmc.h>
22#include <mach/at91_st.h> 22#include <mach/at91_st.h>
23#include <mach/cpu.h> 23#include <mach/cpu.h>
24 24
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index d6a1fa85371d..6c821e562159 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
@@ -20,7 +21,6 @@
20#include <mach/cpu.h> 21#include <mach/cpu.h>
21#include <mach/at91_dbgu.h> 22#include <mach/at91_dbgu.h>
22#include <mach/at91sam9260.h> 23#include <mach/at91sam9260.h>
23#include <mach/at91_pmc.h>
24 24
25#include "at91_aic.h" 25#include "at91_aic.h"
26#include "at91_rstc.h" 26#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 23ba1d8a1531..6276b4c1acfe 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
@@ -19,7 +20,6 @@
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/cpu.h> 21#include <mach/cpu.h>
21#include <mach/at91sam9261.h> 22#include <mach/at91sam9261.h>
22#include <mach/at91_pmc.h>
23 23
24#include "at91_aic.h" 24#include "at91_aic.h"
25#include "at91_rstc.h" 25#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 7eccb0fc57bc..37b90f4b990c 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
@@ -18,7 +19,6 @@
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/at91sam9263.h> 21#include <mach/at91sam9263.h>
21#include <mach/at91_pmc.h>
22 22
23#include "at91_aic.h" 23#include "at91_aic.h"
24#include "at91_rstc.h" 24#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index bb392320a0dd..0f04ffe9c5a8 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -39,6 +39,7 @@
39static u32 pit_cycle; /* write-once */ 39static u32 pit_cycle; /* write-once */
40static u32 pit_cnt; /* access only w/system irq blocked */ 40static u32 pit_cnt; /* access only w/system irq blocked */
41static void __iomem *pit_base_addr __read_mostly; 41static void __iomem *pit_base_addr __read_mostly;
42static struct clk *mck;
42 43
43static inline unsigned int pit_read(unsigned int reg_offset) 44static inline unsigned int pit_read(unsigned int reg_offset)
44{ 45{
@@ -195,10 +196,14 @@ static int __init of_at91sam926x_pit_init(void)
195 if (!pit_base_addr) 196 if (!pit_base_addr)
196 goto node_err; 197 goto node_err;
197 198
199 mck = of_clk_get(np, 0);
200
198 /* Get the interrupts property */ 201 /* Get the interrupts property */
199 ret = irq_of_parse_and_map(np, 0); 202 ret = irq_of_parse_and_map(np, 0);
200 if (!ret) { 203 if (!ret) {
201 pr_crit("AT91: PIT: Unable to get IRQ from DT\n"); 204 pr_crit("AT91: PIT: Unable to get IRQ from DT\n");
205 if (!IS_ERR(mck))
206 clk_put(mck);
202 goto ioremap_err; 207 goto ioremap_err;
203 } 208 }
204 at91sam926x_pit_irq.irq = ret; 209 at91sam926x_pit_irq.irq = ret;
@@ -230,6 +235,8 @@ void __init at91sam926x_pit_init(void)
230 unsigned bits; 235 unsigned bits;
231 int ret; 236 int ret;
232 237
238 mck = ERR_PTR(-ENOENT);
239
233 /* For device tree enabled device: initialize here */ 240 /* For device tree enabled device: initialize here */
234 of_at91sam926x_pit_init(); 241 of_at91sam926x_pit_init();
235 242
@@ -237,7 +244,12 @@ void __init at91sam926x_pit_init(void)
237 * Use our actual MCK to figure out how many MCK/16 ticks per 244 * Use our actual MCK to figure out how many MCK/16 ticks per
238 * 1/HZ period (instead of a compile-time constant LATCH). 245 * 1/HZ period (instead of a compile-time constant LATCH).
239 */ 246 */
240 pit_rate = clk_get_rate(clk_get(NULL, "mck")) / 16; 247 if (IS_ERR(mck))
248 mck = clk_get(NULL, "mck");
249
250 if (IS_ERR(mck))
251 panic("AT91: PIT: Unable to get mck clk\n");
252 pit_rate = clk_get_rate(mck) / 16;
241 pit_cycle = (pit_rate + HZ/2) / HZ; 253 pit_cycle = (pit_rate + HZ/2) / HZ;
242 WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0); 254 WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
243 255
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 9405aa08b104..2f455ce35268 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -12,13 +12,13 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/clk/at91_pmc.h>
15 16
16#include <asm/irq.h> 17#include <asm/irq.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/at91sam9g45.h> 21#include <mach/at91sam9g45.h>
21#include <mach/at91_pmc.h>
22#include <mach/cpu.h> 22#include <mach/cpu.h>
23 23
24#include "at91_aic.h" 24#include "at91_aic.h"
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 388ec3aec4b9..4ef088c62eab 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -8,12 +8,12 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/dma-mapping.h> 10#include <linux/dma-mapping.h>
11#include <linux/clk/at91_pmc.h>
11 12
12#include <asm/irq.h> 13#include <asm/irq.h>
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 15#include <asm/mach/map.h>
15#include <mach/at91sam9n12.h> 16#include <mach/at91sam9n12.h>
16#include <mach/at91_pmc.h>
17#include <mach/cpu.h> 17#include <mach/cpu.h>
18 18
19#include "board.h" 19#include "board.h"
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 0750ffb7e6b1..3651517abedf 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/clk/at91_pmc.h>
13 14
14#include <asm/proc-fns.h> 15#include <asm/proc-fns.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
@@ -19,7 +20,6 @@
19#include <mach/cpu.h> 20#include <mach/cpu.h>
20#include <mach/at91_dbgu.h> 21#include <mach/at91_dbgu.h>
21#include <mach/at91sam9rl.h> 22#include <mach/at91sam9rl.h>
22#include <mach/at91_pmc.h>
23 23
24#include "at91_aic.h" 24#include "at91_aic.h"
25#include "at91_rstc.h" 25#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index e8a2e075a1b8..3e8ec26e39dc 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -8,12 +8,12 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/dma-mapping.h> 10#include <linux/dma-mapping.h>
11#include <linux/clk/at91_pmc.h>
11 12
12#include <asm/irq.h> 13#include <asm/irq.h>
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 15#include <asm/mach/map.h>
15#include <mach/at91sam9x5.h> 16#include <mach/at91sam9x5.h>
16#include <mach/at91_pmc.h>
17#include <mach/cpu.h> 17#include <mach/cpu.h>
18 18
19#include "board.h" 19#include "board.h"
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index bf00d15d954d..075ec0576ada 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -16,6 +16,7 @@
16#include <linux/of_irq.h> 16#include <linux/of_irq.h>
17#include <linux/of_platform.h> 17#include <linux/of_platform.h>
18#include <linux/phy.h> 18#include <linux/phy.h>
19#include <linux/clk-provider.h>
19 20
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
@@ -26,6 +27,13 @@
26#include "at91_aic.h" 27#include "at91_aic.h"
27#include "generic.h" 28#include "generic.h"
28 29
30static void __init sama5_dt_timer_init(void)
31{
32#if defined(CONFIG_COMMON_CLK)
33 of_clk_init(NULL);
34#endif
35 at91sam926x_pit_init();
36}
29 37
30static const struct of_device_id irq_of_match[] __initconst = { 38static const struct of_device_id irq_of_match[] __initconst = {
31 39
@@ -72,7 +80,7 @@ static const char *sama5_dt_board_compat[] __initdata = {
72 80
73DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") 81DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
74 /* Maintainer: Atmel */ 82 /* Maintainer: Atmel */
75 .init_time = at91sam926x_pit_init, 83 .init_time = sama5_dt_timer_init,
76 .map_io = at91_map_io, 84 .map_io = at91_map_io,
77 .handle_irq = at91_aic5_handle_irq, 85 .handle_irq = at91_aic5_handle_irq,
78 .init_early = at91_dt_initialize, 86 .init_early = at91_dt_initialize,
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
deleted file mode 100644
index aa3bc9b0f150..000000000000
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ /dev/null
@@ -1,266 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-qil-a9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2007 Calao-systems
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/gpio.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spi/spi.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/clk.h>
33
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <mach/hardware.h>
43#include <mach/at91sam9_smc.h>
44
45#include "at91_aic.h"
46#include "at91_shdwc.h"
47#include "board.h"
48#include "sam9_smc.h"
49#include "generic.h"
50
51
52static void __init ek_init_early(void)
53{
54 /* Initialize processor: 12.000 MHz crystal */
55 at91_initialize(12000000);
56}
57
58/*
59 * USB Host port
60 */
61static struct at91_usbh_data __initdata ek_usbh_data = {
62 .ports = 2,
63 .vbus_pin = {-EINVAL, -EINVAL},
64 .overcurrent_pin= {-EINVAL, -EINVAL},
65};
66
67/*
68 * USB Device port
69 */
70static struct at91_udc_data __initdata ek_udc_data = {
71 .vbus_pin = AT91_PIN_PC5,
72 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
73};
74
75/*
76 * SPI devices.
77 */
78static struct spi_board_info ek_spi_devices[] = {
79#if defined(CONFIG_RTC_DRV_M41T94)
80 { /* M41T94 RTC */
81 .modalias = "m41t94",
82 .chip_select = 0,
83 .max_speed_hz = 1 * 1000 * 1000,
84 .bus_num = 0,
85 }
86#endif
87};
88
89/*
90 * MACB Ethernet device
91 */
92static struct macb_platform_data __initdata ek_macb_data = {
93 .phy_irq_pin = AT91_PIN_PA31,
94 .is_rmii = 1,
95};
96
97/*
98 * NAND flash
99 */
100static struct mtd_partition __initdata ek_nand_partition[] = {
101 {
102 .name = "Uboot & Kernel",
103 .offset = 0,
104 .size = SZ_16M,
105 },
106 {
107 .name = "Root FS",
108 .offset = MTDPART_OFS_NXTBLK,
109 .size = 120 * SZ_1M,
110 },
111 {
112 .name = "FS",
113 .offset = MTDPART_OFS_NXTBLK,
114 .size = 120 * SZ_1M,
115 },
116};
117
118static struct atmel_nand_data __initdata ek_nand_data = {
119 .ale = 21,
120 .cle = 22,
121 .det_pin = -EINVAL,
122 .rdy_pin = AT91_PIN_PC13,
123 .enable_pin = AT91_PIN_PC14,
124 .ecc_mode = NAND_ECC_SOFT,
125 .on_flash_bbt = 1,
126 .parts = ek_nand_partition,
127 .num_parts = ARRAY_SIZE(ek_nand_partition),
128};
129
130static struct sam9_smc_config __initdata ek_nand_smc_config = {
131 .ncs_read_setup = 0,
132 .nrd_setup = 1,
133 .ncs_write_setup = 0,
134 .nwe_setup = 1,
135
136 .ncs_read_pulse = 3,
137 .nrd_pulse = 3,
138 .ncs_write_pulse = 3,
139 .nwe_pulse = 3,
140
141 .read_cycle = 5,
142 .write_cycle = 5,
143
144 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
145 .tdf_cycles = 2,
146};
147
148static void __init ek_add_device_nand(void)
149{
150 /* configure chip-select 3 (NAND) */
151 sam9_smc_configure(0, 3, &ek_nand_smc_config);
152
153 at91_add_device_nand(&ek_nand_data);
154}
155
156/*
157 * MCI (SD/MMC)
158 */
159static struct mci_platform_data __initdata ek_mci0_data = {
160 .slot[0] = {
161 .bus_width = 4,
162 .detect_pin = -EINVAL,
163 .wp_pin = -EINVAL,
164 },
165};
166
167/*
168 * GPIO Buttons
169 */
170#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
171static struct gpio_keys_button ek_buttons[] = {
172 { /* USER PUSH BUTTON */
173 .code = KEY_ENTER,
174 .gpio = AT91_PIN_PB10,
175 .active_low = 1,
176 .desc = "user_pb",
177 .wakeup = 1,
178 }
179};
180
181static struct gpio_keys_platform_data ek_button_data = {
182 .buttons = ek_buttons,
183 .nbuttons = ARRAY_SIZE(ek_buttons),
184};
185
186static struct platform_device ek_button_device = {
187 .name = "gpio-keys",
188 .id = -1,
189 .num_resources = 0,
190 .dev = {
191 .platform_data = &ek_button_data,
192 }
193};
194
195static void __init ek_add_device_buttons(void)
196{
197 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
198 at91_set_deglitch(AT91_PIN_PB10, 1);
199
200 platform_device_register(&ek_button_device);
201}
202#else
203static void __init ek_add_device_buttons(void) {}
204#endif
205
206/*
207 * LEDs
208 */
209static struct gpio_led ek_leds[] = {
210 { /* user_led (green) */
211 .name = "user_led",
212 .gpio = AT91_PIN_PB21,
213 .active_low = 0,
214 .default_trigger = "heartbeat",
215 }
216};
217
218static void __init ek_board_init(void)
219{
220 /* Serial */
221 /* DBGU on ttyS0. (Rx & Tx only) */
222 at91_register_uart(0, 0, 0);
223
224 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
225 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
226 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
227 | ATMEL_UART_RI);
228
229 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
230 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
231
232 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
233 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
234 at91_add_device_serial();
235 /* USB Host */
236 at91_add_device_usbh(&ek_usbh_data);
237 /* USB Device */
238 at91_add_device_udc(&ek_udc_data);
239 /* SPI */
240 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
241 /* NAND */
242 ek_add_device_nand();
243 /* I2C */
244 at91_add_device_i2c(NULL, 0);
245 /* Ethernet */
246 at91_add_device_eth(&ek_macb_data);
247 /* MMC */
248 at91_add_device_mci(0, &ek_mci0_data);
249 /* Push Buttons */
250 ek_add_device_buttons();
251 /* LEDs */
252 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
253 /* shutdown controller, wakeup button (5 msec low) */
254 at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
255 | AT91_SHDW_RTTWKEN);
256}
257
258MACHINE_START(QIL_A9260, "CALAO QIL_A9260")
259 /* Maintainer: calao-systems */
260 .init_time = at91sam926x_pit_init,
261 .map_io = at91_map_io,
262 .handle_irq = at91_aic_handle_irq,
263 .init_early = ek_init_early,
264 .init_irq = at91_init_irq_default,
265 .init_machine = ek_board_init,
266MACHINE_END
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 6b2630a92f71..034529d801b2 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -24,9 +24,9 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/of_address.h> 26#include <linux/of_address.h>
27#include <linux/clk/at91_pmc.h>
27 28
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29#include <mach/at91_pmc.h>
30#include <mach/cpu.h> 30#include <mach/cpu.h>
31 31
32#include <asm/proc-fns.h> 32#include <asm/proc-fns.h>
@@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate);
330 330
331/*------------------------------------------------------------------------*/ 331/*------------------------------------------------------------------------*/
332 332
333#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
334
335/* 333/*
336 * For now, only the programmable clocks support reparenting (MCK could 334 * For now, only the programmable clocks support reparenting (MCK could
337 * do this too, with care) or rate changing (the PLLs could do this too, 335 * do this too, with care) or rate changing (the PLLs could do this too,
@@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk)
459 clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr); 457 clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
460} 458}
461 459
462#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
463
464/*------------------------------------------------------------------------*/ 460/*------------------------------------------------------------------------*/
465 461
466#ifdef CONFIG_DEBUG_FS 462#ifdef CONFIG_DEBUG_FS
@@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk)
577 clk->parent = &mck; 573 clk->parent = &mck;
578 clk->mode = pmc_sys_mode; 574 clk->mode = pmc_sys_mode;
579 } 575 }
580#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
581 else if (clk_is_programmable(clk)) { 576 else if (clk_is_programmable(clk)) {
582 clk->mode = pmc_sys_mode; 577 clk->mode = pmc_sys_mode;
583 init_programmable_clock(clk); 578 init_programmable_clock(clk);
584 } 579 }
585#endif
586 580
587 at91_clk_add(clk); 581 at91_clk_add(clk);
588 582
@@ -884,6 +878,11 @@ static int __init at91_pmc_init(unsigned long main_clock)
884#if defined(CONFIG_OF) 878#if defined(CONFIG_OF)
885static struct of_device_id pmc_ids[] = { 879static struct of_device_id pmc_ids[] = {
886 { .compatible = "atmel,at91rm9200-pmc" }, 880 { .compatible = "atmel,at91rm9200-pmc" },
881 { .compatible = "atmel,at91sam9260-pmc" },
882 { .compatible = "atmel,at91sam9g45-pmc" },
883 { .compatible = "atmel,at91sam9n12-pmc" },
884 { .compatible = "atmel,at91sam9x5-pmc" },
885 { .compatible = "atmel,sama5d3-pmc" },
887 { /*sentinel*/ } 886 { /*sentinel*/ }
888}; 887};
889 888
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 26dee3ce9397..631fa3b8c16d 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -46,11 +46,12 @@ extern void at91sam926x_pit_init(void);
46extern void at91x40_timer_init(void); 46extern void at91x40_timer_init(void);
47 47
48 /* Clocks */ 48 /* Clocks */
49#ifdef CONFIG_AT91_PMC_UNIT 49#ifdef CONFIG_OLD_CLK_AT91
50extern int __init at91_clock_init(unsigned long main_clock); 50extern int __init at91_clock_init(unsigned long main_clock);
51extern int __init at91_dt_clock_init(void); 51extern int __init at91_dt_clock_init(void);
52#else 52#else
53static int inline at91_clock_init(unsigned long main_clock) { return 0; } 53static int inline at91_clock_init(unsigned long main_clock) { return 0; }
54static int inline at91_dt_clock_init(void) { return 0; }
54#endif 55#endif
55struct device; 56struct device;
56 57
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
deleted file mode 100644
index c604cc69acb5..000000000000
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ /dev/null
@@ -1,190 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_pmc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Power Management Controller (PMC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_PMC_H
17#define AT91_PMC_H
18
19#ifndef __ASSEMBLY__
20extern void __iomem *at91_pmc_base;
21
22#define at91_pmc_read(field) \
23 __raw_readl(at91_pmc_base + field)
24
25#define at91_pmc_write(field, value) \
26 __raw_writel(value, at91_pmc_base + field)
27#else
28.extern at91_pmc_base
29#endif
30
31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
32#define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */
33
34#define AT91_PMC_SCSR 0x08 /* System Clock Status Register */
35#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
36#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */
37#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
38#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */
39#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */
40#define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */
41#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */
42#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */
43#define AT91_PMC_PCK2 (1 << 10) /* Programmable Clock 2 */
44#define AT91_PMC_PCK3 (1 << 11) /* Programmable Clock 3 */
45#define AT91_PMC_PCK4 (1 << 12) /* Programmable Clock 4 [AT572D940HF only] */
46#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
47#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
48
49#define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */
50#define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */
51#define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */
52
53#define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */
54#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
55#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
56#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
57#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */
58
59#define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */
60#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
61#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */
62#define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */
63#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
64#define AT91_PMC_KEY (0x37 << 16) /* MOR Writing Key */
65#define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */
66#define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */
67
68#define AT91_CKGR_MCFR 0x24 /* Main Clock Frequency Register */
69#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */
70#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */
71
72#define AT91_CKGR_PLLAR 0x28 /* PLL A Register */
73#define AT91_CKGR_PLLBR 0x2c /* PLL B Register */
74#define AT91_PMC_DIV (0xff << 0) /* Divider */
75#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
76#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
77#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
78#define AT91_PMC_MUL_GET(n) ((n) >> 16 & 0x7ff)
79#define AT91_PMC3_MUL (0x7f << 18) /* PLL Multiplier [SAMA5 only] */
80#define AT91_PMC3_MUL_GET(n) ((n) >> 18 & 0x7f)
81#define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */
82#define AT91_PMC_USBDIV_1 (0 << 28)
83#define AT91_PMC_USBDIV_2 (1 << 28)
84#define AT91_PMC_USBDIV_4 (2 << 28)
85#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
86
87#define AT91_PMC_MCKR 0x30 /* Master Clock Register */
88#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
89#define AT91_PMC_CSS_SLOW (0 << 0)
90#define AT91_PMC_CSS_MAIN (1 << 0)
91#define AT91_PMC_CSS_PLLA (2 << 0)
92#define AT91_PMC_CSS_PLLB (3 << 0)
93#define AT91_PMC_CSS_UPLL (3 << 0) /* [some SAM9 only] */
94#define PMC_PRES_OFFSET 2
95#define AT91_PMC_PRES (7 << PMC_PRES_OFFSET) /* Master Clock Prescaler */
96#define AT91_PMC_PRES_1 (0 << PMC_PRES_OFFSET)
97#define AT91_PMC_PRES_2 (1 << PMC_PRES_OFFSET)
98#define AT91_PMC_PRES_4 (2 << PMC_PRES_OFFSET)
99#define AT91_PMC_PRES_8 (3 << PMC_PRES_OFFSET)
100#define AT91_PMC_PRES_16 (4 << PMC_PRES_OFFSET)
101#define AT91_PMC_PRES_32 (5 << PMC_PRES_OFFSET)
102#define AT91_PMC_PRES_64 (6 << PMC_PRES_OFFSET)
103#define PMC_ALT_PRES_OFFSET 4
104#define AT91_PMC_ALT_PRES (7 << PMC_ALT_PRES_OFFSET) /* Master Clock Prescaler [alternate location] */
105#define AT91_PMC_ALT_PRES_1 (0 << PMC_ALT_PRES_OFFSET)
106#define AT91_PMC_ALT_PRES_2 (1 << PMC_ALT_PRES_OFFSET)
107#define AT91_PMC_ALT_PRES_4 (2 << PMC_ALT_PRES_OFFSET)
108#define AT91_PMC_ALT_PRES_8 (3 << PMC_ALT_PRES_OFFSET)
109#define AT91_PMC_ALT_PRES_16 (4 << PMC_ALT_PRES_OFFSET)
110#define AT91_PMC_ALT_PRES_32 (5 << PMC_ALT_PRES_OFFSET)
111#define AT91_PMC_ALT_PRES_64 (6 << PMC_ALT_PRES_OFFSET)
112#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
113#define AT91RM9200_PMC_MDIV_1 (0 << 8) /* [AT91RM9200 only] */
114#define AT91RM9200_PMC_MDIV_2 (1 << 8)
115#define AT91RM9200_PMC_MDIV_3 (2 << 8)
116#define AT91RM9200_PMC_MDIV_4 (3 << 8)
117#define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9 only] */
118#define AT91SAM9_PMC_MDIV_2 (1 << 8)
119#define AT91SAM9_PMC_MDIV_4 (2 << 8)
120#define AT91SAM9_PMC_MDIV_6 (3 << 8) /* [some SAM9 only] */
121#define AT91SAM9_PMC_MDIV_3 (3 << 8) /* [some SAM9 only] */
122#define AT91_PMC_PDIV (1 << 12) /* Processor Clock Division [some SAM9 only] */
123#define AT91_PMC_PDIV_1 (0 << 12)
124#define AT91_PMC_PDIV_2 (1 << 12)
125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */
126#define AT91_PMC_PLLADIV2_OFF (0 << 12)
127#define AT91_PMC_PLLADIV2_ON (1 << 12)
128
129#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
130#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
131#define AT91_PMC_USBS_PLLA (0 << 0)
132#define AT91_PMC_USBS_UPLL (1 << 0)
133#define AT91_PMC_USBS_PLLB (1 << 0) /* [AT91SAMN12 only] */
134#define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */
135#define AT91_PMC_OHCIUSBDIV_1 (0x0 << 8)
136#define AT91_PMC_OHCIUSBDIV_2 (0x1 << 8)
137
138#define AT91_PMC_SMD 0x3c /* Soft Modem Clock Register [some SAM9 only] */
139#define AT91_PMC_SMDS (0x1 << 0) /* SMD input clock selection */
140#define AT91_PMC_SMD_DIV (0x1f << 8) /* SMD input clock divider */
141#define AT91_PMC_SMDDIV(n) (((n) << 8) & AT91_PMC_SMD_DIV)
142
143#define AT91_PMC_PCKR(n) (0x40 + ((n) * 4)) /* Programmable Clock 0-N Registers */
144#define AT91_PMC_ALT_PCKR_CSS (0x7 << 0) /* Programmable Clock Source Selection [alternate length] */
145#define AT91_PMC_CSS_MASTER (4 << 0) /* [some SAM9 only] */
146#define AT91_PMC_CSSMCK (0x1 << 8) /* CSS or Master Clock Selection */
147#define AT91_PMC_CSSMCK_CSS (0 << 8)
148#define AT91_PMC_CSSMCK_MCK (1 << 8)
149
150#define AT91_PMC_IER 0x60 /* Interrupt Enable Register */
151#define AT91_PMC_IDR 0x64 /* Interrupt Disable Register */
152#define AT91_PMC_SR 0x68 /* Status Register */
153#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */
154#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
155#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
156#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
157#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */
158#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
159#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
160#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
161#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
162#define AT91_PMC_MOSCSELS (1 << 16) /* Main Oscillator Selection [some SAM9] */
163#define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */
164#define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */
165#define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */
166
167#define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */
168#define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */
169#define AT91_PMC_WPKEY (0xffffff << 8) /* Write Protect Key */
170#define AT91_PMC_PROTKEY (0x504d43 << 8) /* Activation Code */
171
172#define AT91_PMC_WPSR 0xe8 /* Write Protect Status Register [some SAM9] */
173#define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */
174#define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */
175
176#define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
177#define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */
178#define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */
179
180#define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */
181#define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */
182#define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */
183#define AT91_PMC_PCR_DIV(n) ((n) << 16) /* Divisor Value */
184#define AT91_PMC_PCR_DIV0 0x0 /* Peripheral clock is MCK */
185#define AT91_PMC_PCR_DIV2 0x1 /* Peripheral clock is MCK/2 */
186#define AT91_PMC_PCR_DIV4 0x2 /* Peripheral clock is MCK/4 */
187#define AT91_PMC_PCR_DIV8 0x3 /* Peripheral clock is MCK/8 */
188#define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */
189
190#endif
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index d3d7b993846b..86c71debab5b 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -53,6 +53,7 @@
53#define ARCH_EXID_SAMA5D33 0x00414300 53#define ARCH_EXID_SAMA5D33 0x00414300
54#define ARCH_EXID_SAMA5D34 0x00414301 54#define ARCH_EXID_SAMA5D34 0x00414301
55#define ARCH_EXID_SAMA5D35 0x00584300 55#define ARCH_EXID_SAMA5D35 0x00584300
56#define ARCH_EXID_SAMA5D36 0x00004301
56 57
57#define ARCH_FAMILY_AT91X92 0x09200000 58#define ARCH_FAMILY_AT91X92 0x09200000
58#define ARCH_FAMILY_AT91SAM9 0x01900000 59#define ARCH_FAMILY_AT91SAM9 0x01900000
@@ -105,7 +106,7 @@ enum at91_soc_subtype {
105 106
106 /* SAMA5D3 */ 107 /* SAMA5D3 */
107 AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34, 108 AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34,
108 AT91_SOC_SAMA5D35, 109 AT91_SOC_SAMA5D35, AT91_SOC_SAMA5D36,
109 110
110 /* No subtype for this SoC */ 111 /* No subtype for this SoC */
111 AT91_SOC_SUBTYPE_NONE, 112 AT91_SOC_SUBTYPE_NONE,
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 9986542e8060..590b52dea9f7 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -19,13 +19,13 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/clk/at91_pmc.h>
22 23
23#include <asm/irq.h> 24#include <asm/irq.h>
24#include <linux/atomic.h> 25#include <linux/atomic.h>
25#include <asm/mach/time.h> 26#include <asm/mach/time.h>
26#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
27 28
28#include <mach/at91_pmc.h>
29#include <mach/cpu.h> 29#include <mach/cpu.h>
30 30
31#include "at91_aic.h" 31#include "at91_aic.h"
@@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void)
155 } 155 }
156 } 156 }
157 157
158 if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
159 return 1;
160
161 /* PCK0..PCK3 must be disabled, or configured to use clk32k */ 158 /* PCK0..PCK3 must be disabled, or configured to use clk32k */
162 for (i = 0; i < 4; i++) { 159 for (i = 0; i < 4; i++) {
163 u32 css; 160 u32 css;
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index 098c28ddf025..20018779bae7 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -13,8 +13,8 @@
13 */ 13 */
14 14
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/clk/at91_pmc.h>
16#include <mach/hardware.h> 17#include <mach/hardware.h>
17#include <mach/at91_pmc.h>
18#include <mach/at91_ramc.h> 18#include <mach/at91_ramc.h>
19 19
20 20
diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
index 99a0a1d2b7dc..b26156bf15db 100644
--- a/arch/arm/mach-at91/sam9_smc.c
+++ b/arch/arm/mach-at91/sam9_smc.c
@@ -101,7 +101,7 @@ static void sam9_smc_cs_read(void __iomem *base,
101 /* Pulse register */ 101 /* Pulse register */
102 val = __raw_readl(base + AT91_SMC_PULSE); 102 val = __raw_readl(base + AT91_SMC_PULSE);
103 103
104 config->nwe_setup = val & AT91_SMC_NWEPULSE; 104 config->nwe_pulse = val & AT91_SMC_NWEPULSE;
105 config->ncs_write_pulse = (val & AT91_SMC_NCS_WRPULSE) >> 8; 105 config->ncs_write_pulse = (val & AT91_SMC_NCS_WRPULSE) >> 8;
106 config->nrd_pulse = (val & AT91_SMC_NRDPULSE) >> 16; 106 config->nrd_pulse = (val & AT91_SMC_NRDPULSE) >> 16;
107 config->ncs_read_pulse = (val & AT91_SMC_NCS_RDPULSE) >> 24; 107 config->ncs_read_pulse = (val & AT91_SMC_NCS_RDPULSE) >> 24;
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c
index a28873fe3049..3d775d08de08 100644
--- a/arch/arm/mach-at91/sama5d3.c
+++ b/arch/arm/mach-at91/sama5d3.c
@@ -9,360 +9,19 @@
9 9
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/dma-mapping.h> 11#include <linux/dma-mapping.h>
12#include <linux/clk/at91_pmc.h>
12 13
13#include <asm/irq.h> 14#include <asm/irq.h>
14#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
16#include <mach/sama5d3.h> 17#include <mach/sama5d3.h>
17#include <mach/at91_pmc.h>
18#include <mach/cpu.h> 18#include <mach/cpu.h>
19 19
20#include "soc.h" 20#include "soc.h"
21#include "generic.h" 21#include "generic.h"
22#include "clock.h"
23#include "sam9_smc.h" 22#include "sam9_smc.h"
24 23
25/* -------------------------------------------------------------------- 24/* --------------------------------------------------------------------
26 * Clocks
27 * -------------------------------------------------------------------- */
28
29/*
30 * The peripheral clocks.
31 */
32
33static struct clk pioA_clk = {
34 .name = "pioA_clk",
35 .pid = SAMA5D3_ID_PIOA,
36 .type = CLK_TYPE_PERIPHERAL,
37};
38static struct clk pioB_clk = {
39 .name = "pioB_clk",
40 .pid = SAMA5D3_ID_PIOB,
41 .type = CLK_TYPE_PERIPHERAL,
42};
43static struct clk pioC_clk = {
44 .name = "pioC_clk",
45 .pid = SAMA5D3_ID_PIOC,
46 .type = CLK_TYPE_PERIPHERAL,
47};
48static struct clk pioD_clk = {
49 .name = "pioD_clk",
50 .pid = SAMA5D3_ID_PIOD,
51 .type = CLK_TYPE_PERIPHERAL,
52};
53static struct clk pioE_clk = {
54 .name = "pioE_clk",
55 .pid = SAMA5D3_ID_PIOE,
56 .type = CLK_TYPE_PERIPHERAL,
57};
58static struct clk usart0_clk = {
59 .name = "usart0_clk",
60 .pid = SAMA5D3_ID_USART0,
61 .type = CLK_TYPE_PERIPHERAL,
62 .div = AT91_PMC_PCR_DIV2,
63};
64static struct clk usart1_clk = {
65 .name = "usart1_clk",
66 .pid = SAMA5D3_ID_USART1,
67 .type = CLK_TYPE_PERIPHERAL,
68 .div = AT91_PMC_PCR_DIV2,
69};
70static struct clk usart2_clk = {
71 .name = "usart2_clk",
72 .pid = SAMA5D3_ID_USART2,
73 .type = CLK_TYPE_PERIPHERAL,
74 .div = AT91_PMC_PCR_DIV2,
75};
76static struct clk usart3_clk = {
77 .name = "usart3_clk",
78 .pid = SAMA5D3_ID_USART3,
79 .type = CLK_TYPE_PERIPHERAL,
80 .div = AT91_PMC_PCR_DIV2,
81};
82static struct clk uart0_clk = {
83 .name = "uart0_clk",
84 .pid = SAMA5D3_ID_UART0,
85 .type = CLK_TYPE_PERIPHERAL,
86 .div = AT91_PMC_PCR_DIV2,
87};
88static struct clk uart1_clk = {
89 .name = "uart1_clk",
90 .pid = SAMA5D3_ID_UART1,
91 .type = CLK_TYPE_PERIPHERAL,
92 .div = AT91_PMC_PCR_DIV2,
93};
94static struct clk twi0_clk = {
95 .name = "twi0_clk",
96 .pid = SAMA5D3_ID_TWI0,
97 .type = CLK_TYPE_PERIPHERAL,
98 .div = AT91_PMC_PCR_DIV8,
99};
100static struct clk twi1_clk = {
101 .name = "twi1_clk",
102 .pid = SAMA5D3_ID_TWI1,
103 .type = CLK_TYPE_PERIPHERAL,
104 .div = AT91_PMC_PCR_DIV8,
105};
106static struct clk twi2_clk = {
107 .name = "twi2_clk",
108 .pid = SAMA5D3_ID_TWI2,
109 .type = CLK_TYPE_PERIPHERAL,
110 .div = AT91_PMC_PCR_DIV8,
111};
112static struct clk mmc0_clk = {
113 .name = "mci0_clk",
114 .pid = SAMA5D3_ID_HSMCI0,
115 .type = CLK_TYPE_PERIPHERAL,
116};
117static struct clk mmc1_clk = {
118 .name = "mci1_clk",
119 .pid = SAMA5D3_ID_HSMCI1,
120 .type = CLK_TYPE_PERIPHERAL,
121};
122static struct clk mmc2_clk = {
123 .name = "mci2_clk",
124 .pid = SAMA5D3_ID_HSMCI2,
125 .type = CLK_TYPE_PERIPHERAL,
126};
127static struct clk spi0_clk = {
128 .name = "spi0_clk",
129 .pid = SAMA5D3_ID_SPI0,
130 .type = CLK_TYPE_PERIPHERAL,
131};
132static struct clk spi1_clk = {
133 .name = "spi1_clk",
134 .pid = SAMA5D3_ID_SPI1,
135 .type = CLK_TYPE_PERIPHERAL,
136};
137static struct clk tcb0_clk = {
138 .name = "tcb0_clk",
139 .pid = SAMA5D3_ID_TC0,
140 .type = CLK_TYPE_PERIPHERAL,
141 .div = AT91_PMC_PCR_DIV2,
142};
143static struct clk tcb1_clk = {
144 .name = "tcb1_clk",
145 .pid = SAMA5D3_ID_TC1,
146 .type = CLK_TYPE_PERIPHERAL,
147 .div = AT91_PMC_PCR_DIV2,
148};
149static struct clk adc_clk = {
150 .name = "adc_clk",
151 .pid = SAMA5D3_ID_ADC,
152 .type = CLK_TYPE_PERIPHERAL,
153 .div = AT91_PMC_PCR_DIV2,
154};
155static struct clk adc_op_clk = {
156 .name = "adc_op_clk",
157 .type = CLK_TYPE_PERIPHERAL,
158 .rate_hz = 5000000,
159};
160static struct clk dma0_clk = {
161 .name = "dma0_clk",
162 .pid = SAMA5D3_ID_DMA0,
163 .type = CLK_TYPE_PERIPHERAL,
164};
165static struct clk dma1_clk = {
166 .name = "dma1_clk",
167 .pid = SAMA5D3_ID_DMA1,
168 .type = CLK_TYPE_PERIPHERAL,
169};
170static struct clk uhphs_clk = {
171 .name = "uhphs",
172 .pid = SAMA5D3_ID_UHPHS,
173 .type = CLK_TYPE_PERIPHERAL,
174};
175static struct clk udphs_clk = {
176 .name = "udphs_clk",
177 .pid = SAMA5D3_ID_UDPHS,
178 .type = CLK_TYPE_PERIPHERAL,
179};
180/* gmac only for sama5d33, sama5d34, sama5d35 */
181static struct clk macb0_clk = {
182 .name = "macb0_clk",
183 .pid = SAMA5D3_ID_GMAC,
184 .type = CLK_TYPE_PERIPHERAL,
185};
186/* emac only for sama5d31, sama5d35 */
187static struct clk macb1_clk = {
188 .name = "macb1_clk",
189 .pid = SAMA5D3_ID_EMAC,
190 .type = CLK_TYPE_PERIPHERAL,
191};
192/* lcd only for sama5d31, sama5d33, sama5d34 */
193static struct clk lcdc_clk = {
194 .name = "lcdc_clk",
195 .pid = SAMA5D3_ID_LCDC,
196 .type = CLK_TYPE_PERIPHERAL,
197};
198/* isi only for sama5d33, sama5d35 */
199static struct clk isi_clk = {
200 .name = "isi_clk",
201 .pid = SAMA5D3_ID_ISI,
202 .type = CLK_TYPE_PERIPHERAL,
203};
204static struct clk can0_clk = {
205 .name = "can0_clk",
206 .pid = SAMA5D3_ID_CAN0,
207 .type = CLK_TYPE_PERIPHERAL,
208 .div = AT91_PMC_PCR_DIV2,
209};
210static struct clk can1_clk = {
211 .name = "can1_clk",
212 .pid = SAMA5D3_ID_CAN1,
213 .type = CLK_TYPE_PERIPHERAL,
214 .div = AT91_PMC_PCR_DIV2,
215};
216static struct clk ssc0_clk = {
217 .name = "ssc0_clk",
218 .pid = SAMA5D3_ID_SSC0,
219 .type = CLK_TYPE_PERIPHERAL,
220 .div = AT91_PMC_PCR_DIV2,
221};
222static struct clk ssc1_clk = {
223 .name = "ssc1_clk",
224 .pid = SAMA5D3_ID_SSC1,
225 .type = CLK_TYPE_PERIPHERAL,
226 .div = AT91_PMC_PCR_DIV2,
227};
228static struct clk sha_clk = {
229 .name = "sha_clk",
230 .pid = SAMA5D3_ID_SHA,
231 .type = CLK_TYPE_PERIPHERAL,
232 .div = AT91_PMC_PCR_DIV8,
233};
234static struct clk aes_clk = {
235 .name = "aes_clk",
236 .pid = SAMA5D3_ID_AES,
237 .type = CLK_TYPE_PERIPHERAL,
238};
239static struct clk tdes_clk = {
240 .name = "tdes_clk",
241 .pid = SAMA5D3_ID_TDES,
242 .type = CLK_TYPE_PERIPHERAL,
243};
244
245static struct clk *periph_clocks[] __initdata = {
246 &pioA_clk,
247 &pioB_clk,
248 &pioC_clk,
249 &pioD_clk,
250 &pioE_clk,
251 &usart0_clk,
252 &usart1_clk,
253 &usart2_clk,
254 &usart3_clk,
255 &uart0_clk,
256 &uart1_clk,
257 &twi0_clk,
258 &twi1_clk,
259 &twi2_clk,
260 &mmc0_clk,
261 &mmc1_clk,
262 &mmc2_clk,
263 &spi0_clk,
264 &spi1_clk,
265 &tcb0_clk,
266 &tcb1_clk,
267 &adc_clk,
268 &adc_op_clk,
269 &dma0_clk,
270 &dma1_clk,
271 &uhphs_clk,
272 &udphs_clk,
273 &macb0_clk,
274 &macb1_clk,
275 &lcdc_clk,
276 &isi_clk,
277 &can0_clk,
278 &can1_clk,
279 &ssc0_clk,
280 &ssc1_clk,
281 &sha_clk,
282 &aes_clk,
283 &tdes_clk,
284};
285
286static struct clk pck0 = {
287 .name = "pck0",
288 .pmc_mask = AT91_PMC_PCK0,
289 .type = CLK_TYPE_PROGRAMMABLE,
290 .id = 0,
291};
292
293static struct clk pck1 = {
294 .name = "pck1",
295 .pmc_mask = AT91_PMC_PCK1,
296 .type = CLK_TYPE_PROGRAMMABLE,
297 .id = 1,
298};
299
300static struct clk pck2 = {
301 .name = "pck2",
302 .pmc_mask = AT91_PMC_PCK2,
303 .type = CLK_TYPE_PROGRAMMABLE,
304 .id = 2,
305};
306
307static struct clk_lookup periph_clocks_lookups[] = {
308 /* lookup table for DT entries */
309 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
310 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
311 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
312 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk),
313 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioD_clk),
314 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioE_clk),
315 CLKDEV_CON_DEV_ID("usart", "f001c000.serial", &usart0_clk),
316 CLKDEV_CON_DEV_ID("usart", "f0020000.serial", &usart1_clk),
317 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart2_clk),
318 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart3_clk),
319 CLKDEV_CON_DEV_ID(NULL, "f0014000.i2c", &twi0_clk),
320 CLKDEV_CON_DEV_ID(NULL, "f0018000.i2c", &twi1_clk),
321 CLKDEV_CON_DEV_ID(NULL, "f801c000.i2c", &twi2_clk),
322 CLKDEV_CON_DEV_ID("mci_clk", "f0000000.mmc", &mmc0_clk),
323 CLKDEV_CON_DEV_ID("mci_clk", "f8000000.mmc", &mmc1_clk),
324 CLKDEV_CON_DEV_ID("mci_clk", "f8004000.mmc", &mmc2_clk),
325 CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi0_clk),
326 CLKDEV_CON_DEV_ID("spi_clk", "f8008000.spi", &spi1_clk),
327 CLKDEV_CON_DEV_ID("t0_clk", "f0010000.timer", &tcb0_clk),
328 CLKDEV_CON_DEV_ID("t0_clk", "f8014000.timer", &tcb1_clk),
329 CLKDEV_CON_DEV_ID("tsc_clk", "f8018000.tsadcc", &adc_clk),
330 CLKDEV_CON_DEV_ID("dma_clk", "ffffe600.dma-controller", &dma0_clk),
331 CLKDEV_CON_DEV_ID("dma_clk", "ffffe800.dma-controller", &dma1_clk),
332 CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk),
333 CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk),
334 CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk),
335 CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk),
336 CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk),
337 CLKDEV_CON_DEV_ID("hclk", "f0028000.ethernet", &macb0_clk),
338 CLKDEV_CON_DEV_ID("pclk", "f0028000.ethernet", &macb0_clk),
339 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb1_clk),
340 CLKDEV_CON_DEV_ID("pclk", "f802c000.ethernet", &macb1_clk),
341 CLKDEV_CON_DEV_ID("pclk", "f0008000.ssc", &ssc0_clk),
342 CLKDEV_CON_DEV_ID("pclk", "f000c000.ssc", &ssc1_clk),
343 CLKDEV_CON_DEV_ID("can_clk", "f000c000.can", &can0_clk),
344 CLKDEV_CON_DEV_ID("can_clk", "f8010000.can", &can1_clk),
345 CLKDEV_CON_DEV_ID("sha_clk", "f8034000.sha", &sha_clk),
346 CLKDEV_CON_DEV_ID("aes_clk", "f8038000.aes", &aes_clk),
347 CLKDEV_CON_DEV_ID("tdes_clk", "f803c000.tdes", &tdes_clk),
348};
349
350static void __init sama5d3_register_clocks(void)
351{
352 int i;
353
354 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
355 clk_register(periph_clocks[i]);
356
357 clkdev_add_table(periph_clocks_lookups,
358 ARRAY_SIZE(periph_clocks_lookups));
359
360 clk_register(&pck0);
361 clk_register(&pck1);
362 clk_register(&pck2);
363}
364
365/* --------------------------------------------------------------------
366 * AT91SAM9x5 processor initialization 25 * AT91SAM9x5 processor initialization
367 * -------------------------------------------------------------------- */ 26 * -------------------------------------------------------------------- */
368 27
@@ -378,6 +37,5 @@ static void __init sama5d3_initialize(void)
378 37
379AT91_SOC_START(sama5d3) 38AT91_SOC_START(sama5d3)
380 .map_io = sama5d3_map_io, 39 .map_io = sama5d3_map_io,
381 .register_clocks = sama5d3_register_clocks,
382 .init = sama5d3_initialize, 40 .init = sama5d3_initialize,
383AT91_SOC_END 41AT91_SOC_END
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 094b3459c288..f7ca97b7291e 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -11,6 +11,7 @@
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/of_address.h> 12#include <linux/of_address.h>
13#include <linux/pinctrl/machine.h> 13#include <linux/pinctrl/machine.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/system_misc.h> 16#include <asm/system_misc.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
@@ -18,7 +19,6 @@
18#include <mach/hardware.h> 19#include <mach/hardware.h>
19#include <mach/cpu.h> 20#include <mach/cpu.h>
20#include <mach/at91_dbgu.h> 21#include <mach/at91_dbgu.h>
21#include <mach/at91_pmc.h>
22 22
23#include "at91_shdwc.h" 23#include "at91_shdwc.h"
24#include "soc.h" 24#include "soc.h"
@@ -81,7 +81,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
81 81
82 desc->pfn = __phys_to_pfn(base); 82 desc->pfn = __phys_to_pfn(base);
83 desc->length = length; 83 desc->length = length;
84 desc->type = MT_MEMORY_NONCACHED; 84 desc->type = MT_MEMORY_RWX_NONCACHED;
85 85
86 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n", 86 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n",
87 base, length, desc->virtual); 87 base, length, desc->virtual);
@@ -233,6 +233,9 @@ static void __init soc_detect(u32 dbgu_base)
233 case ARCH_EXID_SAMA5D35: 233 case ARCH_EXID_SAMA5D35:
234 at91_soc_initdata.subtype = AT91_SOC_SAMA5D35; 234 at91_soc_initdata.subtype = AT91_SOC_SAMA5D35;
235 break; 235 break;
236 case ARCH_EXID_SAMA5D36:
237 at91_soc_initdata.subtype = AT91_SOC_SAMA5D36;
238 break;
236 } 239 }
237 } 240 }
238} 241}
@@ -275,6 +278,7 @@ static const char *soc_subtype_name[] = {
275 [AT91_SOC_SAMA5D33] = "sama5d33", 278 [AT91_SOC_SAMA5D33] = "sama5d33",
276 [AT91_SOC_SAMA5D34] = "sama5d34", 279 [AT91_SOC_SAMA5D34] = "sama5d34",
277 [AT91_SOC_SAMA5D35] = "sama5d35", 280 [AT91_SOC_SAMA5D35] = "sama5d35",
281 [AT91_SOC_SAMA5D36] = "sama5d36",
278 [AT91_SOC_SUBTYPE_NONE] = "None", 282 [AT91_SOC_SUBTYPE_NONE] = "None",
279 [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown", 283 [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown",
280}; 284};
@@ -491,7 +495,8 @@ void __init at91rm9200_dt_initialize(void)
491 at91_dt_clock_init(); 495 at91_dt_clock_init();
492 496
493 /* Register the processor-specific clocks */ 497 /* Register the processor-specific clocks */
494 at91_boot_soc.register_clocks(); 498 if (at91_boot_soc.register_clocks)
499 at91_boot_soc.register_clocks();
495 500
496 at91_boot_soc.init(); 501 at91_boot_soc.init();
497} 502}
@@ -506,7 +511,8 @@ void __init at91_dt_initialize(void)
506 at91_dt_clock_init(); 511 at91_dt_clock_init();
507 512
508 /* Register the processor-specific clocks */ 513 /* Register the processor-specific clocks */
509 at91_boot_soc.register_clocks(); 514 if (at91_boot_soc.register_clocks)
515 at91_boot_soc.register_clocks();
510 516
511 if (at91_boot_soc.init) 517 if (at91_boot_soc.init)
512 at91_boot_soc.init(); 518 at91_boot_soc.init();
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 9fe6d88737ed..b1aa6a9b3bd1 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -25,6 +25,7 @@ config ARCH_BCM_MOBILE
25 select TICK_ONESHOT 25 select TICK_ONESHOT
26 select CACHE_L2X0 26 select CACHE_L2X0
27 select HAVE_ARM_ARCH_TIMER 27 select HAVE_ARM_ARCH_TIMER
28 select PINCTRL
28 help 29 help
29 This enables support for systems based on Broadcom mobile SoCs. 30 This enables support for systems based on Broadcom mobile SoCs.
30 It currently supports the 'BCM281XX' family, which includes 31 It currently supports the 'BCM281XX' family, which includes
diff --git a/arch/arm/mach-bcm2835/Kconfig b/arch/arm/mach-bcm2835/Kconfig
index 560045cafc34..d1f9612f8c15 100644
--- a/arch/arm/mach-bcm2835/Kconfig
+++ b/arch/arm/mach-bcm2835/Kconfig
@@ -12,4 +12,4 @@ config ARCH_BCM2835
12 select PINCTRL_BCM2835 12 select PINCTRL_BCM2835
13 help 13 help
14 This enables support for the Broadcom BCM2835 SoC. This SoC is 14 This enables support for the Broadcom BCM2835 SoC. This SoC is
15 use in the Raspberry Pi, and Roku 2 devices. 15 used in the Raspberry Pi and Roku 2 devices.
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
new file mode 100644
index 000000000000..7a02d222c378
--- /dev/null
+++ b/arch/arm/mach-berlin/Kconfig
@@ -0,0 +1,29 @@
1config ARCH_BERLIN
2 bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
3 select ARM_GIC
4 select GENERIC_CLOCKEVENTS
5 select GENERIC_IRQ_CHIP
6 select COMMON_CLK
7 select DW_APB_ICTL
8 select DW_APB_TIMER_OF
9
10if ARCH_BERLIN
11
12menu "Marvell Berlin SoC variants"
13
14config MACH_BERLIN_BG2
15 bool "Marvell Armada 1500 (BG2)"
16 select CACHE_L2X0
17 select CPU_PJ4B
18 select HAVE_ARM_TWD if SMP
19 select HAVE_SMP
20
21config MACH_BERLIN_BG2CD
22 bool "Marvell Armada 1500-mini (BG2CD)"
23 select CACHE_L2X0
24 select CPU_V7
25 select HAVE_ARM_TWD if SMP
26
27endmenu
28
29endif
diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
new file mode 100644
index 000000000000..ab69fe956f49
--- /dev/null
+++ b/arch/arm/mach-berlin/Makefile
@@ -0,0 +1 @@
obj-y += berlin.o
diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
new file mode 100644
index 000000000000..025bcb5473eb
--- /dev/null
+++ b/arch/arm/mach-berlin/berlin.c
@@ -0,0 +1,39 @@
1/*
2 * Device Tree support for Marvell Berlin SoCs.
3 *
4 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
5 *
6 * based on GPL'ed 2.6 kernel sources
7 * (c) Marvell International Ltd.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/kernel.h>
17#include <linux/of_platform.h>
18#include <asm/hardware/cache-l2x0.h>
19#include <asm/mach/arch.h>
20
21static void __init berlin_init_machine(void)
22{
23 /*
24 * with DT probing for L2CCs, berlin_init_machine can be removed.
25 * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc
26 */
27 l2x0_of_init(0x70c00000, 0xfeffffff);
28 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
29}
30
31static const char * const berlin_dt_compat[] = {
32 "marvell,berlin",
33 NULL,
34};
35
36DT_MACHINE_START(BERLIN_DT, "Marvell Berlin")
37 .dt_compat = berlin_dt_compat,
38 .init_machine = berlin_init_machine,
39MACHINE_END
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 134641d688bb..a1935911e4f1 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -259,7 +259,7 @@ asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs)
259 } while (1); 259 } while (1);
260} 260}
261 261
262static u32 notrace clps711x_sched_clock_read(void) 262static u64 notrace clps711x_sched_clock_read(void)
263{ 263{
264 return ~readw_relaxed(CLPS711X_VIRT_BASE + TC1D); 264 return ~readw_relaxed(CLPS711X_VIRT_BASE + TC1D);
265} 265}
@@ -366,7 +366,7 @@ void __init clps711x_timer_init(void)
366 tmp = clps_readl(SYSCON1) & ~(SYSCON1_TC1S | SYSCON1_TC1M); 366 tmp = clps_readl(SYSCON1) & ~(SYSCON1_TC1S | SYSCON1_TC1M);
367 clps_writel(tmp, SYSCON1); 367 clps_writel(tmp, SYSCON1);
368 368
369 setup_sched_clock(clps711x_sched_clock_read, 16, timl); 369 sched_clock_register(clps711x_sched_clock_read, 16, timl);
370 370
371 clocksource_mmio_init(CLPS711X_VIRT_BASE + TC1D, 371 clocksource_mmio_init(CLPS711X_VIRT_BASE + TC1D,
372 "clps711x_clocksource", timl, 300, 16, 372 "clps711x_clocksource", timl, 300, 16,
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
index fb77d1448fec..2001488a5ef2 100644
--- a/arch/arm/mach-clps711x/devices.c
+++ b/arch/arm/mach-clps711x/devices.c
@@ -61,8 +61,29 @@ static void __init clps711x_add_syscon(void)
61 &clps711x_syscon_res[i], 1); 61 &clps711x_syscon_res[i], 1);
62} 62}
63 63
64static const struct resource clps711x_uart1_res[] __initconst = {
65 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + UARTDR1, SZ_128),
66 DEFINE_RES_IRQ(IRQ_UTXINT1),
67 DEFINE_RES_IRQ(IRQ_URXINT1),
68};
69
70static const struct resource clps711x_uart2_res[] __initconst = {
71 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + UARTDR2, SZ_128),
72 DEFINE_RES_IRQ(IRQ_UTXINT2),
73 DEFINE_RES_IRQ(IRQ_URXINT2),
74};
75
76static void __init clps711x_add_uart(void)
77{
78 platform_device_register_simple("clps711x-uart", 0, clps711x_uart1_res,
79 ARRAY_SIZE(clps711x_uart1_res));
80 platform_device_register_simple("clps711x-uart", 1, clps711x_uart2_res,
81 ARRAY_SIZE(clps711x_uart2_res));
82};
83
64void __init clps711x_devices_init(void) 84void __init clps711x_devices_init(void)
65{ 85{
66 clps711x_add_gpio(); 86 clps711x_add_gpio();
67 clps711x_add_syscon(); 87 clps711x_add_syscon();
88 clps711x_add_uart();
68} 89}
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index dc9a470ff9c5..985e5fd00fb2 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -133,7 +133,7 @@ EXPORT_SYMBOL(clk_get_rate);
133long clk_round_rate(struct clk *clk, unsigned long rate) 133long clk_round_rate(struct clk *clk, unsigned long rate)
134{ 134{
135 if (clk == NULL || IS_ERR(clk)) 135 if (clk == NULL || IS_ERR(clk))
136 return -EINVAL; 136 return 0;
137 137
138 if (clk->round_rate) 138 if (clk->round_rate)
139 return clk->round_rate(clk, rate); 139 return clk->round_rate(clk, rate);
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 0813b5167e05..115d5736da80 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -385,7 +385,7 @@ static struct clk_lookup da830_clks[] = {
385 CLK(NULL, "pll0_sysclk7", &pll0_sysclk7), 385 CLK(NULL, "pll0_sysclk7", &pll0_sysclk7),
386 CLK("i2c_davinci.1", NULL, &i2c0_clk), 386 CLK("i2c_davinci.1", NULL, &i2c0_clk),
387 CLK(NULL, "timer0", &timerp64_0_clk), 387 CLK(NULL, "timer0", &timerp64_0_clk),
388 CLK("watchdog", NULL, &timerp64_1_clk), 388 CLK("davinci-wdt", NULL, &timerp64_1_clk),
389 CLK(NULL, "arm_rom", &arm_rom_clk), 389 CLK(NULL, "arm_rom", &arm_rom_clk),
390 CLK(NULL, "scr0_ss", &scr0_ss_clk), 390 CLK(NULL, "scr0_ss", &scr0_ss_clk),
391 CLK(NULL, "scr1_ss", &scr1_ss_clk), 391 CLK(NULL, "scr1_ss", &scr1_ss_clk),
@@ -1153,7 +1153,6 @@ static struct davinci_id da830_ids[] = {
1153 1153
1154static struct davinci_gpio_platform_data da830_gpio_platform_data = { 1154static struct davinci_gpio_platform_data da830_gpio_platform_data = {
1155 .ngpio = 128, 1155 .ngpio = 128,
1156 .intc_irq_num = DA830_N_CP_INTC_IRQ,
1157}; 1156};
1158 1157
1159int __init da830_register_gpio(void) 1158int __init da830_register_gpio(void)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 352984e1528a..2ab00434b2eb 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -443,7 +443,7 @@ static struct clk_lookup da850_clks[] = {
443 CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), 443 CLK(NULL, "pll1_sysclk3", &pll1_sysclk3),
444 CLK("i2c_davinci.1", NULL, &i2c0_clk), 444 CLK("i2c_davinci.1", NULL, &i2c0_clk),
445 CLK(NULL, "timer0", &timerp64_0_clk), 445 CLK(NULL, "timer0", &timerp64_0_clk),
446 CLK("watchdog", NULL, &timerp64_1_clk), 446 CLK("davinci-wdt", NULL, &timerp64_1_clk),
447 CLK(NULL, "arm_rom", &arm_rom_clk), 447 CLK(NULL, "arm_rom", &arm_rom_clk),
448 CLK(NULL, "tpcc0", &tpcc0_clk), 448 CLK(NULL, "tpcc0", &tpcc0_clk),
449 CLK(NULL, "tptc0", &tptc0_clk), 449 CLK(NULL, "tptc0", &tptc0_clk),
@@ -1283,7 +1283,6 @@ int __init da850_register_vpif_capture(struct vpif_capture_config
1283 1283
1284static struct davinci_gpio_platform_data da850_gpio_platform_data = { 1284static struct davinci_gpio_platform_data da850_gpio_platform_data = {
1285 .ngpio = 144, 1285 .ngpio = 144,
1286 .intc_irq_num = DA850_N_CP_INTC_IRQ,
1287}; 1286};
1288 1287
1289int __init da850_register_gpio(void) 1288int __init da850_register_gpio(void)
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index d2bc574ae172..ed1928740b5f 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -32,7 +32,7 @@ static void __init da8xx_init_irq(void)
32 32
33static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { 33static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
34 OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL), 34 OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
35 OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL), 35 OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "davinci-wdt", NULL),
36 OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL), 36 OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL),
37 OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f00000, "ehrpwm", NULL), 37 OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f00000, "ehrpwm", NULL),
38 OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL), 38 OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 78829c513fdc..0486cdf28c8d 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -389,7 +389,7 @@ static struct resource da8xx_watchdog_resources[] = {
389}; 389};
390 390
391static struct platform_device da8xx_wdt_device = { 391static struct platform_device da8xx_wdt_device = {
392 .name = "watchdog", 392 .name = "davinci-wdt",
393 .id = -1, 393 .id = -1,
394 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), 394 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources),
395 .resource = da8xx_watchdog_resources, 395 .resource = da8xx_watchdog_resources,
@@ -399,7 +399,7 @@ void da8xx_restart(enum reboot_mode mode, const char *cmd)
399{ 399{
400 struct device *dev; 400 struct device *dev;
401 401
402 dev = bus_find_device_by_name(&platform_bus_type, NULL, "watchdog"); 402 dev = bus_find_device_by_name(&platform_bus_type, NULL, "davinci-wdt");
403 if (!dev) { 403 if (!dev) {
404 pr_err("%s: failed to find watchdog device\n", __func__); 404 pr_err("%s: failed to find watchdog device\n", __func__);
405 return; 405 return;
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 3996e98f52fb..5cf9a027dcc6 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -302,7 +302,7 @@ static struct resource wdt_resources[] = {
302}; 302};
303 303
304struct platform_device davinci_wdt_device = { 304struct platform_device davinci_wdt_device = {
305 .name = "watchdog", 305 .name = "davinci-wdt",
306 .id = -1, 306 .id = -1,
307 .num_resources = ARRAY_SIZE(wdt_resources), 307 .num_resources = ARRAY_SIZE(wdt_resources),
308 .resource = wdt_resources, 308 .resource = wdt_resources,
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 6117fc644188..4668c0e19767 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -375,7 +375,7 @@ static struct clk_lookup dm355_clks[] = {
375 CLK(NULL, "pwm3", &pwm3_clk), 375 CLK(NULL, "pwm3", &pwm3_clk),
376 CLK(NULL, "timer0", &timer0_clk), 376 CLK(NULL, "timer0", &timer0_clk),
377 CLK(NULL, "timer1", &timer1_clk), 377 CLK(NULL, "timer1", &timer1_clk),
378 CLK("watchdog", NULL, &timer2_clk), 378 CLK("davinci-wdt", NULL, &timer2_clk),
379 CLK(NULL, "timer3", &timer3_clk), 379 CLK(NULL, "timer3", &timer3_clk),
380 CLK(NULL, "rto", &rto_clk), 380 CLK(NULL, "rto", &rto_clk),
381 CLK(NULL, "usb", &usb_clk), 381 CLK(NULL, "usb", &usb_clk),
@@ -901,7 +901,6 @@ static struct resource dm355_gpio_resources[] = {
901 901
902static struct davinci_gpio_platform_data dm355_gpio_platform_data = { 902static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
903 .ngpio = 104, 903 .ngpio = 104,
904 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
905}; 904};
906 905
907int __init dm355_gpio_register(void) 906int __init dm355_gpio_register(void)
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index d7c6f85d3fc9..b44b49e2801a 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -473,7 +473,7 @@ static struct clk_lookup dm365_clks[] = {
473 CLK(NULL, "pwm3", &pwm3_clk), 473 CLK(NULL, "pwm3", &pwm3_clk),
474 CLK(NULL, "timer0", &timer0_clk), 474 CLK(NULL, "timer0", &timer0_clk),
475 CLK(NULL, "timer1", &timer1_clk), 475 CLK(NULL, "timer1", &timer1_clk),
476 CLK("watchdog", NULL, &timer2_clk), 476 CLK("davinci-wdt", NULL, &timer2_clk),
477 CLK(NULL, "timer3", &timer3_clk), 477 CLK(NULL, "timer3", &timer3_clk),
478 CLK(NULL, "usb", &usb_clk), 478 CLK(NULL, "usb", &usb_clk),
479 CLK("davinci_emac.1", NULL, &emac_clk), 479 CLK("davinci_emac.1", NULL, &emac_clk),
@@ -713,7 +713,6 @@ static struct resource dm365_gpio_resources[] = {
713 713
714static struct davinci_gpio_platform_data dm365_gpio_platform_data = { 714static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
715 .ngpio = 104, 715 .ngpio = 104,
716 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
717 .gpio_unbanked = 8, 716 .gpio_unbanked = 8,
718}; 717};
719 718
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 3ce47997bb46..5c3e0be95ef3 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -322,7 +322,7 @@ static struct clk_lookup dm644x_clks[] = {
322 CLK(NULL, "pwm2", &pwm2_clk), 322 CLK(NULL, "pwm2", &pwm2_clk),
323 CLK(NULL, "timer0", &timer0_clk), 323 CLK(NULL, "timer0", &timer0_clk),
324 CLK(NULL, "timer1", &timer1_clk), 324 CLK(NULL, "timer1", &timer1_clk),
325 CLK("watchdog", NULL, &timer2_clk), 325 CLK("davinci-wdt", NULL, &timer2_clk),
326 CLK(NULL, NULL, NULL), 326 CLK(NULL, NULL, NULL),
327}; 327};
328 328
@@ -787,7 +787,6 @@ static struct resource dm644_gpio_resources[] = {
787 787
788static struct davinci_gpio_platform_data dm644_gpio_platform_data = { 788static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
789 .ngpio = 71, 789 .ngpio = 71,
790 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
791}; 790};
792 791
793int __init dm644x_gpio_register(void) 792int __init dm644x_gpio_register(void)
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 0e81fea65e7f..81768dd47096 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -356,7 +356,7 @@ static struct clk_lookup dm646x_clks[] = {
356 CLK(NULL, "pwm1", &pwm1_clk), 356 CLK(NULL, "pwm1", &pwm1_clk),
357 CLK(NULL, "timer0", &timer0_clk), 357 CLK(NULL, "timer0", &timer0_clk),
358 CLK(NULL, "timer1", &timer1_clk), 358 CLK(NULL, "timer1", &timer1_clk),
359 CLK("watchdog", NULL, &timer2_clk), 359 CLK("davinci-wdt", NULL, &timer2_clk),
360 CLK("palm_bk3710", NULL, &ide_clk), 360 CLK("palm_bk3710", NULL, &ide_clk),
361 CLK(NULL, "vpif0", &vpif0_clk), 361 CLK(NULL, "vpif0", &vpif0_clk),
362 CLK(NULL, "vpif1", &vpif1_clk), 362 CLK(NULL, "vpif1", &vpif1_clk),
@@ -763,7 +763,6 @@ static struct resource dm646x_gpio_resources[] = {
763 763
764static struct davinci_gpio_platform_data dm646x_gpio_platform_data = { 764static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
765 .ngpio = 43, 765 .ngpio = 43,
766 .intc_irq_num = DAVINCI_N_AINTC_IRQ,
767}; 766};
768 767
769int __init dm646x_gpio_register(void) 768int __init dm646x_gpio_register(void)
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 56c6eb5266ad..24ad30f32ae3 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -285,7 +285,7 @@ static struct clocksource clocksource_davinci = {
285/* 285/*
286 * Overwrite weak default sched_clock with something more precise 286 * Overwrite weak default sched_clock with something more precise
287 */ 287 */
288static u32 notrace davinci_read_sched_clock(void) 288static u64 notrace davinci_read_sched_clock(void)
289{ 289{
290 return timer32_read(&timers[TID_CLOCKSOURCE]); 290 return timer32_read(&timers[TID_CLOCKSOURCE]);
291} 291}
@@ -391,7 +391,7 @@ void __init davinci_timer_init(void)
391 davinci_clock_tick_rate)) 391 davinci_clock_tick_rate))
392 printk(err, clocksource_davinci.name); 392 printk(err, clocksource_davinci.name);
393 393
394 setup_sched_clock(davinci_read_sched_clock, 32, 394 sched_clock_register(davinci_read_sched_clock, 32,
395 davinci_clock_tick_rate); 395 davinci_clock_tick_rate);
396 396
397 /* setup clockevent */ 397 /* setup clockevent */
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index c122bcff9f7c..0d1a89298ece 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -162,7 +162,7 @@ void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
162/***************************************************************************** 162/*****************************************************************************
163 * SoC RTC 163 * SoC RTC
164 ****************************************************************************/ 164 ****************************************************************************/
165void __init dove_rtc_init(void) 165static void __init dove_rtc_init(void)
166{ 166{
167 orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC); 167 orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC);
168} 168}
@@ -257,18 +257,9 @@ void __init dove_timer_init(void)
257} 257}
258 258
259/***************************************************************************** 259/*****************************************************************************
260 * Cryptographic Engines and Security Accelerator (CESA)
261 ****************************************************************************/
262void __init dove_crypto_init(void)
263{
264 orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE,
265 DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO);
266}
267
268/*****************************************************************************
269 * XOR 0 260 * XOR 0
270 ****************************************************************************/ 261 ****************************************************************************/
271void __init dove_xor0_init(void) 262static void __init dove_xor0_init(void)
272{ 263{
273 orion_xor0_init(DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE, 264 orion_xor0_init(DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE,
274 IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01); 265 IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01);
@@ -277,7 +268,7 @@ void __init dove_xor0_init(void)
277/***************************************************************************** 268/*****************************************************************************
278 * XOR 1 269 * XOR 1
279 ****************************************************************************/ 270 ****************************************************************************/
280void __init dove_xor1_init(void) 271static void __init dove_xor1_init(void)
281{ 272{
282 orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE, 273 orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE,
283 IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11); 274 IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11);
diff --git a/arch/arm/mach-efm32/Makefile b/arch/arm/mach-efm32/Makefile
new file mode 100644
index 000000000000..3a74af7413e8
--- /dev/null
+++ b/arch/arm/mach-efm32/Makefile
@@ -0,0 +1 @@
obj-y += dtmachine.o
diff --git a/arch/arm/mach-efm32/Makefile.boot b/arch/arm/mach-efm32/Makefile.boot
new file mode 100644
index 000000000000..eacfc3f5c33e
--- /dev/null
+++ b/arch/arm/mach-efm32/Makefile.boot
@@ -0,0 +1,3 @@
1# Empty file waiting for deletion once Makefile.boot isn't needed any more.
2# Patch waits for application at
3# http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7889/1 .
diff --git a/arch/arm/mach-efm32/dtmachine.c b/arch/arm/mach-efm32/dtmachine.c
new file mode 100644
index 000000000000..2367495193c1
--- /dev/null
+++ b/arch/arm/mach-efm32/dtmachine.c
@@ -0,0 +1,15 @@
1#include <linux/kernel.h>
2
3#include <asm/v7m.h>
4
5#include <asm/mach/arch.h>
6
7static const char *const efm32gg_compat[] __initconst = {
8 "efm32,dk3750",
9 NULL
10};
11
12DT_MACHINE_START(EFM32DT, "EFM32 (Device Tree Support)")
13 .dt_compat = efm32gg_compat,
14 .restart = armv7m_restart,
15MACHINE_END
diff --git a/arch/arm/mach-efm32/include/mach/entry-macro.S b/arch/arm/mach-efm32/include/mach/entry-macro.S
new file mode 100644
index 000000000000..322159d5ed91
--- /dev/null
+++ b/arch/arm/mach-efm32/include/mach/entry-macro.S
@@ -0,0 +1,4 @@
1/*
2 * Empty file waiting for deletion once <mach/entry-macro.S> isn't needed any
3 * more. Patch "ARM: v7-M: drop using mach/entry-macro.S" sitting in next.
4 */
diff --git a/arch/arm/mach-efm32/include/mach/timex.h b/arch/arm/mach-efm32/include/mach/timex.h
new file mode 100644
index 000000000000..7a8b26da6599
--- /dev/null
+++ b/arch/arm/mach-efm32/include/mach/timex.h
@@ -0,0 +1,3 @@
1/*
2 * Empty file waiting for deletion once <mach/timex.h> isn't needed any more.
3 */
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 93e54fd4e3d5..bec570ae6494 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -5,6 +5,7 @@ menu "Cirrus EP93xx Implementation Options"
5config EP93XX_SOC_COMMON 5config EP93XX_SOC_COMMON
6 bool 6 bool
7 default y 7 default y
8 select SOC_BUS
8 select LEDS_GPIO_REGISTER 9 select LEDS_GPIO_REGISTER
9 10
10config CRUNCH 11config CRUNCH
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index d95ee28a616a..157ba88433c9 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -21,6 +21,7 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/sys_soc.h>
24#include <linux/timex.h> 25#include <linux/timex.h>
25#include <linux/irq.h> 26#include <linux/irq.h>
26#include <linux/io.h> 27#include <linux/io.h>
@@ -44,6 +45,7 @@
44#include <linux/platform_data/spi-ep93xx.h> 45#include <linux/platform_data/spi-ep93xx.h>
45#include <mach/gpio-ep93xx.h> 46#include <mach/gpio-ep93xx.h>
46 47
48#include <asm/mach/arch.h>
47#include <asm/mach/map.h> 49#include <asm/mach/map.h>
48#include <asm/mach/time.h> 50#include <asm/mach/time.h>
49 51
@@ -137,7 +139,7 @@ static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
137 139
138static struct irqaction ep93xx_timer_irq = { 140static struct irqaction ep93xx_timer_irq = {
139 .name = "ep93xx timer", 141 .name = "ep93xx timer",
140 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 142 .flags = IRQF_TIMER | IRQF_IRQPOLL,
141 .handler = ep93xx_timer_interrupt, 143 .handler = ep93xx_timer_interrupt,
142}; 144};
143 145
@@ -925,8 +927,108 @@ void ep93xx_ide_release_gpio(struct platform_device *pdev)
925} 927}
926EXPORT_SYMBOL(ep93xx_ide_release_gpio); 928EXPORT_SYMBOL(ep93xx_ide_release_gpio);
927 929
928void __init ep93xx_init_devices(void) 930/*************************************************************************
931 * EP93xx Security peripheral
932 *************************************************************************/
933
934/*
935 * The Maverick Key is 256 bits of micro fuses blown at the factory during
936 * manufacturing to uniquely identify a part.
937 *
938 * See: http://arm.cirrus.com/forum/viewtopic.php?t=486&highlight=maverick+key
939 */
940#define EP93XX_SECURITY_REG(x) (EP93XX_SECURITY_BASE + (x))
941#define EP93XX_SECURITY_SECFLG EP93XX_SECURITY_REG(0x2400)
942#define EP93XX_SECURITY_FUSEFLG EP93XX_SECURITY_REG(0x2410)
943#define EP93XX_SECURITY_UNIQID EP93XX_SECURITY_REG(0x2440)
944#define EP93XX_SECURITY_UNIQCHK EP93XX_SECURITY_REG(0x2450)
945#define EP93XX_SECURITY_UNIQVAL EP93XX_SECURITY_REG(0x2460)
946#define EP93XX_SECURITY_SECID1 EP93XX_SECURITY_REG(0x2500)
947#define EP93XX_SECURITY_SECID2 EP93XX_SECURITY_REG(0x2504)
948#define EP93XX_SECURITY_SECCHK1 EP93XX_SECURITY_REG(0x2520)
949#define EP93XX_SECURITY_SECCHK2 EP93XX_SECURITY_REG(0x2524)
950#define EP93XX_SECURITY_UNIQID2 EP93XX_SECURITY_REG(0x2700)
951#define EP93XX_SECURITY_UNIQID3 EP93XX_SECURITY_REG(0x2704)
952#define EP93XX_SECURITY_UNIQID4 EP93XX_SECURITY_REG(0x2708)
953#define EP93XX_SECURITY_UNIQID5 EP93XX_SECURITY_REG(0x270c)
954
955static char ep93xx_soc_id[33];
956
957static const char __init *ep93xx_get_soc_id(void)
929{ 958{
959 unsigned int id, id2, id3, id4, id5;
960
961 if (__raw_readl(EP93XX_SECURITY_UNIQVAL) != 1)
962 return "bad Hamming code";
963
964 id = __raw_readl(EP93XX_SECURITY_UNIQID);
965 id2 = __raw_readl(EP93XX_SECURITY_UNIQID2);
966 id3 = __raw_readl(EP93XX_SECURITY_UNIQID3);
967 id4 = __raw_readl(EP93XX_SECURITY_UNIQID4);
968 id5 = __raw_readl(EP93XX_SECURITY_UNIQID5);
969
970 if (id != id2)
971 return "invalid";
972
973 snprintf(ep93xx_soc_id, sizeof(ep93xx_soc_id),
974 "%08x%08x%08x%08x", id2, id3, id4, id5);
975
976 return ep93xx_soc_id;
977}
978
979static const char __init *ep93xx_get_soc_rev(void)
980{
981 int rev = ep93xx_chip_revision();
982
983 switch (rev) {
984 case EP93XX_CHIP_REV_D0:
985 return "D0";
986 case EP93XX_CHIP_REV_D1:
987 return "D1";
988 case EP93XX_CHIP_REV_E0:
989 return "E0";
990 case EP93XX_CHIP_REV_E1:
991 return "E1";
992 case EP93XX_CHIP_REV_E2:
993 return "E2";
994 default:
995 return "unknown";
996 }
997}
998
999static const char __init *ep93xx_get_machine_name(void)
1000{
1001 return kasprintf(GFP_KERNEL,"%s", machine_desc->name);
1002}
1003
1004static struct device __init *ep93xx_init_soc(void)
1005{
1006 struct soc_device_attribute *soc_dev_attr;
1007 struct soc_device *soc_dev;
1008
1009 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
1010 if (!soc_dev_attr)
1011 return NULL;
1012
1013 soc_dev_attr->machine = ep93xx_get_machine_name();
1014 soc_dev_attr->family = "Cirrus Logic EP93xx";
1015 soc_dev_attr->revision = ep93xx_get_soc_rev();
1016 soc_dev_attr->soc_id = ep93xx_get_soc_id();
1017
1018 soc_dev = soc_device_register(soc_dev_attr);
1019 if (IS_ERR(soc_dev)) {
1020 kfree(soc_dev_attr->machine);
1021 kfree(soc_dev_attr);
1022 return NULL;
1023 }
1024
1025 return soc_device_to_device(soc_dev);
1026}
1027
1028struct device __init *ep93xx_init_devices(void)
1029{
1030 struct device *parent;
1031
930 /* Disallow access to MaverickCrunch initially */ 1032 /* Disallow access to MaverickCrunch initially */
931 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_CPENA); 1033 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_CPENA);
932 1034
@@ -937,6 +1039,8 @@ void __init ep93xx_init_devices(void)
937 EP93XX_SYSCON_DEVCFG_GONIDE | 1039 EP93XX_SYSCON_DEVCFG_GONIDE |
938 EP93XX_SYSCON_DEVCFG_HONIDE); 1040 EP93XX_SYSCON_DEVCFG_HONIDE);
939 1041
1042 parent = ep93xx_init_soc();
1043
940 /* Get the GPIO working early, other devices need it */ 1044 /* Get the GPIO working early, other devices need it */
941 platform_device_register(&ep93xx_gpio_device); 1045 platform_device_register(&ep93xx_gpio_device);
942 1046
@@ -949,6 +1053,8 @@ void __init ep93xx_init_devices(void)
949 platform_device_register(&ep93xx_wdt_device); 1053 platform_device_register(&ep93xx_wdt_device);
950 1054
951 gpio_led_register_device(-1, &ep93xx_led_data); 1055 gpio_led_register_device(-1, &ep93xx_led_data);
1056
1057 return parent;
952} 1058}
953 1059
954void ep93xx_restart(enum reboot_mode mode, const char *cmd) 1060void ep93xx_restart(enum reboot_mode mode, const char *cmd)
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index e256e0baec2e..4c0bbd97f741 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/reboot.h> 7#include <linux/reboot.h>
8 8
9struct device;
9struct i2c_gpio_platform_data; 10struct i2c_gpio_platform_data;
10struct i2c_board_info; 11struct i2c_board_info;
11struct spi_board_info; 12struct spi_board_info;
@@ -54,7 +55,7 @@ void ep93xx_register_ide(void);
54int ep93xx_ide_acquire_gpio(struct platform_device *pdev); 55int ep93xx_ide_acquire_gpio(struct platform_device *pdev);
55void ep93xx_ide_release_gpio(struct platform_device *pdev); 56void ep93xx_ide_release_gpio(struct platform_device *pdev);
56 57
57void ep93xx_init_devices(void); 58struct device *ep93xx_init_devices(void);
58extern void ep93xx_timer_init(void); 59extern void ep93xx_timer_init(void);
59 60
60void ep93xx_restart(enum reboot_mode, const char *); 61void ep93xx_restart(enum reboot_mode, const char *);
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index f9d67a0acb2a..4c414af75ef0 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -24,6 +24,7 @@ config ARCH_EXYNOS4
24 select HAVE_SMP 24 select HAVE_SMP
25 select MIGHT_HAVE_CACHE_L2X0 25 select MIGHT_HAVE_CACHE_L2X0
26 select PINCTRL 26 select PINCTRL
27 select PM_GENERIC_DOMAINS if PM
27 select S5P_DEV_MFC 28 select S5P_DEV_MFC
28 help 29 help
29 Samsung EXYNOS4 SoCs based systems 30 Samsung EXYNOS4 SoCs based systems
@@ -48,7 +49,6 @@ config CPU_EXYNOS4210
48 select ARCH_HAS_BANDGAP 49 select ARCH_HAS_BANDGAP
49 select ARM_CPU_SUSPEND if PM 50 select ARM_CPU_SUSPEND if PM
50 select PINCTRL_EXYNOS 51 select PINCTRL_EXYNOS
51 select PM_GENERIC_DOMAINS if PM
52 select S5P_PM if PM 52 select S5P_PM if PM
53 select S5P_SLEEP if PM 53 select S5P_SLEEP if PM
54 select SAMSUNG_DMADEV 54 select SAMSUNG_DMADEV
@@ -61,7 +61,6 @@ config SOC_EXYNOS4212
61 depends on ARCH_EXYNOS4 61 depends on ARCH_EXYNOS4
62 select ARCH_HAS_BANDGAP 62 select ARCH_HAS_BANDGAP
63 select PINCTRL_EXYNOS 63 select PINCTRL_EXYNOS
64 select PM_GENERIC_DOMAINS if PM
65 select S5P_PM if PM 64 select S5P_PM if PM
66 select S5P_SLEEP if PM 65 select S5P_SLEEP if PM
67 select SAMSUNG_DMADEV 66 select SAMSUNG_DMADEV
@@ -74,7 +73,6 @@ config SOC_EXYNOS4412
74 depends on ARCH_EXYNOS4 73 depends on ARCH_EXYNOS4
75 select ARCH_HAS_BANDGAP 74 select ARCH_HAS_BANDGAP
76 select PINCTRL_EXYNOS 75 select PINCTRL_EXYNOS
77 select PM_GENERIC_DOMAINS if PM
78 select SAMSUNG_DMADEV 76 select SAMSUNG_DMADEV
79 help 77 help
80 Enable EXYNOS4412 SoC support 78 Enable EXYNOS4412 SoC support
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 61d2906ccefb..f18be40e5b21 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -23,6 +23,7 @@
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
25#include <linux/of_irq.h> 25#include <linux/of_irq.h>
26#include <linux/pm_domain.h>
26#include <linux/export.h> 27#include <linux/export.h>
27#include <linux/irqdomain.h> 28#include <linux/irqdomain.h>
28#include <linux/of_address.h> 29#include <linux/of_address.h>
@@ -37,14 +38,13 @@
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
39 40
40#include <mach/regs-irq.h>
41#include <mach/regs-pmu.h>
42
43#include <plat/cpu.h> 41#include <plat/cpu.h>
44#include <plat/pm.h> 42#include <plat/pm.h>
45#include <plat/regs-serial.h> 43#include <plat/regs-serial.h>
46 44
47#include "common.h" 45#include "common.h"
46#include "regs-pmu.h"
47
48#define L2_AUX_VAL 0x7C470001 48#define L2_AUX_VAL 0x7C470001
49#define L2_AUX_MASK 0xC200ffff 49#define L2_AUX_MASK 0xC200ffff
50 50
@@ -303,13 +303,18 @@ void __init exynos_cpuidle_init(void)
303 platform_device_register(&exynos_cpuidle); 303 platform_device_register(&exynos_cpuidle);
304} 304}
305 305
306void __init exynos_cpufreq_init(void)
307{
308 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
309}
310
306void __init exynos_init_late(void) 311void __init exynos_init_late(void)
307{ 312{
308 if (of_machine_is_compatible("samsung,exynos5440")) 313 if (of_machine_is_compatible("samsung,exynos5440"))
309 /* to be supported later */ 314 /* to be supported later */
310 return; 315 return;
311 316
312 exynos_pm_late_initcall(); 317 pm_genpd_poweroff_unused();
313} 318}
314 319
315static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, 320static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index ff9b6a9419b0..f76967b1c551 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -22,16 +22,11 @@ void exynos_init_io(void);
22void exynos4_restart(enum reboot_mode mode, const char *cmd); 22void exynos4_restart(enum reboot_mode mode, const char *cmd);
23void exynos5_restart(enum reboot_mode mode, const char *cmd); 23void exynos5_restart(enum reboot_mode mode, const char *cmd);
24void exynos_cpuidle_init(void); 24void exynos_cpuidle_init(void);
25void exynos_cpufreq_init(void);
25void exynos_init_late(void); 26void exynos_init_late(void);
26 27
27void exynos_firmware_init(void); 28void exynos_firmware_init(void);
28 29
29#ifdef CONFIG_PM_GENERIC_DOMAINS
30int exynos_pm_late_initcall(void);
31#else
32static inline int exynos_pm_late_initcall(void) { return 0; }
33#endif
34
35extern struct smp_operations exynos_smp_ops; 30extern struct smp_operations exynos_smp_ops;
36 31
37extern void exynos_cpu_die(unsigned int cpu); 32extern void exynos_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index ddbfe8709fe7..f57cb91f02aa 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -22,13 +22,15 @@
22#include <asm/suspend.h> 22#include <asm/suspend.h>
23#include <asm/unified.h> 23#include <asm/unified.h>
24#include <asm/cpuidle.h> 24#include <asm/cpuidle.h>
25#include <mach/regs-clock.h>
26#include <mach/regs-pmu.h>
27 25
28#include <plat/cpu.h> 26#include <plat/cpu.h>
29#include <plat/pm.h> 27#include <plat/pm.h>
30 28
29#include <mach/pm-core.h>
30#include <mach/map.h>
31
31#include "common.h" 32#include "common.h"
33#include "regs-pmu.h"
32 34
33#define REG_DIRECTGO_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \ 35#define REG_DIRECTGO_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \
34 S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \ 36 S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
@@ -39,6 +41,25 @@
39 41
40#define S5P_CHECK_AFTR 0xFCBA0D10 42#define S5P_CHECK_AFTR 0xFCBA0D10
41 43
44#define EXYNOS5_PWR_CTRL1 (S5P_VA_CMU + 0x01020)
45#define EXYNOS5_PWR_CTRL2 (S5P_VA_CMU + 0x01024)
46
47#define PWR_CTRL1_CORE2_DOWN_RATIO (7 << 28)
48#define PWR_CTRL1_CORE1_DOWN_RATIO (7 << 16)
49#define PWR_CTRL1_DIV2_DOWN_EN (1 << 9)
50#define PWR_CTRL1_DIV1_DOWN_EN (1 << 8)
51#define PWR_CTRL1_USE_CORE1_WFE (1 << 5)
52#define PWR_CTRL1_USE_CORE0_WFE (1 << 4)
53#define PWR_CTRL1_USE_CORE1_WFI (1 << 1)
54#define PWR_CTRL1_USE_CORE0_WFI (1 << 0)
55
56#define PWR_CTRL2_DIV2_UP_EN (1 << 25)
57#define PWR_CTRL2_DIV1_UP_EN (1 << 24)
58#define PWR_CTRL2_DUR_STANDBY2_VAL (1 << 16)
59#define PWR_CTRL2_DUR_STANDBY1_VAL (1 << 8)
60#define PWR_CTRL2_CORE2_UP_RATIO (1 << 4)
61#define PWR_CTRL2_CORE1_UP_RATIO (1 << 0)
62
42static int exynos4_enter_lowpower(struct cpuidle_device *dev, 63static int exynos4_enter_lowpower(struct cpuidle_device *dev,
43 struct cpuidle_driver *drv, 64 struct cpuidle_driver *drv,
44 int index); 65 int index);
@@ -151,8 +172,8 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
151{ 172{
152 int new_index = index; 173 int new_index = index;
153 174
154 /* This mode only can be entered when other core's are offline */ 175 /* AFTR can only be entered when cores other than CPU0 are offline */
155 if (num_online_cpus() > 1) 176 if (num_online_cpus() > 1 || dev->cpu != 0)
156 new_index = drv->safe_state_index; 177 new_index = drv->safe_state_index;
157 178
158 if (new_index == 0) 179 if (new_index == 0)
@@ -214,10 +235,6 @@ static int exynos_cpuidle_probe(struct platform_device *pdev)
214 device = &per_cpu(exynos4_cpuidle_device, cpu_id); 235 device = &per_cpu(exynos4_cpuidle_device, cpu_id);
215 device->cpu = cpu_id; 236 device->cpu = cpu_id;
216 237
217 /* Support IDLE only */
218 if (cpu_id != 0)
219 device->state_count = 1;
220
221 ret = cpuidle_register_device(device); 238 ret = cpuidle_register_device(device);
222 if (ret) { 239 if (ret) {
223 dev_err(&pdev->dev, "failed to register cpuidle device\n"); 240 dev_err(&pdev->dev, "failed to register cpuidle device\n");
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index af90cfa2f826..5eead530c6f8 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -19,10 +19,10 @@
19#include <asm/cp15.h> 19#include <asm/cp15.h>
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21 21
22#include <mach/regs-pmu.h>
23#include <plat/cpu.h> 22#include <plat/cpu.h>
24 23
25#include "common.h" 24#include "common.h"
25#include "regs-pmu.h"
26 26
27static inline void cpu_enter_lowpower_a9(void) 27static inline void cpu_enter_lowpower_a9(void)
28{ 28{
diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h
index 2b00833b6641..dc0697c2fa92 100644
--- a/arch/arm/mach-exynos/include/mach/pm-core.h
+++ b/arch/arm/mach-exynos/include/mach/pm-core.h
@@ -19,7 +19,10 @@
19#define __ASM_ARCH_PM_CORE_H __FILE__ 19#define __ASM_ARCH_PM_CORE_H __FILE__
20 20
21#include <linux/of.h> 21#include <linux/of.h>
22#include <mach/regs-pmu.h> 22#include <mach/map.h>
23
24#define S5P_EINT_WAKEUP_MASK (S5P_VA_PMU + 0x0604)
25#define S5P_WAKEUP_MASK (S5P_VA_PMU + 0x0608)
23 26
24#ifdef CONFIG_PINCTRL_EXYNOS 27#ifdef CONFIG_PINCTRL_EXYNOS
25extern u32 exynos_get_eint_wake_mask(void); 28extern u32 exynos_get_eint_wake_mask(void);
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h
deleted file mode 100644
index d36ad76ad6a4..000000000000
--- a/arch/arm/mach-exynos/include/mach/regs-clock.h
+++ /dev/null
@@ -1,372 +0,0 @@
1/* linux/arch/arm/mach-exynos4/include/mach/regs-clock.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - Clock register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_CLOCK_H
14#define __ASM_ARCH_REGS_CLOCK_H __FILE__
15
16#include <plat/cpu.h>
17#include <mach/map.h>
18
19#define EXYNOS_CLKREG(x) (S5P_VA_CMU + (x))
20
21#define EXYNOS4_CLKDIV_LEFTBUS EXYNOS_CLKREG(0x04500)
22#define EXYNOS4_CLKDIV_STAT_LEFTBUS EXYNOS_CLKREG(0x04600)
23#define EXYNOS4_CLKGATE_IP_LEFTBUS EXYNOS_CLKREG(0x04800)
24
25#define EXYNOS4_CLKDIV_RIGHTBUS EXYNOS_CLKREG(0x08500)
26#define EXYNOS4_CLKDIV_STAT_RIGHTBUS EXYNOS_CLKREG(0x08600)
27#define EXYNOS4_CLKGATE_IP_RIGHTBUS EXYNOS_CLKREG(0x08800)
28
29#define EXYNOS4_EPLL_LOCK EXYNOS_CLKREG(0x0C010)
30#define EXYNOS4_VPLL_LOCK EXYNOS_CLKREG(0x0C020)
31
32#define EXYNOS4_EPLL_CON0 EXYNOS_CLKREG(0x0C110)
33#define EXYNOS4_EPLL_CON1 EXYNOS_CLKREG(0x0C114)
34#define EXYNOS4_VPLL_CON0 EXYNOS_CLKREG(0x0C120)
35#define EXYNOS4_VPLL_CON1 EXYNOS_CLKREG(0x0C124)
36
37#define EXYNOS4_CLKSRC_TOP0 EXYNOS_CLKREG(0x0C210)
38#define EXYNOS4_CLKSRC_TOP1 EXYNOS_CLKREG(0x0C214)
39#define EXYNOS4_CLKSRC_CAM EXYNOS_CLKREG(0x0C220)
40#define EXYNOS4_CLKSRC_TV EXYNOS_CLKREG(0x0C224)
41#define EXYNOS4_CLKSRC_MFC EXYNOS_CLKREG(0x0C228)
42#define EXYNOS4_CLKSRC_G3D EXYNOS_CLKREG(0x0C22C)
43#define EXYNOS4_CLKSRC_IMAGE EXYNOS_CLKREG(0x0C230)
44#define EXYNOS4_CLKSRC_LCD0 EXYNOS_CLKREG(0x0C234)
45#define EXYNOS4_CLKSRC_MAUDIO EXYNOS_CLKREG(0x0C23C)
46#define EXYNOS4_CLKSRC_FSYS EXYNOS_CLKREG(0x0C240)
47#define EXYNOS4_CLKSRC_PERIL0 EXYNOS_CLKREG(0x0C250)
48#define EXYNOS4_CLKSRC_PERIL1 EXYNOS_CLKREG(0x0C254)
49
50#define EXYNOS4_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x0C310)
51#define EXYNOS4_CLKSRC_MASK_CAM EXYNOS_CLKREG(0x0C320)
52#define EXYNOS4_CLKSRC_MASK_TV EXYNOS_CLKREG(0x0C324)
53#define EXYNOS4_CLKSRC_MASK_LCD0 EXYNOS_CLKREG(0x0C334)
54#define EXYNOS4_CLKSRC_MASK_MAUDIO EXYNOS_CLKREG(0x0C33C)
55#define EXYNOS4_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x0C340)
56#define EXYNOS4_CLKSRC_MASK_PERIL0 EXYNOS_CLKREG(0x0C350)
57#define EXYNOS4_CLKSRC_MASK_PERIL1 EXYNOS_CLKREG(0x0C354)
58
59#define EXYNOS4_CLKDIV_TOP EXYNOS_CLKREG(0x0C510)
60#define EXYNOS4_CLKDIV_CAM EXYNOS_CLKREG(0x0C520)
61#define EXYNOS4_CLKDIV_TV EXYNOS_CLKREG(0x0C524)
62#define EXYNOS4_CLKDIV_MFC EXYNOS_CLKREG(0x0C528)
63#define EXYNOS4_CLKDIV_G3D EXYNOS_CLKREG(0x0C52C)
64#define EXYNOS4_CLKDIV_IMAGE EXYNOS_CLKREG(0x0C530)
65#define EXYNOS4_CLKDIV_LCD0 EXYNOS_CLKREG(0x0C534)
66#define EXYNOS4_CLKDIV_MAUDIO EXYNOS_CLKREG(0x0C53C)
67#define EXYNOS4_CLKDIV_FSYS0 EXYNOS_CLKREG(0x0C540)
68#define EXYNOS4_CLKDIV_FSYS1 EXYNOS_CLKREG(0x0C544)
69#define EXYNOS4_CLKDIV_FSYS2 EXYNOS_CLKREG(0x0C548)
70#define EXYNOS4_CLKDIV_FSYS3 EXYNOS_CLKREG(0x0C54C)
71#define EXYNOS4_CLKDIV_PERIL0 EXYNOS_CLKREG(0x0C550)
72#define EXYNOS4_CLKDIV_PERIL1 EXYNOS_CLKREG(0x0C554)
73#define EXYNOS4_CLKDIV_PERIL2 EXYNOS_CLKREG(0x0C558)
74#define EXYNOS4_CLKDIV_PERIL3 EXYNOS_CLKREG(0x0C55C)
75#define EXYNOS4_CLKDIV_PERIL4 EXYNOS_CLKREG(0x0C560)
76#define EXYNOS4_CLKDIV_PERIL5 EXYNOS_CLKREG(0x0C564)
77#define EXYNOS4_CLKDIV2_RATIO EXYNOS_CLKREG(0x0C580)
78
79#define EXYNOS4_CLKDIV_STAT_TOP EXYNOS_CLKREG(0x0C610)
80#define EXYNOS4_CLKDIV_STAT_MFC EXYNOS_CLKREG(0x0C628)
81
82#define EXYNOS4_CLKGATE_SCLKCAM EXYNOS_CLKREG(0x0C820)
83#define EXYNOS4_CLKGATE_IP_CAM EXYNOS_CLKREG(0x0C920)
84#define EXYNOS4_CLKGATE_IP_TV EXYNOS_CLKREG(0x0C924)
85#define EXYNOS4_CLKGATE_IP_MFC EXYNOS_CLKREG(0x0C928)
86#define EXYNOS4_CLKGATE_IP_G3D EXYNOS_CLKREG(0x0C92C)
87#define EXYNOS4_CLKGATE_IP_IMAGE (soc_is_exynos4210() ? \
88 EXYNOS_CLKREG(0x0C930) : \
89 EXYNOS_CLKREG(0x04930))
90#define EXYNOS4210_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x0C930)
91#define EXYNOS4212_CLKGATE_IP_IMAGE EXYNOS_CLKREG(0x04930)
92#define EXYNOS4_CLKGATE_IP_LCD0 EXYNOS_CLKREG(0x0C934)
93#define EXYNOS4_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x0C940)
94#define EXYNOS4_CLKGATE_IP_GPS EXYNOS_CLKREG(0x0C94C)
95#define EXYNOS4_CLKGATE_IP_PERIL EXYNOS_CLKREG(0x0C950)
96#define EXYNOS4_CLKGATE_IP_PERIR (soc_is_exynos4210() ? \
97 EXYNOS_CLKREG(0x0C960) : \
98 EXYNOS_CLKREG(0x08960))
99#define EXYNOS4210_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x0C960)
100#define EXYNOS4212_CLKGATE_IP_PERIR EXYNOS_CLKREG(0x08960)
101#define EXYNOS4_CLKGATE_BLOCK EXYNOS_CLKREG(0x0C970)
102
103#define EXYNOS4_CLKSRC_MASK_DMC EXYNOS_CLKREG(0x10300)
104#define EXYNOS4_CLKSRC_DMC EXYNOS_CLKREG(0x10200)
105#define EXYNOS4_CLKDIV_DMC0 EXYNOS_CLKREG(0x10500)
106#define EXYNOS4_CLKDIV_DMC1 EXYNOS_CLKREG(0x10504)
107#define EXYNOS4_CLKDIV_STAT_DMC0 EXYNOS_CLKREG(0x10600)
108#define EXYNOS4_CLKDIV_STAT_DMC1 EXYNOS_CLKREG(0x10604)
109#define EXYNOS4_CLKGATE_IP_DMC EXYNOS_CLKREG(0x10900)
110
111#define EXYNOS4_DMC_PAUSE_CTRL EXYNOS_CLKREG(0x11094)
112#define EXYNOS4_DMC_PAUSE_ENABLE (1 << 0)
113
114#define EXYNOS4_APLL_LOCK EXYNOS_CLKREG(0x14000)
115#define EXYNOS4_MPLL_LOCK (soc_is_exynos4210() ? \
116 EXYNOS_CLKREG(0x14004) : \
117 EXYNOS_CLKREG(0x10008))
118#define EXYNOS4_APLL_CON0 EXYNOS_CLKREG(0x14100)
119#define EXYNOS4_APLL_CON1 EXYNOS_CLKREG(0x14104)
120#define EXYNOS4_MPLL_CON0 (soc_is_exynos4210() ? \
121 EXYNOS_CLKREG(0x14108) : \
122 EXYNOS_CLKREG(0x10108))
123#define EXYNOS4_MPLL_CON1 (soc_is_exynos4210() ? \
124 EXYNOS_CLKREG(0x1410C) : \
125 EXYNOS_CLKREG(0x1010C))
126
127#define EXYNOS4_CLKSRC_CPU EXYNOS_CLKREG(0x14200)
128#define EXYNOS4_CLKMUX_STATCPU EXYNOS_CLKREG(0x14400)
129
130#define EXYNOS4_CLKDIV_CPU EXYNOS_CLKREG(0x14500)
131#define EXYNOS4_CLKDIV_CPU1 EXYNOS_CLKREG(0x14504)
132#define EXYNOS4_CLKDIV_STATCPU EXYNOS_CLKREG(0x14600)
133#define EXYNOS4_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x14604)
134
135#define EXYNOS4_CLKGATE_SCLKCPU EXYNOS_CLKREG(0x14800)
136#define EXYNOS4_CLKGATE_IP_CPU EXYNOS_CLKREG(0x14900)
137
138#define EXYNOS4_CLKGATE_IP_ISP0 EXYNOS_CLKREG(0x18800)
139#define EXYNOS4_CLKGATE_IP_ISP1 EXYNOS_CLKREG(0x18804)
140
141#define EXYNOS4_APLL_LOCKTIME (0x1C20) /* 300us */
142
143#define EXYNOS4_APLLCON0_ENABLE_SHIFT (31)
144#define EXYNOS4_APLLCON0_LOCKED_SHIFT (29)
145#define EXYNOS4_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1)
146#define EXYNOS4_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1)
147
148#define EXYNOS4_EPLLCON0_ENABLE_SHIFT (31)
149#define EXYNOS4_EPLLCON0_LOCKED_SHIFT (29)
150
151#define EXYNOS4_VPLLCON0_ENABLE_SHIFT (31)
152#define EXYNOS4_VPLLCON0_LOCKED_SHIFT (29)
153
154#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
155#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
156
157#define EXYNOS4_CLKDIV_CPU0_CORE_SHIFT (0)
158#define EXYNOS4_CLKDIV_CPU0_CORE_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE_SHIFT)
159#define EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT (4)
160#define EXYNOS4_CLKDIV_CPU0_COREM0_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT)
161#define EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT (8)
162#define EXYNOS4_CLKDIV_CPU0_COREM1_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT)
163#define EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT (12)
164#define EXYNOS4_CLKDIV_CPU0_PERIPH_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT)
165#define EXYNOS4_CLKDIV_CPU0_ATB_SHIFT (16)
166#define EXYNOS4_CLKDIV_CPU0_ATB_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_ATB_SHIFT)
167#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT (20)
168#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT)
169#define EXYNOS4_CLKDIV_CPU0_APLL_SHIFT (24)
170#define EXYNOS4_CLKDIV_CPU0_APLL_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_APLL_SHIFT)
171#define EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT 28
172#define EXYNOS4_CLKDIV_CPU0_CORE2_MASK (0x7 << EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT)
173
174#define EXYNOS4_CLKDIV_CPU1_COPY_SHIFT 0
175#define EXYNOS4_CLKDIV_CPU1_COPY_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_COPY_SHIFT)
176#define EXYNOS4_CLKDIV_CPU1_HPM_SHIFT 4
177#define EXYNOS4_CLKDIV_CPU1_HPM_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_HPM_SHIFT)
178#define EXYNOS4_CLKDIV_CPU1_CORES_SHIFT 8
179#define EXYNOS4_CLKDIV_CPU1_CORES_MASK (0x7 << EXYNOS4_CLKDIV_CPU1_CORES_SHIFT)
180
181#define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT (0)
182#define EXYNOS4_CLKDIV_DMC0_ACP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT)
183#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT (4)
184#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT)
185#define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT (8)
186#define EXYNOS4_CLKDIV_DMC0_DPHY_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT)
187#define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT (12)
188#define EXYNOS4_CLKDIV_DMC0_DMC_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT)
189#define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT (16)
190#define EXYNOS4_CLKDIV_DMC0_DMCD_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT)
191#define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT (20)
192#define EXYNOS4_CLKDIV_DMC0_DMCP_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT)
193#define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT (24)
194#define EXYNOS4_CLKDIV_DMC0_COPY2_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT)
195#define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT (28)
196#define EXYNOS4_CLKDIV_DMC0_CORETI_MASK (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT)
197
198#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT (0)
199#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT)
200#define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT (4)
201#define EXYNOS4_CLKDIV_DMC1_C2C_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT)
202#define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT (8)
203#define EXYNOS4_CLKDIV_DMC1_PWI_MASK (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT)
204#define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT (12)
205#define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT)
206#define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT (16)
207#define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT)
208#define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT (24)
209#define EXYNOS4_CLKDIV_DMC1_DPM_MASK (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT)
210
211#define EXYNOS4_CLKDIV_MFC_SHIFT (0)
212#define EXYNOS4_CLKDIV_MFC_MASK (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT)
213
214#define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT (0)
215#define EXYNOS4_CLKDIV_TOP_ACLK200_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT)
216#define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT (4)
217#define EXYNOS4_CLKDIV_TOP_ACLK100_MASK (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT)
218#define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT (8)
219#define EXYNOS4_CLKDIV_TOP_ACLK160_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT)
220#define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT (12)
221#define EXYNOS4_CLKDIV_TOP_ACLK133_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT)
222#define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT (16)
223#define EXYNOS4_CLKDIV_TOP_ONENAND_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT)
224#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT (20)
225#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT)
226#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT (24)
227#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT)
228
229#define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT (0)
230#define EXYNOS4_CLKDIV_BUS_GDLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT)
231#define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT (4)
232#define EXYNOS4_CLKDIV_BUS_GPLR_MASK (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT)
233
234#define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT (0)
235#define EXYNOS4_CLKDIV_CAM_FIMC0_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT)
236#define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT (4)
237#define EXYNOS4_CLKDIV_CAM_FIMC1_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT)
238#define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT (8)
239#define EXYNOS4_CLKDIV_CAM_FIMC2_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT)
240#define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT (12)
241#define EXYNOS4_CLKDIV_CAM_FIMC3_MASK (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT)
242
243/* Only for EXYNOS4210 */
244
245#define EXYNOS4210_CLKSRC_LCD1 EXYNOS_CLKREG(0x0C238)
246#define EXYNOS4210_CLKSRC_MASK_LCD1 EXYNOS_CLKREG(0x0C338)
247#define EXYNOS4210_CLKDIV_LCD1 EXYNOS_CLKREG(0x0C538)
248#define EXYNOS4210_CLKGATE_IP_LCD1 EXYNOS_CLKREG(0x0C938)
249
250/* Only for EXYNOS4212 */
251
252#define EXYNOS4_CLKDIV_CAM1 EXYNOS_CLKREG(0x0C568)
253
254#define EXYNOS4_CLKDIV_STAT_CAM1 EXYNOS_CLKREG(0x0C668)
255
256#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0)
257#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT)
258
259/* For EXYNOS5250 */
260
261#define EXYNOS5_APLL_LOCK EXYNOS_CLKREG(0x00000)
262#define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100)
263#define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200)
264#define EXYNOS5_CLKMUX_STATCPU EXYNOS_CLKREG(0x00400)
265#define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500)
266#define EXYNOS5_CLKDIV_CPU1 EXYNOS_CLKREG(0x00504)
267#define EXYNOS5_CLKDIV_STATCPU0 EXYNOS_CLKREG(0x00600)
268#define EXYNOS5_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x00604)
269
270#define EXYNOS5_PWR_CTRL1 EXYNOS_CLKREG(0x01020)
271#define EXYNOS5_PWR_CTRL2 EXYNOS_CLKREG(0x01024)
272
273#define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100)
274#define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204)
275
276#define EXYNOS5_CLKGATE_IP_CORE EXYNOS_CLKREG(0x04900)
277
278#define EXYNOS5_CLKDIV_ACP EXYNOS_CLKREG(0x08500)
279
280#define EXYNOS5_EPLL_CON0 EXYNOS_CLKREG(0x10130)
281#define EXYNOS5_EPLL_CON1 EXYNOS_CLKREG(0x10134)
282#define EXYNOS5_EPLL_CON2 EXYNOS_CLKREG(0x10138)
283#define EXYNOS5_VPLL_CON0 EXYNOS_CLKREG(0x10140)
284#define EXYNOS5_VPLL_CON1 EXYNOS_CLKREG(0x10144)
285#define EXYNOS5_VPLL_CON2 EXYNOS_CLKREG(0x10148)
286#define EXYNOS5_CPLL_CON0 EXYNOS_CLKREG(0x10120)
287
288#define EXYNOS5_CLKSRC_TOP0 EXYNOS_CLKREG(0x10210)
289#define EXYNOS5_CLKSRC_TOP1 EXYNOS_CLKREG(0x10214)
290#define EXYNOS5_CLKSRC_TOP2 EXYNOS_CLKREG(0x10218)
291#define EXYNOS5_CLKSRC_TOP3 EXYNOS_CLKREG(0x1021C)
292#define EXYNOS5_CLKSRC_GSCL EXYNOS_CLKREG(0x10220)
293#define EXYNOS5_CLKSRC_DISP1_0 EXYNOS_CLKREG(0x1022C)
294#define EXYNOS5_CLKSRC_MAUDIO EXYNOS_CLKREG(0x10240)
295#define EXYNOS5_CLKSRC_FSYS EXYNOS_CLKREG(0x10244)
296#define EXYNOS5_CLKSRC_PERIC0 EXYNOS_CLKREG(0x10250)
297#define EXYNOS5_CLKSRC_PERIC1 EXYNOS_CLKREG(0x10254)
298#define EXYNOS5_SCLK_SRC_ISP EXYNOS_CLKREG(0x10270)
299
300#define EXYNOS5_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x10310)
301#define EXYNOS5_CLKSRC_MASK_GSCL EXYNOS_CLKREG(0x10320)
302#define EXYNOS5_CLKSRC_MASK_DISP1_0 EXYNOS_CLKREG(0x1032C)
303#define EXYNOS5_CLKSRC_MASK_MAUDIO EXYNOS_CLKREG(0x10334)
304#define EXYNOS5_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x10340)
305#define EXYNOS5_CLKSRC_MASK_PERIC0 EXYNOS_CLKREG(0x10350)
306#define EXYNOS5_CLKSRC_MASK_PERIC1 EXYNOS_CLKREG(0x10354)
307
308#define EXYNOS5_CLKDIV_TOP0 EXYNOS_CLKREG(0x10510)
309#define EXYNOS5_CLKDIV_TOP1 EXYNOS_CLKREG(0x10514)
310#define EXYNOS5_CLKDIV_GSCL EXYNOS_CLKREG(0x10520)
311#define EXYNOS5_CLKDIV_DISP1_0 EXYNOS_CLKREG(0x1052C)
312#define EXYNOS5_CLKDIV_GEN EXYNOS_CLKREG(0x1053C)
313#define EXYNOS5_CLKDIV_MAUDIO EXYNOS_CLKREG(0x10544)
314#define EXYNOS5_CLKDIV_FSYS0 EXYNOS_CLKREG(0x10548)
315#define EXYNOS5_CLKDIV_FSYS1 EXYNOS_CLKREG(0x1054C)
316#define EXYNOS5_CLKDIV_FSYS2 EXYNOS_CLKREG(0x10550)
317#define EXYNOS5_CLKDIV_FSYS3 EXYNOS_CLKREG(0x10554)
318#define EXYNOS5_CLKDIV_PERIC0 EXYNOS_CLKREG(0x10558)
319#define EXYNOS5_CLKDIV_PERIC1 EXYNOS_CLKREG(0x1055C)
320#define EXYNOS5_CLKDIV_PERIC2 EXYNOS_CLKREG(0x10560)
321#define EXYNOS5_CLKDIV_PERIC3 EXYNOS_CLKREG(0x10564)
322#define EXYNOS5_CLKDIV_PERIC4 EXYNOS_CLKREG(0x10568)
323#define EXYNOS5_CLKDIV_PERIC5 EXYNOS_CLKREG(0x1056C)
324#define EXYNOS5_SCLK_DIV_ISP EXYNOS_CLKREG(0x10580)
325
326#define EXYNOS5_CLKGATE_IP_ACP EXYNOS_CLKREG(0x08800)
327#define EXYNOS5_CLKGATE_IP_ISP0 EXYNOS_CLKREG(0x0C800)
328#define EXYNOS5_CLKGATE_IP_ISP1 EXYNOS_CLKREG(0x0C804)
329#define EXYNOS5_CLKGATE_IP_GSCL EXYNOS_CLKREG(0x10920)
330#define EXYNOS5_CLKGATE_IP_DISP1 EXYNOS_CLKREG(0x10928)
331#define EXYNOS5_CLKGATE_IP_MFC EXYNOS_CLKREG(0x1092C)
332#define EXYNOS5_CLKGATE_IP_G3D EXYNOS_CLKREG(0x10930)
333#define EXYNOS5_CLKGATE_IP_GEN EXYNOS_CLKREG(0x10934)
334#define EXYNOS5_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x10944)
335#define EXYNOS5_CLKGATE_IP_GPS EXYNOS_CLKREG(0x1094C)
336#define EXYNOS5_CLKGATE_IP_PERIC EXYNOS_CLKREG(0x10950)
337#define EXYNOS5_CLKGATE_IP_PERIS EXYNOS_CLKREG(0x10960)
338#define EXYNOS5_CLKGATE_BLOCK EXYNOS_CLKREG(0x10980)
339
340#define EXYNOS5_BPLL_CON0 EXYNOS_CLKREG(0x20110)
341#define EXYNOS5_CLKSRC_CDREX EXYNOS_CLKREG(0x20200)
342#define EXYNOS5_CLKDIV_CDREX EXYNOS_CLKREG(0x20500)
343
344#define EXYNOS5_PLL_DIV2_SEL EXYNOS_CLKREG(0x20A24)
345
346#define EXYNOS5_EPLL_LOCK EXYNOS_CLKREG(0x10030)
347
348#define EXYNOS5_EPLLCON0_LOCKED_SHIFT (29)
349
350#define PWR_CTRL1_CORE2_DOWN_RATIO (7 << 28)
351#define PWR_CTRL1_CORE1_DOWN_RATIO (7 << 16)
352#define PWR_CTRL1_DIV2_DOWN_EN (1 << 9)
353#define PWR_CTRL1_DIV1_DOWN_EN (1 << 8)
354#define PWR_CTRL1_USE_CORE1_WFE (1 << 5)
355#define PWR_CTRL1_USE_CORE0_WFE (1 << 4)
356#define PWR_CTRL1_USE_CORE1_WFI (1 << 1)
357#define PWR_CTRL1_USE_CORE0_WFI (1 << 0)
358
359#define PWR_CTRL2_DIV2_UP_EN (1 << 25)
360#define PWR_CTRL2_DIV1_UP_EN (1 << 24)
361#define PWR_CTRL2_DUR_STANDBY2_VAL (1 << 16)
362#define PWR_CTRL2_DUR_STANDBY1_VAL (1 << 8)
363#define PWR_CTRL2_CORE2_UP_RATIO (1 << 4)
364#define PWR_CTRL2_CORE1_UP_RATIO (1 << 0)
365
366/* Compatibility defines and inclusion */
367
368#include <mach/regs-pmu.h>
369
370#define S5P_EPLL_CON EXYNOS4_EPLL_CON0
371
372#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-irq.h b/arch/arm/mach-exynos/include/mach/regs-irq.h
deleted file mode 100644
index f2b50506b9f6..000000000000
--- a/arch/arm/mach-exynos/include/mach/regs-irq.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* linux/arch/arm/mach-exynos4/include/mach/regs-irq.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - IRQ register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_IRQ_H
14#define __ASM_ARCH_REGS_IRQ_H __FILE__
15
16#include <linux/irqchip/arm-gic.h>
17#include <mach/map.h>
18
19#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 4603e6bd424b..d3e54b7644d7 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -22,6 +22,7 @@
22static void __init exynos4_dt_machine_init(void) 22static void __init exynos4_dt_machine_init(void)
23{ 23{
24 exynos_cpuidle_init(); 24 exynos_cpuidle_init();
25 exynos_cpufreq_init();
25 26
26 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
27} 28}
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 1fe075a70c1e..37ea261f0f6c 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -14,10 +14,10 @@
14#include <linux/io.h> 14#include <linux/io.h>
15 15
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <mach/regs-pmu.h>
18#include <plat/mfc.h> 17#include <plat/mfc.h>
19 18
20#include "common.h" 19#include "common.h"
20#include "regs-pmu.h"
21 21
22static void __init exynos5_dt_machine_init(void) 22static void __init exynos5_dt_machine_init(void)
23{ 23{
@@ -44,6 +44,7 @@ static void __init exynos5_dt_machine_init(void)
44 } 44 }
45 45
46 exynos_cpuidle_init(); 46 exynos_cpuidle_init();
47 exynos_cpufreq_init();
47 48
48 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 49 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
49} 50}
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 58b43e6f9262..8ea02f63fed9 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -27,12 +27,11 @@
27#include <asm/firmware.h> 27#include <asm/firmware.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/regs-clock.h>
31#include <mach/regs-pmu.h>
32 30
33#include <plat/cpu.h> 31#include <plat/cpu.h>
34 32
35#include "common.h" 33#include "common.h"
34#include "regs-pmu.h"
36 35
37extern void exynos4_secondary_startup(void); 36extern void exynos4_secondary_startup(void);
38 37
@@ -64,8 +63,7 @@ static void write_pen_release(int val)
64{ 63{
65 pen_release = val; 64 pen_release = val;
66 smp_wmb(); 65 smp_wmb();
67 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); 66 sync_cache_w(&pen_release);
68 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
69} 67}
70 68
71static void __iomem *scu_base_addr(void) 69static void __iomem *scu_base_addr(void)
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index c679db577269..e00025bbbe89 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -29,14 +29,37 @@
29#include <plat/pll.h> 29#include <plat/pll.h>
30#include <plat/regs-srom.h> 30#include <plat/regs-srom.h>
31 31
32#include <mach/regs-irq.h> 32#include <mach/map.h>
33#include <mach/regs-clock.h>
34#include <mach/regs-pmu.h>
35#include <mach/pm-core.h> 33#include <mach/pm-core.h>
36 34
37#include "common.h" 35#include "common.h"
36#include "regs-pmu.h"
38 37
39static struct sleep_save exynos4_set_clksrc[] = { 38#define EXYNOS4_EPLL_LOCK (S5P_VA_CMU + 0x0C010)
39#define EXYNOS4_VPLL_LOCK (S5P_VA_CMU + 0x0C020)
40
41#define EXYNOS4_EPLL_CON0 (S5P_VA_CMU + 0x0C110)
42#define EXYNOS4_EPLL_CON1 (S5P_VA_CMU + 0x0C114)
43#define EXYNOS4_VPLL_CON0 (S5P_VA_CMU + 0x0C120)
44#define EXYNOS4_VPLL_CON1 (S5P_VA_CMU + 0x0C124)
45
46#define EXYNOS4_CLKSRC_MASK_TOP (S5P_VA_CMU + 0x0C310)
47#define EXYNOS4_CLKSRC_MASK_CAM (S5P_VA_CMU + 0x0C320)
48#define EXYNOS4_CLKSRC_MASK_TV (S5P_VA_CMU + 0x0C324)
49#define EXYNOS4_CLKSRC_MASK_LCD0 (S5P_VA_CMU + 0x0C334)
50#define EXYNOS4_CLKSRC_MASK_MAUDIO (S5P_VA_CMU + 0x0C33C)
51#define EXYNOS4_CLKSRC_MASK_FSYS (S5P_VA_CMU + 0x0C340)
52#define EXYNOS4_CLKSRC_MASK_PERIL0 (S5P_VA_CMU + 0x0C350)
53#define EXYNOS4_CLKSRC_MASK_PERIL1 (S5P_VA_CMU + 0x0C354)
54
55#define EXYNOS4_CLKSRC_MASK_DMC (S5P_VA_CMU + 0x10300)
56
57#define EXYNOS4_EPLLCON0_LOCKED_SHIFT (29)
58#define EXYNOS4_VPLLCON0_LOCKED_SHIFT (29)
59
60#define EXYNOS4210_CLKSRC_MASK_LCD1 (S5P_VA_CMU + 0x0C338)
61
62static const struct sleep_save exynos4_set_clksrc[] = {
40 { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, }, 63 { .reg = EXYNOS4_CLKSRC_MASK_TOP , .val = 0x00000001, },
41 { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, }, 64 { .reg = EXYNOS4_CLKSRC_MASK_CAM , .val = 0x11111111, },
42 { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, }, 65 { .reg = EXYNOS4_CLKSRC_MASK_TV , .val = 0x00000111, },
@@ -48,7 +71,7 @@ static struct sleep_save exynos4_set_clksrc[] = {
48 { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, }, 71 { .reg = EXYNOS4_CLKSRC_MASK_DMC , .val = 0x00010000, },
49}; 72};
50 73
51static struct sleep_save exynos4210_set_clksrc[] = { 74static const struct sleep_save exynos4210_set_clksrc[] = {
52 { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, }, 75 { .reg = EXYNOS4210_CLKSRC_MASK_LCD1 , .val = 0x00001111, },
53}; 76};
54 77
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 1703593e366c..8fd24882f0b1 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -22,9 +22,10 @@
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24 24
25#include <mach/regs-pmu.h>
26#include <plat/devs.h> 25#include <plat/devs.h>
27 26
27#include "regs-pmu.h"
28
28/* 29/*
29 * Exynos specific wrapper around the generic power domain 30 * Exynos specific wrapper around the generic power domain
30 */ 31 */
@@ -183,9 +184,3 @@ static __init int exynos4_pm_init_power_domain(void)
183 return 0; 184 return 0;
184} 185}
185arch_initcall(exynos4_pm_init_power_domain); 186arch_initcall(exynos4_pm_init_power_domain);
186
187int __init exynos_pm_late_initcall(void)
188{
189 pm_genpd_poweroff_unused();
190 return 0;
191}
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 97d688526258..05c7ce15322a 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -13,13 +13,14 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/bug.h> 14#include <linux/bug.h>
15 15
16#include <mach/regs-clock.h> 16#include <plat/cpu.h>
17 17
18#include "common.h" 18#include "common.h"
19#include "regs-pmu.h"
19 20
20static struct exynos_pmu_conf *exynos_pmu_config; 21static const struct exynos_pmu_conf *exynos_pmu_config;
21 22
22static struct exynos_pmu_conf exynos4210_pmu_config[] = { 23static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
23 /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ 24 /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
24 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, 25 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
25 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, 26 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
@@ -95,7 +96,7 @@ static struct exynos_pmu_conf exynos4210_pmu_config[] = {
95 { PMU_TABLE_END,}, 96 { PMU_TABLE_END,},
96}; 97};
97 98
98static struct exynos_pmu_conf exynos4x12_pmu_config[] = { 99static const struct exynos_pmu_conf exynos4x12_pmu_config[] = {
99 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } }, 100 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
100 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } }, 101 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
101 { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } }, 102 { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
@@ -203,7 +204,7 @@ static struct exynos_pmu_conf exynos4x12_pmu_config[] = {
203 { PMU_TABLE_END,}, 204 { PMU_TABLE_END,},
204}; 205};
205 206
206static struct exynos_pmu_conf exynos4412_pmu_config[] = { 207static const struct exynos_pmu_conf exynos4412_pmu_config[] = {
207 { S5P_ARM_CORE2_LOWPWR, { 0x0, 0x0, 0x2 } }, 208 { S5P_ARM_CORE2_LOWPWR, { 0x0, 0x0, 0x2 } },
208 { S5P_DIS_IRQ_CORE2, { 0x0, 0x0, 0x0 } }, 209 { S5P_DIS_IRQ_CORE2, { 0x0, 0x0, 0x0 } },
209 { S5P_DIS_IRQ_CENTRAL2, { 0x0, 0x0, 0x0 } }, 210 { S5P_DIS_IRQ_CENTRAL2, { 0x0, 0x0, 0x0 } },
@@ -213,7 +214,7 @@ static struct exynos_pmu_conf exynos4412_pmu_config[] = {
213 { PMU_TABLE_END,}, 214 { PMU_TABLE_END,},
214}; 215};
215 216
216static struct exynos_pmu_conf exynos5250_pmu_config[] = { 217static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
217 /* { .reg = address, .val = { AFTR, LPA, SLEEP } */ 218 /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
218 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 219 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
219 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 220 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
@@ -317,7 +318,7 @@ static struct exynos_pmu_conf exynos5250_pmu_config[] = {
317 { PMU_TABLE_END,}, 318 { PMU_TABLE_END,},
318}; 319};
319 320
320static void __iomem *exynos5_list_both_cnt_feed[] = { 321static void __iomem * const exynos5_list_both_cnt_feed[] = {
321 EXYNOS5_ARM_CORE0_OPTION, 322 EXYNOS5_ARM_CORE0_OPTION,
322 EXYNOS5_ARM_CORE1_OPTION, 323 EXYNOS5_ARM_CORE1_OPTION,
323 EXYNOS5_ARM_COMMON_OPTION, 324 EXYNOS5_ARM_COMMON_OPTION,
@@ -331,7 +332,7 @@ static void __iomem *exynos5_list_both_cnt_feed[] = {
331 EXYNOS5_TOP_PWR_SYSMEM_OPTION, 332 EXYNOS5_TOP_PWR_SYSMEM_OPTION,
332}; 333};
333 334
334static void __iomem *exynos5_list_diable_wfi_wfe[] = { 335static void __iomem * const exynos5_list_diable_wfi_wfe[] = {
335 EXYNOS5_ARM_CORE1_OPTION, 336 EXYNOS5_ARM_CORE1_OPTION,
336 EXYNOS5_FSYS_ARM_OPTION, 337 EXYNOS5_FSYS_ARM_OPTION,
337 EXYNOS5_ISP_ARM_OPTION, 338 EXYNOS5_ISP_ARM_OPTION,
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 2cdb63e8ce5c..7c029ce27711 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -24,31 +24,16 @@
24#define S5P_CENTRAL_SEQ_OPTION S5P_PMUREG(0x0208) 24#define S5P_CENTRAL_SEQ_OPTION S5P_PMUREG(0x0208)
25 25
26#define S5P_USE_STANDBY_WFI0 (1 << 16) 26#define S5P_USE_STANDBY_WFI0 (1 << 16)
27#define S5P_USE_STANDBY_WFI1 (1 << 17)
28#define S5P_USE_STANDBYWFI_ISP_ARM (1 << 18)
29#define S5P_USE_STANDBY_WFE0 (1 << 24) 27#define S5P_USE_STANDBY_WFE0 (1 << 24)
30#define S5P_USE_STANDBY_WFE1 (1 << 25)
31#define S5P_USE_STANDBYWFE_ISP_ARM (1 << 26)
32 28
33#define S5P_SWRESET S5P_PMUREG(0x0400) 29#define S5P_SWRESET S5P_PMUREG(0x0400)
34#define EXYNOS_SWRESET S5P_PMUREG(0x0400) 30#define EXYNOS_SWRESET S5P_PMUREG(0x0400)
35#define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4) 31#define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4)
36 32
37#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) 33#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600)
38#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604)
39#define S5P_WAKEUP_MASK S5P_PMUREG(0x0608)
40
41#define S5P_HDMI_PHY_CONTROL S5P_PMUREG(0x0700)
42#define S5P_HDMI_PHY_ENABLE (1 << 0)
43
44#define S5P_DAC_PHY_CONTROL S5P_PMUREG(0x070C)
45#define S5P_DAC_PHY_ENABLE (1 << 0)
46 34
47#define S5P_INFORM0 S5P_PMUREG(0x0800) 35#define S5P_INFORM0 S5P_PMUREG(0x0800)
48#define S5P_INFORM1 S5P_PMUREG(0x0804) 36#define S5P_INFORM1 S5P_PMUREG(0x0804)
49#define S5P_INFORM2 S5P_PMUREG(0x0808)
50#define S5P_INFORM3 S5P_PMUREG(0x080C)
51#define S5P_INFORM4 S5P_PMUREG(0x0810)
52#define S5P_INFORM5 S5P_PMUREG(0x0814) 37#define S5P_INFORM5 S5P_PMUREG(0x0814)
53#define S5P_INFORM6 S5P_PMUREG(0x0818) 38#define S5P_INFORM6 S5P_PMUREG(0x0818)
54#define S5P_INFORM7 S5P_PMUREG(0x081C) 39#define S5P_INFORM7 S5P_PMUREG(0x081C)
@@ -119,23 +104,8 @@
119#define S5P_GPS_LOWPWR S5P_PMUREG(0x139C) 104#define S5P_GPS_LOWPWR S5P_PMUREG(0x139C)
120#define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) 105#define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0)
121 106
122#define S5P_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000)
123#define S5P_ARM_CORE0_OPTION S5P_PMUREG(0x2008)
124#define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080) 107#define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080)
125#define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084) 108#define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084)
126#define S5P_ARM_CORE1_OPTION S5P_PMUREG(0x2088)
127
128#define S5P_ARM_COMMON_OPTION S5P_PMUREG(0x2408)
129#define S5P_TOP_PWR_OPTION S5P_PMUREG(0x2C48)
130#define S5P_CAM_OPTION S5P_PMUREG(0x3C08)
131#define S5P_TV_OPTION S5P_PMUREG(0x3C28)
132#define S5P_MFC_OPTION S5P_PMUREG(0x3C48)
133#define S5P_G3D_OPTION S5P_PMUREG(0x3C68)
134#define S5P_LCD0_OPTION S5P_PMUREG(0x3C88)
135#define S5P_LCD1_OPTION S5P_PMUREG(0x3CA8)
136#define S5P_MAUDIO_OPTION S5P_PMUREG(0x3CC8)
137#define S5P_GPS_OPTION S5P_PMUREG(0x3CE8)
138#define S5P_GPS_ALIVE_OPTION S5P_PMUREG(0x3D08)
139 109
140#define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028) 110#define S5P_PAD_RET_MAUDIO_OPTION S5P_PMUREG(0x3028)
141#define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108) 111#define S5P_PAD_RET_GPIO_OPTION S5P_PMUREG(0x3108)
@@ -145,28 +115,12 @@
145#define S5P_PAD_RET_EBIA_OPTION S5P_PMUREG(0x3188) 115#define S5P_PAD_RET_EBIA_OPTION S5P_PMUREG(0x3188)
146#define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8) 116#define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8)
147 117
148#define S5P_PMU_CAM_CONF S5P_PMUREG(0x3C00)
149#define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20)
150#define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40)
151#define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60)
152#define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80)
153#define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0)
154
155#define S5P_PMU_SATA_PHY_CONTROL_EN 0x1
156#define S5P_CORE_LOCAL_PWR_EN 0x3 118#define S5P_CORE_LOCAL_PWR_EN 0x3
157#define S5P_INT_LOCAL_PWR_EN 0x7 119#define S5P_INT_LOCAL_PWR_EN 0x7
158 120
159#define S5P_CHECK_SLEEP 0x00000BAD 121#define S5P_CHECK_SLEEP 0x00000BAD
160 122
161/* Only for EXYNOS4210 */ 123/* Only for EXYNOS4210 */
162#define S5P_USBDEVICE_PHY_CONTROL S5P_PMUREG(0x0704)
163#define S5P_USBDEVICE_PHY_ENABLE (1 << 0)
164
165#define S5P_USBHOST_PHY_CONTROL S5P_PMUREG(0x0708)
166#define S5P_USBHOST_PHY_ENABLE (1 << 0)
167
168#define S5P_PMU_SATA_PHY_CONTROL S5P_PMUREG(0x0720)
169
170#define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) 124#define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154)
171#define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174) 125#define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174)
172#define S5P_MODIMIF_MEM_LOWPWR S5P_PMUREG(0x11C4) 126#define S5P_MODIMIF_MEM_LOWPWR S5P_PMUREG(0x11C4)
@@ -174,8 +128,6 @@
174#define S5P_SATA_MEM_LOWPWR S5P_PMUREG(0x11E4) 128#define S5P_SATA_MEM_LOWPWR S5P_PMUREG(0x11E4)
175#define S5P_LCD1_LOWPWR S5P_PMUREG(0x1394) 129#define S5P_LCD1_LOWPWR S5P_PMUREG(0x1394)
176 130
177#define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0)
178
179/* Only for EXYNOS4x12 */ 131/* Only for EXYNOS4x12 */
180#define S5P_ISP_ARM_LOWPWR S5P_PMUREG(0x1050) 132#define S5P_ISP_ARM_LOWPWR S5P_PMUREG(0x1050)
181#define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR S5P_PMUREG(0x1054) 133#define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR S5P_PMUREG(0x1054)
@@ -343,13 +295,9 @@
343#define EXYNOS5_TOP_PWR_OPTION S5P_PMUREG(0x2C48) 295#define EXYNOS5_TOP_PWR_OPTION S5P_PMUREG(0x2C48)
344#define EXYNOS5_TOP_PWR_SYSMEM_OPTION S5P_PMUREG(0x2CC8) 296#define EXYNOS5_TOP_PWR_SYSMEM_OPTION S5P_PMUREG(0x2CC8)
345#define EXYNOS5_JPEG_MEM_OPTION S5P_PMUREG(0x2F48) 297#define EXYNOS5_JPEG_MEM_OPTION S5P_PMUREG(0x2F48)
346#define EXYNOS5_GSCL_STATUS S5P_PMUREG(0x4004)
347#define EXYNOS5_ISP_STATUS S5P_PMUREG(0x4024)
348#define EXYNOS5_GSCL_OPTION S5P_PMUREG(0x4008) 298#define EXYNOS5_GSCL_OPTION S5P_PMUREG(0x4008)
349#define EXYNOS5_ISP_OPTION S5P_PMUREG(0x4028) 299#define EXYNOS5_ISP_OPTION S5P_PMUREG(0x4028)
350#define EXYNOS5_MFC_OPTION S5P_PMUREG(0x4048) 300#define EXYNOS5_MFC_OPTION S5P_PMUREG(0x4048)
351#define EXYNOS5_G3D_CONFIGURATION S5P_PMUREG(0x4060)
352#define EXYNOS5_G3D_STATUS S5P_PMUREG(0x4064)
353#define EXYNOS5_G3D_OPTION S5P_PMUREG(0x4068) 301#define EXYNOS5_G3D_OPTION S5P_PMUREG(0x4068)
354#define EXYNOS5_DISP1_OPTION S5P_PMUREG(0x40A8) 302#define EXYNOS5_DISP1_OPTION S5P_PMUREG(0x40A8)
355#define EXYNOS5_MAU_OPTION S5P_PMUREG(0x40C8) 303#define EXYNOS5_MAU_OPTION S5P_PMUREG(0x40C8)
@@ -357,7 +305,6 @@
357#define EXYNOS5_USE_SC_FEEDBACK (1 << 1) 305#define EXYNOS5_USE_SC_FEEDBACK (1 << 1)
358#define EXYNOS5_USE_SC_COUNTER (1 << 0) 306#define EXYNOS5_USE_SC_COUNTER (1 << 0)
359 307
360#define EXYNOS5_MANUAL_L2RSTDISABLE_CONTROL (1 << 2)
361#define EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN (1 << 7) 308#define EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN (1 << 7)
362 309
363#define EXYNOS5_OPTION_USE_STANDBYWFE (1 << 24) 310#define EXYNOS5_OPTION_USE_STANDBYWFE (1 << 24)
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
index 0f2111a11315..fba55fb9f47d 100644
--- a/arch/arm/mach-footbridge/Kconfig
+++ b/arch/arm/mach-footbridge/Kconfig
@@ -85,6 +85,7 @@ config FOOTBRIDGE
85# Footbridge in host mode 85# Footbridge in host mode
86config FOOTBRIDGE_HOST 86config FOOTBRIDGE_HOST
87 bool 87 bool
88 select ARCH_MIGHT_HAVE_PC_SERIO
88 89
89# Footbridge in addin mode 90# Footbridge in addin mode
90config FOOTBRIDGE_ADDIN 91config FOOTBRIDGE_ADDIN
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index e0091685fd48..9e8220e38398 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -143,11 +143,6 @@ static struct map_desc fb_common_io_desc[] __initdata = {
143 .pfn = __phys_to_pfn(DC21285_ARMCSR_BASE), 143 .pfn = __phys_to_pfn(DC21285_ARMCSR_BASE),
144 .length = ARMCSR_SIZE, 144 .length = ARMCSR_SIZE,
145 .type = MT_DEVICE, 145 .type = MT_DEVICE,
146 }, {
147 .virtual = XBUS_BASE,
148 .pfn = __phys_to_pfn(0x40000000),
149 .length = XBUS_SIZE,
150 .type = MT_DEVICE,
151 } 146 }
152}; 147};
153 148
diff --git a/arch/arm/mach-footbridge/common.h b/arch/arm/mach-footbridge/common.h
index 56607b3a773e..b911e5587ecf 100644
--- a/arch/arm/mach-footbridge/common.h
+++ b/arch/arm/mach-footbridge/common.h
@@ -10,3 +10,5 @@ extern void footbridge_init_irq(void);
10 10
11extern void isa_init_irq(unsigned int irq); 11extern void isa_init_irq(unsigned int irq);
12extern void footbridge_restart(enum reboot_mode, const char *); 12extern void footbridge_restart(enum reboot_mode, const char *);
13
14extern void footbridge_sched_clock(void);
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index 782f6c71fa0a..3971104d32d4 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -9,6 +9,7 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/sched_clock.h>
12 13
13#include <asm/irq.h> 14#include <asm/irq.h>
14 15
@@ -46,6 +47,16 @@ static struct clocksource cksrc_dc21285 = {
46 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 47 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
47}; 48};
48 49
50static int ckevt_dc21285_set_next_event(unsigned long delta,
51 struct clock_event_device *c)
52{
53 *CSR_TIMER1_CLR = 0;
54 *CSR_TIMER1_LOAD = delta;
55 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16;
56
57 return 0;
58}
59
49static void ckevt_dc21285_set_mode(enum clock_event_mode mode, 60static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
50 struct clock_event_device *c) 61 struct clock_event_device *c)
51{ 62{
@@ -58,7 +69,9 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
58 TIMER_CNTL_DIV16; 69 TIMER_CNTL_DIV16;
59 break; 70 break;
60 71
61 default: 72 case CLOCK_EVT_MODE_ONESHOT:
73 case CLOCK_EVT_MODE_UNUSED:
74 case CLOCK_EVT_MODE_SHUTDOWN:
62 *CSR_TIMER1_CNTL = 0; 75 *CSR_TIMER1_CNTL = 0;
63 break; 76 break;
64 } 77 }
@@ -66,9 +79,11 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
66 79
67static struct clock_event_device ckevt_dc21285 = { 80static struct clock_event_device ckevt_dc21285 = {
68 .name = "dc21285_timer1", 81 .name = "dc21285_timer1",
69 .features = CLOCK_EVT_FEAT_PERIODIC, 82 .features = CLOCK_EVT_FEAT_PERIODIC |
83 CLOCK_EVT_FEAT_ONESHOT,
70 .rating = 200, 84 .rating = 200,
71 .irq = IRQ_TIMER1, 85 .irq = IRQ_TIMER1,
86 .set_next_event = ckevt_dc21285_set_next_event,
72 .set_mode = ckevt_dc21285_set_mode, 87 .set_mode = ckevt_dc21285_set_mode,
73}; 88};
74 89
@@ -78,6 +93,10 @@ static irqreturn_t timer1_interrupt(int irq, void *dev_id)
78 93
79 *CSR_TIMER1_CLR = 0; 94 *CSR_TIMER1_CLR = 0;
80 95
96 /* Stop the timer if in one-shot mode */
97 if (ce->mode == CLOCK_EVT_MODE_ONESHOT)
98 *CSR_TIMER1_CNTL = 0;
99
81 ce->event_handler(ce); 100 ce->event_handler(ce);
82 101
83 return IRQ_HANDLED; 102 return IRQ_HANDLED;
@@ -105,3 +124,19 @@ void __init footbridge_timer_init(void)
105 ce->cpumask = cpumask_of(smp_processor_id()); 124 ce->cpumask = cpumask_of(smp_processor_id());
106 clockevents_config_and_register(ce, rate, 0x4, 0xffffff); 125 clockevents_config_and_register(ce, rate, 0x4, 0xffffff);
107} 126}
127
128static u32 notrace footbridge_read_sched_clock(void)
129{
130 return ~*CSR_TIMER3_VALUE;
131}
132
133void __init footbridge_sched_clock(void)
134{
135 unsigned rate = DIV_ROUND_CLOSEST(mem_fclk_21285, 16);
136
137 *CSR_TIMER3_LOAD = 0;
138 *CSR_TIMER3_CLR = 0;
139 *CSR_TIMER3_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16;
140
141 setup_sched_clock(footbridge_read_sched_clock, 24, rate);
142}
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c
index 1a7235fb52ac..aee8300f3490 100644
--- a/arch/arm/mach-footbridge/ebsa285.c
+++ b/arch/arm/mach-footbridge/ebsa285.c
@@ -4,6 +4,7 @@
4 * EBSA285 machine fixup 4 * EBSA285 machine fixup
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/io.h>
7#include <linux/spinlock.h> 8#include <linux/spinlock.h>
8#include <linux/slab.h> 9#include <linux/slab.h>
9#include <linux/leds.h> 10#include <linux/leds.h>
@@ -17,6 +18,11 @@
17 18
18/* LEDs */ 19/* LEDs */
19#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) 20#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
21#define XBUS_AMBER_L BIT(0)
22#define XBUS_GREEN_L BIT(1)
23#define XBUS_RED_L BIT(2)
24#define XBUS_TOGGLE BIT(7)
25
20struct ebsa285_led { 26struct ebsa285_led {
21 struct led_classdev cdev; 27 struct led_classdev cdev;
22 u8 mask; 28 u8 mask;
@@ -36,6 +42,7 @@ static const struct {
36}; 42};
37 43
38static unsigned char hw_led_state; 44static unsigned char hw_led_state;
45static void __iomem *xbus;
39 46
40static void ebsa285_led_set(struct led_classdev *cdev, 47static void ebsa285_led_set(struct led_classdev *cdev,
41 enum led_brightness b) 48 enum led_brightness b)
@@ -47,7 +54,7 @@ static void ebsa285_led_set(struct led_classdev *cdev,
47 hw_led_state |= led->mask; 54 hw_led_state |= led->mask;
48 else 55 else
49 hw_led_state &= ~led->mask; 56 hw_led_state &= ~led->mask;
50 *XBUS_LEDS = hw_led_state; 57 writeb(hw_led_state, xbus);
51} 58}
52 59
53static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) 60static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
@@ -65,9 +72,13 @@ static int __init ebsa285_leds_init(void)
65 if (!machine_is_ebsa285()) 72 if (!machine_is_ebsa285())
66 return -ENODEV; 73 return -ENODEV;
67 74
75 xbus = ioremap(XBUS_CS2, SZ_4K);
76 if (!xbus)
77 return -ENOMEM;
78
68 /* 3 LEDS all off */ 79 /* 3 LEDS all off */
69 hw_led_state = XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED; 80 hw_led_state = XBUS_AMBER_L | XBUS_GREEN_L | XBUS_RED_L;
70 *XBUS_LEDS = hw_led_state; 81 writeb(hw_led_state, xbus);
71 82
72 for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { 83 for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) {
73 struct ebsa285_led *led; 84 struct ebsa285_led *led;
@@ -104,6 +115,7 @@ MACHINE_START(EBSA285, "EBSA285")
104 .video_start = 0x000a0000, 115 .video_start = 0x000a0000,
105 .video_end = 0x000bffff, 116 .video_end = 0x000bffff,
106 .map_io = footbridge_map_io, 117 .map_io = footbridge_map_io,
118 .init_early = footbridge_sched_clock,
107 .init_irq = footbridge_init_irq, 119 .init_irq = footbridge_init_irq,
108 .init_time = footbridge_timer_init, 120 .init_time = footbridge_timer_init,
109 .restart = footbridge_restart, 121 .restart = footbridge_restart,
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h
index e3d6ccac2162..02f6d7a706b1 100644
--- a/arch/arm/mach-footbridge/include/mach/hardware.h
+++ b/arch/arm/mach-footbridge/include/mach/hardware.h
@@ -51,11 +51,7 @@
51#define PCIMEM_SIZE 0x01000000 51#define PCIMEM_SIZE 0x01000000
52#define PCIMEM_BASE MMU_IO(0xf0000000, 0x80000000) 52#define PCIMEM_BASE MMU_IO(0xf0000000, 0x80000000)
53 53
54#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000)) 54#define XBUS_CS2 0x40012000
55#define XBUS_LED_AMBER (1 << 0)
56#define XBUS_LED_GREEN (1 << 1)
57#define XBUS_LED_RED (1 << 2)
58#define XBUS_LED_TOGGLE (1 << 8)
59 55
60#define XBUS_SWITCH ((volatile unsigned char *)(XBUS_BASE + 0x12000)) 56#define XBUS_SWITCH ((volatile unsigned char *)(XBUS_BASE + 0x12000))
61#define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15) 57#define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15)
diff --git a/arch/arm/mach-hisi/Kconfig b/arch/arm/mach-hisi/Kconfig
new file mode 100644
index 000000000000..8f4649b301b2
--- /dev/null
+++ b/arch/arm/mach-hisi/Kconfig
@@ -0,0 +1,16 @@
1config ARCH_HI3xxx
2 bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7
3 select ARM_AMBA
4 select ARM_GIC
5 select ARM_TIMER_SP804
6 select ARCH_WANT_OPTIONAL_GPIOLIB
7 select CACHE_L2X0
8 select CLKSRC_OF
9 select GENERIC_CLOCKEVENTS
10 select HAVE_ARM_SCU
11 select HAVE_ARM_TWD
12 select HAVE_SMP
13 select PINCTRL
14 select PINCTRL_SINGLE
15 help
16 Support for Hisilicon Hi36xx/Hi37xx processor family
diff --git a/arch/arm/mach-hisi/Makefile b/arch/arm/mach-hisi/Makefile
new file mode 100644
index 000000000000..6870058d0a48
--- /dev/null
+++ b/arch/arm/mach-hisi/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for Hisilicon processors family
3#
4
5obj-y += hisilicon.o
6obj-$(CONFIG_SMP) += platsmp.o
7obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-hisi/core.h b/arch/arm/mach-hisi/core.h
new file mode 100644
index 000000000000..af23ec204538
--- /dev/null
+++ b/arch/arm/mach-hisi/core.h
@@ -0,0 +1,15 @@
1#ifndef __HISILICON_CORE_H
2#define __HISILICON_CORE_H
3
4#include <linux/reboot.h>
5
6extern void hi3xxx_set_cpu_jump(int cpu, void *jump_addr);
7extern int hi3xxx_get_cpu_jump(int cpu);
8extern void secondary_startup(void);
9extern struct smp_operations hi3xxx_smp_ops;
10
11extern void hi3xxx_cpu_die(unsigned int cpu);
12extern int hi3xxx_cpu_kill(unsigned int cpu);
13extern void hi3xxx_set_cpu(int cpu, bool enable);
14
15#endif
diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c
new file mode 100644
index 000000000000..741faf3e7100
--- /dev/null
+++ b/arch/arm/mach-hisi/hisilicon.c
@@ -0,0 +1,90 @@
1/*
2 * (Hisilicon's SoC based) flattened device tree enabled machine
3 *
4 * Copyright (c) 2012-2013 Hisilicon Ltd.
5 * Copyright (c) 2012-2013 Linaro Ltd.
6 *
7 * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/clk-provider.h>
15#include <linux/clocksource.h>
16#include <linux/irqchip.h>
17#include <linux/of_address.h>
18#include <linux/of_platform.h>
19
20#include <asm/proc-fns.h>
21
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24
25#include "core.h"
26
27#define HI3620_SYSCTRL_PHYS_BASE 0xfc802000
28#define HI3620_SYSCTRL_VIRT_BASE 0xfe802000
29
30/*
31 * This table is only for optimization. Since ioremap() could always share
32 * the same mapping if it's defined as static IO mapping.
33 *
34 * Without this table, system could also work. The cost is some virtual address
35 * spaces wasted since ioremap() may be called multi times for the same
36 * IO space.
37 */
38static struct map_desc hi3620_io_desc[] __initdata = {
39 {
40 /* sysctrl */
41 .pfn = __phys_to_pfn(HI3620_SYSCTRL_PHYS_BASE),
42 .virtual = HI3620_SYSCTRL_VIRT_BASE,
43 .length = 0x1000,
44 .type = MT_DEVICE,
45 },
46};
47
48static void __init hi3620_map_io(void)
49{
50 debug_ll_io_init();
51 iotable_init(hi3620_io_desc, ARRAY_SIZE(hi3620_io_desc));
52}
53
54static void hi3xxx_restart(enum reboot_mode mode, const char *cmd)
55{
56 struct device_node *np;
57 void __iomem *base;
58 int offset;
59
60 np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
61 if (!np) {
62 pr_err("failed to find hisilicon,sysctrl node\n");
63 return;
64 }
65 base = of_iomap(np, 0);
66 if (!base) {
67 pr_err("failed to map address in hisilicon,sysctrl node\n");
68 return;
69 }
70 if (of_property_read_u32(np, "reboot-offset", &offset) < 0) {
71 pr_err("failed to find reboot-offset property\n");
72 return;
73 }
74 writel_relaxed(0xdeadbeef, base + offset);
75
76 while (1)
77 cpu_do_idle();
78}
79
80static const char *hi3xxx_compat[] __initconst = {
81 "hisilicon,hi3620-hi4511",
82 NULL,
83};
84
85DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)")
86 .map_io = hi3620_map_io,
87 .dt_compat = hi3xxx_compat,
88 .smp = smp_ops(hi3xxx_smp_ops),
89 .restart = hi3xxx_restart,
90MACHINE_END
diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c
new file mode 100644
index 000000000000..b909854eee7f
--- /dev/null
+++ b/arch/arm/mach-hisi/hotplug.c
@@ -0,0 +1,200 @@
1/*
2 * Copyright (c) 2013 Linaro Ltd.
3 * Copyright (c) 2013 Hisilicon Limited.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 */
9
10#include <linux/cpu.h>
11#include <linux/delay.h>
12#include <linux/io.h>
13#include <linux/of_address.h>
14#include <linux/of_platform.h>
15#include <asm/cacheflush.h>
16#include <asm/smp_plat.h>
17#include "core.h"
18
19/* Sysctrl registers in Hi3620 SoC */
20#define SCISOEN 0xc0
21#define SCISODIS 0xc4
22#define SCPERPWREN 0xd0
23#define SCPERPWRDIS 0xd4
24#define SCCPUCOREEN 0xf4
25#define SCCPUCOREDIS 0xf8
26#define SCPERCTRL0 0x200
27#define SCCPURSTEN 0x410
28#define SCCPURSTDIS 0x414
29
30/*
31 * bit definition in SCISOEN/SCPERPWREN/...
32 *
33 * CPU2_ISO_CTRL (1 << 5)
34 * CPU3_ISO_CTRL (1 << 6)
35 * ...
36 */
37#define CPU2_ISO_CTRL (1 << 5)
38
39/*
40 * bit definition in SCPERCTRL0
41 *
42 * CPU0_WFI_MASK_CFG (1 << 28)
43 * CPU1_WFI_MASK_CFG (1 << 29)
44 * ...
45 */
46#define CPU0_WFI_MASK_CFG (1 << 28)
47
48/*
49 * bit definition in SCCPURSTEN/...
50 *
51 * CPU0_SRST_REQ_EN (1 << 0)
52 * CPU1_SRST_REQ_EN (1 << 1)
53 * ...
54 */
55#define CPU0_HPM_SRST_REQ_EN (1 << 22)
56#define CPU0_DBG_SRST_REQ_EN (1 << 12)
57#define CPU0_NEON_SRST_REQ_EN (1 << 4)
58#define CPU0_SRST_REQ_EN (1 << 0)
59
60enum {
61 HI3620_CTRL,
62 ERROR_CTRL,
63};
64
65static void __iomem *ctrl_base;
66static int id;
67
68static void set_cpu_hi3620(int cpu, bool enable)
69{
70 u32 val = 0;
71
72 if (enable) {
73 /* MTCMOS set */
74 if ((cpu == 2) || (cpu == 3))
75 writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
76 ctrl_base + SCPERPWREN);
77 udelay(100);
78
79 /* Enable core */
80 writel_relaxed(0x01 << cpu, ctrl_base + SCCPUCOREEN);
81
82 /* unreset */
83 val = CPU0_DBG_SRST_REQ_EN | CPU0_NEON_SRST_REQ_EN
84 | CPU0_SRST_REQ_EN;
85 writel_relaxed(val << cpu, ctrl_base + SCCPURSTDIS);
86 /* reset */
87 val |= CPU0_HPM_SRST_REQ_EN;
88 writel_relaxed(val << cpu, ctrl_base + SCCPURSTEN);
89
90 /* ISO disable */
91 if ((cpu == 2) || (cpu == 3))
92 writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
93 ctrl_base + SCISODIS);
94 udelay(1);
95
96 /* WFI Mask */
97 val = readl_relaxed(ctrl_base + SCPERCTRL0);
98 val &= ~(CPU0_WFI_MASK_CFG << cpu);
99 writel_relaxed(val, ctrl_base + SCPERCTRL0);
100
101 /* Unreset */
102 val = CPU0_DBG_SRST_REQ_EN | CPU0_NEON_SRST_REQ_EN
103 | CPU0_SRST_REQ_EN | CPU0_HPM_SRST_REQ_EN;
104 writel_relaxed(val << cpu, ctrl_base + SCCPURSTDIS);
105 } else {
106 /* wfi mask */
107 val = readl_relaxed(ctrl_base + SCPERCTRL0);
108 val |= (CPU0_WFI_MASK_CFG << cpu);
109 writel_relaxed(val, ctrl_base + SCPERCTRL0);
110
111 /* disable core*/
112 writel_relaxed(0x01 << cpu, ctrl_base + SCCPUCOREDIS);
113
114 if ((cpu == 2) || (cpu == 3)) {
115 /* iso enable */
116 writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
117 ctrl_base + SCISOEN);
118 udelay(1);
119 }
120
121 /* reset */
122 val = CPU0_DBG_SRST_REQ_EN | CPU0_NEON_SRST_REQ_EN
123 | CPU0_SRST_REQ_EN | CPU0_HPM_SRST_REQ_EN;
124 writel_relaxed(val << cpu, ctrl_base + SCCPURSTEN);
125
126 if ((cpu == 2) || (cpu == 3)) {
127 /* MTCMOS unset */
128 writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
129 ctrl_base + SCPERPWRDIS);
130 udelay(100);
131 }
132 }
133}
134
135static int hi3xxx_hotplug_init(void)
136{
137 struct device_node *node;
138
139 node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
140 if (node) {
141 ctrl_base = of_iomap(node, 0);
142 id = HI3620_CTRL;
143 return 0;
144 }
145 id = ERROR_CTRL;
146 return -ENOENT;
147}
148
149void hi3xxx_set_cpu(int cpu, bool enable)
150{
151 if (!ctrl_base) {
152 if (hi3xxx_hotplug_init() < 0)
153 return;
154 }
155
156 if (id == HI3620_CTRL)
157 set_cpu_hi3620(cpu, enable);
158}
159
160static inline void cpu_enter_lowpower(void)
161{
162 unsigned int v;
163
164 flush_cache_all();
165
166 /*
167 * Turn off coherency and L1 D-cache
168 */
169 asm volatile(
170 " mrc p15, 0, %0, c1, c0, 1\n"
171 " bic %0, %0, #0x40\n"
172 " mcr p15, 0, %0, c1, c0, 1\n"
173 " mrc p15, 0, %0, c1, c0, 0\n"
174 " bic %0, %0, #0x04\n"
175 " mcr p15, 0, %0, c1, c0, 0\n"
176 : "=&r" (v)
177 : "r" (0)
178 : "cc");
179}
180
181void hi3xxx_cpu_die(unsigned int cpu)
182{
183 cpu_enter_lowpower();
184 hi3xxx_set_cpu_jump(cpu, phys_to_virt(0));
185 cpu_do_idle();
186
187 /* We should have never returned from idle */
188 panic("cpu %d unexpectedly exit from shutdown\n", cpu);
189}
190
191int hi3xxx_cpu_kill(unsigned int cpu)
192{
193 unsigned long timeout = jiffies + msecs_to_jiffies(50);
194
195 while (hi3xxx_get_cpu_jump(cpu))
196 if (time_after(jiffies, timeout))
197 return 0;
198 hi3xxx_set_cpu(cpu, false);
199 return 1;
200}
diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
new file mode 100644
index 000000000000..471f1ee3be2b
--- /dev/null
+++ b/arch/arm/mach-hisi/platsmp.c
@@ -0,0 +1,89 @@
1/*
2 * Copyright (c) 2013 Linaro Ltd.
3 * Copyright (c) 2013 Hisilicon Limited.
4 * Based on arch/arm/mach-vexpress/platsmp.c, Copyright (C) 2002 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 */
10#include <linux/smp.h>
11#include <linux/io.h>
12#include <linux/of_address.h>
13
14#include <asm/cacheflush.h>
15#include <asm/smp_plat.h>
16#include <asm/smp_scu.h>
17
18#include "core.h"
19
20static void __iomem *ctrl_base;
21
22void hi3xxx_set_cpu_jump(int cpu, void *jump_addr)
23{
24 cpu = cpu_logical_map(cpu);
25 if (!cpu || !ctrl_base)
26 return;
27 writel_relaxed(virt_to_phys(jump_addr), ctrl_base + ((cpu - 1) << 2));
28}
29
30int hi3xxx_get_cpu_jump(int cpu)
31{
32 cpu = cpu_logical_map(cpu);
33 if (!cpu || !ctrl_base)
34 return 0;
35 return readl_relaxed(ctrl_base + ((cpu - 1) << 2));
36}
37
38static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
39{
40 struct device_node *np = NULL;
41 unsigned long base = 0;
42 u32 offset = 0;
43 void __iomem *scu_base = NULL;
44
45 if (scu_a9_has_base()) {
46 base = scu_a9_get_base();
47 scu_base = ioremap(base, SZ_4K);
48 if (!scu_base) {
49 pr_err("ioremap(scu_base) failed\n");
50 return;
51 }
52 scu_enable(scu_base);
53 iounmap(scu_base);
54 }
55 if (!ctrl_base) {
56 np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
57 if (!np) {
58 pr_err("failed to find hisilicon,sysctrl node\n");
59 return;
60 }
61 ctrl_base = of_iomap(np, 0);
62 if (!ctrl_base) {
63 pr_err("failed to map address\n");
64 return;
65 }
66 if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
67 pr_err("failed to find smp-offset property\n");
68 return;
69 }
70 ctrl_base += offset;
71 }
72}
73
74static int hi3xxx_boot_secondary(unsigned int cpu, struct task_struct *idle)
75{
76 hi3xxx_set_cpu(cpu, true);
77 hi3xxx_set_cpu_jump(cpu, secondary_startup);
78 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
79 return 0;
80}
81
82struct smp_operations hi3xxx_smp_ops __initdata = {
83 .smp_prepare_cpus = hi3xxx_smp_prepare_cpus,
84 .smp_boot_secondary = hi3xxx_boot_secondary,
85#ifdef CONFIG_HOTPLUG_CPU
86 .cpu_die = hi3xxx_cpu_die,
87 .cpu_kill = hi3xxx_cpu_kill,
88#endif
89};
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 7a6e6f710068..33567aa5880f 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -3,7 +3,6 @@ config ARCH_MXC
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
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
7 select CLKSRC_MMIO 6 select CLKSRC_MMIO
8 select COMMON_CLK 7 select COMMON_CLK
9 select GENERIC_ALLOCATOR 8 select GENERIC_ALLOCATOR
@@ -11,6 +10,7 @@ config ARCH_MXC
11 select GENERIC_IRQ_CHIP 10 select GENERIC_IRQ_CHIP
12 select MIGHT_HAVE_CACHE_L2X0 if ARCH_MULTI_V6_V7 11 select MIGHT_HAVE_CACHE_L2X0 if ARCH_MULTI_V6_V7
13 select MULTI_IRQ_HANDLER 12 select MULTI_IRQ_HANDLER
13 select PINCTRL
14 select SOC_BUS 14 select SOC_BUS
15 select SPARSE_IRQ 15 select SPARSE_IRQ
16 select USE_OF 16 select USE_OF
@@ -20,16 +20,6 @@ config ARCH_MXC
20menu "Freescale i.MX support" 20menu "Freescale i.MX support"
21 depends on ARCH_MXC 21 depends on ARCH_MXC
22 22
23config MXC_IRQ_PRIOR
24 bool "Use IRQ priority"
25 help
26 Select this if you want to use prioritized IRQ handling.
27 This feature prevents higher priority ISR to be interrupted
28 by lower priority IRQ.
29 This may be useful in embedded applications, where are strong
30 requirements for timing.
31 Say N here, unless you have a specialized requirement.
32
33config MXC_TZIC 23config MXC_TZIC
34 bool 24 bool
35 25
@@ -109,6 +99,7 @@ config SOC_IMX25
109 select ARCH_MXC_IOMUX_V3 99 select ARCH_MXC_IOMUX_V3
110 select CPU_ARM926T 100 select CPU_ARM926T
111 select MXC_AVIC 101 select MXC_AVIC
102 select PINCTRL_IMX25
112 103
113config SOC_IMX27 104config SOC_IMX27
114 bool 105 bool
@@ -118,6 +109,7 @@ config SOC_IMX27
118 select IMX_HAVE_IOMUX_V1 109 select IMX_HAVE_IOMUX_V1
119 select MACH_MX27 110 select MACH_MX27
120 select MXC_AVIC 111 select MXC_AVIC
112 select PINCTRL_IMX27
121 113
122config SOC_IMX31 114config SOC_IMX31
123 bool 115 bool
@@ -133,6 +125,7 @@ config SOC_IMX35
133 select HAVE_EPIT 125 select HAVE_EPIT
134 select MXC_AVIC 126 select MXC_AVIC
135 select SMP_ON_UP if SMP 127 select SMP_ON_UP if SMP
128 select PINCTRL
136 129
137config SOC_IMX5 130config SOC_IMX5
138 bool 131 bool
@@ -145,7 +138,6 @@ config SOC_IMX5
145config SOC_IMX51 138config SOC_IMX51
146 bool 139 bool
147 select HAVE_IMX_SRC 140 select HAVE_IMX_SRC
148 select PINCTRL
149 select PINCTRL_IMX51 141 select PINCTRL_IMX51
150 select SOC_IMX5 142 select SOC_IMX5
151 143
@@ -619,6 +611,13 @@ config MACH_IMX31_DT
619 611
620comment "MX35 platforms:" 612comment "MX35 platforms:"
621 613
614config MACH_IMX35_DT
615 bool "Support i.MX35 platforms from device tree"
616 select SOC_IMX35
617 help
618 Include support for Freescale i.MX35 based platforms
619 using the device tree for discovery.
620
622config MACH_PCM043 621config MACH_PCM043
623 bool "Support Phytec pcm043 (i.MX35) platforms" 622 bool "Support Phytec pcm043 (i.MX35) platforms"
624 select IMX_HAVE_PLATFORM_FLEXCAN 623 select IMX_HAVE_PLATFORM_FLEXCAN
@@ -766,11 +765,19 @@ endchoice
766 765
767comment "Device tree only" 766comment "Device tree only"
768 767
768config SOC_IMX50
769 bool "i.MX50 support"
770 select HAVE_IMX_SRC
771 select PINCTRL_IMX50
772 select SOC_IMX5
773
774 help
775 This enables support for Freescale i.MX50 processor.
776
769config SOC_IMX53 777config SOC_IMX53
770 bool "i.MX53 support" 778 bool "i.MX53 support"
771 select HAVE_IMX_SRC 779 select HAVE_IMX_SRC
772 select IMX_HAVE_PLATFORM_IMX2_WDT 780 select IMX_HAVE_PLATFORM_IMX2_WDT
773 select PINCTRL
774 select PINCTRL_IMX53 781 select PINCTRL_IMX53
775 select SOC_IMX5 782 select SOC_IMX5
776 783
@@ -796,7 +803,6 @@ config SOC_IMX6Q
796 select MFD_SYSCON 803 select MFD_SYSCON
797 select MIGHT_HAVE_PCI 804 select MIGHT_HAVE_PCI
798 select PCI_DOMAINS if PCI 805 select PCI_DOMAINS if PCI
799 select PINCTRL
800 select PINCTRL_IMX6Q 806 select PINCTRL_IMX6Q
801 select PL310_ERRATA_588369 if CACHE_PL310 807 select PL310_ERRATA_588369 if CACHE_PL310
802 select PL310_ERRATA_727915 if CACHE_PL310 808 select PL310_ERRATA_727915 if CACHE_PL310
@@ -817,7 +823,6 @@ config SOC_IMX6SL
817 select HAVE_IMX_MMDC 823 select HAVE_IMX_MMDC
818 select HAVE_IMX_SRC 824 select HAVE_IMX_SRC
819 select MFD_SYSCON 825 select MFD_SYSCON
820 select PINCTRL
821 select PINCTRL_IMX6SL 826 select PINCTRL_IMX6SL
822 select PL310_ERRATA_588369 if CACHE_PL310 827 select PL310_ERRATA_588369 if CACHE_PL310
823 select PL310_ERRATA_727915 if CACHE_PL310 828 select PL310_ERRATA_727915 if CACHE_PL310
@@ -831,7 +836,6 @@ config SOC_VF610
831 select CPU_V7 836 select CPU_V7
832 select ARM_GIC 837 select ARM_GIC
833 select CLKSRC_OF 838 select CLKSRC_OF
834 select PINCTRL
835 select PINCTRL_VF610 839 select PINCTRL_VF610
836 select VF_PIT_TIMER 840 select VF_PIT_TIMER
837 select PL310_ERRATA_588369 if CACHE_PL310 841 select PL310_ERRATA_588369 if CACHE_PL310
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 1789e2b31903..befcaf5d0574 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -89,6 +89,7 @@ obj-$(CONFIG_MACH_MX35_3DS) += mach-mx35_3ds.o
89obj-$(CONFIG_MACH_EUKREA_CPUIMX35SD) += mach-cpuimx35.o 89obj-$(CONFIG_MACH_EUKREA_CPUIMX35SD) += mach-cpuimx35.o
90obj-$(CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD) += eukrea_mbimxsd35-baseboard.o 90obj-$(CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD) += eukrea_mbimxsd35-baseboard.o
91obj-$(CONFIG_MACH_VPR200) += mach-vpr200.o 91obj-$(CONFIG_MACH_VPR200) += mach-vpr200.o
92obj-$(CONFIG_MACH_IMX35_DT) += imx35-dt.o
92 93
93obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o 94obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
94obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o 95obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
@@ -112,6 +113,7 @@ obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
112obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o 113obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
113 114
114obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o 115obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
116obj-$(CONFIG_SOC_IMX50) += mach-imx50.o
115obj-$(CONFIG_SOC_IMX53) += mach-imx53.o 117obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
116 118
117obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o 119obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o
diff --git a/arch/arm/mach-imx/avic.c b/arch/arm/mach-imx/avic.c
index e163ec7a8441..8d1df2e4b7ac 100644
--- a/arch/arm/mach-imx/avic.c
+++ b/arch/arm/mach-imx/avic.c
@@ -54,28 +54,6 @@
54static void __iomem *avic_base; 54static void __iomem *avic_base;
55static struct irq_domain *domain; 55static struct irq_domain *domain;
56 56
57#ifdef CONFIG_MXC_IRQ_PRIOR
58static int avic_irq_set_priority(unsigned char irq, unsigned char prio)
59{
60 struct irq_data *d = irq_get_irq_data(irq);
61 unsigned int temp;
62 unsigned int mask = 0x0F << irq % 8 * 4;
63
64 irq = d->hwirq;
65
66 if (irq >= AVIC_NUM_IRQS)
67 return -EINVAL;
68
69 temp = __raw_readl(avic_base + AVIC_NIPRIORITY(irq / 8));
70 temp &= ~mask;
71 temp |= prio & mask;
72
73 __raw_writel(temp, avic_base + AVIC_NIPRIORITY(irq / 8));
74
75 return 0;
76}
77#endif
78
79#ifdef CONFIG_FIQ 57#ifdef CONFIG_FIQ
80static int avic_set_irq_fiq(unsigned int irq, unsigned int type) 58static int avic_set_irq_fiq(unsigned int irq, unsigned int type)
81{ 59{
@@ -102,9 +80,6 @@ static int avic_set_irq_fiq(unsigned int irq, unsigned int type)
102 80
103 81
104static struct mxc_extra_irq avic_extra_irq = { 82static struct mxc_extra_irq avic_extra_irq = {
105#ifdef CONFIG_MXC_IRQ_PRIOR
106 .set_priority = avic_irq_set_priority,
107#endif
108#ifdef CONFIG_FIQ 83#ifdef CONFIG_FIQ
109 .set_irq_fiq = avic_set_irq_fiq, 84 .set_irq_fiq = avic_set_irq_fiq,
110#endif 85#endif
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index a63e415609a8..a2ecc006b322 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -72,7 +72,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
72 72
73 reg = readl(gate->reg); 73 reg = readl(gate->reg);
74 74
75 if (((reg >> gate->bit_idx) & 3) == 3) 75 if (((reg >> gate->bit_idx) & 1) == 1)
76 return 1; 76 return 1;
77 77
78 return 0; 78 return 0;
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 2193c834f55c..a4d5e425cd82 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -45,6 +45,8 @@ static struct arm_ahb_div clk_consumer[] = {
45static char hsp_div_532[] = { 4, 8, 3, 0 }; 45static char hsp_div_532[] = { 4, 8, 3, 0 };
46static char hsp_div_400[] = { 3, 6, 3, 0 }; 46static char hsp_div_400[] = { 3, 6, 3, 0 };
47 47
48static struct clk_onecell_data clk_data;
49
48static const char *std_sel[] = {"ppll", "arm"}; 50static const char *std_sel[] = {"ppll", "arm"};
49static const char *ipg_per_sel[] = {"ahb_per_div", "arm_per_div"}; 51static const char *ipg_per_sel[] = {"ahb_per_div", "arm_per_div"};
50 52
@@ -286,3 +288,15 @@ int __init mx35_clocks_init(void)
286 288
287 return 0; 289 return 0;
288} 290}
291
292static int __init mx35_clocks_init_dt(struct device_node *ccm_node)
293{
294 clk_data.clks = clk;
295 clk_data.clk_num = ARRAY_SIZE(clk);
296 of_clk_add_provider(ccm_node, of_clk_src_onecell_get, &clk_data);
297
298 mx35_clocks_init();
299
300 return 0;
301}
302CLK_OF_DECLARE(imx35, "fsl,imx35-ccm", mx35_clocks_init_dt);
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index ce37af26ff8c..19fca1fdc6fe 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -12,11 +12,11 @@
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/clk-provider.h>
15#include <linux/of.h>
16#include <linux/err.h> 15#include <linux/err.h>
17#include <linux/of.h> 16#include <linux/of.h>
18#include <linux/of_address.h> 17#include <linux/of_address.h>
19#include <linux/of_irq.h> 18#include <linux/of_irq.h>
19#include <dt-bindings/clock/imx5-clock.h>
20 20
21#include "crm-regs-imx5.h" 21#include "crm-regs-imx5.h"
22#include "clk.h" 22#include "clk.h"
@@ -83,50 +83,7 @@ static const char *spdif_sel[] = { "pll1_sw", "pll2_sw", "pll3_sw", "spdif_xtal_
83static const char *spdif0_com_sel[] = { "spdif0_podf", "ssi1_root_gate", }; 83static const char *spdif0_com_sel[] = { "spdif0_podf", "ssi1_root_gate", };
84static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", }; 84static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", };
85 85
86 86static struct clk *clk[IMX5_CLK_END];
87enum imx5_clks {
88 dummy, ckil, osc, ckih1, ckih2, ahb, ipg, axi_a, axi_b, uart_pred,
89 uart_root, esdhc_a_pred, esdhc_b_pred, esdhc_c_s, esdhc_d_s,
90 emi_sel, emi_slow_podf, nfc_podf, ecspi_pred, ecspi_podf, usboh3_pred,
91 usboh3_podf, usb_phy_pred, usb_phy_podf, cpu_podf, di_pred, tve_di_unused,
92 tve_s, uart1_ipg_gate, uart1_per_gate, uart2_ipg_gate,
93 uart2_per_gate, uart3_ipg_gate, uart3_per_gate, i2c1_gate, i2c2_gate,
94 gpt_ipg_gate, pwm1_ipg_gate, pwm1_hf_gate, pwm2_ipg_gate, pwm2_hf_gate,
95 gpt_hf_gate, fec_gate, usboh3_per_gate, esdhc1_ipg_gate, esdhc2_ipg_gate,
96 esdhc3_ipg_gate, esdhc4_ipg_gate, ssi1_ipg_gate, ssi2_ipg_gate,
97 ssi3_ipg_gate, ecspi1_ipg_gate, ecspi1_per_gate, ecspi2_ipg_gate,
98 ecspi2_per_gate, cspi_ipg_gate, sdma_gate, emi_slow_gate, ipu_s,
99 ipu_gate, nfc_gate, ipu_di1_gate, vpu_s, vpu_gate,
100 vpu_reference_gate, uart4_ipg_gate, uart4_per_gate, uart5_ipg_gate,
101 uart5_per_gate, tve_gate, tve_pred, esdhc1_per_gate, esdhc2_per_gate,
102 esdhc3_per_gate, esdhc4_per_gate, usb_phy_gate, hsi2c_gate,
103 mipi_hsc1_gate, mipi_hsc2_gate, mipi_esc_gate, mipi_hsp_gate,
104 ldb_di1_div_3_5, ldb_di1_div, ldb_di0_div_3_5, ldb_di0_div,
105 ldb_di1_gate, can2_serial_gate, can2_ipg_gate, i2c3_gate, lp_apm,
106 periph_apm, main_bus, ahb_max, aips_tz1, aips_tz2, tmax1, tmax2,
107 tmax3, spba, uart_sel, esdhc_a_sel, esdhc_b_sel, esdhc_a_podf,
108 esdhc_b_podf, ecspi_sel, usboh3_sel, usb_phy_sel, iim_gate,
109 usboh3_gate, emi_fast_gate, ipu_di0_gate,gpc_dvfs, pll1_sw, pll2_sw,
110 pll3_sw, ipu_di0_sel, ipu_di1_sel, tve_ext_sel, mx51_mipi, pll4_sw,
111 ldb_di1_sel, di_pll4_podf, ldb_di0_sel, ldb_di0_gate, usb_phy1_gate,
112 usb_phy2_gate, per_lp_apm, per_pred1, per_pred2, per_podf, per_root,
113 ssi_apm, ssi1_root_sel, ssi2_root_sel, ssi3_root_sel, ssi_ext1_sel,
114 ssi_ext2_sel, ssi_ext1_com_sel, ssi_ext2_com_sel, ssi1_root_pred,
115 ssi1_root_podf, ssi2_root_pred, ssi2_root_podf, ssi_ext1_pred,
116 ssi_ext1_podf, ssi_ext2_pred, ssi_ext2_podf, ssi1_root_gate,
117 ssi2_root_gate, ssi3_root_gate, ssi_ext1_gate, ssi_ext2_gate,
118 epit1_ipg_gate, epit1_hf_gate, epit2_ipg_gate, epit2_hf_gate,
119 can_sel, can1_serial_gate, can1_ipg_gate,
120 owire_gate, gpu3d_s, gpu2d_s, gpu3d_gate, gpu2d_gate, garb_gate,
121 cko1_sel, cko1_podf, cko1,
122 cko2_sel, cko2_podf, cko2,
123 srtc_gate, pata_gate, sata_gate, spdif_xtal_sel, spdif0_sel,
124 spdif1_sel, spdif0_pred, spdif0_podf, spdif1_pred, spdif1_podf,
125 spdif0_com_s, spdif1_com_sel, spdif0_gate, spdif1_gate, spdif_ipg_gate,
126 ocram, clk_max
127};
128
129static struct clk *clk[clk_max];
130static struct clk_onecell_data clk_data; 87static struct clk_onecell_data clk_data;
131 88
132static void __init mx5_clocks_common_init(unsigned long rate_ckil, 89static void __init mx5_clocks_common_init(unsigned long rate_ckil,
@@ -135,236 +92,296 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
135{ 92{
136 int i; 93 int i;
137 94
138 clk[dummy] = imx_clk_fixed("dummy", 0); 95 clk[IMX5_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
139 clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil); 96 clk[IMX5_CLK_CKIL] = imx_obtain_fixed_clock("ckil", rate_ckil);
140 clk[osc] = imx_obtain_fixed_clock("osc", rate_osc); 97 clk[IMX5_CLK_OSC] = imx_obtain_fixed_clock("osc", rate_osc);
141 clk[ckih1] = imx_obtain_fixed_clock("ckih1", rate_ckih1); 98 clk[IMX5_CLK_CKIH1] = imx_obtain_fixed_clock("ckih1", rate_ckih1);
142 clk[ckih2] = imx_obtain_fixed_clock("ckih2", rate_ckih2); 99 clk[IMX5_CLK_CKIH2] = imx_obtain_fixed_clock("ckih2", rate_ckih2);
143 100
144 clk[lp_apm] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1, 101 clk[IMX5_CLK_PERIPH_APM] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2,
145 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 102 periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
146 clk[periph_apm] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2, 103 clk[IMX5_CLK_MAIN_BUS] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
147 periph_apm_sel, ARRAY_SIZE(periph_apm_sel)); 104 main_bus_sel, ARRAY_SIZE(main_bus_sel));
148 clk[main_bus] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1, 105 clk[IMX5_CLK_PER_LP_APM] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCMR, 1, 1,
149 main_bus_sel, ARRAY_SIZE(main_bus_sel)); 106 per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel));
150 clk[per_lp_apm] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCMR, 1, 1, 107 clk[IMX5_CLK_PER_PRED1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2);
151 per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel)); 108 clk[IMX5_CLK_PER_PRED2] = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3);
152 clk[per_pred1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2); 109 clk[IMX5_CLK_PER_PODF] = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3);
153 clk[per_pred2] = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3); 110 clk[IMX5_CLK_PER_ROOT] = imx_clk_mux("per_root", MXC_CCM_CBCMR, 0, 1,
154 clk[per_podf] = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3); 111 per_root_sel, ARRAY_SIZE(per_root_sel));
155 clk[per_root] = imx_clk_mux("per_root", MXC_CCM_CBCMR, 0, 1, 112 clk[IMX5_CLK_AHB] = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3);
156 per_root_sel, ARRAY_SIZE(per_root_sel)); 113 clk[IMX5_CLK_AHB_MAX] = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28);
157 clk[ahb] = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3); 114 clk[IMX5_CLK_AIPS_TZ1] = imx_clk_gate2("aips_tz1", "ahb", MXC_CCM_CCGR0, 24);
158 clk[ahb_max] = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28); 115 clk[IMX5_CLK_AIPS_TZ2] = imx_clk_gate2("aips_tz2", "ahb", MXC_CCM_CCGR0, 26);
159 clk[aips_tz1] = imx_clk_gate2("aips_tz1", "ahb", MXC_CCM_CCGR0, 24); 116 clk[IMX5_CLK_TMAX1] = imx_clk_gate2("tmax1", "ahb", MXC_CCM_CCGR1, 0);
160 clk[aips_tz2] = imx_clk_gate2("aips_tz2", "ahb", MXC_CCM_CCGR0, 26); 117 clk[IMX5_CLK_TMAX2] = imx_clk_gate2("tmax2", "ahb", MXC_CCM_CCGR1, 2);
161 clk[tmax1] = imx_clk_gate2("tmax1", "ahb", MXC_CCM_CCGR1, 0); 118 clk[IMX5_CLK_TMAX3] = imx_clk_gate2("tmax3", "ahb", MXC_CCM_CCGR1, 4);
162 clk[tmax2] = imx_clk_gate2("tmax2", "ahb", MXC_CCM_CCGR1, 2); 119 clk[IMX5_CLK_SPBA] = imx_clk_gate2("spba", "ipg", MXC_CCM_CCGR5, 0);
163 clk[tmax3] = imx_clk_gate2("tmax3", "ahb", MXC_CCM_CCGR1, 4); 120 clk[IMX5_CLK_IPG] = imx_clk_divider("ipg", "ahb", MXC_CCM_CBCDR, 8, 2);
164 clk[spba] = imx_clk_gate2("spba", "ipg", MXC_CCM_CCGR5, 0); 121 clk[IMX5_CLK_AXI_A] = imx_clk_divider("axi_a", "main_bus", MXC_CCM_CBCDR, 16, 3);
165 clk[ipg] = imx_clk_divider("ipg", "ahb", MXC_CCM_CBCDR, 8, 2); 122 clk[IMX5_CLK_AXI_B] = imx_clk_divider("axi_b", "main_bus", MXC_CCM_CBCDR, 19, 3);
166 clk[axi_a] = imx_clk_divider("axi_a", "main_bus", MXC_CCM_CBCDR, 16, 3); 123 clk[IMX5_CLK_UART_SEL] = imx_clk_mux("uart_sel", MXC_CCM_CSCMR1, 24, 2,
167 clk[axi_b] = imx_clk_divider("axi_b", "main_bus", MXC_CCM_CBCDR, 19, 3); 124 standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
168 clk[uart_sel] = imx_clk_mux("uart_sel", MXC_CCM_CSCMR1, 24, 2, 125 clk[IMX5_CLK_UART_PRED] = imx_clk_divider("uart_pred", "uart_sel", MXC_CCM_CSCDR1, 3, 3);
169 standard_pll_sel, ARRAY_SIZE(standard_pll_sel)); 126 clk[IMX5_CLK_UART_ROOT] = imx_clk_divider("uart_root", "uart_pred", MXC_CCM_CSCDR1, 0, 3);
170 clk[uart_pred] = imx_clk_divider("uart_pred", "uart_sel", MXC_CCM_CSCDR1, 3, 3); 127
171 clk[uart_root] = imx_clk_divider("uart_root", "uart_pred", MXC_CCM_CSCDR1, 0, 3); 128 clk[IMX5_CLK_ESDHC_A_SEL] = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 20, 2,
172 129 standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
173 clk[esdhc_a_sel] = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 20, 2, 130 clk[IMX5_CLK_ESDHC_B_SEL] = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2,
174 standard_pll_sel, ARRAY_SIZE(standard_pll_sel)); 131 standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
175 clk[esdhc_b_sel] = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2, 132 clk[IMX5_CLK_ESDHC_A_PRED] = imx_clk_divider("esdhc_a_pred", "esdhc_a_sel", MXC_CCM_CSCDR1, 16, 3);
176 standard_pll_sel, ARRAY_SIZE(standard_pll_sel)); 133 clk[IMX5_CLK_ESDHC_A_PODF] = imx_clk_divider("esdhc_a_podf", "esdhc_a_pred", MXC_CCM_CSCDR1, 11, 3);
177 clk[esdhc_a_pred] = imx_clk_divider("esdhc_a_pred", "esdhc_a_sel", MXC_CCM_CSCDR1, 16, 3); 134 clk[IMX5_CLK_ESDHC_B_PRED] = imx_clk_divider("esdhc_b_pred", "esdhc_b_sel", MXC_CCM_CSCDR1, 22, 3);
178 clk[esdhc_a_podf] = imx_clk_divider("esdhc_a_podf", "esdhc_a_pred", MXC_CCM_CSCDR1, 11, 3); 135 clk[IMX5_CLK_ESDHC_B_PODF] = imx_clk_divider("esdhc_b_podf", "esdhc_b_pred", MXC_CCM_CSCDR1, 19, 3);
179 clk[esdhc_b_pred] = imx_clk_divider("esdhc_b_pred", "esdhc_b_sel", MXC_CCM_CSCDR1, 22, 3); 136 clk[IMX5_CLK_ESDHC_C_SEL] = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel));
180 clk[esdhc_b_podf] = imx_clk_divider("esdhc_b_podf", "esdhc_b_pred", MXC_CCM_CSCDR1, 19, 3); 137 clk[IMX5_CLK_ESDHC_D_SEL] = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 18, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel));
181 clk[esdhc_c_s] = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel)); 138
182 clk[esdhc_d_s] = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 18, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel)); 139 clk[IMX5_CLK_EMI_SEL] = imx_clk_mux("emi_sel", MXC_CCM_CBCDR, 26, 1,
183 140 emi_slow_sel, ARRAY_SIZE(emi_slow_sel));
184 clk[emi_sel] = imx_clk_mux("emi_sel", MXC_CCM_CBCDR, 26, 1, 141 clk[IMX5_CLK_EMI_SLOW_PODF] = imx_clk_divider("emi_slow_podf", "emi_sel", MXC_CCM_CBCDR, 22, 3);
185 emi_slow_sel, ARRAY_SIZE(emi_slow_sel)); 142 clk[IMX5_CLK_NFC_PODF] = imx_clk_divider("nfc_podf", "emi_slow_podf", MXC_CCM_CBCDR, 13, 3);
186 clk[emi_slow_podf] = imx_clk_divider("emi_slow_podf", "emi_sel", MXC_CCM_CBCDR, 22, 3); 143 clk[IMX5_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", MXC_CCM_CSCMR1, 4, 2,
187 clk[nfc_podf] = imx_clk_divider("nfc_podf", "emi_slow_podf", MXC_CCM_CBCDR, 13, 3); 144 standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
188 clk[ecspi_sel] = imx_clk_mux("ecspi_sel", MXC_CCM_CSCMR1, 4, 2, 145 clk[IMX5_CLK_ECSPI_PRED] = imx_clk_divider("ecspi_pred", "ecspi_sel", MXC_CCM_CSCDR2, 25, 3);
189 standard_pll_sel, ARRAY_SIZE(standard_pll_sel)); 146 clk[IMX5_CLK_ECSPI_PODF] = imx_clk_divider("ecspi_podf", "ecspi_pred", MXC_CCM_CSCDR2, 19, 6);
190 clk[ecspi_pred] = imx_clk_divider("ecspi_pred", "ecspi_sel", MXC_CCM_CSCDR2, 25, 3); 147 clk[IMX5_CLK_USBOH3_SEL] = imx_clk_mux("usboh3_sel", MXC_CCM_CSCMR1, 22, 2,
191 clk[ecspi_podf] = imx_clk_divider("ecspi_podf", "ecspi_pred", MXC_CCM_CSCDR2, 19, 6); 148 standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
192 clk[usboh3_sel] = imx_clk_mux("usboh3_sel", MXC_CCM_CSCMR1, 22, 2, 149 clk[IMX5_CLK_USBOH3_PRED] = imx_clk_divider("usboh3_pred", "usboh3_sel", MXC_CCM_CSCDR1, 8, 3);
193 standard_pll_sel, ARRAY_SIZE(standard_pll_sel)); 150 clk[IMX5_CLK_USBOH3_PODF] = imx_clk_divider("usboh3_podf", "usboh3_pred", MXC_CCM_CSCDR1, 6, 2);
194 clk[usboh3_pred] = imx_clk_divider("usboh3_pred", "usboh3_sel", MXC_CCM_CSCDR1, 8, 3); 151 clk[IMX5_CLK_USB_PHY_PRED] = imx_clk_divider("usb_phy_pred", "pll3_sw", MXC_CCM_CDCDR, 3, 3);
195 clk[usboh3_podf] = imx_clk_divider("usboh3_podf", "usboh3_pred", MXC_CCM_CSCDR1, 6, 2); 152 clk[IMX5_CLK_USB_PHY_PODF] = imx_clk_divider("usb_phy_podf", "usb_phy_pred", MXC_CCM_CDCDR, 0, 3);
196 clk[usb_phy_pred] = imx_clk_divider("usb_phy_pred", "pll3_sw", MXC_CCM_CDCDR, 3, 3); 153 clk[IMX5_CLK_USB_PHY_SEL] = imx_clk_mux("usb_phy_sel", MXC_CCM_CSCMR1, 26, 1,
197 clk[usb_phy_podf] = imx_clk_divider("usb_phy_podf", "usb_phy_pred", MXC_CCM_CDCDR, 0, 3); 154 usb_phy_sel_str, ARRAY_SIZE(usb_phy_sel_str));
198 clk[usb_phy_sel] = imx_clk_mux("usb_phy_sel", MXC_CCM_CSCMR1, 26, 1, 155 clk[IMX5_CLK_CPU_PODF] = imx_clk_divider("cpu_podf", "pll1_sw", MXC_CCM_CACRR, 0, 3);
199 usb_phy_sel_str, ARRAY_SIZE(usb_phy_sel_str)); 156 clk[IMX5_CLK_DI_PRED] = imx_clk_divider("di_pred", "pll3_sw", MXC_CCM_CDCDR, 6, 3);
200 clk[cpu_podf] = imx_clk_divider("cpu_podf", "pll1_sw", MXC_CCM_CACRR, 0, 3); 157 clk[IMX5_CLK_IIM_GATE] = imx_clk_gate2("iim_gate", "ipg", MXC_CCM_CCGR0, 30);
201 clk[di_pred] = imx_clk_divider("di_pred", "pll3_sw", MXC_CCM_CDCDR, 6, 3); 158 clk[IMX5_CLK_UART1_IPG_GATE] = imx_clk_gate2("uart1_ipg_gate", "ipg", MXC_CCM_CCGR1, 6);
202 clk[iim_gate] = imx_clk_gate2("iim_gate", "ipg", MXC_CCM_CCGR0, 30); 159 clk[IMX5_CLK_UART1_PER_GATE] = imx_clk_gate2("uart1_per_gate", "uart_root", MXC_CCM_CCGR1, 8);
203 clk[uart1_ipg_gate] = imx_clk_gate2("uart1_ipg_gate", "ipg", MXC_CCM_CCGR1, 6); 160 clk[IMX5_CLK_UART2_IPG_GATE] = imx_clk_gate2("uart2_ipg_gate", "ipg", MXC_CCM_CCGR1, 10);
204 clk[uart1_per_gate] = imx_clk_gate2("uart1_per_gate", "uart_root", MXC_CCM_CCGR1, 8); 161 clk[IMX5_CLK_UART2_PER_GATE] = imx_clk_gate2("uart2_per_gate", "uart_root", MXC_CCM_CCGR1, 12);
205 clk[uart2_ipg_gate] = imx_clk_gate2("uart2_ipg_gate", "ipg", MXC_CCM_CCGR1, 10); 162 clk[IMX5_CLK_UART3_IPG_GATE] = imx_clk_gate2("uart3_ipg_gate", "ipg", MXC_CCM_CCGR1, 14);
206 clk[uart2_per_gate] = imx_clk_gate2("uart2_per_gate", "uart_root", MXC_CCM_CCGR1, 12); 163 clk[IMX5_CLK_UART3_PER_GATE] = imx_clk_gate2("uart3_per_gate", "uart_root", MXC_CCM_CCGR1, 16);
207 clk[uart3_ipg_gate] = imx_clk_gate2("uart3_ipg_gate", "ipg", MXC_CCM_CCGR1, 14); 164 clk[IMX5_CLK_I2C1_GATE] = imx_clk_gate2("i2c1_gate", "per_root", MXC_CCM_CCGR1, 18);
208 clk[uart3_per_gate] = imx_clk_gate2("uart3_per_gate", "uart_root", MXC_CCM_CCGR1, 16); 165 clk[IMX5_CLK_I2C2_GATE] = imx_clk_gate2("i2c2_gate", "per_root", MXC_CCM_CCGR1, 20);
209 clk[i2c1_gate] = imx_clk_gate2("i2c1_gate", "per_root", MXC_CCM_CCGR1, 18); 166 clk[IMX5_CLK_PWM1_IPG_GATE] = imx_clk_gate2("pwm1_ipg_gate", "ipg", MXC_CCM_CCGR2, 10);
210 clk[i2c2_gate] = imx_clk_gate2("i2c2_gate", "per_root", MXC_CCM_CCGR1, 20); 167 clk[IMX5_CLK_PWM1_HF_GATE] = imx_clk_gate2("pwm1_hf_gate", "per_root", MXC_CCM_CCGR2, 12);
211 clk[pwm1_ipg_gate] = imx_clk_gate2("pwm1_ipg_gate", "ipg", MXC_CCM_CCGR2, 10); 168 clk[IMX5_CLK_PWM2_IPG_GATE] = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14);
212 clk[pwm1_hf_gate] = imx_clk_gate2("pwm1_hf_gate", "per_root", MXC_CCM_CCGR2, 12); 169 clk[IMX5_CLK_PWM2_HF_GATE] = imx_clk_gate2("pwm2_hf_gate", "per_root", MXC_CCM_CCGR2, 16);
213 clk[pwm2_ipg_gate] = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14); 170 clk[IMX5_CLK_GPT_IPG_GATE] = imx_clk_gate2("gpt_ipg_gate", "ipg", MXC_CCM_CCGR2, 18);
214 clk[pwm2_hf_gate] = imx_clk_gate2("pwm2_hf_gate", "per_root", MXC_CCM_CCGR2, 16); 171 clk[IMX5_CLK_GPT_HF_GATE] = imx_clk_gate2("gpt_hf_gate", "per_root", MXC_CCM_CCGR2, 20);
215 clk[gpt_ipg_gate] = imx_clk_gate2("gpt_ipg_gate", "ipg", MXC_CCM_CCGR2, 18); 172 clk[IMX5_CLK_FEC_GATE] = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24);
216 clk[gpt_hf_gate] = imx_clk_gate2("gpt_hf_gate", "per_root", MXC_CCM_CCGR2, 20); 173 clk[IMX5_CLK_USBOH3_GATE] = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26);
217 clk[fec_gate] = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24); 174 clk[IMX5_CLK_USBOH3_PER_GATE] = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28);
218 clk[usboh3_gate] = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26); 175 clk[IMX5_CLK_ESDHC1_IPG_GATE] = imx_clk_gate2("esdhc1_ipg_gate", "ipg", MXC_CCM_CCGR3, 0);
219 clk[usboh3_per_gate] = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28); 176 clk[IMX5_CLK_ESDHC2_IPG_GATE] = imx_clk_gate2("esdhc2_ipg_gate", "ipg", MXC_CCM_CCGR3, 4);
220 clk[esdhc1_ipg_gate] = imx_clk_gate2("esdhc1_ipg_gate", "ipg", MXC_CCM_CCGR3, 0); 177 clk[IMX5_CLK_ESDHC3_IPG_GATE] = imx_clk_gate2("esdhc3_ipg_gate", "ipg", MXC_CCM_CCGR3, 8);
221 clk[esdhc2_ipg_gate] = imx_clk_gate2("esdhc2_ipg_gate", "ipg", MXC_CCM_CCGR3, 4); 178 clk[IMX5_CLK_ESDHC4_IPG_GATE] = imx_clk_gate2("esdhc4_ipg_gate", "ipg", MXC_CCM_CCGR3, 12);
222 clk[esdhc3_ipg_gate] = imx_clk_gate2("esdhc3_ipg_gate", "ipg", MXC_CCM_CCGR3, 8); 179 clk[IMX5_CLK_SSI1_IPG_GATE] = imx_clk_gate2("ssi1_ipg_gate", "ipg", MXC_CCM_CCGR3, 16);
223 clk[esdhc4_ipg_gate] = imx_clk_gate2("esdhc4_ipg_gate", "ipg", MXC_CCM_CCGR3, 12); 180 clk[IMX5_CLK_SSI2_IPG_GATE] = imx_clk_gate2("ssi2_ipg_gate", "ipg", MXC_CCM_CCGR3, 20);
224 clk[ssi1_ipg_gate] = imx_clk_gate2("ssi1_ipg_gate", "ipg", MXC_CCM_CCGR3, 16); 181 clk[IMX5_CLK_SSI3_IPG_GATE] = imx_clk_gate2("ssi3_ipg_gate", "ipg", MXC_CCM_CCGR3, 24);
225 clk[ssi2_ipg_gate] = imx_clk_gate2("ssi2_ipg_gate", "ipg", MXC_CCM_CCGR3, 20); 182 clk[IMX5_CLK_ECSPI1_IPG_GATE] = imx_clk_gate2("ecspi1_ipg_gate", "ipg", MXC_CCM_CCGR4, 18);
226 clk[ssi3_ipg_gate] = imx_clk_gate2("ssi3_ipg_gate", "ipg", MXC_CCM_CCGR3, 24); 183 clk[IMX5_CLK_ECSPI1_PER_GATE] = imx_clk_gate2("ecspi1_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 20);
227 clk[ecspi1_ipg_gate] = imx_clk_gate2("ecspi1_ipg_gate", "ipg", MXC_CCM_CCGR4, 18); 184 clk[IMX5_CLK_ECSPI2_IPG_GATE] = imx_clk_gate2("ecspi2_ipg_gate", "ipg", MXC_CCM_CCGR4, 22);
228 clk[ecspi1_per_gate] = imx_clk_gate2("ecspi1_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 20); 185 clk[IMX5_CLK_ECSPI2_PER_GATE] = imx_clk_gate2("ecspi2_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 24);
229 clk[ecspi2_ipg_gate] = imx_clk_gate2("ecspi2_ipg_gate", "ipg", MXC_CCM_CCGR4, 22); 186 clk[IMX5_CLK_CSPI_IPG_GATE] = imx_clk_gate2("cspi_ipg_gate", "ipg", MXC_CCM_CCGR4, 26);
230 clk[ecspi2_per_gate] = imx_clk_gate2("ecspi2_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 24); 187 clk[IMX5_CLK_SDMA_GATE] = imx_clk_gate2("sdma_gate", "ipg", MXC_CCM_CCGR4, 30);
231 clk[cspi_ipg_gate] = imx_clk_gate2("cspi_ipg_gate", "ipg", MXC_CCM_CCGR4, 26); 188 clk[IMX5_CLK_EMI_FAST_GATE] = imx_clk_gate2("emi_fast_gate", "dummy", MXC_CCM_CCGR5, 14);
232 clk[sdma_gate] = imx_clk_gate2("sdma_gate", "ipg", MXC_CCM_CCGR4, 30); 189 clk[IMX5_CLK_EMI_SLOW_GATE] = imx_clk_gate2("emi_slow_gate", "emi_slow_podf", MXC_CCM_CCGR5, 16);
233 clk[emi_fast_gate] = imx_clk_gate2("emi_fast_gate", "dummy", MXC_CCM_CCGR5, 14); 190 clk[IMX5_CLK_IPU_SEL] = imx_clk_mux("ipu_sel", MXC_CCM_CBCMR, 6, 2, ipu_sel, ARRAY_SIZE(ipu_sel));
234 clk[emi_slow_gate] = imx_clk_gate2("emi_slow_gate", "emi_slow_podf", MXC_CCM_CCGR5, 16); 191 clk[IMX5_CLK_IPU_GATE] = imx_clk_gate2("ipu_gate", "ipu_sel", MXC_CCM_CCGR5, 10);
235 clk[ipu_s] = imx_clk_mux("ipu_sel", MXC_CCM_CBCMR, 6, 2, ipu_sel, ARRAY_SIZE(ipu_sel)); 192 clk[IMX5_CLK_NFC_GATE] = imx_clk_gate2("nfc_gate", "nfc_podf", MXC_CCM_CCGR5, 20);
236 clk[ipu_gate] = imx_clk_gate2("ipu_gate", "ipu_sel", MXC_CCM_CCGR5, 10); 193 clk[IMX5_CLK_IPU_DI0_GATE] = imx_clk_gate2("ipu_di0_gate", "ipu_di0_sel", MXC_CCM_CCGR6, 10);
237 clk[nfc_gate] = imx_clk_gate2("nfc_gate", "nfc_podf", MXC_CCM_CCGR5, 20); 194 clk[IMX5_CLK_IPU_DI1_GATE] = imx_clk_gate2("ipu_di1_gate", "ipu_di1_sel", MXC_CCM_CCGR6, 12);
238 clk[ipu_di0_gate] = imx_clk_gate2("ipu_di0_gate", "ipu_di0_sel", MXC_CCM_CCGR6, 10); 195 clk[IMX5_CLK_GPU3D_SEL] = imx_clk_mux("gpu3d_sel", MXC_CCM_CBCMR, 4, 2, gpu3d_sel, ARRAY_SIZE(gpu3d_sel));
239 clk[ipu_di1_gate] = imx_clk_gate2("ipu_di1_gate", "ipu_di1_sel", MXC_CCM_CCGR6, 12); 196 clk[IMX5_CLK_GPU2D_SEL] = imx_clk_mux("gpu2d_sel", MXC_CCM_CBCMR, 16, 2, gpu2d_sel, ARRAY_SIZE(gpu2d_sel));
240 clk[gpu3d_s] = imx_clk_mux("gpu3d_sel", MXC_CCM_CBCMR, 4, 2, gpu3d_sel, ARRAY_SIZE(gpu3d_sel)); 197 clk[IMX5_CLK_GPU3D_GATE] = imx_clk_gate2("gpu3d_gate", "gpu3d_sel", MXC_CCM_CCGR5, 2);
241 clk[gpu2d_s] = imx_clk_mux("gpu2d_sel", MXC_CCM_CBCMR, 16, 2, gpu2d_sel, ARRAY_SIZE(gpu2d_sel)); 198 clk[IMX5_CLK_GARB_GATE] = imx_clk_gate2("garb_gate", "axi_a", MXC_CCM_CCGR5, 4);
242 clk[gpu3d_gate] = imx_clk_gate2("gpu3d_gate", "gpu3d_sel", MXC_CCM_CCGR5, 2); 199 clk[IMX5_CLK_GPU2D_GATE] = imx_clk_gate2("gpu2d_gate", "gpu2d_sel", MXC_CCM_CCGR6, 14);
243 clk[garb_gate] = imx_clk_gate2("garb_gate", "axi_a", MXC_CCM_CCGR5, 4); 200 clk[IMX5_CLK_VPU_SEL] = imx_clk_mux("vpu_sel", MXC_CCM_CBCMR, 14, 2, vpu_sel, ARRAY_SIZE(vpu_sel));
244 clk[gpu2d_gate] = imx_clk_gate2("gpu2d_gate", "gpu2d_sel", MXC_CCM_CCGR6, 14); 201 clk[IMX5_CLK_VPU_GATE] = imx_clk_gate2("vpu_gate", "vpu_sel", MXC_CCM_CCGR5, 6);
245 clk[vpu_s] = imx_clk_mux("vpu_sel", MXC_CCM_CBCMR, 14, 2, vpu_sel, ARRAY_SIZE(vpu_sel)); 202 clk[IMX5_CLK_VPU_REFERENCE_GATE] = imx_clk_gate2("vpu_reference_gate", "osc", MXC_CCM_CCGR5, 8);
246 clk[vpu_gate] = imx_clk_gate2("vpu_gate", "vpu_sel", MXC_CCM_CCGR5, 6); 203 clk[IMX5_CLK_UART4_IPG_GATE] = imx_clk_gate2("uart4_ipg_gate", "ipg", MXC_CCM_CCGR7, 8);
247 clk[vpu_reference_gate] = imx_clk_gate2("vpu_reference_gate", "osc", MXC_CCM_CCGR5, 8); 204 clk[IMX5_CLK_UART4_PER_GATE] = imx_clk_gate2("uart4_per_gate", "uart_root", MXC_CCM_CCGR7, 10);
248 clk[uart4_ipg_gate] = imx_clk_gate2("uart4_ipg_gate", "ipg", MXC_CCM_CCGR7, 8); 205 clk[IMX5_CLK_UART5_IPG_GATE] = imx_clk_gate2("uart5_ipg_gate", "ipg", MXC_CCM_CCGR7, 12);
249 clk[uart4_per_gate] = imx_clk_gate2("uart4_per_gate", "uart_root", MXC_CCM_CCGR7, 10); 206 clk[IMX5_CLK_UART5_PER_GATE] = imx_clk_gate2("uart5_per_gate", "uart_root", MXC_CCM_CCGR7, 14);
250 clk[uart5_ipg_gate] = imx_clk_gate2("uart5_ipg_gate", "ipg", MXC_CCM_CCGR7, 12); 207 clk[IMX5_CLK_GPC_DVFS] = imx_clk_gate2("gpc_dvfs", "dummy", MXC_CCM_CCGR5, 24);
251 clk[uart5_per_gate] = imx_clk_gate2("uart5_per_gate", "uart_root", MXC_CCM_CCGR7, 14); 208
252 clk[gpc_dvfs] = imx_clk_gate2("gpc_dvfs", "dummy", MXC_CCM_CCGR5, 24); 209 clk[IMX5_CLK_SSI_APM] = imx_clk_mux("ssi_apm", MXC_CCM_CSCMR1, 8, 2, ssi_apm_sels, ARRAY_SIZE(ssi_apm_sels));
253 210 clk[IMX5_CLK_SSI1_ROOT_SEL] = imx_clk_mux("ssi1_root_sel", MXC_CCM_CSCMR1, 14, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
254 clk[ssi_apm] = imx_clk_mux("ssi_apm", MXC_CCM_CSCMR1, 8, 2, ssi_apm_sels, ARRAY_SIZE(ssi_apm_sels)); 211 clk[IMX5_CLK_SSI2_ROOT_SEL] = imx_clk_mux("ssi2_root_sel", MXC_CCM_CSCMR1, 12, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
255 clk[ssi1_root_sel] = imx_clk_mux("ssi1_root_sel", MXC_CCM_CSCMR1, 14, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels)); 212 clk[IMX5_CLK_SSI3_ROOT_SEL] = imx_clk_mux("ssi3_root_sel", MXC_CCM_CSCMR1, 11, 1, ssi3_clk_sels, ARRAY_SIZE(ssi3_clk_sels));
256 clk[ssi2_root_sel] = imx_clk_mux("ssi2_root_sel", MXC_CCM_CSCMR1, 12, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels)); 213 clk[IMX5_CLK_SSI_EXT1_SEL] = imx_clk_mux("ssi_ext1_sel", MXC_CCM_CSCMR1, 28, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
257 clk[ssi3_root_sel] = imx_clk_mux("ssi3_root_sel", MXC_CCM_CSCMR1, 11, 1, ssi3_clk_sels, ARRAY_SIZE(ssi3_clk_sels)); 214 clk[IMX5_CLK_SSI_EXT2_SEL] = imx_clk_mux("ssi_ext2_sel", MXC_CCM_CSCMR1, 30, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
258 clk[ssi_ext1_sel] = imx_clk_mux("ssi_ext1_sel", MXC_CCM_CSCMR1, 28, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels)); 215 clk[IMX5_CLK_SSI_EXT1_COM_SEL] = imx_clk_mux("ssi_ext1_com_sel", MXC_CCM_CSCMR1, 0, 1, ssi_ext1_com_sels, ARRAY_SIZE(ssi_ext1_com_sels));
259 clk[ssi_ext2_sel] = imx_clk_mux("ssi_ext2_sel", MXC_CCM_CSCMR1, 30, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels)); 216 clk[IMX5_CLK_SSI_EXT2_COM_SEL] = imx_clk_mux("ssi_ext2_com_sel", MXC_CCM_CSCMR1, 1, 1, ssi_ext2_com_sels, ARRAY_SIZE(ssi_ext2_com_sels));
260 clk[ssi_ext1_com_sel] = imx_clk_mux("ssi_ext1_com_sel", MXC_CCM_CSCMR1, 0, 1, ssi_ext1_com_sels, ARRAY_SIZE(ssi_ext1_com_sels)); 217 clk[IMX5_CLK_SSI1_ROOT_PRED] = imx_clk_divider("ssi1_root_pred", "ssi1_root_sel", MXC_CCM_CS1CDR, 6, 3);
261 clk[ssi_ext2_com_sel] = imx_clk_mux("ssi_ext2_com_sel", MXC_CCM_CSCMR1, 1, 1, ssi_ext2_com_sels, ARRAY_SIZE(ssi_ext2_com_sels)); 218 clk[IMX5_CLK_SSI1_ROOT_PODF] = imx_clk_divider("ssi1_root_podf", "ssi1_root_pred", MXC_CCM_CS1CDR, 0, 6);
262 clk[ssi1_root_pred] = imx_clk_divider("ssi1_root_pred", "ssi1_root_sel", MXC_CCM_CS1CDR, 6, 3); 219 clk[IMX5_CLK_SSI2_ROOT_PRED] = imx_clk_divider("ssi2_root_pred", "ssi2_root_sel", MXC_CCM_CS2CDR, 6, 3);
263 clk[ssi1_root_podf] = imx_clk_divider("ssi1_root_podf", "ssi1_root_pred", MXC_CCM_CS1CDR, 0, 6); 220 clk[IMX5_CLK_SSI2_ROOT_PODF] = imx_clk_divider("ssi2_root_podf", "ssi2_root_pred", MXC_CCM_CS2CDR, 0, 6);
264 clk[ssi2_root_pred] = imx_clk_divider("ssi2_root_pred", "ssi2_root_sel", MXC_CCM_CS2CDR, 6, 3); 221 clk[IMX5_CLK_SSI_EXT1_PRED] = imx_clk_divider("ssi_ext1_pred", "ssi_ext1_sel", MXC_CCM_CS1CDR, 22, 3);
265 clk[ssi2_root_podf] = imx_clk_divider("ssi2_root_podf", "ssi2_root_pred", MXC_CCM_CS2CDR, 0, 6); 222 clk[IMX5_CLK_SSI_EXT1_PODF] = imx_clk_divider("ssi_ext1_podf", "ssi_ext1_pred", MXC_CCM_CS1CDR, 16, 6);
266 clk[ssi_ext1_pred] = imx_clk_divider("ssi_ext1_pred", "ssi_ext1_sel", MXC_CCM_CS1CDR, 22, 3); 223 clk[IMX5_CLK_SSI_EXT2_PRED] = imx_clk_divider("ssi_ext2_pred", "ssi_ext2_sel", MXC_CCM_CS2CDR, 22, 3);
267 clk[ssi_ext1_podf] = imx_clk_divider("ssi_ext1_podf", "ssi_ext1_pred", MXC_CCM_CS1CDR, 16, 6); 224 clk[IMX5_CLK_SSI_EXT2_PODF] = imx_clk_divider("ssi_ext2_podf", "ssi_ext2_pred", MXC_CCM_CS2CDR, 16, 6);
268 clk[ssi_ext2_pred] = imx_clk_divider("ssi_ext2_pred", "ssi_ext2_sel", MXC_CCM_CS2CDR, 22, 3); 225 clk[IMX5_CLK_SSI1_ROOT_GATE] = imx_clk_gate2("ssi1_root_gate", "ssi1_root_podf", MXC_CCM_CCGR3, 18);
269 clk[ssi_ext2_podf] = imx_clk_divider("ssi_ext2_podf", "ssi_ext2_pred", MXC_CCM_CS2CDR, 16, 6); 226 clk[IMX5_CLK_SSI2_ROOT_GATE] = imx_clk_gate2("ssi2_root_gate", "ssi2_root_podf", MXC_CCM_CCGR3, 22);
270 clk[ssi1_root_gate] = imx_clk_gate2("ssi1_root_gate", "ssi1_root_podf", MXC_CCM_CCGR3, 18); 227 clk[IMX5_CLK_SSI3_ROOT_GATE] = imx_clk_gate2("ssi3_root_gate", "ssi3_root_sel", MXC_CCM_CCGR3, 26);
271 clk[ssi2_root_gate] = imx_clk_gate2("ssi2_root_gate", "ssi2_root_podf", MXC_CCM_CCGR3, 22); 228 clk[IMX5_CLK_SSI_EXT1_GATE] = imx_clk_gate2("ssi_ext1_gate", "ssi_ext1_com_sel", MXC_CCM_CCGR3, 28);
272 clk[ssi3_root_gate] = imx_clk_gate2("ssi3_root_gate", "ssi3_root_sel", MXC_CCM_CCGR3, 26); 229 clk[IMX5_CLK_SSI_EXT2_GATE] = imx_clk_gate2("ssi_ext2_gate", "ssi_ext2_com_sel", MXC_CCM_CCGR3, 30);
273 clk[ssi_ext1_gate] = imx_clk_gate2("ssi_ext1_gate", "ssi_ext1_com_sel", MXC_CCM_CCGR3, 28); 230 clk[IMX5_CLK_EPIT1_IPG_GATE] = imx_clk_gate2("epit1_ipg_gate", "ipg", MXC_CCM_CCGR2, 2);
274 clk[ssi_ext2_gate] = imx_clk_gate2("ssi_ext2_gate", "ssi_ext2_com_sel", MXC_CCM_CCGR3, 30); 231 clk[IMX5_CLK_EPIT1_HF_GATE] = imx_clk_gate2("epit1_hf_gate", "per_root", MXC_CCM_CCGR2, 4);
275 clk[epit1_ipg_gate] = imx_clk_gate2("epit1_ipg_gate", "ipg", MXC_CCM_CCGR2, 2); 232 clk[IMX5_CLK_EPIT2_IPG_GATE] = imx_clk_gate2("epit2_ipg_gate", "ipg", MXC_CCM_CCGR2, 6);
276 clk[epit1_hf_gate] = imx_clk_gate2("epit1_hf_gate", "per_root", MXC_CCM_CCGR2, 4); 233 clk[IMX5_CLK_EPIT2_HF_GATE] = imx_clk_gate2("epit2_hf_gate", "per_root", MXC_CCM_CCGR2, 8);
277 clk[epit2_ipg_gate] = imx_clk_gate2("epit2_ipg_gate", "ipg", MXC_CCM_CCGR2, 6); 234 clk[IMX5_CLK_OWIRE_GATE] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22);
278 clk[epit2_hf_gate] = imx_clk_gate2("epit2_hf_gate", "per_root", MXC_CCM_CCGR2, 8); 235 clk[IMX5_CLK_SRTC_GATE] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28);
279 clk[owire_gate] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22); 236 clk[IMX5_CLK_PATA_GATE] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0);
280 clk[srtc_gate] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28); 237 clk[IMX5_CLK_SPDIF0_SEL] = imx_clk_mux("spdif0_sel", MXC_CCM_CSCMR2, 0, 2, spdif_sel, ARRAY_SIZE(spdif_sel));
281 clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0); 238 clk[IMX5_CLK_SPDIF0_PRED] = imx_clk_divider("spdif0_pred", "spdif0_sel", MXC_CCM_CDCDR, 25, 3);
282 clk[spdif0_sel] = imx_clk_mux("spdif0_sel", MXC_CCM_CSCMR2, 0, 2, spdif_sel, ARRAY_SIZE(spdif_sel)); 239 clk[IMX5_CLK_SPDIF0_PODF] = imx_clk_divider("spdif0_podf", "spdif0_pred", MXC_CCM_CDCDR, 19, 6);
283 clk[spdif0_pred] = imx_clk_divider("spdif0_pred", "spdif0_sel", MXC_CCM_CDCDR, 25, 3); 240 clk[IMX5_CLK_SPDIF0_COM_SEL] = imx_clk_mux_flags("spdif0_com_sel", MXC_CCM_CSCMR2, 4, 1,
284 clk[spdif0_podf] = imx_clk_divider("spdif0_podf", "spdif0_pred", MXC_CCM_CDCDR, 19, 6); 241 spdif0_com_sel, ARRAY_SIZE(spdif0_com_sel), CLK_SET_RATE_PARENT);
285 clk[spdif0_com_s] = imx_clk_mux_flags("spdif0_com_sel", MXC_CCM_CSCMR2, 4, 1, 242 clk[IMX5_CLK_SPDIF0_GATE] = imx_clk_gate2("spdif0_gate", "spdif0_com_sel", MXC_CCM_CCGR5, 26);
286 spdif0_com_sel, ARRAY_SIZE(spdif0_com_sel), CLK_SET_RATE_PARENT); 243 clk[IMX5_CLK_SPDIF_IPG_GATE] = imx_clk_gate2("spdif_ipg_gate", "ipg", MXC_CCM_CCGR5, 30);
287 clk[spdif0_gate] = imx_clk_gate2("spdif0_gate", "spdif0_com_sel", MXC_CCM_CCGR5, 26); 244 clk[IMX5_CLK_SAHARA_IPG_GATE] = imx_clk_gate2("sahara_ipg_gate", "ipg", MXC_CCM_CCGR4, 14);
288 clk[spdif_ipg_gate] = imx_clk_gate2("spdif_ipg_gate", "ipg", MXC_CCM_CCGR5, 30); 245 clk[IMX5_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "usb_phy1_gate", 1, 1);
289 246
290 for (i = 0; i < ARRAY_SIZE(clk); i++) 247 for (i = 0; i < ARRAY_SIZE(clk); i++)
291 if (IS_ERR(clk[i])) 248 if (IS_ERR(clk[i]))
292 pr_err("i.MX5 clk %d: register failed with %ld\n", 249 pr_err("i.MX5 clk %d: register failed with %ld\n",
293 i, PTR_ERR(clk[i])); 250 i, PTR_ERR(clk[i]));
294 251
295 clk_register_clkdev(clk[gpt_hf_gate], "per", "imx-gpt.0"); 252 clk_register_clkdev(clk[IMX5_CLK_GPT_HF_GATE], "per", "imx-gpt.0");
296 clk_register_clkdev(clk[gpt_ipg_gate], "ipg", "imx-gpt.0"); 253 clk_register_clkdev(clk[IMX5_CLK_GPT_IPG_GATE], "ipg", "imx-gpt.0");
297 clk_register_clkdev(clk[uart1_per_gate], "per", "imx21-uart.0"); 254 clk_register_clkdev(clk[IMX5_CLK_UART1_PER_GATE], "per", "imx21-uart.0");
298 clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0"); 255 clk_register_clkdev(clk[IMX5_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
299 clk_register_clkdev(clk[uart2_per_gate], "per", "imx21-uart.1"); 256 clk_register_clkdev(clk[IMX5_CLK_UART2_PER_GATE], "per", "imx21-uart.1");
300 clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1"); 257 clk_register_clkdev(clk[IMX5_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1");
301 clk_register_clkdev(clk[uart3_per_gate], "per", "imx21-uart.2"); 258 clk_register_clkdev(clk[IMX5_CLK_UART3_PER_GATE], "per", "imx21-uart.2");
302 clk_register_clkdev(clk[uart3_ipg_gate], "ipg", "imx21-uart.2"); 259 clk_register_clkdev(clk[IMX5_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2");
303 clk_register_clkdev(clk[uart4_per_gate], "per", "imx21-uart.3"); 260 clk_register_clkdev(clk[IMX5_CLK_UART4_PER_GATE], "per", "imx21-uart.3");
304 clk_register_clkdev(clk[uart4_ipg_gate], "ipg", "imx21-uart.3"); 261 clk_register_clkdev(clk[IMX5_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3");
305 clk_register_clkdev(clk[uart5_per_gate], "per", "imx21-uart.4"); 262 clk_register_clkdev(clk[IMX5_CLK_UART5_PER_GATE], "per", "imx21-uart.4");
306 clk_register_clkdev(clk[uart5_ipg_gate], "ipg", "imx21-uart.4"); 263 clk_register_clkdev(clk[IMX5_CLK_UART5_IPG_GATE], "ipg", "imx21-uart.4");
307 clk_register_clkdev(clk[ecspi1_per_gate], "per", "imx51-ecspi.0"); 264 clk_register_clkdev(clk[IMX5_CLK_ECSPI1_PER_GATE], "per", "imx51-ecspi.0");
308 clk_register_clkdev(clk[ecspi1_ipg_gate], "ipg", "imx51-ecspi.0"); 265 clk_register_clkdev(clk[IMX5_CLK_ECSPI1_IPG_GATE], "ipg", "imx51-ecspi.0");
309 clk_register_clkdev(clk[ecspi2_per_gate], "per", "imx51-ecspi.1"); 266 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_PER_GATE], "per", "imx51-ecspi.1");
310 clk_register_clkdev(clk[ecspi2_ipg_gate], "ipg", "imx51-ecspi.1"); 267 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_IPG_GATE], "ipg", "imx51-ecspi.1");
311 clk_register_clkdev(clk[cspi_ipg_gate], NULL, "imx35-cspi.2"); 268 clk_register_clkdev(clk[IMX5_CLK_CSPI_IPG_GATE], NULL, "imx35-cspi.2");
312 clk_register_clkdev(clk[pwm1_ipg_gate], "pwm", "mxc_pwm.0"); 269 clk_register_clkdev(clk[IMX5_CLK_PWM1_IPG_GATE], "pwm", "mxc_pwm.0");
313 clk_register_clkdev(clk[pwm2_ipg_gate], "pwm", "mxc_pwm.1"); 270 clk_register_clkdev(clk[IMX5_CLK_PWM2_IPG_GATE], "pwm", "mxc_pwm.1");
314 clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0"); 271 clk_register_clkdev(clk[IMX5_CLK_I2C1_GATE], NULL, "imx21-i2c.0");
315 clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1"); 272 clk_register_clkdev(clk[IMX5_CLK_I2C2_GATE], NULL, "imx21-i2c.1");
316 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.0"); 273 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.0");
317 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.0"); 274 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.0");
318 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.0"); 275 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.0");
319 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.1"); 276 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.1");
320 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.1"); 277 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.1");
321 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.1"); 278 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.1");
322 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.2"); 279 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.2");
323 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.2"); 280 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.2");
324 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.2"); 281 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.2");
325 clk_register_clkdev(clk[usboh3_per_gate], "per", "imx-udc-mx51"); 282 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "imx-udc-mx51");
326 clk_register_clkdev(clk[usboh3_gate], "ipg", "imx-udc-mx51"); 283 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "imx-udc-mx51");
327 clk_register_clkdev(clk[usboh3_gate], "ahb", "imx-udc-mx51"); 284 clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "imx-udc-mx51");
328 clk_register_clkdev(clk[nfc_gate], NULL, "imx51-nand"); 285 clk_register_clkdev(clk[IMX5_CLK_NFC_GATE], NULL, "imx51-nand");
329 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); 286 clk_register_clkdev(clk[IMX5_CLK_SSI1_IPG_GATE], NULL, "imx-ssi.0");
330 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 287 clk_register_clkdev(clk[IMX5_CLK_SSI2_IPG_GATE], NULL, "imx-ssi.1");
331 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2"); 288 clk_register_clkdev(clk[IMX5_CLK_SSI3_IPG_GATE], NULL, "imx-ssi.2");
332 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma"); 289 clk_register_clkdev(clk[IMX5_CLK_SDMA_GATE], NULL, "imx35-sdma");
333 clk_register_clkdev(clk[cpu_podf], NULL, "cpu0"); 290 clk_register_clkdev(clk[IMX5_CLK_CPU_PODF], NULL, "cpu0");
334 clk_register_clkdev(clk[iim_gate], "iim", NULL); 291 clk_register_clkdev(clk[IMX5_CLK_IIM_GATE], "iim", NULL);
335 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0"); 292 clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx2-wdt.0");
336 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1"); 293 clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx2-wdt.1");
337 clk_register_clkdev(clk[dummy], NULL, "imx-keypad"); 294 clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx-keypad");
338 clk_register_clkdev(clk[ipu_di1_gate], "di1", "imx-tve.0"); 295 clk_register_clkdev(clk[IMX5_CLK_IPU_DI1_GATE], "di1", "imx-tve.0");
339 clk_register_clkdev(clk[gpc_dvfs], "gpc_dvfs", NULL); 296 clk_register_clkdev(clk[IMX5_CLK_GPC_DVFS], "gpc_dvfs", NULL);
340 clk_register_clkdev(clk[epit1_ipg_gate], "ipg", "imx-epit.0"); 297 clk_register_clkdev(clk[IMX5_CLK_EPIT1_IPG_GATE], "ipg", "imx-epit.0");
341 clk_register_clkdev(clk[epit1_hf_gate], "per", "imx-epit.0"); 298 clk_register_clkdev(clk[IMX5_CLK_EPIT1_HF_GATE], "per", "imx-epit.0");
342 clk_register_clkdev(clk[epit2_ipg_gate], "ipg", "imx-epit.1"); 299 clk_register_clkdev(clk[IMX5_CLK_EPIT2_IPG_GATE], "ipg", "imx-epit.1");
343 clk_register_clkdev(clk[epit2_hf_gate], "per", "imx-epit.1"); 300 clk_register_clkdev(clk[IMX5_CLK_EPIT2_HF_GATE], "per", "imx-epit.1");
344 301
345 /* Set SDHC parents to be PLL2 */ 302 /* Set SDHC parents to be PLL2 */
346 clk_set_parent(clk[esdhc_a_sel], clk[pll2_sw]); 303 clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]);
347 clk_set_parent(clk[esdhc_b_sel], clk[pll2_sw]); 304 clk_set_parent(clk[IMX5_CLK_ESDHC_B_SEL], clk[IMX5_CLK_PLL2_SW]);
348 305
349 /* move usb phy clk to 24MHz */ 306 /* move usb phy clk to 24MHz */
350 clk_set_parent(clk[usb_phy_sel], clk[osc]); 307 clk_set_parent(clk[IMX5_CLK_USB_PHY_SEL], clk[IMX5_CLK_OSC]);
351 308
352 clk_prepare_enable(clk[gpc_dvfs]); 309 clk_prepare_enable(clk[IMX5_CLK_GPC_DVFS]);
353 clk_prepare_enable(clk[ahb_max]); /* esdhc3 */ 310 clk_prepare_enable(clk[IMX5_CLK_AHB_MAX]); /* esdhc3 */
354 clk_prepare_enable(clk[aips_tz1]); 311 clk_prepare_enable(clk[IMX5_CLK_AIPS_TZ1]);
355 clk_prepare_enable(clk[aips_tz2]); /* fec */ 312 clk_prepare_enable(clk[IMX5_CLK_AIPS_TZ2]); /* fec */
356 clk_prepare_enable(clk[spba]); 313 clk_prepare_enable(clk[IMX5_CLK_SPBA]);
357 clk_prepare_enable(clk[emi_fast_gate]); /* fec */ 314 clk_prepare_enable(clk[IMX5_CLK_EMI_FAST_GATE]); /* fec */
358 clk_prepare_enable(clk[emi_slow_gate]); /* eim */ 315 clk_prepare_enable(clk[IMX5_CLK_EMI_SLOW_GATE]); /* eim */
359 clk_prepare_enable(clk[mipi_hsc1_gate]); 316 clk_prepare_enable(clk[IMX5_CLK_MIPI_HSC1_GATE]);
360 clk_prepare_enable(clk[mipi_hsc2_gate]); 317 clk_prepare_enable(clk[IMX5_CLK_MIPI_HSC2_GATE]);
361 clk_prepare_enable(clk[mipi_esc_gate]); 318 clk_prepare_enable(clk[IMX5_CLK_MIPI_ESC_GATE]);
362 clk_prepare_enable(clk[mipi_hsp_gate]); 319 clk_prepare_enable(clk[IMX5_CLK_MIPI_HSP_GATE]);
363 clk_prepare_enable(clk[tmax1]); 320 clk_prepare_enable(clk[IMX5_CLK_TMAX1]);
364 clk_prepare_enable(clk[tmax2]); /* esdhc2, fec */ 321 clk_prepare_enable(clk[IMX5_CLK_TMAX2]); /* esdhc2, fec */
365 clk_prepare_enable(clk[tmax3]); /* esdhc1, esdhc4 */ 322 clk_prepare_enable(clk[IMX5_CLK_TMAX3]); /* esdhc1, esdhc4 */
366} 323}
367 324
325static void __init mx50_clocks_init(struct device_node *np)
326{
327 void __iomem *base;
328 unsigned long r;
329 int i, irq;
330
331 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
332 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
333 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE);
334
335 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
336 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
337 clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
338 clk[IMX5_CLK_ESDHC2_PER_GATE] = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6);
339 clk[IMX5_CLK_ESDHC3_PER_GATE] = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10);
340 clk[IMX5_CLK_ESDHC4_PER_GATE] = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
341 clk[IMX5_CLK_USB_PHY1_GATE] = imx_clk_gate2("usb_phy1_gate", "usb_phy_sel", MXC_CCM_CCGR4, 10);
342 clk[IMX5_CLK_USB_PHY2_GATE] = imx_clk_gate2("usb_phy2_gate", "usb_phy_sel", MXC_CCM_CCGR4, 12);
343 clk[IMX5_CLK_I2C3_GATE] = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22);
344
345 clk[IMX5_CLK_CKO1_SEL] = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4,
346 mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel));
347 clk[IMX5_CLK_CKO1_PODF] = imx_clk_divider("cko1_podf", "cko1_sel", MXC_CCM_CCOSR, 4, 3);
348 clk[IMX5_CLK_CKO1] = imx_clk_gate2("cko1", "cko1_podf", MXC_CCM_CCOSR, 7);
349
350 clk[IMX5_CLK_CKO2_SEL] = imx_clk_mux("cko2_sel", MXC_CCM_CCOSR, 16, 5,
351 mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel));
352 clk[IMX5_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
353 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
354
355 for (i = 0; i < ARRAY_SIZE(clk); i++)
356 if (IS_ERR(clk[i]))
357 pr_err("i.MX50 clk %d: register failed with %ld\n",
358 i, PTR_ERR(clk[i]));
359
360 clk_data.clks = clk;
361 clk_data.clk_num = ARRAY_SIZE(clk);
362 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
363
364 mx5_clocks_common_init(0, 0, 0, 0);
365
366 /* set SDHC root clock to 200MHZ*/
367 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
368 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
369
370 clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
371 imx_print_silicon_rev("i.MX50", IMX_CHIP_REVISION_1_1);
372 clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
373
374 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
375 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
376
377 np = of_find_compatible_node(NULL, NULL, "fsl,imx50-gpt");
378 base = of_iomap(np, 0);
379 WARN_ON(!base);
380 irq = irq_of_parse_and_map(np, 0);
381 mxc_timer_init(base, irq);
382}
383CLK_OF_DECLARE(imx50_ccm, "fsl,imx50-ccm", mx50_clocks_init);
384
368int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, 385int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
369 unsigned long rate_ckih1, unsigned long rate_ckih2) 386 unsigned long rate_ckih1, unsigned long rate_ckih2)
370{ 387{
@@ -372,38 +389,40 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
372 u32 val; 389 u32 val;
373 struct device_node *np; 390 struct device_node *np;
374 391
375 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE); 392 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE);
376 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX51_DPLL2_BASE); 393 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX51_DPLL2_BASE);
377 clk[pll3_sw] = imx_clk_pllv2("pll3_sw", "osc", MX51_DPLL3_BASE); 394 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", MX51_DPLL3_BASE);
378 clk[ipu_di0_sel] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3, 395 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1,
379 mx51_ipu_di0_sel, ARRAY_SIZE(mx51_ipu_di0_sel)); 396 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
380 clk[ipu_di1_sel] = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3, 397 clk[IMX5_CLK_IPU_DI0_SEL] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
381 mx51_ipu_di1_sel, ARRAY_SIZE(mx51_ipu_di1_sel)); 398 mx51_ipu_di0_sel, ARRAY_SIZE(mx51_ipu_di0_sel));
382 clk[tve_ext_sel] = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1, 399 clk[IMX5_CLK_IPU_DI1_SEL] = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3,
383 mx51_tve_ext_sel, ARRAY_SIZE(mx51_tve_ext_sel), CLK_SET_RATE_PARENT); 400 mx51_ipu_di1_sel, ARRAY_SIZE(mx51_ipu_di1_sel));
384 clk[tve_s] = imx_clk_mux("tve_sel", MXC_CCM_CSCMR1, 7, 1, 401 clk[IMX5_CLK_TVE_EXT_SEL] = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1,
385 mx51_tve_sel, ARRAY_SIZE(mx51_tve_sel)); 402 mx51_tve_ext_sel, ARRAY_SIZE(mx51_tve_ext_sel), CLK_SET_RATE_PARENT);
386 clk[tve_gate] = imx_clk_gate2("tve_gate", "tve_sel", MXC_CCM_CCGR2, 30); 403 clk[IMX5_CLK_TVE_SEL] = imx_clk_mux("tve_sel", MXC_CCM_CSCMR1, 7, 1,
387 clk[tve_pred] = imx_clk_divider("tve_pred", "pll3_sw", MXC_CCM_CDCDR, 28, 3); 404 mx51_tve_sel, ARRAY_SIZE(mx51_tve_sel));
388 clk[esdhc1_per_gate] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2); 405 clk[IMX5_CLK_TVE_GATE] = imx_clk_gate2("tve_gate", "tve_sel", MXC_CCM_CCGR2, 30);
389 clk[esdhc2_per_gate] = imx_clk_gate2("esdhc2_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 6); 406 clk[IMX5_CLK_TVE_PRED] = imx_clk_divider("tve_pred", "pll3_sw", MXC_CCM_CDCDR, 28, 3);
390 clk[esdhc3_per_gate] = imx_clk_gate2("esdhc3_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 10); 407 clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
391 clk[esdhc4_per_gate] = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14); 408 clk[IMX5_CLK_ESDHC2_PER_GATE] = imx_clk_gate2("esdhc2_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 6);
392 clk[usb_phy_gate] = imx_clk_gate2("usb_phy_gate", "usb_phy_sel", MXC_CCM_CCGR2, 0); 409 clk[IMX5_CLK_ESDHC3_PER_GATE] = imx_clk_gate2("esdhc3_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 10);
393 clk[hsi2c_gate] = imx_clk_gate2("hsi2c_gate", "ipg", MXC_CCM_CCGR1, 22); 410 clk[IMX5_CLK_ESDHC4_PER_GATE] = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
394 clk[mipi_hsc1_gate] = imx_clk_gate2("mipi_hsc1_gate", "ipg", MXC_CCM_CCGR4, 6); 411 clk[IMX5_CLK_USB_PHY_GATE] = imx_clk_gate2("usb_phy_gate", "usb_phy_sel", MXC_CCM_CCGR2, 0);
395 clk[mipi_hsc2_gate] = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8); 412 clk[IMX5_CLK_HSI2C_GATE] = imx_clk_gate2("hsi2c_gate", "ipg", MXC_CCM_CCGR1, 22);
396 clk[mipi_esc_gate] = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10); 413 clk[IMX5_CLK_MIPI_HSC1_GATE] = imx_clk_gate2("mipi_hsc1_gate", "ipg", MXC_CCM_CCGR4, 6);
397 clk[mipi_hsp_gate] = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12); 414 clk[IMX5_CLK_MIPI_HSC2_GATE] = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8);
398 clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2, 415 clk[IMX5_CLK_MIPI_ESC_GATE] = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10);
399 mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel)); 416 clk[IMX5_CLK_MIPI_HSP_GATE] = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12);
400 clk[spdif1_sel] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2, 417 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
401 spdif_sel, ARRAY_SIZE(spdif_sel)); 418 mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel));
402 clk[spdif1_pred] = imx_clk_divider("spdif1_pred", "spdif1_sel", MXC_CCM_CDCDR, 16, 3); 419 clk[IMX5_CLK_SPDIF1_SEL] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2,
403 clk[spdif1_podf] = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6); 420 spdif_sel, ARRAY_SIZE(spdif_sel));
404 clk[spdif1_com_sel] = imx_clk_mux("spdif1_com_sel", MXC_CCM_CSCMR2, 5, 1, 421 clk[IMX5_CLK_SPDIF1_PRED] = imx_clk_divider("spdif1_pred", "spdif1_sel", MXC_CCM_CDCDR, 16, 3);
405 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel)); 422 clk[IMX5_CLK_SPDIF1_PODF] = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6);
406 clk[spdif1_gate] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28); 423 clk[IMX5_CLK_SPDIF1_COM_SEL] = imx_clk_mux("spdif1_com_sel", MXC_CCM_CSCMR2, 5, 1,
424 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
425 clk[IMX5_CLK_SPDIF1_GATE] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28);
407 426
408 for (i = 0; i < ARRAY_SIZE(clk); i++) 427 for (i = 0; i < ARRAY_SIZE(clk); i++)
409 if (IS_ERR(clk[i])) 428 if (IS_ERR(clk[i]))
@@ -417,37 +436,37 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
417 436
418 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2); 437 mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
419 438
420 clk_register_clkdev(clk[hsi2c_gate], NULL, "imx21-i2c.2"); 439 clk_register_clkdev(clk[IMX5_CLK_HSI2C_GATE], NULL, "imx21-i2c.2");
421 clk_register_clkdev(clk[mx51_mipi], "mipi_hsp", NULL); 440 clk_register_clkdev(clk[IMX5_CLK_MX51_MIPI], "mipi_hsp", NULL);
422 clk_register_clkdev(clk[vpu_gate], NULL, "imx51-vpu.0"); 441 clk_register_clkdev(clk[IMX5_CLK_VPU_GATE], NULL, "imx51-vpu.0");
423 clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0"); 442 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx27-fec.0");
424 clk_register_clkdev(clk[usb_phy_gate], "phy", "mxc-ehci.0"); 443 clk_register_clkdev(clk[IMX5_CLK_USB_PHY_GATE], "phy", "mxc-ehci.0");
425 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx51.0"); 444 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx51.0");
426 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.0"); 445 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.0");
427 clk_register_clkdev(clk[esdhc1_per_gate], "per", "sdhci-esdhc-imx51.0"); 446 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_PER_GATE], "per", "sdhci-esdhc-imx51.0");
428 clk_register_clkdev(clk[esdhc2_ipg_gate], "ipg", "sdhci-esdhc-imx51.1"); 447 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_IPG_GATE], "ipg", "sdhci-esdhc-imx51.1");
429 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.1"); 448 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.1");
430 clk_register_clkdev(clk[esdhc2_per_gate], "per", "sdhci-esdhc-imx51.1"); 449 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_PER_GATE], "per", "sdhci-esdhc-imx51.1");
431 clk_register_clkdev(clk[esdhc3_ipg_gate], "ipg", "sdhci-esdhc-imx51.2"); 450 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_IPG_GATE], "ipg", "sdhci-esdhc-imx51.2");
432 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.2"); 451 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.2");
433 clk_register_clkdev(clk[esdhc3_per_gate], "per", "sdhci-esdhc-imx51.2"); 452 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_PER_GATE], "per", "sdhci-esdhc-imx51.2");
434 clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx51.3"); 453 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_IPG_GATE], "ipg", "sdhci-esdhc-imx51.3");
435 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.3"); 454 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.3");
436 clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx51.3"); 455 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_PER_GATE], "per", "sdhci-esdhc-imx51.3");
437 456
438 /* set the usboh3 parent to pll2_sw */ 457 /* set the usboh3 parent to pll2_sw */
439 clk_set_parent(clk[usboh3_sel], clk[pll2_sw]); 458 clk_set_parent(clk[IMX5_CLK_USBOH3_SEL], clk[IMX5_CLK_PLL2_SW]);
440 459
441 /* set SDHC root clock to 166.25MHZ*/ 460 /* set SDHC root clock to 166.25MHZ*/
442 clk_set_rate(clk[esdhc_a_podf], 166250000); 461 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 166250000);
443 clk_set_rate(clk[esdhc_b_podf], 166250000); 462 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 166250000);
444 463
445 /* System timer */ 464 /* System timer */
446 mxc_timer_init(MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), MX51_INT_GPT); 465 mxc_timer_init(MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), MX51_INT_GPT);
447 466
448 clk_prepare_enable(clk[iim_gate]); 467 clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
449 imx_print_silicon_rev("i.MX51", mx51_revision()); 468 imx_print_silicon_rev("i.MX51", mx51_revision());
450 clk_disable_unprepare(clk[iim_gate]); 469 clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
451 470
452 /* 471 /*
453 * Reference Manual says: Functionality of CCDR[18] and CLPCR[23] is no 472 * Reference Manual says: Functionality of CCDR[18] and CLPCR[23] is no
@@ -479,57 +498,59 @@ static void __init mx53_clocks_init(struct device_node *np)
479 unsigned long r; 498 unsigned long r;
480 void __iomem *base; 499 void __iomem *base;
481 500
482 clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE); 501 clk[IMX5_CLK_PLL1_SW] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
483 clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE); 502 clk[IMX5_CLK_PLL2_SW] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
484 clk[pll3_sw] = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE); 503 clk[IMX5_CLK_PLL3_SW] = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE);
485 clk[pll4_sw] = imx_clk_pllv2("pll4_sw", "osc", MX53_DPLL4_BASE); 504 clk[IMX5_CLK_PLL4_SW] = imx_clk_pllv2("pll4_sw", "osc", MX53_DPLL4_BASE);
486 505
487 clk[ldb_di1_div_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 506 clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
488 clk[ldb_di1_div] = imx_clk_divider_flags("ldb_di1_div", "ldb_di1_div_3_5", MXC_CCM_CSCMR2, 11, 1, 0); 507 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
489 clk[ldb_di1_sel] = imx_clk_mux_flags("ldb_di1_sel", MXC_CCM_CSCMR2, 9, 1, 508 clk[IMX5_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7);
490 mx53_ldb_di1_sel, ARRAY_SIZE(mx53_ldb_di1_sel), CLK_SET_RATE_PARENT); 509 clk[IMX5_CLK_LDB_DI1_DIV] = imx_clk_divider_flags("ldb_di1_div", "ldb_di1_div_3_5", MXC_CCM_CSCMR2, 11, 1, 0);
491 clk[di_pll4_podf] = imx_clk_divider("di_pll4_podf", "pll4_sw", MXC_CCM_CDCDR, 16, 3); 510 clk[IMX5_CLK_LDB_DI1_SEL] = imx_clk_mux_flags("ldb_di1_sel", MXC_CCM_CSCMR2, 9, 1,
492 clk[ldb_di0_div_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 511 mx53_ldb_di1_sel, ARRAY_SIZE(mx53_ldb_di1_sel), CLK_SET_RATE_PARENT);
493 clk[ldb_di0_div] = imx_clk_divider_flags("ldb_di0_div", "ldb_di0_div_3_5", MXC_CCM_CSCMR2, 10, 1, 0); 512 clk[IMX5_CLK_DI_PLL4_PODF] = imx_clk_divider("di_pll4_podf", "pll4_sw", MXC_CCM_CDCDR, 16, 3);
494 clk[ldb_di0_sel] = imx_clk_mux_flags("ldb_di0_sel", MXC_CCM_CSCMR2, 8, 1, 513 clk[IMX5_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
495 mx53_ldb_di0_sel, ARRAY_SIZE(mx53_ldb_di0_sel), CLK_SET_RATE_PARENT); 514 clk[IMX5_CLK_LDB_DI0_DIV] = imx_clk_divider_flags("ldb_di0_div", "ldb_di0_div_3_5", MXC_CCM_CSCMR2, 10, 1, 0);
496 clk[ldb_di0_gate] = imx_clk_gate2("ldb_di0_gate", "ldb_di0_div", MXC_CCM_CCGR6, 28); 515 clk[IMX5_CLK_LDB_DI0_SEL] = imx_clk_mux_flags("ldb_di0_sel", MXC_CCM_CSCMR2, 8, 1,
497 clk[ldb_di1_gate] = imx_clk_gate2("ldb_di1_gate", "ldb_di1_div", MXC_CCM_CCGR6, 30); 516 mx53_ldb_di0_sel, ARRAY_SIZE(mx53_ldb_di0_sel), CLK_SET_RATE_PARENT);
498 clk[ipu_di0_sel] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3, 517 clk[IMX5_CLK_LDB_DI0_GATE] = imx_clk_gate2("ldb_di0_gate", "ldb_di0_div", MXC_CCM_CCGR6, 28);
499 mx53_ipu_di0_sel, ARRAY_SIZE(mx53_ipu_di0_sel)); 518 clk[IMX5_CLK_LDB_DI1_GATE] = imx_clk_gate2("ldb_di1_gate", "ldb_di1_div", MXC_CCM_CCGR6, 30);
500 clk[ipu_di1_sel] = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3, 519 clk[IMX5_CLK_IPU_DI0_SEL] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
501 mx53_ipu_di1_sel, ARRAY_SIZE(mx53_ipu_di1_sel)); 520 mx53_ipu_di0_sel, ARRAY_SIZE(mx53_ipu_di0_sel));
502 clk[tve_ext_sel] = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1, 521 clk[IMX5_CLK_IPU_DI1_SEL] = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3,
503 mx53_tve_ext_sel, ARRAY_SIZE(mx53_tve_ext_sel), CLK_SET_RATE_PARENT); 522 mx53_ipu_di1_sel, ARRAY_SIZE(mx53_ipu_di1_sel));
504 clk[tve_gate] = imx_clk_gate2("tve_gate", "tve_pred", MXC_CCM_CCGR2, 30); 523 clk[IMX5_CLK_TVE_EXT_SEL] = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1,
505 clk[tve_pred] = imx_clk_divider("tve_pred", "tve_ext_sel", MXC_CCM_CDCDR, 28, 3); 524 mx53_tve_ext_sel, ARRAY_SIZE(mx53_tve_ext_sel), CLK_SET_RATE_PARENT);
506 clk[esdhc1_per_gate] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2); 525 clk[IMX5_CLK_TVE_GATE] = imx_clk_gate2("tve_gate", "tve_pred", MXC_CCM_CCGR2, 30);
507 clk[esdhc2_per_gate] = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6); 526 clk[IMX5_CLK_TVE_PRED] = imx_clk_divider("tve_pred", "tve_ext_sel", MXC_CCM_CDCDR, 28, 3);
508 clk[esdhc3_per_gate] = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10); 527 clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
509 clk[esdhc4_per_gate] = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14); 528 clk[IMX5_CLK_ESDHC2_PER_GATE] = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6);
510 clk[usb_phy1_gate] = imx_clk_gate2("usb_phy1_gate", "usb_phy_sel", MXC_CCM_CCGR4, 10); 529 clk[IMX5_CLK_ESDHC3_PER_GATE] = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10);
511 clk[usb_phy2_gate] = imx_clk_gate2("usb_phy2_gate", "usb_phy_sel", MXC_CCM_CCGR4, 12); 530 clk[IMX5_CLK_ESDHC4_PER_GATE] = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
512 clk[can_sel] = imx_clk_mux("can_sel", MXC_CCM_CSCMR2, 6, 2, 531 clk[IMX5_CLK_USB_PHY1_GATE] = imx_clk_gate2("usb_phy1_gate", "usb_phy_sel", MXC_CCM_CCGR4, 10);
513 mx53_can_sel, ARRAY_SIZE(mx53_can_sel)); 532 clk[IMX5_CLK_USB_PHY2_GATE] = imx_clk_gate2("usb_phy2_gate", "usb_phy_sel", MXC_CCM_CCGR4, 12);
514 clk[can1_serial_gate] = imx_clk_gate2("can1_serial_gate", "can_sel", MXC_CCM_CCGR6, 22); 533 clk[IMX5_CLK_CAN_SEL] = imx_clk_mux("can_sel", MXC_CCM_CSCMR2, 6, 2,
515 clk[can1_ipg_gate] = imx_clk_gate2("can1_ipg_gate", "ipg", MXC_CCM_CCGR6, 20); 534 mx53_can_sel, ARRAY_SIZE(mx53_can_sel));
516 clk[ocram] = imx_clk_gate2("ocram", "ahb", MXC_CCM_CCGR6, 2); 535 clk[IMX5_CLK_CAN1_SERIAL_GATE] = imx_clk_gate2("can1_serial_gate", "can_sel", MXC_CCM_CCGR6, 22);
517 clk[can2_serial_gate] = imx_clk_gate2("can2_serial_gate", "can_sel", MXC_CCM_CCGR4, 8); 536 clk[IMX5_CLK_CAN1_IPG_GATE] = imx_clk_gate2("can1_ipg_gate", "ipg", MXC_CCM_CCGR6, 20);
518 clk[can2_ipg_gate] = imx_clk_gate2("can2_ipg_gate", "ipg", MXC_CCM_CCGR4, 6); 537 clk[IMX5_CLK_OCRAM] = imx_clk_gate2("ocram", "ahb", MXC_CCM_CCGR6, 2);
519 clk[i2c3_gate] = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22); 538 clk[IMX5_CLK_CAN2_SERIAL_GATE] = imx_clk_gate2("can2_serial_gate", "can_sel", MXC_CCM_CCGR4, 8);
520 clk[sata_gate] = imx_clk_gate2("sata_gate", "ipg", MXC_CCM_CCGR4, 2); 539 clk[IMX5_CLK_CAN2_IPG_GATE] = imx_clk_gate2("can2_ipg_gate", "ipg", MXC_CCM_CCGR4, 6);
521 540 clk[IMX5_CLK_I2C3_GATE] = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22);
522 clk[cko1_sel] = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4, 541 clk[IMX5_CLK_SATA_GATE] = imx_clk_gate2("sata_gate", "ipg", MXC_CCM_CCGR4, 2);
523 mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel)); 542
524 clk[cko1_podf] = imx_clk_divider("cko1_podf", "cko1_sel", MXC_CCM_CCOSR, 4, 3); 543 clk[IMX5_CLK_CKO1_SEL] = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4,
525 clk[cko1] = imx_clk_gate2("cko1", "cko1_podf", MXC_CCM_CCOSR, 7); 544 mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel));
526 545 clk[IMX5_CLK_CKO1_PODF] = imx_clk_divider("cko1_podf", "cko1_sel", MXC_CCM_CCOSR, 4, 3);
527 clk[cko2_sel] = imx_clk_mux("cko2_sel", MXC_CCM_CCOSR, 16, 5, 546 clk[IMX5_CLK_CKO1] = imx_clk_gate2("cko1", "cko1_podf", MXC_CCM_CCOSR, 7);
528 mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel)); 547
529 clk[cko2_podf] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3); 548 clk[IMX5_CLK_CKO2_SEL] = imx_clk_mux("cko2_sel", MXC_CCM_CCOSR, 16, 5,
530 clk[cko2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24); 549 mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel));
531 clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2, 550 clk[IMX5_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
532 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel)); 551 clk[IMX5_CLK_CKO2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
552 clk[IMX5_CLK_SPDIF_XTAL_SEL] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
553 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel));
533 554
534 for (i = 0; i < ARRAY_SIZE(clk); i++) 555 for (i = 0; i < ARRAY_SIZE(clk); i++)
535 if (IS_ERR(clk[i])) 556 if (IS_ERR(clk[i]))
@@ -542,33 +563,36 @@ static void __init mx53_clocks_init(struct device_node *np)
542 563
543 mx5_clocks_common_init(0, 0, 0, 0); 564 mx5_clocks_common_init(0, 0, 0, 0);
544 565
545 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0"); 566 clk_register_clkdev(clk[IMX5_CLK_VPU_GATE], NULL, "imx53-vpu.0");
546 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2"); 567 clk_register_clkdev(clk[IMX5_CLK_I2C3_GATE], NULL, "imx21-i2c.2");
547 clk_register_clkdev(clk[fec_gate], NULL, "imx25-fec.0"); 568 clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx25-fec.0");
548 clk_register_clkdev(clk[usb_phy1_gate], "usb_phy1", "mxc-ehci.0"); 569 clk_register_clkdev(clk[IMX5_CLK_USB_PHY1_GATE], "usb_phy1", "mxc-ehci.0");
549 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx53.0"); 570 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx53.0");
550 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.0"); 571 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.0");
551 clk_register_clkdev(clk[esdhc1_per_gate], "per", "sdhci-esdhc-imx53.0"); 572 clk_register_clkdev(clk[IMX5_CLK_ESDHC1_PER_GATE], "per", "sdhci-esdhc-imx53.0");
552 clk_register_clkdev(clk[esdhc2_ipg_gate], "ipg", "sdhci-esdhc-imx53.1"); 573 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_IPG_GATE], "ipg", "sdhci-esdhc-imx53.1");
553 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.1"); 574 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.1");
554 clk_register_clkdev(clk[esdhc2_per_gate], "per", "sdhci-esdhc-imx53.1"); 575 clk_register_clkdev(clk[IMX5_CLK_ESDHC2_PER_GATE], "per", "sdhci-esdhc-imx53.1");
555 clk_register_clkdev(clk[esdhc3_ipg_gate], "ipg", "sdhci-esdhc-imx53.2"); 576 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_IPG_GATE], "ipg", "sdhci-esdhc-imx53.2");
556 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.2"); 577 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.2");
557 clk_register_clkdev(clk[esdhc3_per_gate], "per", "sdhci-esdhc-imx53.2"); 578 clk_register_clkdev(clk[IMX5_CLK_ESDHC3_PER_GATE], "per", "sdhci-esdhc-imx53.2");
558 clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx53.3"); 579 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_IPG_GATE], "ipg", "sdhci-esdhc-imx53.3");
559 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.3"); 580 clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.3");
560 clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx53.3"); 581 clk_register_clkdev(clk[IMX5_CLK_ESDHC4_PER_GATE], "per", "sdhci-esdhc-imx53.3");
561 582
562 /* set SDHC root clock to 200MHZ*/ 583 /* set SDHC root clock to 200MHZ*/
563 clk_set_rate(clk[esdhc_a_podf], 200000000); 584 clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
564 clk_set_rate(clk[esdhc_b_podf], 200000000); 585 clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
586
587 /* move can bus clk to 24MHz */
588 clk_set_parent(clk[IMX5_CLK_CAN_SEL], clk[IMX5_CLK_LP_APM]);
565 589
566 clk_prepare_enable(clk[iim_gate]); 590 clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
567 imx_print_silicon_rev("i.MX53", mx53_revision()); 591 imx_print_silicon_rev("i.MX53", mx53_revision());
568 clk_disable_unprepare(clk[iim_gate]); 592 clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
569 593
570 r = clk_round_rate(clk[usboh3_per_gate], 54000000); 594 r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
571 clk_set_rate(clk[usboh3_per_gate], r); 595 clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
572 596
573 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-gpt"); 597 np = of_find_compatible_node(NULL, NULL, "fsl,imx53-gpt");
574 base = of_iomap(np, 0); 598 base = of_iomap(np, 0);
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 04cfd0fcb0e5..af2e582d2b74 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -114,7 +114,7 @@ static struct clk *clk[clk_max];
114static struct clk_onecell_data clk_data; 114static struct clk_onecell_data clk_data;
115 115
116static enum mx6q_clks const clks_init_on[] __initconst = { 116static enum mx6q_clks const clks_init_on[] __initconst = {
117 mmdc_ch0_axi, rom, pll1_sys, 117 mmdc_ch0_axi, rom, arm,
118}; 118};
119 119
120static struct clk_div_table clk_enet_ref_table[] = { 120static struct clk_div_table clk_enet_ref_table[] = {
@@ -475,6 +475,9 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
475 if (ret) 475 if (ret)
476 pr_warn("failed to set up CLKO: %d\n", ret); 476 pr_warn("failed to set up CLKO: %d\n", ret);
477 477
478 /* Audio-related clocks configuration */
479 clk_set_parent(clk[spdif_sel], clk[pll3_pfd3_454m]);
480
478 /* All existing boards with PCIe use LVDS1 */ 481 /* All existing boards with PCIe use LVDS1 */
479 if (IS_ENABLED(CONFIG_PCI_IMX6)) 482 if (IS_ENABLED(CONFIG_PCI_IMX6))
480 clk_set_parent(clk[lvds1_sel], clk[sata_ref]); 483 clk_set_parent(clk[lvds1_sel], clk[sata_ref]);
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index c0c4ef55e35b..3781a1853998 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -29,14 +29,14 @@ static const char const *periph_sels[] = { "pre_periph_sel", "periph_clk2_podf"
29static const char const *periph2_sels[] = { "pre_periph2_sel", "periph2_clk2_podf", }; 29static const char const *periph2_sels[] = { "pre_periph2_sel", "periph2_clk2_podf", };
30static const char const *csi_lcdif_sels[] = { "mmdc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", }; 30static const char const *csi_lcdif_sels[] = { "mmdc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", };
31static const char const *usdhc_sels[] = { "pll2_pfd2", "pll2_pfd0", }; 31static const char const *usdhc_sels[] = { "pll2_pfd2", "pll2_pfd0", };
32static const char const *ssi_sels[] = { "pll3_pfd2", "pll3_pfd3", "pll4_post_div", "dummy", }; 32static const char const *ssi_sels[] = { "pll3_pfd2", "pll3_pfd3", "pll4_audio_div", "dummy", };
33static const char const *perclk_sels[] = { "ipg", "osc", }; 33static const char const *perclk_sels[] = { "ipg", "osc", };
34static const char const *epdc_pxp_sels[] = { "mmdc", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd1", }; 34static const char const *epdc_pxp_sels[] = { "mmdc", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd1", };
35static const char const *gpu2d_ovg_sels[] = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", }; 35static const char const *gpu2d_ovg_sels[] = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", };
36static const char const *gpu2d_sels[] = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", }; 36static const char const *gpu2d_sels[] = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", };
37static const char const *lcdif_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", }; 37static const char const *lcdif_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", };
38static const char const *epdc_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd1", "pll3_pfd1", }; 38static const char const *epdc_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd1", "pll3_pfd1", };
39static const char const *audio_sels[] = { "pll4_post_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", }; 39static const char const *audio_sels[] = { "pll4_audio_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", };
40static const char const *ecspi_sels[] = { "pll3_60m", "osc", }; 40static const char const *ecspi_sels[] = { "pll3_60m", "osc", };
41static const char const *uart_sels[] = { "pll3_80m", "osc", }; 41static const char const *uart_sels[] = { "pll3_80m", "osc", };
42 42
@@ -63,7 +63,7 @@ static struct clk_div_table video_div_table[] = {
63 { } 63 { }
64}; 64};
65 65
66static struct clk *clks[IMX6SL_CLK_CLK_END]; 66static struct clk *clks[IMX6SL_CLK_END];
67static struct clk_onecell_data clk_data; 67static struct clk_onecell_data clk_data;
68 68
69static void __init imx6sl_clocks_init(struct device_node *ccm_node) 69static void __init imx6sl_clocks_init(struct device_node *ccm_node)
@@ -104,6 +104,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
104 104
105 /* dev name parent_name flags reg shift width div: flags, div_table lock */ 105 /* dev name parent_name flags reg shift width div: flags, div_table lock */
106 clks[IMX6SL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 106 clks[IMX6SL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock);
107 clks[IMX6SL_CLK_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);
107 clks[IMX6SL_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 108 clks[IMX6SL_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock);
108 clks[IMX6SL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 109 clks[IMX6SL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock);
109 clks[IMX6SL_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock); 110 clks[IMX6SL_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock);
@@ -232,6 +233,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
232 clks[IMX6SL_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20); 233 clks[IMX6SL_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20);
233 clks[IMX6SL_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22); 234 clks[IMX6SL_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22);
234 clks[IMX6SL_CLK_SDMA] = imx_clk_gate2("sdma", "ipg", base + 0x7c, 6); 235 clks[IMX6SL_CLK_SDMA] = imx_clk_gate2("sdma", "ipg", base + 0x7c, 6);
236 clks[IMX6SL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
235 clks[IMX6SL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif0_podf", base + 0x7c, 14); 237 clks[IMX6SL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif0_podf", base + 0x7c, 14);
236 clks[IMX6SL_CLK_SSI1] = imx_clk_gate2("ssi1", "ssi1_podf", base + 0x7c, 18); 238 clks[IMX6SL_CLK_SSI1] = imx_clk_gate2("ssi1", "ssi1_podf", base + 0x7c, 18);
237 clks[IMX6SL_CLK_SSI2] = imx_clk_gate2("ssi2", "ssi2_podf", base + 0x7c, 20); 239 clks[IMX6SL_CLK_SSI2] = imx_clk_gate2("ssi2", "ssi2_podf", base + 0x7c, 20);
@@ -261,6 +263,9 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
261 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]); 263 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]);
262 } 264 }
263 265
266 /* Audio-related clocks configuration */
267 clk_set_parent(clks[IMX6SL_CLK_SPDIF0_SEL], clks[IMX6SL_CLK_PLL3_PFD3]);
268
264 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt"); 269 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt");
265 base = of_iomap(np, 0); 270 base = of_iomap(np, 0);
266 WARN_ON(!base); 271 WARN_ON(!base);
diff --git a/arch/arm/mach-imx/clk-pfd.c b/arch/arm/mach-imx/clk-pfd.c
index e2ed4160f329..0b0f6f66ec56 100644
--- a/arch/arm/mach-imx/clk-pfd.c
+++ b/arch/arm/mach-imx/clk-pfd.c
@@ -109,12 +109,23 @@ static int clk_pfd_set_rate(struct clk_hw *hw, unsigned long rate,
109 return 0; 109 return 0;
110} 110}
111 111
112static int clk_pfd_is_enabled(struct clk_hw *hw)
113{
114 struct clk_pfd *pfd = to_clk_pfd(hw);
115
116 if (readl_relaxed(pfd->reg) & (1 << ((pfd->idx + 1) * 8 - 1)))
117 return 0;
118
119 return 1;
120}
121
112static const struct clk_ops clk_pfd_ops = { 122static const struct clk_ops clk_pfd_ops = {
113 .enable = clk_pfd_enable, 123 .enable = clk_pfd_enable,
114 .disable = clk_pfd_disable, 124 .disable = clk_pfd_disable,
115 .recalc_rate = clk_pfd_recalc_rate, 125 .recalc_rate = clk_pfd_recalc_rate,
116 .round_rate = clk_pfd_round_rate, 126 .round_rate = clk_pfd_round_rate,
117 .set_rate = clk_pfd_set_rate, 127 .set_rate = clk_pfd_set_rate,
128 .is_enabled = clk_pfd_is_enabled,
118}; 129};
119 130
120struct clk *imx_clk_pfd(const char *name, const char *parent_name, 131struct clk *imx_clk_pfd(const char *name, const char *parent_name,
diff --git a/arch/arm/mach-imx/clk-pllv1.c b/arch/arm/mach-imx/clk-pllv1.c
index c1eaee346954..d21d14ca46c1 100644
--- a/arch/arm/mach-imx/clk-pllv1.c
+++ b/arch/arm/mach-imx/clk-pllv1.c
@@ -18,6 +18,11 @@
18 * 18 *
19 * PLL clock version 1, found on i.MX1/21/25/27/31/35 19 * PLL clock version 1, found on i.MX1/21/25/27/31/35
20 */ 20 */
21
22#define MFN_BITS (10)
23#define MFN_SIGN (BIT(MFN_BITS - 1))
24#define MFN_MASK (MFN_SIGN - 1)
25
21struct clk_pllv1 { 26struct clk_pllv1 {
22 struct clk_hw hw; 27 struct clk_hw hw;
23 void __iomem *base; 28 void __iomem *base;
@@ -25,6 +30,11 @@ struct clk_pllv1 {
25 30
26#define to_clk_pllv1(clk) (container_of(clk, struct clk_pllv1, clk)) 31#define to_clk_pllv1(clk) (container_of(clk, struct clk_pllv1, clk))
27 32
33static inline bool mfn_is_negative(unsigned int mfn)
34{
35 return !cpu_is_mx1() && !cpu_is_mx21() && (mfn & MFN_SIGN);
36}
37
28static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw, 38static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
29 unsigned long parent_rate) 39 unsigned long parent_rate)
30{ 40{
@@ -58,10 +68,15 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
58 68
59 /* 69 /*
60 * On all i.MXs except i.MX1 and i.MX21 mfn is a 10bit 70 * On all i.MXs except i.MX1 and i.MX21 mfn is a 10bit
61 * 2's complements number 71 * 2's complements number.
72 * On i.MX27 the bit 9 is the sign bit.
62 */ 73 */
63 if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200) 74 if (mfn_is_negative(mfn)) {
64 mfn_abs = 0x400 - mfn; 75 if (cpu_is_mx27())
76 mfn_abs = mfn & MFN_MASK;
77 else
78 mfn_abs = BIT(MFN_BITS) - mfn;
79 }
65 80
66 rate = parent_rate * 2; 81 rate = parent_rate * 2;
67 rate /= pd + 1; 82 rate /= pd + 1;
@@ -70,7 +85,7 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
70 85
71 do_div(ll, mfd + 1); 86 do_div(ll, mfd + 1);
72 87
73 if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200) 88 if (mfn_is_negative(mfn))
74 ll = -ll; 89 ll = -ll;
75 90
76 ll = (rate * mfi) + ll; 91 ll = (rate * mfi) + ll;
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index b169a396d93b..ecd66d8e20b6 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -298,6 +298,11 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
298 clk[VF610_CLK_FLEXCAN0] = imx_clk_gate2("flexcan0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(0)); 298 clk[VF610_CLK_FLEXCAN0] = imx_clk_gate2("flexcan0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(0));
299 clk[VF610_CLK_FLEXCAN1] = imx_clk_gate2("flexcan1", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(4)); 299 clk[VF610_CLK_FLEXCAN1] = imx_clk_gate2("flexcan1", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(4));
300 300
301 clk[VF610_CLK_DMAMUX0] = imx_clk_gate2("dmamux0", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(4));
302 clk[VF610_CLK_DMAMUX1] = imx_clk_gate2("dmamux1", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(5));
303 clk[VF610_CLK_DMAMUX2] = imx_clk_gate2("dmamux2", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(1));
304 clk[VF610_CLK_DMAMUX3] = imx_clk_gate2("dmamux3", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(2));
305
301 clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]); 306 clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]);
302 clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2); 307 clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2);
303 clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2); 308 clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 24a7899e36a8..59c3b9b26bb4 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -108,6 +108,7 @@ void tzic_handle_irq(struct pt_regs *);
108#define imx27_handle_irq avic_handle_irq 108#define imx27_handle_irq avic_handle_irq
109#define imx31_handle_irq avic_handle_irq 109#define imx31_handle_irq avic_handle_irq
110#define imx35_handle_irq avic_handle_irq 110#define imx35_handle_irq avic_handle_irq
111#define imx50_handle_irq tzic_handle_irq
111#define imx51_handle_irq tzic_handle_irq 112#define imx51_handle_irq tzic_handle_irq
112#define imx53_handle_irq tzic_handle_irq 113#define imx53_handle_irq tzic_handle_irq
113 114
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index 818a1cc2fe45..e1e70ef7bc2d 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -25,7 +25,7 @@ static void __init imx31_dt_init(void)
25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
26} 26}
27 27
28static const char *imx31_dt_board_compat[] __initdata = { 28static const char *imx31_dt_board_compat[] __initconst = {
29 "fsl,imx31", 29 "fsl,imx31",
30 NULL 30 NULL
31}; 31};
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
new file mode 100644
index 000000000000..9d48e0065a63
--- /dev/null
+++ b/arch/arm/mach-imx/imx35-dt.c
@@ -0,0 +1,50 @@
1/*
2 * Copyright 2012 Steffen Trumtrar, Pengutronix
3 *
4 * based on imx27-dt.c
5 *
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation.
9 */
10
11#include <linux/irq.h>
12#include <linux/irqdomain.h>
13#include <linux/of_irq.h>
14#include <linux/of_platform.h>
15#include <linux/clk-provider.h>
16#include <linux/clocksource.h>
17#include <asm/mach/arch.h>
18#include <asm/mach/time.h>
19#include <asm/hardware/cache-l2x0.h>
20#include "common.h"
21#include "mx35.h"
22
23static void __init imx35_dt_init(void)
24{
25 mxc_arch_reset_init_dt();
26
27 of_platform_populate(NULL, of_default_bus_match_table,
28 NULL, NULL);
29}
30
31static void __init imx35_irq_init(void)
32{
33 imx_init_l2cache();
34 mx35_init_irq();
35}
36
37static const char *imx35_dt_board_compat[] __initconst = {
38 "fsl,imx35",
39 NULL
40};
41
42DT_MACHINE_START(IMX35_DT, "Freescale i.MX35 (Device Tree Support)")
43 .map_io = mx35_map_io,
44 .init_early = imx35_init_early,
45 .init_irq = imx35_irq_init,
46 .handle_irq = imx35_handle_irq,
47 .init_machine = imx35_dt_init,
48 .dt_compat = imx35_dt_board_compat,
49 .restart = mxc_restart,
50MACHINE_END
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index bece8a65e6f0..0230d78d1413 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -29,7 +29,7 @@ static void __init imx51_dt_init(void)
29 platform_device_register_full(&devinfo); 29 platform_device_register_full(&devinfo);
30} 30}
31 31
32static const char *imx51_dt_board_compat[] __initdata = { 32static const char *imx51_dt_board_compat[] __initconst = {
33 "fsl,imx51", 33 "fsl,imx51",
34 NULL 34 NULL
35}; 35};
diff --git a/arch/arm/mach-imx/irq-common.h b/arch/arm/mach-imx/irq-common.h
index 5b2dabba330f..6e3175dc0c0a 100644
--- a/arch/arm/mach-imx/irq-common.h
+++ b/arch/arm/mach-imx/irq-common.h
@@ -24,7 +24,6 @@
24 24
25struct mxc_extra_irq 25struct mxc_extra_irq
26{ 26{
27 int (*set_priority)(unsigned char irq, unsigned char prio);
28 int (*set_irq_fiq)(unsigned int irq, unsigned int type); 27 int (*set_irq_fiq)(unsigned int irq, unsigned int type);
29}; 28};
30 29
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index 771362d1fbee..65e4c53e1554 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -53,7 +53,7 @@ static const struct imxi2c_platform_data
53}; 53};
54 54
55#define TSC2007_IRQGPIO IMX_GPIO_NR(3, 2) 55#define TSC2007_IRQGPIO IMX_GPIO_NR(3, 2)
56static int tsc2007_get_pendown_state(void) 56static int tsc2007_get_pendown_state(struct device *dev)
57{ 57{
58 return !gpio_get_value(TSC2007_IRQGPIO); 58 return !gpio_get_value(TSC2007_IRQGPIO);
59} 59}
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
index 9b5ddf5bbd33..1fba2b8e983f 100644
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c
@@ -121,7 +121,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
121 .flags = IMXUART_HAVE_RTSCTS, 121 .flags = IMXUART_HAVE_RTSCTS,
122}; 122};
123 123
124static int tsc2007_get_pendown_state(void) 124static int tsc2007_get_pendown_state(struct device *dev)
125{ 125{
126 if (mx51_revision() < IMX_CHIP_REVISION_3_0) 126 if (mx51_revision() < IMX_CHIP_REVISION_3_0)
127 return !gpio_get_value(TSC2007_IRQGPIO_REV2); 127 return !gpio_get_value(TSC2007_IRQGPIO_REV2);
diff --git a/arch/arm/mach-imx/mach-imx50.c b/arch/arm/mach-imx/mach-imx50.c
new file mode 100644
index 000000000000..77b77a92bb5d
--- /dev/null
+++ b/arch/arm/mach-imx/mach-imx50.c
@@ -0,0 +1,38 @@
1/*
2 * Copyright 2013 Greg Ungerer <gerg@uclinux.org>
3 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
4 * Copyright 2011 Linaro Ltd.
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14#include <linux/of_platform.h>
15#include <asm/mach/arch.h>
16
17#include "common.h"
18
19static void __init imx50_dt_init(void)
20{
21 mxc_arch_reset_init_dt();
22
23 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
24}
25
26static const char *imx50_dt_board_compat[] __initconst = {
27 "fsl,imx50",
28 NULL
29};
30
31DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
32 .map_io = mx53_map_io,
33 .init_irq = mx53_init_irq,
34 .handle_irq = imx50_handle_irq,
35 .init_machine = imx50_dt_init,
36 .dt_compat = imx50_dt_board_compat,
37 .restart = mxc_restart,
38MACHINE_END
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index c9c4d8d96931..65850908a4b4 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -31,7 +31,7 @@ static void __init imx53_dt_init(void)
31 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 31 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
32} 32}
33 33
34static const char *imx53_dt_board_compat[] __initdata = { 34static const char *imx53_dt_board_compat[] __initconst = {
35 "fsl,imx53", 35 "fsl,imx53",
36 NULL 36 NULL
37}; 37};
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index d0cfb225ec9a..76e5db4fce35 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -13,6 +13,7 @@
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clkdev.h> 14#include <linux/clkdev.h>
15#include <linux/cpu.h> 15#include <linux/cpu.h>
16#include <linux/delay.h>
16#include <linux/export.h> 17#include <linux/export.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/io.h> 19#include <linux/io.h>
@@ -23,6 +24,7 @@
23#include <linux/of_irq.h> 24#include <linux/of_irq.h>
24#include <linux/of_platform.h> 25#include <linux/of_platform.h>
25#include <linux/pm_opp.h> 26#include <linux/pm_opp.h>
27#include <linux/pci.h>
26#include <linux/phy.h> 28#include <linux/phy.h>
27#include <linux/reboot.h> 29#include <linux/reboot.h>
28#include <linux/regmap.h> 30#include <linux/regmap.h>
@@ -78,6 +80,34 @@ static int ksz9031rn_phy_fixup(struct phy_device *dev)
78 return 0; 80 return 0;
79} 81}
80 82
83/*
84 * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High
85 * as they are used for slots1-7 PERST#
86 */
87static void ventana_pciesw_early_fixup(struct pci_dev *dev)
88{
89 u32 dw;
90
91 if (!of_machine_is_compatible("gw,ventana"))
92 return;
93
94 if (dev->devfn != 0)
95 return;
96
97 pci_read_config_dword(dev, 0x62c, &dw);
98 dw |= 0xaaa8; // GPIO1-7 outputs
99 pci_write_config_dword(dev, 0x62c, dw);
100
101 pci_read_config_dword(dev, 0x644, &dw);
102 dw |= 0xfe; // GPIO1-7 output high
103 pci_write_config_dword(dev, 0x644, dw);
104
105 msleep(100);
106}
107DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, ventana_pciesw_early_fixup);
108DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, ventana_pciesw_early_fixup);
109DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, ventana_pciesw_early_fixup);
110
81static int ar8031_phy_fixup(struct phy_device *dev) 111static int ar8031_phy_fixup(struct phy_device *dev)
82{ 112{
83 u16 val; 113 u16 val;
@@ -103,6 +133,39 @@ static int ar8031_phy_fixup(struct phy_device *dev)
103 133
104#define PHY_ID_AR8031 0x004dd074 134#define PHY_ID_AR8031 0x004dd074
105 135
136static int ar8035_phy_fixup(struct phy_device *dev)
137{
138 u16 val;
139
140 /* Ar803x phy SmartEEE feature cause link status generates glitch,
141 * which cause ethernet link down/up issue, so disable SmartEEE
142 */
143 phy_write(dev, 0xd, 0x3);
144 phy_write(dev, 0xe, 0x805d);
145 phy_write(dev, 0xd, 0x4003);
146
147 val = phy_read(dev, 0xe);
148 phy_write(dev, 0xe, val & ~(1 << 8));
149
150 /*
151 * Enable 125MHz clock from CLK_25M on the AR8031. This
152 * is fed in to the IMX6 on the ENET_REF_CLK (V22) pad.
153 * Also, introduce a tx clock delay.
154 *
155 * This is the same as is the AR8031 fixup.
156 */
157 ar8031_phy_fixup(dev);
158
159 /*check phy power*/
160 val = phy_read(dev, 0x0);
161 if (val & BMCR_PDOWN)
162 phy_write(dev, 0x0, val & ~BMCR_PDOWN);
163
164 return 0;
165}
166
167#define PHY_ID_AR8035 0x004dd072
168
106static void __init imx6q_enet_phy_init(void) 169static void __init imx6q_enet_phy_init(void)
107{ 170{
108 if (IS_BUILTIN(CONFIG_PHYLIB)) { 171 if (IS_BUILTIN(CONFIG_PHYLIB)) {
@@ -112,6 +175,8 @@ static void __init imx6q_enet_phy_init(void)
112 ksz9031rn_phy_fixup); 175 ksz9031rn_phy_fixup);
113 phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, 176 phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff,
114 ar8031_phy_fixup); 177 ar8031_phy_fixup);
178 phy_register_fixup_for_uid(PHY_ID_AR8035, 0xffffffef,
179 ar8035_phy_fixup);
115 } 180 }
116} 181}
117 182
@@ -243,7 +308,7 @@ static void __init imx6q_init_irq(void)
243 irqchip_init(); 308 irqchip_init();
244} 309}
245 310
246static const char *imx6q_dt_compat[] __initdata = { 311static const char *imx6q_dt_compat[] __initconst = {
247 "fsl,imx6dl", 312 "fsl,imx6dl",
248 "fsl,imx6q", 313 "fsl,imx6q",
249 NULL, 314 NULL,
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index 2f952e3fcf89..0f4fd4c0ab8e 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -34,6 +34,13 @@ static void __init imx6sl_fec_init(void)
34 } 34 }
35} 35}
36 36
37static void __init imx6sl_init_late(void)
38{
39 /* imx6sl reuses imx6q cpufreq driver */
40 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
41 platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
42}
43
37static void __init imx6sl_init_machine(void) 44static void __init imx6sl_init_machine(void)
38{ 45{
39 struct device *parent; 46 struct device *parent;
@@ -61,7 +68,7 @@ static void __init imx6sl_init_irq(void)
61 irqchip_init(); 68 irqchip_init();
62} 69}
63 70
64static const char *imx6sl_dt_compat[] __initdata = { 71static const char *imx6sl_dt_compat[] __initconst = {
65 "fsl,imx6sl", 72 "fsl,imx6sl",
66 NULL, 73 NULL,
67}; 74};
@@ -70,6 +77,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
70 .map_io = debug_ll_io_init, 77 .map_io = debug_ll_io_init,
71 .init_irq = imx6sl_init_irq, 78 .init_irq = imx6sl_init_irq,
72 .init_machine = imx6sl_init_machine, 79 .init_machine = imx6sl_init_machine,
80 .init_late = imx6sl_init_late,
73 .dt_compat = imx6sl_dt_compat, 81 .dt_compat = imx6sl_dt_compat,
74 .restart = mxc_restart, 82 .restart = mxc_restart,
75MACHINE_END 83MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 6f424eced181..b3738e616f19 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -236,32 +236,26 @@ static struct mc13xxx_led_platform_data moboard_led[] = {
236 { 236 {
237 .id = MC13783_LED_R1, 237 .id = MC13783_LED_R1,
238 .name = "coreboard-led-4:red", 238 .name = "coreboard-led-4:red",
239 .max_current = 2,
240 }, 239 },
241 { 240 {
242 .id = MC13783_LED_G1, 241 .id = MC13783_LED_G1,
243 .name = "coreboard-led-4:green", 242 .name = "coreboard-led-4:green",
244 .max_current = 2,
245 }, 243 },
246 { 244 {
247 .id = MC13783_LED_B1, 245 .id = MC13783_LED_B1,
248 .name = "coreboard-led-4:blue", 246 .name = "coreboard-led-4:blue",
249 .max_current = 2,
250 }, 247 },
251 { 248 {
252 .id = MC13783_LED_R2, 249 .id = MC13783_LED_R2,
253 .name = "coreboard-led-5:red", 250 .name = "coreboard-led-5:red",
254 .max_current = 3,
255 }, 251 },
256 { 252 {
257 .id = MC13783_LED_G2, 253 .id = MC13783_LED_G2,
258 .name = "coreboard-led-5:green", 254 .name = "coreboard-led-5:green",
259 .max_current = 3,
260 }, 255 },
261 { 256 {
262 .id = MC13783_LED_B2, 257 .id = MC13783_LED_B2,
263 .name = "coreboard-led-5:blue", 258 .name = "coreboard-led-5:blue",
264 .max_current = 3,
265 }, 259 },
266}; 260};
267 261
@@ -271,8 +265,14 @@ static struct mc13xxx_leds_platform_data moboard_leds = {
271 .led_control[0] = MC13783_LED_C0_ENABLE | MC13783_LED_C0_ABMODE(0), 265 .led_control[0] = MC13783_LED_C0_ENABLE | MC13783_LED_C0_ABMODE(0),
272 .led_control[1] = MC13783_LED_C1_SLEWLIM, 266 .led_control[1] = MC13783_LED_C1_SLEWLIM,
273 .led_control[2] = MC13783_LED_C2_SLEWLIM, 267 .led_control[2] = MC13783_LED_C2_SLEWLIM,
274 .led_control[3] = MC13783_LED_C3_PERIOD(0), 268 .led_control[3] = MC13783_LED_C3_PERIOD(0) |
275 .led_control[4] = MC13783_LED_C3_PERIOD(0), 269 MC13783_LED_C3_CURRENT_R1(2) |
270 MC13783_LED_C3_CURRENT_G1(2) |
271 MC13783_LED_C3_CURRENT_B1(2),
272 .led_control[4] = MC13783_LED_C4_PERIOD(0) |
273 MC13783_LED_C4_CURRENT_R2(3) |
274 MC13783_LED_C4_CURRENT_G2(3) |
275 MC13783_LED_C4_CURRENT_B2(3),
276}; 276};
277 277
278static struct mc13xxx_buttons_platform_data moboard_buttons = { 278static struct mc13xxx_buttons_platform_data moboard_buttons = {
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index c5f95674e9b7..bf3ac51d5aca 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -249,7 +249,7 @@ static int pca100_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
249 "imx-mmc-detect", data); 249 "imx-mmc-detect", data);
250 if (ret) 250 if (ret)
251 printk(KERN_ERR 251 printk(KERN_ERR
252 "pca100: Failed to reuest irq for sd/mmc detection\n"); 252 "pca100: Failed to request irq for sd/mmc detection\n");
253 253
254 return ret; 254 return ret;
255} 255}
diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c
index af0cb8a9dc48..2d8aef5a6efa 100644
--- a/arch/arm/mach-imx/mach-vf610.c
+++ b/arch/arm/mach-imx/mach-vf610.c
@@ -26,7 +26,7 @@ static void __init vf610_init_irq(void)
26 irqchip_init(); 26 irqchip_init();
27} 27}
28 28
29static const char *vf610_dt_compat[] __initdata = { 29static const char *vf610_dt_compat[] __initconst = {
30 "fsl,vf610", 30 "fsl,vf610",
31 NULL, 31 NULL,
32}; 32};
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index d1d52600f458..4c112021aa4e 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -89,15 +89,7 @@ void __init imx51_init_early(void)
89 89
90void __init imx53_init_early(void) 90void __init imx53_init_early(void)
91{ 91{
92 struct device_node *np;
93 void __iomem *base;
94
95 mxc_set_cpu_type(MXC_CPU_MX53); 92 mxc_set_cpu_type(MXC_CPU_MX53);
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);
101 imx_src_init(); 93 imx_src_init();
102} 94}
103 95
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 1f24c1fdfea4..5b57c17c06bd 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -92,8 +92,7 @@ static void __init imx_smp_prepare_cpus(unsigned int max_cpus)
92 * secondary cores when booting them. 92 * secondary cores when booting them.
93 */ 93 */
94 asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (g_diag_reg) : : "cc"); 94 asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (g_diag_reg) : : "cc");
95 __cpuc_flush_dcache_area(&g_diag_reg, sizeof(g_diag_reg)); 95 sync_cache_w(&g_diag_reg);
96 outer_clean_range(__pa(&g_diag_reg), __pa(&g_diag_reg + 1));
97} 96}
98 97
99struct smp_operations imx_smp_ops __initdata = { 98struct smp_operations imx_smp_ops __initdata = {
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
index aecd9f8037e0..9d47adc078aa 100644
--- a/arch/arm/mach-imx/pm-imx6q.c
+++ b/arch/arm/mach-imx/pm-imx6q.c
@@ -156,10 +156,16 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
156 } 156 }
157 157
158 /* 158 /*
159 * Unmask the always pending IOMUXC interrupt #32 as wakeup source to 159 * ERR007265: CCM: When improper low-power sequence is used,
160 * deassert dsm_request signal, so that we can ensure dsm_request 160 * the SoC enters low power mode before the ARM core executes WFI.
161 * is not asserted when we're going to write CLPCR register to set LPM. 161 *
162 * After setting up LPM bits, we need to mask this wakeup source. 162 * Software workaround:
163 * 1) Software should trigger IRQ #32 (IOMUX) to be always pending
164 * by setting IOMUX_GPR1_GINT.
165 * 2) Software should then unmask IRQ #32 in GPC before setting CCM
166 * Low-Power mode.
167 * 3) Software should mask IRQ #32 right after CCM Low-Power mode
168 * is set (set bits 0-1 of CCM_CLPCR).
163 */ 169 */
164 iomuxc_irq_desc = irq_to_desc(32); 170 iomuxc_irq_desc = irq_to_desc(32);
165 imx_gpc_irq_unmask(&iomuxc_irq_desc->irq_data); 171 imx_gpc_irq_unmask(&iomuxc_irq_desc->irq_data);
@@ -219,6 +225,8 @@ void __init imx6q_pm_init(void)
219 WARN_ON(!ccm_base); 225 WARN_ON(!ccm_base);
220 226
221 /* 227 /*
228 * This is for SW workaround step #1 of ERR007265, see comments
229 * in imx6q_set_lpm for details of this errata.
222 * Force IOMUXC irq pending, so that the interrupt to GPC can be 230 * Force IOMUXC irq pending, so that the interrupt to GPC can be
223 * used to deassert dsm_request signal when the signal gets 231 * used to deassert dsm_request signal when the signal gets
224 * asserted unexpectedly. 232 * asserted unexpectedly.
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index 9b6638aadeaa..1a3a5f615770 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -111,7 +111,7 @@ static void gpt_irq_acknowledge(void)
111 111
112static void __iomem *sched_clock_reg; 112static void __iomem *sched_clock_reg;
113 113
114static u32 notrace mxc_read_sched_clock(void) 114static u64 notrace mxc_read_sched_clock(void)
115{ 115{
116 return sched_clock_reg ? __raw_readl(sched_clock_reg) : 0; 116 return sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
117} 117}
@@ -123,7 +123,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
123 123
124 sched_clock_reg = reg; 124 sched_clock_reg = reg;
125 125
126 setup_sched_clock(mxc_read_sched_clock, 32, c); 126 sched_clock_register(mxc_read_sched_clock, 32, c);
127 return clocksource_mmio_init(reg, "mxc_timer1", c, 200, 32, 127 return clocksource_mmio_init(reg, "mxc_timer1", c, 200, 32,
128 clocksource_mmio_readl_up); 128 clocksource_mmio_readl_up);
129} 129}
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index d50dc2dbfd89..17c0fe627435 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -63,6 +63,9 @@
63 63
64/* Base address to the AP system controller */ 64/* Base address to the AP system controller */
65void __iomem *ap_syscon_base; 65void __iomem *ap_syscon_base;
66/* Base address to the external bus interface */
67static void __iomem *ebi_base;
68
66 69
67/* 70/*
68 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx 71 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
@@ -72,15 +75,11 @@ void __iomem *ap_syscon_base;
72 * just for now). 75 * just for now).
73 */ 76 */
74#define VA_IC_BASE __io_address(INTEGRATOR_IC_BASE) 77#define VA_IC_BASE __io_address(INTEGRATOR_IC_BASE)
75#define VA_EBI_BASE __io_address(INTEGRATOR_EBI_BASE)
76#define VA_CMIC_BASE __io_address(INTEGRATOR_HDR_IC)
77 78
78/* 79/*
79 * Logical Physical 80 * Logical Physical
80 * ef000000 Cache flush 81 * ef000000 Cache flush
81 * f1000000 10000000 Core module registers
82 * f1100000 11000000 System controller registers 82 * f1100000 11000000 System controller registers
83 * f1200000 12000000 EBI registers
84 * f1300000 13000000 Counter/Timer 83 * f1300000 13000000 Counter/Timer
85 * f1400000 14000000 Interrupt controller 84 * f1400000 14000000 Interrupt controller
86 * f1600000 16000000 UART 0 85 * f1600000 16000000 UART 0
@@ -91,16 +90,6 @@ void __iomem *ap_syscon_base;
91 90
92static struct map_desc ap_io_desc[] __initdata __maybe_unused = { 91static struct map_desc ap_io_desc[] __initdata __maybe_unused = {
93 { 92 {
94 .virtual = IO_ADDRESS(INTEGRATOR_HDR_BASE),
95 .pfn = __phys_to_pfn(INTEGRATOR_HDR_BASE),
96 .length = SZ_4K,
97 .type = MT_DEVICE
98 }, {
99 .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE),
100 .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE),
101 .length = SZ_4K,
102 .type = MT_DEVICE
103 }, {
104 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE), 93 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE),
105 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE), 94 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE),
106 .length = SZ_4K, 95 .length = SZ_4K,
@@ -174,9 +163,6 @@ device_initcall(irq_syscore_init);
174/* 163/*
175 * Flash handling. 164 * Flash handling.
176 */ 165 */
177#define EBI_CSR1 (VA_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET)
178#define EBI_LOCK (VA_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET)
179
180static int ap_flash_init(struct platform_device *dev) 166static int ap_flash_init(struct platform_device *dev)
181{ 167{
182 u32 tmp; 168 u32 tmp;
@@ -184,13 +170,15 @@ static int ap_flash_init(struct platform_device *dev)
184 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, 170 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
185 ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET); 171 ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
186 172
187 tmp = readl(EBI_CSR1) | INTEGRATOR_EBI_WRITE_ENABLE; 173 tmp = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) |
188 writel(tmp, EBI_CSR1); 174 INTEGRATOR_EBI_WRITE_ENABLE;
175 writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
189 176
190 if (!(readl(EBI_CSR1) & INTEGRATOR_EBI_WRITE_ENABLE)) { 177 if (!(readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET)
191 writel(0xa05f, EBI_LOCK); 178 & INTEGRATOR_EBI_WRITE_ENABLE)) {
192 writel(tmp, EBI_CSR1); 179 writel(0xa05f, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
193 writel(0, EBI_LOCK); 180 writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
181 writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
194 } 182 }
195 return 0; 183 return 0;
196} 184}
@@ -202,13 +190,15 @@ static void ap_flash_exit(struct platform_device *dev)
202 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, 190 writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
203 ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET); 191 ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
204 192
205 tmp = readl(EBI_CSR1) & ~INTEGRATOR_EBI_WRITE_ENABLE; 193 tmp = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) &
206 writel(tmp, EBI_CSR1); 194 ~INTEGRATOR_EBI_WRITE_ENABLE;
195 writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
207 196
208 if (readl(EBI_CSR1) & INTEGRATOR_EBI_WRITE_ENABLE) { 197 if (readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) &
209 writel(0xa05f, EBI_LOCK); 198 INTEGRATOR_EBI_WRITE_ENABLE) {
210 writel(tmp, EBI_CSR1); 199 writel(0xa05f, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
211 writel(0, EBI_LOCK); 200 writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
201 writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
212 } 202 }
213} 203}
214 204
@@ -277,7 +267,7 @@ struct amba_pl010_data ap_uart_data = {
277 267
278static unsigned long timer_reload; 268static unsigned long timer_reload;
279 269
280static u32 notrace integrator_read_sched_clock(void) 270static u64 notrace integrator_read_sched_clock(void)
281{ 271{
282 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE); 272 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE);
283} 273}
@@ -298,7 +288,7 @@ static void integrator_clocksource_init(unsigned long inrate,
298 288
299 clocksource_mmio_init(base + TIMER_VALUE, "timer2", 289 clocksource_mmio_init(base + TIMER_VALUE, "timer2",
300 rate, 200, 16, clocksource_mmio_readl_down); 290 rate, 200, 16, clocksource_mmio_readl_down);
301 setup_sched_clock(integrator_read_sched_clock, 16, rate); 291 sched_clock_register(integrator_read_sched_clock, 16, rate);
302} 292}
303 293
304static void __iomem * clkevt_base; 294static void __iomem * clkevt_base;
@@ -475,11 +465,17 @@ static const struct of_device_id ap_syscon_match[] = {
475 { }, 465 { },
476}; 466};
477 467
468static const struct of_device_id ebi_match[] = {
469 { .compatible = "arm,external-bus-interface"},
470 { },
471};
472
478static void __init ap_init_of(void) 473static void __init ap_init_of(void)
479{ 474{
480 unsigned long sc_dec; 475 unsigned long sc_dec;
481 struct device_node *root; 476 struct device_node *root;
482 struct device_node *syscon; 477 struct device_node *syscon;
478 struct device_node *ebi;
483 struct device *parent; 479 struct device *parent;
484 struct soc_device *soc_dev; 480 struct soc_device *soc_dev;
485 struct soc_device_attribute *soc_dev_attr; 481 struct soc_device_attribute *soc_dev_attr;
@@ -495,10 +491,16 @@ static void __init ap_init_of(void)
495 syscon = of_find_matching_node(root, ap_syscon_match); 491 syscon = of_find_matching_node(root, ap_syscon_match);
496 if (!syscon) 492 if (!syscon)
497 return; 493 return;
494 ebi = of_find_matching_node(root, ebi_match);
495 if (!ebi)
496 return;
498 497
499 ap_syscon_base = of_iomap(syscon, 0); 498 ap_syscon_base = of_iomap(syscon, 0);
500 if (!ap_syscon_base) 499 if (!ap_syscon_base)
501 return; 500 return;
501 ebi_base = of_iomap(ebi, 0);
502 if (!ebi_base)
503 return;
502 504
503 ap_sc_id = readl(ap_syscon_base); 505 ap_sc_id = readl(ap_syscon_base);
504 506
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 4fc0a195de01..a3ef961e4a93 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -65,8 +65,6 @@ static void __iomem *intcp_con_base;
65/* 65/*
66 * Logical Physical 66 * Logical Physical
67 * f1000000 10000000 Core module registers 67 * f1000000 10000000 Core module registers
68 * f1100000 11000000 System controller registers
69 * f1200000 12000000 EBI registers
70 * f1300000 13000000 Counter/Timer 68 * f1300000 13000000 Counter/Timer
71 * f1400000 14000000 Interrupt controller 69 * f1400000 14000000 Interrupt controller
72 * f1600000 16000000 UART 0 70 * f1600000 16000000 UART 0
@@ -74,7 +72,6 @@ static void __iomem *intcp_con_base;
74 * f1a00000 1a000000 Debug LEDs 72 * f1a00000 1a000000 Debug LEDs
75 * fc900000 c9000000 GPIO 73 * fc900000 c9000000 GPIO
76 * fca00000 ca000000 SIC 74 * fca00000 ca000000 SIC
77 * fcb00000 cb000000 CP system control
78 */ 75 */
79 76
80static struct map_desc intcp_io_desc[] __initdata __maybe_unused = { 77static struct map_desc intcp_io_desc[] __initdata __maybe_unused = {
@@ -84,11 +81,6 @@ static struct map_desc intcp_io_desc[] __initdata __maybe_unused = {
84 .length = SZ_4K, 81 .length = SZ_4K,
85 .type = MT_DEVICE 82 .type = MT_DEVICE
86 }, { 83 }, {
87 .virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE),
88 .pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE),
89 .length = SZ_4K,
90 .type = MT_DEVICE
91 }, {
92 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE), 84 .virtual = IO_ADDRESS(INTEGRATOR_CT_BASE),
93 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE), 85 .pfn = __phys_to_pfn(INTEGRATOR_CT_BASE),
94 .length = SZ_4K, 86 .length = SZ_4K,
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index 177cd073a83b..77e1ff057303 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -23,6 +23,7 @@
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/gpio.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <linux/io.h> 28#include <linux/io.h>
28#include <linux/irq.h> 29#include <linux/irq.h>
@@ -176,11 +177,35 @@ static struct platform_device em7210_serial_device = {
176 .resource = &em7210_uart_resource, 177 .resource = &em7210_uart_resource,
177}; 178};
178 179
180#define EM7210_HARDWARE_POWER 0
181
179void em7210_power_off(void) 182void em7210_power_off(void)
180{ 183{
181 *IOP3XX_GPOE &= 0xfe; 184 int ret;
182 *IOP3XX_GPOD |= 0x01; 185
186 ret = gpio_direction_output(EM7210_HARDWARE_POWER, 1);
187 if (ret)
188 pr_crit("could not drive power off GPIO high\n");
189}
190
191static int __init em7210_request_gpios(void)
192{
193 int ret;
194
195 if (!machine_is_em7210())
196 return 0;
197
198 ret = gpio_request(EM7210_HARDWARE_POWER, "power");
199 if (ret) {
200 pr_err("could not request power off GPIO\n");
201 return 0;
202 }
203
204 pm_power_off = em7210_power_off;
205
206 return 0;
183} 207}
208device_initcall(em7210_request_gpios);
184 209
185static void __init em7210_init_machine(void) 210static void __init em7210_init_machine(void)
186{ 211{
@@ -194,9 +219,6 @@ static void __init em7210_init_machine(void)
194 219
195 i2c_register_board_info(0, em7210_i2c_devices, 220 i2c_register_board_info(0, em7210_i2c_devices,
196 ARRAY_SIZE(em7210_i2c_devices)); 221 ARRAY_SIZE(em7210_i2c_devices));
197
198
199 pm_power_off = em7210_power_off;
200} 222}
201 223
202MACHINE_START(EM7210, "Lanner EM7210") 224MACHINE_START(EM7210, "Lanner EM7210")
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 6d6bde3e15fa..200970d56f6d 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -326,7 +326,7 @@ static int ixp4xx_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t s
326 */ 326 */
327static int ixp4xx_pci_platform_notify(struct device *dev) 327static int ixp4xx_pci_platform_notify(struct device *dev)
328{ 328{
329 if(dev->bus == &pci_bus_type) { 329 if (dev_is_pci(dev)) {
330 *dev->dma_mask = SZ_64M - 1; 330 *dev->dma_mask = SZ_64M - 1;
331 dev->coherent_dma_mask = SZ_64M - 1; 331 dev->coherent_dma_mask = SZ_64M - 1;
332 dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce); 332 dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce);
@@ -336,9 +336,9 @@ static int ixp4xx_pci_platform_notify(struct device *dev)
336 336
337static int ixp4xx_pci_platform_notify_remove(struct device *dev) 337static int ixp4xx_pci_platform_notify_remove(struct device *dev)
338{ 338{
339 if(dev->bus == &pci_bus_type) { 339 if (dev_is_pci(dev))
340 dmabounce_unregister_dev(dev); 340 dmabounce_unregister_dev(dev);
341 } 341
342 return 0; 342 return 0;
343} 343}
344 344
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 9edaf4734fa8..6d68aed6548a 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -475,7 +475,7 @@ void __init ixp4xx_sys_init(void)
475/* 475/*
476 * sched_clock() 476 * sched_clock()
477 */ 477 */
478static u32 notrace ixp4xx_read_sched_clock(void) 478static u64 notrace ixp4xx_read_sched_clock(void)
479{ 479{
480 return *IXP4XX_OSTS; 480 return *IXP4XX_OSTS;
481} 481}
@@ -493,7 +493,7 @@ unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
493EXPORT_SYMBOL(ixp4xx_timer_freq); 493EXPORT_SYMBOL(ixp4xx_timer_freq);
494static void __init ixp4xx_clocksource_init(void) 494static void __init ixp4xx_clocksource_init(void)
495{ 495{
496 setup_sched_clock(ixp4xx_read_sched_clock, 32, ixp4xx_timer_freq); 496 sched_clock_register(ixp4xx_read_sched_clock, 32, ixp4xx_timer_freq);
497 497
498 clocksource_mmio_init(NULL, "OSTS", ixp4xx_timer_freq, 200, 32, 498 clocksource_mmio_init(NULL, "OSTS", ixp4xx_timer_freq, 200, 32,
499 ixp4xx_clocksource_read); 499 ixp4xx_clocksource_read);
@@ -560,7 +560,7 @@ static void __init ixp4xx_clockevent_init(void)
560 560
561void ixp4xx_restart(enum reboot_mode mode, const char *cmd) 561void ixp4xx_restart(enum reboot_mode mode, const char *cmd)
562{ 562{
563 if ( 1 && mode == REBOOT_SOFT) { 563 if (mode == REBOOT_SOFT) {
564 /* Jump into ROM at address 0 */ 564 /* Jump into ROM at address 0 */
565 soft_restart(0); 565 soft_restart(0);
566 } else { 566 } else {
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index f20c53e75ed9..90a708fef541 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -10,7 +10,8 @@ config ARCH_KEYSTONE
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 12 select COMMON_CLK_KEYSTONE
13 select TI_EDMA 13 select ARCH_SUPPORTS_BIG_ENDIAN
14 select ZONE_DMA if ARM_LPAE
14 help 15 help
15 Support for boards based on the Texas Instruments Keystone family of 16 Support for boards based on the Texas Instruments Keystone family of
16 SoCs. 17 SoCs.
diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index b661c5c2870a..6e6bb7d5ea30 100644
--- a/arch/arm/mach-keystone/keystone.c
+++ b/arch/arm/mach-keystone/keystone.c
@@ -41,6 +41,7 @@ static void __init keystone_init(void)
41 if (WARN_ON(!keystone_rstctrl)) 41 if (WARN_ON(!keystone_rstctrl))
42 pr_warn("ti,keystone-reset iomap error\n"); 42 pr_warn("ti,keystone-reset iomap error\n");
43 43
44 keystone_pm_runtime_init();
44 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 45 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
45} 46}
46 47
@@ -68,6 +69,9 @@ void keystone_restart(enum reboot_mode mode, const char *cmd)
68} 69}
69 70
70DT_MACHINE_START(KEYSTONE, "Keystone") 71DT_MACHINE_START(KEYSTONE, "Keystone")
72#if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
73 .dma_zone_size = SZ_2G,
74#endif
71 .smp = smp_ops(keystone_smp_ops), 75 .smp = smp_ops(keystone_smp_ops),
72 .init_machine = keystone_init, 76 .init_machine = keystone_init,
73 .dt_compat = keystone_match, 77 .dt_compat = keystone_match,
diff --git a/arch/arm/mach-keystone/keystone.h b/arch/arm/mach-keystone/keystone.h
index 60bef9dedb12..cd04a1c14de8 100644
--- a/arch/arm/mach-keystone/keystone.h
+++ b/arch/arm/mach-keystone/keystone.h
@@ -18,6 +18,7 @@
18extern struct smp_operations keystone_smp_ops; 18extern struct smp_operations keystone_smp_ops;
19extern void secondary_startup(void); 19extern void secondary_startup(void);
20extern u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr); 20extern u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr);
21extern int keystone_pm_runtime_init(void);
21 22
22#endif /* __ASSEMBLER__ */ 23#endif /* __ASSEMBLER__ */
23#endif /* __KEYSTONE_H__ */ 24#endif /* __KEYSTONE_H__ */
diff --git a/arch/arm/mach-keystone/pm_domain.c b/arch/arm/mach-keystone/pm_domain.c
index 29625232e954..ca79ddac38bc 100644
--- a/arch/arm/mach-keystone/pm_domain.c
+++ b/arch/arm/mach-keystone/pm_domain.c
@@ -74,9 +74,7 @@ int __init keystone_pm_runtime_init(void)
74 if (!np) 74 if (!np)
75 return 0; 75 return 0;
76 76
77 of_clk_init(NULL);
78 pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier); 77 pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);
79 78
80 return 0; 79 return 0;
81} 80}
82subsys_initcall(keystone_pm_runtime_init);
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 9caa4fe95913..78188159484d 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -10,55 +10,21 @@
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/clk.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/of.h> 16#include <linux/of.h>
16#include <linux/of_address.h> 17#include <linux/of_address.h>
17#include <linux/of_net.h> 18#include <linux/of_net.h>
18#include <linux/of_platform.h> 19#include <linux/of_platform.h>
19#include <linux/clk-provider.h>
20#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
21#include <linux/irqchip.h> 21#include <linux/irqchip.h>
22#include <linux/kexec.h> 22#include <linux/kexec.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <mach/bridge-regs.h> 24#include <mach/bridge-regs.h>
26#include <linux/platform_data/usb-ehci-orion.h>
27#include <plat/irq.h>
28#include <plat/common.h> 25#include <plat/common.h>
29#include "common.h" 26#include "common.h"
30 27
31/*
32 * There are still devices that doesn't know about DT yet. Get clock
33 * gates here and add a clock lookup alias, so that old platform
34 * devices still work.
35*/
36
37static void __init kirkwood_legacy_clk_init(void)
38{
39
40 struct device_node *np = of_find_compatible_node(
41 NULL, NULL, "marvell,kirkwood-gating-clock");
42 struct of_phandle_args clkspec;
43 struct clk *clk;
44
45 clkspec.np = np;
46 clkspec.args_count = 1;
47
48 /*
49 * The ethernet interfaces forget the MAC address assigned by
50 * u-boot if the clocks are turned off. Until proper DT support
51 * is available we always enable them for now.
52 */
53 clkspec.args[0] = CGC_BIT_GE0;
54 clk = of_clk_get_from_provider(&clkspec);
55 clk_prepare_enable(clk);
56
57 clkspec.args[0] = CGC_BIT_GE1;
58 clk = of_clk_get_from_provider(&clkspec);
59 clk_prepare_enable(clk);
60}
61
62#define MV643XX_ETH_MAC_ADDR_LOW 0x0414 28#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
63#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 29#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
64 30
@@ -140,7 +106,7 @@ eth_fixup_skip:
140 106
141static void __init kirkwood_dt_init(void) 107static void __init kirkwood_dt_init(void)
142{ 108{
143 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); 109 pr_info("Kirkwood: %s.\n", kirkwood_id());
144 110
145 /* 111 /*
146 * Disable propagation of mbus errors to the CPU local bus, 112 * Disable propagation of mbus errors to the CPU local bus,
@@ -156,8 +122,6 @@ static void __init kirkwood_dt_init(void)
156 122
157 kirkwood_cpufreq_init(); 123 kirkwood_cpufreq_init();
158 kirkwood_cpuidle_init(); 124 kirkwood_cpuidle_init();
159 /* Setup clocks for legacy devices */
160 kirkwood_legacy_clk_init();
161 125
162 kirkwood_pm_init(); 126 kirkwood_pm_init();
163 kirkwood_dt_eth_fixup(); 127 kirkwood_dt_eth_fixup();
diff --git a/arch/arm/mach-kirkwood/pm.c b/arch/arm/mach-kirkwood/pm.c
index 8783a7184e73..c6ab8d9303a5 100644
--- a/arch/arm/mach-kirkwood/pm.c
+++ b/arch/arm/mach-kirkwood/pm.c
@@ -18,6 +18,7 @@
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <mach/bridge-regs.h> 20#include <mach/bridge-regs.h>
21#include "common.h"
21 22
22static void __iomem *ddr_operation_base; 23static void __iomem *ddr_operation_base;
23 24
@@ -65,9 +66,8 @@ static const struct platform_suspend_ops kirkwood_suspend_ops = {
65 .valid = kirkwood_pm_valid_standby, 66 .valid = kirkwood_pm_valid_standby,
66}; 67};
67 68
68int __init kirkwood_pm_init(void) 69void __init kirkwood_pm_init(void)
69{ 70{
70 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4); 71 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
71 suspend_set_ops(&kirkwood_suspend_ops); 72 suspend_set_ops(&kirkwood_suspend_ops);
72 return 0;
73} 73}
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
deleted file mode 100644
index f5fda36e4512..000000000000
--- a/arch/arm/mach-ks8695/include/mach/gpio.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/gpio.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_GPIO_H_
12#define __ASM_ARCH_GPIO_H_
13
14/*
15 * Map IRQ number to GPIO line.
16 */
17extern int irq_to_gpio(unsigned int irq);
18
19#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
deleted file mode 100644
index a544e962a818..000000000000
--- a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Author: Kevin Wells <kevin.wells@nxp.com>
3 *
4 * Copyright (C) 2010 NXP Semiconductors
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __MACH_GPIO_LPC32XX_H
18#define __MACH_GPIO_LPC32XX_H
19
20/*
21 * Note!
22 * Muxed GP pins need to be setup to the GP state in the board level
23 * code prior to using this driver.
24 * GPI pins : 28xP3 group
25 * GPO pins : 24xP3 group
26 * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
27 */
28
29#define LPC32XX_GPIO_P0_MAX 8
30#define LPC32XX_GPIO_P1_MAX 24
31#define LPC32XX_GPIO_P2_MAX 13
32#define LPC32XX_GPIO_P3_MAX 6
33#define LPC32XX_GPI_P3_MAX 29
34#define LPC32XX_GPO_P3_MAX 24
35
36#define LPC32XX_GPIO_P0_GRP 0
37#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
38#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
39#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
40#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
41#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
42
43/*
44 * A specific GPIO can be selected with this macro
45 * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
46 * See the LPC32x0 User's guide for GPIO group numbers
47 */
48#define LPC32XX_GPIO(x, y) ((x) + (y))
49
50#endif /* __MACH_GPIO_LPC32XX_H */
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio.h b/arch/arm/mach-lpc32xx/include/mach/gpio.h
deleted file mode 100644
index 0052e7a76179..000000000000
--- a/arch/arm/mach-lpc32xx/include/mach/gpio.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __MACH_GPIO_H
2#define __MACH_GPIO_H
3
4#include "gpio-lpc32xx.h"
5
6#endif /* __MACH_GPIO_H */
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index e54f87ec2e4a..34932e0e31fa 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -36,6 +36,7 @@
36#include <linux/clk.h> 36#include <linux/clk.h>
37#include <linux/mtd/lpc32xx_slc.h> 37#include <linux/mtd/lpc32xx_slc.h>
38#include <linux/mtd/lpc32xx_mlc.h> 38#include <linux/mtd/lpc32xx_mlc.h>
39#include <linux/platform_data/gpio-lpc32xx.h>
39 40
40#include <asm/setup.h> 41#include <asm/setup.h>
41#include <asm/mach-types.h> 42#include <asm/mach-types.h>
@@ -44,7 +45,6 @@
44#include <mach/hardware.h> 45#include <mach/hardware.h>
45#include <mach/platform.h> 46#include <mach/platform.h>
46#include <mach/board.h> 47#include <mach/board.h>
47#include <mach/gpio-lpc32xx.h>
48#include "common.h" 48#include "common.h"
49 49
50/* 50/*
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index ebdda8346a26..ebdba87b9671 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -136,4 +136,7 @@ config USB_EHCI_MV_U2O
136 help 136 help
137 Enables support for OTG controller which can be switched to host mode. 137 Enables support for OTG controller which can be switched to host mode.
138 138
139config MMP_SRAM
140 bool
141
139endif 142endif
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index 9b702a1dc7b0..98f0f6388e44 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -7,7 +7,8 @@ obj-y += common.o devices.o time.o
7# SoC support 7# SoC support
8obj-$(CONFIG_CPU_PXA168) += pxa168.o 8obj-$(CONFIG_CPU_PXA168) += pxa168.o
9obj-$(CONFIG_CPU_PXA910) += pxa910.o 9obj-$(CONFIG_CPU_PXA910) += pxa910.o
10obj-$(CONFIG_CPU_MMP2) += mmp2.o sram.o 10obj-$(CONFIG_CPU_MMP2) += mmp2.o
11obj-$(CONFIG_MMP_SRAM) += sram.o
11 12
12ifeq ($(CONFIG_COMMON_CLK), ) 13ifeq ($(CONFIG_COMMON_CLK), )
13obj-y += clock.o 14obj-y += clock.o
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 7ac41e83cfef..024022d91fe3 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -61,7 +61,7 @@ static inline uint32_t timer_read(void)
61 return __raw_readl(mmp_timer_base + TMR_CVWR(1)); 61 return __raw_readl(mmp_timer_base + TMR_CVWR(1));
62} 62}
63 63
64static u32 notrace mmp_read_sched_clock(void) 64static u64 notrace mmp_read_sched_clock(void)
65{ 65{
66 return timer_read(); 66 return timer_read();
67} 67}
@@ -195,7 +195,7 @@ void __init timer_init(int irq)
195{ 195{
196 timer_config(); 196 timer_config();
197 197
198 setup_sched_clock(mmp_read_sched_clock, 32, CLOCK_TICK_RATE); 198 sched_clock_register(mmp_read_sched_clock, 32, CLOCK_TICK_RATE);
199 199
200 ckevt.cpumask = cpumask_of(0); 200 ckevt.cpumask = cpumask_of(0);
201 201
diff --git a/arch/arm/mach-moxart/Kconfig b/arch/arm/mach-moxart/Kconfig
new file mode 100644
index 000000000000..ba470d64493b
--- /dev/null
+++ b/arch/arm/mach-moxart/Kconfig
@@ -0,0 +1,31 @@
1config ARCH_MOXART
2 bool "MOXA ART SoC" if ARCH_MULTI_V4T
3 select CPU_FA526
4 select ARM_DMA_MEM_BUFFERABLE
5 select DMA_OF
6 select USE_OF
7 select CLKSRC_OF
8 select CLKSRC_MMIO
9 select HAVE_CLK
10 select COMMON_CLK
11 select GENERIC_IRQ_CHIP
12 select ARCH_REQUIRE_GPIOLIB
13 select GENERIC_CLOCKEVENTS
14 select PHYLIB if NETDEVICES
15 help
16 Say Y here if you want to run your kernel on hardware with a
17 MOXA ART SoC.
18 The MOXA ART SoC is based on a Faraday FA526 ARMv4 32-bit
19 192 MHz CPU with MMU and 16KB/8KB D/I-cache (UC-7112-LX).
20 Used on models UC-7101, UC-7112/UC-7110, IA240/IA241, IA3341.
21
22if ARCH_MOXART
23
24config MACH_UC7112LX
25 bool "MOXA UC-7112-LX"
26 depends on ARCH_MOXART
27 help
28 Say Y here if you intend to run this kernel on a MOXA
29 UC-7112-LX embedded computer.
30
31endif
diff --git a/arch/arm/mach-moxart/Makefile b/arch/arm/mach-moxart/Makefile
new file mode 100644
index 000000000000..fa022eb10ca1
--- /dev/null
+++ b/arch/arm/mach-moxart/Makefile
@@ -0,0 +1,3 @@
1# Object file lists.
2
3obj-$(CONFIG_MACH_UC7112LX) += moxart.o
diff --git a/arch/arm/mach-moxart/moxart.c b/arch/arm/mach-moxart/moxart.c
new file mode 100644
index 000000000000..86b6d9b57c54
--- /dev/null
+++ b/arch/arm/mach-moxart/moxart.c
@@ -0,0 +1,15 @@
1/*
2 * arch/arm/mach-moxart/moxart.c
3 *
4 * (C) Copyright 2013, Jonas Jensen <jonas.jensen@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 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 */
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 2586c2865874..9625cf378931 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -1,12 +1,50 @@
1config ARCH_MSM
2 bool
3
4config ARCH_MSM_DT
5 bool "Qualcomm MSM DT Support" if ARCH_MULTI_V7
6 select ARCH_MSM
7 select ARCH_REQUIRE_GPIOLIB
8 select CLKSRC_OF
9 select GENERIC_CLOCKEVENTS
10 help
11 Support for Qualcomm's devicetree based MSM systems.
12
1if ARCH_MSM 13if ARCH_MSM
2 14
3comment "Qualcomm MSM SoC Type" 15menu "Qualcomm MSM SoC Selection"
4 depends on ARCH_MSM_DT 16 depends on ARCH_MSM_DT
5 17
18config ARCH_MSM8X60
19 bool "Enable support for MSM8X60"
20 select ARM_GIC
21 select CPU_V7
22 select HAVE_SMP
23 select MSM_SCM if SMP
24 select MSM_TIMER
25
26config ARCH_MSM8960
27 bool "Enable support for MSM8960"
28 select ARM_GIC
29 select CPU_V7
30 select HAVE_SMP
31 select MSM_SCM if SMP
32 select MSM_TIMER
33
34config ARCH_MSM8974
35 bool "Enable support for MSM8974"
36 select ARM_GIC
37 select CPU_V7
38 select HAVE_ARM_ARCH_TIMER
39 select HAVE_SMP
40 select MSM_SCM if SMP
41
42endmenu
43
6choice 44choice
7 prompt "Qualcomm MSM SoC Type" 45 prompt "Qualcomm MSM SoC Type"
8 default ARCH_MSM7X00A 46 default ARCH_MSM7X00A
9 depends on !ARCH_MSM_DT 47 depends on ARCH_MSM_NODT
10 48
11config ARCH_MSM7X00A 49config ARCH_MSM7X00A
12 bool "MSM7x00A / MSM7x01A" 50 bool "MSM7x00A / MSM7x01A"
@@ -16,6 +54,7 @@ config ARCH_MSM7X00A
16 select MACH_TROUT if !MACH_HALIBUT 54 select MACH_TROUT if !MACH_HALIBUT
17 select MSM_PROC_COMM 55 select MSM_PROC_COMM
18 select MSM_SMD 56 select MSM_SMD
57 select MSM_TIMER
19 select MSM_SMD_PKG3 58 select MSM_SMD_PKG3
20 59
21config ARCH_MSM7X30 60config ARCH_MSM7X30
@@ -27,6 +66,7 @@ config ARCH_MSM7X30
27 select MSM_GPIOMUX 66 select MSM_GPIOMUX
28 select MSM_PROC_COMM 67 select MSM_PROC_COMM
29 select MSM_SMD 68 select MSM_SMD
69 select MSM_TIMER
30 select MSM_VIC 70 select MSM_VIC
31 71
32config ARCH_QSD8X50 72config ARCH_QSD8X50
@@ -38,32 +78,11 @@ config ARCH_QSD8X50
38 select MSM_GPIOMUX 78 select MSM_GPIOMUX
39 select MSM_PROC_COMM 79 select MSM_PROC_COMM
40 select MSM_SMD 80 select MSM_SMD
81 select MSM_TIMER
41 select MSM_VIC 82 select MSM_VIC
42 83
43endchoice 84endchoice
44 85
45config ARCH_MSM8X60
46 bool "MSM8X60"
47 select ARM_GIC
48 select CPU_V7
49 select GPIO_MSM_V2
50 select HAVE_SMP
51 select MSM_SCM if SMP
52
53config ARCH_MSM8960
54 bool "MSM8960"
55 select ARM_GIC
56 select CPU_V7
57 select HAVE_SMP
58 select GPIO_MSM_V2
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
65 select USE_OF
66
67config MSM_HAS_DEBUG_UART_HS 86config MSM_HAS_DEBUG_UART_HS
68 bool 87 bool
69 88
@@ -80,7 +99,7 @@ config MSM_VIC
80 bool 99 bool
81 100
82menu "Qualcomm MSM Board Type" 101menu "Qualcomm MSM Board Type"
83 depends on !ARCH_MSM_DT 102 depends on ARCH_MSM_NODT
84 103
85config MACH_HALIBUT 104config MACH_HALIBUT
86 depends on ARCH_MSM 105 depends on ARCH_MSM
@@ -128,10 +147,13 @@ config MSM_SMD
128 147
129config MSM_GPIOMUX 148config MSM_GPIOMUX
130 bool 149 bool
131 depends on !ARCH_MSM_DT
132 help 150 help
133 Support for MSM V1 TLMM GPIOMUX architecture. 151 Support for MSM V1 TLMM GPIOMUX architecture.
134 152
135config MSM_SCM 153config MSM_SCM
136 bool 154 bool
155
156config MSM_TIMER
157 bool
158
137endif 159endif
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 7ed4c1b2bdd2..8e307a10d3c3 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,5 +1,5 @@
1obj-y += timer.o 1obj-$(CONFIG_MSM_TIMER) += timer.o
2obj-y += clock.o 2obj-$(CONFIG_MSM_PROC_COMM) += clock.o
3 3
4obj-$(CONFIG_MSM_VIC) += irq-vic.o 4obj-$(CONFIG_MSM_VIC) += irq-vic.o
5 5
diff --git a/arch/arm/mach-msm/board-dt.c b/arch/arm/mach-msm/board-dt.c
index 16e6183ac9f1..1f11d93e700e 100644
--- a/arch/arm/mach-msm/board-dt.c
+++ b/arch/arm/mach-msm/board-dt.c
@@ -26,7 +26,16 @@ static const char * const msm_dt_match[] __initconst = {
26 NULL 26 NULL
27}; 27};
28 28
29static const char * const apq8074_dt_match[] __initconst = {
30 "qcom,apq8074-dragonboard",
31 NULL
32};
33
29DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)") 34DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
30 .smp = smp_ops(msm_smp_ops), 35 .smp = smp_ops(msm_smp_ops),
31 .dt_compat = msm_dt_match, 36 .dt_compat = msm_dt_match,
32MACHINE_END 37MACHINE_END
38
39DT_MACHINE_START(APQ_DT, "Qualcomm MSM (Flattened Device Tree)")
40 .dt_compat = apq8074_dt_match,
41MACHINE_END
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index f9af5a46e8b6..46de789ad3ae 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -30,6 +30,7 @@
30#include <asm/memory.h> 30#include <asm/memory.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32 32
33#include <mach/clk.h>
33#include <mach/msm_iomap.h> 34#include <mach/msm_iomap.h>
34#include <mach/dma.h> 35#include <mach/dma.h>
35 36
@@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {
60 -1 61 -1
61}; 62};
62 63
64static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
65{
66 int ret;
67
68 if (assert) {
69 ret = clk_reset(link_clk, CLK_RESET_ASSERT);
70 if (ret)
71 pr_err("usb hs_clk assert failed\n");
72 } else {
73 ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
74 if (ret)
75 pr_err("usb hs_clk deassert failed\n");
76 }
77 return ret;
78}
79
80static int hsusb_phy_clk_reset(struct clk *phy_clk)
81{
82 int ret;
83
84 ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
85 if (ret) {
86 pr_err("usb phy clk assert failed\n");
87 return ret;
88 }
89 usleep_range(10000, 12000);
90 ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
91 if (ret)
92 pr_err("usb phy clk deassert failed\n");
93 return ret;
94}
95
63static struct msm_otg_platform_data msm_otg_pdata = { 96static struct msm_otg_platform_data msm_otg_pdata = {
64 .phy_init_seq = hsusb_phy_init_seq, 97 .phy_init_seq = hsusb_phy_init_seq,
65 .mode = USB_PERIPHERAL, 98 .mode = USB_PERIPHERAL,
66 .otg_control = OTG_PHY_CONTROL, 99 .otg_control = OTG_PHY_CONTROL,
100 .link_clk_reset = hsusb_link_clk_reset,
101 .phy_clk_reset = hsusb_phy_clk_reset,
67}; 102};
68 103
69struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { 104struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 5f933bc50783..9169ec324a43 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -31,6 +31,7 @@
31#include <mach/irqs.h> 31#include <mach/irqs.h>
32#include <mach/sirc.h> 32#include <mach/sirc.h>
33#include <mach/vreg.h> 33#include <mach/vreg.h>
34#include <mach/clk.h>
34#include <linux/platform_data/mmc-msm_sdcc.h> 35#include <linux/platform_data/mmc-msm_sdcc.h>
35 36
36#include "devices.h" 37#include "devices.h"
@@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = {
81 -1 82 -1
82}; 83};
83 84
85static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
86{
87 int ret;
88
89 if (assert) {
90 ret = clk_reset(link_clk, CLK_RESET_ASSERT);
91 if (ret)
92 pr_err("usb hs_clk assert failed\n");
93 } else {
94 ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
95 if (ret)
96 pr_err("usb hs_clk deassert failed\n");
97 }
98 return ret;
99}
100
101static int hsusb_phy_clk_reset(struct clk *phy_clk)
102{
103 int ret;
104
105 ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
106 if (ret) {
107 pr_err("usb phy clk assert failed\n");
108 return ret;
109 }
110 usleep_range(10000, 12000);
111 ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
112 if (ret)
113 pr_err("usb phy clk deassert failed\n");
114 return ret;
115}
116
84static struct msm_otg_platform_data msm_otg_pdata = { 117static struct msm_otg_platform_data msm_otg_pdata = {
85 .phy_init_seq = hsusb_phy_init_seq, 118 .phy_init_seq = hsusb_phy_init_seq,
86 .mode = USB_PERIPHERAL, 119 .mode = USB_PERIPHERAL,
87 .otg_control = OTG_PHY_CONTROL, 120 .otg_control = OTG_PHY_CONTROL,
121 .link_clk_reset = hsusb_link_clk_reset,
122 .phy_clk_reset = hsusb_phy_clk_reset,
88}; 123};
89 124
90static struct platform_device *devices[] __initdata = { 125static struct platform_device *devices[] __initdata = {
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index ccf6621bc664..015d544aa017 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -13,6 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 */ 15 */
16#define pr_fmt(fmt) "%s: " fmt, __func__
16 17
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/init.h> 19#include <linux/init.h>
@@ -68,12 +69,11 @@ static void __init trout_init(void)
68 69
69 platform_add_devices(devices, ARRAY_SIZE(devices)); 70 platform_add_devices(devices, ARRAY_SIZE(devices));
70 71
71#ifdef CONFIG_MMC 72 if (IS_ENABLED(CONFIG_MMC)) {
72 rc = trout_init_mmc(system_rev); 73 rc = trout_init_mmc(system_rev);
73 if (rc) 74 if (rc)
74 printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc); 75 pr_crit("MMC init failure (%d)\n", rc);
75#endif 76 }
76
77} 77}
78 78
79static struct map_desc trout_io_desc[] __initdata = { 79static struct map_desc trout_io_desc[] __initdata = {
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index 3f06edcdd0ce..f10a1f58fde9 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -99,8 +99,7 @@ static int msm_boot_secondary(unsigned int cpu, struct task_struct *idle)
99 * "cpu" is Linux's internal ID. 99 * "cpu" is Linux's internal ID.
100 */ 100 */
101 pen_release = cpu_logical_map(cpu); 101 pen_release = cpu_logical_map(cpu);
102 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); 102 sync_cache_w(&pen_release);
103 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
104 103
105 /* 104 /*
106 * Send the secondary CPU a soft interrupt, thereby causing 105 * Send the secondary CPU a soft interrupt, thereby causing
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 1e9c3383daba..fd1644987534 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -187,7 +187,7 @@ static struct notifier_block msm_timer_cpu_nb = {
187 .notifier_call = msm_timer_cpu_notify, 187 .notifier_call = msm_timer_cpu_notify,
188}; 188};
189 189
190static notrace u32 msm_sched_clock_read(void) 190static u64 notrace msm_sched_clock_read(void)
191{ 191{
192 return msm_clocksource.read(&msm_clocksource); 192 return msm_clocksource.read(&msm_clocksource);
193} 193}
@@ -229,7 +229,7 @@ err:
229 res = clocksource_register_hz(cs, dgt_hz); 229 res = clocksource_register_hz(cs, dgt_hz);
230 if (res) 230 if (res)
231 pr_err("clocksource_register failed\n"); 231 pr_err("clocksource_register failed\n");
232 setup_sched_clock(msm_sched_clock_read, sched_bits, dgt_hz); 232 sched_clock_register(msm_sched_clock_read, sched_bits, dgt_hz);
233} 233}
234 234
235#ifdef CONFIG_OF 235#ifdef CONFIG_OF
diff --git a/arch/arm/mach-mv78xx0/include/mach/gpio.h b/arch/arm/mach-mv78xx0/include/mach/gpio.h
deleted file mode 100644
index 77e1b843e768..000000000000
--- a/arch/arm/mach-mv78xx0/include/mach/gpio.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * arch/asm-arm/mach-mv78xx0/include/mach/gpio.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <plat/gpio.h>
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 2d04f0e21870..878aebe98dcc 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -3,7 +3,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
3 3
4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a 4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a
5 5
6obj-y += system-controller.o 6obj-y += system-controller.o mvebu-soc-id.o
7obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o 7obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o
8obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o 8obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o
9obj-$(CONFIG_SMP) += platsmp.o headsmp.o 9obj-$(CONFIG_SMP) += platsmp.o headsmp.o
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index e2acff98e750..f6c9d1d85c14 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -21,6 +21,7 @@
21#include <linux/clocksource.h> 21#include <linux/clocksource.h>
22#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/mbus.h> 23#include <linux/mbus.h>
24#include <linux/slab.h>
24#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
@@ -28,6 +29,7 @@
28#include "armada-370-xp.h" 29#include "armada-370-xp.h"
29#include "common.h" 30#include "common.h"
30#include "coherency.h" 31#include "coherency.h"
32#include "mvebu-soc-id.h"
31 33
32static void __init armada_370_xp_map_io(void) 34static void __init armada_370_xp_map_io(void)
33{ 35{
@@ -45,8 +47,38 @@ static void __init armada_370_xp_timer_and_clk_init(void)
45#endif 47#endif
46} 48}
47 49
50static void __init i2c_quirk(void)
51{
52 struct device_node *np;
53 u32 dev, rev;
54
55 /*
56 * Only revisons more recent than A0 support the offload
57 * mechanism. We can exit only if we are sure that we can
58 * get the SoC revision and it is more recent than A0.
59 */
60 if (mvebu_get_soc_id(&rev, &dev) == 0 && dev > MV78XX0_A0_REV)
61 return;
62
63 for_each_compatible_node(np, NULL, "marvell,mv78230-i2c") {
64 struct property *new_compat;
65
66 new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL);
67
68 new_compat->name = kstrdup("compatible", GFP_KERNEL);
69 new_compat->length = sizeof("marvell,mv78230-a0-i2c");
70 new_compat->value = kstrdup("marvell,mv78230-a0-i2c",
71 GFP_KERNEL);
72
73 of_update_property(np, new_compat);
74 }
75 return;
76}
77
48static void __init armada_370_xp_dt_init(void) 78static void __init armada_370_xp_dt_init(void)
49{ 79{
80 if (of_machine_is_compatible("plathome,openblocks-ax3-4"))
81 i2c_quirk();
50 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 82 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
51} 83}
52 84
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index c612b2c4ed6c..237c86b83390 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -18,8 +18,12 @@
18#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20 20
21#define ARMADA_XP_MAX_CPUS 4
22
21void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq); 23void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq);
22void armada_xp_mpic_smp_cpu_init(void); 24void armada_xp_mpic_smp_cpu_init(void);
25void armada_xp_secondary_startup(void);
26extern struct smp_operations armada_xp_smp_ops;
23#endif 27#endif
24 28
25#endif /* __MACH_ARMADA_370_XP_H */ 29#endif /* __MACH_ARMADA_370_XP_H */
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 58adf2fd9cfc..4e9d58148ca7 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -27,6 +27,7 @@
27#include <asm/smp_plat.h> 27#include <asm/smp_plat.h>
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include "armada-370-xp.h" 29#include "armada-370-xp.h"
30#include "coherency.h"
30 31
31unsigned long coherency_phys_base; 32unsigned long coherency_phys_base;
32static void __iomem *coherency_base; 33static void __iomem *coherency_base;
diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h
index df33ad8a6c08..760226c41353 100644
--- a/arch/arm/mach-mvebu/coherency.h
+++ b/arch/arm/mach-mvebu/coherency.h
@@ -14,7 +14,9 @@
14#ifndef __MACH_370_XP_COHERENCY_H 14#ifndef __MACH_370_XP_COHERENCY_H
15#define __MACH_370_XP_COHERENCY_H 15#define __MACH_370_XP_COHERENCY_H
16 16
17int set_cpu_coherent(int cpu_id, int smp_group_id); 17extern unsigned long coherency_phys_base;
18
19int set_cpu_coherent(unsigned int cpu_id, int smp_group_id);
18int coherency_init(void); 20int coherency_init(void);
19 21
20#endif /* __MACH_370_XP_COHERENCY_H */ 22#endif /* __MACH_370_XP_COHERENCY_H */
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index e366010e1d91..55449c487c9e 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -15,18 +15,10 @@
15#ifndef __ARCH_MVEBU_COMMON_H 15#ifndef __ARCH_MVEBU_COMMON_H
16#define __ARCH_MVEBU_COMMON_H 16#define __ARCH_MVEBU_COMMON_H
17 17
18#define ARMADA_XP_MAX_CPUS 4
19
20#include <linux/reboot.h> 18#include <linux/reboot.h>
21 19
22void mvebu_restart(enum reboot_mode mode, const char *cmd); 20void mvebu_restart(enum reboot_mode mode, const char *cmd);
23 21
24void armada_370_xp_init_irq(void);
25void armada_370_xp_handle_irq(struct pt_regs *regs);
26
27void armada_xp_cpu_die(unsigned int cpu); 22void armada_xp_cpu_die(unsigned int cpu);
28int armada_370_xp_coherency_init(void); 23
29int armada_370_xp_pmsu_init(void);
30void armada_xp_secondary_startup(void);
31extern struct smp_operations armada_xp_smp_ops;
32#endif 24#endif
diff --git a/arch/arm/mach-mvebu/hotplug.c b/arch/arm/mach-mvebu/hotplug.c
index b228b6a80c85..d95e91047168 100644
--- a/arch/arm/mach-mvebu/hotplug.c
+++ b/arch/arm/mach-mvebu/hotplug.c
@@ -15,6 +15,7 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
18#include "common.h"
18 19
19/* 20/*
20 * platform-specific code to shutdown a CPU 21 * platform-specific code to shutdown a CPU
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
new file mode 100644
index 000000000000..f3b325f6cbd4
--- /dev/null
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -0,0 +1,119 @@
1/*
2 * ID and revision information for mvebu SoCs
3 *
4 * Copyright (C) 2014 Marvell
5 *
6 * Gregory CLEMENT <gregory.clement@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 * All the mvebu SoCs have information related to their variant and
13 * revision that can be read from the PCI control register. This is
14 * done before the PCI initialization to avoid any conflict. Once the
15 * ID and revision are retrieved, the mapping is freed.
16 */
17
18#define pr_fmt(fmt) "mvebu-soc-id: " fmt
19
20#include <linux/clk.h>
21#include <linux/init.h>
22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
26#include "mvebu-soc-id.h"
27
28#define PCIE_DEV_ID_OFF 0x0
29#define PCIE_DEV_REV_OFF 0x8
30
31#define SOC_ID_MASK 0xFFFF0000
32#define SOC_REV_MASK 0xFF
33
34static u32 soc_dev_id;
35static u32 soc_rev;
36static bool is_id_valid;
37
38static const struct of_device_id mvebu_pcie_of_match_table[] = {
39 { .compatible = "marvell,armada-xp-pcie", },
40 { .compatible = "marvell,armada-370-pcie", },
41 {},
42};
43
44int mvebu_get_soc_id(u32 *dev, u32 *rev)
45{
46 if (is_id_valid) {
47 *dev = soc_dev_id;
48 *rev = soc_rev;
49 return 0;
50 } else
51 return -1;
52}
53
54static int __init mvebu_soc_id_init(void)
55{
56 struct device_node *np;
57 int ret = 0;
58 void __iomem *pci_base;
59 struct clk *clk;
60 struct device_node *child;
61
62 np = of_find_matching_node(NULL, mvebu_pcie_of_match_table);
63 if (!np)
64 return ret;
65
66 /*
67 * ID and revision are available from any port, so we
68 * just pick the first one
69 */
70 child = of_get_next_child(np, NULL);
71 if (child == NULL) {
72 pr_err("cannot get pci node\n");
73 ret = -ENOMEM;
74 goto clk_err;
75 }
76
77 clk = of_clk_get_by_name(child, NULL);
78 if (IS_ERR(clk)) {
79 pr_err("cannot get clock\n");
80 ret = -ENOMEM;
81 goto clk_err;
82 }
83
84 ret = clk_prepare_enable(clk);
85 if (ret) {
86 pr_err("cannot enable clock\n");
87 goto clk_err;
88 }
89
90 pci_base = of_iomap(child, 0);
91 if (pci_base == NULL) {
92 pr_err("cannot map registers\n");
93 ret = -ENOMEM;
94 goto res_ioremap;
95 }
96
97 /* SoC ID */
98 soc_dev_id = readl(pci_base + PCIE_DEV_ID_OFF) >> 16;
99
100 /* SoC revision */
101 soc_rev = readl(pci_base + PCIE_DEV_REV_OFF) & SOC_REV_MASK;
102
103 is_id_valid = true;
104
105 pr_info("MVEBU SoC ID=0x%X, Rev=0x%X\n", soc_dev_id, soc_rev);
106
107 iounmap(pci_base);
108
109res_ioremap:
110 clk_disable_unprepare(clk);
111
112clk_err:
113 of_node_put(child);
114 of_node_put(np);
115
116 return ret;
117}
118core_initcall(mvebu_soc_id_init);
119
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.h b/arch/arm/mach-mvebu/mvebu-soc-id.h
new file mode 100644
index 000000000000..31654252fe35
--- /dev/null
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.h
@@ -0,0 +1,32 @@
1/*
2 * Marvell EBU SoC ID and revision definitions.
3 *
4 * Copyright (C) 2014 Marvell Semiconductor
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __LINUX_MVEBU_SOC_ID_H
12#define __LINUX_MVEBU_SOC_ID_H
13
14/* Armada XP ID */
15#define MV78230_DEV_ID 0x7823
16#define MV78260_DEV_ID 0x7826
17#define MV78460_DEV_ID 0x7846
18
19/* Armada XP Revision */
20#define MV78XX0_A0_REV 0x1
21#define MV78XX0_B0_REV 0x2
22
23#ifdef CONFIG_ARCH_MVEBU
24int mvebu_get_soc_id(u32 *dev, u32 *rev);
25#else
26static inline int mvebu_get_soc_id(u32 *dev, u32 *rev)
27{
28 return -1;
29}
30#endif
31
32#endif /* __LINUX_MVEBU_SOC_ID_H */
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index ff69c2df298b..a6da03f5b24e 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -46,7 +46,7 @@ static struct clk *__init get_cpu_clk(int cpu)
46 return cpu_clk; 46 return cpu_clk;
47} 47}
48 48
49void __init set_secondary_cpus_clock(void) 49static void __init set_secondary_cpus_clock(void)
50{ 50{
51 int thiscpu, cpu; 51 int thiscpu, cpu;
52 unsigned long rate; 52 unsigned long rate;
@@ -94,7 +94,7 @@ static void __init armada_xp_smp_init_cpus(void)
94 set_smp_cross_call(armada_mpic_send_doorbell); 94 set_smp_cross_call(armada_mpic_send_doorbell);
95} 95}
96 96
97void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) 97static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
98{ 98{
99 struct device_node *node; 99 struct device_node *node;
100 struct resource res; 100 struct resource res;
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 27fc4f049474..d71ef53107c4 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -22,6 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/smp.h> 23#include <linux/smp.h>
24#include <asm/smp_plat.h> 24#include <asm/smp_plat.h>
25#include "pmsu.h"
25 26
26static void __iomem *pmsu_mp_base; 27static void __iomem *pmsu_mp_base;
27static void __iomem *pmsu_reset_base; 28static void __iomem *pmsu_reset_base;
@@ -58,7 +59,7 @@ int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr)
58} 59}
59#endif 60#endif
60 61
61int __init armada_370_xp_pmsu_init(void) 62static int __init armada_370_xp_pmsu_init(void)
62{ 63{
63 struct device_node *np; 64 struct device_node *np;
64 65
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index 5175083cdb34..a7fb89a5b5d9 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -27,6 +27,7 @@
27#include <linux/of_address.h> 27#include <linux/of_address.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/reboot.h> 29#include <linux/reboot.h>
30#include "common.h"
30 31
31static void __iomem *system_controller_base; 32static void __iomem *system_controller_base;
32 33
@@ -39,14 +40,14 @@ struct mvebu_system_controller {
39}; 40};
40static struct mvebu_system_controller *mvebu_sc; 41static struct mvebu_system_controller *mvebu_sc;
41 42
42const struct mvebu_system_controller armada_370_xp_system_controller = { 43static const struct mvebu_system_controller armada_370_xp_system_controller = {
43 .rstoutn_mask_offset = 0x60, 44 .rstoutn_mask_offset = 0x60,
44 .system_soft_reset_offset = 0x64, 45 .system_soft_reset_offset = 0x64,
45 .rstoutn_mask_reset_out_en = 0x1, 46 .rstoutn_mask_reset_out_en = 0x1,
46 .system_soft_reset = 0x1, 47 .system_soft_reset = 0x1,
47}; 48};
48 49
49const struct mvebu_system_controller orion_system_controller = { 50static const struct mvebu_system_controller orion_system_controller = {
50 .rstoutn_mask_offset = 0x108, 51 .rstoutn_mask_offset = 0x108,
51 .system_soft_reset_offset = 0x10c, 52 .system_soft_reset_offset = 0x10c,
52 .rstoutn_mask_reset_out_en = 0x4, 53 .rstoutn_mask_reset_out_en = 0x4,
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index cce2c9dfb5d1..4a1065e41e9c 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -110,38 +110,6 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
110} 110}
111 111
112/* 112/*
113 * The SMSC911x IRQ is connected to a GPIO pin, but the driver expects
114 * to simply request an IRQ passed as a resource. So the GPIO pin needs
115 * to be requested by this hog and set as input.
116 */
117static int __init cpu8815_eth_init(void)
118{
119 struct device_node *eth;
120 int gpio, irq, err;
121
122 eth = of_find_node_by_path("/usb-s8815/ethernet-gpio");
123 if (!eth) {
124 pr_info("could not find any ethernet GPIO\n");
125 return 0;
126 }
127 gpio = of_get_gpio(eth, 0);
128 err = gpio_request(gpio, "eth_irq");
129 if (err) {
130 pr_info("failed to request ethernet GPIO\n");
131 return -ENODEV;
132 }
133 err = gpio_direction_input(gpio);
134 if (err) {
135 pr_info("failed to set ethernet GPIO as input\n");
136 return -ENODEV;
137 }
138 irq = gpio_to_irq(gpio);
139 pr_info("enabled USB-S8815 ethernet GPIO %d, IRQ %d\n", gpio, irq);
140 return 0;
141}
142device_initcall(cpu8815_eth_init);
143
144/*
145 * This GPIO pin turns on a line that is used to detect card insertion 113 * This GPIO pin turns on a line that is used to detect card insertion
146 * on this board. 114 * on this board.
147 */ 115 */
diff --git a/arch/arm/mach-omap1/include/mach/usb.h b/arch/arm/mach-omap1/include/mach/usb.h
index 45e5ac707cbb..2c263051dc51 100644
--- a/arch/arm/mach-omap1/include/mach/usb.h
+++ b/arch/arm/mach-omap1/include/mach/usb.h
@@ -8,43 +8,7 @@
8#define is_usb0_device(config) 0 8#define is_usb0_device(config) 0
9#endif 9#endif
10 10
11struct omap_usb_config { 11#include <linux/platform_data/usb-omap1.h>
12 /* Configure drivers according to the connectors on your board:
13 * - "A" connector (rectagular)
14 * ... for host/OHCI use, set "register_host".
15 * - "B" connector (squarish) or "Mini-B"
16 * ... for device/gadget use, set "register_dev".
17 * - "Mini-AB" connector (very similar to Mini-B)
18 * ... for OTG use as device OR host, initialize "otg"
19 */
20 unsigned register_host:1;
21 unsigned register_dev:1;
22 u8 otg; /* port number, 1-based: usb1 == 2 */
23
24 u8 hmc_mode;
25
26 /* implicitly true if otg: host supports remote wakeup? */
27 u8 rwc;
28
29 /* signaling pins used to talk to transceiver on usbN:
30 * 0 == usbN unused
31 * 2 == usb0-only, using internal transceiver
32 * 3 == 3 wire bidirectional
33 * 4 == 4 wire bidirectional
34 * 6 == 6 wire unidirectional (or TLL)
35 */
36 u8 pins[3];
37
38 struct platform_device *udc_device;
39 struct platform_device *ohci_device;
40 struct platform_device *otg_device;
41
42 u32 (*usb0_init)(unsigned nwires, unsigned is_device);
43 u32 (*usb1_init)(unsigned nwires);
44 u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup);
45
46 int (*ocpi_enable)(void);
47};
48 12
49void omap_otg_init(struct omap_usb_config *config); 13void omap_otg_init(struct omap_usb_config *config);
50 14
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 6b5f298d6638..a7588cfd0286 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -181,7 +181,7 @@ static __init void omap_init_mpu_timer(unsigned long rate)
181 * --------------------------------------------------------------------------- 181 * ---------------------------------------------------------------------------
182 */ 182 */
183 183
184static u32 notrace omap_mpu_read_sched_clock(void) 184static u64 notrace omap_mpu_read_sched_clock(void)
185{ 185{
186 return ~omap_mpu_timer_read(1); 186 return ~omap_mpu_timer_read(1);
187} 187}
@@ -193,7 +193,7 @@ static void __init omap_init_clocksource(unsigned long rate)
193 "%s: can't register clocksource!\n"; 193 "%s: can't register clocksource!\n";
194 194
195 omap_mpu_timer_start(1, ~0, 1); 195 omap_mpu_timer_start(1, ~0, 1);
196 setup_sched_clock(omap_mpu_read_sched_clock, 32, rate); 196 sched_clock_register(omap_mpu_read_sched_clock, 32, rate);
197 197
198 if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate, 198 if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate,
199 300, 32, clocksource_mmio_readl_down)) 199 300, 32, clocksource_mmio_readl_down))
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index dc21df166161..653b489479e0 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -76,6 +76,16 @@ config SOC_AM43XX
76 select ARM_GIC 76 select ARM_GIC
77 select MACH_OMAP_GENERIC 77 select MACH_OMAP_GENERIC
78 78
79config SOC_DRA7XX
80 bool "TI DRA7XX"
81 depends on ARCH_MULTI_V7
82 select ARCH_OMAP2PLUS
83 select ARM_CPU_SUSPEND if PM
84 select ARM_GIC
85 select CPU_V7
86 select HAVE_SMP
87 select HAVE_ARM_ARCH_TIMER
88
79config ARCH_OMAP2PLUS 89config ARCH_OMAP2PLUS
80 bool 90 bool
81 select ARCH_HAS_BANDGAP 91 select ARCH_HAS_BANDGAP
@@ -128,14 +138,6 @@ config SOC_HAS_REALTIME_COUNTER
128 depends on SOC_OMAP5 || SOC_DRA7XX 138 depends on SOC_OMAP5 || SOC_DRA7XX
129 default y 139 default y
130 140
131config SOC_DRA7XX
132 bool "TI DRA7XX"
133 select ARM_ARCH_TIMER
134 select CPU_V7
135 select ARM_GIC
136 select HAVE_SMP
137 select COMMON_CLK
138
139comment "OMAP Core Type" 141comment "OMAP Core Type"
140 depends on ARCH_OMAP2 142 depends on ARCH_OMAP2
141 143
@@ -192,19 +194,6 @@ config MACH_OMAP2_TUSB6010
192 depends on ARCH_OMAP2 && SOC_OMAP2420 194 depends on ARCH_OMAP2 && SOC_OMAP2420
193 default y if MACH_NOKIA_N8X0 195 default y if MACH_NOKIA_N8X0
194 196
195config MACH_OMAP_H4
196 bool "OMAP 2420 H4 board"
197 depends on SOC_OMAP2420
198 default y
199 select OMAP_DEBUG_DEVICES
200 select OMAP_PACKAGE_ZAF
201
202config MACH_OMAP_2430SDP
203 bool "OMAP 2430 SDP board"
204 depends on SOC_OMAP2430
205 default y
206 select OMAP_PACKAGE_ZAC
207
208config MACH_OMAP3_BEAGLE 197config MACH_OMAP3_BEAGLE
209 bool "OMAP3 BEAGLE board" 198 bool "OMAP3 BEAGLE board"
210 depends on ARCH_OMAP3 199 depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index adcef406ff0a..e6eec6f72fd3 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -66,8 +66,6 @@ obj-$(CONFIG_SOC_OMAP5) += omap4-restart.o
66obj-$(CONFIG_SOC_DRA7XX) += omap4-restart.o 66obj-$(CONFIG_SOC_DRA7XX) += omap4-restart.o
67 67
68# Pin multiplexing 68# Pin multiplexing
69obj-$(CONFIG_SOC_OMAP2420) += mux2420.o
70obj-$(CONFIG_SOC_OMAP2430) += mux2430.o
71obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o 69obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o
72 70
73# SMS/SDRC 71# SMS/SDRC
@@ -132,6 +130,7 @@ obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common)
132obj-$(CONFIG_SOC_AM43XX) += $(voltagedomain-common) 130obj-$(CONFIG_SOC_AM43XX) += $(voltagedomain-common)
133obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common) 131obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common)
134obj-$(CONFIG_SOC_OMAP5) += voltagedomains54xx_data.o 132obj-$(CONFIG_SOC_OMAP5) += voltagedomains54xx_data.o
133obj-$(CONFIG_SOC_DRA7XX) += $(voltagedomain-common)
135 134
136# OMAP powerdomain framework 135# OMAP powerdomain framework
137powerdomain-common += powerdomain.o powerdomain-common.o 136powerdomain-common += powerdomain.o powerdomain-common.o
@@ -186,12 +185,14 @@ obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o
186obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o 185obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o
187obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o cclock3xxx_data.o 186obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o cclock3xxx_data.o
188obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o 187obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o
189obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) cclock44xx_data.o 188obj-$(CONFIG_ARCH_OMAP4) += $(clock-common)
190obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o 189obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
191obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o 190obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o
192obj-$(CONFIG_SOC_AM33XX) += cclock33xx_data.o
193obj-$(CONFIG_SOC_OMAP5) += $(clock-common) 191obj-$(CONFIG_SOC_OMAP5) += $(clock-common)
194obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o 192obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o
193obj-$(CONFIG_SOC_DRA7XX) += $(clock-common)
194obj-$(CONFIG_SOC_DRA7XX) += dpll3xxx.o dpll44xx.o
195obj-$(CONFIG_SOC_AM43XX) += $(clock-common) dpll3xxx.o
195 196
196# OMAP2 clock rate set data (old "OPP" data) 197# OMAP2 clock rate set data (old "OPP" data)
197obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o 198obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
@@ -237,8 +238,6 @@ obj-$(CONFIG_SOC_OMAP2420) += msdi.o
237 238
238# Specific board support 239# Specific board support
239obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o pdata-quirks.o 240obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o pdata-quirks.o
240obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
241obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
242obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o 241obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
243obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o 242obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
244obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 243obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
deleted file mode 100644
index c711ad6ac067..000000000000
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ /dev/null
@@ -1,273 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/board-2430sdp.c
3 *
4 * Copyright (C) 2006 Texas Instruments
5 *
6 * Modified from mach-omap2/board-generic.c
7 *
8 * Initial Code : Based on a patch from Komal Shah and Richard Woodruff
9 * Updated the Code for 2430 SDP : Syed Mohammed Khasim
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/mtd/mtd.h>
20#include <linux/mtd/partitions.h>
21#include <linux/mtd/physmap.h>
22#include <linux/mmc/host.h>
23#include <linux/delay.h>
24#include <linux/i2c/twl.h>
25#include <linux/regulator/machine.h>
26#include <linux/err.h>
27#include <linux/clk.h>
28#include <linux/io.h>
29#include <linux/gpio.h>
30#include <linux/usb/phy.h>
31
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35
36#include "common.h"
37#include "gpmc.h"
38#include "gpmc-smc91x.h"
39
40#include <video/omapdss.h>
41#include <video/omap-panel-data.h>
42
43#include "mux.h"
44#include "hsmmc.h"
45#include "common-board-devices.h"
46
47#define SDP2430_CS0_BASE 0x04000000
48#define SECONDARY_LCD_GPIO 147
49
50static struct mtd_partition sdp2430_partitions[] = {
51 /* bootloader (U-Boot, etc) in first sector */
52 {
53 .name = "bootloader",
54 .offset = 0,
55 .size = SZ_256K,
56 .mask_flags = MTD_WRITEABLE, /* force read-only */
57 },
58 /* bootloader params in the next sector */
59 {
60 .name = "params",
61 .offset = MTDPART_OFS_APPEND,
62 .size = SZ_128K,
63 .mask_flags = 0,
64 },
65 /* kernel */
66 {
67 .name = "kernel",
68 .offset = MTDPART_OFS_APPEND,
69 .size = SZ_2M,
70 .mask_flags = 0
71 },
72 /* file system */
73 {
74 .name = "filesystem",
75 .offset = MTDPART_OFS_APPEND,
76 .size = MTDPART_SIZ_FULL,
77 .mask_flags = 0
78 }
79};
80
81static struct physmap_flash_data sdp2430_flash_data = {
82 .width = 2,
83 .parts = sdp2430_partitions,
84 .nr_parts = ARRAY_SIZE(sdp2430_partitions),
85};
86
87static struct resource sdp2430_flash_resource = {
88 .start = SDP2430_CS0_BASE,
89 .end = SDP2430_CS0_BASE + SZ_64M - 1,
90 .flags = IORESOURCE_MEM,
91};
92
93static struct platform_device sdp2430_flash_device = {
94 .name = "physmap-flash",
95 .id = 0,
96 .dev = {
97 .platform_data = &sdp2430_flash_data,
98 },
99 .num_resources = 1,
100 .resource = &sdp2430_flash_resource,
101};
102
103/* LCD */
104#define SDP2430_LCD_PANEL_BACKLIGHT_GPIO 91
105#define SDP2430_LCD_PANEL_ENABLE_GPIO 154
106
107static const struct display_timing sdp2430_lcd_videomode = {
108 .pixelclock = { 0, 5400000, 0 },
109
110 .hactive = { 0, 240, 0 },
111 .hfront_porch = { 0, 3, 0 },
112 .hback_porch = { 0, 39, 0 },
113 .hsync_len = { 0, 3, 0 },
114
115 .vactive = { 0, 320, 0 },
116 .vfront_porch = { 0, 2, 0 },
117 .vback_porch = { 0, 7, 0 },
118 .vsync_len = { 0, 1, 0 },
119
120 .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
121 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
122};
123
124static struct panel_dpi_platform_data sdp2430_lcd_pdata = {
125 .name = "lcd",
126 .source = "dpi.0",
127
128 .data_lines = 16,
129
130 .display_timing = &sdp2430_lcd_videomode,
131
132 .enable_gpio = SDP2430_LCD_PANEL_ENABLE_GPIO,
133 .backlight_gpio = SDP2430_LCD_PANEL_BACKLIGHT_GPIO,
134};
135
136static struct platform_device sdp2430_lcd_device = {
137 .name = "panel-dpi",
138 .id = 0,
139 .dev.platform_data = &sdp2430_lcd_pdata,
140};
141
142static struct omap_dss_board_info sdp2430_dss_data = {
143 .default_display_name = "lcd",
144};
145
146static struct platform_device *sdp2430_devices[] __initdata = {
147 &sdp2430_flash_device,
148 &sdp2430_lcd_device,
149};
150
151#if IS_ENABLED(CONFIG_SMC91X)
152
153static struct omap_smc91x_platform_data board_smc91x_data = {
154 .cs = 5,
155 .gpio_irq = 149,
156 .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
157 IORESOURCE_IRQ_LOWLEVEL,
158
159};
160
161static void __init board_smc91x_init(void)
162{
163 omap_mux_init_gpio(149, OMAP_PIN_INPUT);
164 gpmc_smc91x_init(&board_smc91x_data);
165}
166
167#else
168
169static inline void board_smc91x_init(void)
170{
171}
172
173#endif
174
175static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
176 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
177};
178
179/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
180static struct regulator_init_data sdp2430_vmmc1 = {
181 .constraints = {
182 .min_uV = 1850000,
183 .max_uV = 3150000,
184 .valid_modes_mask = REGULATOR_MODE_NORMAL
185 | REGULATOR_MODE_STANDBY,
186 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
187 | REGULATOR_CHANGE_MODE
188 | REGULATOR_CHANGE_STATUS,
189 },
190 .num_consumer_supplies = ARRAY_SIZE(sdp2430_vmmc1_supplies),
191 .consumer_supplies = &sdp2430_vmmc1_supplies[0],
192};
193
194static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
195};
196
197static struct twl4030_platform_data sdp2430_twldata = {
198 /* platform_data for children goes here */
199 .gpio = &sdp2430_gpio_data,
200 .vmmc1 = &sdp2430_vmmc1,
201};
202
203static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = {
204 {
205 I2C_BOARD_INFO("isp1301_omap", 0x2D),
206 .flags = I2C_CLIENT_WAKE,
207 },
208};
209
210static int __init omap2430_i2c_init(void)
211{
212 sdp2430_i2c1_boardinfo[0].irq = gpio_to_irq(78);
213 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
214 ARRAY_SIZE(sdp2430_i2c1_boardinfo));
215 omap_pmic_init(2, 100, "twl4030", 7 + OMAP_INTC_START,
216 &sdp2430_twldata);
217 return 0;
218}
219
220static struct omap2_hsmmc_info mmc[] __initdata = {
221 {
222 .mmc = 1,
223 .caps = MMC_CAP_4_BIT_DATA,
224 .gpio_cd = -EINVAL,
225 .gpio_wp = -EINVAL,
226 .ext_clock = 1,
227 },
228 {} /* Terminator */
229};
230
231#ifdef CONFIG_OMAP_MUX
232static struct omap_board_mux board_mux[] __initdata = {
233 { .reg_offset = OMAP_MUX_TERMINATOR },
234};
235#endif
236
237static void __init omap_2430sdp_init(void)
238{
239 omap2430_mux_init(board_mux, OMAP_PACKAGE_ZAC);
240
241 omap2430_i2c_init();
242
243 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
244 omap_serial_init();
245 omap_sdrc_init(NULL, NULL);
246 omap_hsmmc_init(mmc);
247
248 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP);
249 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
250 usb_musb_init(NULL);
251
252 board_smc91x_init();
253
254 /* Turn off secondary LCD backlight */
255 gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW,
256 "Secondary LCD backlight");
257
258 omap_display_init(&sdp2430_dss_data);
259}
260
261MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
262 /* Maintainer: Syed Khasim - Texas Instruments Inc */
263 .atag_offset = 0x100,
264 .reserve = omap_reserve,
265 .map_io = omap243x_map_io,
266 .init_early = omap2430_init_early,
267 .init_irq = omap2_init_irq,
268 .handle_irq = omap2_intc_handle_irq,
269 .init_machine = omap_2430sdp_init,
270 .init_late = omap2430_init_late,
271 .init_time = omap2_sync32k_timer_init,
272 .restart = omap2xxx_restart,
273MACHINE_END
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 8d972ff18c56..8e3daa11602b 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -78,6 +78,7 @@ MACHINE_END
78 78
79#ifdef CONFIG_ARCH_OMAP3 79#ifdef CONFIG_ARCH_OMAP3
80static const char *omap3_boards_compat[] __initdata = { 80static const char *omap3_boards_compat[] __initdata = {
81 "ti,omap3430",
81 "ti,omap3", 82 "ti,omap3",
82 NULL, 83 NULL,
83}; 84};
@@ -173,6 +174,8 @@ MACHINE_END
173 174
174#ifdef CONFIG_ARCH_OMAP4 175#ifdef CONFIG_ARCH_OMAP4
175static const char *omap4_boards_compat[] __initdata = { 176static const char *omap4_boards_compat[] __initdata = {
177 "ti,omap4460",
178 "ti,omap4430",
176 "ti,omap4", 179 "ti,omap4",
177 NULL, 180 NULL,
178}; 181};
@@ -193,6 +196,8 @@ MACHINE_END
193 196
194#ifdef CONFIG_SOC_OMAP5 197#ifdef CONFIG_SOC_OMAP5
195static const char *omap5_boards_compat[] __initdata = { 198static const char *omap5_boards_compat[] __initdata = {
199 "ti,omap5432",
200 "ti,omap5430",
196 "ti,omap5", 201 "ti,omap5",
197 NULL, 202 NULL,
198}; 203};
@@ -213,6 +218,7 @@ MACHINE_END
213 218
214#ifdef CONFIG_SOC_AM43XX 219#ifdef CONFIG_SOC_AM43XX
215static const char *am43_boards_compat[] __initdata = { 220static const char *am43_boards_compat[] __initdata = {
221 "ti,am4372",
216 "ti,am43", 222 "ti,am43",
217 NULL, 223 NULL,
218}; 224};
@@ -230,6 +236,7 @@ MACHINE_END
230 236
231#ifdef CONFIG_SOC_DRA7XX 237#ifdef CONFIG_SOC_DRA7XX
232static const char *dra7xx_boards_compat[] __initdata = { 238static const char *dra7xx_boards_compat[] __initdata = {
239 "ti,dra7xx",
233 "ti,dra7", 240 "ti,dra7",
234 NULL, 241 NULL,
235}; 242};
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
deleted file mode 100644
index f7808349a734..000000000000
--- a/arch/arm/mach-omap2/board-h4.c
+++ /dev/null
@@ -1,365 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/board-h4.c
3 *
4 * Copyright (C) 2005 Nokia Corporation
5 * Author: Paul Mundt <paul.mundt@nokia.com>
6 *
7 * Modified from mach-omap/omap1/board-generic.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/gpio.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/mtd.h>
18#include <linux/mtd/partitions.h>
19#include <linux/mtd/physmap.h>
20#include <linux/delay.h>
21#include <linux/workqueue.h>
22#include <linux/i2c.h>
23#include <linux/platform_data/at24.h>
24#include <linux/input.h>
25#include <linux/err.h>
26#include <linux/clk.h>
27#include <linux/io.h>
28#include <linux/input/matrix_keypad.h>
29#include <linux/mfd/menelaus.h>
30#include <linux/omap-dma.h>
31
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35
36#include <video/omapdss.h>
37#include <video/omap-panel-data.h>
38
39#include "common.h"
40#include "mux.h"
41#include "control.h"
42#include "gpmc.h"
43#include "gpmc-smc91x.h"
44
45#define H4_FLASH_CS 0
46
47#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
48static const uint32_t board_matrix_keys[] = {
49 KEY(0, 0, KEY_LEFT),
50 KEY(1, 0, KEY_RIGHT),
51 KEY(2, 0, KEY_A),
52 KEY(3, 0, KEY_B),
53 KEY(4, 0, KEY_C),
54 KEY(0, 1, KEY_DOWN),
55 KEY(1, 1, KEY_UP),
56 KEY(2, 1, KEY_E),
57 KEY(3, 1, KEY_F),
58 KEY(4, 1, KEY_G),
59 KEY(0, 2, KEY_ENTER),
60 KEY(1, 2, KEY_I),
61 KEY(2, 2, KEY_J),
62 KEY(3, 2, KEY_K),
63 KEY(4, 2, KEY_3),
64 KEY(0, 3, KEY_M),
65 KEY(1, 3, KEY_N),
66 KEY(2, 3, KEY_O),
67 KEY(3, 3, KEY_P),
68 KEY(4, 3, KEY_Q),
69 KEY(0, 4, KEY_R),
70 KEY(1, 4, KEY_4),
71 KEY(2, 4, KEY_T),
72 KEY(3, 4, KEY_U),
73 KEY(4, 4, KEY_ENTER),
74 KEY(0, 5, KEY_V),
75 KEY(1, 5, KEY_W),
76 KEY(2, 5, KEY_L),
77 KEY(3, 5, KEY_S),
78 KEY(4, 5, KEY_ENTER),
79};
80
81static const struct matrix_keymap_data board_keymap_data = {
82 .keymap = board_matrix_keys,
83 .keymap_size = ARRAY_SIZE(board_matrix_keys),
84};
85
86static unsigned int board_keypad_row_gpios[] = {
87 88, 89, 124, 11, 6, 96
88};
89
90static unsigned int board_keypad_col_gpios[] = {
91 90, 91, 100, 36, 12, 97, 98
92};
93
94static struct matrix_keypad_platform_data board_keypad_platform_data = {
95 .keymap_data = &board_keymap_data,
96 .row_gpios = board_keypad_row_gpios,
97 .num_row_gpios = ARRAY_SIZE(board_keypad_row_gpios),
98 .col_gpios = board_keypad_col_gpios,
99 .num_col_gpios = ARRAY_SIZE(board_keypad_col_gpios),
100 .active_low = 1,
101
102 .debounce_ms = 20,
103 .col_scan_delay_us = 5,
104};
105
106static struct platform_device board_keyboard = {
107 .name = "matrix-keypad",
108 .id = -1,
109 .dev = {
110 .platform_data = &board_keypad_platform_data,
111 },
112};
113static void __init board_mkp_init(void)
114{
115 omap_mux_init_gpio(88, OMAP_PULL_ENA | OMAP_PULL_UP);
116 omap_mux_init_gpio(89, OMAP_PULL_ENA | OMAP_PULL_UP);
117 omap_mux_init_gpio(124, OMAP_PULL_ENA | OMAP_PULL_UP);
118 omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA | OMAP_PULL_UP);
119 if (omap_has_menelaus()) {
120 omap_mux_init_signal("sdrc_a14.gpio0",
121 OMAP_PULL_ENA | OMAP_PULL_UP);
122 omap_mux_init_signal("vlynq_rx0.gpio_15", 0);
123 omap_mux_init_signal("gpio_98", 0);
124 board_keypad_row_gpios[5] = 0;
125 board_keypad_col_gpios[2] = 15;
126 board_keypad_col_gpios[6] = 18;
127 } else {
128 omap_mux_init_signal("gpio_96", OMAP_PULL_ENA | OMAP_PULL_UP);
129 omap_mux_init_signal("gpio_100", 0);
130 omap_mux_init_signal("gpio_98", 0);
131 }
132 omap_mux_init_signal("gpio_90", 0);
133 omap_mux_init_signal("gpio_91", 0);
134 omap_mux_init_signal("gpio_36", 0);
135 omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
136 omap_mux_init_signal("gpio_97", 0);
137
138 platform_device_register(&board_keyboard);
139}
140#else
141static inline void board_mkp_init(void)
142{
143}
144#endif
145
146static struct mtd_partition h4_partitions[] = {
147 /* bootloader (U-Boot, etc) in first sector */
148 {
149 .name = "bootloader",
150 .offset = 0,
151 .size = SZ_128K,
152 .mask_flags = MTD_WRITEABLE, /* force read-only */
153 },
154 /* bootloader params in the next sector */
155 {
156 .name = "params",
157 .offset = MTDPART_OFS_APPEND,
158 .size = SZ_128K,
159 .mask_flags = 0,
160 },
161 /* kernel */
162 {
163 .name = "kernel",
164 .offset = MTDPART_OFS_APPEND,
165 .size = SZ_2M,
166 .mask_flags = 0
167 },
168 /* file system */
169 {
170 .name = "filesystem",
171 .offset = MTDPART_OFS_APPEND,
172 .size = MTDPART_SIZ_FULL,
173 .mask_flags = 0
174 }
175};
176
177static struct physmap_flash_data h4_flash_data = {
178 .width = 2,
179 .parts = h4_partitions,
180 .nr_parts = ARRAY_SIZE(h4_partitions),
181};
182
183static struct resource h4_flash_resource = {
184 .flags = IORESOURCE_MEM,
185};
186
187static struct platform_device h4_flash_device = {
188 .name = "physmap-flash",
189 .id = 0,
190 .dev = {
191 .platform_data = &h4_flash_data,
192 },
193 .num_resources = 1,
194 .resource = &h4_flash_resource,
195};
196
197static const struct display_timing cm_t35_lcd_videomode = {
198 .pixelclock = { 0, 6250000, 0 },
199
200 .hactive = { 0, 240, 0 },
201 .hfront_porch = { 0, 15, 0 },
202 .hback_porch = { 0, 60, 0 },
203 .hsync_len = { 0, 15, 0 },
204
205 .vactive = { 0, 320, 0 },
206 .vfront_porch = { 0, 1, 0 },
207 .vback_porch = { 0, 1, 0 },
208 .vsync_len = { 0, 1, 0 },
209
210 .flags = DISPLAY_FLAGS_HSYNC_HIGH | DISPLAY_FLAGS_VSYNC_HIGH |
211 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
212};
213
214static struct panel_dpi_platform_data cm_t35_lcd_pdata = {
215 .name = "lcd",
216 .source = "dpi.0",
217
218 .data_lines = 16,
219
220 .display_timing = &cm_t35_lcd_videomode,
221
222 .enable_gpio = -1,
223 .backlight_gpio = -1,
224};
225
226static struct platform_device cm_t35_lcd_device = {
227 .name = "panel-dpi",
228 .id = 0,
229 .dev.platform_data = &cm_t35_lcd_pdata,
230};
231
232static struct platform_device *h4_devices[] __initdata = {
233 &h4_flash_device,
234 &cm_t35_lcd_device,
235};
236
237static struct omap_dss_board_info h4_dss_data = {
238 .default_display_name = "lcd",
239};
240
241/* 2420 Sysboot setup (2430 is different) */
242static u32 get_sysboot_value(void)
243{
244 return (omap_ctrl_readl(OMAP24XX_CONTROL_STATUS) &
245 (OMAP2_SYSBOOT_5_MASK | OMAP2_SYSBOOT_4_MASK |
246 OMAP2_SYSBOOT_3_MASK | OMAP2_SYSBOOT_2_MASK |
247 OMAP2_SYSBOOT_1_MASK | OMAP2_SYSBOOT_0_MASK));
248}
249
250/* H4-2420's always used muxed mode, H4-2422's always use non-muxed
251 *
252 * Note: OMAP-GIT doesn't correctly do is_cpu_omap2422 and is_cpu_omap2423
253 * correctly. The macro needs to look at production_id not just hawkeye.
254 */
255static u32 is_gpmc_muxed(void)
256{
257 u32 mux;
258 mux = get_sysboot_value();
259 if ((mux & 0xF) == 0xd)
260 return 1; /* NAND config (could be either) */
261 if (mux & 0x2) /* if mux'ed */
262 return 1;
263 else
264 return 0;
265}
266
267#if IS_ENABLED(CONFIG_SMC91X)
268
269static struct omap_smc91x_platform_data board_smc91x_data = {
270 .cs = 1,
271 .gpio_irq = 92,
272 .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_LOWLEVEL,
273};
274
275static void __init board_smc91x_init(void)
276{
277 if (is_gpmc_muxed())
278 board_smc91x_data.flags |= GPMC_MUX_ADD_DATA;
279
280 omap_mux_init_gpio(board_smc91x_data.gpio_irq, OMAP_PIN_INPUT);
281 gpmc_smc91x_init(&board_smc91x_data);
282}
283
284#else
285
286static inline void board_smc91x_init(void)
287{
288}
289
290#endif
291
292static void __init h4_init_flash(void)
293{
294 unsigned long base;
295
296 if (gpmc_cs_request(H4_FLASH_CS, SZ_64M, &base) < 0) {
297 printk("Can't request GPMC CS for flash\n");
298 return;
299 }
300 h4_flash_resource.start = base;
301 h4_flash_resource.end = base + SZ_64M - 1;
302}
303
304static struct at24_platform_data m24c01 = {
305 .byte_len = SZ_1K / 8,
306 .page_size = 16,
307};
308
309static struct i2c_board_info __initdata h4_i2c_board_info[] = {
310 {
311 I2C_BOARD_INFO("isp1301_omap", 0x2d),
312 },
313 { /* EEPROM on mainboard */
314 I2C_BOARD_INFO("24c01", 0x52),
315 .platform_data = &m24c01,
316 },
317 { /* EEPROM on cpu card */
318 I2C_BOARD_INFO("24c01", 0x57),
319 .platform_data = &m24c01,
320 },
321};
322
323#ifdef CONFIG_OMAP_MUX
324static struct omap_board_mux board_mux[] __initdata = {
325 { .reg_offset = OMAP_MUX_TERMINATOR },
326};
327#endif
328
329static void __init omap_h4_init(void)
330{
331 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAF);
332
333 /*
334 * Make sure the serial ports are muxed on at this point.
335 * You have to mux them off in device drivers later on
336 * if not needed.
337 */
338
339 board_mkp_init();
340 h4_i2c_board_info[0].irq = gpio_to_irq(125);
341 i2c_register_board_info(1, h4_i2c_board_info,
342 ARRAY_SIZE(h4_i2c_board_info));
343
344 platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
345 omap_serial_init();
346 omap_sdrc_init(NULL, NULL);
347 h4_init_flash();
348 board_smc91x_init();
349
350 omap_display_init(&h4_dss_data);
351}
352
353MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
354 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
355 .atag_offset = 0x100,
356 .reserve = omap_reserve,
357 .map_io = omap242x_map_io,
358 .init_early = omap2420_init_early,
359 .init_irq = omap2_init_irq,
360 .handle_irq = omap2_intc_handle_irq,
361 .init_machine = omap_h4_init,
362 .init_late = omap2420_init_late,
363 .init_time = omap2_sync32k_timer_init,
364 .restart = omap2xxx_restart,
365MACHINE_END
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 827d15009a86..aead77a4bc6d 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -21,7 +21,6 @@
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
23#include <linux/usb/musb.h> 23#include <linux/usb/musb.h>
24#include <linux/platform_data/i2c-cbus-gpio.h>
25#include <linux/platform_data/spi-omap2-mcspi.h> 24#include <linux/platform_data/spi-omap2-mcspi.h>
26#include <linux/platform_data/mtd-onenand-omap2.h> 25#include <linux/platform_data/mtd-onenand-omap2.h>
27#include <linux/mfd/menelaus.h> 26#include <linux/mfd/menelaus.h>
@@ -32,8 +31,7 @@
32 31
33#include "common.h" 32#include "common.h"
34#include "mmc.h" 33#include "mmc.h"
35 34#include "soc.h"
36#include "mux.h"
37#include "gpmc-onenand.h" 35#include "gpmc-onenand.h"
38 36
39#define TUSB6010_ASYNC_CS 1 37#define TUSB6010_ASYNC_CS 1
@@ -42,44 +40,30 @@
42#define TUSB6010_GPIO_ENABLE 0 40#define TUSB6010_GPIO_ENABLE 0
43#define TUSB6010_DMACHAN 0x3f 41#define TUSB6010_DMACHAN 0x3f
44 42
45#if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE) 43#define NOKIA_N810_WIMAX (1 << 2)
46static struct i2c_cbus_platform_data n8x0_cbus_data = { 44#define NOKIA_N810 (1 << 1)
47 .clk_gpio = 66, 45#define NOKIA_N800 (1 << 0)
48 .dat_gpio = 65,
49 .sel_gpio = 64,
50};
51 46
52static struct platform_device n8x0_cbus_device = { 47static u32 board_caps;
53 .name = "i2c-cbus-gpio",
54 .id = 3,
55 .dev = {
56 .platform_data = &n8x0_cbus_data,
57 },
58};
59 48
60static struct i2c_board_info n8x0_i2c_board_info_3[] __initdata = { 49#define board_is_n800() (board_caps & NOKIA_N800)
61 { 50#define board_is_n810() (board_caps & NOKIA_N810)
62 I2C_BOARD_INFO("retu-mfd", 0x01), 51#define board_is_n810_wimax() (board_caps & NOKIA_N810_WIMAX)
63 },
64};
65 52
66static void __init n8x0_cbus_init(void) 53static void board_check_revision(void)
67{ 54{
68 const int retu_irq_gpio = 108; 55 if (of_have_populated_dt()) {
56 if (of_machine_is_compatible("nokia,n800"))
57 board_caps = NOKIA_N800;
58 else if (of_machine_is_compatible("nokia,n810"))
59 board_caps = NOKIA_N810;
60 else if (of_machine_is_compatible("nokia,n810-wimax"))
61 board_caps = NOKIA_N810_WIMAX;
62 }
69 63
70 if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ")) 64 if (!board_caps)
71 return; 65 pr_err("Unknown board\n");
72 irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING);
73 n8x0_i2c_board_info_3[0].irq = gpio_to_irq(retu_irq_gpio);
74 i2c_register_board_info(3, n8x0_i2c_board_info_3,
75 ARRAY_SIZE(n8x0_i2c_board_info_3));
76 platform_device_register(&n8x0_cbus_device);
77}
78#else /* CONFIG_I2C_CBUS_GPIO */
79static void __init n8x0_cbus_init(void)
80{
81} 66}
82#endif /* CONFIG_I2C_CBUS_GPIO */
83 67
84#if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE) 68#if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
85/* 69/*
@@ -178,49 +162,6 @@ static struct spi_board_info n800_spi_board_info[] __initdata = {
178 }, 162 },
179}; 163};
180 164
181#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
182 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
183
184static struct mtd_partition onenand_partitions[] = {
185 {
186 .name = "bootloader",
187 .offset = 0,
188 .size = 0x20000,
189 .mask_flags = MTD_WRITEABLE, /* Force read-only */
190 },
191 {
192 .name = "config",
193 .offset = MTDPART_OFS_APPEND,
194 .size = 0x60000,
195 },
196 {
197 .name = "kernel",
198 .offset = MTDPART_OFS_APPEND,
199 .size = 0x200000,
200 },
201 {
202 .name = "initfs",
203 .offset = MTDPART_OFS_APPEND,
204 .size = 0x400000,
205 },
206 {
207 .name = "rootfs",
208 .offset = MTDPART_OFS_APPEND,
209 .size = MTDPART_SIZ_FULL,
210 },
211};
212
213static struct omap_onenand_platform_data board_onenand_data[] = {
214 {
215 .cs = 0,
216 .gpio_irq = 26,
217 .parts = onenand_partitions,
218 .nr_parts = ARRAY_SIZE(onenand_partitions),
219 .flags = ONENAND_SYNC_READ,
220 }
221};
222#endif
223
224#if defined(CONFIG_MENELAUS) && \ 165#if defined(CONFIG_MENELAUS) && \
225 (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)) 166 (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))
226 167
@@ -342,7 +283,7 @@ static void n810_set_power_emmc(struct device *dev,
342static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on, 283static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on,
343 int vdd) 284 int vdd)
344{ 285{
345 if (machine_is_nokia_n800() || slot == 0) 286 if (board_is_n800() || slot == 0)
346 return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd); 287 return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd);
347 288
348 n810_set_power_emmc(dev, power_on); 289 n810_set_power_emmc(dev, power_on);
@@ -388,7 +329,7 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
388{ 329{
389 int bit, *openp, index; 330 int bit, *openp, index;
390 331
391 if (machine_is_nokia_n800()) { 332 if (board_is_n800()) {
392 bit = 1 << 1; 333 bit = 1 << 1;
393 openp = &slot2_cover_open; 334 openp = &slot2_cover_open;
394 index = 1; 335 index = 1;
@@ -421,7 +362,7 @@ static int n8x0_mmc_late_init(struct device *dev)
421 if (r < 0) 362 if (r < 0)
422 return r; 363 return r;
423 364
424 if (machine_is_nokia_n800()) 365 if (board_is_n800())
425 vs2sel = 0; 366 vs2sel = 0;
426 else 367 else
427 vs2sel = 2; 368 vs2sel = 2;
@@ -444,7 +385,7 @@ static int n8x0_mmc_late_init(struct device *dev)
444 if (r < 0) 385 if (r < 0)
445 return r; 386 return r;
446 387
447 if (machine_is_nokia_n800()) { 388 if (board_is_n800()) {
448 bit = 1 << 1; 389 bit = 1 << 1;
449 openp = &slot2_cover_open; 390 openp = &slot2_cover_open;
450 } else { 391 } else {
@@ -471,7 +412,7 @@ static void n8x0_mmc_shutdown(struct device *dev)
471{ 412{
472 int vs2sel; 413 int vs2sel;
473 414
474 if (machine_is_nokia_n800()) 415 if (board_is_n800())
475 vs2sel = 0; 416 vs2sel = 0;
476 else 417 else
477 vs2sel = 2; 418 vs2sel = 2;
@@ -486,7 +427,7 @@ static void n8x0_mmc_cleanup(struct device *dev)
486 427
487 gpio_free(N8X0_SLOT_SWITCH_GPIO); 428 gpio_free(N8X0_SLOT_SWITCH_GPIO);
488 429
489 if (machine_is_nokia_n810()) { 430 if (board_is_n810()) {
490 gpio_free(N810_EMMC_VSD_GPIO); 431 gpio_free(N810_EMMC_VSD_GPIO);
491 gpio_free(N810_EMMC_VIO_GPIO); 432 gpio_free(N810_EMMC_VIO_GPIO);
492 } 433 }
@@ -497,7 +438,7 @@ static void n8x0_mmc_cleanup(struct device *dev)
497 * MMC controller2 is not in use. 438 * MMC controller2 is not in use.
498 */ 439 */
499static struct omap_mmc_platform_data mmc1_data = { 440static struct omap_mmc_platform_data mmc1_data = {
500 .nr_slots = 2, 441 .nr_slots = 0,
501 .switch_slot = n8x0_mmc_switch_slot, 442 .switch_slot = n8x0_mmc_switch_slot,
502 .init = n8x0_mmc_late_init, 443 .init = n8x0_mmc_late_init,
503 .cleanup = n8x0_mmc_cleanup, 444 .cleanup = n8x0_mmc_cleanup,
@@ -537,7 +478,7 @@ static void __init n8x0_mmc_init(void)
537{ 478{
538 int err; 479 int err;
539 480
540 if (machine_is_nokia_n810()) { 481 if (board_is_n810()) {
541 mmc1_data.slots[0].name = "external"; 482 mmc1_data.slots[0].name = "external";
542 483
543 /* 484 /*
@@ -555,7 +496,7 @@ static void __init n8x0_mmc_init(void)
555 if (err) 496 if (err)
556 return; 497 return;
557 498
558 if (machine_is_nokia_n810()) { 499 if (board_is_n810()) {
559 err = gpio_request_array(n810_emmc_gpios, 500 err = gpio_request_array(n810_emmc_gpios,
560 ARRAY_SIZE(n810_emmc_gpios)); 501 ARRAY_SIZE(n810_emmc_gpios));
561 if (err) { 502 if (err) {
@@ -564,11 +505,11 @@ static void __init n8x0_mmc_init(void)
564 } 505 }
565 } 506 }
566 507
508 mmc1_data.nr_slots = 2;
567 mmc_data[0] = &mmc1_data; 509 mmc_data[0] = &mmc1_data;
568 omap242x_init_mmc(mmc_data);
569} 510}
570#else 511#else
571 512static struct omap_mmc_platform_data mmc1_data;
572void __init n8x0_mmc_init(void) 513void __init n8x0_mmc_init(void)
573{ 514{
574} 515}
@@ -650,109 +591,32 @@ static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
650 }, 591 },
651}; 592};
652 593
653#ifdef CONFIG_OMAP_MUX 594static int __init n8x0_late_initcall(void)
654static struct omap_board_mux board_mux[] __initdata = {
655 /* I2S codec port pins for McBSP block */
656 OMAP2420_MUX(EAC_AC_SCLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
657 OMAP2420_MUX(EAC_AC_FS, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
658 OMAP2420_MUX(EAC_AC_DIN, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
659 OMAP2420_MUX(EAC_AC_DOUT, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
660 { .reg_offset = OMAP_MUX_TERMINATOR },
661};
662
663static struct omap_device_pad serial2_pads[] __initdata = {
664 {
665 .name = "uart3_rx_irrx.uart3_rx_irrx",
666 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
667 .enable = OMAP_MUX_MODE0,
668 .idle = OMAP_MUX_MODE3 /* Mux as GPIO for idle */
669 },
670};
671
672static inline void board_serial_init(void)
673{ 595{
674 struct omap_board_data bdata; 596 if (!board_caps)
675 597 return -ENODEV;
676 bdata.flags = 0;
677 bdata.pads = NULL;
678 bdata.pads_cnt = 0;
679
680 bdata.id = 0;
681 omap_serial_init_port(&bdata, NULL);
682
683 bdata.id = 1;
684 omap_serial_init_port(&bdata, NULL);
685
686 bdata.id = 2;
687 bdata.pads = serial2_pads;
688 bdata.pads_cnt = ARRAY_SIZE(serial2_pads);
689 omap_serial_init_port(&bdata, NULL);
690}
691 598
692#else 599 n8x0_mmc_init();
600 n8x0_usb_init();
693 601
694static inline void board_serial_init(void) 602 return 0;
695{
696 omap_serial_init();
697} 603}
604omap_late_initcall(n8x0_late_initcall);
698 605
699#endif 606/*
700 607 * Legacy init pdata init for n8x0. Note that we want to follow the
701static void __init n8x0_init_machine(void) 608 * I2C bus numbering starting at 0 for device tree like other omaps.
609 */
610void * __init n8x0_legacy_init(void)
702{ 611{
703 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); 612 board_check_revision();
704 /* FIXME: add n810 spi devices */
705 spi_register_board_info(n800_spi_board_info, 613 spi_register_board_info(n800_spi_board_info,
706 ARRAY_SIZE(n800_spi_board_info)); 614 ARRAY_SIZE(n800_spi_board_info));
707 omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, 615 i2c_register_board_info(0, n8x0_i2c_board_info_1,
708 ARRAY_SIZE(n8x0_i2c_board_info_1)); 616 ARRAY_SIZE(n8x0_i2c_board_info_1));
709 omap_register_i2c_bus(2, 400, NULL, 0); 617 if (board_is_n810())
710 if (machine_is_nokia_n810()) 618 i2c_register_board_info(1, n810_i2c_board_info_2,
711 i2c_register_board_info(2, n810_i2c_board_info_2,
712 ARRAY_SIZE(n810_i2c_board_info_2)); 619 ARRAY_SIZE(n810_i2c_board_info_2));
713 board_serial_init();
714 omap_sdrc_init(NULL, NULL);
715 gpmc_onenand_init(board_onenand_data);
716 n8x0_mmc_init();
717 n8x0_usb_init();
718 n8x0_cbus_init();
719}
720 620
721MACHINE_START(NOKIA_N800, "Nokia N800") 621 return &mmc1_data;
722 .atag_offset = 0x100, 622}
723 .reserve = omap_reserve,
724 .map_io = omap242x_map_io,
725 .init_early = omap2420_init_early,
726 .init_irq = omap2_init_irq,
727 .handle_irq = omap2_intc_handle_irq,
728 .init_machine = n8x0_init_machine,
729 .init_late = omap2420_init_late,
730 .init_time = omap2_sync32k_timer_init,
731 .restart = omap2xxx_restart,
732MACHINE_END
733
734MACHINE_START(NOKIA_N810, "Nokia N810")
735 .atag_offset = 0x100,
736 .reserve = omap_reserve,
737 .map_io = omap242x_map_io,
738 .init_early = omap2420_init_early,
739 .init_irq = omap2_init_irq,
740 .handle_irq = omap2_intc_handle_irq,
741 .init_machine = n8x0_init_machine,
742 .init_late = omap2420_init_late,
743 .init_time = omap2_sync32k_timer_init,
744 .restart = omap2xxx_restart,
745MACHINE_END
746
747MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
748 .atag_offset = 0x100,
749 .reserve = omap_reserve,
750 .map_io = omap242x_map_io,
751 .init_early = omap2420_init_early,
752 .init_irq = omap2_init_irq,
753 .handle_irq = omap2_intc_handle_irq,
754 .init_machine = n8x0_init_machine,
755 .init_late = omap2420_init_late,
756 .init_time = omap2_sync32k_timer_init,
757 .restart = omap2xxx_restart,
758MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index f093af17f5e6..8760bbe3baab 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -760,7 +760,14 @@ static struct regulator_init_data rx51_vintdig = {
760 }, 760 },
761}; 761};
762 762
763static const char * const si4713_supply_names[] = {
764 "vio",
765 "vdd",
766};
767
763static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = { 768static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
769 .supplies = ARRAY_SIZE(si4713_supply_names),
770 .supply_names = si4713_supply_names,
764 .gpio_reset = RX51_FMTX_RESET_GPIO, 771 .gpio_reset = RX51_FMTX_RESET_GPIO,
765}; 772};
766 773
diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
deleted file mode 100644
index 865d30ee812f..000000000000
--- a/arch/arm/mach-omap2/cclock33xx_data.c
+++ /dev/null
@@ -1,1064 +0,0 @@
1/*
2 * AM33XX Clock data
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.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 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/kernel.h>
18#include <linux/list.h>
19#include <linux/clk-private.h>
20#include <linux/clkdev.h>
21#include <linux/io.h>
22
23#include "am33xx.h"
24#include "soc.h"
25#include "iomap.h"
26#include "clock.h"
27#include "control.h"
28#include "cm.h"
29#include "cm33xx.h"
30#include "cm-regbits-33xx.h"
31#include "prm.h"
32
33/* Modulemode control */
34#define AM33XX_MODULEMODE_HWCTRL_SHIFT 0
35#define AM33XX_MODULEMODE_SWCTRL_SHIFT 1
36
37/*LIST_HEAD(clocks);*/
38
39/* Root clocks */
40
41/* RTC 32k */
42DEFINE_CLK_FIXED_RATE(clk_32768_ck, CLK_IS_ROOT, 32768, 0x0);
43
44/* On-Chip 32KHz RC OSC */
45DEFINE_CLK_FIXED_RATE(clk_rc32k_ck, CLK_IS_ROOT, 32000, 0x0);
46
47/* Crystal input clks */
48DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
49
50DEFINE_CLK_FIXED_RATE(virt_24000000_ck, CLK_IS_ROOT, 24000000, 0x0);
51
52DEFINE_CLK_FIXED_RATE(virt_25000000_ck, CLK_IS_ROOT, 25000000, 0x0);
53
54DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
55
56/* Oscillator clock */
57/* 19.2, 24, 25 or 26 MHz */
58static const char *sys_clkin_ck_parents[] = {
59 "virt_19200000_ck", "virt_24000000_ck", "virt_25000000_ck",
60 "virt_26000000_ck",
61};
62
63/*
64 * sys_clk in: input to the dpll and also used as funtional clock for,
65 * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
66 *
67 */
68DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
69 AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
70 AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT,
71 AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH,
72 0, NULL);
73
74/* External clock - 12 MHz */
75DEFINE_CLK_FIXED_RATE(tclkin_ck, CLK_IS_ROOT, 12000000, 0x0);
76
77/* Module clocks and DPLL outputs */
78
79/* DPLL_CORE */
80static struct dpll_data dpll_core_dd = {
81 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_CORE,
82 .clk_bypass = &sys_clkin_ck,
83 .clk_ref = &sys_clkin_ck,
84 .control_reg = AM33XX_CM_CLKMODE_DPLL_CORE,
85 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
86 .idlest_reg = AM33XX_CM_IDLEST_DPLL_CORE,
87 .mult_mask = AM33XX_DPLL_MULT_MASK,
88 .div1_mask = AM33XX_DPLL_DIV_MASK,
89 .enable_mask = AM33XX_DPLL_EN_MASK,
90 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
91 .max_multiplier = 2047,
92 .max_divider = 128,
93 .min_divider = 1,
94};
95
96/* CLKDCOLDO output */
97static const char *dpll_core_ck_parents[] = {
98 "sys_clkin_ck",
99};
100
101static struct clk dpll_core_ck;
102
103static const struct clk_ops dpll_core_ck_ops = {
104 .recalc_rate = &omap3_dpll_recalc,
105 .get_parent = &omap2_init_dpll_parent,
106};
107
108static struct clk_hw_omap dpll_core_ck_hw = {
109 .hw = {
110 .clk = &dpll_core_ck,
111 },
112 .dpll_data = &dpll_core_dd,
113 .ops = &clkhwops_omap3_dpll,
114};
115
116DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
117
118static const char *dpll_core_x2_ck_parents[] = {
119 "dpll_core_ck",
120};
121
122static struct clk dpll_core_x2_ck;
123
124static const struct clk_ops dpll_x2_ck_ops = {
125 .recalc_rate = &omap3_clkoutx2_recalc,
126};
127
128static struct clk_hw_omap dpll_core_x2_ck_hw = {
129 .hw = {
130 .clk = &dpll_core_x2_ck,
131 },
132 .flags = CLOCK_CLKOUTX2,
133};
134
135DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_x2_ck_ops);
136
137DEFINE_CLK_DIVIDER(dpll_core_m4_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
138 0x0, AM33XX_CM_DIV_M4_DPLL_CORE,
139 AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT,
140 AM33XX_HSDIVIDER_CLKOUT1_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
141 NULL);
142
143DEFINE_CLK_DIVIDER(dpll_core_m5_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
144 0x0, AM33XX_CM_DIV_M5_DPLL_CORE,
145 AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT,
146 AM33XX_HSDIVIDER_CLKOUT2_DIV_WIDTH,
147 CLK_DIVIDER_ONE_BASED, NULL);
148
149DEFINE_CLK_DIVIDER(dpll_core_m6_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
150 0x0, AM33XX_CM_DIV_M6_DPLL_CORE,
151 AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT,
152 AM33XX_HSDIVIDER_CLKOUT3_DIV_WIDTH,
153 CLK_DIVIDER_ONE_BASED, NULL);
154
155
156/* DPLL_MPU */
157static struct dpll_data dpll_mpu_dd = {
158 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
159 .clk_bypass = &sys_clkin_ck,
160 .clk_ref = &sys_clkin_ck,
161 .control_reg = AM33XX_CM_CLKMODE_DPLL_MPU,
162 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
163 .idlest_reg = AM33XX_CM_IDLEST_DPLL_MPU,
164 .mult_mask = AM33XX_DPLL_MULT_MASK,
165 .div1_mask = AM33XX_DPLL_DIV_MASK,
166 .enable_mask = AM33XX_DPLL_EN_MASK,
167 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
168 .max_multiplier = 2047,
169 .max_divider = 128,
170 .min_divider = 1,
171};
172
173/* CLKOUT: fdpll/M2 */
174static struct clk dpll_mpu_ck;
175
176static const struct clk_ops dpll_mpu_ck_ops = {
177 .enable = &omap3_noncore_dpll_enable,
178 .disable = &omap3_noncore_dpll_disable,
179 .recalc_rate = &omap3_dpll_recalc,
180 .round_rate = &omap2_dpll_round_rate,
181 .set_rate = &omap3_noncore_dpll_set_rate,
182 .get_parent = &omap2_init_dpll_parent,
183};
184
185static struct clk_hw_omap dpll_mpu_ck_hw = {
186 .hw = {
187 .clk = &dpll_mpu_ck,
188 },
189 .dpll_data = &dpll_mpu_dd,
190 .ops = &clkhwops_omap3_dpll,
191};
192
193DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_mpu_ck_ops);
194
195/*
196 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
197 * and ALT_CLK1/2)
198 */
199DEFINE_CLK_DIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck,
200 0x0, AM33XX_CM_DIV_M2_DPLL_MPU, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
201 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
202
203/* DPLL_DDR */
204static struct dpll_data dpll_ddr_dd = {
205 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DDR,
206 .clk_bypass = &sys_clkin_ck,
207 .clk_ref = &sys_clkin_ck,
208 .control_reg = AM33XX_CM_CLKMODE_DPLL_DDR,
209 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
210 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DDR,
211 .mult_mask = AM33XX_DPLL_MULT_MASK,
212 .div1_mask = AM33XX_DPLL_DIV_MASK,
213 .enable_mask = AM33XX_DPLL_EN_MASK,
214 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
215 .max_multiplier = 2047,
216 .max_divider = 128,
217 .min_divider = 1,
218};
219
220/* CLKOUT: fdpll/M2 */
221static struct clk dpll_ddr_ck;
222
223static const struct clk_ops dpll_ddr_ck_ops = {
224 .recalc_rate = &omap3_dpll_recalc,
225 .get_parent = &omap2_init_dpll_parent,
226 .round_rate = &omap2_dpll_round_rate,
227 .set_rate = &omap3_noncore_dpll_set_rate,
228};
229
230static struct clk_hw_omap dpll_ddr_ck_hw = {
231 .hw = {
232 .clk = &dpll_ddr_ck,
233 },
234 .dpll_data = &dpll_ddr_dd,
235 .ops = &clkhwops_omap3_dpll,
236};
237
238DEFINE_STRUCT_CLK(dpll_ddr_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
239
240/*
241 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
242 * and ALT_CLK1/2)
243 */
244DEFINE_CLK_DIVIDER(dpll_ddr_m2_ck, "dpll_ddr_ck", &dpll_ddr_ck,
245 0x0, AM33XX_CM_DIV_M2_DPLL_DDR,
246 AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
247 CLK_DIVIDER_ONE_BASED, NULL);
248
249/* emif_fck functional clock */
250DEFINE_CLK_FIXED_FACTOR(dpll_ddr_m2_div2_ck, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck,
251 0x0, 1, 2);
252
253/* DPLL_DISP */
254static struct dpll_data dpll_disp_dd = {
255 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DISP,
256 .clk_bypass = &sys_clkin_ck,
257 .clk_ref = &sys_clkin_ck,
258 .control_reg = AM33XX_CM_CLKMODE_DPLL_DISP,
259 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
260 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DISP,
261 .mult_mask = AM33XX_DPLL_MULT_MASK,
262 .div1_mask = AM33XX_DPLL_DIV_MASK,
263 .enable_mask = AM33XX_DPLL_EN_MASK,
264 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
265 .max_multiplier = 2047,
266 .max_divider = 128,
267 .min_divider = 1,
268};
269
270/* CLKOUT: fdpll/M2 */
271static struct clk dpll_disp_ck;
272
273static struct clk_hw_omap dpll_disp_ck_hw = {
274 .hw = {
275 .clk = &dpll_disp_ck,
276 },
277 .dpll_data = &dpll_disp_dd,
278 .ops = &clkhwops_omap3_dpll,
279};
280
281DEFINE_STRUCT_CLK(dpll_disp_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
282
283/*
284 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
285 * and ALT_CLK1/2)
286 */
287DEFINE_CLK_DIVIDER(dpll_disp_m2_ck, "dpll_disp_ck", &dpll_disp_ck,
288 CLK_SET_RATE_PARENT, AM33XX_CM_DIV_M2_DPLL_DISP,
289 AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
290 CLK_DIVIDER_ONE_BASED, NULL);
291
292/* DPLL_PER */
293static struct dpll_data dpll_per_dd = {
294 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
295 .clk_bypass = &sys_clkin_ck,
296 .clk_ref = &sys_clkin_ck,
297 .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
298 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
299 .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
300 .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
301 .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
302 .enable_mask = AM33XX_DPLL_EN_MASK,
303 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
304 .max_multiplier = 2047,
305 .max_divider = 128,
306 .min_divider = 1,
307 .flags = DPLL_J_TYPE,
308};
309
310/* CLKDCOLDO */
311static struct clk dpll_per_ck;
312
313static struct clk_hw_omap dpll_per_ck_hw = {
314 .hw = {
315 .clk = &dpll_per_ck,
316 },
317 .dpll_data = &dpll_per_dd,
318 .ops = &clkhwops_omap3_dpll,
319};
320
321DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
322
323/* CLKOUT: fdpll/M2 */
324DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
325 AM33XX_CM_DIV_M2_DPLL_PER, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
326 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
327 NULL);
328
329DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_wkupdm_ck, "dpll_per_m2_ck",
330 &dpll_per_m2_ck, 0x0, 1, 4);
331
332DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_ck, "dpll_per_m2_ck",
333 &dpll_per_m2_ck, 0x0, 1, 4);
334
335DEFINE_CLK_FIXED_FACTOR(dpll_core_m4_div2_ck, "dpll_core_m4_ck",
336 &dpll_core_m4_ck, 0x0, 1, 2);
337
338DEFINE_CLK_FIXED_FACTOR(l4_rtc_gclk, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
339 1, 2);
340
341DEFINE_CLK_FIXED_FACTOR(clk_24mhz, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1,
342 8);
343
344/*
345 * Below clock nodes describes clockdomains derived out
346 * of core clock.
347 */
348static const struct clk_ops clk_ops_null = {
349};
350
351static const char *l3_gclk_parents[] = {
352 "dpll_core_m4_ck"
353};
354
355static struct clk l3_gclk;
356DEFINE_STRUCT_CLK_HW_OMAP(l3_gclk, NULL);
357DEFINE_STRUCT_CLK(l3_gclk, l3_gclk_parents, clk_ops_null);
358
359static struct clk l4hs_gclk;
360DEFINE_STRUCT_CLK_HW_OMAP(l4hs_gclk, NULL);
361DEFINE_STRUCT_CLK(l4hs_gclk, l3_gclk_parents, clk_ops_null);
362
363static const char *l3s_gclk_parents[] = {
364 "dpll_core_m4_div2_ck"
365};
366
367static struct clk l3s_gclk;
368DEFINE_STRUCT_CLK_HW_OMAP(l3s_gclk, NULL);
369DEFINE_STRUCT_CLK(l3s_gclk, l3s_gclk_parents, clk_ops_null);
370
371static struct clk l4fw_gclk;
372DEFINE_STRUCT_CLK_HW_OMAP(l4fw_gclk, NULL);
373DEFINE_STRUCT_CLK(l4fw_gclk, l3s_gclk_parents, clk_ops_null);
374
375static struct clk l4ls_gclk;
376DEFINE_STRUCT_CLK_HW_OMAP(l4ls_gclk, NULL);
377DEFINE_STRUCT_CLK(l4ls_gclk, l3s_gclk_parents, clk_ops_null);
378
379static struct clk sysclk_div_ck;
380DEFINE_STRUCT_CLK_HW_OMAP(sysclk_div_ck, NULL);
381DEFINE_STRUCT_CLK(sysclk_div_ck, l3_gclk_parents, clk_ops_null);
382
383/*
384 * In order to match the clock domain with hwmod clockdomain entry,
385 * separate clock nodes is required for the modules which are
386 * directly getting their funtioncal clock from sys_clkin.
387 */
388static struct clk adc_tsc_fck;
389DEFINE_STRUCT_CLK_HW_OMAP(adc_tsc_fck, NULL);
390DEFINE_STRUCT_CLK(adc_tsc_fck, dpll_core_ck_parents, clk_ops_null);
391
392static struct clk dcan0_fck;
393DEFINE_STRUCT_CLK_HW_OMAP(dcan0_fck, NULL);
394DEFINE_STRUCT_CLK(dcan0_fck, dpll_core_ck_parents, clk_ops_null);
395
396static struct clk dcan1_fck;
397DEFINE_STRUCT_CLK_HW_OMAP(dcan1_fck, NULL);
398DEFINE_STRUCT_CLK(dcan1_fck, dpll_core_ck_parents, clk_ops_null);
399
400static struct clk mcasp0_fck;
401DEFINE_STRUCT_CLK_HW_OMAP(mcasp0_fck, NULL);
402DEFINE_STRUCT_CLK(mcasp0_fck, dpll_core_ck_parents, clk_ops_null);
403
404static struct clk mcasp1_fck;
405DEFINE_STRUCT_CLK_HW_OMAP(mcasp1_fck, NULL);
406DEFINE_STRUCT_CLK(mcasp1_fck, dpll_core_ck_parents, clk_ops_null);
407
408static struct clk smartreflex0_fck;
409DEFINE_STRUCT_CLK_HW_OMAP(smartreflex0_fck, NULL);
410DEFINE_STRUCT_CLK(smartreflex0_fck, dpll_core_ck_parents, clk_ops_null);
411
412static struct clk smartreflex1_fck;
413DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
414DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
415
416static struct clk sha0_fck;
417DEFINE_STRUCT_CLK_HW_OMAP(sha0_fck, NULL);
418DEFINE_STRUCT_CLK(sha0_fck, dpll_core_ck_parents, clk_ops_null);
419
420static struct clk aes0_fck;
421DEFINE_STRUCT_CLK_HW_OMAP(aes0_fck, NULL);
422DEFINE_STRUCT_CLK(aes0_fck, dpll_core_ck_parents, clk_ops_null);
423
424static struct clk rng_fck;
425DEFINE_STRUCT_CLK_HW_OMAP(rng_fck, NULL);
426DEFINE_STRUCT_CLK(rng_fck, dpll_core_ck_parents, clk_ops_null);
427
428/*
429 * Modules clock nodes
430 *
431 * The following clock leaf nodes are added for the moment because:
432 *
433 * - hwmod data is not present for these modules, either hwmod
434 * control is not required or its not populated.
435 * - Driver code is not yet migrated to use hwmod/runtime pm
436 * - Modules outside kernel access (to disable them by default)
437 *
438 * - mmu (gfx domain)
439 * - cefuse
440 * - usbotg_fck (its additional clock and not really a modulemode)
441 * - ieee5000
442 */
443
444DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
445 AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
446 0x0, NULL);
447
448DEFINE_CLK_GATE(cefuse_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
449 AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
450 0x0, NULL);
451
452/*
453 * clkdiv32 is generated from fixed division of 732.4219
454 */
455DEFINE_CLK_FIXED_FACTOR(clkdiv32k_ck, "clk_24mhz", &clk_24mhz, 0x0, 1, 732);
456
457static struct clk clkdiv32k_ick;
458
459static const char *clkdiv32k_ick_parent_names[] = {
460 "clkdiv32k_ck",
461};
462
463static const struct clk_ops clkdiv32k_ick_ops = {
464 .enable = &omap2_dflt_clk_enable,
465 .disable = &omap2_dflt_clk_disable,
466 .is_enabled = &omap2_dflt_clk_is_enabled,
467 .init = &omap2_init_clk_clkdm,
468};
469
470static struct clk_hw_omap clkdiv32k_ick_hw = {
471 .hw = {
472 .clk = &clkdiv32k_ick,
473 },
474 .enable_reg = AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
475 .enable_bit = AM33XX_MODULEMODE_SWCTRL_SHIFT,
476 .clkdm_name = "clk_24mhz_clkdm",
477};
478
479DEFINE_STRUCT_CLK(clkdiv32k_ick, clkdiv32k_ick_parent_names, clkdiv32k_ick_ops);
480
481/* "usbotg_fck" is an additional clock and not really a modulemode */
482DEFINE_CLK_GATE(usbotg_fck, "dpll_per_ck", &dpll_per_ck, 0x0,
483 AM33XX_CM_CLKDCOLDO_DPLL_PER, AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
484 0x0, NULL);
485
486DEFINE_CLK_GATE(ieee5000_fck, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck,
487 0x0, AM33XX_CM_PER_IEEE5000_CLKCTRL,
488 AM33XX_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
489
490/* Timers */
491static const struct clksel timer1_clkmux_sel[] = {
492 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
493 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
494 { .parent = &tclkin_ck, .rates = div_1_2_rates },
495 { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
496 { .parent = &clk_32768_ck, .rates = div_1_4_rates },
497 { .parent = NULL },
498};
499
500static const char *timer1_ck_parents[] = {
501 "sys_clkin_ck", "clkdiv32k_ick", "tclkin_ck", "clk_rc32k_ck",
502 "clk_32768_ck",
503};
504
505static struct clk timer1_fck;
506
507static const struct clk_ops timer1_fck_ops = {
508 .recalc_rate = &omap2_clksel_recalc,
509 .get_parent = &omap2_clksel_find_parent_index,
510 .set_parent = &omap2_clksel_set_parent,
511 .init = &omap2_init_clk_clkdm,
512};
513
514static struct clk_hw_omap timer1_fck_hw = {
515 .hw = {
516 .clk = &timer1_fck,
517 },
518 .clkdm_name = "l4ls_clkdm",
519 .clksel = timer1_clkmux_sel,
520 .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
521 .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
522};
523
524DEFINE_STRUCT_CLK(timer1_fck, timer1_ck_parents, timer1_fck_ops);
525
526static const struct clksel timer2_to_7_clk_sel[] = {
527 { .parent = &tclkin_ck, .rates = div_1_0_rates },
528 { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
529 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
530 { .parent = NULL },
531};
532
533static const char *timer2_to_7_ck_parents[] = {
534 "tclkin_ck", "sys_clkin_ck", "clkdiv32k_ick",
535};
536
537static struct clk timer2_fck;
538
539static struct clk_hw_omap timer2_fck_hw = {
540 .hw = {
541 .clk = &timer2_fck,
542 },
543 .clkdm_name = "l4ls_clkdm",
544 .clksel = timer2_to_7_clk_sel,
545 .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
546 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
547};
548
549DEFINE_STRUCT_CLK(timer2_fck, timer2_to_7_ck_parents, timer1_fck_ops);
550
551static struct clk timer3_fck;
552
553static struct clk_hw_omap timer3_fck_hw = {
554 .hw = {
555 .clk = &timer3_fck,
556 },
557 .clkdm_name = "l4ls_clkdm",
558 .clksel = timer2_to_7_clk_sel,
559 .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
560 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
561};
562
563DEFINE_STRUCT_CLK(timer3_fck, timer2_to_7_ck_parents, timer1_fck_ops);
564
565static struct clk timer4_fck;
566
567static struct clk_hw_omap timer4_fck_hw = {
568 .hw = {
569 .clk = &timer4_fck,
570 },
571 .clkdm_name = "l4ls_clkdm",
572 .clksel = timer2_to_7_clk_sel,
573 .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
574 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
575};
576
577DEFINE_STRUCT_CLK(timer4_fck, timer2_to_7_ck_parents, timer1_fck_ops);
578
579static struct clk timer5_fck;
580
581static struct clk_hw_omap timer5_fck_hw = {
582 .hw = {
583 .clk = &timer5_fck,
584 },
585 .clkdm_name = "l4ls_clkdm",
586 .clksel = timer2_to_7_clk_sel,
587 .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
588 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
589};
590
591DEFINE_STRUCT_CLK(timer5_fck, timer2_to_7_ck_parents, timer1_fck_ops);
592
593static struct clk timer6_fck;
594
595static struct clk_hw_omap timer6_fck_hw = {
596 .hw = {
597 .clk = &timer6_fck,
598 },
599 .clkdm_name = "l4ls_clkdm",
600 .clksel = timer2_to_7_clk_sel,
601 .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
602 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
603};
604
605DEFINE_STRUCT_CLK(timer6_fck, timer2_to_7_ck_parents, timer1_fck_ops);
606
607static struct clk timer7_fck;
608
609static struct clk_hw_omap timer7_fck_hw = {
610 .hw = {
611 .clk = &timer7_fck,
612 },
613 .clkdm_name = "l4ls_clkdm",
614 .clksel = timer2_to_7_clk_sel,
615 .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
616 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
617};
618
619DEFINE_STRUCT_CLK(timer7_fck, timer2_to_7_ck_parents, timer1_fck_ops);
620
621DEFINE_CLK_FIXED_FACTOR(cpsw_125mhz_gclk,
622 "dpll_core_m5_ck",
623 &dpll_core_m5_ck,
624 0x0,
625 1, 2);
626
627static const struct clk_ops cpsw_fck_ops = {
628 .recalc_rate = &omap2_clksel_recalc,
629 .get_parent = &omap2_clksel_find_parent_index,
630 .set_parent = &omap2_clksel_set_parent,
631};
632
633static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
634 { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
635 { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
636 { .parent = NULL },
637};
638
639static const char *cpsw_cpts_rft_ck_parents[] = {
640 "dpll_core_m5_ck", "dpll_core_m4_ck",
641};
642
643static struct clk cpsw_cpts_rft_clk;
644
645static struct clk_hw_omap cpsw_cpts_rft_clk_hw = {
646 .hw = {
647 .clk = &cpsw_cpts_rft_clk,
648 },
649 .clkdm_name = "cpsw_125mhz_clkdm",
650 .clksel = cpsw_cpts_rft_clkmux_sel,
651 .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
652 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
653};
654
655DEFINE_STRUCT_CLK(cpsw_cpts_rft_clk, cpsw_cpts_rft_ck_parents, cpsw_fck_ops);
656
657
658/* gpio */
659static const char *gpio0_ck_parents[] = {
660 "clk_rc32k_ck", "clk_32768_ck", "clkdiv32k_ick",
661};
662
663static const struct clksel gpio0_dbclk_mux_sel[] = {
664 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
665 { .parent = &clk_32768_ck, .rates = div_1_1_rates },
666 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
667 { .parent = NULL },
668};
669
670static const struct clk_ops gpio_fck_ops = {
671 .recalc_rate = &omap2_clksel_recalc,
672 .get_parent = &omap2_clksel_find_parent_index,
673 .set_parent = &omap2_clksel_set_parent,
674 .init = &omap2_init_clk_clkdm,
675};
676
677static struct clk gpio0_dbclk_mux_ck;
678
679static struct clk_hw_omap gpio0_dbclk_mux_ck_hw = {
680 .hw = {
681 .clk = &gpio0_dbclk_mux_ck,
682 },
683 .clkdm_name = "l4_wkup_clkdm",
684 .clksel = gpio0_dbclk_mux_sel,
685 .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
686 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
687};
688
689DEFINE_STRUCT_CLK(gpio0_dbclk_mux_ck, gpio0_ck_parents, gpio_fck_ops);
690
691DEFINE_CLK_GATE(gpio0_dbclk, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, 0x0,
692 AM33XX_CM_WKUP_GPIO0_CLKCTRL,
693 AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT, 0x0, NULL);
694
695DEFINE_CLK_GATE(gpio1_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
696 AM33XX_CM_PER_GPIO1_CLKCTRL,
697 AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT, 0x0, NULL);
698
699DEFINE_CLK_GATE(gpio2_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
700 AM33XX_CM_PER_GPIO2_CLKCTRL,
701 AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT, 0x0, NULL);
702
703DEFINE_CLK_GATE(gpio3_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
704 AM33XX_CM_PER_GPIO3_CLKCTRL,
705 AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT, 0x0, NULL);
706
707
708static const char *pruss_ck_parents[] = {
709 "l3_gclk", "dpll_disp_m2_ck",
710};
711
712static const struct clksel pruss_ocp_clk_mux_sel[] = {
713 { .parent = &l3_gclk, .rates = div_1_0_rates },
714 { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
715 { .parent = NULL },
716};
717
718static struct clk pruss_ocp_gclk;
719
720static struct clk_hw_omap pruss_ocp_gclk_hw = {
721 .hw = {
722 .clk = &pruss_ocp_gclk,
723 },
724 .clkdm_name = "pruss_ocp_clkdm",
725 .clksel = pruss_ocp_clk_mux_sel,
726 .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
727 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
728};
729
730DEFINE_STRUCT_CLK(pruss_ocp_gclk, pruss_ck_parents, gpio_fck_ops);
731
732static const char *lcd_ck_parents[] = {
733 "dpll_disp_m2_ck", "dpll_core_m5_ck", "dpll_per_m2_ck",
734};
735
736static const struct clksel lcd_clk_mux_sel[] = {
737 { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
738 { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
739 { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
740 { .parent = NULL },
741};
742
743static struct clk lcd_gclk;
744
745static struct clk_hw_omap lcd_gclk_hw = {
746 .hw = {
747 .clk = &lcd_gclk,
748 },
749 .clkdm_name = "lcdc_clkdm",
750 .clksel = lcd_clk_mux_sel,
751 .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
752 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
753};
754
755DEFINE_STRUCT_CLK_FLAGS(lcd_gclk, lcd_ck_parents,
756 gpio_fck_ops, CLK_SET_RATE_PARENT);
757
758DEFINE_CLK_FIXED_FACTOR(mmc_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1, 2);
759
760static const char *gfx_ck_parents[] = {
761 "dpll_core_m4_ck", "dpll_per_m2_ck",
762};
763
764static const struct clksel gfx_clksel_sel[] = {
765 { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
766 { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
767 { .parent = NULL },
768};
769
770static struct clk gfx_fclk_clksel_ck;
771
772static struct clk_hw_omap gfx_fclk_clksel_ck_hw = {
773 .hw = {
774 .clk = &gfx_fclk_clksel_ck,
775 },
776 .clksel = gfx_clksel_sel,
777 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
778 .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
779};
780
781DEFINE_STRUCT_CLK(gfx_fclk_clksel_ck, gfx_ck_parents, gpio_fck_ops);
782
783static const struct clk_div_table div_1_0_2_1_rates[] = {
784 { .div = 1, .val = 0, },
785 { .div = 2, .val = 1, },
786 { .div = 0 },
787};
788
789DEFINE_CLK_DIVIDER_TABLE(gfx_fck_div_ck, "gfx_fclk_clksel_ck",
790 &gfx_fclk_clksel_ck, 0x0, AM33XX_CLKSEL_GFX_FCLK,
791 AM33XX_CLKSEL_0_0_SHIFT, AM33XX_CLKSEL_0_0_WIDTH,
792 0x0, div_1_0_2_1_rates, NULL);
793
794static const char *sysclkout_ck_parents[] = {
795 "clk_32768_ck", "l3_gclk", "dpll_ddr_m2_ck", "dpll_per_m2_ck",
796 "lcd_gclk",
797};
798
799static const struct clksel sysclkout_pre_sel[] = {
800 { .parent = &clk_32768_ck, .rates = div_1_0_rates },
801 { .parent = &l3_gclk, .rates = div_1_1_rates },
802 { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
803 { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
804 { .parent = &lcd_gclk, .rates = div_1_4_rates },
805 { .parent = NULL },
806};
807
808static struct clk sysclkout_pre_ck;
809
810static struct clk_hw_omap sysclkout_pre_ck_hw = {
811 .hw = {
812 .clk = &sysclkout_pre_ck,
813 },
814 .clksel = sysclkout_pre_sel,
815 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
816 .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
817};
818
819DEFINE_STRUCT_CLK(sysclkout_pre_ck, sysclkout_ck_parents, gpio_fck_ops);
820
821/* Divide by 8 clock rates with default clock is 1/1*/
822static const struct clk_div_table div8_rates[] = {
823 { .div = 1, .val = 0, },
824 { .div = 2, .val = 1, },
825 { .div = 3, .val = 2, },
826 { .div = 4, .val = 3, },
827 { .div = 5, .val = 4, },
828 { .div = 6, .val = 5, },
829 { .div = 7, .val = 6, },
830 { .div = 8, .val = 7, },
831 { .div = 0 },
832};
833
834DEFINE_CLK_DIVIDER_TABLE(clkout2_div_ck, "sysclkout_pre_ck", &sysclkout_pre_ck,
835 0x0, AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2DIV_SHIFT,
836 AM33XX_CLKOUT2DIV_WIDTH, 0x0, div8_rates, NULL);
837
838DEFINE_CLK_GATE(clkout2_ck, "clkout2_div_ck", &clkout2_div_ck, 0x0,
839 AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2EN_SHIFT, 0x0, NULL);
840
841static const char *wdt_ck_parents[] = {
842 "clk_rc32k_ck", "clkdiv32k_ick",
843};
844
845static const struct clksel wdt_clkmux_sel[] = {
846 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
847 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
848 { .parent = NULL },
849};
850
851static struct clk wdt1_fck;
852
853static struct clk_hw_omap wdt1_fck_hw = {
854 .hw = {
855 .clk = &wdt1_fck,
856 },
857 .clkdm_name = "l4_wkup_clkdm",
858 .clksel = wdt_clkmux_sel,
859 .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
860 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
861};
862
863DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
864
865static const char *pwmss_clk_parents[] = {
866 "dpll_per_m2_ck",
867};
868
869static const struct clk_ops ehrpwm_tbclk_ops = {
870 .enable = &omap2_dflt_clk_enable,
871 .disable = &omap2_dflt_clk_disable,
872};
873
874DEFINE_CLK_OMAP_MUX_GATE(ehrpwm0_tbclk, "l4ls_clkdm",
875 NULL, NULL, 0,
876 AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
877 AM33XX_PWMSS0_TBCLKEN_SHIFT,
878 NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
879
880DEFINE_CLK_OMAP_MUX_GATE(ehrpwm1_tbclk, "l4ls_clkdm",
881 NULL, NULL, 0,
882 AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
883 AM33XX_PWMSS1_TBCLKEN_SHIFT,
884 NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
885
886DEFINE_CLK_OMAP_MUX_GATE(ehrpwm2_tbclk, "l4ls_clkdm",
887 NULL, NULL, 0,
888 AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
889 AM33XX_PWMSS2_TBCLKEN_SHIFT,
890 NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
891
892/*
893 * debugss optional clocks
894 */
895DEFINE_CLK_GATE(dbg_sysclk_ck, "sys_clkin_ck", &sys_clkin_ck,
896 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
897 AM33XX_OPTFCLKEN_DBGSYSCLK_SHIFT, 0x0, NULL);
898
899DEFINE_CLK_GATE(dbg_clka_ck, "dpll_core_m4_ck", &dpll_core_m4_ck,
900 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
901 AM33XX_OPTCLK_DEBUG_CLKA_SHIFT, 0x0, NULL);
902
903static const char *stm_pmd_clock_mux_ck_parents[] = {
904 "dbg_sysclk_ck", "dbg_clka_ck",
905};
906
907DEFINE_CLK_MUX(stm_pmd_clock_mux_ck, stm_pmd_clock_mux_ck_parents, NULL, 0x0,
908 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_STM_PMD_CLKSEL_SHIFT,
909 AM33XX_STM_PMD_CLKSEL_WIDTH, 0x0, NULL);
910
911DEFINE_CLK_MUX(trace_pmd_clk_mux_ck, stm_pmd_clock_mux_ck_parents, NULL, 0x0,
912 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
913 AM33XX_TRC_PMD_CLKSEL_SHIFT,
914 AM33XX_TRC_PMD_CLKSEL_WIDTH, 0x0, NULL);
915
916DEFINE_CLK_DIVIDER(stm_clk_div_ck, "stm_pmd_clock_mux_ck",
917 &stm_pmd_clock_mux_ck, 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
918 AM33XX_STM_PMD_CLKDIVSEL_SHIFT,
919 AM33XX_STM_PMD_CLKDIVSEL_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
920 NULL);
921
922DEFINE_CLK_DIVIDER(trace_clk_div_ck, "trace_pmd_clk_mux_ck",
923 &trace_pmd_clk_mux_ck, 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
924 AM33XX_TRC_PMD_CLKDIVSEL_SHIFT,
925 AM33XX_TRC_PMD_CLKDIVSEL_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
926 NULL);
927
928/*
929 * clkdev
930 */
931static struct omap_clk am33xx_clks[] = {
932 CLK(NULL, "clk_32768_ck", &clk_32768_ck),
933 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck),
934 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck),
935 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck),
936 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck),
937 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck),
938 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck),
939 CLK(NULL, "tclkin_ck", &tclkin_ck),
940 CLK(NULL, "dpll_core_ck", &dpll_core_ck),
941 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck),
942 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck),
943 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck),
944 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck),
945 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck),
946 CLK("cpu0", NULL, &dpll_mpu_ck),
947 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck),
948 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck),
949 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck),
950 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck),
951 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck),
952 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck),
953 CLK(NULL, "dpll_per_ck", &dpll_per_ck),
954 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck),
955 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck),
956 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck),
957 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck),
958 CLK(NULL, "cefuse_fck", &cefuse_fck),
959 CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck),
960 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick),
961 CLK(NULL, "dcan0_fck", &dcan0_fck),
962 CLK("481cc000.d_can", NULL, &dcan0_fck),
963 CLK(NULL, "dcan1_fck", &dcan1_fck),
964 CLK("481d0000.d_can", NULL, &dcan1_fck),
965 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk),
966 CLK(NULL, "mcasp0_fck", &mcasp0_fck),
967 CLK(NULL, "mcasp1_fck", &mcasp1_fck),
968 CLK(NULL, "mmu_fck", &mmu_fck),
969 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck),
970 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck),
971 CLK(NULL, "sha0_fck", &sha0_fck),
972 CLK(NULL, "aes0_fck", &aes0_fck),
973 CLK(NULL, "rng_fck", &rng_fck),
974 CLK(NULL, "timer1_fck", &timer1_fck),
975 CLK(NULL, "timer2_fck", &timer2_fck),
976 CLK(NULL, "timer3_fck", &timer3_fck),
977 CLK(NULL, "timer4_fck", &timer4_fck),
978 CLK(NULL, "timer5_fck", &timer5_fck),
979 CLK(NULL, "timer6_fck", &timer6_fck),
980 CLK(NULL, "timer7_fck", &timer7_fck),
981 CLK(NULL, "usbotg_fck", &usbotg_fck),
982 CLK(NULL, "ieee5000_fck", &ieee5000_fck),
983 CLK(NULL, "wdt1_fck", &wdt1_fck),
984 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk),
985 CLK(NULL, "l3_gclk", &l3_gclk),
986 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck),
987 CLK(NULL, "l4hs_gclk", &l4hs_gclk),
988 CLK(NULL, "l3s_gclk", &l3s_gclk),
989 CLK(NULL, "l4fw_gclk", &l4fw_gclk),
990 CLK(NULL, "l4ls_gclk", &l4ls_gclk),
991 CLK(NULL, "clk_24mhz", &clk_24mhz),
992 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck),
993 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk),
994 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk),
995 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck),
996 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk),
997 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk),
998 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk),
999 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk),
1000 CLK(NULL, "lcd_gclk", &lcd_gclk),
1001 CLK(NULL, "mmc_clk", &mmc_clk),
1002 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck),
1003 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck),
1004 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck),
1005 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck),
1006 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick),
1007 CLK(NULL, "timer_sys_ck", &sys_clkin_ck),
1008 CLK(NULL, "dbg_sysclk_ck", &dbg_sysclk_ck),
1009 CLK(NULL, "dbg_clka_ck", &dbg_clka_ck),
1010 CLK(NULL, "stm_pmd_clock_mux_ck", &stm_pmd_clock_mux_ck),
1011 CLK(NULL, "trace_pmd_clk_mux_ck", &trace_pmd_clk_mux_ck),
1012 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck),
1013 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck),
1014 CLK(NULL, "clkout2_ck", &clkout2_ck),
1015 CLK("48300200.ehrpwm", "tbclk", &ehrpwm0_tbclk),
1016 CLK("48302200.ehrpwm", "tbclk", &ehrpwm1_tbclk),
1017 CLK("48304200.ehrpwm", "tbclk", &ehrpwm2_tbclk),
1018};
1019
1020
1021static const char *enable_init_clks[] = {
1022 "dpll_ddr_m2_ck",
1023 "dpll_mpu_m2_ck",
1024 "l3_gclk",
1025 "l4hs_gclk",
1026 "l4fw_gclk",
1027 "l4ls_gclk",
1028 "clkout2_ck", /* Required for external peripherals like, Audio codecs */
1029};
1030
1031int __init am33xx_clk_init(void)
1032{
1033 if (soc_is_am33xx())
1034 cpu_mask = RATE_IN_AM33XX;
1035
1036 omap_clocks_register(am33xx_clks, ARRAY_SIZE(am33xx_clks));
1037
1038 omap2_clk_disable_autoidle_all();
1039
1040 omap2_clk_enable_init_clocks(enable_init_clks,
1041 ARRAY_SIZE(enable_init_clks));
1042
1043 /* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
1044 * physically present, in such a case HWMOD enabling of
1045 * clock would be failure with default parent. And timer
1046 * probe thinks clock is already enabled, this leads to
1047 * crash upon accessing timer 3 & 6 registers in probe.
1048 * Fix by setting parent of both these timers to master
1049 * oscillator clock.
1050 */
1051
1052 clk_set_parent(&timer3_fck, &sys_clkin_ck);
1053 clk_set_parent(&timer6_fck, &sys_clkin_ck);
1054 /*
1055 * The On-Chip 32K RC Osc clock is not an accurate clock-source as per
1056 * the design/spec, so as a result, for example, timer which supposed
1057 * to get expired @60Sec, but will expire somewhere ~@40Sec, which is
1058 * not expected by any use-case, so change WDT1 clock source to PRCM
1059 * 32KHz clock.
1060 */
1061 clk_set_parent(&wdt1_fck, &clkdiv32k_ick);
1062
1063 return 0;
1064}
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
deleted file mode 100644
index ec0dc0b1755e..000000000000
--- a/arch/arm/mach-omap2/cclock44xx_data.c
+++ /dev/null
@@ -1,1735 +0,0 @@
1/*
2 * OMAP4 Clock data
3 *
4 * Copyright (C) 2009-2012 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 * Mike Turquette (mturquette@ti.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * XXX Some of the ES1 clocks have been removed/changed; once support
17 * is added for discriminating clocks by ES level, these should be added back
18 * in.
19 *
20 * XXX All of the remaining MODULEMODE clock nodes should be removed
21 * once the drivers are updated to use pm_runtime or to use the appropriate
22 * upstream clock node for rate/parent selection.
23 */
24
25#include <linux/kernel.h>
26#include <linux/list.h>
27#include <linux/clk-private.h>
28#include <linux/clkdev.h>
29#include <linux/io.h>
30
31#include "soc.h"
32#include "iomap.h"
33#include "clock.h"
34#include "clock44xx.h"
35#include "cm1_44xx.h"
36#include "cm2_44xx.h"
37#include "cm-regbits-44xx.h"
38#include "prm44xx.h"
39#include "prm-regbits-44xx.h"
40#include "control.h"
41#include "scrm44xx.h"
42
43/* OMAP4 modulemode control */
44#define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0
45#define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1
46
47/*
48 * OMAP4 ABE DPLL default frequency. In OMAP4460 TRM version V, section
49 * "3.6.3.2.3 CM1_ABE Clock Generator" states that the "DPLL_ABE_X2_CLK
50 * must be set to 196.608 MHz" and hence, the DPLL locked frequency is
51 * half of this value.
52 */
53#define OMAP4_DPLL_ABE_DEFFREQ 98304000
54
55/*
56 * OMAP4 USB DPLL default frequency. In OMAP4430 TRM version V, section
57 * "3.6.3.9.5 DPLL_USB Preferred Settings" shows that the preferred
58 * locked frequency for the USB DPLL is 960MHz.
59 */
60#define OMAP4_DPLL_USB_DEFFREQ 960000000
61
62/* Root clocks */
63
64DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
65
66DEFINE_CLK_FIXED_RATE(pad_clks_src_ck, CLK_IS_ROOT, 12000000, 0x0);
67
68DEFINE_CLK_GATE(pad_clks_ck, "pad_clks_src_ck", &pad_clks_src_ck, 0x0,
69 OMAP4430_CM_CLKSEL_ABE, OMAP4430_PAD_CLKS_GATE_SHIFT,
70 0x0, NULL);
71
72DEFINE_CLK_FIXED_RATE(pad_slimbus_core_clks_ck, CLK_IS_ROOT, 12000000, 0x0);
73
74DEFINE_CLK_FIXED_RATE(secure_32k_clk_src_ck, CLK_IS_ROOT, 32768, 0x0);
75
76DEFINE_CLK_FIXED_RATE(slimbus_src_clk, CLK_IS_ROOT, 12000000, 0x0);
77
78DEFINE_CLK_GATE(slimbus_clk, "slimbus_src_clk", &slimbus_src_clk, 0x0,
79 OMAP4430_CM_CLKSEL_ABE, OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
80 0x0, NULL);
81
82DEFINE_CLK_FIXED_RATE(sys_32k_ck, CLK_IS_ROOT, 32768, 0x0);
83
84DEFINE_CLK_FIXED_RATE(virt_12000000_ck, CLK_IS_ROOT, 12000000, 0x0);
85
86DEFINE_CLK_FIXED_RATE(virt_13000000_ck, CLK_IS_ROOT, 13000000, 0x0);
87
88DEFINE_CLK_FIXED_RATE(virt_16800000_ck, CLK_IS_ROOT, 16800000, 0x0);
89
90DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
91
92DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
93
94DEFINE_CLK_FIXED_RATE(virt_27000000_ck, CLK_IS_ROOT, 27000000, 0x0);
95
96DEFINE_CLK_FIXED_RATE(virt_38400000_ck, CLK_IS_ROOT, 38400000, 0x0);
97
98static const char *sys_clkin_ck_parents[] = {
99 "virt_12000000_ck", "virt_13000000_ck", "virt_16800000_ck",
100 "virt_19200000_ck", "virt_26000000_ck", "virt_27000000_ck",
101 "virt_38400000_ck",
102};
103
104DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
105 OMAP4430_CM_SYS_CLKSEL, OMAP4430_SYS_CLKSEL_SHIFT,
106 OMAP4430_SYS_CLKSEL_WIDTH, CLK_MUX_INDEX_ONE, NULL);
107
108DEFINE_CLK_FIXED_RATE(tie_low_clock_ck, CLK_IS_ROOT, 0, 0x0);
109
110DEFINE_CLK_FIXED_RATE(utmi_phy_clkout_ck, CLK_IS_ROOT, 60000000, 0x0);
111
112DEFINE_CLK_FIXED_RATE(xclk60mhsp1_ck, CLK_IS_ROOT, 60000000, 0x0);
113
114DEFINE_CLK_FIXED_RATE(xclk60mhsp2_ck, CLK_IS_ROOT, 60000000, 0x0);
115
116DEFINE_CLK_FIXED_RATE(xclk60motg_ck, CLK_IS_ROOT, 60000000, 0x0);
117
118/* Module clocks and DPLL outputs */
119
120static const char *abe_dpll_bypass_clk_mux_ck_parents[] = {
121 "sys_clkin_ck", "sys_32k_ck",
122};
123
124DEFINE_CLK_MUX(abe_dpll_bypass_clk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents,
125 NULL, 0x0, OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_SHIFT,
126 OMAP4430_CLKSEL_WIDTH, 0x0, NULL);
127
128DEFINE_CLK_MUX(abe_dpll_refclk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents, NULL,
129 0x0, OMAP4430_CM_ABE_PLL_REF_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
130 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
131
132/* DPLL_ABE */
133static struct dpll_data dpll_abe_dd = {
134 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
135 .clk_bypass = &abe_dpll_bypass_clk_mux_ck,
136 .clk_ref = &abe_dpll_refclk_mux_ck,
137 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
138 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
139 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
140 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
141 .mult_mask = OMAP4430_DPLL_MULT_MASK,
142 .div1_mask = OMAP4430_DPLL_DIV_MASK,
143 .enable_mask = OMAP4430_DPLL_EN_MASK,
144 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
145 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
146 .m4xen_mask = OMAP4430_DPLL_REGM4XEN_MASK,
147 .lpmode_mask = OMAP4430_DPLL_LPMODE_EN_MASK,
148 .max_multiplier = 2047,
149 .max_divider = 128,
150 .min_divider = 1,
151};
152
153
154static const char *dpll_abe_ck_parents[] = {
155 "abe_dpll_refclk_mux_ck",
156};
157
158static struct clk dpll_abe_ck;
159
160static const struct clk_ops dpll_abe_ck_ops = {
161 .enable = &omap3_noncore_dpll_enable,
162 .disable = &omap3_noncore_dpll_disable,
163 .recalc_rate = &omap4_dpll_regm4xen_recalc,
164 .round_rate = &omap4_dpll_regm4xen_round_rate,
165 .set_rate = &omap3_noncore_dpll_set_rate,
166 .get_parent = &omap2_init_dpll_parent,
167};
168
169static struct clk_hw_omap dpll_abe_ck_hw = {
170 .hw = {
171 .clk = &dpll_abe_ck,
172 },
173 .dpll_data = &dpll_abe_dd,
174 .ops = &clkhwops_omap3_dpll,
175};
176
177DEFINE_STRUCT_CLK(dpll_abe_ck, dpll_abe_ck_parents, dpll_abe_ck_ops);
178
179static const char *dpll_abe_x2_ck_parents[] = {
180 "dpll_abe_ck",
181};
182
183static struct clk dpll_abe_x2_ck;
184
185static const struct clk_ops dpll_abe_x2_ck_ops = {
186 .recalc_rate = &omap3_clkoutx2_recalc,
187};
188
189static struct clk_hw_omap dpll_abe_x2_ck_hw = {
190 .hw = {
191 .clk = &dpll_abe_x2_ck,
192 },
193 .flags = CLOCK_CLKOUTX2,
194 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
195 .ops = &clkhwops_omap4_dpllmx,
196};
197
198DEFINE_STRUCT_CLK(dpll_abe_x2_ck, dpll_abe_x2_ck_parents, dpll_abe_x2_ck_ops);
199
200static const struct clk_ops omap_hsdivider_ops = {
201 .set_rate = &omap2_clksel_set_rate,
202 .recalc_rate = &omap2_clksel_recalc,
203 .round_rate = &omap2_clksel_round_rate,
204};
205
206DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m2x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
207 0x0, OMAP4430_CM_DIV_M2_DPLL_ABE,
208 OMAP4430_DPLL_CLKOUT_DIV_MASK);
209
210DEFINE_CLK_FIXED_FACTOR(abe_24m_fclk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
211 0x0, 1, 8);
212
213DEFINE_CLK_DIVIDER(abe_clk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, 0x0,
214 OMAP4430_CM_CLKSEL_ABE, OMAP4430_CLKSEL_OPP_SHIFT,
215 OMAP4430_CLKSEL_OPP_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
216
217DEFINE_CLK_DIVIDER(aess_fclk, "abe_clk", &abe_clk, 0x0,
218 OMAP4430_CM1_ABE_AESS_CLKCTRL,
219 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
220 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
221 0x0, NULL);
222
223DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m3x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
224 0x0, OMAP4430_CM_DIV_M3_DPLL_ABE,
225 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK);
226
227static const char *core_hsd_byp_clk_mux_ck_parents[] = {
228 "sys_clkin_ck", "dpll_abe_m3x2_ck",
229};
230
231DEFINE_CLK_MUX(core_hsd_byp_clk_mux_ck, core_hsd_byp_clk_mux_ck_parents, NULL,
232 0x0, OMAP4430_CM_CLKSEL_DPLL_CORE,
233 OMAP4430_DPLL_BYP_CLKSEL_SHIFT, OMAP4430_DPLL_BYP_CLKSEL_WIDTH,
234 0x0, NULL);
235
236/* DPLL_CORE */
237static struct dpll_data dpll_core_dd = {
238 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
239 .clk_bypass = &core_hsd_byp_clk_mux_ck,
240 .clk_ref = &sys_clkin_ck,
241 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
242 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
243 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
244 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
245 .mult_mask = OMAP4430_DPLL_MULT_MASK,
246 .div1_mask = OMAP4430_DPLL_DIV_MASK,
247 .enable_mask = OMAP4430_DPLL_EN_MASK,
248 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
249 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
250 .max_multiplier = 2047,
251 .max_divider = 128,
252 .min_divider = 1,
253};
254
255
256static const char *dpll_core_ck_parents[] = {
257 "sys_clkin_ck", "core_hsd_byp_clk_mux_ck"
258};
259
260static struct clk dpll_core_ck;
261
262static const struct clk_ops dpll_core_ck_ops = {
263 .recalc_rate = &omap3_dpll_recalc,
264 .get_parent = &omap2_init_dpll_parent,
265};
266
267static struct clk_hw_omap dpll_core_ck_hw = {
268 .hw = {
269 .clk = &dpll_core_ck,
270 },
271 .dpll_data = &dpll_core_dd,
272 .ops = &clkhwops_omap3_dpll,
273};
274
275DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
276
277static const char *dpll_core_x2_ck_parents[] = {
278 "dpll_core_ck",
279};
280
281static struct clk dpll_core_x2_ck;
282
283static struct clk_hw_omap dpll_core_x2_ck_hw = {
284 .hw = {
285 .clk = &dpll_core_x2_ck,
286 },
287};
288
289DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_abe_x2_ck_ops);
290
291DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m6x2_ck, "dpll_core_x2_ck",
292 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M6_DPLL_CORE,
293 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
294
295DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m2_ck, "dpll_core_ck", &dpll_core_ck, 0x0,
296 OMAP4430_CM_DIV_M2_DPLL_CORE,
297 OMAP4430_DPLL_CLKOUT_DIV_MASK);
298
299DEFINE_CLK_FIXED_FACTOR(ddrphy_ck, "dpll_core_m2_ck", &dpll_core_m2_ck, 0x0, 1,
300 2);
301
302DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m5x2_ck, "dpll_core_x2_ck",
303 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M5_DPLL_CORE,
304 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
305
306DEFINE_CLK_DIVIDER(div_core_ck, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, 0x0,
307 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT,
308 OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL);
309
310DEFINE_CLK_DIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck,
311 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA, OMAP4430_CLKSEL_0_1_SHIFT,
312 OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
313
314DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck,
315 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT,
316 OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
317
318DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m4x2_ck, "dpll_core_x2_ck",
319 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M4_DPLL_CORE,
320 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
321
322DEFINE_CLK_FIXED_FACTOR(dll_clk_div_ck, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck,
323 0x0, 1, 2);
324
325DEFINE_CLK_DIVIDER(dpll_abe_m2_ck, "dpll_abe_ck", &dpll_abe_ck, 0x0,
326 OMAP4430_CM_DIV_M2_DPLL_ABE, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
327 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
328
329static const struct clk_ops dpll_hsd_ops = {
330 .enable = &omap2_dflt_clk_enable,
331 .disable = &omap2_dflt_clk_disable,
332 .is_enabled = &omap2_dflt_clk_is_enabled,
333 .recalc_rate = &omap2_clksel_recalc,
334 .get_parent = &omap2_clksel_find_parent_index,
335 .set_parent = &omap2_clksel_set_parent,
336 .init = &omap2_init_clk_clkdm,
337};
338
339static const struct clk_ops func_dmic_abe_gfclk_ops = {
340 .recalc_rate = &omap2_clksel_recalc,
341 .get_parent = &omap2_clksel_find_parent_index,
342 .set_parent = &omap2_clksel_set_parent,
343};
344
345static const char *dpll_core_m3x2_ck_parents[] = {
346 "dpll_core_x2_ck",
347};
348
349static const struct clksel dpll_core_m3x2_div[] = {
350 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
351 { .parent = NULL },
352};
353
354/* XXX Missing round_rate, set_rate in ops */
355DEFINE_CLK_OMAP_MUX_GATE(dpll_core_m3x2_ck, NULL, dpll_core_m3x2_div,
356 OMAP4430_CM_DIV_M3_DPLL_CORE,
357 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
358 OMAP4430_CM_DIV_M3_DPLL_CORE,
359 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
360 dpll_core_m3x2_ck_parents, dpll_hsd_ops);
361
362DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m7x2_ck, "dpll_core_x2_ck",
363 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M7_DPLL_CORE,
364 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
365
366static const char *iva_hsd_byp_clk_mux_ck_parents[] = {
367 "sys_clkin_ck", "div_iva_hs_clk",
368};
369
370DEFINE_CLK_MUX(iva_hsd_byp_clk_mux_ck, iva_hsd_byp_clk_mux_ck_parents, NULL,
371 0x0, OMAP4430_CM_CLKSEL_DPLL_IVA, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
372 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
373
374/* DPLL_IVA */
375static struct dpll_data dpll_iva_dd = {
376 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
377 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
378 .clk_ref = &sys_clkin_ck,
379 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
380 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
381 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
382 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
383 .mult_mask = OMAP4430_DPLL_MULT_MASK,
384 .div1_mask = OMAP4430_DPLL_DIV_MASK,
385 .enable_mask = OMAP4430_DPLL_EN_MASK,
386 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
387 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
388 .max_multiplier = 2047,
389 .max_divider = 128,
390 .min_divider = 1,
391};
392
393static const char *dpll_iva_ck_parents[] = {
394 "sys_clkin_ck", "iva_hsd_byp_clk_mux_ck"
395};
396
397static struct clk dpll_iva_ck;
398
399static const struct clk_ops dpll_ck_ops = {
400 .enable = &omap3_noncore_dpll_enable,
401 .disable = &omap3_noncore_dpll_disable,
402 .recalc_rate = &omap3_dpll_recalc,
403 .round_rate = &omap2_dpll_round_rate,
404 .set_rate = &omap3_noncore_dpll_set_rate,
405 .get_parent = &omap2_init_dpll_parent,
406};
407
408static struct clk_hw_omap dpll_iva_ck_hw = {
409 .hw = {
410 .clk = &dpll_iva_ck,
411 },
412 .dpll_data = &dpll_iva_dd,
413 .ops = &clkhwops_omap3_dpll,
414};
415
416DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_iva_ck_parents, dpll_ck_ops);
417
418static const char *dpll_iva_x2_ck_parents[] = {
419 "dpll_iva_ck",
420};
421
422static struct clk dpll_iva_x2_ck;
423
424static struct clk_hw_omap dpll_iva_x2_ck_hw = {
425 .hw = {
426 .clk = &dpll_iva_x2_ck,
427 },
428};
429
430DEFINE_STRUCT_CLK(dpll_iva_x2_ck, dpll_iva_x2_ck_parents, dpll_abe_x2_ck_ops);
431
432DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m4x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
433 0x0, OMAP4430_CM_DIV_M4_DPLL_IVA,
434 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
435
436DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m5x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
437 0x0, OMAP4430_CM_DIV_M5_DPLL_IVA,
438 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
439
440/* DPLL_MPU */
441static struct dpll_data dpll_mpu_dd = {
442 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
443 .clk_bypass = &div_mpu_hs_clk,
444 .clk_ref = &sys_clkin_ck,
445 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
446 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
447 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
448 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
449 .mult_mask = OMAP4430_DPLL_MULT_MASK,
450 .div1_mask = OMAP4430_DPLL_DIV_MASK,
451 .enable_mask = OMAP4430_DPLL_EN_MASK,
452 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
453 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
454 .max_multiplier = 2047,
455 .max_divider = 128,
456 .min_divider = 1,
457};
458
459static const char *dpll_mpu_ck_parents[] = {
460 "sys_clkin_ck", "div_mpu_hs_clk"
461};
462
463static struct clk dpll_mpu_ck;
464
465static struct clk_hw_omap dpll_mpu_ck_hw = {
466 .hw = {
467 .clk = &dpll_mpu_ck,
468 },
469 .dpll_data = &dpll_mpu_dd,
470 .ops = &clkhwops_omap3_dpll,
471};
472
473DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_mpu_ck_parents, dpll_ck_ops);
474
475DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2);
476
477DEFINE_CLK_OMAP_HSDIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck, 0x0,
478 OMAP4430_CM_DIV_M2_DPLL_MPU,
479 OMAP4430_DPLL_CLKOUT_DIV_MASK);
480
481DEFINE_CLK_FIXED_FACTOR(per_hs_clk_div_ck, "dpll_abe_m3x2_ck",
482 &dpll_abe_m3x2_ck, 0x0, 1, 2);
483
484static const char *per_hsd_byp_clk_mux_ck_parents[] = {
485 "sys_clkin_ck", "per_hs_clk_div_ck",
486};
487
488DEFINE_CLK_MUX(per_hsd_byp_clk_mux_ck, per_hsd_byp_clk_mux_ck_parents, NULL,
489 0x0, OMAP4430_CM_CLKSEL_DPLL_PER, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
490 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
491
492/* DPLL_PER */
493static struct dpll_data dpll_per_dd = {
494 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
495 .clk_bypass = &per_hsd_byp_clk_mux_ck,
496 .clk_ref = &sys_clkin_ck,
497 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
498 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
499 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
500 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
501 .mult_mask = OMAP4430_DPLL_MULT_MASK,
502 .div1_mask = OMAP4430_DPLL_DIV_MASK,
503 .enable_mask = OMAP4430_DPLL_EN_MASK,
504 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
505 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
506 .max_multiplier = 2047,
507 .max_divider = 128,
508 .min_divider = 1,
509};
510
511static const char *dpll_per_ck_parents[] = {
512 "sys_clkin_ck", "per_hsd_byp_clk_mux_ck"
513};
514
515static struct clk dpll_per_ck;
516
517static struct clk_hw_omap dpll_per_ck_hw = {
518 .hw = {
519 .clk = &dpll_per_ck,
520 },
521 .dpll_data = &dpll_per_dd,
522 .ops = &clkhwops_omap3_dpll,
523};
524
525DEFINE_STRUCT_CLK(dpll_per_ck, dpll_per_ck_parents, dpll_ck_ops);
526
527DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
528 OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
529 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
530
531static const char *dpll_per_x2_ck_parents[] = {
532 "dpll_per_ck",
533};
534
535static struct clk dpll_per_x2_ck;
536
537static struct clk_hw_omap dpll_per_x2_ck_hw = {
538 .hw = {
539 .clk = &dpll_per_x2_ck,
540 },
541 .flags = CLOCK_CLKOUTX2,
542 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
543 .ops = &clkhwops_omap4_dpllmx,
544};
545
546DEFINE_STRUCT_CLK(dpll_per_x2_ck, dpll_per_x2_ck_parents, dpll_abe_x2_ck_ops);
547
548DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m2x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
549 0x0, OMAP4430_CM_DIV_M2_DPLL_PER,
550 OMAP4430_DPLL_CLKOUT_DIV_MASK);
551
552static const char *dpll_per_m3x2_ck_parents[] = {
553 "dpll_per_x2_ck",
554};
555
556static const struct clksel dpll_per_m3x2_div[] = {
557 { .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
558 { .parent = NULL },
559};
560
561/* XXX Missing round_rate, set_rate in ops */
562DEFINE_CLK_OMAP_MUX_GATE(dpll_per_m3x2_ck, NULL, dpll_per_m3x2_div,
563 OMAP4430_CM_DIV_M3_DPLL_PER,
564 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
565 OMAP4430_CM_DIV_M3_DPLL_PER,
566 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
567 dpll_per_m3x2_ck_parents, dpll_hsd_ops);
568
569DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m4x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
570 0x0, OMAP4430_CM_DIV_M4_DPLL_PER,
571 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
572
573DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m5x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
574 0x0, OMAP4430_CM_DIV_M5_DPLL_PER,
575 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
576
577DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m6x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
578 0x0, OMAP4430_CM_DIV_M6_DPLL_PER,
579 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
580
581DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m7x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
582 0x0, OMAP4430_CM_DIV_M7_DPLL_PER,
583 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
584
585DEFINE_CLK_FIXED_FACTOR(usb_hs_clk_div_ck, "dpll_abe_m3x2_ck",
586 &dpll_abe_m3x2_ck, 0x0, 1, 3);
587
588/* DPLL_USB */
589static struct dpll_data dpll_usb_dd = {
590 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
591 .clk_bypass = &usb_hs_clk_div_ck,
592 .flags = DPLL_J_TYPE,
593 .clk_ref = &sys_clkin_ck,
594 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
595 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
596 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
597 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
598 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
599 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
600 .enable_mask = OMAP4430_DPLL_EN_MASK,
601 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
602 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
603 .sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
604 .max_multiplier = 4095,
605 .max_divider = 256,
606 .min_divider = 1,
607};
608
609static const char *dpll_usb_ck_parents[] = {
610 "sys_clkin_ck", "usb_hs_clk_div_ck"
611};
612
613static struct clk dpll_usb_ck;
614
615static const struct clk_ops dpll_usb_ck_ops = {
616 .enable = &omap3_noncore_dpll_enable,
617 .disable = &omap3_noncore_dpll_disable,
618 .recalc_rate = &omap3_dpll_recalc,
619 .round_rate = &omap2_dpll_round_rate,
620 .set_rate = &omap3_noncore_dpll_set_rate,
621 .get_parent = &omap2_init_dpll_parent,
622 .init = &omap2_init_clk_clkdm,
623};
624
625static struct clk_hw_omap dpll_usb_ck_hw = {
626 .hw = {
627 .clk = &dpll_usb_ck,
628 },
629 .dpll_data = &dpll_usb_dd,
630 .clkdm_name = "l3_init_clkdm",
631 .ops = &clkhwops_omap3_dpll,
632};
633
634DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_usb_ck_parents, dpll_usb_ck_ops);
635
636static const char *dpll_usb_clkdcoldo_ck_parents[] = {
637 "dpll_usb_ck",
638};
639
640static struct clk dpll_usb_clkdcoldo_ck;
641
642static const struct clk_ops dpll_usb_clkdcoldo_ck_ops = {
643};
644
645static struct clk_hw_omap dpll_usb_clkdcoldo_ck_hw = {
646 .hw = {
647 .clk = &dpll_usb_clkdcoldo_ck,
648 },
649 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
650 .ops = &clkhwops_omap4_dpllmx,
651};
652
653DEFINE_STRUCT_CLK(dpll_usb_clkdcoldo_ck, dpll_usb_clkdcoldo_ck_parents,
654 dpll_usb_clkdcoldo_ck_ops);
655
656DEFINE_CLK_OMAP_HSDIVIDER(dpll_usb_m2_ck, "dpll_usb_ck", &dpll_usb_ck, 0x0,
657 OMAP4430_CM_DIV_M2_DPLL_USB,
658 OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK);
659
660static const char *ducati_clk_mux_ck_parents[] = {
661 "div_core_ck", "dpll_per_m6x2_ck",
662};
663
664DEFINE_CLK_MUX(ducati_clk_mux_ck, ducati_clk_mux_ck_parents, NULL, 0x0,
665 OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT, OMAP4430_CLKSEL_0_0_SHIFT,
666 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
667
668DEFINE_CLK_FIXED_FACTOR(func_12m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
669 0x0, 1, 16);
670
671DEFINE_CLK_FIXED_FACTOR(func_24m_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0,
672 1, 4);
673
674DEFINE_CLK_FIXED_FACTOR(func_24mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
675 0x0, 1, 8);
676
677static const struct clk_div_table func_48m_fclk_rates[] = {
678 { .div = 4, .val = 0 },
679 { .div = 8, .val = 1 },
680 { .div = 0 },
681};
682DEFINE_CLK_DIVIDER_TABLE(func_48m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
683 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
684 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_48m_fclk_rates,
685 NULL);
686
687DEFINE_CLK_FIXED_FACTOR(func_48mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
688 0x0, 1, 4);
689
690static const struct clk_div_table func_64m_fclk_rates[] = {
691 { .div = 2, .val = 0 },
692 { .div = 4, .val = 1 },
693 { .div = 0 },
694};
695DEFINE_CLK_DIVIDER_TABLE(func_64m_fclk, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck,
696 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
697 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_64m_fclk_rates,
698 NULL);
699
700static const struct clk_div_table func_96m_fclk_rates[] = {
701 { .div = 2, .val = 0 },
702 { .div = 4, .val = 1 },
703 { .div = 0 },
704};
705DEFINE_CLK_DIVIDER_TABLE(func_96m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
706 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
707 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_96m_fclk_rates,
708 NULL);
709
710static const struct clk_div_table init_60m_fclk_rates[] = {
711 { .div = 1, .val = 0 },
712 { .div = 8, .val = 1 },
713 { .div = 0 },
714};
715DEFINE_CLK_DIVIDER_TABLE(init_60m_fclk, "dpll_usb_m2_ck", &dpll_usb_m2_ck,
716 0x0, OMAP4430_CM_CLKSEL_USB_60MHZ,
717 OMAP4430_CLKSEL_0_0_SHIFT, OMAP4430_CLKSEL_0_0_WIDTH,
718 0x0, init_60m_fclk_rates, NULL);
719
720DEFINE_CLK_DIVIDER(l3_div_ck, "div_core_ck", &div_core_ck, 0x0,
721 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L3_SHIFT,
722 OMAP4430_CLKSEL_L3_WIDTH, 0x0, NULL);
723
724DEFINE_CLK_DIVIDER(l4_div_ck, "l3_div_ck", &l3_div_ck, 0x0,
725 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L4_SHIFT,
726 OMAP4430_CLKSEL_L4_WIDTH, 0x0, NULL);
727
728DEFINE_CLK_FIXED_FACTOR(lp_clk_div_ck, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
729 0x0, 1, 16);
730
731static const char *l4_wkup_clk_mux_ck_parents[] = {
732 "sys_clkin_ck", "lp_clk_div_ck",
733};
734
735DEFINE_CLK_MUX(l4_wkup_clk_mux_ck, l4_wkup_clk_mux_ck_parents, NULL, 0x0,
736 OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
737 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
738
739static const struct clk_div_table ocp_abe_iclk_rates[] = {
740 { .div = 2, .val = 0 },
741 { .div = 1, .val = 1 },
742 { .div = 0 },
743};
744DEFINE_CLK_DIVIDER_TABLE(ocp_abe_iclk, "aess_fclk", &aess_fclk, 0x0,
745 OMAP4430_CM1_ABE_AESS_CLKCTRL,
746 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
747 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
748 0x0, ocp_abe_iclk_rates, NULL);
749
750DEFINE_CLK_FIXED_FACTOR(per_abe_24m_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck,
751 0x0, 1, 4);
752
753DEFINE_CLK_DIVIDER(per_abe_nc_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck, 0x0,
754 OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
755 OMAP4430_SCALE_FCLK_WIDTH, 0x0, NULL);
756
757DEFINE_CLK_DIVIDER(syc_clk_div_ck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
758 OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
759 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
760
761static const char *dbgclk_mux_ck_parents[] = {
762 "sys_clkin_ck"
763};
764
765static struct clk dbgclk_mux_ck;
766DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL);
767DEFINE_STRUCT_CLK(dbgclk_mux_ck, dbgclk_mux_ck_parents,
768 dpll_usb_clkdcoldo_ck_ops);
769
770/* Leaf clocks controlled by modules */
771
772DEFINE_CLK_GATE(aes1_fck, "l3_div_ck", &l3_div_ck, 0x0,
773 OMAP4430_CM_L4SEC_AES1_CLKCTRL,
774 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
775
776DEFINE_CLK_GATE(aes2_fck, "l3_div_ck", &l3_div_ck, 0x0,
777 OMAP4430_CM_L4SEC_AES2_CLKCTRL,
778 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
779
780DEFINE_CLK_GATE(bandgap_fclk, "sys_32k_ck", &sys_32k_ck, 0x0,
781 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
782 OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT, 0x0, NULL);
783
784static const struct clk_div_table div_ts_ck_rates[] = {
785 { .div = 8, .val = 0 },
786 { .div = 16, .val = 1 },
787 { .div = 32, .val = 2 },
788 { .div = 0 },
789};
790DEFINE_CLK_DIVIDER_TABLE(div_ts_ck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
791 0x0, OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
792 OMAP4430_CLKSEL_24_25_SHIFT,
793 OMAP4430_CLKSEL_24_25_WIDTH, 0x0, div_ts_ck_rates,
794 NULL);
795
796DEFINE_CLK_GATE(bandgap_ts_fclk, "div_ts_ck", &div_ts_ck, 0x0,
797 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
798 OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
799 0x0, NULL);
800
801static const char *dmic_sync_mux_ck_parents[] = {
802 "abe_24m_fclk", "syc_clk_div_ck", "func_24m_clk",
803};
804
805DEFINE_CLK_MUX(dmic_sync_mux_ck, dmic_sync_mux_ck_parents, NULL,
806 0x0, OMAP4430_CM1_ABE_DMIC_CLKCTRL,
807 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
808 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
809
810static const struct clksel func_dmic_abe_gfclk_sel[] = {
811 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
812 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
813 { .parent = &slimbus_clk, .rates = div_1_2_rates },
814 { .parent = NULL },
815};
816
817static const char *func_dmic_abe_gfclk_parents[] = {
818 "dmic_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
819};
820
821DEFINE_CLK_OMAP_MUX(func_dmic_abe_gfclk, "abe_clkdm", func_dmic_abe_gfclk_sel,
822 OMAP4430_CM1_ABE_DMIC_CLKCTRL, OMAP4430_CLKSEL_SOURCE_MASK,
823 func_dmic_abe_gfclk_parents, func_dmic_abe_gfclk_ops);
824
825DEFINE_CLK_GATE(dss_sys_clk, "syc_clk_div_ck", &syc_clk_div_ck, 0x0,
826 OMAP4430_CM_DSS_DSS_CLKCTRL,
827 OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT, 0x0, NULL);
828
829DEFINE_CLK_GATE(dss_tv_clk, "extalt_clkin_ck", &extalt_clkin_ck, 0x0,
830 OMAP4430_CM_DSS_DSS_CLKCTRL,
831 OMAP4430_OPTFCLKEN_TV_CLK_SHIFT, 0x0, NULL);
832
833DEFINE_CLK_GATE(dss_dss_clk, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck,
834 CLK_SET_RATE_PARENT,
835 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
836 0x0, NULL);
837
838DEFINE_CLK_GATE(dss_48mhz_clk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
839 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
840 0x0, NULL);
841
842DEFINE_CLK_GATE(dss_fck, "l3_div_ck", &l3_div_ck, 0x0,
843 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
844 0x0, NULL);
845
846DEFINE_CLK_DIVIDER(fdif_fck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
847 OMAP4430_CM_CAM_FDIF_CLKCTRL, OMAP4430_CLKSEL_FCLK_SHIFT,
848 OMAP4430_CLKSEL_FCLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
849
850DEFINE_CLK_GATE(gpio1_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
851 OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
852 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
853
854DEFINE_CLK_GATE(gpio2_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
855 OMAP4430_CM_L4PER_GPIO2_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
856 0x0, NULL);
857
858DEFINE_CLK_GATE(gpio3_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
859 OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
860 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
861
862DEFINE_CLK_GATE(gpio4_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
863 OMAP4430_CM_L4PER_GPIO4_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
864 0x0, NULL);
865
866DEFINE_CLK_GATE(gpio5_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
867 OMAP4430_CM_L4PER_GPIO5_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
868 0x0, NULL);
869
870DEFINE_CLK_GATE(gpio6_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
871 OMAP4430_CM_L4PER_GPIO6_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
872 0x0, NULL);
873
874static const struct clksel sgx_clk_mux_sel[] = {
875 { .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
876 { .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
877 { .parent = NULL },
878};
879
880static const char *sgx_clk_mux_parents[] = {
881 "dpll_core_m7x2_ck", "dpll_per_m7x2_ck",
882};
883
884DEFINE_CLK_OMAP_MUX(sgx_clk_mux, "l3_gfx_clkdm", sgx_clk_mux_sel,
885 OMAP4430_CM_GFX_GFX_CLKCTRL, OMAP4430_CLKSEL_SGX_FCLK_MASK,
886 sgx_clk_mux_parents, func_dmic_abe_gfclk_ops);
887
888DEFINE_CLK_DIVIDER(hsi_fck, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, 0x0,
889 OMAP4430_CM_L3INIT_HSI_CLKCTRL, OMAP4430_CLKSEL_24_25_SHIFT,
890 OMAP4430_CLKSEL_24_25_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
891 NULL);
892
893DEFINE_CLK_GATE(iss_ctrlclk, "func_96m_fclk", &func_96m_fclk, 0x0,
894 OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
895 0x0, NULL);
896
897DEFINE_CLK_MUX(mcasp_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
898 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
899 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
900 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
901
902static const struct clksel func_mcasp_abe_gfclk_sel[] = {
903 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
904 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
905 { .parent = &slimbus_clk, .rates = div_1_2_rates },
906 { .parent = NULL },
907};
908
909static const char *func_mcasp_abe_gfclk_parents[] = {
910 "mcasp_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
911};
912
913DEFINE_CLK_OMAP_MUX(func_mcasp_abe_gfclk, "abe_clkdm", func_mcasp_abe_gfclk_sel,
914 OMAP4430_CM1_ABE_MCASP_CLKCTRL, OMAP4430_CLKSEL_SOURCE_MASK,
915 func_mcasp_abe_gfclk_parents, func_dmic_abe_gfclk_ops);
916
917DEFINE_CLK_MUX(mcbsp1_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
918 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
919 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
920 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
921
922static const struct clksel func_mcbsp1_gfclk_sel[] = {
923 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
924 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
925 { .parent = &slimbus_clk, .rates = div_1_2_rates },
926 { .parent = NULL },
927};
928
929static const char *func_mcbsp1_gfclk_parents[] = {
930 "mcbsp1_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
931};
932
933DEFINE_CLK_OMAP_MUX(func_mcbsp1_gfclk, "abe_clkdm", func_mcbsp1_gfclk_sel,
934 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
935 OMAP4430_CLKSEL_SOURCE_MASK, func_mcbsp1_gfclk_parents,
936 func_dmic_abe_gfclk_ops);
937
938DEFINE_CLK_MUX(mcbsp2_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
939 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
940 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
941 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
942
943static const struct clksel func_mcbsp2_gfclk_sel[] = {
944 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
945 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
946 { .parent = &slimbus_clk, .rates = div_1_2_rates },
947 { .parent = NULL },
948};
949
950static const char *func_mcbsp2_gfclk_parents[] = {
951 "mcbsp2_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
952};
953
954DEFINE_CLK_OMAP_MUX(func_mcbsp2_gfclk, "abe_clkdm", func_mcbsp2_gfclk_sel,
955 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
956 OMAP4430_CLKSEL_SOURCE_MASK, func_mcbsp2_gfclk_parents,
957 func_dmic_abe_gfclk_ops);
958
959DEFINE_CLK_MUX(mcbsp3_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
960 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
961 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
962 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
963
964static const struct clksel func_mcbsp3_gfclk_sel[] = {
965 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
966 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
967 { .parent = &slimbus_clk, .rates = div_1_2_rates },
968 { .parent = NULL },
969};
970
971static const char *func_mcbsp3_gfclk_parents[] = {
972 "mcbsp3_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
973};
974
975DEFINE_CLK_OMAP_MUX(func_mcbsp3_gfclk, "abe_clkdm", func_mcbsp3_gfclk_sel,
976 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
977 OMAP4430_CLKSEL_SOURCE_MASK, func_mcbsp3_gfclk_parents,
978 func_dmic_abe_gfclk_ops);
979
980static const char *mcbsp4_sync_mux_ck_parents[] = {
981 "func_96m_fclk", "per_abe_nc_fclk",
982};
983
984DEFINE_CLK_MUX(mcbsp4_sync_mux_ck, mcbsp4_sync_mux_ck_parents, NULL, 0x0,
985 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
986 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
987 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
988
989static const struct clksel per_mcbsp4_gfclk_sel[] = {
990 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
991 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
992 { .parent = NULL },
993};
994
995static const char *per_mcbsp4_gfclk_parents[] = {
996 "mcbsp4_sync_mux_ck", "pad_clks_ck",
997};
998
999DEFINE_CLK_OMAP_MUX(per_mcbsp4_gfclk, "l4_per_clkdm", per_mcbsp4_gfclk_sel,
1000 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1001 OMAP4430_CLKSEL_SOURCE_24_24_MASK, per_mcbsp4_gfclk_parents,
1002 func_dmic_abe_gfclk_ops);
1003
1004static const struct clksel hsmmc1_fclk_sel[] = {
1005 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1006 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1007 { .parent = NULL },
1008};
1009
1010static const char *hsmmc1_fclk_parents[] = {
1011 "func_64m_fclk", "func_96m_fclk",
1012};
1013
1014DEFINE_CLK_OMAP_MUX(hsmmc1_fclk, "l3_init_clkdm", hsmmc1_fclk_sel,
1015 OMAP4430_CM_L3INIT_MMC1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1016 hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops);
1017
1018DEFINE_CLK_OMAP_MUX(hsmmc2_fclk, "l3_init_clkdm", hsmmc1_fclk_sel,
1019 OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
1020 hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops);
1021
1022DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0,
1023 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1024 OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL);
1025
1026DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
1027 OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
1028 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1029
1030DEFINE_CLK_GATE(slimbus1_fclk_1, "func_24m_clk", &func_24m_clk, 0x0,
1031 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1032 OMAP4430_OPTFCLKEN_FCLK1_SHIFT, 0x0, NULL);
1033
1034DEFINE_CLK_GATE(slimbus1_fclk_0, "abe_24m_fclk", &abe_24m_fclk, 0x0,
1035 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1036 OMAP4430_OPTFCLKEN_FCLK0_SHIFT, 0x0, NULL);
1037
1038DEFINE_CLK_GATE(slimbus1_fclk_2, "pad_clks_ck", &pad_clks_ck, 0x0,
1039 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1040 OMAP4430_OPTFCLKEN_FCLK2_SHIFT, 0x0, NULL);
1041
1042DEFINE_CLK_GATE(slimbus1_slimbus_clk, "slimbus_clk", &slimbus_clk, 0x0,
1043 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1044 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT, 0x0, NULL);
1045
1046DEFINE_CLK_GATE(slimbus2_fclk_1, "per_abe_24m_fclk", &per_abe_24m_fclk, 0x0,
1047 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1048 OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT, 0x0, NULL);
1049
1050DEFINE_CLK_GATE(slimbus2_fclk_0, "func_24mc_fclk", &func_24mc_fclk, 0x0,
1051 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1052 OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT, 0x0, NULL);
1053
1054DEFINE_CLK_GATE(slimbus2_slimbus_clk, "pad_slimbus_core_clks_ck",
1055 &pad_slimbus_core_clks_ck, 0x0,
1056 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1057 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT, 0x0, NULL);
1058
1059DEFINE_CLK_GATE(smartreflex_core_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1060 0x0, OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
1061 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1062
1063DEFINE_CLK_GATE(smartreflex_iva_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1064 0x0, OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
1065 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1066
1067DEFINE_CLK_GATE(smartreflex_mpu_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1068 0x0, OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
1069 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1070
1071static const struct clksel dmt1_clk_mux_sel[] = {
1072 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1073 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1074 { .parent = NULL },
1075};
1076
1077DEFINE_CLK_OMAP_MUX(dmt1_clk_mux, "l4_wkup_clkdm", dmt1_clk_mux_sel,
1078 OMAP4430_CM_WKUP_TIMER1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1079 abe_dpll_bypass_clk_mux_ck_parents,
1080 func_dmic_abe_gfclk_ops);
1081
1082DEFINE_CLK_OMAP_MUX(cm2_dm10_mux, "l4_per_clkdm", dmt1_clk_mux_sel,
1083 OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL, OMAP4430_CLKSEL_MASK,
1084 abe_dpll_bypass_clk_mux_ck_parents,
1085 func_dmic_abe_gfclk_ops);
1086
1087DEFINE_CLK_OMAP_MUX(cm2_dm11_mux, "l4_per_clkdm", dmt1_clk_mux_sel,
1088 OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL, OMAP4430_CLKSEL_MASK,
1089 abe_dpll_bypass_clk_mux_ck_parents,
1090 func_dmic_abe_gfclk_ops);
1091
1092DEFINE_CLK_OMAP_MUX(cm2_dm2_mux, "l4_per_clkdm", dmt1_clk_mux_sel,
1093 OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL, OMAP4430_CLKSEL_MASK,
1094 abe_dpll_bypass_clk_mux_ck_parents,
1095 func_dmic_abe_gfclk_ops);
1096
1097DEFINE_CLK_OMAP_MUX(cm2_dm3_mux, "l4_per_clkdm", dmt1_clk_mux_sel,
1098 OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL, OMAP4430_CLKSEL_MASK,
1099 abe_dpll_bypass_clk_mux_ck_parents,
1100 func_dmic_abe_gfclk_ops);
1101
1102DEFINE_CLK_OMAP_MUX(cm2_dm4_mux, "l4_per_clkdm", dmt1_clk_mux_sel,
1103 OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL, OMAP4430_CLKSEL_MASK,
1104 abe_dpll_bypass_clk_mux_ck_parents,
1105 func_dmic_abe_gfclk_ops);
1106
1107static const struct clksel timer5_sync_mux_sel[] = {
1108 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
1109 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1110 { .parent = NULL },
1111};
1112
1113static const char *timer5_sync_mux_parents[] = {
1114 "syc_clk_div_ck", "sys_32k_ck",
1115};
1116
1117DEFINE_CLK_OMAP_MUX(timer5_sync_mux, "abe_clkdm", timer5_sync_mux_sel,
1118 OMAP4430_CM1_ABE_TIMER5_CLKCTRL, OMAP4430_CLKSEL_MASK,
1119 timer5_sync_mux_parents, func_dmic_abe_gfclk_ops);
1120
1121DEFINE_CLK_OMAP_MUX(timer6_sync_mux, "abe_clkdm", timer5_sync_mux_sel,
1122 OMAP4430_CM1_ABE_TIMER6_CLKCTRL, OMAP4430_CLKSEL_MASK,
1123 timer5_sync_mux_parents, func_dmic_abe_gfclk_ops);
1124
1125DEFINE_CLK_OMAP_MUX(timer7_sync_mux, "abe_clkdm", timer5_sync_mux_sel,
1126 OMAP4430_CM1_ABE_TIMER7_CLKCTRL, OMAP4430_CLKSEL_MASK,
1127 timer5_sync_mux_parents, func_dmic_abe_gfclk_ops);
1128
1129DEFINE_CLK_OMAP_MUX(timer8_sync_mux, "abe_clkdm", timer5_sync_mux_sel,
1130 OMAP4430_CM1_ABE_TIMER8_CLKCTRL, OMAP4430_CLKSEL_MASK,
1131 timer5_sync_mux_parents, func_dmic_abe_gfclk_ops);
1132
1133DEFINE_CLK_OMAP_MUX(cm2_dm9_mux, "l4_per_clkdm", dmt1_clk_mux_sel,
1134 OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL, OMAP4430_CLKSEL_MASK,
1135 abe_dpll_bypass_clk_mux_ck_parents,
1136 func_dmic_abe_gfclk_ops);
1137
1138static struct clk usb_host_fs_fck;
1139
1140static const char *usb_host_fs_fck_parent_names[] = {
1141 "func_48mc_fclk",
1142};
1143
1144static const struct clk_ops usb_host_fs_fck_ops = {
1145 .enable = &omap2_dflt_clk_enable,
1146 .disable = &omap2_dflt_clk_disable,
1147 .is_enabled = &omap2_dflt_clk_is_enabled,
1148};
1149
1150static struct clk_hw_omap usb_host_fs_fck_hw = {
1151 .hw = {
1152 .clk = &usb_host_fs_fck,
1153 },
1154 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
1155 .enable_bit = OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1156 .clkdm_name = "l3_init_clkdm",
1157};
1158
1159DEFINE_STRUCT_CLK(usb_host_fs_fck, usb_host_fs_fck_parent_names,
1160 usb_host_fs_fck_ops);
1161
1162static const char *utmi_p1_gfclk_parents[] = {
1163 "init_60m_fclk", "xclk60mhsp1_ck",
1164};
1165
1166DEFINE_CLK_MUX(utmi_p1_gfclk, utmi_p1_gfclk_parents, NULL, 0x0,
1167 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1168 OMAP4430_CLKSEL_UTMI_P1_SHIFT, OMAP4430_CLKSEL_UTMI_P1_WIDTH,
1169 0x0, NULL);
1170
1171DEFINE_CLK_GATE(usb_host_hs_utmi_p1_clk, "utmi_p1_gfclk", &utmi_p1_gfclk, 0x0,
1172 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1173 OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, 0x0, NULL);
1174
1175static const char *utmi_p2_gfclk_parents[] = {
1176 "init_60m_fclk", "xclk60mhsp2_ck",
1177};
1178
1179DEFINE_CLK_MUX(utmi_p2_gfclk, utmi_p2_gfclk_parents, NULL, 0x0,
1180 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1181 OMAP4430_CLKSEL_UTMI_P2_SHIFT, OMAP4430_CLKSEL_UTMI_P2_WIDTH,
1182 0x0, NULL);
1183
1184DEFINE_CLK_GATE(usb_host_hs_utmi_p2_clk, "utmi_p2_gfclk", &utmi_p2_gfclk, 0x0,
1185 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1186 OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, 0x0, NULL);
1187
1188DEFINE_CLK_GATE(usb_host_hs_utmi_p3_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1189 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1190 OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT, 0x0, NULL);
1191
1192DEFINE_CLK_GATE(usb_host_hs_hsic480m_p1_clk, "dpll_usb_m2_ck",
1193 &dpll_usb_m2_ck, 0x0,
1194 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1195 OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT, 0x0, NULL);
1196
1197DEFINE_CLK_GATE(usb_host_hs_hsic60m_p1_clk, "init_60m_fclk",
1198 &init_60m_fclk, 0x0,
1199 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1200 OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT, 0x0, NULL);
1201
1202DEFINE_CLK_GATE(usb_host_hs_hsic60m_p2_clk, "init_60m_fclk",
1203 &init_60m_fclk, 0x0,
1204 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1205 OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT, 0x0, NULL);
1206
1207DEFINE_CLK_GATE(usb_host_hs_hsic480m_p2_clk, "dpll_usb_m2_ck",
1208 &dpll_usb_m2_ck, 0x0,
1209 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1210 OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT, 0x0, NULL);
1211
1212DEFINE_CLK_GATE(usb_host_hs_func48mclk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
1213 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1214 OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT, 0x0, NULL);
1215
1216DEFINE_CLK_GATE(usb_host_hs_fck, "init_60m_fclk", &init_60m_fclk, 0x0,
1217 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1218 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1219
1220static const char *otg_60m_gfclk_parents[] = {
1221 "utmi_phy_clkout_ck", "xclk60motg_ck",
1222};
1223
1224DEFINE_CLK_MUX(otg_60m_gfclk, otg_60m_gfclk_parents, NULL, 0x0,
1225 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL, OMAP4430_CLKSEL_60M_SHIFT,
1226 OMAP4430_CLKSEL_60M_WIDTH, 0x0, NULL);
1227
1228DEFINE_CLK_GATE(usb_otg_hs_xclk, "otg_60m_gfclk", &otg_60m_gfclk, 0x0,
1229 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1230 OMAP4430_OPTFCLKEN_XCLK_SHIFT, 0x0, NULL);
1231
1232DEFINE_CLK_GATE(usb_otg_hs_ick, "l3_div_ck", &l3_div_ck, 0x0,
1233 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1234 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1235
1236DEFINE_CLK_GATE(usb_phy_cm_clk32k, "sys_32k_ck", &sys_32k_ck, 0x0,
1237 OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
1238 OMAP4430_OPTFCLKEN_CLK32K_SHIFT, 0x0, NULL);
1239
1240DEFINE_CLK_GATE(usb_tll_hs_usb_ch2_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1241 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1242 OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT, 0x0, NULL);
1243
1244DEFINE_CLK_GATE(usb_tll_hs_usb_ch0_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1245 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1246 OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT, 0x0, NULL);
1247
1248DEFINE_CLK_GATE(usb_tll_hs_usb_ch1_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1249 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1250 OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT, 0x0, NULL);
1251
1252DEFINE_CLK_GATE(usb_tll_hs_ick, "l4_div_ck", &l4_div_ck, 0x0,
1253 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1254 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1255
1256static const struct clk_div_table usim_ck_rates[] = {
1257 { .div = 14, .val = 0 },
1258 { .div = 18, .val = 1 },
1259 { .div = 0 },
1260};
1261DEFINE_CLK_DIVIDER_TABLE(usim_ck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
1262 OMAP4430_CM_WKUP_USIM_CLKCTRL,
1263 OMAP4430_CLKSEL_DIV_SHIFT, OMAP4430_CLKSEL_DIV_WIDTH,
1264 0x0, usim_ck_rates, NULL);
1265
1266DEFINE_CLK_GATE(usim_fclk, "usim_ck", &usim_ck, 0x0,
1267 OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_OPTFCLKEN_FCLK_SHIFT,
1268 0x0, NULL);
1269
1270/* Remaining optional clocks */
1271static const char *pmd_stm_clock_mux_ck_parents[] = {
1272 "sys_clkin_ck", "dpll_core_m6x2_ck", "tie_low_clock_ck",
1273};
1274
1275DEFINE_CLK_MUX(pmd_stm_clock_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1276 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL, OMAP4430_PMD_STM_MUX_CTRL_SHIFT,
1277 OMAP4430_PMD_STM_MUX_CTRL_WIDTH, 0x0, NULL);
1278
1279DEFINE_CLK_MUX(pmd_trace_clk_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1280 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1281 OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT,
1282 OMAP4430_PMD_TRACE_MUX_CTRL_WIDTH, 0x0, NULL);
1283
1284DEFINE_CLK_DIVIDER(stm_clk_div_ck, "pmd_stm_clock_mux_ck",
1285 &pmd_stm_clock_mux_ck, 0x0, OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1286 OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT,
1287 OMAP4430_CLKSEL_PMD_STM_CLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
1288 NULL);
1289
1290static const char *trace_clk_div_ck_parents[] = {
1291 "pmd_trace_clk_mux_ck",
1292};
1293
1294static const struct clksel trace_clk_div_div[] = {
1295 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
1296 { .parent = NULL },
1297};
1298
1299static struct clk trace_clk_div_ck;
1300
1301static const struct clk_ops trace_clk_div_ck_ops = {
1302 .recalc_rate = &omap2_clksel_recalc,
1303 .set_rate = &omap2_clksel_set_rate,
1304 .round_rate = &omap2_clksel_round_rate,
1305 .init = &omap2_init_clk_clkdm,
1306 .enable = &omap2_clkops_enable_clkdm,
1307 .disable = &omap2_clkops_disable_clkdm,
1308};
1309
1310static struct clk_hw_omap trace_clk_div_ck_hw = {
1311 .hw = {
1312 .clk = &trace_clk_div_ck,
1313 },
1314 .clkdm_name = "emu_sys_clkdm",
1315 .clksel = trace_clk_div_div,
1316 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1317 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
1318};
1319
1320DEFINE_STRUCT_CLK(trace_clk_div_ck, trace_clk_div_ck_parents,
1321 trace_clk_div_ck_ops);
1322
1323/* SCRM aux clk nodes */
1324
1325static const struct clksel auxclk_src_sel[] = {
1326 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1327 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
1328 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
1329 { .parent = NULL },
1330};
1331
1332static const char *auxclk_src_ck_parents[] = {
1333 "sys_clkin_ck", "dpll_core_m3x2_ck", "dpll_per_m3x2_ck",
1334};
1335
1336static const struct clk_ops auxclk_src_ck_ops = {
1337 .enable = &omap2_dflt_clk_enable,
1338 .disable = &omap2_dflt_clk_disable,
1339 .is_enabled = &omap2_dflt_clk_is_enabled,
1340 .recalc_rate = &omap2_clksel_recalc,
1341 .get_parent = &omap2_clksel_find_parent_index,
1342};
1343
1344DEFINE_CLK_OMAP_MUX_GATE(auxclk0_src_ck, NULL, auxclk_src_sel,
1345 OMAP4_SCRM_AUXCLK0, OMAP4_SRCSELECT_MASK,
1346 OMAP4_SCRM_AUXCLK0, OMAP4_ENABLE_SHIFT, NULL,
1347 auxclk_src_ck_parents, auxclk_src_ck_ops);
1348
1349DEFINE_CLK_DIVIDER(auxclk0_ck, "auxclk0_src_ck", &auxclk0_src_ck, 0x0,
1350 OMAP4_SCRM_AUXCLK0, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1351 0x0, NULL);
1352
1353DEFINE_CLK_OMAP_MUX_GATE(auxclk1_src_ck, NULL, auxclk_src_sel,
1354 OMAP4_SCRM_AUXCLK1, OMAP4_SRCSELECT_MASK,
1355 OMAP4_SCRM_AUXCLK1, OMAP4_ENABLE_SHIFT, NULL,
1356 auxclk_src_ck_parents, auxclk_src_ck_ops);
1357
1358DEFINE_CLK_DIVIDER(auxclk1_ck, "auxclk1_src_ck", &auxclk1_src_ck, 0x0,
1359 OMAP4_SCRM_AUXCLK1, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1360 0x0, NULL);
1361
1362DEFINE_CLK_OMAP_MUX_GATE(auxclk2_src_ck, NULL, auxclk_src_sel,
1363 OMAP4_SCRM_AUXCLK2, OMAP4_SRCSELECT_MASK,
1364 OMAP4_SCRM_AUXCLK2, OMAP4_ENABLE_SHIFT, NULL,
1365 auxclk_src_ck_parents, auxclk_src_ck_ops);
1366
1367DEFINE_CLK_DIVIDER(auxclk2_ck, "auxclk2_src_ck", &auxclk2_src_ck, 0x0,
1368 OMAP4_SCRM_AUXCLK2, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1369 0x0, NULL);
1370
1371DEFINE_CLK_OMAP_MUX_GATE(auxclk3_src_ck, NULL, auxclk_src_sel,
1372 OMAP4_SCRM_AUXCLK3, OMAP4_SRCSELECT_MASK,
1373 OMAP4_SCRM_AUXCLK3, OMAP4_ENABLE_SHIFT, NULL,
1374 auxclk_src_ck_parents, auxclk_src_ck_ops);
1375
1376DEFINE_CLK_DIVIDER(auxclk3_ck, "auxclk3_src_ck", &auxclk3_src_ck, 0x0,
1377 OMAP4_SCRM_AUXCLK3, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1378 0x0, NULL);
1379
1380DEFINE_CLK_OMAP_MUX_GATE(auxclk4_src_ck, NULL, auxclk_src_sel,
1381 OMAP4_SCRM_AUXCLK4, OMAP4_SRCSELECT_MASK,
1382 OMAP4_SCRM_AUXCLK4, OMAP4_ENABLE_SHIFT, NULL,
1383 auxclk_src_ck_parents, auxclk_src_ck_ops);
1384
1385DEFINE_CLK_DIVIDER(auxclk4_ck, "auxclk4_src_ck", &auxclk4_src_ck, 0x0,
1386 OMAP4_SCRM_AUXCLK4, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1387 0x0, NULL);
1388
1389DEFINE_CLK_OMAP_MUX_GATE(auxclk5_src_ck, NULL, auxclk_src_sel,
1390 OMAP4_SCRM_AUXCLK5, OMAP4_SRCSELECT_MASK,
1391 OMAP4_SCRM_AUXCLK5, OMAP4_ENABLE_SHIFT, NULL,
1392 auxclk_src_ck_parents, auxclk_src_ck_ops);
1393
1394DEFINE_CLK_DIVIDER(auxclk5_ck, "auxclk5_src_ck", &auxclk5_src_ck, 0x0,
1395 OMAP4_SCRM_AUXCLK5, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1396 0x0, NULL);
1397
1398static const char *auxclkreq_ck_parents[] = {
1399 "auxclk0_ck", "auxclk1_ck", "auxclk2_ck", "auxclk3_ck", "auxclk4_ck",
1400 "auxclk5_ck",
1401};
1402
1403DEFINE_CLK_MUX(auxclkreq0_ck, auxclkreq_ck_parents, NULL, 0x0,
1404 OMAP4_SCRM_AUXCLKREQ0, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1405 0x0, NULL);
1406
1407DEFINE_CLK_MUX(auxclkreq1_ck, auxclkreq_ck_parents, NULL, 0x0,
1408 OMAP4_SCRM_AUXCLKREQ1, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1409 0x0, NULL);
1410
1411DEFINE_CLK_MUX(auxclkreq2_ck, auxclkreq_ck_parents, NULL, 0x0,
1412 OMAP4_SCRM_AUXCLKREQ2, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1413 0x0, NULL);
1414
1415DEFINE_CLK_MUX(auxclkreq3_ck, auxclkreq_ck_parents, NULL, 0x0,
1416 OMAP4_SCRM_AUXCLKREQ3, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1417 0x0, NULL);
1418
1419DEFINE_CLK_MUX(auxclkreq4_ck, auxclkreq_ck_parents, NULL, 0x0,
1420 OMAP4_SCRM_AUXCLKREQ4, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1421 0x0, NULL);
1422
1423DEFINE_CLK_MUX(auxclkreq5_ck, auxclkreq_ck_parents, NULL, 0x0,
1424 OMAP4_SCRM_AUXCLKREQ5, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1425 0x0, NULL);
1426
1427/*
1428 * clocks specific to omap4460
1429 */
1430static struct omap_clk omap446x_clks[] = {
1431 CLK(NULL, "div_ts_ck", &div_ts_ck),
1432 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk),
1433};
1434
1435/*
1436 * clocks specific to omap4430
1437 */
1438static struct omap_clk omap443x_clks[] = {
1439 CLK(NULL, "bandgap_fclk", &bandgap_fclk),
1440};
1441
1442/*
1443 * clocks common to omap44xx
1444 */
1445static struct omap_clk omap44xx_clks[] = {
1446 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck),
1447 CLK(NULL, "pad_clks_src_ck", &pad_clks_src_ck),
1448 CLK(NULL, "pad_clks_ck", &pad_clks_ck),
1449 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck),
1450 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck),
1451 CLK(NULL, "slimbus_src_clk", &slimbus_src_clk),
1452 CLK(NULL, "slimbus_clk", &slimbus_clk),
1453 CLK(NULL, "sys_32k_ck", &sys_32k_ck),
1454 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck),
1455 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck),
1456 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck),
1457 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck),
1458 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck),
1459 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck),
1460 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck),
1461 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck),
1462 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck),
1463 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck),
1464 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck),
1465 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck),
1466 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck),
1467 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck),
1468 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck),
1469 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck),
1470 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck),
1471 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck),
1472 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk),
1473 CLK(NULL, "abe_clk", &abe_clk),
1474 CLK(NULL, "aess_fclk", &aess_fclk),
1475 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck),
1476 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck),
1477 CLK(NULL, "dpll_core_ck", &dpll_core_ck),
1478 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck),
1479 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck),
1480 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck),
1481 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck),
1482 CLK(NULL, "ddrphy_ck", &ddrphy_ck),
1483 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck),
1484 CLK(NULL, "div_core_ck", &div_core_ck),
1485 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk),
1486 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk),
1487 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck),
1488 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck),
1489 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck),
1490 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck),
1491 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck),
1492 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck),
1493 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck),
1494 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck),
1495 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck),
1496 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck),
1497 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck),
1498 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck),
1499 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck),
1500 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck),
1501 CLK(NULL, "dpll_per_ck", &dpll_per_ck),
1502 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck),
1503 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck),
1504 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck),
1505 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck),
1506 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck),
1507 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck),
1508 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck),
1509 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck),
1510 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck),
1511 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck),
1512 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck),
1513 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck),
1514 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck),
1515 CLK(NULL, "func_12m_fclk", &func_12m_fclk),
1516 CLK(NULL, "func_24m_clk", &func_24m_clk),
1517 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk),
1518 CLK(NULL, "func_48m_fclk", &func_48m_fclk),
1519 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk),
1520 CLK(NULL, "func_64m_fclk", &func_64m_fclk),
1521 CLK(NULL, "func_96m_fclk", &func_96m_fclk),
1522 CLK(NULL, "init_60m_fclk", &init_60m_fclk),
1523 CLK(NULL, "l3_div_ck", &l3_div_ck),
1524 CLK(NULL, "l4_div_ck", &l4_div_ck),
1525 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck),
1526 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck),
1527 CLK("smp_twd", NULL, &mpu_periphclk),
1528 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk),
1529 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk),
1530 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk),
1531 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck),
1532 CLK(NULL, "aes1_fck", &aes1_fck),
1533 CLK(NULL, "aes2_fck", &aes2_fck),
1534 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck),
1535 CLK(NULL, "func_dmic_abe_gfclk", &func_dmic_abe_gfclk),
1536 CLK(NULL, "dss_sys_clk", &dss_sys_clk),
1537 CLK(NULL, "dss_tv_clk", &dss_tv_clk),
1538 CLK(NULL, "dss_dss_clk", &dss_dss_clk),
1539 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk),
1540 CLK(NULL, "dss_fck", &dss_fck),
1541 CLK("omapdss_dss", "ick", &dss_fck),
1542 CLK(NULL, "fdif_fck", &fdif_fck),
1543 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk),
1544 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk),
1545 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk),
1546 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk),
1547 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk),
1548 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk),
1549 CLK(NULL, "sgx_clk_mux", &sgx_clk_mux),
1550 CLK(NULL, "hsi_fck", &hsi_fck),
1551 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk),
1552 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck),
1553 CLK(NULL, "func_mcasp_abe_gfclk", &func_mcasp_abe_gfclk),
1554 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck),
1555 CLK(NULL, "func_mcbsp1_gfclk", &func_mcbsp1_gfclk),
1556 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck),
1557 CLK(NULL, "func_mcbsp2_gfclk", &func_mcbsp2_gfclk),
1558 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck),
1559 CLK(NULL, "func_mcbsp3_gfclk", &func_mcbsp3_gfclk),
1560 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck),
1561 CLK(NULL, "per_mcbsp4_gfclk", &per_mcbsp4_gfclk),
1562 CLK(NULL, "hsmmc1_fclk", &hsmmc1_fclk),
1563 CLK(NULL, "hsmmc2_fclk", &hsmmc2_fclk),
1564 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m),
1565 CLK(NULL, "sha2md5_fck", &sha2md5_fck),
1566 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1),
1567 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0),
1568 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2),
1569 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk),
1570 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1),
1571 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0),
1572 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk),
1573 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck),
1574 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck),
1575 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck),
1576 CLK(NULL, "dmt1_clk_mux", &dmt1_clk_mux),
1577 CLK(NULL, "cm2_dm10_mux", &cm2_dm10_mux),
1578 CLK(NULL, "cm2_dm11_mux", &cm2_dm11_mux),
1579 CLK(NULL, "cm2_dm2_mux", &cm2_dm2_mux),
1580 CLK(NULL, "cm2_dm3_mux", &cm2_dm3_mux),
1581 CLK(NULL, "cm2_dm4_mux", &cm2_dm4_mux),
1582 CLK(NULL, "timer5_sync_mux", &timer5_sync_mux),
1583 CLK(NULL, "timer6_sync_mux", &timer6_sync_mux),
1584 CLK(NULL, "timer7_sync_mux", &timer7_sync_mux),
1585 CLK(NULL, "timer8_sync_mux", &timer8_sync_mux),
1586 CLK(NULL, "cm2_dm9_mux", &cm2_dm9_mux),
1587 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck),
1588 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck),
1589 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk),
1590 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk),
1591 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk),
1592 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk),
1593 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk),
1594 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk),
1595 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk),
1596 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk),
1597 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk),
1598 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk),
1599 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck),
1600 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck),
1601 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk),
1602 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk),
1603 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick),
1604 CLK("musb-omap2430", "ick", &usb_otg_hs_ick),
1605 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k),
1606 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk),
1607 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk),
1608 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk),
1609 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick),
1610 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick),
1611 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick),
1612 CLK(NULL, "usim_ck", &usim_ck),
1613 CLK(NULL, "usim_fclk", &usim_fclk),
1614 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck),
1615 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck),
1616 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck),
1617 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck),
1618 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck),
1619 CLK(NULL, "auxclk0_ck", &auxclk0_ck),
1620 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck),
1621 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck),
1622 CLK(NULL, "auxclk1_ck", &auxclk1_ck),
1623 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck),
1624 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck),
1625 CLK(NULL, "auxclk2_ck", &auxclk2_ck),
1626 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck),
1627 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck),
1628 CLK(NULL, "auxclk3_ck", &auxclk3_ck),
1629 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck),
1630 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck),
1631 CLK(NULL, "auxclk4_ck", &auxclk4_ck),
1632 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck),
1633 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck),
1634 CLK(NULL, "auxclk5_ck", &auxclk5_ck),
1635 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck),
1636 CLK("50000000.gpmc", "fck", &dummy_ck),
1637 CLK("omap_i2c.1", "ick", &dummy_ck),
1638 CLK("omap_i2c.2", "ick", &dummy_ck),
1639 CLK("omap_i2c.3", "ick", &dummy_ck),
1640 CLK("omap_i2c.4", "ick", &dummy_ck),
1641 CLK(NULL, "mailboxes_ick", &dummy_ck),
1642 CLK("omap_hsmmc.0", "ick", &dummy_ck),
1643 CLK("omap_hsmmc.1", "ick", &dummy_ck),
1644 CLK("omap_hsmmc.2", "ick", &dummy_ck),
1645 CLK("omap_hsmmc.3", "ick", &dummy_ck),
1646 CLK("omap_hsmmc.4", "ick", &dummy_ck),
1647 CLK("omap-mcbsp.1", "ick", &dummy_ck),
1648 CLK("omap-mcbsp.2", "ick", &dummy_ck),
1649 CLK("omap-mcbsp.3", "ick", &dummy_ck),
1650 CLK("omap-mcbsp.4", "ick", &dummy_ck),
1651 CLK("omap2_mcspi.1", "ick", &dummy_ck),
1652 CLK("omap2_mcspi.2", "ick", &dummy_ck),
1653 CLK("omap2_mcspi.3", "ick", &dummy_ck),
1654 CLK("omap2_mcspi.4", "ick", &dummy_ck),
1655 CLK(NULL, "uart1_ick", &dummy_ck),
1656 CLK(NULL, "uart2_ick", &dummy_ck),
1657 CLK(NULL, "uart3_ick", &dummy_ck),
1658 CLK(NULL, "uart4_ick", &dummy_ck),
1659 CLK("usbhs_omap", "usbhost_ick", &dummy_ck),
1660 CLK("usbhs_omap", "usbtll_fck", &dummy_ck),
1661 CLK("usbhs_tll", "usbtll_fck", &dummy_ck),
1662 CLK("omap_wdt", "ick", &dummy_ck),
1663 CLK(NULL, "timer_32k_ck", &sys_32k_ck),
1664 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
1665 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck),
1666 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck),
1667 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck),
1668 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck),
1669 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck),
1670 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck),
1671 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck),
1672 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck),
1673 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck),
1674 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck),
1675 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck),
1676 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck),
1677 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck),
1678 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck),
1679 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck),
1680 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck),
1681 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck),
1682 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck),
1683 CLK("40138000.timer", "timer_sys_ck", &syc_clk_div_ck),
1684 CLK("4013a000.timer", "timer_sys_ck", &syc_clk_div_ck),
1685 CLK("4013c000.timer", "timer_sys_ck", &syc_clk_div_ck),
1686 CLK("4013e000.timer", "timer_sys_ck", &syc_clk_div_ck),
1687 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck),
1688};
1689
1690int __init omap4xxx_clk_init(void)
1691{
1692 int rc;
1693
1694 if (cpu_is_omap443x()) {
1695 cpu_mask = RATE_IN_4430;
1696 omap_clocks_register(omap443x_clks, ARRAY_SIZE(omap443x_clks));
1697 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
1698 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
1699 omap_clocks_register(omap446x_clks, ARRAY_SIZE(omap446x_clks));
1700 if (cpu_is_omap447x())
1701 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
1702 } else {
1703 return 0;
1704 }
1705
1706 omap_clocks_register(omap44xx_clks, ARRAY_SIZE(omap44xx_clks));
1707
1708 omap2_clk_disable_autoidle_all();
1709
1710 /*
1711 * A set rate of ABE DPLL inturn triggers a set rate of USB DPLL
1712 * when its in bypass. So always lock USB before ABE DPLL.
1713 */
1714 /*
1715 * Lock USB DPLL on OMAP4 devices so that the L3INIT power
1716 * domain can transition to retention state when not in use.
1717 */
1718 rc = clk_set_rate(&dpll_usb_ck, OMAP4_DPLL_USB_DEFFREQ);
1719 if (rc)
1720 pr_err("%s: failed to configure USB DPLL!\n", __func__);
1721
1722 /*
1723 * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power
1724 * state when turning the ABE clock domain. Workaround this by
1725 * locking the ABE DPLL on boot.
1726 * Lock the ABE DPLL in any case to avoid issues with audio.
1727 */
1728 rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck);
1729 if (!rc)
1730 rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ);
1731 if (rc)
1732 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
1733
1734 return 0;
1735}
diff --git a/arch/arm/mach-omap2/clkt_clksel.c b/arch/arm/mach-omap2/clkt_clksel.c
index 0ec9f6fdf046..7ee26108ac0d 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -97,12 +97,12 @@ static void _write_clksel_reg(struct clk_hw_omap *clk, u32 field_val)
97{ 97{
98 u32 v; 98 u32 v;
99 99
100 v = __raw_readl(clk->clksel_reg); 100 v = omap2_clk_readl(clk, clk->clksel_reg);
101 v &= ~clk->clksel_mask; 101 v &= ~clk->clksel_mask;
102 v |= field_val << __ffs(clk->clksel_mask); 102 v |= field_val << __ffs(clk->clksel_mask);
103 __raw_writel(v, clk->clksel_reg); 103 omap2_clk_writel(v, clk, clk->clksel_reg);
104 104
105 v = __raw_readl(clk->clksel_reg); /* OCP barrier */ 105 v = omap2_clk_readl(clk, clk->clksel_reg); /* OCP barrier */
106} 106}
107 107
108/** 108/**
@@ -204,7 +204,7 @@ static u32 _read_divisor(struct clk_hw_omap *clk)
204 if (!clk->clksel || !clk->clksel_mask) 204 if (!clk->clksel || !clk->clksel_mask)
205 return 0; 205 return 0;
206 206
207 v = __raw_readl(clk->clksel_reg); 207 v = omap2_clk_readl(clk, clk->clksel_reg);
208 v &= clk->clksel_mask; 208 v &= clk->clksel_mask;
209 v >>= __ffs(clk->clksel_mask); 209 v >>= __ffs(clk->clksel_mask);
210 210
@@ -320,7 +320,7 @@ u8 omap2_clksel_find_parent_index(struct clk_hw *hw)
320 WARN((!clk->clksel || !clk->clksel_mask), 320 WARN((!clk->clksel || !clk->clksel_mask),
321 "clock: %s: attempt to call on a non-clksel clock", clk_name); 321 "clock: %s: attempt to call on a non-clksel clock", clk_name);
322 322
323 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask; 323 r = omap2_clk_readl(clk, clk->clksel_reg) & clk->clksel_mask;
324 r >>= __ffs(clk->clksel_mask); 324 r >>= __ffs(clk->clksel_mask);
325 325
326 for (clks = clk->clksel; clks->parent && !found; clks++) { 326 for (clks = clk->clksel; clks->parent && !found; clks++) {
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 924c230f8948..47f9562ca7aa 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -196,7 +196,7 @@ u8 omap2_init_dpll_parent(struct clk_hw *hw)
196 if (!dd) 196 if (!dd)
197 return -EINVAL; 197 return -EINVAL;
198 198
199 v = __raw_readl(dd->control_reg); 199 v = omap2_clk_readl(clk, dd->control_reg);
200 v &= dd->enable_mask; 200 v &= dd->enable_mask;
201 v >>= __ffs(dd->enable_mask); 201 v >>= __ffs(dd->enable_mask);
202 202
@@ -243,7 +243,7 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
243 return 0; 243 return 0;
244 244
245 /* Return bypass rate if DPLL is bypassed */ 245 /* Return bypass rate if DPLL is bypassed */
246 v = __raw_readl(dd->control_reg); 246 v = omap2_clk_readl(clk, dd->control_reg);
247 v &= dd->enable_mask; 247 v &= dd->enable_mask;
248 v >>= __ffs(dd->enable_mask); 248 v >>= __ffs(dd->enable_mask);
249 249
@@ -262,7 +262,7 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
262 return __clk_get_rate(dd->clk_bypass); 262 return __clk_get_rate(dd->clk_bypass);
263 } 263 }
264 264
265 v = __raw_readl(dd->mult_div1_reg); 265 v = omap2_clk_readl(clk, dd->mult_div1_reg);
266 dpll_mult = v & dd->mult_mask; 266 dpll_mult = v & dd->mult_mask;
267 dpll_mult >>= __ffs(dd->mult_mask); 267 dpll_mult >>= __ffs(dd->mult_mask);
268 dpll_div = v & dd->div1_mask; 268 dpll_div = v & dd->div1_mask;
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index f10eb03ce3e2..333f0a666171 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -25,25 +25,29 @@
25/* XXX */ 25/* XXX */
26void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk) 26void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
27{ 27{
28 u32 v, r; 28 u32 v;
29 void __iomem *r;
29 30
30 r = ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); 31 r = (__force void __iomem *)
32 ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN));
31 33
32 v = __raw_readl((__force void __iomem *)r); 34 v = omap2_clk_readl(clk, r);
33 v |= (1 << clk->enable_bit); 35 v |= (1 << clk->enable_bit);
34 __raw_writel(v, (__force void __iomem *)r); 36 omap2_clk_writel(v, clk, r);
35} 37}
36 38
37/* XXX */ 39/* XXX */
38void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk) 40void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
39{ 41{
40 u32 v, r; 42 u32 v;
43 void __iomem *r;
41 44
42 r = ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); 45 r = (__force void __iomem *)
46 ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN));
43 47
44 v = __raw_readl((__force void __iomem *)r); 48 v = omap2_clk_readl(clk, r);
45 v &= ~(1 << clk->enable_bit); 49 v &= ~(1 << clk->enable_bit);
46 __raw_writel(v, (__force void __iomem *)r); 50 omap2_clk_writel(v, clk, r);
47} 51}
48 52
49/* Public data */ 53/* Public data */
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index c7c5d31e9082..591581a66532 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -26,7 +26,6 @@
26#include <linux/clk-private.h> 26#include <linux/clk-private.h>
27#include <asm/cpu.h> 27#include <asm/cpu.h>
28 28
29
30#include <trace/events/power.h> 29#include <trace/events/power.h>
31 30
32#include "soc.h" 31#include "soc.h"
@@ -56,6 +55,31 @@ u16 cpu_mask;
56static bool clkdm_control = true; 55static bool clkdm_control = true;
57 56
58static LIST_HEAD(clk_hw_omap_clocks); 57static LIST_HEAD(clk_hw_omap_clocks);
58void __iomem *clk_memmaps[CLK_MAX_MEMMAPS];
59
60void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg)
61{
62 if (clk->flags & MEMMAP_ADDRESSING) {
63 struct clk_omap_reg *r = (struct clk_omap_reg *)&reg;
64 writel_relaxed(val, clk_memmaps[r->index] + r->offset);
65 } else {
66 writel_relaxed(val, reg);
67 }
68}
69
70u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg)
71{
72 u32 val;
73
74 if (clk->flags & MEMMAP_ADDRESSING) {
75 struct clk_omap_reg *r = (struct clk_omap_reg *)&reg;
76 val = readl_relaxed(clk_memmaps[r->index] + r->offset);
77 } else {
78 val = readl_relaxed(reg);
79 }
80
81 return val;
82}
59 83
60/* 84/*
61 * Used for clocks that have the same value as the parent clock, 85 * Used for clocks that have the same value as the parent clock,
@@ -87,6 +111,7 @@ unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
87 111
88/** 112/**
89 * _wait_idlest_generic - wait for a module to leave the idle state 113 * _wait_idlest_generic - wait for a module to leave the idle state
114 * @clk: module clock to wait for (needed for register offsets)
90 * @reg: virtual address of module IDLEST register 115 * @reg: virtual address of module IDLEST register
91 * @mask: value to mask against to determine if the module is active 116 * @mask: value to mask against to determine if the module is active
92 * @idlest: idle state indicator (0 or 1) for the clock 117 * @idlest: idle state indicator (0 or 1) for the clock
@@ -98,14 +123,14 @@ unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
98 * elapsed. XXX Deprecated - should be moved into drivers for the 123 * elapsed. XXX Deprecated - should be moved into drivers for the
99 * individual IP block that the IDLEST register exists in. 124 * individual IP block that the IDLEST register exists in.
100 */ 125 */
101static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest, 126static int _wait_idlest_generic(struct clk_hw_omap *clk, void __iomem *reg,
102 const char *name) 127 u32 mask, u8 idlest, const char *name)
103{ 128{
104 int i = 0, ena = 0; 129 int i = 0, ena = 0;
105 130
106 ena = (idlest) ? 0 : mask; 131 ena = (idlest) ? 0 : mask;
107 132
108 omap_test_timeout(((__raw_readl(reg) & mask) == ena), 133 omap_test_timeout(((omap2_clk_readl(clk, reg) & mask) == ena),
109 MAX_MODULE_ENABLE_WAIT, i); 134 MAX_MODULE_ENABLE_WAIT, i);
110 135
111 if (i < MAX_MODULE_ENABLE_WAIT) 136 if (i < MAX_MODULE_ENABLE_WAIT)
@@ -138,7 +163,7 @@ static void _omap2_module_wait_ready(struct clk_hw_omap *clk)
138 /* Not all modules have multiple clocks that their IDLEST depends on */ 163 /* Not all modules have multiple clocks that their IDLEST depends on */
139 if (clk->ops->find_companion) { 164 if (clk->ops->find_companion) {
140 clk->ops->find_companion(clk, &companion_reg, &other_bit); 165 clk->ops->find_companion(clk, &companion_reg, &other_bit);
141 if (!(__raw_readl(companion_reg) & (1 << other_bit))) 166 if (!(omap2_clk_readl(clk, companion_reg) & (1 << other_bit)))
142 return; 167 return;
143 } 168 }
144 169
@@ -146,8 +171,8 @@ static void _omap2_module_wait_ready(struct clk_hw_omap *clk)
146 r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id); 171 r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id);
147 if (r) { 172 if (r) {
148 /* IDLEST register not in the CM module */ 173 /* IDLEST register not in the CM module */
149 _wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val, 174 _wait_idlest_generic(clk, idlest_reg, (1 << idlest_bit),
150 __clk_get_name(clk->hw.clk)); 175 idlest_val, __clk_get_name(clk->hw.clk));
151 } else { 176 } else {
152 cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit); 177 cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit);
153 }; 178 };
@@ -309,13 +334,13 @@ int omap2_dflt_clk_enable(struct clk_hw *hw)
309 } 334 }
310 335
311 /* FIXME should not have INVERT_ENABLE bit here */ 336 /* FIXME should not have INVERT_ENABLE bit here */
312 v = __raw_readl(clk->enable_reg); 337 v = omap2_clk_readl(clk, clk->enable_reg);
313 if (clk->flags & INVERT_ENABLE) 338 if (clk->flags & INVERT_ENABLE)
314 v &= ~(1 << clk->enable_bit); 339 v &= ~(1 << clk->enable_bit);
315 else 340 else
316 v |= (1 << clk->enable_bit); 341 v |= (1 << clk->enable_bit);
317 __raw_writel(v, clk->enable_reg); 342 omap2_clk_writel(v, clk, clk->enable_reg);
318 v = __raw_readl(clk->enable_reg); /* OCP barrier */ 343 v = omap2_clk_readl(clk, clk->enable_reg); /* OCP barrier */
319 344
320 if (clk->ops && clk->ops->find_idlest) 345 if (clk->ops && clk->ops->find_idlest)
321 _omap2_module_wait_ready(clk); 346 _omap2_module_wait_ready(clk);
@@ -353,12 +378,12 @@ void omap2_dflt_clk_disable(struct clk_hw *hw)
353 return; 378 return;
354 } 379 }
355 380
356 v = __raw_readl(clk->enable_reg); 381 v = omap2_clk_readl(clk, clk->enable_reg);
357 if (clk->flags & INVERT_ENABLE) 382 if (clk->flags & INVERT_ENABLE)
358 v |= (1 << clk->enable_bit); 383 v |= (1 << clk->enable_bit);
359 else 384 else
360 v &= ~(1 << clk->enable_bit); 385 v &= ~(1 << clk->enable_bit);
361 __raw_writel(v, clk->enable_reg); 386 omap2_clk_writel(v, clk, clk->enable_reg);
362 /* No OCP barrier needed here since it is a disable operation */ 387 /* No OCP barrier needed here since it is a disable operation */
363 388
364 if (clkdm_control && clk->clkdm) 389 if (clkdm_control && clk->clkdm)
@@ -454,7 +479,7 @@ int omap2_dflt_clk_is_enabled(struct clk_hw *hw)
454 struct clk_hw_omap *clk = to_clk_hw_omap(hw); 479 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
455 u32 v; 480 u32 v;
456 481
457 v = __raw_readl(clk->enable_reg); 482 v = omap2_clk_readl(clk, clk->enable_reg);
458 483
459 if (clk->flags & INVERT_ENABLE) 484 if (clk->flags & INVERT_ENABLE)
460 v ^= BIT(clk->enable_bit); 485 v ^= BIT(clk->enable_bit);
@@ -520,6 +545,9 @@ int omap2_clk_enable_autoidle_all(void)
520 list_for_each_entry(c, &clk_hw_omap_clocks, node) 545 list_for_each_entry(c, &clk_hw_omap_clocks, node)
521 if (c->ops && c->ops->allow_idle) 546 if (c->ops && c->ops->allow_idle)
522 c->ops->allow_idle(c); 547 c->ops->allow_idle(c);
548
549 of_ti_clk_allow_autoidle_all();
550
523 return 0; 551 return 0;
524} 552}
525 553
@@ -539,6 +567,9 @@ int omap2_clk_disable_autoidle_all(void)
539 list_for_each_entry(c, &clk_hw_omap_clocks, node) 567 list_for_each_entry(c, &clk_hw_omap_clocks, node)
540 if (c->ops && c->ops->deny_idle) 568 if (c->ops && c->ops->deny_idle)
541 c->ops->deny_idle(c); 569 c->ops->deny_idle(c);
570
571 of_ti_clk_deny_autoidle_all();
572
542 return 0; 573 return 0;
543} 574}
544 575
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 82916cc82c92..bda767a9dea8 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/clkdev.h> 22#include <linux/clkdev.h>
23#include <linux/clk-provider.h> 23#include <linux/clk-provider.h>
24#include <linux/clk/ti.h>
24 25
25struct omap_clk { 26struct omap_clk {
26 u16 cpu; 27 u16 cpu;
@@ -37,7 +38,6 @@ struct omap_clk {
37 } 38 }
38 39
39struct clockdomain; 40struct clockdomain;
40#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
41 41
42#define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \ 42#define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \
43 static struct clk _name = { \ 43 static struct clk _name = { \
@@ -178,141 +178,6 @@ struct clksel {
178 const struct clksel_rate *rates; 178 const struct clksel_rate *rates;
179}; 179};
180 180
181/**
182 * struct dpll_data - DPLL registers and integration data
183 * @mult_div1_reg: register containing the DPLL M and N bitfields
184 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
185 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
186 * @clk_bypass: struct clk pointer to the clock's bypass clock input
187 * @clk_ref: struct clk pointer to the clock's reference clock input
188 * @control_reg: register containing the DPLL mode bitfield
189 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
190 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
191 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
192 * @last_rounded_m4xen: cache of the last M4X result of
193 * omap4_dpll_regm4xen_round_rate()
194 * @last_rounded_lpmode: cache of the last lpmode result of
195 * omap4_dpll_lpmode_recalc()
196 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
197 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
198 * @min_divider: minimum valid non-bypass divider value (actual)
199 * @max_divider: maximum valid non-bypass divider value (actual)
200 * @modes: possible values of @enable_mask
201 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
202 * @idlest_reg: register containing the DPLL idle status bitfield
203 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
204 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
205 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
206 * @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg
207 * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg
208 * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
209 * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
210 * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
211 * @flags: DPLL type/features (see below)
212 *
213 * Possible values for @flags:
214 * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
215 *
216 * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
217 *
218 * XXX Some DPLLs have multiple bypass inputs, so it's not technically
219 * correct to only have one @clk_bypass pointer.
220 *
221 * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
222 * @last_rounded_n) should be separated from the runtime-fixed fields
223 * and placed into a different structure, so that the runtime-fixed data
224 * can be placed into read-only space.
225 */
226struct dpll_data {
227 void __iomem *mult_div1_reg;
228 u32 mult_mask;
229 u32 div1_mask;
230 struct clk *clk_bypass;
231 struct clk *clk_ref;
232 void __iomem *control_reg;
233 u32 enable_mask;
234 unsigned long last_rounded_rate;
235 u16 last_rounded_m;
236 u8 last_rounded_m4xen;
237 u8 last_rounded_lpmode;
238 u16 max_multiplier;
239 u8 last_rounded_n;
240 u8 min_divider;
241 u16 max_divider;
242 u8 modes;
243 void __iomem *autoidle_reg;
244 void __iomem *idlest_reg;
245 u32 autoidle_mask;
246 u32 freqsel_mask;
247 u32 idlest_mask;
248 u32 dco_mask;
249 u32 sddiv_mask;
250 u32 lpmode_mask;
251 u32 m4xen_mask;
252 u8 auto_recal_bit;
253 u8 recal_en_bit;
254 u8 recal_st_bit;
255 u8 flags;
256};
257
258/*
259 * struct clk.flags possibilities
260 *
261 * XXX document the rest of the clock flags here
262 *
263 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
264 * bits share the same register. This flag allows the
265 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
266 * should be used. This is a temporary solution - a better approach
267 * would be to associate clock type-specific data with the clock,
268 * similar to the struct dpll_data approach.
269 */
270#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
271#define CLOCK_IDLE_CONTROL (1 << 1)
272#define CLOCK_NO_IDLE_PARENT (1 << 2)
273#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
274#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
275#define CLOCK_CLKOUTX2 (1 << 5)
276
277/**
278 * struct clk_hw_omap - OMAP struct clk
279 * @node: list_head connecting this clock into the full clock list
280 * @enable_reg: register to write to enable the clock (see @enable_bit)
281 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
282 * @flags: see "struct clk.flags possibilities" above
283 * @clksel_reg: for clksel clks, register va containing src/divisor select
284 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
285 * @clksel: for clksel clks, pointer to struct clksel for this clock
286 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
287 * @clkdm_name: clockdomain name that this clock is contained in
288 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
289 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
290 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
291 *
292 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
293 * clock code converted to use clksel.
294 *
295 */
296
297struct clk_hw_omap_ops;
298
299struct clk_hw_omap {
300 struct clk_hw hw;
301 struct list_head node;
302 unsigned long fixed_rate;
303 u8 fixed_div;
304 void __iomem *enable_reg;
305 u8 enable_bit;
306 u8 flags;
307 void __iomem *clksel_reg;
308 u32 clksel_mask;
309 const struct clksel *clksel;
310 struct dpll_data *dpll_data;
311 const char *clkdm_name;
312 struct clockdomain *clkdm;
313 const struct clk_hw_omap_ops *ops;
314};
315
316struct clk_hw_omap_ops { 181struct clk_hw_omap_ops {
317 void (*find_idlest)(struct clk_hw_omap *oclk, 182 void (*find_idlest)(struct clk_hw_omap *oclk,
318 void __iomem **idlest_reg, 183 void __iomem **idlest_reg,
@@ -348,36 +213,13 @@ unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
348#define OMAP4XXX_EN_DPLL_FRBYPASS 0x6 213#define OMAP4XXX_EN_DPLL_FRBYPASS 0x6
349#define OMAP4XXX_EN_DPLL_LOCKED 0x7 214#define OMAP4XXX_EN_DPLL_LOCKED 0x7
350 215
351/* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */
352#define DPLL_LOW_POWER_STOP 0x1
353#define DPLL_LOW_POWER_BYPASS 0x5
354#define DPLL_LOCKED 0x7
355
356/* DPLL Type and DCO Selection Flags */
357#define DPLL_J_TYPE 0x1
358
359long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
360 unsigned long *parent_rate);
361unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate);
362int omap3_noncore_dpll_enable(struct clk_hw *hw);
363void omap3_noncore_dpll_disable(struct clk_hw *hw);
364int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
365 unsigned long parent_rate);
366u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk); 216u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk);
367void omap3_dpll_allow_idle(struct clk_hw_omap *clk); 217void omap3_dpll_allow_idle(struct clk_hw_omap *clk);
368void omap3_dpll_deny_idle(struct clk_hw_omap *clk); 218void omap3_dpll_deny_idle(struct clk_hw_omap *clk);
369unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
370 unsigned long parent_rate);
371int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk); 219int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk);
372void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk); 220void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk);
373void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk); 221void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk);
374unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
375 unsigned long parent_rate);
376long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
377 unsigned long target_rate,
378 unsigned long *parent_rate);
379 222
380void omap2_init_clk_clkdm(struct clk_hw *clk);
381void __init omap2_clk_disable_clkdm_control(void); 223void __init omap2_clk_disable_clkdm_control(void);
382 224
383/* clkt_clksel.c public functions */ 225/* clkt_clksel.c public functions */
@@ -396,29 +238,25 @@ int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val);
396extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk); 238extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk);
397extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk); 239extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk);
398 240
399u8 omap2_init_dpll_parent(struct clk_hw *hw);
400unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk); 241unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk);
401 242
402int omap2_dflt_clk_enable(struct clk_hw *hw);
403void omap2_dflt_clk_disable(struct clk_hw *hw);
404int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
405void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk, 243void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
406 void __iomem **other_reg, 244 void __iomem **other_reg,
407 u8 *other_bit); 245 u8 *other_bit);
408void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk, 246void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
409 void __iomem **idlest_reg, 247 void __iomem **idlest_reg,
410 u8 *idlest_bit, u8 *idlest_val); 248 u8 *idlest_bit, u8 *idlest_val);
411void omap2_init_clk_hw_omap_clocks(struct clk *clk);
412int omap2_clk_enable_autoidle_all(void); 249int omap2_clk_enable_autoidle_all(void);
413int omap2_clk_disable_autoidle_all(void);
414int omap2_clk_allow_idle(struct clk *clk); 250int omap2_clk_allow_idle(struct clk *clk);
415int omap2_clk_deny_idle(struct clk *clk); 251int omap2_clk_deny_idle(struct clk *clk);
416void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
417int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); 252int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name);
418void omap2_clk_print_new_rates(const char *hfclkin_ck_name, 253void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
419 const char *core_ck_name, 254 const char *core_ck_name,
420 const char *mpu_ck_name); 255 const char *mpu_ck_name);
421 256
257u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg);
258void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg);
259
422extern u16 cpu_mask; 260extern u16 cpu_mask;
423 261
424extern const struct clkops clkops_omap2_dflt_wait; 262extern const struct clkops clkops_omap2_dflt_wait;
@@ -433,19 +271,12 @@ extern const struct clksel_rate gfx_l3_rates[];
433extern const struct clksel_rate dsp_ick_rates[]; 271extern const struct clksel_rate dsp_ick_rates[];
434extern struct clk dummy_ck; 272extern struct clk dummy_ck;
435 273
436extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
437extern const struct clk_hw_omap_ops clkhwops_iclk_wait; 274extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
438extern const struct clk_hw_omap_ops clkhwops_wait; 275extern const struct clk_hw_omap_ops clkhwops_wait;
439extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
440extern const struct clk_hw_omap_ops clkhwops_iclk;
441extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait; 276extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait;
442extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait;
443extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait; 277extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait;
444extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait;
445extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait;
446extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait; 278extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait;
447extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait; 279extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait;
448extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait;
449extern const struct clk_hw_omap_ops clkhwops_apll54; 280extern const struct clk_hw_omap_ops clkhwops_apll54;
450extern const struct clk_hw_omap_ops clkhwops_apll96; 281extern const struct clk_hw_omap_ops clkhwops_apll96;
451extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll; 282extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
@@ -460,6 +291,8 @@ extern const struct clksel_rate div_1_3_rates[];
460extern const struct clksel_rate div_1_4_rates[]; 291extern const struct clksel_rate div_1_4_rates[];
461extern const struct clksel_rate div31_1to31_rates[]; 292extern const struct clksel_rate div31_1to31_rates[];
462 293
294extern void __iomem *clk_memmaps[];
295
463extern int am33xx_clk_init(void); 296extern int am33xx_clk_init(void);
464 297
465extern int omap2_clkops_enable_clkdm(struct clk_hw *hw); 298extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
diff --git a/arch/arm/mach-omap2/clock36xx.c b/arch/arm/mach-omap2/clock36xx.c
index bbd6a3f717e6..91ccb962e09e 100644
--- a/arch/arm/mach-omap2/clock36xx.c
+++ b/arch/arm/mach-omap2/clock36xx.c
@@ -43,6 +43,7 @@ int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
43 struct clk_divider *parent; 43 struct clk_divider *parent;
44 struct clk_hw *parent_hw; 44 struct clk_hw *parent_hw;
45 u32 dummy_v, orig_v; 45 u32 dummy_v, orig_v;
46 struct clk_hw_omap *omap_clk = to_clk_hw_omap(clk);
46 int ret; 47 int ret;
47 48
48 /* Clear PWRDN bit of HSDIVIDER */ 49 /* Clear PWRDN bit of HSDIVIDER */
@@ -53,15 +54,15 @@ int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
53 54
54 /* Restore the dividers */ 55 /* Restore the dividers */
55 if (!ret) { 56 if (!ret) {
56 orig_v = __raw_readl(parent->reg); 57 orig_v = omap2_clk_readl(omap_clk, parent->reg);
57 dummy_v = orig_v; 58 dummy_v = orig_v;
58 59
59 /* Write any other value different from the Read value */ 60 /* Write any other value different from the Read value */
60 dummy_v ^= (1 << parent->shift); 61 dummy_v ^= (1 << parent->shift);
61 __raw_writel(dummy_v, parent->reg); 62 omap2_clk_writel(dummy_v, omap_clk, parent->reg);
62 63
63 /* Write the original divider */ 64 /* Write the original divider */
64 __raw_writel(orig_v, parent->reg); 65 omap2_clk_writel(orig_v, omap_clk, parent->reg);
65 } 66 }
66 67
67 return ret; 68 return ret;
diff --git a/arch/arm/mach-omap2/clock3xxx.h b/arch/arm/mach-omap2/clock3xxx.h
index 8cd4b0a882ae..78d9f562e3ce 100644
--- a/arch/arm/mach-omap2/clock3xxx.h
+++ b/arch/arm/mach-omap2/clock3xxx.h
@@ -9,11 +9,8 @@
9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H
10 10
11int omap3xxx_clk_init(void); 11int omap3xxx_clk_init(void);
12int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
13 unsigned long parent_rate);
14int omap3_core_dpll_m2_set_rate(struct clk_hw *clk, unsigned long rate, 12int omap3_core_dpll_m2_set_rate(struct clk_hw *clk, unsigned long rate,
15 unsigned long parent_rate); 13 unsigned long parent_rate);
16void omap3_clk_lock_dpll5(void);
17 14
18extern struct clk *sdrc_ick_p; 15extern struct clk *sdrc_ick_p;
19extern struct clk *arm_fck_p; 16extern struct clk *arm_fck_p;
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index 72bb41b3fd25..f338177e6900 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -10,5 +10,6 @@ struct ads7846_platform_data;
10 10
11void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, 11void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
12 struct ads7846_platform_data *board_pdata); 12 struct ads7846_platform_data *board_pdata);
13void *n8x0_legacy_init(void);
13 14
14#endif /* __OMAP_COMMON_BOARD_DEVICES__ */ 15#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index e30ef6797c63..a6aae300542c 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -62,11 +62,17 @@ static inline int omap3_pm_init(void)
62 62
63#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) 63#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4)
64int omap4_pm_init(void); 64int omap4_pm_init(void);
65int omap4_pm_init_early(void);
65#else 66#else
66static inline int omap4_pm_init(void) 67static inline int omap4_pm_init(void)
67{ 68{
68 return 0; 69 return 0;
69} 70}
71
72static inline int omap4_pm_init_early(void)
73{
74 return 0;
75}
70#endif 76#endif
71 77
72#ifdef CONFIG_OMAP_MUX 78#ifdef CONFIG_OMAP_MUX
@@ -236,6 +242,7 @@ static inline void __iomem *omap4_get_scu_base(void)
236 242
237extern void __init gic_init_irq(void); 243extern void __init gic_init_irq(void);
238extern void gic_dist_disable(void); 244extern void gic_dist_disable(void);
245extern void gic_dist_enable(void);
239extern bool gic_dist_disabled(void); 246extern bool gic_dist_disabled(void);
240extern void gic_timer_retrigger(void); 247extern void gic_timer_retrigger(void);
241extern void omap_smc1(u32 fn, u32 arg); 248extern void omap_smc1(u32 fn, u32 arg);
@@ -293,6 +300,7 @@ static inline void omap4_cpu_resume(void)
293#endif 300#endif
294 301
295void pdata_quirks_init(struct of_device_id *); 302void pdata_quirks_init(struct of_device_id *);
303void omap_auxdata_legacy_init(struct device *dev);
296void omap_pcs_legacy_init(int irq, void (*rearm)(void)); 304void omap_pcs_legacy_init(int irq, void (*rearm)(void));
297 305
298struct omap_sdrc_params; 306struct omap_sdrc_params;
@@ -305,7 +313,7 @@ struct omap_hwmod;
305extern int omap_dss_reset(struct omap_hwmod *); 313extern int omap_dss_reset(struct omap_hwmod *);
306 314
307/* SoC specific clock initializer */ 315/* SoC specific clock initializer */
308extern int (*omap_clk_init)(void); 316int omap_clk_init(void);
309 317
310#endif /* __ASSEMBLER__ */ 318#endif /* __ASSEMBLER__ */
311#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 319#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index 4c8982ae9529..4c158c838d40 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -80,6 +80,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
80 int index) 80 int index)
81{ 81{
82 struct idle_statedata *cx = state_ptr + index; 82 struct idle_statedata *cx = state_ptr + index;
83 u32 mpuss_can_lose_context = 0;
83 84
84 /* 85 /*
85 * CPU0 has to wait and stay ON until CPU1 is OFF state. 86 * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -104,6 +105,9 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
104 } 105 }
105 } 106 }
106 107
108 mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) &&
109 (cx->mpu_logic_state == PWRDM_POWER_OFF);
110
107 /* 111 /*
108 * Call idle CPU PM enter notifier chain so that 112 * Call idle CPU PM enter notifier chain so that
109 * VFP and per CPU interrupt context is saved. 113 * VFP and per CPU interrupt context is saved.
@@ -118,9 +122,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
118 * Call idle CPU cluster PM enter notifier chain 122 * Call idle CPU cluster PM enter notifier chain
119 * to save GIC and wakeupgen context. 123 * to save GIC and wakeupgen context.
120 */ 124 */
121 if ((cx->mpu_state == PWRDM_POWER_RET) && 125 if (mpuss_can_lose_context)
122 (cx->mpu_logic_state == PWRDM_POWER_OFF)) 126 cpu_cluster_pm_enter();
123 cpu_cluster_pm_enter();
124 } 127 }
125 128
126 omap4_enter_lowpower(dev->cpu, cx->cpu_state); 129 omap4_enter_lowpower(dev->cpu, cx->cpu_state);
@@ -128,9 +131,23 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
128 131
129 /* Wakeup CPU1 only if it is not offlined */ 132 /* Wakeup CPU1 only if it is not offlined */
130 if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) { 133 if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
134
135 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) &&
136 mpuss_can_lose_context)
137 gic_dist_disable();
138
131 clkdm_wakeup(cpu_clkdm[1]); 139 clkdm_wakeup(cpu_clkdm[1]);
132 omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON); 140 omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON);
133 clkdm_allow_idle(cpu_clkdm[1]); 141 clkdm_allow_idle(cpu_clkdm[1]);
142
143 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) &&
144 mpuss_can_lose_context) {
145 while (gic_dist_disabled()) {
146 udelay(1);
147 cpu_relax();
148 }
149 gic_timer_retrigger();
150 }
134 } 151 }
135 152
136 /* 153 /*
@@ -143,8 +160,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
143 * Call idle CPU cluster PM exit notifier chain 160 * Call idle CPU cluster PM exit notifier chain
144 * to restore GIC and wakeupgen context. 161 * to restore GIC and wakeupgen context.
145 */ 162 */
146 if (dev->cpu == 0 && (cx->mpu_state == PWRDM_POWER_RET) && 163 if (dev->cpu == 0 && mpuss_can_lose_context)
147 (cx->mpu_logic_state == PWRDM_POWER_OFF))
148 cpu_cluster_pm_exit(); 164 cpu_cluster_pm_exit();
149 165
150fail: 166fail:
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 3a0296cfcace..3185ced807c9 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -50,10 +50,10 @@ static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits)
50 50
51 dd = clk->dpll_data; 51 dd = clk->dpll_data;
52 52
53 v = __raw_readl(dd->control_reg); 53 v = omap2_clk_readl(clk, dd->control_reg);
54 v &= ~dd->enable_mask; 54 v &= ~dd->enable_mask;
55 v |= clken_bits << __ffs(dd->enable_mask); 55 v |= clken_bits << __ffs(dd->enable_mask);
56 __raw_writel(v, dd->control_reg); 56 omap2_clk_writel(v, clk, dd->control_reg);
57} 57}
58 58
59/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ 59/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
@@ -69,8 +69,8 @@ static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state)
69 69
70 state <<= __ffs(dd->idlest_mask); 70 state <<= __ffs(dd->idlest_mask);
71 71
72 while (((__raw_readl(dd->idlest_reg) & dd->idlest_mask) != state) && 72 while (((omap2_clk_readl(clk, dd->idlest_reg) & dd->idlest_mask)
73 i < MAX_DPLL_WAIT_TRIES) { 73 != state) && i < MAX_DPLL_WAIT_TRIES) {
74 i++; 74 i++;
75 udelay(1); 75 udelay(1);
76 } 76 }
@@ -147,7 +147,7 @@ static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk)
147 state <<= __ffs(dd->idlest_mask); 147 state <<= __ffs(dd->idlest_mask);
148 148
149 /* Check if already locked */ 149 /* Check if already locked */
150 if ((__raw_readl(dd->idlest_reg) & dd->idlest_mask) == state) 150 if ((omap2_clk_readl(clk, dd->idlest_reg) & dd->idlest_mask) == state)
151 goto done; 151 goto done;
152 152
153 ai = omap3_dpll_autoidle_read(clk); 153 ai = omap3_dpll_autoidle_read(clk);
@@ -311,14 +311,14 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
311 * only since freqsel field is no longer present on other devices. 311 * only since freqsel field is no longer present on other devices.
312 */ 312 */
313 if (cpu_is_omap343x()) { 313 if (cpu_is_omap343x()) {
314 v = __raw_readl(dd->control_reg); 314 v = omap2_clk_readl(clk, dd->control_reg);
315 v &= ~dd->freqsel_mask; 315 v &= ~dd->freqsel_mask;
316 v |= freqsel << __ffs(dd->freqsel_mask); 316 v |= freqsel << __ffs(dd->freqsel_mask);
317 __raw_writel(v, dd->control_reg); 317 omap2_clk_writel(v, clk, dd->control_reg);
318 } 318 }
319 319
320 /* Set DPLL multiplier, divider */ 320 /* Set DPLL multiplier, divider */
321 v = __raw_readl(dd->mult_div1_reg); 321 v = omap2_clk_readl(clk, dd->mult_div1_reg);
322 v &= ~(dd->mult_mask | dd->div1_mask); 322 v &= ~(dd->mult_mask | dd->div1_mask);
323 v |= dd->last_rounded_m << __ffs(dd->mult_mask); 323 v |= dd->last_rounded_m << __ffs(dd->mult_mask);
324 v |= (dd->last_rounded_n - 1) << __ffs(dd->div1_mask); 324 v |= (dd->last_rounded_n - 1) << __ffs(dd->div1_mask);
@@ -336,11 +336,11 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
336 v |= sd_div << __ffs(dd->sddiv_mask); 336 v |= sd_div << __ffs(dd->sddiv_mask);
337 } 337 }
338 338
339 __raw_writel(v, dd->mult_div1_reg); 339 omap2_clk_writel(v, clk, dd->mult_div1_reg);
340 340
341 /* Set 4X multiplier and low-power mode */ 341 /* Set 4X multiplier and low-power mode */
342 if (dd->m4xen_mask || dd->lpmode_mask) { 342 if (dd->m4xen_mask || dd->lpmode_mask) {
343 v = __raw_readl(dd->control_reg); 343 v = omap2_clk_readl(clk, dd->control_reg);
344 344
345 if (dd->m4xen_mask) { 345 if (dd->m4xen_mask) {
346 if (dd->last_rounded_m4xen) 346 if (dd->last_rounded_m4xen)
@@ -356,7 +356,7 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
356 v &= ~dd->lpmode_mask; 356 v &= ~dd->lpmode_mask;
357 } 357 }
358 358
359 __raw_writel(v, dd->control_reg); 359 omap2_clk_writel(v, clk, dd->control_reg);
360 } 360 }
361 361
362 /* We let the clock framework set the other output dividers later */ 362 /* We let the clock framework set the other output dividers later */
@@ -554,7 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk)
554 if (!dd->autoidle_reg) 554 if (!dd->autoidle_reg)
555 return -EINVAL; 555 return -EINVAL;
556 556
557 v = __raw_readl(dd->autoidle_reg); 557 v = omap2_clk_readl(clk, dd->autoidle_reg);
558 v &= dd->autoidle_mask; 558 v &= dd->autoidle_mask;
559 v >>= __ffs(dd->autoidle_mask); 559 v >>= __ffs(dd->autoidle_mask);
560 560
@@ -588,10 +588,10 @@ void omap3_dpll_allow_idle(struct clk_hw_omap *clk)
588 * by writing 0x5 instead of 0x1. Add some mechanism to 588 * by writing 0x5 instead of 0x1. Add some mechanism to
589 * optionally enter this mode. 589 * optionally enter this mode.
590 */ 590 */
591 v = __raw_readl(dd->autoidle_reg); 591 v = omap2_clk_readl(clk, dd->autoidle_reg);
592 v &= ~dd->autoidle_mask; 592 v &= ~dd->autoidle_mask;
593 v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask); 593 v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask);
594 __raw_writel(v, dd->autoidle_reg); 594 omap2_clk_writel(v, clk, dd->autoidle_reg);
595 595
596} 596}
597 597
@@ -614,10 +614,10 @@ void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
614 if (!dd->autoidle_reg) 614 if (!dd->autoidle_reg)
615 return; 615 return;
616 616
617 v = __raw_readl(dd->autoidle_reg); 617 v = omap2_clk_readl(clk, dd->autoidle_reg);
618 v &= ~dd->autoidle_mask; 618 v &= ~dd->autoidle_mask;
619 v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask); 619 v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
620 __raw_writel(v, dd->autoidle_reg); 620 omap2_clk_writel(v, clk, dd->autoidle_reg);
621 621
622} 622}
623 623
@@ -639,6 +639,9 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
639 struct clk_hw_omap *pclk = NULL; 639 struct clk_hw_omap *pclk = NULL;
640 struct clk *parent; 640 struct clk *parent;
641 641
642 if (!parent_rate)
643 return 0;
644
642 /* Walk up the parents of clk, looking for a DPLL */ 645 /* Walk up the parents of clk, looking for a DPLL */
643 do { 646 do {
644 do { 647 do {
@@ -660,7 +663,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
660 663
661 WARN_ON(!dd->enable_mask); 664 WARN_ON(!dd->enable_mask);
662 665
663 v = __raw_readl(dd->control_reg) & dd->enable_mask; 666 v = omap2_clk_readl(pclk, dd->control_reg) & dd->enable_mask;
664 v >>= __ffs(dd->enable_mask); 667 v >>= __ffs(dd->enable_mask);
665 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) 668 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE))
666 rate = parent_rate; 669 rate = parent_rate;
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index d28b0f726715..52f9438b92f2 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -42,7 +42,7 @@ int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk)
42 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : 42 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
43 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; 43 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
44 44
45 v = __raw_readl(clk->clksel_reg); 45 v = omap2_clk_readl(clk, clk->clksel_reg);
46 v &= mask; 46 v &= mask;
47 v >>= __ffs(mask); 47 v >>= __ffs(mask);
48 48
@@ -61,10 +61,10 @@ void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
61 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : 61 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
62 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; 62 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
63 63
64 v = __raw_readl(clk->clksel_reg); 64 v = omap2_clk_readl(clk, clk->clksel_reg);
65 /* Clear the bit to allow gatectrl */ 65 /* Clear the bit to allow gatectrl */
66 v &= ~mask; 66 v &= ~mask;
67 __raw_writel(v, clk->clksel_reg); 67 omap2_clk_writel(v, clk, clk->clksel_reg);
68} 68}
69 69
70void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk) 70void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
@@ -79,10 +79,10 @@ void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
79 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : 79 OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
80 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; 80 OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
81 81
82 v = __raw_readl(clk->clksel_reg); 82 v = omap2_clk_readl(clk, clk->clksel_reg);
83 /* Set the bit to deny gatectrl */ 83 /* Set the bit to deny gatectrl */
84 v |= mask; 84 v |= mask;
85 __raw_writel(v, clk->clksel_reg); 85 omap2_clk_writel(v, clk, clk->clksel_reg);
86} 86}
87 87
88const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = { 88const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = {
@@ -140,7 +140,7 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
140 rate = omap2_get_dpll_rate(clk); 140 rate = omap2_get_dpll_rate(clk);
141 141
142 /* regm4xen adds a multiplier of 4 to DPLL calculations */ 142 /* regm4xen adds a multiplier of 4 to DPLL calculations */
143 v = __raw_readl(dd->control_reg); 143 v = omap2_clk_readl(clk, dd->control_reg);
144 if (v & OMAP4430_DPLL_REGM4XEN_MASK) 144 if (v & OMAP4430_DPLL_REGM4XEN_MASK)
145 rate *= OMAP4430_REGM4XEN_MULT; 145 rate *= OMAP4430_REGM4XEN_MULT;
146 146
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 662c7fd633cc..174caecc3186 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -65,6 +65,22 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
65 return 1; 65 return 1;
66} 66}
67 67
68/* This function will go away once the device-tree convertion is complete */
69static void gpmc_set_legacy(struct omap_nand_platform_data *gpmc_nand_data,
70 struct gpmc_settings *s)
71{
72 /* Enable RD PIN Monitoring Reg */
73 if (gpmc_nand_data->dev_ready) {
74 s->wait_on_read = true;
75 s->wait_on_write = true;
76 }
77
78 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
79 s->device_width = GPMC_DEVWIDTH_16BIT;
80 else
81 s->device_width = GPMC_DEVWIDTH_8BIT;
82}
83
68int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, 84int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
69 struct gpmc_timings *gpmc_t) 85 struct gpmc_timings *gpmc_t)
70{ 86{
@@ -98,32 +114,22 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
98 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 114 dev_err(dev, "Unable to set gpmc timings: %d\n", err);
99 return err; 115 return err;
100 } 116 }
117 }
101 118
102 if (gpmc_nand_data->of_node) { 119 if (gpmc_nand_data->of_node)
103 gpmc_read_settings_dt(gpmc_nand_data->of_node, &s); 120 gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
104 } else { 121 else
105 /* Enable RD PIN Monitoring Reg */ 122 gpmc_set_legacy(gpmc_nand_data, &s);
106 if (gpmc_nand_data->dev_ready) {
107 s.wait_on_read = true;
108 s.wait_on_write = true;
109 }
110 }
111
112 s.device_nand = true;
113 123
114 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) 124 s.device_nand = true;
115 s.device_width = GPMC_DEVWIDTH_16BIT;
116 else
117 s.device_width = GPMC_DEVWIDTH_8BIT;
118 125
119 err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s); 126 err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
120 if (err < 0) 127 if (err < 0)
121 goto out_free_cs; 128 goto out_free_cs;
122 129
123 err = gpmc_configure(GPMC_CONFIG_WP, 0); 130 err = gpmc_configure(GPMC_CONFIG_WP, 0);
124 if (err < 0) 131 if (err < 0)
125 goto out_free_cs; 132 goto out_free_cs;
126 }
127 133
128 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 134 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
129 135
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index cd22262a2cc0..d408b15b4fbf 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -55,10 +55,10 @@
55#include "prm44xx.h" 55#include "prm44xx.h"
56 56
57/* 57/*
58 * omap_clk_init: points to a function that does the SoC-specific 58 * omap_clk_soc_init: points to a function that does the SoC-specific
59 * clock initializations 59 * clock initializations
60 */ 60 */
61int (*omap_clk_init)(void); 61static int (*omap_clk_soc_init)(void);
62 62
63/* 63/*
64 * The machine specific code may provide the extra mapping besides the 64 * The machine specific code may provide the extra mapping besides the
@@ -244,7 +244,7 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
244 .virtual = OMAP4_SRAM_VA, 244 .virtual = OMAP4_SRAM_VA,
245 .pfn = __phys_to_pfn(OMAP4_SRAM_PA), 245 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
246 .length = PAGE_SIZE, 246 .length = PAGE_SIZE,
247 .type = MT_MEMORY_SO, 247 .type = MT_MEMORY_RW_SO,
248 }, 248 },
249#endif 249#endif
250 250
@@ -282,7 +282,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
282 .virtual = OMAP4_SRAM_VA, 282 .virtual = OMAP4_SRAM_VA,
283 .pfn = __phys_to_pfn(OMAP4_SRAM_PA), 283 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
284 .length = PAGE_SIZE, 284 .length = PAGE_SIZE,
285 .type = MT_MEMORY_SO, 285 .type = MT_MEMORY_RW_SO,
286 }, 286 },
287#endif 287#endif
288}; 288};
@@ -419,7 +419,7 @@ void __init omap2420_init_early(void)
419 omap242x_clockdomains_init(); 419 omap242x_clockdomains_init();
420 omap2420_hwmod_init(); 420 omap2420_hwmod_init();
421 omap_hwmod_init_postsetup(); 421 omap_hwmod_init_postsetup();
422 omap_clk_init = omap2420_clk_init; 422 omap_clk_soc_init = omap2420_clk_init;
423} 423}
424 424
425void __init omap2420_init_late(void) 425void __init omap2420_init_late(void)
@@ -448,7 +448,7 @@ void __init omap2430_init_early(void)
448 omap243x_clockdomains_init(); 448 omap243x_clockdomains_init();
449 omap2430_hwmod_init(); 449 omap2430_hwmod_init();
450 omap_hwmod_init_postsetup(); 450 omap_hwmod_init_postsetup();
451 omap_clk_init = omap2430_clk_init; 451 omap_clk_soc_init = omap2430_clk_init;
452} 452}
453 453
454void __init omap2430_init_late(void) 454void __init omap2430_init_late(void)
@@ -482,27 +482,35 @@ void __init omap3_init_early(void)
482 omap3xxx_clockdomains_init(); 482 omap3xxx_clockdomains_init();
483 omap3xxx_hwmod_init(); 483 omap3xxx_hwmod_init();
484 omap_hwmod_init_postsetup(); 484 omap_hwmod_init_postsetup();
485 omap_clk_init = omap3xxx_clk_init; 485 omap_clk_soc_init = omap3xxx_clk_init;
486} 486}
487 487
488void __init omap3430_init_early(void) 488void __init omap3430_init_early(void)
489{ 489{
490 omap3_init_early(); 490 omap3_init_early();
491 if (of_have_populated_dt())
492 omap_clk_soc_init = omap3430_dt_clk_init;
491} 493}
492 494
493void __init omap35xx_init_early(void) 495void __init omap35xx_init_early(void)
494{ 496{
495 omap3_init_early(); 497 omap3_init_early();
498 if (of_have_populated_dt())
499 omap_clk_soc_init = omap3430_dt_clk_init;
496} 500}
497 501
498void __init omap3630_init_early(void) 502void __init omap3630_init_early(void)
499{ 503{
500 omap3_init_early(); 504 omap3_init_early();
505 if (of_have_populated_dt())
506 omap_clk_soc_init = omap3630_dt_clk_init;
501} 507}
502 508
503void __init am35xx_init_early(void) 509void __init am35xx_init_early(void)
504{ 510{
505 omap3_init_early(); 511 omap3_init_early();
512 if (of_have_populated_dt())
513 omap_clk_soc_init = am35xx_dt_clk_init;
506} 514}
507 515
508void __init ti81xx_init_early(void) 516void __init ti81xx_init_early(void)
@@ -520,7 +528,10 @@ void __init ti81xx_init_early(void)
520 omap3xxx_clockdomains_init(); 528 omap3xxx_clockdomains_init();
521 omap3xxx_hwmod_init(); 529 omap3xxx_hwmod_init();
522 omap_hwmod_init_postsetup(); 530 omap_hwmod_init_postsetup();
523 omap_clk_init = omap3xxx_clk_init; 531 if (of_have_populated_dt())
532 omap_clk_soc_init = ti81xx_dt_clk_init;
533 else
534 omap_clk_soc_init = omap3xxx_clk_init;
524} 535}
525 536
526void __init omap3_init_late(void) 537void __init omap3_init_late(void)
@@ -581,7 +592,7 @@ void __init am33xx_init_early(void)
581 am33xx_clockdomains_init(); 592 am33xx_clockdomains_init();
582 am33xx_hwmod_init(); 593 am33xx_hwmod_init();
583 omap_hwmod_init_postsetup(); 594 omap_hwmod_init_postsetup();
584 omap_clk_init = am33xx_clk_init; 595 omap_clk_soc_init = am33xx_dt_clk_init;
585} 596}
586 597
587void __init am33xx_init_late(void) 598void __init am33xx_init_late(void)
@@ -606,6 +617,7 @@ void __init am43xx_init_early(void)
606 am43xx_clockdomains_init(); 617 am43xx_clockdomains_init();
607 am43xx_hwmod_init(); 618 am43xx_hwmod_init();
608 omap_hwmod_init_postsetup(); 619 omap_hwmod_init_postsetup();
620 omap_clk_soc_init = am43xx_dt_clk_init;
609} 621}
610 622
611void __init am43xx_init_late(void) 623void __init am43xx_init_late(void)
@@ -629,13 +641,14 @@ void __init omap4430_init_early(void)
629 omap_cm_base_init(); 641 omap_cm_base_init();
630 omap4xxx_check_revision(); 642 omap4xxx_check_revision();
631 omap4xxx_check_features(); 643 omap4xxx_check_features();
644 omap4_pm_init_early();
632 omap44xx_prm_init(); 645 omap44xx_prm_init();
633 omap44xx_voltagedomains_init(); 646 omap44xx_voltagedomains_init();
634 omap44xx_powerdomains_init(); 647 omap44xx_powerdomains_init();
635 omap44xx_clockdomains_init(); 648 omap44xx_clockdomains_init();
636 omap44xx_hwmod_init(); 649 omap44xx_hwmod_init();
637 omap_hwmod_init_postsetup(); 650 omap_hwmod_init_postsetup();
638 omap_clk_init = omap4xxx_clk_init; 651 omap_clk_soc_init = omap4xxx_dt_clk_init;
639} 652}
640 653
641void __init omap4430_init_late(void) 654void __init omap4430_init_late(void)
@@ -666,6 +679,7 @@ void __init omap5_init_early(void)
666 omap54xx_clockdomains_init(); 679 omap54xx_clockdomains_init();
667 omap54xx_hwmod_init(); 680 omap54xx_hwmod_init();
668 omap_hwmod_init_postsetup(); 681 omap_hwmod_init_postsetup();
682 omap_clk_soc_init = omap5xxx_dt_clk_init;
669} 683}
670 684
671void __init omap5_init_late(void) 685void __init omap5_init_late(void)
@@ -691,6 +705,7 @@ void __init dra7xx_init_early(void)
691 dra7xx_clockdomains_init(); 705 dra7xx_clockdomains_init();
692 dra7xx_hwmod_init(); 706 dra7xx_hwmod_init();
693 omap_hwmod_init_postsetup(); 707 omap_hwmod_init_postsetup();
708 omap_clk_soc_init = dra7xx_dt_clk_init;
694} 709}
695 710
696void __init dra7xx_init_late(void) 711void __init dra7xx_init_late(void)
@@ -710,3 +725,17 @@ void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
710 _omap2_init_reprogram_sdrc(); 725 _omap2_init_reprogram_sdrc();
711 } 726 }
712} 727}
728
729int __init omap_clk_init(void)
730{
731 int ret = 0;
732
733 if (!omap_clk_soc_init)
734 return 0;
735
736 ret = of_prcm_init();
737 if (!ret)
738 ret = omap_clk_soc_init();
739
740 return ret;
741}
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
index c52d8b4a3e91..828e0db3d943 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -88,72 +88,3 @@ int omap_msdi_reset(struct omap_hwmod *oh)
88 88
89 return 0; 89 return 0;
90} 90}
91
92#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
93
94static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
95 *mmc_controller)
96{
97 if ((mmc_controller->slots[0].switch_pin > 0) && \
98 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
99 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
100 OMAP_PIN_INPUT_PULLUP);
101 if ((mmc_controller->slots[0].gpio_wp > 0) && \
102 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
103 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
104 OMAP_PIN_INPUT_PULLUP);
105
106 omap_mux_init_signal("sdmmc_cmd", 0);
107 omap_mux_init_signal("sdmmc_clki", 0);
108 omap_mux_init_signal("sdmmc_clko", 0);
109 omap_mux_init_signal("sdmmc_dat0", 0);
110 omap_mux_init_signal("sdmmc_dat_dir0", 0);
111 omap_mux_init_signal("sdmmc_cmd_dir", 0);
112 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
113 omap_mux_init_signal("sdmmc_dat1", 0);
114 omap_mux_init_signal("sdmmc_dat2", 0);
115 omap_mux_init_signal("sdmmc_dat3", 0);
116 omap_mux_init_signal("sdmmc_dat_dir1", 0);
117 omap_mux_init_signal("sdmmc_dat_dir2", 0);
118 omap_mux_init_signal("sdmmc_dat_dir3", 0);
119 }
120
121 /*
122 * Use internal loop-back in MMC/SDIO Module Input Clock
123 * selection
124 */
125 if (mmc_controller->slots[0].internal_clock) {
126 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
127 v |= (1 << 24);
128 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
129 }
130}
131
132void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
133{
134 struct platform_device *pdev;
135 struct omap_hwmod *oh;
136 int id = 0;
137 char *oh_name = "msdi1";
138 char *dev_name = "mmci-omap";
139
140 if (!mmc_data[0]) {
141 pr_err("%s fails: Incomplete platform data\n", __func__);
142 return;
143 }
144
145 omap242x_mmc_mux(mmc_data[0]);
146
147 oh = omap_hwmod_lookup(oh_name);
148 if (!oh) {
149 pr_err("Could not look up %s\n", oh_name);
150 return;
151 }
152 pdev = omap_device_build(dev_name, id, oh, mmc_data[0],
153 sizeof(struct omap_mmc_platform_data));
154 if (IS_ERR(pdev))
155 WARN(1, "Can'd build omap_device for %s:%s.\n",
156 dev_name, oh->name);
157}
158
159#endif
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 16f78a990d04..a722330d4d53 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -7,8 +7,6 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9 9
10#include "mux2420.h"
11#include "mux2430.h"
12#include "mux34xx.h" 10#include "mux34xx.h"
13 11
14#define OMAP_MUX_TERMINATOR 0xffff 12#define OMAP_MUX_TERMINATOR 0xffff
diff --git a/arch/arm/mach-omap2/mux2420.c b/arch/arm/mach-omap2/mux2420.c
deleted file mode 100644
index cf6de0971c6c..000000000000
--- a/arch/arm/mach-omap2/mux2420.c
+++ /dev/null
@@ -1,690 +0,0 @@
1/*
2 * Copyright (C) 2010 Nokia
3 * Copyright (C) 2010 Texas Instruments
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/module.h>
11#include <linux/init.h>
12
13#include "mux.h"
14
15#ifdef CONFIG_OMAP_MUX
16
17#define _OMAP2420_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
18{ \
19 .reg_offset = (OMAP2420_CONTROL_PADCONF_##M0##_OFFSET), \
20 .gpio = (g), \
21 .muxnames = { m0, m1, m2, m3, m4, m5, m6, m7 }, \
22}
23
24#else
25
26#define _OMAP2420_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
27{ \
28 .reg_offset = (OMAP2420_CONTROL_PADCONF_##M0##_OFFSET), \
29 .gpio = (g), \
30}
31
32#endif
33
34#define _OMAP2420_BALLENTRY(M0, bb, bt) \
35{ \
36 .reg_offset = (OMAP2420_CONTROL_PADCONF_##M0##_OFFSET), \
37 .balls = { bb, bt }, \
38}
39
40/*
41 * Superset of all mux modes for omap2420
42 */
43static struct omap_mux __initdata omap2420_muxmodes[] = {
44 _OMAP2420_MUXENTRY(CAM_D0, 54,
45 "cam_d0", "hw_dbg2", "sti_dout", "gpio_54",
46 NULL, NULL, "etk_d2", NULL),
47 _OMAP2420_MUXENTRY(CAM_D1, 53,
48 "cam_d1", "hw_dbg3", "sti_din", "gpio_53",
49 NULL, NULL, "etk_d3", NULL),
50 _OMAP2420_MUXENTRY(CAM_D2, 52,
51 "cam_d2", "hw_dbg4", "mcbsp1_clkx", "gpio_52",
52 NULL, NULL, "etk_d4", NULL),
53 _OMAP2420_MUXENTRY(CAM_D3, 51,
54 "cam_d3", "hw_dbg5", "mcbsp1_dr", "gpio_51",
55 NULL, NULL, "etk_d5", NULL),
56 _OMAP2420_MUXENTRY(CAM_D4, 50,
57 "cam_d4", "hw_dbg6", "mcbsp1_fsr", "gpio_50",
58 NULL, NULL, "etk_d6", NULL),
59 _OMAP2420_MUXENTRY(CAM_D5, 49,
60 "cam_d5", "hw_dbg7", "mcbsp1_clkr", "gpio_49",
61 NULL, NULL, "etk_d7", NULL),
62 _OMAP2420_MUXENTRY(CAM_D6, 0,
63 "cam_d6", "hw_dbg8", NULL, NULL,
64 NULL, NULL, "etk_d8", NULL),
65 _OMAP2420_MUXENTRY(CAM_D7, 0,
66 "cam_d7", "hw_dbg9", NULL, NULL,
67 NULL, NULL, "etk_d9", NULL),
68 _OMAP2420_MUXENTRY(CAM_D8, 54,
69 "cam_d8", "hw_dbg10", NULL, "gpio_54",
70 NULL, NULL, "etk_d10", NULL),
71 _OMAP2420_MUXENTRY(CAM_D9, 53,
72 "cam_d9", "hw_dbg11", NULL, "gpio_53",
73 NULL, NULL, "etk_d11", NULL),
74 _OMAP2420_MUXENTRY(CAM_HS, 55,
75 "cam_hs", "hw_dbg1", "mcbsp1_dx", "gpio_55",
76 NULL, NULL, "etk_d1", NULL),
77 _OMAP2420_MUXENTRY(CAM_LCLK, 57,
78 "cam_lclk", NULL, "mcbsp_clks", "gpio_57",
79 NULL, NULL, "etk_c1", NULL),
80 _OMAP2420_MUXENTRY(CAM_VS, 56,
81 "cam_vs", "hw_dbg0", "mcbsp1_fsx", "gpio_56",
82 NULL, NULL, "etk_d0", NULL),
83 _OMAP2420_MUXENTRY(CAM_XCLK, 0,
84 "cam_xclk", NULL, "sti_clk", NULL,
85 NULL, NULL, "etk_c2", NULL),
86 _OMAP2420_MUXENTRY(DSS_ACBIAS, 48,
87 "dss_acbias", NULL, "mcbsp2_fsx", "gpio_48",
88 NULL, NULL, NULL, NULL),
89 _OMAP2420_MUXENTRY(DSS_DATA10, 40,
90 "dss_data10", NULL, NULL, "gpio_40",
91 NULL, NULL, NULL, NULL),
92 _OMAP2420_MUXENTRY(DSS_DATA11, 41,
93 "dss_data11", NULL, NULL, "gpio_41",
94 NULL, NULL, NULL, NULL),
95 _OMAP2420_MUXENTRY(DSS_DATA12, 42,
96 "dss_data12", NULL, NULL, "gpio_42",
97 NULL, NULL, NULL, NULL),
98 _OMAP2420_MUXENTRY(DSS_DATA13, 43,
99 "dss_data13", NULL, NULL, "gpio_43",
100 NULL, NULL, NULL, NULL),
101 _OMAP2420_MUXENTRY(DSS_DATA14, 44,
102 "dss_data14", NULL, NULL, "gpio_44",
103 NULL, NULL, NULL, NULL),
104 _OMAP2420_MUXENTRY(DSS_DATA15, 45,
105 "dss_data15", NULL, NULL, "gpio_45",
106 NULL, NULL, NULL, NULL),
107 _OMAP2420_MUXENTRY(DSS_DATA16, 46,
108 "dss_data16", NULL, NULL, "gpio_46",
109 NULL, NULL, NULL, NULL),
110 _OMAP2420_MUXENTRY(DSS_DATA17, 47,
111 "dss_data17", NULL, NULL, "gpio_47",
112 NULL, NULL, NULL, NULL),
113 _OMAP2420_MUXENTRY(DSS_DATA8, 38,
114 "dss_data8", NULL, NULL, "gpio_38",
115 NULL, NULL, NULL, NULL),
116 _OMAP2420_MUXENTRY(DSS_DATA9, 39,
117 "dss_data9", NULL, NULL, "gpio_39",
118 NULL, NULL, NULL, NULL),
119 _OMAP2420_MUXENTRY(EAC_AC_DIN, 115,
120 "eac_ac_din", "mcbsp2_dr", NULL, "gpio_115",
121 NULL, NULL, NULL, NULL),
122 _OMAP2420_MUXENTRY(EAC_AC_DOUT, 116,
123 "eac_ac_dout", "mcbsp2_dx", NULL, "gpio_116",
124 NULL, NULL, NULL, NULL),
125 _OMAP2420_MUXENTRY(EAC_AC_FS, 114,
126 "eac_ac_fs", "mcbsp2_fsx", NULL, "gpio_114",
127 NULL, NULL, NULL, NULL),
128 _OMAP2420_MUXENTRY(EAC_AC_MCLK, 117,
129 "eac_ac_mclk", NULL, NULL, "gpio_117",
130 NULL, NULL, NULL, NULL),
131 _OMAP2420_MUXENTRY(EAC_AC_RST, 118,
132 "eac_ac_rst", "eac_bt_din", NULL, "gpio_118",
133 NULL, NULL, NULL, NULL),
134 _OMAP2420_MUXENTRY(EAC_AC_SCLK, 113,
135 "eac_ac_sclk", "mcbsp2_clkx", NULL, "gpio_113",
136 NULL, NULL, NULL, NULL),
137 _OMAP2420_MUXENTRY(EAC_BT_DIN, 73,
138 "eac_bt_din", NULL, NULL, "gpio_73",
139 NULL, NULL, "etk_d9", NULL),
140 _OMAP2420_MUXENTRY(EAC_BT_DOUT, 74,
141 "eac_bt_dout", NULL, "sti_clk", "gpio_74",
142 NULL, NULL, "etk_d8", NULL),
143 _OMAP2420_MUXENTRY(EAC_BT_FS, 72,
144 "eac_bt_fs", NULL, NULL, "gpio_72",
145 NULL, NULL, "etk_d10", NULL),
146 _OMAP2420_MUXENTRY(EAC_BT_SCLK, 71,
147 "eac_bt_sclk", NULL, NULL, "gpio_71",
148 NULL, NULL, "etk_d11", NULL),
149 _OMAP2420_MUXENTRY(GPIO_119, 119,
150 "gpio_119", NULL, "sti_din", "gpio_119",
151 NULL, "sys_boot0", "etk_d12", NULL),
152 _OMAP2420_MUXENTRY(GPIO_120, 120,
153 "gpio_120", NULL, "sti_dout", "gpio_120",
154 "cam_d9", "sys_boot1", "etk_d13", NULL),
155 _OMAP2420_MUXENTRY(GPIO_121, 121,
156 "gpio_121", NULL, NULL, "gpio_121",
157 "jtag_emu2", "sys_boot2", "etk_d14", NULL),
158 _OMAP2420_MUXENTRY(GPIO_122, 122,
159 "gpio_122", NULL, NULL, "gpio_122",
160 "jtag_emu3", "sys_boot3", "etk_d15", NULL),
161 _OMAP2420_MUXENTRY(GPIO_124, 124,
162 "gpio_124", NULL, NULL, "gpio_124",
163 NULL, "sys_boot5", NULL, NULL),
164 _OMAP2420_MUXENTRY(GPIO_125, 125,
165 "gpio_125", "sys_jtagsel1", "sys_jtagsel2", "gpio_125",
166 NULL, NULL, NULL, NULL),
167 _OMAP2420_MUXENTRY(GPIO_36, 36,
168 "gpio_36", NULL, NULL, "gpio_36",
169 NULL, "sys_boot4", NULL, NULL),
170 _OMAP2420_MUXENTRY(GPIO_62, 62,
171 "gpio_62", "uart1_rx", "usb1_dat", "gpio_62",
172 NULL, NULL, NULL, NULL),
173 _OMAP2420_MUXENTRY(GPIO_6, 6,
174 "gpio_6", "tv_detpulse", NULL, "gpio_6",
175 NULL, NULL, NULL, NULL),
176 _OMAP2420_MUXENTRY(GPMC_A10, 3,
177 "gpmc_a10", NULL, "sys_ndmareq5", "gpio_3",
178 NULL, NULL, NULL, NULL),
179 _OMAP2420_MUXENTRY(GPMC_A1, 12,
180 "gpmc_a1", "dss_data18", NULL, "gpio_12",
181 NULL, NULL, NULL, NULL),
182 _OMAP2420_MUXENTRY(GPMC_A2, 11,
183 "gpmc_a2", "dss_data19", NULL, "gpio_11",
184 NULL, NULL, NULL, NULL),
185 _OMAP2420_MUXENTRY(GPMC_A3, 10,
186 "gpmc_a3", "dss_data20", NULL, "gpio_10",
187 NULL, NULL, NULL, NULL),
188 _OMAP2420_MUXENTRY(GPMC_A4, 9,
189 "gpmc_a4", "dss_data21", NULL, "gpio_9",
190 NULL, NULL, NULL, NULL),
191 _OMAP2420_MUXENTRY(GPMC_A5, 8,
192 "gpmc_a5", "dss_data22", NULL, "gpio_8",
193 NULL, NULL, NULL, NULL),
194 _OMAP2420_MUXENTRY(GPMC_A6, 7,
195 "gpmc_a6", "dss_data23", NULL, "gpio_7",
196 NULL, NULL, NULL, NULL),
197 _OMAP2420_MUXENTRY(GPMC_A7, 6,
198 "gpmc_a7", NULL, "sys_ndmareq2", "gpio_6",
199 NULL, NULL, NULL, NULL),
200 _OMAP2420_MUXENTRY(GPMC_A8, 5,
201 "gpmc_a8", NULL, "sys_ndmareq3", "gpio_5",
202 NULL, NULL, NULL, NULL),
203 _OMAP2420_MUXENTRY(GPMC_A9, 4,
204 "gpmc_a9", NULL, "sys_ndmareq4", "gpio_4",
205 NULL, NULL, NULL, NULL),
206 _OMAP2420_MUXENTRY(GPMC_CLK, 21,
207 "gpmc_clk", NULL, NULL, "gpio_21",
208 NULL, NULL, NULL, NULL),
209 _OMAP2420_MUXENTRY(GPMC_D10, 18,
210 "gpmc_d10", "ssi2_rdy_rx", NULL, "gpio_18",
211 NULL, NULL, NULL, NULL),
212 _OMAP2420_MUXENTRY(GPMC_D11, 17,
213 "gpmc_d11", "ssi2_flag_rx", NULL, "gpio_17",
214 NULL, NULL, NULL, NULL),
215 _OMAP2420_MUXENTRY(GPMC_D12, 16,
216 "gpmc_d12", "ssi2_dat_rx", NULL, "gpio_16",
217 NULL, NULL, NULL, NULL),
218 _OMAP2420_MUXENTRY(GPMC_D13, 15,
219 "gpmc_d13", "ssi2_rdy_tx", NULL, "gpio_15",
220 NULL, NULL, NULL, NULL),
221 _OMAP2420_MUXENTRY(GPMC_D14, 14,
222 "gpmc_d14", "ssi2_flag_tx", NULL, "gpio_14",
223 NULL, NULL, NULL, NULL),
224 _OMAP2420_MUXENTRY(GPMC_D15, 13,
225 "gpmc_d15", "ssi2_dat_tx", NULL, "gpio_13",
226 NULL, NULL, NULL, NULL),
227 _OMAP2420_MUXENTRY(GPMC_D8, 20,
228 "gpmc_d8", NULL, NULL, "gpio_20",
229 NULL, NULL, NULL, NULL),
230 _OMAP2420_MUXENTRY(GPMC_D9, 19,
231 "gpmc_d9", "ssi2_wake", NULL, "gpio_19",
232 NULL, NULL, NULL, NULL),
233 _OMAP2420_MUXENTRY(GPMC_NBE0, 29,
234 "gpmc_nbe0", NULL, NULL, "gpio_29",
235 NULL, NULL, NULL, NULL),
236 _OMAP2420_MUXENTRY(GPMC_NBE1, 30,
237 "gpmc_nbe1", NULL, NULL, "gpio_30",
238 NULL, NULL, NULL, NULL),
239 _OMAP2420_MUXENTRY(GPMC_NCS1, 22,
240 "gpmc_ncs1", NULL, NULL, "gpio_22",
241 NULL, NULL, NULL, NULL),
242 _OMAP2420_MUXENTRY(GPMC_NCS2, 23,
243 "gpmc_ncs2", NULL, NULL, "gpio_23",
244 NULL, NULL, NULL, NULL),
245 _OMAP2420_MUXENTRY(GPMC_NCS3, 24,
246 "gpmc_ncs3", "gpmc_io_dir", NULL, "gpio_24",
247 NULL, NULL, NULL, NULL),
248 _OMAP2420_MUXENTRY(GPMC_NCS4, 25,
249 "gpmc_ncs4", NULL, NULL, "gpio_25",
250 NULL, NULL, NULL, NULL),
251 _OMAP2420_MUXENTRY(GPMC_NCS5, 26,
252 "gpmc_ncs5", NULL, NULL, "gpio_26",
253 NULL, NULL, NULL, NULL),
254 _OMAP2420_MUXENTRY(GPMC_NCS6, 27,
255 "gpmc_ncs6", NULL, NULL, "gpio_27",
256 NULL, NULL, NULL, NULL),
257 _OMAP2420_MUXENTRY(GPMC_NCS7, 28,
258 "gpmc_ncs7", "gpmc_io_dir", "gpio_28", NULL,
259 NULL, NULL, NULL, NULL),
260 _OMAP2420_MUXENTRY(GPMC_NWP, 31,
261 "gpmc_nwp", NULL, NULL, "gpio_31",
262 NULL, NULL, NULL, NULL),
263 _OMAP2420_MUXENTRY(GPMC_WAIT1, 33,
264 "gpmc_wait1", NULL, NULL, "gpio_33",
265 NULL, NULL, NULL, NULL),
266 _OMAP2420_MUXENTRY(GPMC_WAIT2, 34,
267 "gpmc_wait2", NULL, NULL, "gpio_34",
268 NULL, NULL, NULL, NULL),
269 _OMAP2420_MUXENTRY(GPMC_WAIT3, 35,
270 "gpmc_wait3", NULL, NULL, "gpio_35",
271 NULL, NULL, NULL, NULL),
272 _OMAP2420_MUXENTRY(HDQ_SIO, 101,
273 "hdq_sio", "usb2_tllse0", "sys_altclk", "gpio_101",
274 NULL, NULL, NULL, NULL),
275 _OMAP2420_MUXENTRY(I2C2_SCL, 99,
276 "i2c2_scl", NULL, "gpt9_pwm_evt", "gpio_99",
277 NULL, NULL, NULL, NULL),
278 _OMAP2420_MUXENTRY(I2C2_SDA, 100,
279 "i2c2_sda", NULL, "spi2_ncs1", "gpio_100",
280 NULL, NULL, NULL, NULL),
281 _OMAP2420_MUXENTRY(JTAG_EMU0, 127,
282 "jtag_emu0", NULL, NULL, "gpio_127",
283 NULL, NULL, NULL, NULL),
284 _OMAP2420_MUXENTRY(JTAG_EMU1, 126,
285 "jtag_emu1", NULL, NULL, "gpio_126",
286 NULL, NULL, NULL, NULL),
287 _OMAP2420_MUXENTRY(MCBSP1_CLKR, 92,
288 "mcbsp1_clkr", "ssi2_dat_tx", "vlynq_tx1", "gpio_92",
289 NULL, NULL, NULL, NULL),
290 _OMAP2420_MUXENTRY(MCBSP1_CLKX, 98,
291 "mcbsp1_clkx", "ssi2_wake", "vlynq_nla", "gpio_98",
292 NULL, NULL, NULL, NULL),
293 _OMAP2420_MUXENTRY(MCBSP1_DR, 95,
294 "mcbsp1_dr", "ssi2_dat_rx", "vlynq_rx1", "gpio_95",
295 NULL, NULL, NULL, NULL),
296 _OMAP2420_MUXENTRY(MCBSP1_DX, 94,
297 "mcbsp1_dx", "ssi2_rdy_tx", "vlynq_clk", "gpio_94",
298 NULL, NULL, NULL, NULL),
299 _OMAP2420_MUXENTRY(MCBSP1_FSR, 93,
300 "mcbsp1_fsr", "ssi2_flag_tx", "vlynq_tx0", "gpio_93",
301 "spi2_ncs1", NULL, NULL, NULL),
302 _OMAP2420_MUXENTRY(MCBSP1_FSX, 97,
303 "mcbsp1_fsx", "ssi2_rdy_rx", NULL, "gpio_97",
304 NULL, NULL, NULL, NULL),
305 _OMAP2420_MUXENTRY(MCBSP2_CLKX, 12,
306 "mcbsp2_clkx", NULL, "dss_data23", "gpio_12",
307 NULL, NULL, NULL, NULL),
308 _OMAP2420_MUXENTRY(MCBSP2_DR, 11,
309 "mcbsp2_dr", NULL, "dss_data22", "gpio_11",
310 NULL, NULL, NULL, NULL),
311 _OMAP2420_MUXENTRY(MCBSP_CLKS, 96,
312 "mcbsp_clks", "ssi2_flag_rx", "vlynq_rx0", "gpio_96",
313 NULL, NULL, NULL, NULL),
314 _OMAP2420_MUXENTRY(MMC_CLKI, 59,
315 "sdmmc_clki", "ms_clki", NULL, "gpio_59",
316 NULL, NULL, NULL, NULL),
317 _OMAP2420_MUXENTRY(MMC_CLKO, 0,
318 "sdmmc_clko", "ms_clko", NULL, NULL,
319 NULL, NULL, NULL, NULL),
320 _OMAP2420_MUXENTRY(MMC_CMD_DIR, 8,
321 "sdmmc_cmd_dir", NULL, NULL, "gpio_8",
322 NULL, NULL, NULL, NULL),
323 _OMAP2420_MUXENTRY(MMC_CMD, 0,
324 "sdmmc_cmd", "ms_bs", NULL, NULL,
325 NULL, NULL, NULL, NULL),
326 _OMAP2420_MUXENTRY(MMC_DAT_DIR0, 7,
327 "sdmmc_dat_dir0", "ms_dat0_dir", NULL, "gpio_7",
328 NULL, NULL, NULL, NULL),
329 _OMAP2420_MUXENTRY(MMC_DAT0, 0,
330 "sdmmc_dat0", "ms_dat0", NULL, NULL,
331 NULL, NULL, NULL, NULL),
332 _OMAP2420_MUXENTRY(MMC_DAT_DIR1, 78,
333 "sdmmc_dat_dir1", "ms_datu_dir", "uart2_rts", "gpio_78",
334 NULL, NULL, NULL, NULL),
335 _OMAP2420_MUXENTRY(MMC_DAT1, 75,
336 "sdmmc_dat1", "ms_dat1", NULL, "gpio_75",
337 NULL, NULL, NULL, NULL),
338 _OMAP2420_MUXENTRY(MMC_DAT_DIR2, 79,
339 "sdmmc_dat_dir2", "ms_datu_dir", "uart2_tx", "gpio_79",
340 NULL, NULL, NULL, NULL),
341 _OMAP2420_MUXENTRY(MMC_DAT2, 76,
342 "sdmmc_dat2", "ms_dat2", "uart2_cts", "gpio_76",
343 NULL, NULL, NULL, NULL),
344 _OMAP2420_MUXENTRY(MMC_DAT_DIR3, 80,
345 "sdmmc_dat_dir3", "ms_datu_dir", "uart2_rx", "gpio_80",
346 NULL, NULL, NULL, NULL),
347 _OMAP2420_MUXENTRY(MMC_DAT3, 77,
348 "sdmmc_dat3", "ms_dat3", NULL, "gpio_77",
349 NULL, NULL, NULL, NULL),
350 _OMAP2420_MUXENTRY(SDRC_A12, 2,
351 "sdrc_a12", NULL, NULL, "gpio_2",
352 NULL, NULL, NULL, NULL),
353 _OMAP2420_MUXENTRY(SDRC_A13, 1,
354 "sdrc_a13", NULL, NULL, "gpio_1",
355 NULL, NULL, NULL, NULL),
356 _OMAP2420_MUXENTRY(SDRC_A14, 0,
357 "sdrc_a14", NULL, NULL, "gpio_0",
358 NULL, NULL, NULL, NULL),
359 _OMAP2420_MUXENTRY(SDRC_CKE1, 38,
360 "sdrc_cke1", NULL, NULL, "gpio_38",
361 NULL, NULL, NULL, NULL),
362 _OMAP2420_MUXENTRY(SDRC_NCS1, 37,
363 "sdrc_ncs1", NULL, NULL, "gpio_37",
364 NULL, NULL, NULL, NULL),
365 _OMAP2420_MUXENTRY(SPI1_CLK, 81,
366 "spi1_clk", NULL, NULL, "gpio_81",
367 NULL, NULL, NULL, NULL),
368 _OMAP2420_MUXENTRY(SPI1_NCS0, 84,
369 "spi1_ncs0", NULL, NULL, "gpio_84",
370 NULL, NULL, NULL, NULL),
371 _OMAP2420_MUXENTRY(SPI1_NCS1, 85,
372 "spi1_ncs1", NULL, NULL, "gpio_85",
373 NULL, NULL, NULL, NULL),
374 _OMAP2420_MUXENTRY(SPI1_NCS2, 86,
375 "spi1_ncs2", NULL, NULL, "gpio_86",
376 NULL, NULL, NULL, NULL),
377 _OMAP2420_MUXENTRY(SPI1_NCS3, 87,
378 "spi1_ncs3", NULL, NULL, "gpio_87",
379 NULL, NULL, NULL, NULL),
380 _OMAP2420_MUXENTRY(SPI1_SIMO, 82,
381 "spi1_simo", NULL, NULL, "gpio_82",
382 NULL, NULL, NULL, NULL),
383 _OMAP2420_MUXENTRY(SPI1_SOMI, 83,
384 "spi1_somi", NULL, NULL, "gpio_83",
385 NULL, NULL, NULL, NULL),
386 _OMAP2420_MUXENTRY(SPI2_CLK, 88,
387 "spi2_clk", NULL, NULL, "gpio_88",
388 NULL, NULL, NULL, NULL),
389 _OMAP2420_MUXENTRY(SPI2_NCS0, 91,
390 "spi2_ncs0", "gpt12_pwm_evt", NULL, "gpio_91",
391 NULL, NULL, NULL, NULL),
392 _OMAP2420_MUXENTRY(SPI2_SIMO, 89,
393 "spi2_simo", "gpt10_pwm_evt", NULL, "gpio_89",
394 NULL, NULL, NULL, NULL),
395 _OMAP2420_MUXENTRY(SPI2_SOMI, 90,
396 "spi2_somi", "gpt11_pwm_evt", NULL, "gpio_90",
397 NULL, NULL, NULL, NULL),
398 _OMAP2420_MUXENTRY(SSI1_DAT_RX, 63,
399 "ssi1_dat_rx", "eac_md_sclk", NULL, "gpio_63",
400 NULL, NULL, NULL, NULL),
401 _OMAP2420_MUXENTRY(SSI1_DAT_TX, 59,
402 "ssi1_dat_tx", "uart1_tx", "usb1_se0", "gpio_59",
403 NULL, NULL, NULL, NULL),
404 _OMAP2420_MUXENTRY(SSI1_FLAG_RX, 64,
405 "ssi1_flag_rx", "eac_md_din", NULL, "gpio_64",
406 NULL, NULL, NULL, NULL),
407 _OMAP2420_MUXENTRY(SSI1_FLAG_TX, 25,
408 "ssi1_flag_tx", "uart1_rts", "usb1_rcv", "gpio_25",
409 NULL, NULL, NULL, NULL),
410 _OMAP2420_MUXENTRY(SSI1_RDY_RX, 65,
411 "ssi1_rdy_rx", "eac_md_dout", NULL, "gpio_65",
412 NULL, NULL, NULL, NULL),
413 _OMAP2420_MUXENTRY(SSI1_RDY_TX, 61,
414 "ssi1_rdy_tx", "uart1_cts", "usb1_txen", "gpio_61",
415 NULL, NULL, NULL, NULL),
416 _OMAP2420_MUXENTRY(SSI1_WAKE, 66,
417 "ssi1_wake", "eac_md_fs", NULL, "gpio_66",
418 NULL, NULL, NULL, NULL),
419 _OMAP2420_MUXENTRY(SYS_CLKOUT, 123,
420 "sys_clkout", NULL, NULL, "gpio_123",
421 NULL, NULL, NULL, NULL),
422 _OMAP2420_MUXENTRY(SYS_CLKREQ, 52,
423 "sys_clkreq", NULL, NULL, "gpio_52",
424 NULL, NULL, NULL, NULL),
425 _OMAP2420_MUXENTRY(SYS_NIRQ, 60,
426 "sys_nirq", NULL, NULL, "gpio_60",
427 NULL, NULL, NULL, NULL),
428 _OMAP2420_MUXENTRY(UART1_CTS, 32,
429 "uart1_cts", NULL, "dss_data18", "gpio_32",
430 NULL, NULL, NULL, NULL),
431 _OMAP2420_MUXENTRY(UART1_RTS, 8,
432 "uart1_rts", NULL, "dss_data19", "gpio_8",
433 NULL, NULL, NULL, NULL),
434 _OMAP2420_MUXENTRY(UART1_RX, 10,
435 "uart1_rx", NULL, "dss_data21", "gpio_10",
436 NULL, NULL, NULL, NULL),
437 _OMAP2420_MUXENTRY(UART1_TX, 9,
438 "uart1_tx", NULL, "dss_data20", "gpio_9",
439 NULL, NULL, NULL, NULL),
440 _OMAP2420_MUXENTRY(UART2_CTS, 67,
441 "uart2_cts", "usb1_rcv", "gpt9_pwm_evt", "gpio_67",
442 NULL, NULL, NULL, NULL),
443 _OMAP2420_MUXENTRY(UART2_RTS, 68,
444 "uart2_rts", "usb1_txen", "gpt10_pwm_evt", "gpio_68",
445 NULL, NULL, NULL, NULL),
446 _OMAP2420_MUXENTRY(UART2_RX, 70,
447 "uart2_rx", "usb1_dat", "gpt12_pwm_evt", "gpio_70",
448 NULL, NULL, NULL, NULL),
449 _OMAP2420_MUXENTRY(UART2_TX, 69,
450 "uart2_tx", "usb1_se0", "gpt11_pwm_evt", "gpio_69",
451 NULL, NULL, NULL, NULL),
452 _OMAP2420_MUXENTRY(UART3_CTS_RCTX, 102,
453 "uart3_cts_rctx", "uart3_rx_irrx", NULL, "gpio_102",
454 NULL, NULL, NULL, NULL),
455 _OMAP2420_MUXENTRY(UART3_RTS_SD, 103,
456 "uart3_rts_sd", "uart3_tx_irtx", NULL, "gpio_103",
457 NULL, NULL, NULL, NULL),
458 _OMAP2420_MUXENTRY(UART3_RX_IRRX, 105,
459 "uart3_rx_irrx", NULL, NULL, "gpio_105",
460 NULL, NULL, NULL, NULL),
461 _OMAP2420_MUXENTRY(UART3_TX_IRTX, 104,
462 "uart3_tx_irtx", "uart3_cts_rctx", NULL, "gpio_104",
463 NULL, NULL, NULL, NULL),
464 _OMAP2420_MUXENTRY(USB0_DAT, 112,
465 "usb0_dat", "uart3_rx_irrx", "uart2_rx", "gpio_112",
466 "uart2_tx", NULL, NULL, NULL),
467 _OMAP2420_MUXENTRY(USB0_PUEN, 106,
468 "usb0_puen", "mcbsp2_dx", NULL, "gpio_106",
469 NULL, NULL, NULL, NULL),
470 _OMAP2420_MUXENTRY(USB0_RCV, 109,
471 "usb0_rcv", "mcbsp2_fsx", NULL, "gpio_109",
472 "uart2_cts", NULL, NULL, NULL),
473 _OMAP2420_MUXENTRY(USB0_SE0, 111,
474 "usb0_se0", "uart3_tx_irtx", "uart2_tx", "gpio_111",
475 "uart2_rx", NULL, NULL, NULL),
476 _OMAP2420_MUXENTRY(USB0_TXEN, 110,
477 "usb0_txen", "uart3_cts_rctx", "uart2_cts", "gpio_110",
478 NULL, NULL, NULL, NULL),
479 _OMAP2420_MUXENTRY(USB0_VM, 108,
480 "usb0_vm", "mcbsp2_clkx", NULL, "gpio_108",
481 "uart2_rx", NULL, NULL, NULL),
482 _OMAP2420_MUXENTRY(USB0_VP, 107,
483 "usb0_vp", "mcbsp2_dr", NULL, "gpio_107",
484 NULL, NULL, NULL, NULL),
485 _OMAP2420_MUXENTRY(VLYNQ_CLK, 13,
486 "vlynq_clk", "usb2_se0", "sys_ndmareq0", "gpio_13",
487 NULL, NULL, NULL, NULL),
488 _OMAP2420_MUXENTRY(VLYNQ_NLA, 58,
489 "vlynq_nla", NULL, NULL, "gpio_58",
490 "cam_d6", NULL, NULL, NULL),
491 _OMAP2420_MUXENTRY(VLYNQ_RX0, 15,
492 "vlynq_rx0", "usb2_tllse0", NULL, "gpio_15",
493 "cam_d7", NULL, NULL, NULL),
494 _OMAP2420_MUXENTRY(VLYNQ_RX1, 14,
495 "vlynq_rx1", "usb2_rcv", "sys_ndmareq1", "gpio_14",
496 "cam_d8", NULL, NULL, NULL),
497 _OMAP2420_MUXENTRY(VLYNQ_TX0, 17,
498 "vlynq_tx0", "usb2_txen", NULL, "gpio_17",
499 NULL, NULL, NULL, NULL),
500 _OMAP2420_MUXENTRY(VLYNQ_TX1, 16,
501 "vlynq_tx1", "usb2_dat", "sys_clkout2", "gpio_16",
502 NULL, NULL, NULL, NULL),
503 { .reg_offset = OMAP_MUX_TERMINATOR },
504};
505
506/*
507 * Balls for 447-pin POP package
508 */
509#ifdef CONFIG_DEBUG_FS
510static struct omap_ball __initdata omap2420_pop_ball[] = {
511 _OMAP2420_BALLENTRY(CAM_D0, "y4", NULL),
512 _OMAP2420_BALLENTRY(CAM_D1, "y3", NULL),
513 _OMAP2420_BALLENTRY(CAM_D2, "u7", NULL),
514 _OMAP2420_BALLENTRY(CAM_D3, "ab3", NULL),
515 _OMAP2420_BALLENTRY(CAM_D4, "v2", NULL),
516 _OMAP2420_BALLENTRY(CAM_D5, "ad3", NULL),
517 _OMAP2420_BALLENTRY(CAM_D6, "aa4", NULL),
518 _OMAP2420_BALLENTRY(CAM_D7, "ab4", NULL),
519 _OMAP2420_BALLENTRY(CAM_D8, "ac6", NULL),
520 _OMAP2420_BALLENTRY(CAM_D9, "ac7", NULL),
521 _OMAP2420_BALLENTRY(CAM_HS, "v4", NULL),
522 _OMAP2420_BALLENTRY(CAM_LCLK, "ad6", NULL),
523 _OMAP2420_BALLENTRY(CAM_VS, "p7", NULL),
524 _OMAP2420_BALLENTRY(CAM_XCLK, "w4", NULL),
525 _OMAP2420_BALLENTRY(DSS_ACBIAS, "ae8", NULL),
526 _OMAP2420_BALLENTRY(DSS_DATA10, "ac12", NULL),
527 _OMAP2420_BALLENTRY(DSS_DATA11, "ae11", NULL),
528 _OMAP2420_BALLENTRY(DSS_DATA12, "ae13", NULL),
529 _OMAP2420_BALLENTRY(DSS_DATA13, "ad13", NULL),
530 _OMAP2420_BALLENTRY(DSS_DATA14, "ac13", NULL),
531 _OMAP2420_BALLENTRY(DSS_DATA15, "y12", NULL),
532 _OMAP2420_BALLENTRY(DSS_DATA16, "ad14", NULL),
533 _OMAP2420_BALLENTRY(DSS_DATA17, "y13", NULL),
534 _OMAP2420_BALLENTRY(DSS_DATA8, "ad11", NULL),
535 _OMAP2420_BALLENTRY(DSS_DATA9, "ad12", NULL),
536 _OMAP2420_BALLENTRY(EAC_AC_DIN, "ad19", NULL),
537 _OMAP2420_BALLENTRY(EAC_AC_DOUT, "af22", NULL),
538 _OMAP2420_BALLENTRY(EAC_AC_FS, "ad16", NULL),
539 _OMAP2420_BALLENTRY(EAC_AC_MCLK, "y17", NULL),
540 _OMAP2420_BALLENTRY(EAC_AC_RST, "ae22", NULL),
541 _OMAP2420_BALLENTRY(EAC_AC_SCLK, "ac18", NULL),
542 _OMAP2420_BALLENTRY(EAC_BT_DIN, "u8", NULL),
543 _OMAP2420_BALLENTRY(EAC_BT_DOUT, "ad5", NULL),
544 _OMAP2420_BALLENTRY(EAC_BT_FS, "w7", NULL),
545 _OMAP2420_BALLENTRY(EAC_BT_SCLK, "ad4", NULL),
546 _OMAP2420_BALLENTRY(GPIO_119, "af6", NULL),
547 _OMAP2420_BALLENTRY(GPIO_120, "af4", NULL),
548 _OMAP2420_BALLENTRY(GPIO_121, "ae6", NULL),
549 _OMAP2420_BALLENTRY(GPIO_122, "w3", NULL),
550 _OMAP2420_BALLENTRY(GPIO_124, "y19", NULL),
551 _OMAP2420_BALLENTRY(GPIO_125, "ae24", NULL),
552 _OMAP2420_BALLENTRY(GPIO_36, "y18", NULL),
553 _OMAP2420_BALLENTRY(GPIO_6, "d6", NULL),
554 _OMAP2420_BALLENTRY(GPIO_62, "ad18", NULL),
555 _OMAP2420_BALLENTRY(GPMC_A1, "m8", NULL),
556 _OMAP2420_BALLENTRY(GPMC_A10, "d5", NULL),
557 _OMAP2420_BALLENTRY(GPMC_A2, "w9", NULL),
558 _OMAP2420_BALLENTRY(GPMC_A3, "af10", NULL),
559 _OMAP2420_BALLENTRY(GPMC_A4, "w8", NULL),
560 _OMAP2420_BALLENTRY(GPMC_A5, "ae16", NULL),
561 _OMAP2420_BALLENTRY(GPMC_A6, "af9", NULL),
562 _OMAP2420_BALLENTRY(GPMC_A7, "e4", NULL),
563 _OMAP2420_BALLENTRY(GPMC_A8, "j7", NULL),
564 _OMAP2420_BALLENTRY(GPMC_A9, "ae18", NULL),
565 _OMAP2420_BALLENTRY(GPMC_CLK, "p1", "l1"),
566 _OMAP2420_BALLENTRY(GPMC_D10, "t1", "n1"),
567 _OMAP2420_BALLENTRY(GPMC_D11, "u2", "p2"),
568 _OMAP2420_BALLENTRY(GPMC_D12, "u1", "p1"),
569 _OMAP2420_BALLENTRY(GPMC_D13, "p2", "m1"),
570 _OMAP2420_BALLENTRY(GPMC_D14, "h2", "j2"),
571 _OMAP2420_BALLENTRY(GPMC_D15, "h1", "k2"),
572 _OMAP2420_BALLENTRY(GPMC_D8, "v1", "r1"),
573 _OMAP2420_BALLENTRY(GPMC_D9, "y1", "t1"),
574 _OMAP2420_BALLENTRY(GPMC_NBE0, "af12", "aa10"),
575 _OMAP2420_BALLENTRY(GPMC_NBE1, "u3", NULL),
576 _OMAP2420_BALLENTRY(GPMC_NCS1, "af14", "w1"),
577 _OMAP2420_BALLENTRY(GPMC_NCS2, "g4", NULL),
578 _OMAP2420_BALLENTRY(GPMC_NCS3, "t8", NULL),
579 _OMAP2420_BALLENTRY(GPMC_NCS4, "h8", NULL),
580 _OMAP2420_BALLENTRY(GPMC_NCS5, "k3", NULL),
581 _OMAP2420_BALLENTRY(GPMC_NCS6, "m7", NULL),
582 _OMAP2420_BALLENTRY(GPMC_NCS7, "p3", NULL),
583 _OMAP2420_BALLENTRY(GPMC_NWP, "ae15", "y5"),
584 _OMAP2420_BALLENTRY(GPMC_WAIT1, "ae20", "y8"),
585 _OMAP2420_BALLENTRY(GPMC_WAIT2, "n2", NULL),
586 _OMAP2420_BALLENTRY(GPMC_WAIT3, "t4", NULL),
587 _OMAP2420_BALLENTRY(HDQ_SIO, "t23", NULL),
588 _OMAP2420_BALLENTRY(I2C2_SCL, "l2", NULL),
589 _OMAP2420_BALLENTRY(I2C2_SDA, "k19", NULL),
590 _OMAP2420_BALLENTRY(JTAG_EMU0, "n24", NULL),
591 _OMAP2420_BALLENTRY(JTAG_EMU1, "ac22", NULL),
592 _OMAP2420_BALLENTRY(MCBSP1_CLKR, "y24", NULL),
593 _OMAP2420_BALLENTRY(MCBSP1_CLKX, "t19", NULL),
594 _OMAP2420_BALLENTRY(MCBSP1_DR, "u23", NULL),
595 _OMAP2420_BALLENTRY(MCBSP1_DX, "r24", NULL),
596 _OMAP2420_BALLENTRY(MCBSP1_FSR, "r20", NULL),
597 _OMAP2420_BALLENTRY(MCBSP1_FSX, "r23", NULL),
598 _OMAP2420_BALLENTRY(MCBSP2_CLKX, "t24", NULL),
599 _OMAP2420_BALLENTRY(MCBSP2_DR, "p20", NULL),
600 _OMAP2420_BALLENTRY(MCBSP_CLKS, "p23", NULL),
601 _OMAP2420_BALLENTRY(MMC_CLKI, "c23", NULL),
602 _OMAP2420_BALLENTRY(MMC_CLKO, "h23", NULL),
603 _OMAP2420_BALLENTRY(MMC_CMD, "j23", NULL),
604 _OMAP2420_BALLENTRY(MMC_CMD_DIR, "j24", NULL),
605 _OMAP2420_BALLENTRY(MMC_DAT0, "h17", NULL),
606 _OMAP2420_BALLENTRY(MMC_DAT_DIR0, "f23", NULL),
607 _OMAP2420_BALLENTRY(MMC_DAT1, "g19", NULL),
608 _OMAP2420_BALLENTRY(MMC_DAT_DIR1, "d23", NULL),
609 _OMAP2420_BALLENTRY(MMC_DAT2, "h20", NULL),
610 _OMAP2420_BALLENTRY(MMC_DAT_DIR2, "g23", NULL),
611 _OMAP2420_BALLENTRY(MMC_DAT3, "d24", NULL),
612 _OMAP2420_BALLENTRY(MMC_DAT_DIR3, "e23", NULL),
613 _OMAP2420_BALLENTRY(SDRC_A12, "w26", "r21"),
614 _OMAP2420_BALLENTRY(SDRC_A13, "w25", "aa15"),
615 _OMAP2420_BALLENTRY(SDRC_A14, "aa26", "y12"),
616 _OMAP2420_BALLENTRY(SDRC_CKE1, "ae25", "y13"),
617 _OMAP2420_BALLENTRY(SDRC_NCS1, "y25", "t20"),
618 _OMAP2420_BALLENTRY(SPI1_CLK, "y23", NULL),
619 _OMAP2420_BALLENTRY(SPI1_NCS0, "w24", NULL),
620 _OMAP2420_BALLENTRY(SPI1_NCS1, "w23", NULL),
621 _OMAP2420_BALLENTRY(SPI1_NCS2, "v23", NULL),
622 _OMAP2420_BALLENTRY(SPI1_NCS3, "u20", NULL),
623 _OMAP2420_BALLENTRY(SPI1_SIMO, "h10", NULL),
624 _OMAP2420_BALLENTRY(SPI1_SOMI, "v19", NULL),
625 _OMAP2420_BALLENTRY(SPI2_CLK, "v24", NULL),
626 _OMAP2420_BALLENTRY(SPI2_NCS0, "aa24", NULL),
627 _OMAP2420_BALLENTRY(SPI2_SIMO, "u24", NULL),
628 _OMAP2420_BALLENTRY(SPI2_SOMI, "v25", NULL),
629 _OMAP2420_BALLENTRY(SSI1_DAT_RX, "w15", NULL),
630 _OMAP2420_BALLENTRY(SSI1_DAT_TX, "w13", NULL),
631 _OMAP2420_BALLENTRY(SSI1_FLAG_RX, "af11", NULL),
632 _OMAP2420_BALLENTRY(SSI1_FLAG_TX, "ac15", NULL),
633 _OMAP2420_BALLENTRY(SSI1_RDY_RX, "ac16", NULL),
634 _OMAP2420_BALLENTRY(SSI1_RDY_TX, "af15", NULL),
635 _OMAP2420_BALLENTRY(SSI1_WAKE, "ad15", NULL),
636 _OMAP2420_BALLENTRY(SYS_CLKOUT, "ae19", NULL),
637 _OMAP2420_BALLENTRY(SYS_CLKREQ, "ad20", NULL),
638 _OMAP2420_BALLENTRY(SYS_NIRQ, "y20", NULL),
639 _OMAP2420_BALLENTRY(UART1_CTS, "g20", NULL),
640 _OMAP2420_BALLENTRY(UART1_RTS, "k20", NULL),
641 _OMAP2420_BALLENTRY(UART1_RX, "t20", NULL),
642 _OMAP2420_BALLENTRY(UART1_TX, "h12", NULL),
643 _OMAP2420_BALLENTRY(UART2_CTS, "ac24", NULL),
644 _OMAP2420_BALLENTRY(UART2_RTS, "w20", NULL),
645 _OMAP2420_BALLENTRY(UART2_RX, "ad24", NULL),
646 _OMAP2420_BALLENTRY(UART2_TX, "ab24", NULL),
647 _OMAP2420_BALLENTRY(UART3_CTS_RCTX, "k24", NULL),
648 _OMAP2420_BALLENTRY(UART3_RTS_SD, "m20", NULL),
649 _OMAP2420_BALLENTRY(UART3_RX_IRRX, "h24", NULL),
650 _OMAP2420_BALLENTRY(UART3_TX_IRTX, "g24", NULL),
651 _OMAP2420_BALLENTRY(USB0_DAT, "j25", NULL),
652 _OMAP2420_BALLENTRY(USB0_PUEN, "l23", NULL),
653 _OMAP2420_BALLENTRY(USB0_RCV, "k23", NULL),
654 _OMAP2420_BALLENTRY(USB0_SE0, "l24", NULL),
655 _OMAP2420_BALLENTRY(USB0_TXEN, "m24", NULL),
656 _OMAP2420_BALLENTRY(USB0_VM, "n23", NULL),
657 _OMAP2420_BALLENTRY(USB0_VP, "m23", NULL),
658 _OMAP2420_BALLENTRY(VLYNQ_CLK, "w12", NULL),
659 _OMAP2420_BALLENTRY(VLYNQ_NLA, "ae10", NULL),
660 _OMAP2420_BALLENTRY(VLYNQ_RX0, "ad7", NULL),
661 _OMAP2420_BALLENTRY(VLYNQ_RX1, "w10", NULL),
662 _OMAP2420_BALLENTRY(VLYNQ_TX0, "y15", NULL),
663 _OMAP2420_BALLENTRY(VLYNQ_TX1, "w14", NULL),
664 { .reg_offset = OMAP_MUX_TERMINATOR },
665};
666#else
667#define omap2420_pop_ball NULL
668#endif
669
670int __init omap2420_mux_init(struct omap_board_mux *board_subset, int flags)
671{
672 struct omap_ball *package_balls = NULL;
673
674 switch (flags & OMAP_PACKAGE_MASK) {
675 case OMAP_PACKAGE_ZAC:
676 package_balls = omap2420_pop_ball;
677 break;
678 case OMAP_PACKAGE_ZAF:
679 /* REVISIT: Please add data */
680 default:
681 pr_warning("%s: No ball data available for omap2420 package\n",
682 __func__);
683 }
684
685 return omap_mux_init("core", OMAP_MUX_REG_8BIT | OMAP_MUX_GPIO_IN_MODE3,
686 OMAP2420_CONTROL_PADCONF_MUX_PBASE,
687 OMAP2420_CONTROL_PADCONF_MUX_SIZE,
688 omap2420_muxmodes, NULL, board_subset,
689 package_balls);
690}
diff --git a/arch/arm/mach-omap2/mux2420.h b/arch/arm/mach-omap2/mux2420.h
deleted file mode 100644
index 0f555aa847b5..000000000000
--- a/arch/arm/mach-omap2/mux2420.h
+++ /dev/null
@@ -1,282 +0,0 @@
1/*
2 * Copyright (C) 2009 Nokia
3 * Copyright (C) 2009 Texas Instruments
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 OMAP2420_CONTROL_PADCONF_MUX_PBASE 0x48000030LU
11
12#define OMAP2420_MUX(mode0, mux_value) \
13{ \
14 .reg_offset = (OMAP2420_CONTROL_PADCONF_##mode0##_OFFSET), \
15 .value = (mux_value), \
16}
17
18/*
19 * OMAP2420 CONTROL_PADCONF* register offsets for pin-muxing
20 *
21 * Extracted from the TRM. Add 0x48000030 to these values to get the
22 * absolute addresses. The name in the macro is the mode-0 name of
23 * the pin. NOTE: These registers are 8-bits wide.
24 */
25#define OMAP2420_CONTROL_PADCONF_SDRC_A14_OFFSET 0x000
26#define OMAP2420_CONTROL_PADCONF_SDRC_A13_OFFSET 0x001
27#define OMAP2420_CONTROL_PADCONF_SDRC_A12_OFFSET 0x002
28#define OMAP2420_CONTROL_PADCONF_SDRC_BA1_OFFSET 0x003
29#define OMAP2420_CONTROL_PADCONF_SDRC_BA0_OFFSET 0x004
30#define OMAP2420_CONTROL_PADCONF_SDRC_A11_OFFSET 0x005
31#define OMAP2420_CONTROL_PADCONF_SDRC_A10_OFFSET 0x006
32#define OMAP2420_CONTROL_PADCONF_SDRC_A9_OFFSET 0x007
33#define OMAP2420_CONTROL_PADCONF_SDRC_A8_OFFSET 0x008
34#define OMAP2420_CONTROL_PADCONF_SDRC_A7_OFFSET 0x009
35#define OMAP2420_CONTROL_PADCONF_SDRC_A6_OFFSET 0x00a
36#define OMAP2420_CONTROL_PADCONF_SDRC_A5_OFFSET 0x00b
37#define OMAP2420_CONTROL_PADCONF_SDRC_A4_OFFSET 0x00c
38#define OMAP2420_CONTROL_PADCONF_SDRC_A3_OFFSET 0x00d
39#define OMAP2420_CONTROL_PADCONF_SDRC_A2_OFFSET 0x00e
40#define OMAP2420_CONTROL_PADCONF_SDRC_A1_OFFSET 0x00f
41#define OMAP2420_CONTROL_PADCONF_SDRC_A0_OFFSET 0x010
42#define OMAP2420_CONTROL_PADCONF_SDRC_D31_OFFSET 0x021
43#define OMAP2420_CONTROL_PADCONF_SDRC_D30_OFFSET 0x022
44#define OMAP2420_CONTROL_PADCONF_SDRC_D29_OFFSET 0x023
45#define OMAP2420_CONTROL_PADCONF_SDRC_D28_OFFSET 0x024
46#define OMAP2420_CONTROL_PADCONF_SDRC_D27_OFFSET 0x025
47#define OMAP2420_CONTROL_PADCONF_SDRC_D26_OFFSET 0x026
48#define OMAP2420_CONTROL_PADCONF_SDRC_D25_OFFSET 0x027
49#define OMAP2420_CONTROL_PADCONF_SDRC_D24_OFFSET 0x028
50#define OMAP2420_CONTROL_PADCONF_SDRC_D23_OFFSET 0x029
51#define OMAP2420_CONTROL_PADCONF_SDRC_D22_OFFSET 0x02a
52#define OMAP2420_CONTROL_PADCONF_SDRC_D21_OFFSET 0x02b
53#define OMAP2420_CONTROL_PADCONF_SDRC_D20_OFFSET 0x02c
54#define OMAP2420_CONTROL_PADCONF_SDRC_D19_OFFSET 0x02d
55#define OMAP2420_CONTROL_PADCONF_SDRC_D18_OFFSET 0x02e
56#define OMAP2420_CONTROL_PADCONF_SDRC_D17_OFFSET 0x02f
57#define OMAP2420_CONTROL_PADCONF_SDRC_D16_OFFSET 0x030
58#define OMAP2420_CONTROL_PADCONF_SDRC_D15_OFFSET 0x031
59#define OMAP2420_CONTROL_PADCONF_SDRC_D14_OFFSET 0x032
60#define OMAP2420_CONTROL_PADCONF_SDRC_D13_OFFSET 0x033
61#define OMAP2420_CONTROL_PADCONF_SDRC_D12_OFFSET 0x034
62#define OMAP2420_CONTROL_PADCONF_SDRC_D11_OFFSET 0x035
63#define OMAP2420_CONTROL_PADCONF_SDRC_D10_OFFSET 0x036
64#define OMAP2420_CONTROL_PADCONF_SDRC_D9_OFFSET 0x037
65#define OMAP2420_CONTROL_PADCONF_SDRC_D8_OFFSET 0x038
66#define OMAP2420_CONTROL_PADCONF_SDRC_D7_OFFSET 0x039
67#define OMAP2420_CONTROL_PADCONF_SDRC_D6_OFFSET 0x03a
68#define OMAP2420_CONTROL_PADCONF_SDRC_D5_OFFSET 0x03b
69#define OMAP2420_CONTROL_PADCONF_SDRC_D4_OFFSET 0x03c
70#define OMAP2420_CONTROL_PADCONF_SDRC_D3_OFFSET 0x03d
71#define OMAP2420_CONTROL_PADCONF_SDRC_D2_OFFSET 0x03e
72#define OMAP2420_CONTROL_PADCONF_SDRC_D1_OFFSET 0x03f
73#define OMAP2420_CONTROL_PADCONF_SDRC_D0_OFFSET 0x040
74#define OMAP2420_CONTROL_PADCONF_GPMC_A10_OFFSET 0x041
75#define OMAP2420_CONTROL_PADCONF_GPMC_A9_OFFSET 0x042
76#define OMAP2420_CONTROL_PADCONF_GPMC_A8_OFFSET 0x043
77#define OMAP2420_CONTROL_PADCONF_GPMC_A7_OFFSET 0x044
78#define OMAP2420_CONTROL_PADCONF_GPMC_A6_OFFSET 0x045
79#define OMAP2420_CONTROL_PADCONF_GPMC_A5_OFFSET 0x046
80#define OMAP2420_CONTROL_PADCONF_GPMC_A4_OFFSET 0x047
81#define OMAP2420_CONTROL_PADCONF_GPMC_A3_OFFSET 0x048
82#define OMAP2420_CONTROL_PADCONF_GPMC_A2_OFFSET 0x049
83#define OMAP2420_CONTROL_PADCONF_GPMC_A1_OFFSET 0x04a
84#define OMAP2420_CONTROL_PADCONF_GPMC_D15_OFFSET 0x04b
85#define OMAP2420_CONTROL_PADCONF_GPMC_D14_OFFSET 0x04c
86#define OMAP2420_CONTROL_PADCONF_GPMC_D13_OFFSET 0x04d
87#define OMAP2420_CONTROL_PADCONF_GPMC_D12_OFFSET 0x04e
88#define OMAP2420_CONTROL_PADCONF_GPMC_D11_OFFSET 0x04f
89#define OMAP2420_CONTROL_PADCONF_GPMC_D10_OFFSET 0x050
90#define OMAP2420_CONTROL_PADCONF_GPMC_D9_OFFSET 0x051
91#define OMAP2420_CONTROL_PADCONF_GPMC_D8_OFFSET 0x052
92#define OMAP2420_CONTROL_PADCONF_GPMC_D7_OFFSET 0x053
93#define OMAP2420_CONTROL_PADCONF_GPMC_D6_OFFSET 0x054
94#define OMAP2420_CONTROL_PADCONF_GPMC_D5_OFFSET 0x055
95#define OMAP2420_CONTROL_PADCONF_GPMC_D4_OFFSET 0x056
96#define OMAP2420_CONTROL_PADCONF_GPMC_D3_OFFSET 0x057
97#define OMAP2420_CONTROL_PADCONF_GPMC_D2_OFFSET 0x058
98#define OMAP2420_CONTROL_PADCONF_GPMC_D1_OFFSET 0x059
99#define OMAP2420_CONTROL_PADCONF_GPMC_D0_OFFSET 0x05a
100#define OMAP2420_CONTROL_PADCONF_GPMC_CLK_OFFSET 0x05b
101#define OMAP2420_CONTROL_PADCONF_GPMC_NCS0_OFFSET 0x05c
102#define OMAP2420_CONTROL_PADCONF_GPMC_NCS1_OFFSET 0x05d
103#define OMAP2420_CONTROL_PADCONF_GPMC_NCS2_OFFSET 0x05e
104#define OMAP2420_CONTROL_PADCONF_GPMC_NCS3_OFFSET 0x05f
105#define OMAP2420_CONTROL_PADCONF_GPMC_NCS4_OFFSET 0x060
106#define OMAP2420_CONTROL_PADCONF_GPMC_NCS5_OFFSET 0x061
107#define OMAP2420_CONTROL_PADCONF_GPMC_NCS6_OFFSET 0x062
108#define OMAP2420_CONTROL_PADCONF_GPMC_NCS7_OFFSET 0x063
109#define OMAP2420_CONTROL_PADCONF_GPMC_NALE_ALE_OFFSET 0x064
110#define OMAP2420_CONTROL_PADCONF_GPMC_NOE_OFFSET 0x065
111#define OMAP2420_CONTROL_PADCONF_GPMC_NWE_OFFSET 0x066
112#define OMAP2420_CONTROL_PADCONF_GPMC_NBE0_OFFSET 0x067
113#define OMAP2420_CONTROL_PADCONF_GPMC_NBE1_OFFSET 0x068
114#define OMAP2420_CONTROL_PADCONF_GPMC_NWP_OFFSET 0x069
115#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT0_OFFSET 0x06a
116#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT1_OFFSET 0x06b
117#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT2_OFFSET 0x06c
118#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT3_OFFSET 0x06d
119#define OMAP2420_CONTROL_PADCONF_SDRC_CLK_OFFSET 0x06e
120#define OMAP2420_CONTROL_PADCONF_SDRC_NCLK_OFFSET 0x06f
121#define OMAP2420_CONTROL_PADCONF_SDRC_NCS0_OFFSET 0x070
122#define OMAP2420_CONTROL_PADCONF_SDRC_NCS1_OFFSET 0x071
123#define OMAP2420_CONTROL_PADCONF_SDRC_CKE0_OFFSET 0x072
124#define OMAP2420_CONTROL_PADCONF_SDRC_CKE1_OFFSET 0x073
125#define OMAP2420_CONTROL_PADCONF_SDRC_NRAS_OFFSET 0x074
126#define OMAP2420_CONTROL_PADCONF_SDRC_NCAS_OFFSET 0x075
127#define OMAP2420_CONTROL_PADCONF_SDRC_NWE_OFFSET 0x076
128#define OMAP2420_CONTROL_PADCONF_SDRC_DM0_OFFSET 0x077
129#define OMAP2420_CONTROL_PADCONF_SDRC_DM1_OFFSET 0x078
130#define OMAP2420_CONTROL_PADCONF_SDRC_DM2_OFFSET 0x079
131#define OMAP2420_CONTROL_PADCONF_SDRC_DM3_OFFSET 0x07a
132#define OMAP2420_CONTROL_PADCONF_SDRC_DQS0_OFFSET 0x07f
133#define OMAP2420_CONTROL_PADCONF_SDRC_DQS1_OFFSET 0x080
134#define OMAP2420_CONTROL_PADCONF_SDRC_DQS2_OFFSET 0x081
135#define OMAP2420_CONTROL_PADCONF_SDRC_DQS3_OFFSET 0x082
136#define OMAP2420_CONTROL_PADCONF_DSS_DATA0_OFFSET 0x083
137#define OMAP2420_CONTROL_PADCONF_DSS_DATA1_OFFSET 0x084
138#define OMAP2420_CONTROL_PADCONF_DSS_DATA2_OFFSET 0x085
139#define OMAP2420_CONTROL_PADCONF_DSS_DATA3_OFFSET 0x086
140#define OMAP2420_CONTROL_PADCONF_DSS_DATA4_OFFSET 0x087
141#define OMAP2420_CONTROL_PADCONF_DSS_DATA5_OFFSET 0x088
142#define OMAP2420_CONTROL_PADCONF_DSS_DATA6_OFFSET 0x089
143#define OMAP2420_CONTROL_PADCONF_DSS_DATA7_OFFSET 0x08a
144#define OMAP2420_CONTROL_PADCONF_DSS_DATA8_OFFSET 0x08b
145#define OMAP2420_CONTROL_PADCONF_DSS_DATA9_OFFSET 0x08c
146#define OMAP2420_CONTROL_PADCONF_DSS_DATA10_OFFSET 0x08d
147#define OMAP2420_CONTROL_PADCONF_DSS_DATA11_OFFSET 0x08e
148#define OMAP2420_CONTROL_PADCONF_DSS_DATA12_OFFSET 0x08f
149#define OMAP2420_CONTROL_PADCONF_DSS_DATA13_OFFSET 0x090
150#define OMAP2420_CONTROL_PADCONF_DSS_DATA14_OFFSET 0x091
151#define OMAP2420_CONTROL_PADCONF_DSS_DATA15_OFFSET 0x092
152#define OMAP2420_CONTROL_PADCONF_DSS_DATA16_OFFSET 0x093
153#define OMAP2420_CONTROL_PADCONF_DSS_DATA17_OFFSET 0x094
154#define OMAP2420_CONTROL_PADCONF_UART1_CTS_OFFSET 0x095
155#define OMAP2420_CONTROL_PADCONF_UART1_RTS_OFFSET 0x096
156#define OMAP2420_CONTROL_PADCONF_UART1_TX_OFFSET 0x097
157#define OMAP2420_CONTROL_PADCONF_UART1_RX_OFFSET 0x098
158#define OMAP2420_CONTROL_PADCONF_MCBSP2_DR_OFFSET 0x099
159#define OMAP2420_CONTROL_PADCONF_MCBSP2_CLKX_OFFSET 0x09a
160#define OMAP2420_CONTROL_PADCONF_DSS_PCL_OFFSET 0x09b
161#define OMAP2420_CONTROL_PADCONF_DSS_VSYNC_OFFSET 0x09c
162#define OMAP2420_CONTROL_PADCONF_DSS_HSYNC_OFFSET 0x09d
163#define OMAP2420_CONTROL_PADCONF_DSS_ACBIAS_OFFSET 0x09e
164#define OMAP2420_CONTROL_PADCONF_CAM_D9_OFFSET 0x09f
165#define OMAP2420_CONTROL_PADCONF_CAM_D8_OFFSET 0x0a0
166#define OMAP2420_CONTROL_PADCONF_CAM_D7_OFFSET 0x0a1
167#define OMAP2420_CONTROL_PADCONF_CAM_D6_OFFSET 0x0a2
168#define OMAP2420_CONTROL_PADCONF_CAM_D5_OFFSET 0x0a3
169#define OMAP2420_CONTROL_PADCONF_CAM_D4_OFFSET 0x0a4
170#define OMAP2420_CONTROL_PADCONF_CAM_D3_OFFSET 0x0a5
171#define OMAP2420_CONTROL_PADCONF_CAM_D2_OFFSET 0x0a6
172#define OMAP2420_CONTROL_PADCONF_CAM_D1_OFFSET 0x0a7
173#define OMAP2420_CONTROL_PADCONF_CAM_D0_OFFSET 0x0a8
174#define OMAP2420_CONTROL_PADCONF_CAM_HS_OFFSET 0x0a9
175#define OMAP2420_CONTROL_PADCONF_CAM_VS_OFFSET 0x0aa
176#define OMAP2420_CONTROL_PADCONF_CAM_LCLK_OFFSET 0x0ab
177#define OMAP2420_CONTROL_PADCONF_CAM_XCLK_OFFSET 0x0ac
178#define OMAP2420_CONTROL_PADCONF_SSI1_DAT_TX_OFFSET 0x0ad
179#define OMAP2420_CONTROL_PADCONF_SSI1_FLAG_TX_OFFSET 0x0ae
180#define OMAP2420_CONTROL_PADCONF_SSI1_RDY_TX_OFFSET 0x0af
181#define OMAP2420_CONTROL_PADCONF_GPIO_62_OFFSET 0x0b0
182#define OMAP2420_CONTROL_PADCONF_SSI1_DAT_RX_OFFSET 0x0b1
183#define OMAP2420_CONTROL_PADCONF_SSI1_FLAG_RX_OFFSET 0x0b2
184#define OMAP2420_CONTROL_PADCONF_SSI1_RDY_RX_OFFSET 0x0b3
185#define OMAP2420_CONTROL_PADCONF_SSI1_WAKE_OFFSET 0x0b4
186#define OMAP2420_CONTROL_PADCONF_VLYNQ_CLK_OFFSET 0x0b5
187#define OMAP2420_CONTROL_PADCONF_VLYNQ_RX1_OFFSET 0x0b6
188#define OMAP2420_CONTROL_PADCONF_VLYNQ_RX0_OFFSET 0x0b7
189#define OMAP2420_CONTROL_PADCONF_VLYNQ_TX1_OFFSET 0x0b8
190#define OMAP2420_CONTROL_PADCONF_VLYNQ_TX0_OFFSET 0x0b9
191#define OMAP2420_CONTROL_PADCONF_VLYNQ_NLA_OFFSET 0x0ba
192#define OMAP2420_CONTROL_PADCONF_UART2_CTS_OFFSET 0x0bb
193#define OMAP2420_CONTROL_PADCONF_UART2_RTS_OFFSET 0x0bc
194#define OMAP2420_CONTROL_PADCONF_UART2_TX_OFFSET 0x0bd
195#define OMAP2420_CONTROL_PADCONF_UART2_RX_OFFSET 0x0be
196#define OMAP2420_CONTROL_PADCONF_EAC_BT_SCLK_OFFSET 0x0bf
197#define OMAP2420_CONTROL_PADCONF_EAC_BT_FS_OFFSET 0x0c0
198#define OMAP2420_CONTROL_PADCONF_EAC_BT_DIN_OFFSET 0x0c1
199#define OMAP2420_CONTROL_PADCONF_EAC_BT_DOUT_OFFSET 0x0c2
200#define OMAP2420_CONTROL_PADCONF_MMC_CLKO_OFFSET 0x0c3
201#define OMAP2420_CONTROL_PADCONF_MMC_CMD_OFFSET 0x0c4
202#define OMAP2420_CONTROL_PADCONF_MMC_DAT0_OFFSET 0x0c5
203#define OMAP2420_CONTROL_PADCONF_MMC_DAT1_OFFSET 0x0c6
204#define OMAP2420_CONTROL_PADCONF_MMC_DAT2_OFFSET 0x0c7
205#define OMAP2420_CONTROL_PADCONF_MMC_DAT3_OFFSET 0x0c8
206#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR0_OFFSET 0x0c9
207#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR1_OFFSET 0x0ca
208#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR2_OFFSET 0x0cb
209#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR3_OFFSET 0x0cc
210#define OMAP2420_CONTROL_PADCONF_MMC_CMD_DIR_OFFSET 0x0cd
211#define OMAP2420_CONTROL_PADCONF_MMC_CLKI_OFFSET 0x0ce
212#define OMAP2420_CONTROL_PADCONF_SPI1_CLK_OFFSET 0x0cf
213#define OMAP2420_CONTROL_PADCONF_SPI1_SIMO_OFFSET 0x0d0
214#define OMAP2420_CONTROL_PADCONF_SPI1_SOMI_OFFSET 0x0d1
215#define OMAP2420_CONTROL_PADCONF_SPI1_NCS0_OFFSET 0x0d2
216#define OMAP2420_CONTROL_PADCONF_SPI1_NCS1_OFFSET 0x0d3
217#define OMAP2420_CONTROL_PADCONF_SPI1_NCS2_OFFSET 0x0d4
218#define OMAP2420_CONTROL_PADCONF_SPI1_NCS3_OFFSET 0x0d5
219#define OMAP2420_CONTROL_PADCONF_SPI2_CLK_OFFSET 0x0d6
220#define OMAP2420_CONTROL_PADCONF_SPI2_SIMO_OFFSET 0x0d7
221#define OMAP2420_CONTROL_PADCONF_SPI2_SOMI_OFFSET 0x0d8
222#define OMAP2420_CONTROL_PADCONF_SPI2_NCS0_OFFSET 0x0d9
223#define OMAP2420_CONTROL_PADCONF_MCBSP1_CLKR_OFFSET 0x0da
224#define OMAP2420_CONTROL_PADCONF_MCBSP1_FSR_OFFSET 0x0db
225#define OMAP2420_CONTROL_PADCONF_MCBSP1_DX_OFFSET 0x0dc
226#define OMAP2420_CONTROL_PADCONF_MCBSP1_DR_OFFSET 0x0dd
227#define OMAP2420_CONTROL_PADCONF_MCBSP_CLKS_OFFSET 0x0de
228#define OMAP2420_CONTROL_PADCONF_MCBSP1_FSX_OFFSET 0x0df
229#define OMAP2420_CONTROL_PADCONF_MCBSP1_CLKX_OFFSET 0x0e0
230#define OMAP2420_CONTROL_PADCONF_I2C1_SCL_OFFSET 0x0e1
231#define OMAP2420_CONTROL_PADCONF_I2C1_SDA_OFFSET 0x0e2
232#define OMAP2420_CONTROL_PADCONF_I2C2_SCL_OFFSET 0x0e3
233#define OMAP2420_CONTROL_PADCONF_I2C2_SDA_OFFSET 0x0e4
234#define OMAP2420_CONTROL_PADCONF_HDQ_SIO_OFFSET 0x0e5
235#define OMAP2420_CONTROL_PADCONF_UART3_CTS_RCTX_OFFSET 0x0e6
236#define OMAP2420_CONTROL_PADCONF_UART3_RTS_SD_OFFSET 0x0e7
237#define OMAP2420_CONTROL_PADCONF_UART3_TX_IRTX_OFFSET 0x0e8
238#define OMAP2420_CONTROL_PADCONF_UART3_RX_IRRX_OFFSET 0x0e9
239#define OMAP2420_CONTROL_PADCONF_TV_CVBS_OFFSET 0x0ea
240#define OMAP2420_CONTROL_PADCONF_TV_VREF_OFFSET 0x0eb
241#define OMAP2420_CONTROL_PADCONF_TV_RREF_OFFSET 0x0ec
242#define OMAP2420_CONTROL_PADCONF_USB0_PUEN_OFFSET 0x0ed
243#define OMAP2420_CONTROL_PADCONF_USB0_VP_OFFSET 0x0ee
244#define OMAP2420_CONTROL_PADCONF_USB0_VM_OFFSET 0x0ef
245#define OMAP2420_CONTROL_PADCONF_USB0_RCV_OFFSET 0x0f0
246#define OMAP2420_CONTROL_PADCONF_USB0_TXEN_OFFSET 0x0f1
247#define OMAP2420_CONTROL_PADCONF_USB0_SE0_OFFSET 0x0f2
248#define OMAP2420_CONTROL_PADCONF_USB0_DAT_OFFSET 0x0f3
249#define OMAP2420_CONTROL_PADCONF_EAC_AC_SCLK_OFFSET 0x0f4
250#define OMAP2420_CONTROL_PADCONF_EAC_AC_FS_OFFSET 0x0f5
251#define OMAP2420_CONTROL_PADCONF_EAC_AC_DIN_OFFSET 0x0f6
252#define OMAP2420_CONTROL_PADCONF_EAC_AC_DOUT_OFFSET 0x0f7
253#define OMAP2420_CONTROL_PADCONF_EAC_AC_MCLK_OFFSET 0x0f8
254#define OMAP2420_CONTROL_PADCONF_EAC_AC_RST_OFFSET 0x0f9
255#define OMAP2420_CONTROL_PADCONF_SYS_NRESPWRON_OFFSET 0x0fa
256#define OMAP2420_CONTROL_PADCONF_SYS_NRESWARM_OFFSET 0x0fb
257#define OMAP2420_CONTROL_PADCONF_SYS_NIRQ_OFFSET 0x0fc
258#define OMAP2420_CONTROL_PADCONF_SYS_NV_OFFSET 0x0fd
259#define OMAP2420_CONTROL_PADCONF_GPIO_119_OFFSET 0x0fe
260#define OMAP2420_CONTROL_PADCONF_GPIO_120_OFFSET 0x0ff
261#define OMAP2420_CONTROL_PADCONF_GPIO_121_OFFSET 0x100
262#define OMAP2420_CONTROL_PADCONF_GPIO_122_OFFSET 0x101
263#define OMAP2420_CONTROL_PADCONF_SYS_32K_OFFSET 0x102
264#define OMAP2420_CONTROL_PADCONF_SYS_XTALIN_OFFSET 0x103
265#define OMAP2420_CONTROL_PADCONF_SYS_XTALOUT_OFFSET 0x104
266#define OMAP2420_CONTROL_PADCONF_GPIO_36_OFFSET 0x105
267#define OMAP2420_CONTROL_PADCONF_SYS_CLKREQ_OFFSET 0x106
268#define OMAP2420_CONTROL_PADCONF_SYS_CLKOUT_OFFSET 0x107
269#define OMAP2420_CONTROL_PADCONF_GPIO_6_OFFSET 0x108
270#define OMAP2420_CONTROL_PADCONF_GPIO_124_OFFSET 0x109
271#define OMAP2420_CONTROL_PADCONF_GPIO_125_OFFSET 0x10a
272#define OMAP2420_CONTROL_PADCONF_JTAG_EMU1_OFFSET 0x10b
273#define OMAP2420_CONTROL_PADCONF_JTAG_EMU0_OFFSET 0x10c
274#define OMAP2420_CONTROL_PADCONF_JTAG_NTRST_OFFSET 0x10d
275#define OMAP2420_CONTROL_PADCONF_JTAG_TCK_OFFSET 0x10e
276#define OMAP2420_CONTROL_PADCONF_JTAG_RTCK_OFFSET 0x10f
277#define OMAP2420_CONTROL_PADCONF_JTAG_TMS_OFFSET 0x110
278#define OMAP2420_CONTROL_PADCONF_JTAG_TDI_OFFSET 0x111
279#define OMAP2420_CONTROL_PADCONF_JTAG_TDO_OFFSET 0x112
280
281#define OMAP2420_CONTROL_PADCONF_MUX_SIZE \
282 (OMAP2420_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x1)
diff --git a/arch/arm/mach-omap2/mux2430.c b/arch/arm/mach-omap2/mux2430.c
deleted file mode 100644
index 4185f92553db..000000000000
--- a/arch/arm/mach-omap2/mux2430.c
+++ /dev/null
@@ -1,793 +0,0 @@
1/*
2 * Copyright (C) 2010 Nokia
3 * Copyright (C) 2010 Texas Instruments
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/module.h>
11#include <linux/init.h>
12
13#include "mux.h"
14
15#ifdef CONFIG_OMAP_MUX
16
17#define _OMAP2430_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
18{ \
19 .reg_offset = (OMAP2430_CONTROL_PADCONF_##M0##_OFFSET), \
20 .gpio = (g), \
21 .muxnames = { m0, m1, m2, m3, m4, m5, m6, m7 }, \
22}
23
24#else
25
26#define _OMAP2430_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
27{ \
28 .reg_offset = (OMAP2430_CONTROL_PADCONF_##M0##_OFFSET), \
29 .gpio = (g), \
30}
31
32#endif
33
34#define _OMAP2430_BALLENTRY(M0, bb, bt) \
35{ \
36 .reg_offset = (OMAP2430_CONTROL_PADCONF_##M0##_OFFSET), \
37 .balls = { bb, bt }, \
38}
39
40/*
41 * Superset of all mux modes for omap2430
42 */
43static struct omap_mux __initdata omap2430_muxmodes[] = {
44 _OMAP2430_MUXENTRY(CAM_D0, 133,
45 "cam_d0", "hw_dbg0", "sti_dout", "gpio_133",
46 NULL, NULL, "etk_d2", "safe_mode"),
47 _OMAP2430_MUXENTRY(CAM_D10, 146,
48 "cam_d10", NULL, NULL, "gpio_146",
49 NULL, NULL, "etk_d12", "safe_mode"),
50 _OMAP2430_MUXENTRY(CAM_D11, 145,
51 "cam_d11", NULL, NULL, "gpio_145",
52 NULL, NULL, "etk_d13", "safe_mode"),
53 _OMAP2430_MUXENTRY(CAM_D1, 132,
54 "cam_d1", "hw_dbg1", "sti_din", "gpio_132",
55 NULL, NULL, "etk_d3", "safe_mode"),
56 _OMAP2430_MUXENTRY(CAM_D2, 129,
57 "cam_d2", "hw_dbg2", "mcbsp1_clkx", "gpio_129",
58 NULL, NULL, "etk_d4", "safe_mode"),
59 _OMAP2430_MUXENTRY(CAM_D3, 128,
60 "cam_d3", "hw_dbg3", "mcbsp1_dr", "gpio_128",
61 NULL, NULL, "etk_d5", "safe_mode"),
62 _OMAP2430_MUXENTRY(CAM_D4, 143,
63 "cam_d4", "hw_dbg4", "mcbsp1_fsr", "gpio_143",
64 NULL, NULL, "etk_d6", "safe_mode"),
65 _OMAP2430_MUXENTRY(CAM_D5, 112,
66 "cam_d5", "hw_dbg5", "mcbsp1_clkr", "gpio_112",
67 NULL, NULL, "etk_d7", "safe_mode"),
68 _OMAP2430_MUXENTRY(CAM_D6, 137,
69 "cam_d6", "hw_dbg6", NULL, "gpio_137",
70 NULL, NULL, "etk_d8", "safe_mode"),
71 _OMAP2430_MUXENTRY(CAM_D7, 136,
72 "cam_d7", "hw_dbg7", NULL, "gpio_136",
73 NULL, NULL, "etk_d9", "safe_mode"),
74 _OMAP2430_MUXENTRY(CAM_D8, 135,
75 "cam_d8", "hw_dbg8", NULL, "gpio_135",
76 NULL, NULL, "etk_d10", "safe_mode"),
77 _OMAP2430_MUXENTRY(CAM_D9, 134,
78 "cam_d9", "hw_dbg9", NULL, "gpio_134",
79 NULL, NULL, "etk_d11", "safe_mode"),
80 _OMAP2430_MUXENTRY(CAM_HS, 11,
81 "cam_hs", "hw_dbg10", "mcbsp1_dx", "gpio_11",
82 NULL, NULL, "etk_d1", "safe_mode"),
83 _OMAP2430_MUXENTRY(CAM_LCLK, 0,
84 "cam_lclk", NULL, "mcbsp_clks", NULL,
85 NULL, NULL, "etk_c1", "safe_mode"),
86 _OMAP2430_MUXENTRY(CAM_VS, 12,
87 "cam_vs", "hw_dbg11", "mcbsp1_fsx", "gpio_12",
88 NULL, NULL, "etk_d0", "safe_mode"),
89 _OMAP2430_MUXENTRY(CAM_XCLK, 0,
90 "cam_xclk", NULL, "sti_clk", NULL,
91 NULL, NULL, "etk_c2", NULL),
92 _OMAP2430_MUXENTRY(DSS_ACBIAS, 48,
93 "dss_acbias", NULL, "mcbsp2_fsx", "gpio_48",
94 NULL, NULL, NULL, "safe_mode"),
95 _OMAP2430_MUXENTRY(DSS_DATA0, 40,
96 "dss_data0", "uart1_cts", NULL, "gpio_40",
97 NULL, NULL, NULL, "safe_mode"),
98 _OMAP2430_MUXENTRY(DSS_DATA10, 128,
99 "dss_data10", "sdi_data1n", NULL, "gpio_128",
100 NULL, NULL, NULL, "safe_mode"),
101 _OMAP2430_MUXENTRY(DSS_DATA11, 129,
102 "dss_data11", "sdi_data1p", NULL, "gpio_129",
103 NULL, NULL, NULL, "safe_mode"),
104 _OMAP2430_MUXENTRY(DSS_DATA12, 130,
105 "dss_data12", "sdi_data2n", NULL, "gpio_130",
106 NULL, NULL, NULL, "safe_mode"),
107 _OMAP2430_MUXENTRY(DSS_DATA13, 131,
108 "dss_data13", "sdi_data2p", NULL, "gpio_131",
109 NULL, NULL, NULL, "safe_mode"),
110 _OMAP2430_MUXENTRY(DSS_DATA14, 132,
111 "dss_data14", "sdi_data3n", NULL, "gpio_132",
112 NULL, NULL, NULL, "safe_mode"),
113 _OMAP2430_MUXENTRY(DSS_DATA15, 133,
114 "dss_data15", "sdi_data3p", NULL, "gpio_133",
115 NULL, NULL, NULL, "safe_mode"),
116 _OMAP2430_MUXENTRY(DSS_DATA16, 46,
117 "dss_data16", NULL, NULL, "gpio_46",
118 NULL, NULL, NULL, "safe_mode"),
119 _OMAP2430_MUXENTRY(DSS_DATA17, 47,
120 "dss_data17", NULL, NULL, "gpio_47",
121 NULL, NULL, NULL, "safe_mode"),
122 _OMAP2430_MUXENTRY(DSS_DATA1, 41,
123 "dss_data1", "uart1_rts", NULL, "gpio_41",
124 NULL, NULL, NULL, "safe_mode"),
125 _OMAP2430_MUXENTRY(DSS_DATA2, 42,
126 "dss_data2", "uart1_tx", NULL, "gpio_42",
127 NULL, NULL, NULL, "safe_mode"),
128 _OMAP2430_MUXENTRY(DSS_DATA3, 43,
129 "dss_data3", "uart1_rx", NULL, "gpio_43",
130 NULL, NULL, NULL, "safe_mode"),
131 _OMAP2430_MUXENTRY(DSS_DATA4, 44,
132 "dss_data4", "uart3_rx_irrx", NULL, "gpio_44",
133 NULL, NULL, NULL, "safe_mode"),
134 _OMAP2430_MUXENTRY(DSS_DATA5, 45,
135 "dss_data5", "uart3_tx_irtx", NULL, "gpio_45",
136 NULL, NULL, NULL, "safe_mode"),
137 _OMAP2430_MUXENTRY(DSS_DATA6, 144,
138 "dss_data6", NULL, NULL, "gpio_144",
139 NULL, NULL, NULL, "safe_mode"),
140 _OMAP2430_MUXENTRY(DSS_DATA7, 147,
141 "dss_data7", NULL, NULL, "gpio_147",
142 NULL, NULL, NULL, "safe_mode"),
143 _OMAP2430_MUXENTRY(DSS_DATA8, 38,
144 "dss_data8", NULL, NULL, "gpio_38",
145 NULL, NULL, NULL, "safe_mode"),
146 _OMAP2430_MUXENTRY(DSS_DATA9, 39,
147 "dss_data9", NULL, NULL, "gpio_39",
148 NULL, NULL, NULL, "safe_mode"),
149 _OMAP2430_MUXENTRY(DSS_HSYNC, 110,
150 "dss_hsync", NULL, NULL, "gpio_110",
151 NULL, NULL, NULL, "safe_mode"),
152 _OMAP2430_MUXENTRY(GPIO_113, 113,
153 "gpio_113", "mcbsp2_clkx", NULL, "gpio_113",
154 NULL, NULL, NULL, "safe_mode"),
155 _OMAP2430_MUXENTRY(GPIO_114, 114,
156 "gpio_114", "mcbsp2_fsx", NULL, "gpio_114",
157 NULL, NULL, NULL, "safe_mode"),
158 _OMAP2430_MUXENTRY(GPIO_115, 115,
159 "gpio_115", "mcbsp2_dr", NULL, "gpio_115",
160 NULL, NULL, NULL, "safe_mode"),
161 _OMAP2430_MUXENTRY(GPIO_116, 116,
162 "gpio_116", "mcbsp2_dx", NULL, "gpio_116",
163 NULL, NULL, NULL, "safe_mode"),
164 _OMAP2430_MUXENTRY(GPIO_128, 128,
165 "gpio_128", NULL, "sti_din", "gpio_128",
166 NULL, "sys_boot0", NULL, "safe_mode"),
167 _OMAP2430_MUXENTRY(GPIO_129, 129,
168 "gpio_129", NULL, "sti_dout", "gpio_129",
169 NULL, "sys_boot1", NULL, "safe_mode"),
170 _OMAP2430_MUXENTRY(GPIO_130, 130,
171 "gpio_130", NULL, NULL, "gpio_130",
172 "jtag_emu2", "sys_boot2", NULL, "safe_mode"),
173 _OMAP2430_MUXENTRY(GPIO_131, 131,
174 "gpio_131", NULL, NULL, "gpio_131",
175 "jtag_emu3", "sys_boot3", NULL, "safe_mode"),
176 _OMAP2430_MUXENTRY(GPIO_132, 132,
177 "gpio_132", NULL, NULL, "gpio_132",
178 NULL, "sys_boot4", NULL, "safe_mode"),
179 _OMAP2430_MUXENTRY(GPIO_133, 133,
180 "gpio_133", NULL, NULL, "gpio_133",
181 NULL, "sys_boot5", NULL, "safe_mode"),
182 _OMAP2430_MUXENTRY(GPIO_134, 134,
183 "gpio_134", "ccp_datn", NULL, "gpio_134",
184 NULL, NULL, NULL, "safe_mode"),
185 _OMAP2430_MUXENTRY(GPIO_135, 135,
186 "gpio_135", "ccp_datp", NULL, "gpio_135",
187 NULL, NULL, NULL, "safe_mode"),
188 _OMAP2430_MUXENTRY(GPIO_136, 136,
189 "gpio_136", "ccp_clkn", NULL, "gpio_136",
190 NULL, NULL, NULL, "safe_mode"),
191 _OMAP2430_MUXENTRY(GPIO_137, 137,
192 "gpio_137", "ccp_clkp", NULL, "gpio_137",
193 NULL, NULL, NULL, "safe_mode"),
194 _OMAP2430_MUXENTRY(GPIO_138, 138,
195 "gpio_138", "spi3_clk", NULL, "gpio_138",
196 NULL, NULL, NULL, "safe_mode"),
197 _OMAP2430_MUXENTRY(GPIO_139, 139,
198 "gpio_139", "spi3_cs0", "sys_ndmareq3", "gpio_139",
199 NULL, NULL, NULL, "safe_mode"),
200 _OMAP2430_MUXENTRY(GPIO_140, 140,
201 "gpio_140", "spi3_simo", "sys_ndmareq4", "gpio_140",
202 NULL, NULL, "etk_d14", "safe_mode"),
203 _OMAP2430_MUXENTRY(GPIO_141, 141,
204 "gpio_141", "spi3_somi", NULL, "gpio_141",
205 NULL, NULL, NULL, "safe_mode"),
206 _OMAP2430_MUXENTRY(GPIO_142, 142,
207 "gpio_142", "spi3_cs1", "sys_ndmareq2", "gpio_142",
208 NULL, NULL, "etk_d15", "safe_mode"),
209 _OMAP2430_MUXENTRY(GPIO_148, 148,
210 "gpio_148", "mcbsp5_fsx", NULL, "gpio_148",
211 NULL, NULL, NULL, "safe_mode"),
212 _OMAP2430_MUXENTRY(GPIO_149, 149,
213 "gpio_149", "mcbsp5_dx", NULL, "gpio_149",
214 NULL, NULL, NULL, "safe_mode"),
215 _OMAP2430_MUXENTRY(GPIO_150, 150,
216 "gpio_150", "mcbsp5_dr", NULL, "gpio_150",
217 NULL, NULL, NULL, "safe_mode"),
218 _OMAP2430_MUXENTRY(GPIO_151, 151,
219 "gpio_151", "sys_pwrok", NULL, "gpio_151",
220 NULL, NULL, NULL, "safe_mode"),
221 _OMAP2430_MUXENTRY(GPIO_152, 152,
222 "gpio_152", "uart1_cts", "sys_ndmareq1", "gpio_152",
223 NULL, NULL, NULL, "safe_mode"),
224 _OMAP2430_MUXENTRY(GPIO_153, 153,
225 "gpio_153", "uart1_rx", "sys_ndmareq0", "gpio_153",
226 NULL, NULL, NULL, "safe_mode"),
227 _OMAP2430_MUXENTRY(GPIO_154, 154,
228 "gpio_154", "mcbsp5_clkx", NULL, "gpio_154",
229 NULL, NULL, NULL, "safe_mode"),
230 _OMAP2430_MUXENTRY(GPIO_63, 63,
231 "gpio_63", "mcbsp4_clkx", NULL, "gpio_63",
232 NULL, NULL, NULL, "safe_mode"),
233 _OMAP2430_MUXENTRY(GPIO_78, 78,
234 "gpio_78", NULL, "uart2_rts", "gpio_78",
235 "uart3_rts_sd", NULL, NULL, "safe_mode"),
236 _OMAP2430_MUXENTRY(GPIO_79, 79,
237 "gpio_79", "secure_indicator", "uart2_tx", "gpio_79",
238 "uart3_tx_irtx", NULL, NULL, "safe_mode"),
239 _OMAP2430_MUXENTRY(GPIO_7, 7,
240 "gpio_7", NULL, "uart2_cts", "gpio_7",
241 "uart3_cts_rctx", NULL, NULL, "safe_mode"),
242 _OMAP2430_MUXENTRY(GPIO_80, 80,
243 "gpio_80", NULL, "uart2_rx", "gpio_80",
244 "uart3_rx_irrx", NULL, NULL, "safe_mode"),
245 _OMAP2430_MUXENTRY(GPMC_A10, 3,
246 "gpmc_a10", NULL, "sys_ndmareq0", "gpio_3",
247 NULL, NULL, NULL, "safe_mode"),
248 _OMAP2430_MUXENTRY(GPMC_A1, 31,
249 "gpmc_a1", NULL, NULL, "gpio_31",
250 NULL, NULL, NULL, "safe_mode"),
251 _OMAP2430_MUXENTRY(GPMC_A2, 30,
252 "gpmc_a2", NULL, NULL, "gpio_30",
253 NULL, NULL, NULL, "safe_mode"),
254 _OMAP2430_MUXENTRY(GPMC_A3, 29,
255 "gpmc_a3", NULL, NULL, "gpio_29",
256 NULL, NULL, NULL, "safe_mode"),
257 _OMAP2430_MUXENTRY(GPMC_A4, 49,
258 "gpmc_a4", NULL, NULL, "gpio_49",
259 NULL, NULL, NULL, "safe_mode"),
260 _OMAP2430_MUXENTRY(GPMC_A5, 53,
261 "gpmc_a5", NULL, NULL, "gpio_53",
262 NULL, NULL, NULL, "safe_mode"),
263 _OMAP2430_MUXENTRY(GPMC_A6, 52,
264 "gpmc_a6", NULL, NULL, "gpio_52",
265 NULL, NULL, NULL, "safe_mode"),
266 _OMAP2430_MUXENTRY(GPMC_A7, 6,
267 "gpmc_a7", NULL, NULL, "gpio_6",
268 NULL, NULL, NULL, "safe_mode"),
269 _OMAP2430_MUXENTRY(GPMC_A8, 5,
270 "gpmc_a8", NULL, NULL, "gpio_5",
271 NULL, NULL, NULL, "safe_mode"),
272 _OMAP2430_MUXENTRY(GPMC_A9, 4,
273 "gpmc_a9", NULL, "sys_ndmareq1", "gpio_4",
274 NULL, NULL, NULL, "safe_mode"),
275 _OMAP2430_MUXENTRY(GPMC_CLK, 21,
276 "gpmc_clk", NULL, NULL, "gpio_21",
277 NULL, NULL, NULL, "safe_mode"),
278 _OMAP2430_MUXENTRY(GPMC_D10, 18,
279 "gpmc_d10", NULL, NULL, "gpio_18",
280 NULL, NULL, NULL, "safe_mode"),
281 _OMAP2430_MUXENTRY(GPMC_D11, 57,
282 "gpmc_d11", NULL, NULL, "gpio_57",
283 NULL, NULL, NULL, "safe_mode"),
284 _OMAP2430_MUXENTRY(GPMC_D12, 77,
285 "gpmc_d12", NULL, NULL, "gpio_77",
286 NULL, NULL, NULL, "safe_mode"),
287 _OMAP2430_MUXENTRY(GPMC_D13, 76,
288 "gpmc_d13", NULL, NULL, "gpio_76",
289 NULL, NULL, NULL, "safe_mode"),
290 _OMAP2430_MUXENTRY(GPMC_D14, 55,
291 "gpmc_d14", NULL, NULL, "gpio_55",
292 NULL, NULL, NULL, "safe_mode"),
293 _OMAP2430_MUXENTRY(GPMC_D15, 54,
294 "gpmc_d15", NULL, NULL, "gpio_54",
295 NULL, NULL, NULL, "safe_mode"),
296 _OMAP2430_MUXENTRY(GPMC_D8, 20,
297 "gpmc_d8", NULL, NULL, "gpio_20",
298 NULL, NULL, NULL, "safe_mode"),
299 _OMAP2430_MUXENTRY(GPMC_D9, 19,
300 "gpmc_d9", NULL, NULL, "gpio_19",
301 NULL, NULL, NULL, "safe_mode"),
302 _OMAP2430_MUXENTRY(GPMC_NCS1, 22,
303 "gpmc_ncs1", NULL, NULL, "gpio_22",
304 NULL, NULL, NULL, "safe_mode"),
305 _OMAP2430_MUXENTRY(GPMC_NCS2, 23,
306 "gpmc_ncs2", NULL, NULL, "gpio_23",
307 NULL, NULL, NULL, "safe_mode"),
308 _OMAP2430_MUXENTRY(GPMC_NCS3, 24,
309 "gpmc_ncs3", "gpmc_io_dir", NULL, "gpio_24",
310 NULL, NULL, NULL, "safe_mode"),
311 _OMAP2430_MUXENTRY(GPMC_NCS4, 25,
312 "gpmc_ncs4", NULL, NULL, "gpio_25",
313 NULL, NULL, NULL, "safe_mode"),
314 _OMAP2430_MUXENTRY(GPMC_NCS5, 26,
315 "gpmc_ncs5", NULL, NULL, "gpio_26",
316 NULL, NULL, NULL, "safe_mode"),
317 _OMAP2430_MUXENTRY(GPMC_NCS6, 27,
318 "gpmc_ncs6", NULL, NULL, "gpio_27",
319 NULL, NULL, NULL, "safe_mode"),
320 _OMAP2430_MUXENTRY(GPMC_NCS7, 28,
321 "gpmc_ncs7", "gpmc_io_dir", NULL, "gpio_28",
322 NULL, NULL, NULL, "safe_mode"),
323 _OMAP2430_MUXENTRY(GPMC_WAIT1, 33,
324 "gpmc_wait1", NULL, NULL, "gpio_33",
325 NULL, NULL, NULL, "safe_mode"),
326 _OMAP2430_MUXENTRY(GPMC_WAIT2, 34,
327 "gpmc_wait2", NULL, NULL, "gpio_34",
328 NULL, NULL, NULL, "safe_mode"),
329 _OMAP2430_MUXENTRY(GPMC_WAIT3, 35,
330 "gpmc_wait3", NULL, NULL, "gpio_35",
331 NULL, NULL, NULL, "safe_mode"),
332 _OMAP2430_MUXENTRY(HDQ_SIO, 101,
333 "hdq_sio", "usb2_tllse0", "sys_altclk", "gpio_101",
334 "uart3_rx_irrx", NULL, NULL, "safe_mode"),
335 _OMAP2430_MUXENTRY(I2C1_SCL, 50,
336 "i2c1_scl", NULL, NULL, "gpio_50",
337 NULL, NULL, NULL, "safe_mode"),
338 _OMAP2430_MUXENTRY(I2C1_SDA, 51,
339 "i2c1_sda", NULL, NULL, "gpio_51",
340 NULL, NULL, NULL, "safe_mode"),
341 _OMAP2430_MUXENTRY(I2C2_SCL, 99,
342 "i2c2_scl", NULL, NULL, "gpio_99",
343 NULL, NULL, NULL, "safe_mode"),
344 _OMAP2430_MUXENTRY(I2C2_SDA, 100,
345 "i2c2_sda", NULL, NULL, "gpio_100",
346 NULL, NULL, NULL, "safe_mode"),
347 _OMAP2430_MUXENTRY(JTAG_EMU0, 127,
348 "jtag_emu0", "secure_indicator", NULL, "gpio_127",
349 NULL, NULL, NULL, "safe_mode"),
350 _OMAP2430_MUXENTRY(JTAG_EMU1, 126,
351 "jtag_emu1", NULL, NULL, "gpio_126",
352 NULL, NULL, NULL, "safe_mode"),
353 _OMAP2430_MUXENTRY(MCBSP1_CLKR, 92,
354 "mcbsp1_clkr", "ssi2_dat_tx", NULL, "gpio_92",
355 NULL, NULL, NULL, "safe_mode"),
356 _OMAP2430_MUXENTRY(MCBSP1_CLKX, 98,
357 "mcbsp1_clkx", "ssi2_wake", NULL, "gpio_98",
358 NULL, NULL, NULL, "safe_mode"),
359 _OMAP2430_MUXENTRY(MCBSP1_DR, 95,
360 "mcbsp1_dr", "ssi2_dat_rx", NULL, "gpio_95",
361 NULL, NULL, NULL, "safe_mode"),
362 _OMAP2430_MUXENTRY(MCBSP1_DX, 94,
363 "mcbsp1_dx", "ssi2_rdy_tx", NULL, "gpio_94",
364 NULL, NULL, NULL, "safe_mode"),
365 _OMAP2430_MUXENTRY(MCBSP1_FSR, 93,
366 "mcbsp1_fsr", "ssi2_flag_tx", NULL, "gpio_93",
367 "spi2_cs1", NULL, NULL, "safe_mode"),
368 _OMAP2430_MUXENTRY(MCBSP1_FSX, 97,
369 "mcbsp1_fsx", "ssi2_rdy_rx", NULL, "gpio_97",
370 NULL, NULL, NULL, "safe_mode"),
371 _OMAP2430_MUXENTRY(MCBSP2_CLKX, 147,
372 "mcbsp2_clkx", "sdi_clkp", "dss_data23", "gpio_147",
373 NULL, NULL, NULL, "safe_mode"),
374 _OMAP2430_MUXENTRY(MCBSP2_DR, 144,
375 "mcbsp2_dr", "sdi_clkn", "dss_data22", "gpio_144",
376 NULL, NULL, NULL, "safe_mode"),
377 _OMAP2430_MUXENTRY(MCBSP3_CLKX, 71,
378 "mcbsp3_clkx", NULL, NULL, "gpio_71",
379 NULL, NULL, NULL, "safe_mode"),
380 _OMAP2430_MUXENTRY(MCBSP3_DR, 73,
381 "mcbsp3_dr", NULL, NULL, "gpio_73",
382 NULL, NULL, NULL, "safe_mode"),
383 _OMAP2430_MUXENTRY(MCBSP3_DX, 74,
384 "mcbsp3_dx", NULL, "sti_clk", "gpio_74",
385 NULL, NULL, NULL, "safe_mode"),
386 _OMAP2430_MUXENTRY(MCBSP3_FSX, 72,
387 "mcbsp3_fsx", NULL, NULL, "gpio_72",
388 NULL, NULL, NULL, "safe_mode"),
389 _OMAP2430_MUXENTRY(MCBSP_CLKS, 96,
390 "mcbsp_clks", "ssi2_flag_rx", NULL, "gpio_96",
391 NULL, NULL, NULL, "safe_mode"),
392 _OMAP2430_MUXENTRY(SDMMC1_CLKO, 0,
393 "sdmmc1_clko", "ms_clko", NULL, NULL,
394 NULL, "hw_dbg9", "hw_dbg3", "safe_mode"),
395 _OMAP2430_MUXENTRY(SDMMC1_CMD, 0,
396 "sdmmc1_cmd", "ms_bs", NULL, NULL,
397 NULL, "hw_dbg8", "hw_dbg2", "safe_mode"),
398 _OMAP2430_MUXENTRY(SDMMC1_DAT0, 0,
399 "sdmmc1_dat0", "ms_dat0", NULL, NULL,
400 NULL, "hw_dbg7", "hw_dbg1", "safe_mode"),
401 _OMAP2430_MUXENTRY(SDMMC1_DAT1, 75,
402 "sdmmc1_dat1", "ms_dat1", NULL, "gpio_75",
403 NULL, "hw_dbg6", "hw_dbg0", "safe_mode"),
404 _OMAP2430_MUXENTRY(SDMMC1_DAT2, 0,
405 "sdmmc1_dat2", "ms_dat2", NULL, NULL,
406 NULL, "hw_dbg5", "hw_dbg10", "safe_mode"),
407 _OMAP2430_MUXENTRY(SDMMC1_DAT3, 0,
408 "sdmmc1_dat3", "ms_dat3", NULL, NULL,
409 NULL, "hw_dbg4", "hw_dbg11", "safe_mode"),
410 _OMAP2430_MUXENTRY(SDMMC2_CLKO, 13,
411 "sdmmc2_clko", NULL, NULL, "gpio_13",
412 NULL, "spi3_clk", NULL, "safe_mode"),
413 _OMAP2430_MUXENTRY(SDMMC2_CMD, 15,
414 "sdmmc2_cmd", "usb2_rcv", NULL, "gpio_15",
415 NULL, "spi3_simo", NULL, "safe_mode"),
416 _OMAP2430_MUXENTRY(SDMMC2_DAT0, 16,
417 "sdmmc2_dat0", "usb2_tllse0", NULL, "gpio_16",
418 NULL, "spi3_somi", NULL, "safe_mode"),
419 _OMAP2430_MUXENTRY(SDMMC2_DAT1, 58,
420 "sdmmc2_dat1", "usb2_txen", NULL, "gpio_58",
421 NULL, NULL, NULL, "safe_mode"),
422 _OMAP2430_MUXENTRY(SDMMC2_DAT2, 17,
423 "sdmmc2_dat2", "usb2_dat", NULL, "gpio_17",
424 NULL, "spi3_cs1", NULL, "safe_mode"),
425 _OMAP2430_MUXENTRY(SDMMC2_DAT3, 14,
426 "sdmmc2_dat3", "usb2_se0", NULL, "gpio_14",
427 NULL, "spi3_cs0", NULL, "safe_mode"),
428 _OMAP2430_MUXENTRY(SDRC_A12, 2,
429 "sdrc_a12", NULL, NULL, "gpio_2",
430 NULL, NULL, NULL, "safe_mode"),
431 _OMAP2430_MUXENTRY(SDRC_A13, 1,
432 "sdrc_a13", NULL, NULL, "gpio_1",
433 NULL, NULL, NULL, "safe_mode"),
434 _OMAP2430_MUXENTRY(SDRC_A14, 0,
435 "sdrc_a14", NULL, NULL, "gpio_0",
436 NULL, NULL, NULL, "safe_mode"),
437 _OMAP2430_MUXENTRY(SDRC_CKE1, 36,
438 "sdrc_cke1", NULL, NULL, "gpio_36",
439 NULL, NULL, NULL, "safe_mode"),
440 _OMAP2430_MUXENTRY(SDRC_NCS1, 37,
441 "sdrc_ncs1", NULL, NULL, "gpio_37",
442 NULL, NULL, NULL, "safe_mode"),
443 _OMAP2430_MUXENTRY(SPI1_CLK, 81,
444 "spi1_clk", NULL, NULL, "gpio_81",
445 NULL, NULL, NULL, "safe_mode"),
446 _OMAP2430_MUXENTRY(SPI1_CS0, 84,
447 "spi1_cs0", NULL, NULL, "gpio_84",
448 NULL, NULL, NULL, "safe_mode"),
449 _OMAP2430_MUXENTRY(SPI1_CS1, 85,
450 "spi1_cs1", NULL, NULL, "gpio_85",
451 NULL, NULL, NULL, "safe_mode"),
452 _OMAP2430_MUXENTRY(SPI1_CS2, 86,
453 "spi1_cs2", NULL, NULL, "gpio_86",
454 NULL, NULL, NULL, "safe_mode"),
455 _OMAP2430_MUXENTRY(SPI1_CS3, 87,
456 "spi1_cs3", "spi2_cs1", NULL, "gpio_87",
457 NULL, NULL, NULL, "safe_mode"),
458 _OMAP2430_MUXENTRY(SPI1_SIMO, 82,
459 "spi1_simo", NULL, NULL, "gpio_82",
460 NULL, NULL, NULL, "safe_mode"),
461 _OMAP2430_MUXENTRY(SPI1_SOMI, 83,
462 "spi1_somi", NULL, NULL, "gpio_83",
463 NULL, NULL, NULL, "safe_mode"),
464 _OMAP2430_MUXENTRY(SPI2_CLK, 88,
465 "spi2_clk", "gpt9_pwm_evt", NULL, "gpio_88",
466 NULL, NULL, NULL, "safe_mode"),
467 _OMAP2430_MUXENTRY(SPI2_CS0, 91,
468 "spi2_cs0", "gpt12_pwm_evt", NULL, "gpio_91",
469 NULL, NULL, NULL, "safe_mode"),
470 _OMAP2430_MUXENTRY(SPI2_SIMO, 89,
471 "spi2_simo", "gpt10_pwm_evt", NULL, "gpio_89",
472 NULL, NULL, NULL, "safe_mode"),
473 _OMAP2430_MUXENTRY(SPI2_SOMI, 90,
474 "spi2_somi", "gpt11_pwm_evt", NULL, "gpio_90",
475 NULL, NULL, NULL, "safe_mode"),
476 _OMAP2430_MUXENTRY(SSI1_DAT_RX, 62,
477 "ssi1_dat_rx", "uart1_rx", "usb1_dat", "gpio_62",
478 NULL, NULL, NULL, "safe_mode"),
479 _OMAP2430_MUXENTRY(SSI1_DAT_TX, 59,
480 "ssi1_dat_tx", "uart1_tx", "usb1_se0", "gpio_59",
481 NULL, NULL, NULL, "safe_mode"),
482 _OMAP2430_MUXENTRY(SSI1_FLAG_RX, 64,
483 "ssi1_flag_rx", "mcbsp4_dr", NULL, "gpio_64",
484 NULL, NULL, NULL, "safe_mode"),
485 _OMAP2430_MUXENTRY(SSI1_FLAG_TX, 60,
486 "ssi1_flag_tx", "uart1_rts", "usb1_rcv", "gpio_60",
487 NULL, NULL, NULL, "safe_mode"),
488 _OMAP2430_MUXENTRY(SSI1_RDY_RX, 65,
489 "ssi1_rdy_rx", "mcbsp4_dx", NULL, "gpio_65",
490 NULL, NULL, NULL, "safe_mode"),
491 _OMAP2430_MUXENTRY(SSI1_RDY_TX, 61,
492 "ssi1_rdy_tx", "uart1_cts", "usb1_txen", "gpio_61",
493 NULL, NULL, NULL, "safe_mode"),
494 _OMAP2430_MUXENTRY(SSI1_WAKE, 66,
495 "ssi1_wake", "mcbsp4_fsx", NULL, "gpio_66",
496 NULL, NULL, NULL, "safe_mode"),
497 _OMAP2430_MUXENTRY(SYS_CLKOUT, 111,
498 "sys_clkout", NULL, NULL, "gpio_111",
499 NULL, NULL, NULL, "safe_mode"),
500 _OMAP2430_MUXENTRY(SYS_DRM_MSECURE, 118,
501 "sys_drm_msecure", NULL, "sys_ndmareq6", "gpio_118",
502 NULL, NULL, NULL, "safe_mode"),
503 _OMAP2430_MUXENTRY(SYS_NIRQ0, 56,
504 "sys_nirq0", NULL, NULL, "gpio_56",
505 NULL, NULL, NULL, "safe_mode"),
506 _OMAP2430_MUXENTRY(SYS_NIRQ1, 125,
507 "sys_nirq1", NULL, "sys_ndmareq5", "gpio_125",
508 NULL, NULL, NULL, "safe_mode"),
509 _OMAP2430_MUXENTRY(UART1_CTS, 32,
510 "uart1_cts", "sdi_vsync", "dss_data18", "gpio_32",
511 "mcbsp5_clkx", NULL, NULL, "safe_mode"),
512 _OMAP2430_MUXENTRY(UART1_RTS, 8,
513 "uart1_rts", "sdi_hsync", "dss_data19", "gpio_8",
514 "mcbsp5_fsx", NULL, NULL, "safe_mode"),
515 _OMAP2430_MUXENTRY(UART1_RX, 10,
516 "uart1_rx", "sdi_stp", "dss_data21", "gpio_10",
517 "mcbsp5_dr", NULL, NULL, "safe_mode"),
518 _OMAP2430_MUXENTRY(UART1_TX, 9,
519 "uart1_tx", "sdi_den", "dss_data20", "gpio_9",
520 "mcbsp5_dx", NULL, NULL, "safe_mode"),
521 _OMAP2430_MUXENTRY(UART2_CTS, 67,
522 "uart2_cts", "usb1_rcv", "gpt9_pwm_evt", "gpio_67",
523 NULL, NULL, NULL, "safe_mode"),
524 _OMAP2430_MUXENTRY(UART2_RTS, 68,
525 "uart2_rts", "usb1_txen", "gpt10_pwm_evt", "gpio_68",
526 NULL, NULL, NULL, "safe_mode"),
527 _OMAP2430_MUXENTRY(UART2_RX, 70,
528 "uart2_rx", "usb1_dat", "gpt12_pwm_evt", "gpio_70",
529 NULL, NULL, NULL, "safe_mode"),
530 _OMAP2430_MUXENTRY(UART2_TX, 69,
531 "uart2_tx", "usb1_se0", "gpt11_pwm_evt", "gpio_69",
532 NULL, NULL, NULL, "safe_mode"),
533 _OMAP2430_MUXENTRY(UART3_CTS_RCTX, 102,
534 "uart3_cts_rctx", "uart3_rx_irrx", NULL, "gpio_102",
535 NULL, NULL, NULL, "safe_mode"),
536 _OMAP2430_MUXENTRY(UART3_RTS_SD, 103,
537 "uart3_rts_sd", "uart3_tx_irtx", NULL, "gpio_103",
538 NULL, NULL, NULL, "safe_mode"),
539 _OMAP2430_MUXENTRY(UART3_RX_IRRX, 105,
540 "uart3_rx_irrx", NULL, NULL, "gpio_105",
541 NULL, NULL, NULL, "safe_mode"),
542 _OMAP2430_MUXENTRY(UART3_TX_IRTX, 104,
543 "uart3_tx_irtx", "uart3_cts_rctx", NULL, "gpio_104",
544 NULL, NULL, NULL, "safe_mode"),
545 _OMAP2430_MUXENTRY(USB0HS_CLK, 120,
546 "usb0hs_clk", NULL, NULL, "gpio_120",
547 NULL, NULL, NULL, "safe_mode"),
548 _OMAP2430_MUXENTRY(USB0HS_DATA0, 0,
549 "usb0hs_data0", "uart3_tx_irtx", NULL, NULL,
550 "usb0_txen", NULL, NULL, "safe_mode"),
551 _OMAP2430_MUXENTRY(USB0HS_DATA1, 0,
552 "usb0hs_data1", "uart3_rx_irrx", NULL, NULL,
553 "usb0_dat", NULL, NULL, "safe_mode"),
554 _OMAP2430_MUXENTRY(USB0HS_DATA2, 0,
555 "usb0hs_data2", "uart3_rts_sd", NULL, NULL,
556 "usb0_se0", NULL, NULL, "safe_mode"),
557 _OMAP2430_MUXENTRY(USB0HS_DATA3, 106,
558 "usb0hs_data3", NULL, "uart3_cts_rctx", "gpio_106",
559 "usb0_puen", NULL, NULL, "safe_mode"),
560 _OMAP2430_MUXENTRY(USB0HS_DATA4, 107,
561 "usb0hs_data4", "mcbsp2_dr", NULL, "gpio_107",
562 "usb0_vp", NULL, NULL, "safe_mode"),
563 _OMAP2430_MUXENTRY(USB0HS_DATA5, 108,
564 "usb0hs_data5", "mcbsp2_dx", NULL, "gpio_108",
565 "usb0_vm", NULL, NULL, "safe_mode"),
566 _OMAP2430_MUXENTRY(USB0HS_DATA6, 109,
567 "usb0hs_data6", "mcbsp2_fsx", NULL, "gpio_109",
568 "usb0_rcv", NULL, NULL, "safe_mode"),
569 _OMAP2430_MUXENTRY(USB0HS_DATA7, 124,
570 "usb0hs_data7", "mcbsp2_clkx", NULL, "gpio_124",
571 NULL, NULL, NULL, "safe_mode"),
572 _OMAP2430_MUXENTRY(USB0HS_DIR, 121,
573 "usb0hs_dir", NULL, NULL, "gpio_121",
574 NULL, NULL, NULL, "safe_mode"),
575 _OMAP2430_MUXENTRY(USB0HS_NXT, 123,
576 "usb0hs_nxt", NULL, NULL, "gpio_123",
577 NULL, NULL, NULL, "safe_mode"),
578 _OMAP2430_MUXENTRY(USB0HS_STP, 122,
579 "usb0hs_stp", NULL, NULL, "gpio_122",
580 NULL, NULL, NULL, "safe_mode"),
581 { .reg_offset = OMAP_MUX_TERMINATOR },
582};
583
584/*
585 * Balls for POP package
586 * 447-pin s-PBGA Package, 0.00mm Ball Pitch (Bottom)
587 */
588#ifdef CONFIG_DEBUG_FS
589static struct omap_ball __initdata omap2430_pop_ball[] = {
590 _OMAP2430_BALLENTRY(CAM_D0, "t8", NULL),
591 _OMAP2430_BALLENTRY(CAM_D1, "t4", NULL),
592 _OMAP2430_BALLENTRY(CAM_D10, "r4", NULL),
593 _OMAP2430_BALLENTRY(CAM_D11, "w3", NULL),
594 _OMAP2430_BALLENTRY(CAM_D2, "r2", NULL),
595 _OMAP2430_BALLENTRY(CAM_D3, "u3", NULL),
596 _OMAP2430_BALLENTRY(CAM_D4, "u2", NULL),
597 _OMAP2430_BALLENTRY(CAM_D5, "v1", NULL),
598 _OMAP2430_BALLENTRY(CAM_D6, "t3", NULL),
599 _OMAP2430_BALLENTRY(CAM_D7, "r3", NULL),
600 _OMAP2430_BALLENTRY(CAM_D8, "u7", NULL),
601 _OMAP2430_BALLENTRY(CAM_D9, "t7", NULL),
602 _OMAP2430_BALLENTRY(CAM_HS, "p2", NULL),
603 _OMAP2430_BALLENTRY(CAM_LCLK, "r7", NULL),
604 _OMAP2430_BALLENTRY(CAM_VS, "n2", NULL),
605 _OMAP2430_BALLENTRY(CAM_XCLK, "p3", NULL),
606 _OMAP2430_BALLENTRY(DSS_ACBIAS, "y3", NULL),
607 _OMAP2430_BALLENTRY(DSS_DATA0, "v8", NULL),
608 _OMAP2430_BALLENTRY(DSS_DATA1, "w1", NULL),
609 _OMAP2430_BALLENTRY(DSS_DATA10, "k25", NULL),
610 _OMAP2430_BALLENTRY(DSS_DATA11, "j25", NULL),
611 _OMAP2430_BALLENTRY(DSS_DATA12, "k24", NULL),
612 _OMAP2430_BALLENTRY(DSS_DATA13, "j24", NULL),
613 _OMAP2430_BALLENTRY(DSS_DATA14, "h25", NULL),
614 _OMAP2430_BALLENTRY(DSS_DATA15, "g25", NULL),
615 _OMAP2430_BALLENTRY(DSS_DATA16, "ac3", NULL),
616 _OMAP2430_BALLENTRY(DSS_DATA17, "y7", NULL),
617 _OMAP2430_BALLENTRY(DSS_DATA2, "u8", NULL),
618 _OMAP2430_BALLENTRY(DSS_DATA3, "u4", NULL),
619 _OMAP2430_BALLENTRY(DSS_DATA4, "v3", NULL),
620 _OMAP2430_BALLENTRY(DSS_DATA5, "aa4", NULL),
621 _OMAP2430_BALLENTRY(DSS_DATA6, "w8", NULL),
622 _OMAP2430_BALLENTRY(DSS_DATA7, "y1", NULL),
623 _OMAP2430_BALLENTRY(DSS_DATA8, "aa2", NULL),
624 _OMAP2430_BALLENTRY(DSS_DATA9, "ab4", NULL),
625 _OMAP2430_BALLENTRY(DSS_HSYNC, "v2", NULL),
626 _OMAP2430_BALLENTRY(GPIO_113, "ad16", NULL),
627 _OMAP2430_BALLENTRY(GPIO_114, "ac10", NULL),
628 _OMAP2430_BALLENTRY(GPIO_115, "ad13", NULL),
629 _OMAP2430_BALLENTRY(GPIO_116, "ae15", NULL),
630 _OMAP2430_BALLENTRY(GPIO_128, "p1", NULL),
631 _OMAP2430_BALLENTRY(GPIO_129, "r1", NULL),
632 _OMAP2430_BALLENTRY(GPIO_130, "p7", NULL),
633 _OMAP2430_BALLENTRY(GPIO_131, "l8", NULL),
634 _OMAP2430_BALLENTRY(GPIO_132, "w24", NULL),
635 _OMAP2430_BALLENTRY(GPIO_133, "aa24", NULL),
636 _OMAP2430_BALLENTRY(GPIO_134, "ae12", NULL),
637 _OMAP2430_BALLENTRY(GPIO_135, "ae11", NULL),
638 _OMAP2430_BALLENTRY(GPIO_136, "ad12", NULL),
639 _OMAP2430_BALLENTRY(GPIO_137, "ad11", NULL),
640 _OMAP2430_BALLENTRY(GPIO_138, "y12", NULL),
641 _OMAP2430_BALLENTRY(GPIO_139, "ad17", NULL),
642 _OMAP2430_BALLENTRY(GPIO_140, "l7", NULL),
643 _OMAP2430_BALLENTRY(GPIO_141, "ac24", NULL),
644 _OMAP2430_BALLENTRY(GPIO_142, "m3", NULL),
645 _OMAP2430_BALLENTRY(GPIO_148, "af12", NULL),
646 _OMAP2430_BALLENTRY(GPIO_149, "k7", NULL),
647 _OMAP2430_BALLENTRY(GPIO_150, "m1", NULL),
648 _OMAP2430_BALLENTRY(GPIO_151, "ad14", NULL),
649 _OMAP2430_BALLENTRY(GPIO_152, "ad18", NULL),
650 _OMAP2430_BALLENTRY(GPIO_153, "u24", NULL),
651 _OMAP2430_BALLENTRY(GPIO_154, "ae16", NULL),
652 _OMAP2430_BALLENTRY(GPIO_63, "n3", NULL),
653 _OMAP2430_BALLENTRY(GPIO_7, "ac23", NULL),
654 _OMAP2430_BALLENTRY(GPIO_78, "ad10", NULL),
655 _OMAP2430_BALLENTRY(GPIO_79, "ae10", NULL),
656 _OMAP2430_BALLENTRY(GPIO_80, "ae13", NULL),
657 _OMAP2430_BALLENTRY(GPMC_A1, "a9", NULL),
658 _OMAP2430_BALLENTRY(GPMC_A10, "g12", NULL),
659 _OMAP2430_BALLENTRY(GPMC_A2, "b8", NULL),
660 _OMAP2430_BALLENTRY(GPMC_A3, "g10", NULL),
661 _OMAP2430_BALLENTRY(GPMC_A4, "g11", NULL),
662 _OMAP2430_BALLENTRY(GPMC_A5, "a10", NULL),
663 _OMAP2430_BALLENTRY(GPMC_A6, "g13", NULL),
664 _OMAP2430_BALLENTRY(GPMC_A7, "a6", NULL),
665 _OMAP2430_BALLENTRY(GPMC_A8, "h1", NULL),
666 _OMAP2430_BALLENTRY(GPMC_A9, "c8", NULL),
667 _OMAP2430_BALLENTRY(GPMC_CLK, "n1", "l1"),
668 _OMAP2430_BALLENTRY(GPMC_D10, "d1", "n1"),
669 _OMAP2430_BALLENTRY(GPMC_D11, "d2", "p2"),
670 _OMAP2430_BALLENTRY(GPMC_D12, "e1", "p1"),
671 _OMAP2430_BALLENTRY(GPMC_D13, "e3", "m1"),
672 _OMAP2430_BALLENTRY(GPMC_D14, "c7", "j2"),
673 _OMAP2430_BALLENTRY(GPMC_D15, "f3", "k2"),
674 _OMAP2430_BALLENTRY(GPMC_D8, "e2", "r1"),
675 _OMAP2430_BALLENTRY(GPMC_D9, "ab1", "t1"),
676 _OMAP2430_BALLENTRY(GPMC_NCS1, "ac1", "w1"),
677 _OMAP2430_BALLENTRY(GPMC_NCS2, "c6", NULL),
678 _OMAP2430_BALLENTRY(GPMC_NCS3, "b9", NULL),
679 _OMAP2430_BALLENTRY(GPMC_NCS4, "b4", NULL),
680 _OMAP2430_BALLENTRY(GPMC_NCS5, "a4", NULL),
681 _OMAP2430_BALLENTRY(GPMC_NCS6, "f1", NULL),
682 _OMAP2430_BALLENTRY(GPMC_NCS7, "a7", NULL),
683 _OMAP2430_BALLENTRY(GPMC_WAIT1, "j1", "y8"),
684 _OMAP2430_BALLENTRY(GPMC_WAIT2, "b7", NULL),
685 _OMAP2430_BALLENTRY(GPMC_WAIT3, "g14", NULL),
686 _OMAP2430_BALLENTRY(HDQ_SIO, "h20", NULL),
687 _OMAP2430_BALLENTRY(I2C1_SCL, "y17", NULL),
688 _OMAP2430_BALLENTRY(I2C1_SDA, "ac19", NULL),
689 _OMAP2430_BALLENTRY(I2C2_SCL, "n7", NULL),
690 _OMAP2430_BALLENTRY(I2C2_SDA, "m4", NULL),
691 _OMAP2430_BALLENTRY(JTAG_EMU0, "e25", NULL),
692 _OMAP2430_BALLENTRY(JTAG_EMU1, "e24", NULL),
693 _OMAP2430_BALLENTRY(MCBSP1_CLKR, "ab2", NULL),
694 _OMAP2430_BALLENTRY(MCBSP1_CLKX, "y9", NULL),
695 _OMAP2430_BALLENTRY(MCBSP1_DR, "af3", NULL),
696 _OMAP2430_BALLENTRY(MCBSP1_DX, "aa1", NULL),
697 _OMAP2430_BALLENTRY(MCBSP1_FSR, "ad5", NULL),
698 _OMAP2430_BALLENTRY(MCBSP1_FSX, "ab3", NULL),
699 _OMAP2430_BALLENTRY(MCBSP2_CLKX, "j26", NULL),
700 _OMAP2430_BALLENTRY(MCBSP2_DR, "k26", NULL),
701 _OMAP2430_BALLENTRY(MCBSP3_CLKX, "ac9", NULL),
702 _OMAP2430_BALLENTRY(MCBSP3_DR, "ae2", NULL),
703 _OMAP2430_BALLENTRY(MCBSP3_DX, "af4", NULL),
704 _OMAP2430_BALLENTRY(MCBSP3_FSX, "ae4", NULL),
705 _OMAP2430_BALLENTRY(MCBSP_CLKS, "ad6", NULL),
706 _OMAP2430_BALLENTRY(SDMMC1_CLKO, "n23", NULL),
707 _OMAP2430_BALLENTRY(SDMMC1_CMD, "l23", NULL),
708 _OMAP2430_BALLENTRY(SDMMC1_DAT0, "m24", NULL),
709 _OMAP2430_BALLENTRY(SDMMC1_DAT1, "p23", NULL),
710 _OMAP2430_BALLENTRY(SDMMC1_DAT2, "t20", NULL),
711 _OMAP2430_BALLENTRY(SDMMC1_DAT3, "r20", NULL),
712 _OMAP2430_BALLENTRY(SDMMC2_CLKO, "v26", NULL),
713 _OMAP2430_BALLENTRY(SDMMC2_CMD, "w20", NULL),
714 _OMAP2430_BALLENTRY(SDMMC2_DAT0, "v23", NULL),
715 _OMAP2430_BALLENTRY(SDMMC2_DAT1, "y24", NULL),
716 _OMAP2430_BALLENTRY(SDMMC2_DAT2, "v25", NULL),
717 _OMAP2430_BALLENTRY(SDMMC2_DAT3, "v24", NULL),
718 _OMAP2430_BALLENTRY(SDRC_A12, "w26", "r21"),
719 _OMAP2430_BALLENTRY(SDRC_A13, "af20", "aa15"),
720 _OMAP2430_BALLENTRY(SDRC_A14, "af16", "y12"),
721 _OMAP2430_BALLENTRY(SDRC_CKE1, "af15", "y13"),
722 _OMAP2430_BALLENTRY(SDRC_NCS1, "aa25", "t20"),
723 _OMAP2430_BALLENTRY(SPI1_CLK, "y18", NULL),
724 _OMAP2430_BALLENTRY(SPI1_CS0, "u1", NULL),
725 _OMAP2430_BALLENTRY(SPI1_CS1, "af19", NULL),
726 _OMAP2430_BALLENTRY(SPI1_CS2, "ae19", NULL),
727 _OMAP2430_BALLENTRY(SPI1_CS3, "h24", NULL),
728 _OMAP2430_BALLENTRY(SPI1_SIMO, "ad15", NULL),
729 _OMAP2430_BALLENTRY(SPI1_SOMI, "ae17", NULL),
730 _OMAP2430_BALLENTRY(SPI2_CLK, "y20", NULL),
731 _OMAP2430_BALLENTRY(SPI2_CS0, "y19", NULL),
732 _OMAP2430_BALLENTRY(SPI2_SIMO, "ac20", NULL),
733 _OMAP2430_BALLENTRY(SPI2_SOMI, "ad19", NULL),
734 _OMAP2430_BALLENTRY(SSI1_DAT_RX, "aa26", NULL),
735 _OMAP2430_BALLENTRY(SSI1_DAT_TX, "ad24", NULL),
736 _OMAP2430_BALLENTRY(SSI1_FLAG_RX, "ad23", NULL),
737 _OMAP2430_BALLENTRY(SSI1_FLAG_TX, "ab24", NULL),
738 _OMAP2430_BALLENTRY(SSI1_RDY_RX, "ab25", NULL),
739 _OMAP2430_BALLENTRY(SSI1_RDY_TX, "y25", NULL),
740 _OMAP2430_BALLENTRY(SSI1_WAKE, "ac25", NULL),
741 _OMAP2430_BALLENTRY(SYS_CLKOUT, "r25", NULL),
742 _OMAP2430_BALLENTRY(SYS_DRM_MSECURE, "ae3", NULL),
743 _OMAP2430_BALLENTRY(SYS_NIRQ0, "w25", NULL),
744 _OMAP2430_BALLENTRY(SYS_NIRQ1, "ad21", NULL),
745 _OMAP2430_BALLENTRY(UART1_CTS, "p24", NULL),
746 _OMAP2430_BALLENTRY(UART1_RTS, "p25", NULL),
747 _OMAP2430_BALLENTRY(UART1_RX, "n24", NULL),
748 _OMAP2430_BALLENTRY(UART1_TX, "r24", NULL),
749 _OMAP2430_BALLENTRY(UART2_CTS, "u25", NULL),
750 _OMAP2430_BALLENTRY(UART2_RTS, "t23", NULL),
751 _OMAP2430_BALLENTRY(UART2_RX, "t24", NULL),
752 _OMAP2430_BALLENTRY(UART2_TX, "u20", NULL),
753 _OMAP2430_BALLENTRY(UART3_CTS_RCTX, "m2", NULL),
754 _OMAP2430_BALLENTRY(UART3_RTS_SD, "k2", NULL),
755 _OMAP2430_BALLENTRY(UART3_RX_IRRX, "l3", NULL),
756 _OMAP2430_BALLENTRY(UART3_TX_IRTX, "l2", NULL),
757 _OMAP2430_BALLENTRY(USB0HS_CLK, "ae8", NULL),
758 _OMAP2430_BALLENTRY(USB0HS_DATA0, "ad4", NULL),
759 _OMAP2430_BALLENTRY(USB0HS_DATA1, "ae6", NULL),
760 _OMAP2430_BALLENTRY(USB0HS_DATA2, "af9", NULL),
761 _OMAP2430_BALLENTRY(USB0HS_DATA3, "ad9", NULL),
762 _OMAP2430_BALLENTRY(USB0HS_DATA4, "y11", NULL),
763 _OMAP2430_BALLENTRY(USB0HS_DATA5, "ad7", NULL),
764 _OMAP2430_BALLENTRY(USB0HS_DATA6, "ae7", NULL),
765 _OMAP2430_BALLENTRY(USB0HS_DATA7, "ac7", NULL),
766 _OMAP2430_BALLENTRY(USB0HS_DIR, "ad8", NULL),
767 _OMAP2430_BALLENTRY(USB0HS_NXT, "ae9", NULL),
768 _OMAP2430_BALLENTRY(USB0HS_STP, "ae5", NULL),
769 { .reg_offset = OMAP_MUX_TERMINATOR },
770};
771#else
772#define omap2430_pop_ball NULL
773#endif
774
775int __init omap2430_mux_init(struct omap_board_mux *board_subset, int flags)
776{
777 struct omap_ball *package_balls = NULL;
778
779 switch (flags & OMAP_PACKAGE_MASK) {
780 case OMAP_PACKAGE_ZAC:
781 package_balls = omap2430_pop_ball;
782 break;
783 default:
784 pr_warning("%s: No ball data available for omap2420 package\n",
785 __func__);
786 }
787
788 return omap_mux_init("core", OMAP_MUX_REG_8BIT | OMAP_MUX_GPIO_IN_MODE3,
789 OMAP2430_CONTROL_PADCONF_MUX_PBASE,
790 OMAP2430_CONTROL_PADCONF_MUX_SIZE,
791 omap2430_muxmodes, NULL, board_subset,
792 package_balls);
793}
diff --git a/arch/arm/mach-omap2/mux2430.h b/arch/arm/mach-omap2/mux2430.h
deleted file mode 100644
index 9fd93149ebd9..000000000000
--- a/arch/arm/mach-omap2/mux2430.h
+++ /dev/null
@@ -1,370 +0,0 @@
1/*
2 * Copyright (C) 2009 Nokia
3 * Copyright (C) 2009 Texas Instruments
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 OMAP2430_CONTROL_PADCONF_MUX_PBASE 0x49002030LU
11
12#define OMAP2430_MUX(mode0, mux_value) \
13{ \
14 .reg_offset = (OMAP2430_CONTROL_PADCONF_##mode0##_OFFSET), \
15 .value = (mux_value), \
16}
17
18/*
19 * OMAP2430 CONTROL_PADCONF* register offsets for pin-muxing
20 *
21 * Extracted from the TRM. Add 0x49002030 to these values to get the
22 * absolute addresses. The name in the macro is the mode-0 name of
23 * the pin. NOTE: These registers are 8-bits wide.
24 *
25 * Note that these defines use SDMMC instead of MMC for compatibility
26 * with signal names used in 3630.
27 */
28#define OMAP2430_CONTROL_PADCONF_GPMC_CLK_OFFSET 0x000
29#define OMAP2430_CONTROL_PADCONF_GPMC_NCS0_OFFSET 0x001
30#define OMAP2430_CONTROL_PADCONF_GPMC_NCS1_OFFSET 0x002
31#define OMAP2430_CONTROL_PADCONF_GPMC_NCS2_OFFSET 0x003
32#define OMAP2430_CONTROL_PADCONF_GPMC_NCS3_OFFSET 0x004
33#define OMAP2430_CONTROL_PADCONF_GPMC_NCS4_OFFSET 0x005
34#define OMAP2430_CONTROL_PADCONF_GPMC_NCS5_OFFSET 0x006
35#define OMAP2430_CONTROL_PADCONF_GPMC_NCS6_OFFSET 0x007
36#define OMAP2430_CONTROL_PADCONF_GPMC_NCS7_OFFSET 0x008
37#define OMAP2430_CONTROL_PADCONF_GPMC_NADV_ALE_OFFSET 0x009
38#define OMAP2430_CONTROL_PADCONF_GPMC_NOE_NRE_OFFSET 0x00a
39#define OMAP2430_CONTROL_PADCONF_GPMC_NWE_OFFSET 0x00b
40#define OMAP2430_CONTROL_PADCONF_GPMC_NBE0_CLE_OFFSET 0x00c
41#define OMAP2430_CONTROL_PADCONF_GPMC_NBE1_OFFSET 0x00d
42#define OMAP2430_CONTROL_PADCONF_GPMC_NWP_OFFSET 0x00e
43#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT0_OFFSET 0x00f
44#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT1_OFFSET 0x010
45#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT2_OFFSET 0x011
46#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT3_OFFSET 0x012
47#define OMAP2430_CONTROL_PADCONF_SDRC_CLK_OFFSET 0x013
48#define OMAP2430_CONTROL_PADCONF_SDRC_NCLK_OFFSET 0x014
49#define OMAP2430_CONTROL_PADCONF_SDRC_NCS0_OFFSET 0x015
50#define OMAP2430_CONTROL_PADCONF_SDRC_NCS1_OFFSET 0x016
51#define OMAP2430_CONTROL_PADCONF_SDRC_CKE0_OFFSET 0x017
52#define OMAP2430_CONTROL_PADCONF_SDRC_CKE1_OFFSET 0x018
53#define OMAP2430_CONTROL_PADCONF_SDRC_NRAS_OFFSET 0x019
54#define OMAP2430_CONTROL_PADCONF_SDRC_NCAS_OFFSET 0x01a
55#define OMAP2430_CONTROL_PADCONF_SDRC_NWE_OFFSET 0x01b
56#define OMAP2430_CONTROL_PADCONF_SDRC_DM0_OFFSET 0x01c
57#define OMAP2430_CONTROL_PADCONF_SDRC_DM1_OFFSET 0x01d
58#define OMAP2430_CONTROL_PADCONF_SDRC_DM2_OFFSET 0x01e
59#define OMAP2430_CONTROL_PADCONF_SDRC_DM3_OFFSET 0x01f
60#define OMAP2430_CONTROL_PADCONF_SDRC_DQS0_OFFSET 0x020
61#define OMAP2430_CONTROL_PADCONF_SDRC_DQS1_OFFSET 0x021
62#define OMAP2430_CONTROL_PADCONF_SDRC_DQS2_OFFSET 0x022
63#define OMAP2430_CONTROL_PADCONF_SDRC_DQS3_OFFSET 0x023
64#define OMAP2430_CONTROL_PADCONF_SDRC_A14_OFFSET 0x024
65#define OMAP2430_CONTROL_PADCONF_SDRC_A13_OFFSET 0x025
66#define OMAP2430_CONTROL_PADCONF_SDRC_A12_OFFSET 0x026
67#define OMAP2430_CONTROL_PADCONF_SDRC_BA1_OFFSET 0x027
68#define OMAP2430_CONTROL_PADCONF_SDRC_BA0_OFFSET 0x028
69#define OMAP2430_CONTROL_PADCONF_SDRC_A11_OFFSET 0x029
70#define OMAP2430_CONTROL_PADCONF_SDRC_A10_OFFSET 0x02a
71#define OMAP2430_CONTROL_PADCONF_SDRC_A9_OFFSET 0x02b
72#define OMAP2430_CONTROL_PADCONF_SDRC_A8_OFFSET 0x02c
73#define OMAP2430_CONTROL_PADCONF_SDRC_A7_OFFSET 0x02d
74#define OMAP2430_CONTROL_PADCONF_SDRC_A6_OFFSET 0x02e
75#define OMAP2430_CONTROL_PADCONF_SDRC_A5_OFFSET 0x02f
76#define OMAP2430_CONTROL_PADCONF_SDRC_A4_OFFSET 0x030
77#define OMAP2430_CONTROL_PADCONF_SDRC_A3_OFFSET 0x031
78#define OMAP2430_CONTROL_PADCONF_SDRC_A2_OFFSET 0x032
79#define OMAP2430_CONTROL_PADCONF_SDRC_A1_OFFSET 0x033
80#define OMAP2430_CONTROL_PADCONF_SDRC_A0_OFFSET 0x034
81#define OMAP2430_CONTROL_PADCONF_SDRC_D31_OFFSET 0x035
82#define OMAP2430_CONTROL_PADCONF_SDRC_D30_OFFSET 0x036
83#define OMAP2430_CONTROL_PADCONF_SDRC_D29_OFFSET 0x037
84#define OMAP2430_CONTROL_PADCONF_SDRC_D28_OFFSET 0x038
85#define OMAP2430_CONTROL_PADCONF_SDRC_D27_OFFSET 0x039
86#define OMAP2430_CONTROL_PADCONF_SDRC_D26_OFFSET 0x03a
87#define OMAP2430_CONTROL_PADCONF_SDRC_D25_OFFSET 0x03b
88#define OMAP2430_CONTROL_PADCONF_SDRC_D24_OFFSET 0x03c
89#define OMAP2430_CONTROL_PADCONF_SDRC_D23_OFFSET 0x03d
90#define OMAP2430_CONTROL_PADCONF_SDRC_D22_OFFSET 0x03e
91#define OMAP2430_CONTROL_PADCONF_SDRC_D21_OFFSET 0x03f
92#define OMAP2430_CONTROL_PADCONF_SDRC_D20_OFFSET 0x040
93#define OMAP2430_CONTROL_PADCONF_SDRC_D19_OFFSET 0x041
94#define OMAP2430_CONTROL_PADCONF_SDRC_D18_OFFSET 0x042
95#define OMAP2430_CONTROL_PADCONF_SDRC_D17_OFFSET 0x043
96#define OMAP2430_CONTROL_PADCONF_SDRC_D16_OFFSET 0x044
97#define OMAP2430_CONTROL_PADCONF_SDRC_D15_OFFSET 0x045
98#define OMAP2430_CONTROL_PADCONF_SDRC_D14_OFFSET 0x046
99#define OMAP2430_CONTROL_PADCONF_SDRC_D13_OFFSET 0x047
100#define OMAP2430_CONTROL_PADCONF_SDRC_D12_OFFSET 0x048
101#define OMAP2430_CONTROL_PADCONF_SDRC_D11_OFFSET 0x049
102#define OMAP2430_CONTROL_PADCONF_SDRC_D10_OFFSET 0x04a
103#define OMAP2430_CONTROL_PADCONF_SDRC_D9_OFFSET 0x04b
104#define OMAP2430_CONTROL_PADCONF_SDRC_D8_OFFSET 0x04c
105#define OMAP2430_CONTROL_PADCONF_SDRC_D7_OFFSET 0x04d
106#define OMAP2430_CONTROL_PADCONF_SDRC_D6_OFFSET 0x04e
107#define OMAP2430_CONTROL_PADCONF_SDRC_D5_OFFSET 0x04f
108#define OMAP2430_CONTROL_PADCONF_SDRC_D4_OFFSET 0x050
109#define OMAP2430_CONTROL_PADCONF_SDRC_D3_OFFSET 0x051
110#define OMAP2430_CONTROL_PADCONF_SDRC_D2_OFFSET 0x052
111#define OMAP2430_CONTROL_PADCONF_SDRC_D1_OFFSET 0x053
112#define OMAP2430_CONTROL_PADCONF_SDRC_D0_OFFSET 0x054
113#define OMAP2430_CONTROL_PADCONF_GPMC_A10_OFFSET 0x055
114#define OMAP2430_CONTROL_PADCONF_GPMC_A9_OFFSET 0x056
115#define OMAP2430_CONTROL_PADCONF_GPMC_A8_OFFSET 0x057
116#define OMAP2430_CONTROL_PADCONF_GPMC_A7_OFFSET 0x058
117#define OMAP2430_CONTROL_PADCONF_GPMC_A6_OFFSET 0x059
118#define OMAP2430_CONTROL_PADCONF_GPMC_A5_OFFSET 0x05a
119#define OMAP2430_CONTROL_PADCONF_GPMC_A4_OFFSET 0x05b
120#define OMAP2430_CONTROL_PADCONF_GPMC_A3_OFFSET 0x05c
121#define OMAP2430_CONTROL_PADCONF_GPMC_A2_OFFSET 0x05d
122#define OMAP2430_CONTROL_PADCONF_GPMC_A1_OFFSET 0x05e
123#define OMAP2430_CONTROL_PADCONF_GPMC_D15_OFFSET 0x05f
124#define OMAP2430_CONTROL_PADCONF_GPMC_D14_OFFSET 0x060
125#define OMAP2430_CONTROL_PADCONF_GPMC_D13_OFFSET 0x061
126#define OMAP2430_CONTROL_PADCONF_GPMC_D12_OFFSET 0x062
127#define OMAP2430_CONTROL_PADCONF_GPMC_D11_OFFSET 0x063
128#define OMAP2430_CONTROL_PADCONF_GPMC_D10_OFFSET 0x064
129#define OMAP2430_CONTROL_PADCONF_GPMC_D9_OFFSET 0x065
130#define OMAP2430_CONTROL_PADCONF_GPMC_D8_OFFSET 0x066
131#define OMAP2430_CONTROL_PADCONF_GPMC_D7_OFFSET 0x067
132#define OMAP2430_CONTROL_PADCONF_GPMC_D6_OFFSET 0x068
133#define OMAP2430_CONTROL_PADCONF_GPMC_D5_OFFSET 0x069
134#define OMAP2430_CONTROL_PADCONF_GPMC_D4_OFFSET 0x06a
135#define OMAP2430_CONTROL_PADCONF_GPMC_D3_OFFSET 0x06b
136#define OMAP2430_CONTROL_PADCONF_GPMC_D2_OFFSET 0x06c
137#define OMAP2430_CONTROL_PADCONF_GPMC_D1_OFFSET 0x06d
138#define OMAP2430_CONTROL_PADCONF_GPMC_D0_OFFSET 0x06e
139#define OMAP2430_CONTROL_PADCONF_DSS_DATA0_OFFSET 0x06f
140#define OMAP2430_CONTROL_PADCONF_DSS_DATA1_OFFSET 0x070
141#define OMAP2430_CONTROL_PADCONF_DSS_DATA2_OFFSET 0x071
142#define OMAP2430_CONTROL_PADCONF_DSS_DATA3_OFFSET 0x072
143#define OMAP2430_CONTROL_PADCONF_DSS_DATA4_OFFSET 0x073
144#define OMAP2430_CONTROL_PADCONF_DSS_DATA5_OFFSET 0x074
145#define OMAP2430_CONTROL_PADCONF_DSS_DATA6_OFFSET 0x075
146#define OMAP2430_CONTROL_PADCONF_DSS_DATA7_OFFSET 0x076
147#define OMAP2430_CONTROL_PADCONF_DSS_DATA8_OFFSET 0x077
148#define OMAP2430_CONTROL_PADCONF_DSS_DATA9_OFFSET 0x078
149#define OMAP2430_CONTROL_PADCONF_DSS_DATA10_OFFSET 0x079
150#define OMAP2430_CONTROL_PADCONF_DSS_DATA11_OFFSET 0x07a
151#define OMAP2430_CONTROL_PADCONF_DSS_DATA12_OFFSET 0x07b
152#define OMAP2430_CONTROL_PADCONF_DSS_DATA13_OFFSET 0x07c
153#define OMAP2430_CONTROL_PADCONF_DSS_DATA14_OFFSET 0x07d
154#define OMAP2430_CONTROL_PADCONF_DSS_DATA15_OFFSET 0x07e
155#define OMAP2430_CONTROL_PADCONF_DSS_DATA16_OFFSET 0x07f
156#define OMAP2430_CONTROL_PADCONF_DSS_DATA17_OFFSET 0x080
157#define OMAP2430_CONTROL_PADCONF_UART1_CTS_OFFSET 0x081
158#define OMAP2430_CONTROL_PADCONF_UART1_RTS_OFFSET 0x082
159#define OMAP2430_CONTROL_PADCONF_UART1_TX_OFFSET 0x083
160#define OMAP2430_CONTROL_PADCONF_UART1_RX_OFFSET 0x084
161#define OMAP2430_CONTROL_PADCONF_MCBSP2_DR_OFFSET 0x085
162#define OMAP2430_CONTROL_PADCONF_MCBSP2_CLKX_OFFSET 0x086
163#define OMAP2430_CONTROL_PADCONF_DSS_PCLK_OFFSET 0x087
164#define OMAP2430_CONTROL_PADCONF_DSS_VSYNC_OFFSET 0x088
165#define OMAP2430_CONTROL_PADCONF_DSS_HSYNC_OFFSET 0x089
166#define OMAP2430_CONTROL_PADCONF_DSS_ACBIAS_OFFSET 0x08a
167#define OMAP2430_CONTROL_PADCONF_SYS_NRESPWRON_OFFSET 0x08b
168#define OMAP2430_CONTROL_PADCONF_SYS_NRESWARM_OFFSET 0x08c
169#define OMAP2430_CONTROL_PADCONF_SYS_NIRQ0_OFFSET 0x08d
170#define OMAP2430_CONTROL_PADCONF_SYS_NIRQ1_OFFSET 0x08e
171#define OMAP2430_CONTROL_PADCONF_SYS_VMODE_OFFSET 0x08f
172#define OMAP2430_CONTROL_PADCONF_GPIO_128_OFFSET 0x090
173#define OMAP2430_CONTROL_PADCONF_GPIO_129_OFFSET 0x091
174#define OMAP2430_CONTROL_PADCONF_GPIO_130_OFFSET 0x092
175#define OMAP2430_CONTROL_PADCONF_GPIO_131_OFFSET 0x093
176#define OMAP2430_CONTROL_PADCONF_SYS_32K_OFFSET 0x094
177#define OMAP2430_CONTROL_PADCONF_SYS_XTALIN_OFFSET 0x095
178#define OMAP2430_CONTROL_PADCONF_SYS_XTALOUT_OFFSET 0x096
179#define OMAP2430_CONTROL_PADCONF_GPIO_132_OFFSET 0x097
180#define OMAP2430_CONTROL_PADCONF_SYS_CLKREQ_OFFSET 0x098
181#define OMAP2430_CONTROL_PADCONF_SYS_CLKOUT_OFFSET 0x099
182#define OMAP2430_CONTROL_PADCONF_GPIO_151_OFFSET 0x09a
183#define OMAP2430_CONTROL_PADCONF_GPIO_133_OFFSET 0x09b
184#define OMAP2430_CONTROL_PADCONF_JTAG_EMU1_OFFSET 0x09c
185#define OMAP2430_CONTROL_PADCONF_JTAG_EMU0_OFFSET 0x09d
186#define OMAP2430_CONTROL_PADCONF_JTAG_NTRST_OFFSET 0x09e
187#define OMAP2430_CONTROL_PADCONF_JTAG_TCK_OFFSET 0x09f
188#define OMAP2430_CONTROL_PADCONF_JTAG_RTCK_OFFSET 0x0a0
189#define OMAP2430_CONTROL_PADCONF_JTAG_TMS_OFFSET 0x0a1
190#define OMAP2430_CONTROL_PADCONF_JTAG_TDI_OFFSET 0x0a2
191#define OMAP2430_CONTROL_PADCONF_JTAG_TDO_OFFSET 0x0a3
192#define OMAP2430_CONTROL_PADCONF_CAM_D9_OFFSET 0x0a4
193#define OMAP2430_CONTROL_PADCONF_CAM_D8_OFFSET 0x0a5
194#define OMAP2430_CONTROL_PADCONF_CAM_D7_OFFSET 0x0a6
195#define OMAP2430_CONTROL_PADCONF_CAM_D6_OFFSET 0x0a7
196#define OMAP2430_CONTROL_PADCONF_CAM_D5_OFFSET 0x0a8
197#define OMAP2430_CONTROL_PADCONF_CAM_D4_OFFSET 0x0a9
198#define OMAP2430_CONTROL_PADCONF_CAM_D3_OFFSET 0x0aa
199#define OMAP2430_CONTROL_PADCONF_CAM_D2_OFFSET 0x0ab
200#define OMAP2430_CONTROL_PADCONF_CAM_D1_OFFSET 0x0ac
201#define OMAP2430_CONTROL_PADCONF_CAM_D0_OFFSET 0x0ad
202#define OMAP2430_CONTROL_PADCONF_CAM_HS_OFFSET 0x0ae
203#define OMAP2430_CONTROL_PADCONF_CAM_VS_OFFSET 0x0af
204#define OMAP2430_CONTROL_PADCONF_CAM_LCLK_OFFSET 0x0b0
205#define OMAP2430_CONTROL_PADCONF_CAM_XCLK_OFFSET 0x0b1
206#define OMAP2430_CONTROL_PADCONF_CAM_D11_OFFSET 0x0b2
207#define OMAP2430_CONTROL_PADCONF_CAM_D10_OFFSET 0x0b3
208#define OMAP2430_CONTROL_PADCONF_GPIO_134_OFFSET 0x0b4
209#define OMAP2430_CONTROL_PADCONF_GPIO_135_OFFSET 0x0b5
210#define OMAP2430_CONTROL_PADCONF_GPIO_136_OFFSET 0x0b6
211#define OMAP2430_CONTROL_PADCONF_GPIO_137_OFFSET 0x0b7
212#define OMAP2430_CONTROL_PADCONF_GPIO_138_OFFSET 0x0b8
213#define OMAP2430_CONTROL_PADCONF_GPIO_139_OFFSET 0x0b9
214#define OMAP2430_CONTROL_PADCONF_GPIO_140_OFFSET 0x0ba
215#define OMAP2430_CONTROL_PADCONF_GPIO_141_OFFSET 0x0bb
216#define OMAP2430_CONTROL_PADCONF_GPIO_142_OFFSET 0x0bc
217#define OMAP2430_CONTROL_PADCONF_GPIO_154_OFFSET 0x0bd
218#define OMAP2430_CONTROL_PADCONF_GPIO_148_OFFSET 0x0be
219#define OMAP2430_CONTROL_PADCONF_GPIO_149_OFFSET 0x0bf
220#define OMAP2430_CONTROL_PADCONF_GPIO_150_OFFSET 0x0c0
221#define OMAP2430_CONTROL_PADCONF_GPIO_152_OFFSET 0x0c1
222#define OMAP2430_CONTROL_PADCONF_GPIO_153_OFFSET 0x0c2
223#define OMAP2430_CONTROL_PADCONF_SDMMC1_CLKO_OFFSET 0x0c3
224#define OMAP2430_CONTROL_PADCONF_SDMMC1_CMD_OFFSET 0x0c4
225#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT0_OFFSET 0x0c5
226#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT1_OFFSET 0x0c6
227#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT2_OFFSET 0x0c7
228#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT3_OFFSET 0x0c8
229#define OMAP2430_CONTROL_PADCONF_SDMMC2_CLKO_OFFSET 0x0c9
230#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT3_OFFSET 0x0ca
231#define OMAP2430_CONTROL_PADCONF_SDMMC2_CMD_OFFSET 0x0cb
232#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT0_OFFSET 0x0cc
233#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT2_OFFSET 0x0cd
234#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT1_OFFSET 0x0ce
235#define OMAP2430_CONTROL_PADCONF_UART2_CTS_OFFSET 0x0cf
236#define OMAP2430_CONTROL_PADCONF_UART2_RTS_OFFSET 0x0d0
237#define OMAP2430_CONTROL_PADCONF_UART2_TX_OFFSET 0x0d1
238#define OMAP2430_CONTROL_PADCONF_UART2_RX_OFFSET 0x0d2
239#define OMAP2430_CONTROL_PADCONF_MCBSP3_CLKX_OFFSET 0x0d3
240#define OMAP2430_CONTROL_PADCONF_MCBSP3_FSX_OFFSET 0x0d4
241#define OMAP2430_CONTROL_PADCONF_MCBSP3_DR_OFFSET 0x0d5
242#define OMAP2430_CONTROL_PADCONF_MCBSP3_DX_OFFSET 0x0d6
243#define OMAP2430_CONTROL_PADCONF_SSI1_DAT_TX_OFFSET 0x0d7
244#define OMAP2430_CONTROL_PADCONF_SSI1_FLAG_TX_OFFSET 0x0d8
245#define OMAP2430_CONTROL_PADCONF_SSI1_RDY_TX_OFFSET 0x0d9
246#define OMAP2430_CONTROL_PADCONF_SSI1_DAT_RX_OFFSET 0x0da
247#define OMAP2430_CONTROL_PADCONF_GPIO_63_OFFSET 0x0db
248#define OMAP2430_CONTROL_PADCONF_SSI1_FLAG_RX_OFFSET 0x0dc
249#define OMAP2430_CONTROL_PADCONF_SSI1_RDY_RX_OFFSET 0x0dd
250#define OMAP2430_CONTROL_PADCONF_SSI1_WAKE_OFFSET 0x0de
251#define OMAP2430_CONTROL_PADCONF_SPI1_CLK_OFFSET 0x0df
252#define OMAP2430_CONTROL_PADCONF_SPI1_SIMO_OFFSET 0x0e0
253#define OMAP2430_CONTROL_PADCONF_SPI1_SOMI_OFFSET 0x0e1
254#define OMAP2430_CONTROL_PADCONF_SPI1_CS0_OFFSET 0x0e2
255#define OMAP2430_CONTROL_PADCONF_SPI1_CS1_OFFSET 0x0e3
256#define OMAP2430_CONTROL_PADCONF_SPI1_CS2_OFFSET 0x0e4
257#define OMAP2430_CONTROL_PADCONF_SPI1_CS3_OFFSET 0x0e5
258#define OMAP2430_CONTROL_PADCONF_SPI2_CLK_OFFSET 0x0e6
259#define OMAP2430_CONTROL_PADCONF_SPI2_SIMO_OFFSET 0x0e7
260#define OMAP2430_CONTROL_PADCONF_SPI2_SOMI_OFFSET 0x0e8
261#define OMAP2430_CONTROL_PADCONF_SPI2_CS0_OFFSET 0x0e9
262#define OMAP2430_CONTROL_PADCONF_MCBSP1_CLKR_OFFSET 0x0ea
263#define OMAP2430_CONTROL_PADCONF_MCBSP1_FSR_OFFSET 0x0eb
264#define OMAP2430_CONTROL_PADCONF_MCBSP1_DX_OFFSET 0x0ec
265#define OMAP2430_CONTROL_PADCONF_MCBSP1_DR_OFFSET 0x0ed
266#define OMAP2430_CONTROL_PADCONF_MCBSP_CLKS_OFFSET 0x0ee
267#define OMAP2430_CONTROL_PADCONF_MCBSP1_FSX_OFFSET 0x0ef
268#define OMAP2430_CONTROL_PADCONF_MCBSP1_CLKX_OFFSET 0x0f0
269#define OMAP2430_CONTROL_PADCONF_I2C1_SCL_OFFSET 0x0f1
270#define OMAP2430_CONTROL_PADCONF_I2C1_SDA_OFFSET 0x0f2
271#define OMAP2430_CONTROL_PADCONF_I2C2_SCL_OFFSET 0x0f3
272#define OMAP2430_CONTROL_PADCONF_I2C2_SDA_OFFSET 0x0f4
273#define OMAP2430_CONTROL_PADCONF_HDQ_SIO_OFFSET 0x0f5
274#define OMAP2430_CONTROL_PADCONF_UART3_CTS_RCTX_OFFSET 0x0f6
275#define OMAP2430_CONTROL_PADCONF_UART3_RTS_SD_OFFSET 0x0f7
276#define OMAP2430_CONTROL_PADCONF_UART3_TX_IRTX_OFFSET 0x0f8
277#define OMAP2430_CONTROL_PADCONF_UART3_RX_IRRX_OFFSET 0x0f9
278#define OMAP2430_CONTROL_PADCONF_GPIO_7_OFFSET 0x0fa
279#define OMAP2430_CONTROL_PADCONF_GPIO_78_OFFSET 0x0fb
280#define OMAP2430_CONTROL_PADCONF_GPIO_79_OFFSET 0x0fc
281#define OMAP2430_CONTROL_PADCONF_GPIO_80_OFFSET 0x0fd
282#define OMAP2430_CONTROL_PADCONF_GPIO_113_OFFSET 0x0fe
283#define OMAP2430_CONTROL_PADCONF_GPIO_114_OFFSET 0x0ff
284#define OMAP2430_CONTROL_PADCONF_GPIO_115_OFFSET 0x100
285#define OMAP2430_CONTROL_PADCONF_GPIO_116_OFFSET 0x101
286#define OMAP2430_CONTROL_PADCONF_SYS_DRM_MSECURE_OFFSET 0x102
287#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA3_OFFSET 0x103
288#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA4_OFFSET 0x104
289#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA5_OFFSET 0x105
290#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA6_OFFSET 0x106
291#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA2_OFFSET 0x107
292#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA0_OFFSET 0x108
293#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA1_OFFSET 0x109
294#define OMAP2430_CONTROL_PADCONF_USB0HS_CLK_OFFSET 0x10a
295#define OMAP2430_CONTROL_PADCONF_USB0HS_DIR_OFFSET 0x10b
296#define OMAP2430_CONTROL_PADCONF_USB0HS_STP_OFFSET 0x10c
297#define OMAP2430_CONTROL_PADCONF_USB0HS_NXT_OFFSET 0x10d
298#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA7_OFFSET 0x10e
299#define OMAP2430_CONTROL_PADCONF_TV_OUT_OFFSET 0x10f
300#define OMAP2430_CONTROL_PADCONF_TV_VREF_OFFSET 0x110
301#define OMAP2430_CONTROL_PADCONF_TV_RSET_OFFSET 0x111
302#define OMAP2430_CONTROL_PADCONF_TV_VFB_OFFSET 0x112
303#define OMAP2430_CONTROL_PADCONF_TV_DACOUT_OFFSET 0x113
304#define OMAP2430_CONTROL_PADCONF_AD2DMCAD0_OFFSET 0x114
305#define OMAP2430_CONTROL_PADCONF_AD2DMCAD1_OFFSET 0x115
306#define OMAP2430_CONTROL_PADCONF_AD2DMCAD2_OFFSET 0x116
307#define OMAP2430_CONTROL_PADCONF_AD2DMCAD3_OFFSET 0x117
308#define OMAP2430_CONTROL_PADCONF_AD2DMCAD4_OFFSET 0x118
309#define OMAP2430_CONTROL_PADCONF_AD2DMCAD5_OFFSET 0x119
310#define OMAP2430_CONTROL_PADCONF_AD2DMCAD6_OFFSET 0x11a
311#define OMAP2430_CONTROL_PADCONF_AD2DMCAD7_OFFSET 0x11b
312#define OMAP2430_CONTROL_PADCONF_AD2DMCAD8_OFFSET 0x11c
313#define OMAP2430_CONTROL_PADCONF_AD2DMCAD9_OFFSET 0x11d
314#define OMAP2430_CONTROL_PADCONF_AD2DMCAD10_OFFSET 0x11e
315#define OMAP2430_CONTROL_PADCONF_AD2DMCAD11_OFFSET 0x11f
316#define OMAP2430_CONTROL_PADCONF_AD2DMCAD12_OFFSET 0x120
317#define OMAP2430_CONTROL_PADCONF_AD2DMCAD13_OFFSET 0x121
318#define OMAP2430_CONTROL_PADCONF_AD2DMCAD14_OFFSET 0x122
319#define OMAP2430_CONTROL_PADCONF_AD2DMCAD15_OFFSET 0x123
320#define OMAP2430_CONTROL_PADCONF_AD2DMCAD16_OFFSET 0x124
321#define OMAP2430_CONTROL_PADCONF_AD2DMCAD17_OFFSET 0x125
322#define OMAP2430_CONTROL_PADCONF_AD2DMCAD18_OFFSET 0x126
323#define OMAP2430_CONTROL_PADCONF_AD2DMCAD19_OFFSET 0x127
324#define OMAP2430_CONTROL_PADCONF_AD2DMCAD20_OFFSET 0x128
325#define OMAP2430_CONTROL_PADCONF_AD2DMCAD21_OFFSET 0x129
326#define OMAP2430_CONTROL_PADCONF_AD2DMCAD22_OFFSET 0x12a
327#define OMAP2430_CONTROL_PADCONF_AD2DMCAD23_OFFSET 0x12b
328#define OMAP2430_CONTROL_PADCONF_AD2DMCAD24_OFFSET 0x12c
329#define OMAP2430_CONTROL_PADCONF_AD2DMCAD25_OFFSET 0x12d
330#define OMAP2430_CONTROL_PADCONF_AD2DMCAD26_OFFSET 0x12e
331#define OMAP2430_CONTROL_PADCONF_AD2DMCAD27_OFFSET 0x12f
332#define OMAP2430_CONTROL_PADCONF_AD2DMCAD28_OFFSET 0x130
333#define OMAP2430_CONTROL_PADCONF_AD2DMCAD29_OFFSET 0x131
334#define OMAP2430_CONTROL_PADCONF_AD2DMCAD30_OFFSET 0x132
335#define OMAP2430_CONTROL_PADCONF_AD2DMCAD31_OFFSET 0x133
336#define OMAP2430_CONTROL_PADCONF_AD2DMCAD32_OFFSET 0x134
337#define OMAP2430_CONTROL_PADCONF_AD2DMCAD33_OFFSET 0x135
338#define OMAP2430_CONTROL_PADCONF_AD2DMCAD34_OFFSET 0x136
339#define OMAP2430_CONTROL_PADCONF_AD2DMCAD35_OFFSET 0x137
340#define OMAP2430_CONTROL_PADCONF_AD2DMCAD36_OFFSET 0x138
341#define OMAP2430_CONTROL_PADCONF_AD2DMCAD37_OFFSET 0x139
342#define OMAP2430_CONTROL_PADCONF_AD2DMWRITE_OFFSET 0x13a
343#define OMAP2430_CONTROL_PADCONF_D2DCLK26MI_OFFSET 0x13b
344#define OMAP2430_CONTROL_PADCONF_D2DNRESPWRON1_OFFSET 0x13c
345#define OMAP2430_CONTROL_PADCONF_D2DNRESWARM_OFFSET 0x13d
346#define OMAP2430_CONTROL_PADCONF_D2DARM9NIRQ_OFFSET 0x13e
347#define OMAP2430_CONTROL_PADCONF_D2DUMA2P6FIQ_OFFSET 0x13f
348#define OMAP2430_CONTROL_PADCONF_D2DSPINT_OFFSET 0x140
349#define OMAP2430_CONTROL_PADCONF_D2DFRINT_OFFSET 0x141
350#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ0_OFFSET 0x142
351#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ1_OFFSET 0x143
352#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ2_OFFSET 0x144
353#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ3_OFFSET 0x145
354#define OMAP2430_CONTROL_PADCONF_D2DN3GTRST_OFFSET 0x146
355#define OMAP2430_CONTROL_PADCONF_D2DN3GTDI_OFFSET 0x147
356#define OMAP2430_CONTROL_PADCONF_D2DN3GTDO_OFFSET 0x148
357#define OMAP2430_CONTROL_PADCONF_D2DN3GTMS_OFFSET 0x149
358#define OMAP2430_CONTROL_PADCONF_D2DN3GTCK_OFFSET 0x14a
359#define OMAP2430_CONTROL_PADCONF_D2DN3GRTCK_OFFSET 0x14b
360#define OMAP2430_CONTROL_PADCONF_D2DMSTDBY_OFFSET 0x14c
361#define OMAP2430_CONTROL_PADCONF_AD2DSREAD_OFFSET 0x14d
362#define OMAP2430_CONTROL_PADCONF_D2DSWAKEUP_OFFSET 0x14e
363#define OMAP2430_CONTROL_PADCONF_D2DIDLEREQ_OFFSET 0x14f
364#define OMAP2430_CONTROL_PADCONF_D2DIDLEACK_OFFSET 0x150
365#define OMAP2430_CONTROL_PADCONF_D2DSPARE0_OFFSET 0x151
366#define OMAP2430_CONTROL_PADCONF_AD2DSWRITE_OFFSET 0x152
367#define OMAP2430_CONTROL_PADCONF_AD2DMREAD_OFFSET 0x153
368
369#define OMAP2430_CONTROL_PADCONF_MUX_SIZE \
370 (OMAP2430_CONTROL_PADCONF_AD2DMREAD_OFFSET + 0x1)
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index f991016e2a6a..667915d236f3 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -271,6 +271,9 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
271 else 271 else
272 omap_pm_ops.finish_suspend(save_state); 272 omap_pm_ops.finish_suspend(save_state);
273 273
274 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) && cpu)
275 gic_dist_enable();
276
274 /* 277 /*
275 * Restore the CPUx power state to ON otherwise CPUx 278 * Restore the CPUx power state to ON otherwise CPUx
276 * power domain can transitions to programmed low power 279 * power domain can transitions to programmed low power
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 75e95d4fb448..17550aa39d0f 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -39,8 +39,6 @@
39 39
40#define OMAP5_CORE_COUNT 0x2 40#define OMAP5_CORE_COUNT 0x2
41 41
42u16 pm44xx_errata;
43
44/* SCU base address */ 42/* SCU base address */
45static void __iomem *scu_base; 43static void __iomem *scu_base;
46 44
@@ -217,10 +215,8 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
217 if (scu_base) 215 if (scu_base)
218 scu_enable(scu_base); 216 scu_enable(scu_base);
219 217
220 if (cpu_is_omap446x()) { 218 if (cpu_is_omap446x())
221 startup_addr = omap4460_secondary_startup; 219 startup_addr = omap4460_secondary_startup;
222 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
223 }
224 220
225 /* 221 /*
226 * Write the address of secondary startup routine into the 222 * Write the address of secondary startup routine into the
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index c0ab9b26be3d..6cd3f3772ecf 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -87,7 +87,7 @@ void __init omap_barriers_init(void)
87 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; 87 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA;
88 dram_io_desc[0].pfn = __phys_to_pfn(paddr); 88 dram_io_desc[0].pfn = __phys_to_pfn(paddr);
89 dram_io_desc[0].length = size; 89 dram_io_desc[0].length = size;
90 dram_io_desc[0].type = MT_MEMORY_SO; 90 dram_io_desc[0].type = MT_MEMORY_RW_SO;
91 iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); 91 iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc));
92 dram_sync = (void __iomem *) dram_io_desc[0].virtual; 92 dram_sync = (void __iomem *) dram_io_desc[0].virtual;
93 sram_sync = (void __iomem *) OMAP4_SRAM_VA; 93 sram_sync = (void __iomem *) OMAP4_SRAM_VA;
@@ -127,6 +127,12 @@ void gic_dist_disable(void)
127 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL); 127 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL);
128} 128}
129 129
130void gic_dist_enable(void)
131{
132 if (gic_dist_base_addr)
133 __raw_writel(0x1, gic_dist_base_addr + GIC_DIST_CTRL);
134}
135
130bool gic_dist_disabled(void) 136bool gic_dist_disabled(void)
131{ 137{
132 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1); 138 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1);
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index e0a398cf28d8..01ef59def44b 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -36,6 +36,7 @@
36#include <linux/of.h> 36#include <linux/of.h>
37#include <linux/notifier.h> 37#include <linux/notifier.h>
38 38
39#include "common.h"
39#include "soc.h" 40#include "soc.h"
40#include "omap_device.h" 41#include "omap_device.h"
41#include "omap_hwmod.h" 42#include "omap_hwmod.h"
@@ -204,6 +205,7 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
204 case BUS_NOTIFY_ADD_DEVICE: 205 case BUS_NOTIFY_ADD_DEVICE:
205 if (pdev->dev.of_node) 206 if (pdev->dev.of_node)
206 omap_device_build_from_dt(pdev); 207 omap_device_build_from_dt(pdev);
208 omap_auxdata_legacy_init(dev);
207 /* fall through */ 209 /* fall through */
208 default: 210 default:
209 od = to_omap_device(pdev); 211 od = to_omap_device(pdev);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 8a1b5e0bad40..42d81885c700 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -686,6 +686,8 @@ static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
686 if (oh->clkdm) { 686 if (oh->clkdm) {
687 return oh->clkdm; 687 return oh->clkdm;
688 } else if (oh->_clk) { 688 } else if (oh->_clk) {
689 if (__clk_get_flags(oh->_clk) & CLK_IS_BASIC)
690 return NULL;
689 clk = to_clk_hw_omap(__clk_get_hw(oh->_clk)); 691 clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
690 return clk->clkdm; 692 return clk->clkdm;
691 } 693 }
@@ -1576,7 +1578,7 @@ static int _init_clkdm(struct omap_hwmod *oh)
1576 if (!oh->clkdm) { 1578 if (!oh->clkdm) {
1577 pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n", 1579 pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n",
1578 oh->name, oh->clkdm_name); 1580 oh->name, oh->clkdm_name);
1579 return -EINVAL; 1581 return 0;
1580 } 1582 }
1581 1583
1582 pr_debug("omap_hwmod: %s: associated to clkdm %s\n", 1584 pr_debug("omap_hwmod: %s: associated to clkdm %s\n",
@@ -2791,9 +2793,7 @@ static int __init _alloc_links(struct omap_hwmod_link **ml,
2791 sz = sizeof(struct omap_hwmod_link) * LINKS_PER_OCP_IF; 2793 sz = sizeof(struct omap_hwmod_link) * LINKS_PER_OCP_IF;
2792 2794
2793 *sl = NULL; 2795 *sl = NULL;
2794 *ml = alloc_bootmem(sz); 2796 *ml = memblock_virt_alloc(sz, 0);
2795
2796 memset(*ml, 0, sz);
2797 2797
2798 *sl = (void *)(*ml) + sizeof(struct omap_hwmod_link); 2798 *sl = (void *)(*ml) + sizeof(struct omap_hwmod_link);
2799 2799
@@ -2912,9 +2912,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2912 pr_debug("omap_hwmod: %s: allocating %d byte linkspace (%d links)\n", 2912 pr_debug("omap_hwmod: %s: allocating %d byte linkspace (%d links)\n",
2913 __func__, sz, max_ls); 2913 __func__, sz, max_ls);
2914 2914
2915 linkspace = alloc_bootmem(sz); 2915 linkspace = memblock_virt_alloc(sz, 0);
2916
2917 memset(linkspace, 0, sz);
2918 2916
2919 return 0; 2917 return 0;
2920} 2918}
@@ -4235,6 +4233,7 @@ void __init omap_hwmod_init(void)
4235 soc_ops.assert_hardreset = _omap2_assert_hardreset; 4233 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4236 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 4234 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4237 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 4235 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
4236 soc_ops.init_clkdm = _init_clkdm;
4238 } else if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx()) { 4237 } else if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx()) {
4239 soc_ops.enable_module = _omap4_enable_module; 4238 soc_ops.enable_module = _omap4_enable_module;
4240 soc_ops.disable_module = _omap4_disable_module; 4239 soc_ops.disable_module = _omap4_disable_module;
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index d8b9d60f854f..2f15979c2e9c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -108,8 +108,6 @@ static struct omap_i2c_dev_attr i2c_dev_attr = {
108/* I2C1 */ 108/* I2C1 */
109static struct omap_hwmod omap2420_i2c1_hwmod = { 109static struct omap_hwmod omap2420_i2c1_hwmod = {
110 .name = "i2c1", 110 .name = "i2c1",
111 .mpu_irqs = omap2_i2c1_mpu_irqs,
112 .sdma_reqs = omap2_i2c1_sdma_reqs,
113 .main_clk = "i2c1_fck", 111 .main_clk = "i2c1_fck",
114 .prcm = { 112 .prcm = {
115 .omap2 = { 113 .omap2 = {
@@ -133,8 +131,6 @@ static struct omap_hwmod omap2420_i2c1_hwmod = {
133/* I2C2 */ 131/* I2C2 */
134static struct omap_hwmod omap2420_i2c2_hwmod = { 132static struct omap_hwmod omap2420_i2c2_hwmod = {
135 .name = "i2c2", 133 .name = "i2c2",
136 .mpu_irqs = omap2_i2c2_mpu_irqs,
137 .sdma_reqs = omap2_i2c2_sdma_reqs,
138 .main_clk = "i2c2_fck", 134 .main_clk = "i2c2_fck",
139 .prcm = { 135 .prcm = {
140 .omap2 = { 136 .omap2 = {
@@ -179,16 +175,9 @@ static struct omap_mbox_pdata omap2420_mailbox_attrs = {
179 .info = omap2420_mailbox_info, 175 .info = omap2420_mailbox_info,
180}; 176};
181 177
182static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = {
183 { .name = "dsp", .irq = 26 + OMAP_INTC_START, },
184 { .name = "iva", .irq = 34 + OMAP_INTC_START, },
185 { .irq = -1 },
186};
187
188static struct omap_hwmod omap2420_mailbox_hwmod = { 178static struct omap_hwmod omap2420_mailbox_hwmod = {
189 .name = "mailbox", 179 .name = "mailbox",
190 .class = &omap2xxx_mailbox_hwmod_class, 180 .class = &omap2xxx_mailbox_hwmod_class,
191 .mpu_irqs = omap2420_mailbox_irqs,
192 .main_clk = "mailboxes_ick", 181 .main_clk = "mailboxes_ick",
193 .prcm = { 182 .prcm = {
194 .omap2 = { 183 .omap2 = {
@@ -217,17 +206,9 @@ static struct omap_hwmod_opt_clk mcbsp_opt_clks[] = {
217}; 206};
218 207
219/* mcbsp1 */ 208/* mcbsp1 */
220static struct omap_hwmod_irq_info omap2420_mcbsp1_irqs[] = {
221 { .name = "tx", .irq = 59 + OMAP_INTC_START, },
222 { .name = "rx", .irq = 60 + OMAP_INTC_START, },
223 { .irq = -1 },
224};
225
226static struct omap_hwmod omap2420_mcbsp1_hwmod = { 209static struct omap_hwmod omap2420_mcbsp1_hwmod = {
227 .name = "mcbsp1", 210 .name = "mcbsp1",
228 .class = &omap2420_mcbsp_hwmod_class, 211 .class = &omap2420_mcbsp_hwmod_class,
229 .mpu_irqs = omap2420_mcbsp1_irqs,
230 .sdma_reqs = omap2_mcbsp1_sdma_reqs,
231 .main_clk = "mcbsp1_fck", 212 .main_clk = "mcbsp1_fck",
232 .prcm = { 213 .prcm = {
233 .omap2 = { 214 .omap2 = {
@@ -243,17 +224,9 @@ static struct omap_hwmod omap2420_mcbsp1_hwmod = {
243}; 224};
244 225
245/* mcbsp2 */ 226/* mcbsp2 */
246static struct omap_hwmod_irq_info omap2420_mcbsp2_irqs[] = {
247 { .name = "tx", .irq = 62 + OMAP_INTC_START, },
248 { .name = "rx", .irq = 63 + OMAP_INTC_START, },
249 { .irq = -1 },
250};
251
252static struct omap_hwmod omap2420_mcbsp2_hwmod = { 227static struct omap_hwmod omap2420_mcbsp2_hwmod = {
253 .name = "mcbsp2", 228 .name = "mcbsp2",
254 .class = &omap2420_mcbsp_hwmod_class, 229 .class = &omap2420_mcbsp_hwmod_class,
255 .mpu_irqs = omap2420_mcbsp2_irqs,
256 .sdma_reqs = omap2_mcbsp2_sdma_reqs,
257 .main_clk = "mcbsp2_fck", 230 .main_clk = "mcbsp2_fck",
258 .prcm = { 231 .prcm = {
259 .omap2 = { 232 .omap2 = {
@@ -283,22 +256,9 @@ static struct omap_hwmod_class omap2420_msdi_hwmod_class = {
283}; 256};
284 257
285/* msdi1 */ 258/* msdi1 */
286static struct omap_hwmod_irq_info omap2420_msdi1_irqs[] = {
287 { .irq = 83 + OMAP_INTC_START, },
288 { .irq = -1 },
289};
290
291static struct omap_hwmod_dma_info omap2420_msdi1_sdma_reqs[] = {
292 { .name = "tx", .dma_req = 61 }, /* OMAP24XX_DMA_MMC1_TX */
293 { .name = "rx", .dma_req = 62 }, /* OMAP24XX_DMA_MMC1_RX */
294 { .dma_req = -1 }
295};
296
297static struct omap_hwmod omap2420_msdi1_hwmod = { 259static struct omap_hwmod omap2420_msdi1_hwmod = {
298 .name = "msdi1", 260 .name = "msdi1",
299 .class = &omap2420_msdi_hwmod_class, 261 .class = &omap2420_msdi_hwmod_class,
300 .mpu_irqs = omap2420_msdi1_irqs,
301 .sdma_reqs = omap2420_msdi1_sdma_reqs,
302 .main_clk = "mmc_fck", 262 .main_clk = "mmc_fck",
303 .prcm = { 263 .prcm = {
304 .omap2 = { 264 .omap2 = {
@@ -315,7 +275,6 @@ static struct omap_hwmod omap2420_msdi1_hwmod = {
315/* HDQ1W/1-wire */ 275/* HDQ1W/1-wire */
316static struct omap_hwmod omap2420_hdq1w_hwmod = { 276static struct omap_hwmod omap2420_hdq1w_hwmod = {
317 .name = "hdq1w", 277 .name = "hdq1w",
318 .mpu_irqs = omap2_hdq1w_mpu_irqs,
319 .main_clk = "hdq_fck", 278 .main_clk = "hdq_fck",
320 .prcm = { 279 .prcm = {
321 .omap2 = { 280 .omap2 = {
@@ -338,7 +297,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__i2c1 = {
338 .master = &omap2xxx_l4_core_hwmod, 297 .master = &omap2xxx_l4_core_hwmod,
339 .slave = &omap2420_i2c1_hwmod, 298 .slave = &omap2420_i2c1_hwmod,
340 .clk = "i2c1_ick", 299 .clk = "i2c1_ick",
341 .addr = omap2_i2c1_addr_space,
342 .user = OCP_USER_MPU | OCP_USER_SDMA, 300 .user = OCP_USER_MPU | OCP_USER_SDMA,
343}; 301};
344 302
@@ -347,7 +305,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__i2c2 = {
347 .master = &omap2xxx_l4_core_hwmod, 305 .master = &omap2xxx_l4_core_hwmod,
348 .slave = &omap2420_i2c2_hwmod, 306 .slave = &omap2420_i2c2_hwmod,
349 .clk = "i2c2_ick", 307 .clk = "i2c2_ick",
350 .addr = omap2_i2c2_addr_space,
351 .user = OCP_USER_MPU | OCP_USER_SDMA, 308 .user = OCP_USER_MPU | OCP_USER_SDMA,
352}; 309};
353 310
@@ -367,111 +324,51 @@ static struct omap_hwmod_ocp_if omap2420_l3__dsp = {
367 .user = OCP_USER_MPU | OCP_USER_SDMA, 324 .user = OCP_USER_MPU | OCP_USER_SDMA,
368}; 325};
369 326
370static struct omap_hwmod_addr_space omap2420_timer1_addrs[] = {
371 {
372 .pa_start = 0x48028000,
373 .pa_end = 0x48028000 + SZ_1K - 1,
374 .flags = ADDR_TYPE_RT
375 },
376 { }
377};
378
379/* l4_wkup -> timer1 */ 327/* l4_wkup -> timer1 */
380static struct omap_hwmod_ocp_if omap2420_l4_wkup__timer1 = { 328static struct omap_hwmod_ocp_if omap2420_l4_wkup__timer1 = {
381 .master = &omap2xxx_l4_wkup_hwmod, 329 .master = &omap2xxx_l4_wkup_hwmod,
382 .slave = &omap2xxx_timer1_hwmod, 330 .slave = &omap2xxx_timer1_hwmod,
383 .clk = "gpt1_ick", 331 .clk = "gpt1_ick",
384 .addr = omap2420_timer1_addrs,
385 .user = OCP_USER_MPU | OCP_USER_SDMA, 332 .user = OCP_USER_MPU | OCP_USER_SDMA,
386}; 333};
387 334
388/* l4_wkup -> wd_timer2 */ 335/* l4_wkup -> wd_timer2 */
389static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = {
390 {
391 .pa_start = 0x48022000,
392 .pa_end = 0x4802207f,
393 .flags = ADDR_TYPE_RT
394 },
395 { }
396};
397
398static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { 336static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = {
399 .master = &omap2xxx_l4_wkup_hwmod, 337 .master = &omap2xxx_l4_wkup_hwmod,
400 .slave = &omap2xxx_wd_timer2_hwmod, 338 .slave = &omap2xxx_wd_timer2_hwmod,
401 .clk = "mpu_wdt_ick", 339 .clk = "mpu_wdt_ick",
402 .addr = omap2420_wd_timer2_addrs,
403 .user = OCP_USER_MPU | OCP_USER_SDMA, 340 .user = OCP_USER_MPU | OCP_USER_SDMA,
404}; 341};
405 342
406/* l4_wkup -> gpio1 */ 343/* l4_wkup -> gpio1 */
407static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = {
408 {
409 .pa_start = 0x48018000,
410 .pa_end = 0x480181ff,
411 .flags = ADDR_TYPE_RT
412 },
413 { }
414};
415
416static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = { 344static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = {
417 .master = &omap2xxx_l4_wkup_hwmod, 345 .master = &omap2xxx_l4_wkup_hwmod,
418 .slave = &omap2xxx_gpio1_hwmod, 346 .slave = &omap2xxx_gpio1_hwmod,
419 .clk = "gpios_ick", 347 .clk = "gpios_ick",
420 .addr = omap2420_gpio1_addr_space,
421 .user = OCP_USER_MPU | OCP_USER_SDMA, 348 .user = OCP_USER_MPU | OCP_USER_SDMA,
422}; 349};
423 350
424/* l4_wkup -> gpio2 */ 351/* l4_wkup -> gpio2 */
425static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = {
426 {
427 .pa_start = 0x4801a000,
428 .pa_end = 0x4801a1ff,
429 .flags = ADDR_TYPE_RT
430 },
431 { }
432};
433
434static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = { 352static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = {
435 .master = &omap2xxx_l4_wkup_hwmod, 353 .master = &omap2xxx_l4_wkup_hwmod,
436 .slave = &omap2xxx_gpio2_hwmod, 354 .slave = &omap2xxx_gpio2_hwmod,
437 .clk = "gpios_ick", 355 .clk = "gpios_ick",
438 .addr = omap2420_gpio2_addr_space,
439 .user = OCP_USER_MPU | OCP_USER_SDMA, 356 .user = OCP_USER_MPU | OCP_USER_SDMA,
440}; 357};
441 358
442/* l4_wkup -> gpio3 */ 359/* l4_wkup -> gpio3 */
443static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = {
444 {
445 .pa_start = 0x4801c000,
446 .pa_end = 0x4801c1ff,
447 .flags = ADDR_TYPE_RT
448 },
449 { }
450};
451
452static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = { 360static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = {
453 .master = &omap2xxx_l4_wkup_hwmod, 361 .master = &omap2xxx_l4_wkup_hwmod,
454 .slave = &omap2xxx_gpio3_hwmod, 362 .slave = &omap2xxx_gpio3_hwmod,
455 .clk = "gpios_ick", 363 .clk = "gpios_ick",
456 .addr = omap2420_gpio3_addr_space,
457 .user = OCP_USER_MPU | OCP_USER_SDMA, 364 .user = OCP_USER_MPU | OCP_USER_SDMA,
458}; 365};
459 366
460/* l4_wkup -> gpio4 */ 367/* l4_wkup -> gpio4 */
461static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = {
462 {
463 .pa_start = 0x4801e000,
464 .pa_end = 0x4801e1ff,
465 .flags = ADDR_TYPE_RT
466 },
467 { }
468};
469
470static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = { 368static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = {
471 .master = &omap2xxx_l4_wkup_hwmod, 369 .master = &omap2xxx_l4_wkup_hwmod,
472 .slave = &omap2xxx_gpio4_hwmod, 370 .slave = &omap2xxx_gpio4_hwmod,
473 .clk = "gpios_ick", 371 .clk = "gpios_ick",
474 .addr = omap2420_gpio4_addr_space,
475 .user = OCP_USER_MPU | OCP_USER_SDMA, 372 .user = OCP_USER_MPU | OCP_USER_SDMA,
476}; 373};
477 374
@@ -496,7 +393,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__dma_system = {
496static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = { 393static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = {
497 .master = &omap2xxx_l4_core_hwmod, 394 .master = &omap2xxx_l4_core_hwmod,
498 .slave = &omap2420_mailbox_hwmod, 395 .slave = &omap2420_mailbox_hwmod,
499 .addr = omap2_mailbox_addrs,
500 .user = OCP_USER_MPU | OCP_USER_SDMA, 396 .user = OCP_USER_MPU | OCP_USER_SDMA,
501}; 397};
502 398
@@ -505,7 +401,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp1 = {
505 .master = &omap2xxx_l4_core_hwmod, 401 .master = &omap2xxx_l4_core_hwmod,
506 .slave = &omap2420_mcbsp1_hwmod, 402 .slave = &omap2420_mcbsp1_hwmod,
507 .clk = "mcbsp1_ick", 403 .clk = "mcbsp1_ick",
508 .addr = omap2_mcbsp1_addrs,
509 .user = OCP_USER_MPU | OCP_USER_SDMA, 404 .user = OCP_USER_MPU | OCP_USER_SDMA,
510}; 405};
511 406
@@ -514,25 +409,14 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp2 = {
514 .master = &omap2xxx_l4_core_hwmod, 409 .master = &omap2xxx_l4_core_hwmod,
515 .slave = &omap2420_mcbsp2_hwmod, 410 .slave = &omap2420_mcbsp2_hwmod,
516 .clk = "mcbsp2_ick", 411 .clk = "mcbsp2_ick",
517 .addr = omap2xxx_mcbsp2_addrs,
518 .user = OCP_USER_MPU | OCP_USER_SDMA, 412 .user = OCP_USER_MPU | OCP_USER_SDMA,
519}; 413};
520 414
521static struct omap_hwmod_addr_space omap2420_msdi1_addrs[] = {
522 {
523 .pa_start = 0x4809c000,
524 .pa_end = 0x4809c000 + SZ_128 - 1,
525 .flags = ADDR_TYPE_RT,
526 },
527 { }
528};
529
530/* l4_core -> msdi1 */ 415/* l4_core -> msdi1 */
531static struct omap_hwmod_ocp_if omap2420_l4_core__msdi1 = { 416static struct omap_hwmod_ocp_if omap2420_l4_core__msdi1 = {
532 .master = &omap2xxx_l4_core_hwmod, 417 .master = &omap2xxx_l4_core_hwmod,
533 .slave = &omap2420_msdi1_hwmod, 418 .slave = &omap2420_msdi1_hwmod,
534 .clk = "mmc_ick", 419 .clk = "mmc_ick",
535 .addr = omap2420_msdi1_addrs,
536 .user = OCP_USER_MPU | OCP_USER_SDMA, 420 .user = OCP_USER_MPU | OCP_USER_SDMA,
537}; 421};
538 422
@@ -541,36 +425,16 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__hdq1w = {
541 .master = &omap2xxx_l4_core_hwmod, 425 .master = &omap2xxx_l4_core_hwmod,
542 .slave = &omap2420_hdq1w_hwmod, 426 .slave = &omap2420_hdq1w_hwmod,
543 .clk = "hdq_ick", 427 .clk = "hdq_ick",
544 .addr = omap2_hdq1w_addr_space,
545 .user = OCP_USER_MPU | OCP_USER_SDMA, 428 .user = OCP_USER_MPU | OCP_USER_SDMA,
546 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE, 429 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
547}; 430};
548 431
549 432
550/* l4_wkup -> 32ksync_counter */ 433/* l4_wkup -> 32ksync_counter */
551static struct omap_hwmod_addr_space omap2420_counter_32k_addrs[] = {
552 {
553 .pa_start = 0x48004000,
554 .pa_end = 0x4800401f,
555 .flags = ADDR_TYPE_RT
556 },
557 { }
558};
559
560static struct omap_hwmod_addr_space omap2420_gpmc_addrs[] = {
561 {
562 .pa_start = 0x6800a000,
563 .pa_end = 0x6800afff,
564 .flags = ADDR_TYPE_RT
565 },
566 { }
567};
568
569static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = { 434static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = {
570 .master = &omap2xxx_l4_wkup_hwmod, 435 .master = &omap2xxx_l4_wkup_hwmod,
571 .slave = &omap2xxx_counter_32k_hwmod, 436 .slave = &omap2xxx_counter_32k_hwmod,
572 .clk = "sync_32k_ick", 437 .clk = "sync_32k_ick",
573 .addr = omap2420_counter_32k_addrs,
574 .user = OCP_USER_MPU | OCP_USER_SDMA, 438 .user = OCP_USER_MPU | OCP_USER_SDMA,
575}; 439};
576 440
@@ -578,7 +442,6 @@ static struct omap_hwmod_ocp_if omap2420_l3__gpmc = {
578 .master = &omap2xxx_l3_main_hwmod, 442 .master = &omap2xxx_l3_main_hwmod,
579 .slave = &omap2xxx_gpmc_hwmod, 443 .slave = &omap2xxx_gpmc_hwmod,
580 .clk = "core_l3_ck", 444 .clk = "core_l3_ck",
581 .addr = omap2420_gpmc_addrs,
582 .user = OCP_USER_MPU | OCP_USER_SDMA, 445 .user = OCP_USER_MPU | OCP_USER_SDMA,
583}; 446};
584 447
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 5b9083461dc5..6d1b60902179 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -86,8 +86,6 @@ static struct omap_i2c_dev_attr i2c_dev_attr = {
86static struct omap_hwmod omap2430_i2c1_hwmod = { 86static struct omap_hwmod omap2430_i2c1_hwmod = {
87 .name = "i2c1", 87 .name = "i2c1",
88 .flags = HWMOD_16BIT_REG, 88 .flags = HWMOD_16BIT_REG,
89 .mpu_irqs = omap2_i2c1_mpu_irqs,
90 .sdma_reqs = omap2_i2c1_sdma_reqs,
91 .main_clk = "i2chs1_fck", 89 .main_clk = "i2chs1_fck",
92 .prcm = { 90 .prcm = {
93 .omap2 = { 91 .omap2 = {
@@ -114,8 +112,6 @@ static struct omap_hwmod omap2430_i2c1_hwmod = {
114static struct omap_hwmod omap2430_i2c2_hwmod = { 112static struct omap_hwmod omap2430_i2c2_hwmod = {
115 .name = "i2c2", 113 .name = "i2c2",
116 .flags = HWMOD_16BIT_REG, 114 .flags = HWMOD_16BIT_REG,
117 .mpu_irqs = omap2_i2c2_mpu_irqs,
118 .sdma_reqs = omap2_i2c2_sdma_reqs,
119 .main_clk = "i2chs2_fck", 115 .main_clk = "i2chs2_fck",
120 .prcm = { 116 .prcm = {
121 .omap2 = { 117 .omap2 = {
@@ -131,15 +127,9 @@ static struct omap_hwmod omap2430_i2c2_hwmod = {
131}; 127};
132 128
133/* gpio5 */ 129/* gpio5 */
134static struct omap_hwmod_irq_info omap243x_gpio5_irqs[] = {
135 { .irq = 33 + OMAP_INTC_START, }, /* INT_24XX_GPIO_BANK5 */
136 { .irq = -1 },
137};
138
139static struct omap_hwmod omap2430_gpio5_hwmod = { 130static struct omap_hwmod omap2430_gpio5_hwmod = {
140 .name = "gpio5", 131 .name = "gpio5",
141 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 132 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
142 .mpu_irqs = omap243x_gpio5_irqs,
143 .main_clk = "gpio5_fck", 133 .main_clk = "gpio5_fck",
144 .prcm = { 134 .prcm = {
145 .omap2 = { 135 .omap2 = {
@@ -182,15 +172,9 @@ static struct omap_mbox_pdata omap2430_mailbox_attrs = {
182 .info = omap2430_mailbox_info, 172 .info = omap2430_mailbox_info,
183}; 173};
184 174
185static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = {
186 { .irq = 26 + OMAP_INTC_START, },
187 { .irq = -1 },
188};
189
190static struct omap_hwmod omap2430_mailbox_hwmod = { 175static struct omap_hwmod omap2430_mailbox_hwmod = {
191 .name = "mailbox", 176 .name = "mailbox",
192 .class = &omap2xxx_mailbox_hwmod_class, 177 .class = &omap2xxx_mailbox_hwmod_class,
193 .mpu_irqs = omap2430_mailbox_irqs,
194 .main_clk = "mailboxes_ick", 178 .main_clk = "mailboxes_ick",
195 .prcm = { 179 .prcm = {
196 .omap2 = { 180 .omap2 = {
@@ -205,27 +189,12 @@ static struct omap_hwmod omap2430_mailbox_hwmod = {
205}; 189};
206 190
207/* mcspi3 */ 191/* mcspi3 */
208static struct omap_hwmod_irq_info omap2430_mcspi3_mpu_irqs[] = {
209 { .irq = 91 + OMAP_INTC_START, },
210 { .irq = -1 },
211};
212
213static struct omap_hwmod_dma_info omap2430_mcspi3_sdma_reqs[] = {
214 { .name = "tx0", .dma_req = 15 }, /* DMA_SPI3_TX0 */
215 { .name = "rx0", .dma_req = 16 }, /* DMA_SPI3_RX0 */
216 { .name = "tx1", .dma_req = 23 }, /* DMA_SPI3_TX1 */
217 { .name = "rx1", .dma_req = 24 }, /* DMA_SPI3_RX1 */
218 { .dma_req = -1 }
219};
220
221static struct omap2_mcspi_dev_attr omap_mcspi3_dev_attr = { 192static struct omap2_mcspi_dev_attr omap_mcspi3_dev_attr = {
222 .num_chipselect = 2, 193 .num_chipselect = 2,
223}; 194};
224 195
225static struct omap_hwmod omap2430_mcspi3_hwmod = { 196static struct omap_hwmod omap2430_mcspi3_hwmod = {
226 .name = "mcspi3", 197 .name = "mcspi3",
227 .mpu_irqs = omap2430_mcspi3_mpu_irqs,
228 .sdma_reqs = omap2430_mcspi3_sdma_reqs,
229 .main_clk = "mcspi3_fck", 198 .main_clk = "mcspi3_fck",
230 .prcm = { 199 .prcm = {
231 .omap2 = { 200 .omap2 = {
@@ -259,16 +228,8 @@ static struct omap_hwmod_class usbotg_class = {
259}; 228};
260 229
261/* usb_otg_hs */ 230/* usb_otg_hs */
262static struct omap_hwmod_irq_info omap2430_usbhsotg_mpu_irqs[] = {
263
264 { .name = "mc", .irq = 92 + OMAP_INTC_START, },
265 { .name = "dma", .irq = 93 + OMAP_INTC_START, },
266 { .irq = -1 },
267};
268
269static struct omap_hwmod omap2430_usbhsotg_hwmod = { 231static struct omap_hwmod omap2430_usbhsotg_hwmod = {
270 .name = "usb_otg_hs", 232 .name = "usb_otg_hs",
271 .mpu_irqs = omap2430_usbhsotg_mpu_irqs,
272 .main_clk = "usbhs_ick", 233 .main_clk = "usbhs_ick",
273 .prcm = { 234 .prcm = {
274 .omap2 = { 235 .omap2 = {
@@ -313,19 +274,9 @@ static struct omap_hwmod_opt_clk mcbsp_opt_clks[] = {
313}; 274};
314 275
315/* mcbsp1 */ 276/* mcbsp1 */
316static struct omap_hwmod_irq_info omap2430_mcbsp1_irqs[] = {
317 { .name = "tx", .irq = 59 + OMAP_INTC_START, },
318 { .name = "rx", .irq = 60 + OMAP_INTC_START, },
319 { .name = "ovr", .irq = 61 + OMAP_INTC_START, },
320 { .name = "common", .irq = 64 + OMAP_INTC_START, },
321 { .irq = -1 },
322};
323
324static struct omap_hwmod omap2430_mcbsp1_hwmod = { 277static struct omap_hwmod omap2430_mcbsp1_hwmod = {
325 .name = "mcbsp1", 278 .name = "mcbsp1",
326 .class = &omap2430_mcbsp_hwmod_class, 279 .class = &omap2430_mcbsp_hwmod_class,
327 .mpu_irqs = omap2430_mcbsp1_irqs,
328 .sdma_reqs = omap2_mcbsp1_sdma_reqs,
329 .main_clk = "mcbsp1_fck", 280 .main_clk = "mcbsp1_fck",
330 .prcm = { 281 .prcm = {
331 .omap2 = { 282 .omap2 = {
@@ -341,18 +292,9 @@ static struct omap_hwmod omap2430_mcbsp1_hwmod = {
341}; 292};
342 293
343/* mcbsp2 */ 294/* mcbsp2 */
344static struct omap_hwmod_irq_info omap2430_mcbsp2_irqs[] = {
345 { .name = "tx", .irq = 62 + OMAP_INTC_START, },
346 { .name = "rx", .irq = 63 + OMAP_INTC_START, },
347 { .name = "common", .irq = 16 + OMAP_INTC_START, },
348 { .irq = -1 },
349};
350
351static struct omap_hwmod omap2430_mcbsp2_hwmod = { 295static struct omap_hwmod omap2430_mcbsp2_hwmod = {
352 .name = "mcbsp2", 296 .name = "mcbsp2",
353 .class = &omap2430_mcbsp_hwmod_class, 297 .class = &omap2430_mcbsp_hwmod_class,
354 .mpu_irqs = omap2430_mcbsp2_irqs,
355 .sdma_reqs = omap2_mcbsp2_sdma_reqs,
356 .main_clk = "mcbsp2_fck", 298 .main_clk = "mcbsp2_fck",
357 .prcm = { 299 .prcm = {
358 .omap2 = { 300 .omap2 = {
@@ -368,18 +310,9 @@ static struct omap_hwmod omap2430_mcbsp2_hwmod = {
368}; 310};
369 311
370/* mcbsp3 */ 312/* mcbsp3 */
371static struct omap_hwmod_irq_info omap2430_mcbsp3_irqs[] = {
372 { .name = "tx", .irq = 89 + OMAP_INTC_START, },
373 { .name = "rx", .irq = 90 + OMAP_INTC_START, },
374 { .name = "common", .irq = 17 + OMAP_INTC_START, },
375 { .irq = -1 },
376};
377
378static struct omap_hwmod omap2430_mcbsp3_hwmod = { 313static struct omap_hwmod omap2430_mcbsp3_hwmod = {
379 .name = "mcbsp3", 314 .name = "mcbsp3",
380 .class = &omap2430_mcbsp_hwmod_class, 315 .class = &omap2430_mcbsp_hwmod_class,
381 .mpu_irqs = omap2430_mcbsp3_irqs,
382 .sdma_reqs = omap2_mcbsp3_sdma_reqs,
383 .main_clk = "mcbsp3_fck", 316 .main_clk = "mcbsp3_fck",
384 .prcm = { 317 .prcm = {
385 .omap2 = { 318 .omap2 = {
@@ -395,24 +328,9 @@ static struct omap_hwmod omap2430_mcbsp3_hwmod = {
395}; 328};
396 329
397/* mcbsp4 */ 330/* mcbsp4 */
398static struct omap_hwmod_irq_info omap2430_mcbsp4_irqs[] = {
399 { .name = "tx", .irq = 54 + OMAP_INTC_START, },
400 { .name = "rx", .irq = 55 + OMAP_INTC_START, },
401 { .name = "common", .irq = 18 + OMAP_INTC_START, },
402 { .irq = -1 },
403};
404
405static struct omap_hwmod_dma_info omap2430_mcbsp4_sdma_chs[] = {
406 { .name = "rx", .dma_req = 20 },
407 { .name = "tx", .dma_req = 19 },
408 { .dma_req = -1 }
409};
410
411static struct omap_hwmod omap2430_mcbsp4_hwmod = { 331static struct omap_hwmod omap2430_mcbsp4_hwmod = {
412 .name = "mcbsp4", 332 .name = "mcbsp4",
413 .class = &omap2430_mcbsp_hwmod_class, 333 .class = &omap2430_mcbsp_hwmod_class,
414 .mpu_irqs = omap2430_mcbsp4_irqs,
415 .sdma_reqs = omap2430_mcbsp4_sdma_chs,
416 .main_clk = "mcbsp4_fck", 334 .main_clk = "mcbsp4_fck",
417 .prcm = { 335 .prcm = {
418 .omap2 = { 336 .omap2 = {
@@ -428,24 +346,9 @@ static struct omap_hwmod omap2430_mcbsp4_hwmod = {
428}; 346};
429 347
430/* mcbsp5 */ 348/* mcbsp5 */
431static struct omap_hwmod_irq_info omap2430_mcbsp5_irqs[] = {
432 { .name = "tx", .irq = 81 + OMAP_INTC_START, },
433 { .name = "rx", .irq = 82 + OMAP_INTC_START, },
434 { .name = "common", .irq = 19 + OMAP_INTC_START, },
435 { .irq = -1 },
436};
437
438static struct omap_hwmod_dma_info omap2430_mcbsp5_sdma_chs[] = {
439 { .name = "rx", .dma_req = 22 },
440 { .name = "tx", .dma_req = 21 },
441 { .dma_req = -1 }
442};
443
444static struct omap_hwmod omap2430_mcbsp5_hwmod = { 349static struct omap_hwmod omap2430_mcbsp5_hwmod = {
445 .name = "mcbsp5", 350 .name = "mcbsp5",
446 .class = &omap2430_mcbsp_hwmod_class, 351 .class = &omap2430_mcbsp_hwmod_class,
447 .mpu_irqs = omap2430_mcbsp5_irqs,
448 .sdma_reqs = omap2430_mcbsp5_sdma_chs,
449 .main_clk = "mcbsp5_fck", 352 .main_clk = "mcbsp5_fck",
450 .prcm = { 353 .prcm = {
451 .omap2 = { 354 .omap2 = {
@@ -478,17 +381,6 @@ static struct omap_hwmod_class omap2430_mmc_class = {
478}; 381};
479 382
480/* MMC/SD/SDIO1 */ 383/* MMC/SD/SDIO1 */
481static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = {
482 { .irq = 83 + OMAP_INTC_START, },
483 { .irq = -1 },
484};
485
486static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = {
487 { .name = "tx", .dma_req = 61 }, /* DMA_MMC1_TX */
488 { .name = "rx", .dma_req = 62 }, /* DMA_MMC1_RX */
489 { .dma_req = -1 }
490};
491
492static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = { 384static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
493 { .role = "dbck", .clk = "mmchsdb1_fck" }, 385 { .role = "dbck", .clk = "mmchsdb1_fck" },
494}; 386};
@@ -500,8 +392,6 @@ static struct omap_mmc_dev_attr mmc1_dev_attr = {
500static struct omap_hwmod omap2430_mmc1_hwmod = { 392static struct omap_hwmod omap2430_mmc1_hwmod = {
501 .name = "mmc1", 393 .name = "mmc1",
502 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 394 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
503 .mpu_irqs = omap2430_mmc1_mpu_irqs,
504 .sdma_reqs = omap2430_mmc1_sdma_reqs,
505 .opt_clks = omap2430_mmc1_opt_clks, 395 .opt_clks = omap2430_mmc1_opt_clks,
506 .opt_clks_cnt = ARRAY_SIZE(omap2430_mmc1_opt_clks), 396 .opt_clks_cnt = ARRAY_SIZE(omap2430_mmc1_opt_clks),
507 .main_clk = "mmchs1_fck", 397 .main_clk = "mmchs1_fck",
@@ -519,17 +409,6 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
519}; 409};
520 410
521/* MMC/SD/SDIO2 */ 411/* MMC/SD/SDIO2 */
522static struct omap_hwmod_irq_info omap2430_mmc2_mpu_irqs[] = {
523 { .irq = 86 + OMAP_INTC_START, },
524 { .irq = -1 },
525};
526
527static struct omap_hwmod_dma_info omap2430_mmc2_sdma_reqs[] = {
528 { .name = "tx", .dma_req = 47 }, /* DMA_MMC2_TX */
529 { .name = "rx", .dma_req = 48 }, /* DMA_MMC2_RX */
530 { .dma_req = -1 }
531};
532
533static struct omap_hwmod_opt_clk omap2430_mmc2_opt_clks[] = { 412static struct omap_hwmod_opt_clk omap2430_mmc2_opt_clks[] = {
534 { .role = "dbck", .clk = "mmchsdb2_fck" }, 413 { .role = "dbck", .clk = "mmchsdb2_fck" },
535}; 414};
@@ -537,8 +416,6 @@ static struct omap_hwmod_opt_clk omap2430_mmc2_opt_clks[] = {
537static struct omap_hwmod omap2430_mmc2_hwmod = { 416static struct omap_hwmod omap2430_mmc2_hwmod = {
538 .name = "mmc2", 417 .name = "mmc2",
539 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 418 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
540 .mpu_irqs = omap2430_mmc2_mpu_irqs,
541 .sdma_reqs = omap2430_mmc2_sdma_reqs,
542 .opt_clks = omap2430_mmc2_opt_clks, 419 .opt_clks = omap2430_mmc2_opt_clks,
543 .opt_clks_cnt = ARRAY_SIZE(omap2430_mmc2_opt_clks), 420 .opt_clks_cnt = ARRAY_SIZE(omap2430_mmc2_opt_clks),
544 .main_clk = "mmchs2_fck", 421 .main_clk = "mmchs2_fck",
@@ -557,7 +434,6 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
557/* HDQ1W/1-wire */ 434/* HDQ1W/1-wire */
558static struct omap_hwmod omap2430_hdq1w_hwmod = { 435static struct omap_hwmod omap2430_hdq1w_hwmod = {
559 .name = "hdq1w", 436 .name = "hdq1w",
560 .mpu_irqs = omap2_hdq1w_mpu_irqs,
561 .main_clk = "hdq_fck", 437 .main_clk = "hdq_fck",
562 .prcm = { 438 .prcm = {
563 .omap2 = { 439 .omap2 = {
@@ -589,7 +465,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__i2c1 = {
589 .master = &omap2xxx_l4_core_hwmod, 465 .master = &omap2xxx_l4_core_hwmod,
590 .slave = &omap2430_i2c1_hwmod, 466 .slave = &omap2430_i2c1_hwmod,
591 .clk = "i2c1_ick", 467 .clk = "i2c1_ick",
592 .addr = omap2_i2c1_addr_space,
593 .user = OCP_USER_MPU | OCP_USER_SDMA, 468 .user = OCP_USER_MPU | OCP_USER_SDMA,
594}; 469};
595 470
@@ -598,25 +473,14 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__i2c2 = {
598 .master = &omap2xxx_l4_core_hwmod, 473 .master = &omap2xxx_l4_core_hwmod,
599 .slave = &omap2430_i2c2_hwmod, 474 .slave = &omap2430_i2c2_hwmod,
600 .clk = "i2c2_ick", 475 .clk = "i2c2_ick",
601 .addr = omap2_i2c2_addr_space,
602 .user = OCP_USER_MPU | OCP_USER_SDMA, 476 .user = OCP_USER_MPU | OCP_USER_SDMA,
603}; 477};
604 478
605static struct omap_hwmod_addr_space omap2430_usbhsotg_addrs[] = {
606 {
607 .pa_start = OMAP243X_HS_BASE,
608 .pa_end = OMAP243X_HS_BASE + SZ_4K - 1,
609 .flags = ADDR_TYPE_RT
610 },
611 { }
612};
613
614/* l4_core ->usbhsotg interface */ 479/* l4_core ->usbhsotg interface */
615static struct omap_hwmod_ocp_if omap2430_l4_core__usbhsotg = { 480static struct omap_hwmod_ocp_if omap2430_l4_core__usbhsotg = {
616 .master = &omap2xxx_l4_core_hwmod, 481 .master = &omap2xxx_l4_core_hwmod,
617 .slave = &omap2430_usbhsotg_hwmod, 482 .slave = &omap2430_usbhsotg_hwmod,
618 .clk = "usb_l4_ick", 483 .clk = "usb_l4_ick",
619 .addr = omap2430_usbhsotg_addrs,
620 .user = OCP_USER_MPU, 484 .user = OCP_USER_MPU,
621}; 485};
622 486
@@ -625,7 +489,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
625 .master = &omap2xxx_l4_core_hwmod, 489 .master = &omap2xxx_l4_core_hwmod,
626 .slave = &omap2430_mmc1_hwmod, 490 .slave = &omap2430_mmc1_hwmod,
627 .clk = "mmchs1_ick", 491 .clk = "mmchs1_ick",
628 .addr = omap2430_mmc1_addr_space,
629 .user = OCP_USER_MPU | OCP_USER_SDMA, 492 .user = OCP_USER_MPU | OCP_USER_SDMA,
630}; 493};
631 494
@@ -634,7 +497,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
634 .master = &omap2xxx_l4_core_hwmod, 497 .master = &omap2xxx_l4_core_hwmod,
635 .slave = &omap2430_mmc2_hwmod, 498 .slave = &omap2430_mmc2_hwmod,
636 .clk = "mmchs2_ick", 499 .clk = "mmchs2_ick",
637 .addr = omap2430_mmc2_addr_space,
638 .user = OCP_USER_MPU | OCP_USER_SDMA, 500 .user = OCP_USER_MPU | OCP_USER_SDMA,
639}; 501};
640 502
@@ -643,7 +505,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi3 = {
643 .master = &omap2xxx_l4_core_hwmod, 505 .master = &omap2xxx_l4_core_hwmod,
644 .slave = &omap2430_mcspi3_hwmod, 506 .slave = &omap2430_mcspi3_hwmod,
645 .clk = "mcspi3_ick", 507 .clk = "mcspi3_ick",
646 .addr = omap2430_mcspi3_addr_space,
647 .user = OCP_USER_MPU | OCP_USER_SDMA, 508 .user = OCP_USER_MPU | OCP_USER_SDMA,
648}; 509};
649 510
@@ -655,129 +516,59 @@ static struct omap_hwmod_ocp_if omap2430_l3__iva = {
655 .user = OCP_USER_MPU | OCP_USER_SDMA, 516 .user = OCP_USER_MPU | OCP_USER_SDMA,
656}; 517};
657 518
658static struct omap_hwmod_addr_space omap2430_timer1_addrs[] = {
659 {
660 .pa_start = 0x49018000,
661 .pa_end = 0x49018000 + SZ_1K - 1,
662 .flags = ADDR_TYPE_RT
663 },
664 { }
665};
666
667/* l4_wkup -> timer1 */ 519/* l4_wkup -> timer1 */
668static struct omap_hwmod_ocp_if omap2430_l4_wkup__timer1 = { 520static struct omap_hwmod_ocp_if omap2430_l4_wkup__timer1 = {
669 .master = &omap2xxx_l4_wkup_hwmod, 521 .master = &omap2xxx_l4_wkup_hwmod,
670 .slave = &omap2xxx_timer1_hwmod, 522 .slave = &omap2xxx_timer1_hwmod,
671 .clk = "gpt1_ick", 523 .clk = "gpt1_ick",
672 .addr = omap2430_timer1_addrs,
673 .user = OCP_USER_MPU | OCP_USER_SDMA, 524 .user = OCP_USER_MPU | OCP_USER_SDMA,
674}; 525};
675 526
676/* l4_wkup -> wd_timer2 */ 527/* l4_wkup -> wd_timer2 */
677static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = {
678 {
679 .pa_start = 0x49016000,
680 .pa_end = 0x4901607f,
681 .flags = ADDR_TYPE_RT
682 },
683 { }
684};
685
686static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = { 528static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = {
687 .master = &omap2xxx_l4_wkup_hwmod, 529 .master = &omap2xxx_l4_wkup_hwmod,
688 .slave = &omap2xxx_wd_timer2_hwmod, 530 .slave = &omap2xxx_wd_timer2_hwmod,
689 .clk = "mpu_wdt_ick", 531 .clk = "mpu_wdt_ick",
690 .addr = omap2430_wd_timer2_addrs,
691 .user = OCP_USER_MPU | OCP_USER_SDMA, 532 .user = OCP_USER_MPU | OCP_USER_SDMA,
692}; 533};
693 534
694/* l4_wkup -> gpio1 */ 535/* l4_wkup -> gpio1 */
695static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = {
696 {
697 .pa_start = 0x4900C000,
698 .pa_end = 0x4900C1ff,
699 .flags = ADDR_TYPE_RT
700 },
701 { }
702};
703
704static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = { 536static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = {
705 .master = &omap2xxx_l4_wkup_hwmod, 537 .master = &omap2xxx_l4_wkup_hwmod,
706 .slave = &omap2xxx_gpio1_hwmod, 538 .slave = &omap2xxx_gpio1_hwmod,
707 .clk = "gpios_ick", 539 .clk = "gpios_ick",
708 .addr = omap2430_gpio1_addr_space,
709 .user = OCP_USER_MPU | OCP_USER_SDMA, 540 .user = OCP_USER_MPU | OCP_USER_SDMA,
710}; 541};
711 542
712/* l4_wkup -> gpio2 */ 543/* l4_wkup -> gpio2 */
713static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = {
714 {
715 .pa_start = 0x4900E000,
716 .pa_end = 0x4900E1ff,
717 .flags = ADDR_TYPE_RT
718 },
719 { }
720};
721
722static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = { 544static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = {
723 .master = &omap2xxx_l4_wkup_hwmod, 545 .master = &omap2xxx_l4_wkup_hwmod,
724 .slave = &omap2xxx_gpio2_hwmod, 546 .slave = &omap2xxx_gpio2_hwmod,
725 .clk = "gpios_ick", 547 .clk = "gpios_ick",
726 .addr = omap2430_gpio2_addr_space,
727 .user = OCP_USER_MPU | OCP_USER_SDMA, 548 .user = OCP_USER_MPU | OCP_USER_SDMA,
728}; 549};
729 550
730/* l4_wkup -> gpio3 */ 551/* l4_wkup -> gpio3 */
731static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = {
732 {
733 .pa_start = 0x49010000,
734 .pa_end = 0x490101ff,
735 .flags = ADDR_TYPE_RT
736 },
737 { }
738};
739
740static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = { 552static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = {
741 .master = &omap2xxx_l4_wkup_hwmod, 553 .master = &omap2xxx_l4_wkup_hwmod,
742 .slave = &omap2xxx_gpio3_hwmod, 554 .slave = &omap2xxx_gpio3_hwmod,
743 .clk = "gpios_ick", 555 .clk = "gpios_ick",
744 .addr = omap2430_gpio3_addr_space,
745 .user = OCP_USER_MPU | OCP_USER_SDMA, 556 .user = OCP_USER_MPU | OCP_USER_SDMA,
746}; 557};
747 558
748/* l4_wkup -> gpio4 */ 559/* l4_wkup -> gpio4 */
749static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = {
750 {
751 .pa_start = 0x49012000,
752 .pa_end = 0x490121ff,
753 .flags = ADDR_TYPE_RT
754 },
755 { }
756};
757
758static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = { 560static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = {
759 .master = &omap2xxx_l4_wkup_hwmod, 561 .master = &omap2xxx_l4_wkup_hwmod,
760 .slave = &omap2xxx_gpio4_hwmod, 562 .slave = &omap2xxx_gpio4_hwmod,
761 .clk = "gpios_ick", 563 .clk = "gpios_ick",
762 .addr = omap2430_gpio4_addr_space,
763 .user = OCP_USER_MPU | OCP_USER_SDMA, 564 .user = OCP_USER_MPU | OCP_USER_SDMA,
764}; 565};
765 566
766/* l4_core -> gpio5 */ 567/* l4_core -> gpio5 */
767static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = {
768 {
769 .pa_start = 0x480B6000,
770 .pa_end = 0x480B61ff,
771 .flags = ADDR_TYPE_RT
772 },
773 { }
774};
775
776static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = { 568static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = {
777 .master = &omap2xxx_l4_core_hwmod, 569 .master = &omap2xxx_l4_core_hwmod,
778 .slave = &omap2430_gpio5_hwmod, 570 .slave = &omap2430_gpio5_hwmod,
779 .clk = "gpio5_ick", 571 .clk = "gpio5_ick",
780 .addr = omap2430_gpio5_addr_space,
781 .user = OCP_USER_MPU | OCP_USER_SDMA, 572 .user = OCP_USER_MPU | OCP_USER_SDMA,
782}; 573};
783 574
@@ -802,7 +593,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__dma_system = {
802static struct omap_hwmod_ocp_if omap2430_l4_core__mailbox = { 593static struct omap_hwmod_ocp_if omap2430_l4_core__mailbox = {
803 .master = &omap2xxx_l4_core_hwmod, 594 .master = &omap2xxx_l4_core_hwmod,
804 .slave = &omap2430_mailbox_hwmod, 595 .slave = &omap2430_mailbox_hwmod,
805 .addr = omap2_mailbox_addrs,
806 .user = OCP_USER_MPU | OCP_USER_SDMA, 596 .user = OCP_USER_MPU | OCP_USER_SDMA,
807}; 597};
808 598
@@ -811,7 +601,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp1 = {
811 .master = &omap2xxx_l4_core_hwmod, 601 .master = &omap2xxx_l4_core_hwmod,
812 .slave = &omap2430_mcbsp1_hwmod, 602 .slave = &omap2430_mcbsp1_hwmod,
813 .clk = "mcbsp1_ick", 603 .clk = "mcbsp1_ick",
814 .addr = omap2_mcbsp1_addrs,
815 .user = OCP_USER_MPU | OCP_USER_SDMA, 604 .user = OCP_USER_MPU | OCP_USER_SDMA,
816}; 605};
817 606
@@ -820,64 +609,30 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp2 = {
820 .master = &omap2xxx_l4_core_hwmod, 609 .master = &omap2xxx_l4_core_hwmod,
821 .slave = &omap2430_mcbsp2_hwmod, 610 .slave = &omap2430_mcbsp2_hwmod,
822 .clk = "mcbsp2_ick", 611 .clk = "mcbsp2_ick",
823 .addr = omap2xxx_mcbsp2_addrs,
824 .user = OCP_USER_MPU | OCP_USER_SDMA, 612 .user = OCP_USER_MPU | OCP_USER_SDMA,
825}; 613};
826 614
827static struct omap_hwmod_addr_space omap2430_mcbsp3_addrs[] = {
828 {
829 .name = "mpu",
830 .pa_start = 0x4808C000,
831 .pa_end = 0x4808C0ff,
832 .flags = ADDR_TYPE_RT
833 },
834 { }
835};
836
837/* l4_core -> mcbsp3 */ 615/* l4_core -> mcbsp3 */
838static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp3 = { 616static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp3 = {
839 .master = &omap2xxx_l4_core_hwmod, 617 .master = &omap2xxx_l4_core_hwmod,
840 .slave = &omap2430_mcbsp3_hwmod, 618 .slave = &omap2430_mcbsp3_hwmod,
841 .clk = "mcbsp3_ick", 619 .clk = "mcbsp3_ick",
842 .addr = omap2430_mcbsp3_addrs,
843 .user = OCP_USER_MPU | OCP_USER_SDMA, 620 .user = OCP_USER_MPU | OCP_USER_SDMA,
844}; 621};
845 622
846static struct omap_hwmod_addr_space omap2430_mcbsp4_addrs[] = {
847 {
848 .name = "mpu",
849 .pa_start = 0x4808E000,
850 .pa_end = 0x4808E0ff,
851 .flags = ADDR_TYPE_RT
852 },
853 { }
854};
855
856/* l4_core -> mcbsp4 */ 623/* l4_core -> mcbsp4 */
857static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp4 = { 624static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp4 = {
858 .master = &omap2xxx_l4_core_hwmod, 625 .master = &omap2xxx_l4_core_hwmod,
859 .slave = &omap2430_mcbsp4_hwmod, 626 .slave = &omap2430_mcbsp4_hwmod,
860 .clk = "mcbsp4_ick", 627 .clk = "mcbsp4_ick",
861 .addr = omap2430_mcbsp4_addrs,
862 .user = OCP_USER_MPU | OCP_USER_SDMA, 628 .user = OCP_USER_MPU | OCP_USER_SDMA,
863}; 629};
864 630
865static struct omap_hwmod_addr_space omap2430_mcbsp5_addrs[] = {
866 {
867 .name = "mpu",
868 .pa_start = 0x48096000,
869 .pa_end = 0x480960ff,
870 .flags = ADDR_TYPE_RT
871 },
872 { }
873};
874
875/* l4_core -> mcbsp5 */ 631/* l4_core -> mcbsp5 */
876static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp5 = { 632static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp5 = {
877 .master = &omap2xxx_l4_core_hwmod, 633 .master = &omap2xxx_l4_core_hwmod,
878 .slave = &omap2430_mcbsp5_hwmod, 634 .slave = &omap2430_mcbsp5_hwmod,
879 .clk = "mcbsp5_ick", 635 .clk = "mcbsp5_ick",
880 .addr = omap2430_mcbsp5_addrs,
881 .user = OCP_USER_MPU | OCP_USER_SDMA, 636 .user = OCP_USER_MPU | OCP_USER_SDMA,
882}; 637};
883 638
@@ -886,35 +641,15 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__hdq1w = {
886 .master = &omap2xxx_l4_core_hwmod, 641 .master = &omap2xxx_l4_core_hwmod,
887 .slave = &omap2430_hdq1w_hwmod, 642 .slave = &omap2430_hdq1w_hwmod,
888 .clk = "hdq_ick", 643 .clk = "hdq_ick",
889 .addr = omap2_hdq1w_addr_space,
890 .user = OCP_USER_MPU | OCP_USER_SDMA, 644 .user = OCP_USER_MPU | OCP_USER_SDMA,
891 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE, 645 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
892}; 646};
893 647
894/* l4_wkup -> 32ksync_counter */ 648/* l4_wkup -> 32ksync_counter */
895static struct omap_hwmod_addr_space omap2430_counter_32k_addrs[] = {
896 {
897 .pa_start = 0x49020000,
898 .pa_end = 0x4902001f,
899 .flags = ADDR_TYPE_RT
900 },
901 { }
902};
903
904static struct omap_hwmod_addr_space omap2430_gpmc_addrs[] = {
905 {
906 .pa_start = 0x6e000000,
907 .pa_end = 0x6e000fff,
908 .flags = ADDR_TYPE_RT
909 },
910 { }
911};
912
913static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = { 649static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = {
914 .master = &omap2xxx_l4_wkup_hwmod, 650 .master = &omap2xxx_l4_wkup_hwmod,
915 .slave = &omap2xxx_counter_32k_hwmod, 651 .slave = &omap2xxx_counter_32k_hwmod,
916 .clk = "sync_32k_ick", 652 .clk = "sync_32k_ick",
917 .addr = omap2430_counter_32k_addrs,
918 .user = OCP_USER_MPU | OCP_USER_SDMA, 653 .user = OCP_USER_MPU | OCP_USER_SDMA,
919}; 654};
920 655
@@ -922,7 +657,6 @@ static struct omap_hwmod_ocp_if omap2430_l3__gpmc = {
922 .master = &omap2xxx_l3_main_hwmod, 657 .master = &omap2xxx_l3_main_hwmod,
923 .slave = &omap2xxx_gpmc_hwmod, 658 .slave = &omap2xxx_gpmc_hwmod,
924 .clk = "core_l3_ck", 659 .clk = "core_l3_ck",
925 .addr = omap2430_gpmc_addrs,
926 .user = OCP_USER_MPU | OCP_USER_SDMA, 660 .user = OCP_USER_MPU | OCP_USER_SDMA,
927}; 661};
928 662
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
index 5fd40d4a989e..656861c29d5c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -20,142 +20,6 @@
20 20
21#include "omap_hwmod_common_data.h" 21#include "omap_hwmod_common_data.h"
22 22
23static struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[] = {
24 {
25 .pa_start = OMAP2_UART1_BASE,
26 .pa_end = OMAP2_UART1_BASE + SZ_8K - 1,
27 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
28 },
29 { }
30};
31
32static struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[] = {
33 {
34 .pa_start = OMAP2_UART2_BASE,
35 .pa_end = OMAP2_UART2_BASE + SZ_1K - 1,
36 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
37 },
38 { }
39};
40
41static struct omap_hwmod_addr_space omap2xxx_uart3_addr_space[] = {
42 {
43 .pa_start = OMAP2_UART3_BASE,
44 .pa_end = OMAP2_UART3_BASE + SZ_1K - 1,
45 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
46 },
47 { }
48};
49
50static struct omap_hwmod_addr_space omap2xxx_timer2_addrs[] = {
51 {
52 .pa_start = 0x4802a000,
53 .pa_end = 0x4802a000 + SZ_1K - 1,
54 .flags = ADDR_TYPE_RT
55 },
56 { }
57};
58
59static struct omap_hwmod_addr_space omap2xxx_timer3_addrs[] = {
60 {
61 .pa_start = 0x48078000,
62 .pa_end = 0x48078000 + SZ_1K - 1,
63 .flags = ADDR_TYPE_RT
64 },
65 { }
66};
67
68static struct omap_hwmod_addr_space omap2xxx_timer4_addrs[] = {
69 {
70 .pa_start = 0x4807a000,
71 .pa_end = 0x4807a000 + SZ_1K - 1,
72 .flags = ADDR_TYPE_RT
73 },
74 { }
75};
76
77static struct omap_hwmod_addr_space omap2xxx_timer5_addrs[] = {
78 {
79 .pa_start = 0x4807c000,
80 .pa_end = 0x4807c000 + SZ_1K - 1,
81 .flags = ADDR_TYPE_RT
82 },
83 { }
84};
85
86static struct omap_hwmod_addr_space omap2xxx_timer6_addrs[] = {
87 {
88 .pa_start = 0x4807e000,
89 .pa_end = 0x4807e000 + SZ_1K - 1,
90 .flags = ADDR_TYPE_RT
91 },
92 { }
93};
94
95static struct omap_hwmod_addr_space omap2xxx_timer7_addrs[] = {
96 {
97 .pa_start = 0x48080000,
98 .pa_end = 0x48080000 + SZ_1K - 1,
99 .flags = ADDR_TYPE_RT
100 },
101 { }
102};
103
104static struct omap_hwmod_addr_space omap2xxx_timer8_addrs[] = {
105 {
106 .pa_start = 0x48082000,
107 .pa_end = 0x48082000 + SZ_1K - 1,
108 .flags = ADDR_TYPE_RT
109 },
110 { }
111};
112
113static struct omap_hwmod_addr_space omap2xxx_timer9_addrs[] = {
114 {
115 .pa_start = 0x48084000,
116 .pa_end = 0x48084000 + SZ_1K - 1,
117 .flags = ADDR_TYPE_RT
118 },
119 { }
120};
121
122struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[] = {
123 {
124 .name = "mpu",
125 .pa_start = 0x48076000,
126 .pa_end = 0x480760ff,
127 .flags = ADDR_TYPE_RT
128 },
129 { }
130};
131
132static struct omap_hwmod_addr_space omap2_rng_addr_space[] = {
133 {
134 .pa_start = 0x480a0000,
135 .pa_end = 0x480a004f,
136 .flags = ADDR_TYPE_RT
137 },
138 { }
139};
140
141static struct omap_hwmod_addr_space omap2xxx_sham_addrs[] = {
142 {
143 .pa_start = 0x480a4000,
144 .pa_end = 0x480a4000 + 0x64 - 1,
145 .flags = ADDR_TYPE_RT
146 },
147 { }
148};
149
150static struct omap_hwmod_addr_space omap2xxx_aes_addrs[] = {
151 {
152 .pa_start = 0x480a6000,
153 .pa_end = 0x480a6000 + 0x50 - 1,
154 .flags = ADDR_TYPE_RT
155 },
156 { }
157};
158
159/* 23/*
160 * Common interconnect data 24 * Common interconnect data
161 */ 25 */
@@ -182,7 +46,7 @@ struct omap_hwmod_ocp_if omap2xxx_dss__l3 = {
182 .omap2 = { 46 .omap2 = {
183 .l3_perm_bit = OMAP2_L3_CORE_FW_CONNID_DSS, 47 .l3_perm_bit = OMAP2_L3_CORE_FW_CONNID_DSS,
184 .flags = OMAP_FIREWALL_L3, 48 .flags = OMAP_FIREWALL_L3,
185 } 49 },
186 }, 50 },
187 .user = OCP_USER_MPU | OCP_USER_SDMA, 51 .user = OCP_USER_MPU | OCP_USER_SDMA,
188}; 52};
@@ -199,7 +63,6 @@ struct omap_hwmod_ocp_if omap2_l4_core__uart1 = {
199 .master = &omap2xxx_l4_core_hwmod, 63 .master = &omap2xxx_l4_core_hwmod,
200 .slave = &omap2xxx_uart1_hwmod, 64 .slave = &omap2xxx_uart1_hwmod,
201 .clk = "uart1_ick", 65 .clk = "uart1_ick",
202 .addr = omap2xxx_uart1_addr_space,
203 .user = OCP_USER_MPU | OCP_USER_SDMA, 66 .user = OCP_USER_MPU | OCP_USER_SDMA,
204}; 67};
205 68
@@ -208,7 +71,6 @@ struct omap_hwmod_ocp_if omap2_l4_core__uart2 = {
208 .master = &omap2xxx_l4_core_hwmod, 71 .master = &omap2xxx_l4_core_hwmod,
209 .slave = &omap2xxx_uart2_hwmod, 72 .slave = &omap2xxx_uart2_hwmod,
210 .clk = "uart2_ick", 73 .clk = "uart2_ick",
211 .addr = omap2xxx_uart2_addr_space,
212 .user = OCP_USER_MPU | OCP_USER_SDMA, 74 .user = OCP_USER_MPU | OCP_USER_SDMA,
213}; 75};
214 76
@@ -217,7 +79,6 @@ struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
217 .master = &omap2xxx_l4_core_hwmod, 79 .master = &omap2xxx_l4_core_hwmod,
218 .slave = &omap2xxx_uart3_hwmod, 80 .slave = &omap2xxx_uart3_hwmod,
219 .clk = "uart3_ick", 81 .clk = "uart3_ick",
220 .addr = omap2xxx_uart3_addr_space,
221 .user = OCP_USER_MPU | OCP_USER_SDMA, 82 .user = OCP_USER_MPU | OCP_USER_SDMA,
222}; 83};
223 84
@@ -226,7 +87,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi1 = {
226 .master = &omap2xxx_l4_core_hwmod, 87 .master = &omap2xxx_l4_core_hwmod,
227 .slave = &omap2xxx_mcspi1_hwmod, 88 .slave = &omap2xxx_mcspi1_hwmod,
228 .clk = "mcspi1_ick", 89 .clk = "mcspi1_ick",
229 .addr = omap2_mcspi1_addr_space,
230 .user = OCP_USER_MPU | OCP_USER_SDMA, 90 .user = OCP_USER_MPU | OCP_USER_SDMA,
231}; 91};
232 92
@@ -235,7 +95,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi2 = {
235 .master = &omap2xxx_l4_core_hwmod, 95 .master = &omap2xxx_l4_core_hwmod,
236 .slave = &omap2xxx_mcspi2_hwmod, 96 .slave = &omap2xxx_mcspi2_hwmod,
237 .clk = "mcspi2_ick", 97 .clk = "mcspi2_ick",
238 .addr = omap2_mcspi2_addr_space,
239 .user = OCP_USER_MPU | OCP_USER_SDMA, 98 .user = OCP_USER_MPU | OCP_USER_SDMA,
240}; 99};
241 100
@@ -244,7 +103,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer2 = {
244 .master = &omap2xxx_l4_core_hwmod, 103 .master = &omap2xxx_l4_core_hwmod,
245 .slave = &omap2xxx_timer2_hwmod, 104 .slave = &omap2xxx_timer2_hwmod,
246 .clk = "gpt2_ick", 105 .clk = "gpt2_ick",
247 .addr = omap2xxx_timer2_addrs,
248 .user = OCP_USER_MPU | OCP_USER_SDMA, 106 .user = OCP_USER_MPU | OCP_USER_SDMA,
249}; 107};
250 108
@@ -253,7 +111,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer3 = {
253 .master = &omap2xxx_l4_core_hwmod, 111 .master = &omap2xxx_l4_core_hwmod,
254 .slave = &omap2xxx_timer3_hwmod, 112 .slave = &omap2xxx_timer3_hwmod,
255 .clk = "gpt3_ick", 113 .clk = "gpt3_ick",
256 .addr = omap2xxx_timer3_addrs,
257 .user = OCP_USER_MPU | OCP_USER_SDMA, 114 .user = OCP_USER_MPU | OCP_USER_SDMA,
258}; 115};
259 116
@@ -262,7 +119,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer4 = {
262 .master = &omap2xxx_l4_core_hwmod, 119 .master = &omap2xxx_l4_core_hwmod,
263 .slave = &omap2xxx_timer4_hwmod, 120 .slave = &omap2xxx_timer4_hwmod,
264 .clk = "gpt4_ick", 121 .clk = "gpt4_ick",
265 .addr = omap2xxx_timer4_addrs,
266 .user = OCP_USER_MPU | OCP_USER_SDMA, 122 .user = OCP_USER_MPU | OCP_USER_SDMA,
267}; 123};
268 124
@@ -271,7 +127,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer5 = {
271 .master = &omap2xxx_l4_core_hwmod, 127 .master = &omap2xxx_l4_core_hwmod,
272 .slave = &omap2xxx_timer5_hwmod, 128 .slave = &omap2xxx_timer5_hwmod,
273 .clk = "gpt5_ick", 129 .clk = "gpt5_ick",
274 .addr = omap2xxx_timer5_addrs,
275 .user = OCP_USER_MPU | OCP_USER_SDMA, 130 .user = OCP_USER_MPU | OCP_USER_SDMA,
276}; 131};
277 132
@@ -280,7 +135,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer6 = {
280 .master = &omap2xxx_l4_core_hwmod, 135 .master = &omap2xxx_l4_core_hwmod,
281 .slave = &omap2xxx_timer6_hwmod, 136 .slave = &omap2xxx_timer6_hwmod,
282 .clk = "gpt6_ick", 137 .clk = "gpt6_ick",
283 .addr = omap2xxx_timer6_addrs,
284 .user = OCP_USER_MPU | OCP_USER_SDMA, 138 .user = OCP_USER_MPU | OCP_USER_SDMA,
285}; 139};
286 140
@@ -289,7 +143,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer7 = {
289 .master = &omap2xxx_l4_core_hwmod, 143 .master = &omap2xxx_l4_core_hwmod,
290 .slave = &omap2xxx_timer7_hwmod, 144 .slave = &omap2xxx_timer7_hwmod,
291 .clk = "gpt7_ick", 145 .clk = "gpt7_ick",
292 .addr = omap2xxx_timer7_addrs,
293 .user = OCP_USER_MPU | OCP_USER_SDMA, 146 .user = OCP_USER_MPU | OCP_USER_SDMA,
294}; 147};
295 148
@@ -298,7 +151,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer8 = {
298 .master = &omap2xxx_l4_core_hwmod, 151 .master = &omap2xxx_l4_core_hwmod,
299 .slave = &omap2xxx_timer8_hwmod, 152 .slave = &omap2xxx_timer8_hwmod,
300 .clk = "gpt8_ick", 153 .clk = "gpt8_ick",
301 .addr = omap2xxx_timer8_addrs,
302 .user = OCP_USER_MPU | OCP_USER_SDMA, 154 .user = OCP_USER_MPU | OCP_USER_SDMA,
303}; 155};
304 156
@@ -307,7 +159,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer9 = {
307 .master = &omap2xxx_l4_core_hwmod, 159 .master = &omap2xxx_l4_core_hwmod,
308 .slave = &omap2xxx_timer9_hwmod, 160 .slave = &omap2xxx_timer9_hwmod,
309 .clk = "gpt9_ick", 161 .clk = "gpt9_ick",
310 .addr = omap2xxx_timer9_addrs,
311 .user = OCP_USER_MPU | OCP_USER_SDMA, 162 .user = OCP_USER_MPU | OCP_USER_SDMA,
312}; 163};
313 164
@@ -316,7 +167,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer10 = {
316 .master = &omap2xxx_l4_core_hwmod, 167 .master = &omap2xxx_l4_core_hwmod,
317 .slave = &omap2xxx_timer10_hwmod, 168 .slave = &omap2xxx_timer10_hwmod,
318 .clk = "gpt10_ick", 169 .clk = "gpt10_ick",
319 .addr = omap2_timer10_addrs,
320 .user = OCP_USER_MPU | OCP_USER_SDMA, 170 .user = OCP_USER_MPU | OCP_USER_SDMA,
321}; 171};
322 172
@@ -325,7 +175,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer11 = {
325 .master = &omap2xxx_l4_core_hwmod, 175 .master = &omap2xxx_l4_core_hwmod,
326 .slave = &omap2xxx_timer11_hwmod, 176 .slave = &omap2xxx_timer11_hwmod,
327 .clk = "gpt11_ick", 177 .clk = "gpt11_ick",
328 .addr = omap2_timer11_addrs,
329 .user = OCP_USER_MPU | OCP_USER_SDMA, 178 .user = OCP_USER_MPU | OCP_USER_SDMA,
330}; 179};
331 180
@@ -334,7 +183,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer12 = {
334 .master = &omap2xxx_l4_core_hwmod, 183 .master = &omap2xxx_l4_core_hwmod,
335 .slave = &omap2xxx_timer12_hwmod, 184 .slave = &omap2xxx_timer12_hwmod,
336 .clk = "gpt12_ick", 185 .clk = "gpt12_ick",
337 .addr = omap2xxx_timer12_addrs,
338 .user = OCP_USER_MPU | OCP_USER_SDMA, 186 .user = OCP_USER_MPU | OCP_USER_SDMA,
339}; 187};
340 188
@@ -348,7 +196,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss = {
348 .omap2 = { 196 .omap2 = {
349 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION, 197 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
350 .flags = OMAP_FIREWALL_L4, 198 .flags = OMAP_FIREWALL_L4,
351 } 199 },
352 }, 200 },
353 .user = OCP_USER_MPU | OCP_USER_SDMA, 201 .user = OCP_USER_MPU | OCP_USER_SDMA,
354}; 202};
@@ -363,7 +211,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc = {
363 .omap2 = { 211 .omap2 = {
364 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_DISPC_REGION, 212 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_DISPC_REGION,
365 .flags = OMAP_FIREWALL_L4, 213 .flags = OMAP_FIREWALL_L4,
366 } 214 },
367 }, 215 },
368 .user = OCP_USER_MPU | OCP_USER_SDMA, 216 .user = OCP_USER_MPU | OCP_USER_SDMA,
369}; 217};
@@ -378,7 +226,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi = {
378 .omap2 = { 226 .omap2 = {
379 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION, 227 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
380 .flags = OMAP_FIREWALL_L4, 228 .flags = OMAP_FIREWALL_L4,
381 } 229 },
382 }, 230 },
383 .user = OCP_USER_MPU | OCP_USER_SDMA, 231 .user = OCP_USER_MPU | OCP_USER_SDMA,
384}; 232};
@@ -393,7 +241,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc = {
393 .omap2 = { 241 .omap2 = {
394 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_VENC_REGION, 242 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_VENC_REGION,
395 .flags = OMAP_FIREWALL_L4, 243 .flags = OMAP_FIREWALL_L4,
396 } 244 },
397 }, 245 },
398 .flags = OCPIF_SWSUP_IDLE, 246 .flags = OCPIF_SWSUP_IDLE,
399 .user = OCP_USER_MPU | OCP_USER_SDMA, 247 .user = OCP_USER_MPU | OCP_USER_SDMA,
@@ -404,7 +252,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__rng = {
404 .master = &omap2xxx_l4_core_hwmod, 252 .master = &omap2xxx_l4_core_hwmod,
405 .slave = &omap2xxx_rng_hwmod, 253 .slave = &omap2xxx_rng_hwmod,
406 .clk = "rng_ick", 254 .clk = "rng_ick",
407 .addr = omap2_rng_addr_space,
408 .user = OCP_USER_MPU | OCP_USER_SDMA, 255 .user = OCP_USER_MPU | OCP_USER_SDMA,
409}; 256};
410 257
@@ -413,7 +260,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__sham = {
413 .master = &omap2xxx_l4_core_hwmod, 260 .master = &omap2xxx_l4_core_hwmod,
414 .slave = &omap2xxx_sham_hwmod, 261 .slave = &omap2xxx_sham_hwmod,
415 .clk = "sha_ick", 262 .clk = "sha_ick",
416 .addr = omap2xxx_sham_addrs,
417 .user = OCP_USER_MPU | OCP_USER_SDMA, 263 .user = OCP_USER_MPU | OCP_USER_SDMA,
418}; 264};
419 265
@@ -422,6 +268,5 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__aes = {
422 .master = &omap2xxx_l4_core_hwmod, 268 .master = &omap2xxx_l4_core_hwmod,
423 .slave = &omap2xxx_aes_hwmod, 269 .slave = &omap2xxx_aes_hwmod,
424 .clk = "aes_ick", 270 .clk = "aes_ick",
425 .addr = omap2xxx_aes_addrs,
426 .user = OCP_USER_MPU | OCP_USER_SDMA, 271 .user = OCP_USER_MPU | OCP_USER_SDMA,
427}; 272};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index d23c77fadb31..8821b9d6bae4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -20,14 +20,9 @@
20#include "prm-regbits-24xx.h" 20#include "prm-regbits-24xx.h"
21#include "wd_timer.h" 21#include "wd_timer.h"
22 22
23struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[] = {
24 { .irq = 48 + OMAP_INTC_START, },
25 { .irq = -1 },
26};
27
28struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[] = { 23struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[] = {
29 { .name = "dispc", .dma_req = 5 }, 24 { .name = "dispc", .dma_req = 5 },
30 { .dma_req = -1 } 25 { .dma_req = -1, },
31}; 26};
32 27
33/* 28/*
@@ -219,14 +214,8 @@ struct omap_hwmod omap2xxx_l4_wkup_hwmod = {
219}; 214};
220 215
221/* MPU */ 216/* MPU */
222static struct omap_hwmod_irq_info omap2xxx_mpu_irqs[] = {
223 { .name = "pmu", .irq = 3 + OMAP_INTC_START },
224 { .irq = -1 }
225};
226
227struct omap_hwmod omap2xxx_mpu_hwmod = { 217struct omap_hwmod omap2xxx_mpu_hwmod = {
228 .name = "mpu", 218 .name = "mpu",
229 .mpu_irqs = omap2xxx_mpu_irqs,
230 .class = &mpu_hwmod_class, 219 .class = &mpu_hwmod_class,
231 .main_clk = "mpu_ck", 220 .main_clk = "mpu_ck",
232}; 221};
@@ -256,7 +245,6 @@ static struct omap_timer_capability_dev_attr capability_dsp_dev_attr = {
256 245
257struct omap_hwmod omap2xxx_timer1_hwmod = { 246struct omap_hwmod omap2xxx_timer1_hwmod = {
258 .name = "timer1", 247 .name = "timer1",
259 .mpu_irqs = omap2_timer1_mpu_irqs,
260 .main_clk = "gpt1_fck", 248 .main_clk = "gpt1_fck",
261 .prcm = { 249 .prcm = {
262 .omap2 = { 250 .omap2 = {
@@ -276,7 +264,6 @@ struct omap_hwmod omap2xxx_timer1_hwmod = {
276 264
277struct omap_hwmod omap2xxx_timer2_hwmod = { 265struct omap_hwmod omap2xxx_timer2_hwmod = {
278 .name = "timer2", 266 .name = "timer2",
279 .mpu_irqs = omap2_timer2_mpu_irqs,
280 .main_clk = "gpt2_fck", 267 .main_clk = "gpt2_fck",
281 .prcm = { 268 .prcm = {
282 .omap2 = { 269 .omap2 = {
@@ -295,7 +282,6 @@ struct omap_hwmod omap2xxx_timer2_hwmod = {
295 282
296struct omap_hwmod omap2xxx_timer3_hwmod = { 283struct omap_hwmod omap2xxx_timer3_hwmod = {
297 .name = "timer3", 284 .name = "timer3",
298 .mpu_irqs = omap2_timer3_mpu_irqs,
299 .main_clk = "gpt3_fck", 285 .main_clk = "gpt3_fck",
300 .prcm = { 286 .prcm = {
301 .omap2 = { 287 .omap2 = {
@@ -314,7 +300,6 @@ struct omap_hwmod omap2xxx_timer3_hwmod = {
314 300
315struct omap_hwmod omap2xxx_timer4_hwmod = { 301struct omap_hwmod omap2xxx_timer4_hwmod = {
316 .name = "timer4", 302 .name = "timer4",
317 .mpu_irqs = omap2_timer4_mpu_irqs,
318 .main_clk = "gpt4_fck", 303 .main_clk = "gpt4_fck",
319 .prcm = { 304 .prcm = {
320 .omap2 = { 305 .omap2 = {
@@ -333,7 +318,6 @@ struct omap_hwmod omap2xxx_timer4_hwmod = {
333 318
334struct omap_hwmod omap2xxx_timer5_hwmod = { 319struct omap_hwmod omap2xxx_timer5_hwmod = {
335 .name = "timer5", 320 .name = "timer5",
336 .mpu_irqs = omap2_timer5_mpu_irqs,
337 .main_clk = "gpt5_fck", 321 .main_clk = "gpt5_fck",
338 .prcm = { 322 .prcm = {
339 .omap2 = { 323 .omap2 = {
@@ -353,7 +337,6 @@ struct omap_hwmod omap2xxx_timer5_hwmod = {
353 337
354struct omap_hwmod omap2xxx_timer6_hwmod = { 338struct omap_hwmod omap2xxx_timer6_hwmod = {
355 .name = "timer6", 339 .name = "timer6",
356 .mpu_irqs = omap2_timer6_mpu_irqs,
357 .main_clk = "gpt6_fck", 340 .main_clk = "gpt6_fck",
358 .prcm = { 341 .prcm = {
359 .omap2 = { 342 .omap2 = {
@@ -373,7 +356,6 @@ struct omap_hwmod omap2xxx_timer6_hwmod = {
373 356
374struct omap_hwmod omap2xxx_timer7_hwmod = { 357struct omap_hwmod omap2xxx_timer7_hwmod = {
375 .name = "timer7", 358 .name = "timer7",
376 .mpu_irqs = omap2_timer7_mpu_irqs,
377 .main_clk = "gpt7_fck", 359 .main_clk = "gpt7_fck",
378 .prcm = { 360 .prcm = {
379 .omap2 = { 361 .omap2 = {
@@ -393,7 +375,6 @@ struct omap_hwmod omap2xxx_timer7_hwmod = {
393 375
394struct omap_hwmod omap2xxx_timer8_hwmod = { 376struct omap_hwmod omap2xxx_timer8_hwmod = {
395 .name = "timer8", 377 .name = "timer8",
396 .mpu_irqs = omap2_timer8_mpu_irqs,
397 .main_clk = "gpt8_fck", 378 .main_clk = "gpt8_fck",
398 .prcm = { 379 .prcm = {
399 .omap2 = { 380 .omap2 = {
@@ -413,7 +394,6 @@ struct omap_hwmod omap2xxx_timer8_hwmod = {
413 394
414struct omap_hwmod omap2xxx_timer9_hwmod = { 395struct omap_hwmod omap2xxx_timer9_hwmod = {
415 .name = "timer9", 396 .name = "timer9",
416 .mpu_irqs = omap2_timer9_mpu_irqs,
417 .main_clk = "gpt9_fck", 397 .main_clk = "gpt9_fck",
418 .prcm = { 398 .prcm = {
419 .omap2 = { 399 .omap2 = {
@@ -433,7 +413,6 @@ struct omap_hwmod omap2xxx_timer9_hwmod = {
433 413
434struct omap_hwmod omap2xxx_timer10_hwmod = { 414struct omap_hwmod omap2xxx_timer10_hwmod = {
435 .name = "timer10", 415 .name = "timer10",
436 .mpu_irqs = omap2_timer10_mpu_irqs,
437 .main_clk = "gpt10_fck", 416 .main_clk = "gpt10_fck",
438 .prcm = { 417 .prcm = {
439 .omap2 = { 418 .omap2 = {
@@ -453,7 +432,6 @@ struct omap_hwmod omap2xxx_timer10_hwmod = {
453 432
454struct omap_hwmod omap2xxx_timer11_hwmod = { 433struct omap_hwmod omap2xxx_timer11_hwmod = {
455 .name = "timer11", 434 .name = "timer11",
456 .mpu_irqs = omap2_timer11_mpu_irqs,
457 .main_clk = "gpt11_fck", 435 .main_clk = "gpt11_fck",
458 .prcm = { 436 .prcm = {
459 .omap2 = { 437 .omap2 = {
@@ -473,7 +451,6 @@ struct omap_hwmod omap2xxx_timer11_hwmod = {
473 451
474struct omap_hwmod omap2xxx_timer12_hwmod = { 452struct omap_hwmod omap2xxx_timer12_hwmod = {
475 .name = "timer12", 453 .name = "timer12",
476 .mpu_irqs = omap2xxx_timer12_mpu_irqs,
477 .main_clk = "gpt12_fck", 454 .main_clk = "gpt12_fck",
478 .prcm = { 455 .prcm = {
479 .omap2 = { 456 .omap2 = {
@@ -509,8 +486,6 @@ struct omap_hwmod omap2xxx_wd_timer2_hwmod = {
509 486
510struct omap_hwmod omap2xxx_uart1_hwmod = { 487struct omap_hwmod omap2xxx_uart1_hwmod = {
511 .name = "uart1", 488 .name = "uart1",
512 .mpu_irqs = omap2_uart1_mpu_irqs,
513 .sdma_reqs = omap2_uart1_sdma_reqs,
514 .main_clk = "uart1_fck", 489 .main_clk = "uart1_fck",
515 .flags = DEBUG_OMAP2UART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 490 .flags = DEBUG_OMAP2UART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
516 .prcm = { 491 .prcm = {
@@ -529,8 +504,6 @@ struct omap_hwmod omap2xxx_uart1_hwmod = {
529 504
530struct omap_hwmod omap2xxx_uart2_hwmod = { 505struct omap_hwmod omap2xxx_uart2_hwmod = {
531 .name = "uart2", 506 .name = "uart2",
532 .mpu_irqs = omap2_uart2_mpu_irqs,
533 .sdma_reqs = omap2_uart2_sdma_reqs,
534 .main_clk = "uart2_fck", 507 .main_clk = "uart2_fck",
535 .flags = DEBUG_OMAP2UART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 508 .flags = DEBUG_OMAP2UART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
536 .prcm = { 509 .prcm = {
@@ -549,8 +522,6 @@ struct omap_hwmod omap2xxx_uart2_hwmod = {
549 522
550struct omap_hwmod omap2xxx_uart3_hwmod = { 523struct omap_hwmod omap2xxx_uart3_hwmod = {
551 .name = "uart3", 524 .name = "uart3",
552 .mpu_irqs = omap2_uart3_mpu_irqs,
553 .sdma_reqs = omap2_uart3_sdma_reqs,
554 .main_clk = "uart3_fck", 525 .main_clk = "uart3_fck",
555 .flags = DEBUG_OMAP2UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT, 526 .flags = DEBUG_OMAP2UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
556 .prcm = { 527 .prcm = {
@@ -610,7 +581,7 @@ struct omap_hwmod omap2xxx_dss_dispc_hwmod = {
610 }, 581 },
611 }, 582 },
612 .flags = HWMOD_NO_IDLEST, 583 .flags = HWMOD_NO_IDLEST,
613 .dev_attr = &omap2_3_dss_dispc_dev_attr 584 .dev_attr = &omap2_3_dss_dispc_dev_attr,
614}; 585};
615 586
616static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = { 587static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
@@ -657,7 +628,6 @@ struct omap_gpio_dev_attr omap2xxx_gpio_dev_attr = {
657struct omap_hwmod omap2xxx_gpio1_hwmod = { 628struct omap_hwmod omap2xxx_gpio1_hwmod = {
658 .name = "gpio1", 629 .name = "gpio1",
659 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 630 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
660 .mpu_irqs = omap2_gpio1_irqs,
661 .main_clk = "gpios_fck", 631 .main_clk = "gpios_fck",
662 .prcm = { 632 .prcm = {
663 .omap2 = { 633 .omap2 = {
@@ -676,7 +646,6 @@ struct omap_hwmod omap2xxx_gpio1_hwmod = {
676struct omap_hwmod omap2xxx_gpio2_hwmod = { 646struct omap_hwmod omap2xxx_gpio2_hwmod = {
677 .name = "gpio2", 647 .name = "gpio2",
678 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 648 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
679 .mpu_irqs = omap2_gpio2_irqs,
680 .main_clk = "gpios_fck", 649 .main_clk = "gpios_fck",
681 .prcm = { 650 .prcm = {
682 .omap2 = { 651 .omap2 = {
@@ -695,7 +664,6 @@ struct omap_hwmod omap2xxx_gpio2_hwmod = {
695struct omap_hwmod omap2xxx_gpio3_hwmod = { 664struct omap_hwmod omap2xxx_gpio3_hwmod = {
696 .name = "gpio3", 665 .name = "gpio3",
697 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 666 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
698 .mpu_irqs = omap2_gpio3_irqs,
699 .main_clk = "gpios_fck", 667 .main_clk = "gpios_fck",
700 .prcm = { 668 .prcm = {
701 .omap2 = { 669 .omap2 = {
@@ -714,7 +682,6 @@ struct omap_hwmod omap2xxx_gpio3_hwmod = {
714struct omap_hwmod omap2xxx_gpio4_hwmod = { 682struct omap_hwmod omap2xxx_gpio4_hwmod = {
715 .name = "gpio4", 683 .name = "gpio4",
716 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 684 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
717 .mpu_irqs = omap2_gpio4_irqs,
718 .main_clk = "gpios_fck", 685 .main_clk = "gpios_fck",
719 .prcm = { 686 .prcm = {
720 .omap2 = { 687 .omap2 = {
@@ -736,8 +703,6 @@ static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = {
736 703
737struct omap_hwmod omap2xxx_mcspi1_hwmod = { 704struct omap_hwmod omap2xxx_mcspi1_hwmod = {
738 .name = "mcspi1", 705 .name = "mcspi1",
739 .mpu_irqs = omap2_mcspi1_mpu_irqs,
740 .sdma_reqs = omap2_mcspi1_sdma_reqs,
741 .main_clk = "mcspi1_fck", 706 .main_clk = "mcspi1_fck",
742 .prcm = { 707 .prcm = {
743 .omap2 = { 708 .omap2 = {
@@ -759,8 +724,6 @@ static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = {
759 724
760struct omap_hwmod omap2xxx_mcspi2_hwmod = { 725struct omap_hwmod omap2xxx_mcspi2_hwmod = {
761 .name = "mcspi2", 726 .name = "mcspi2",
762 .mpu_irqs = omap2_mcspi2_mpu_irqs,
763 .sdma_reqs = omap2_mcspi2_sdma_reqs,
764 .main_clk = "mcspi2_fck", 727 .main_clk = "mcspi2_fck",
765 .prcm = { 728 .prcm = {
766 .omap2 = { 729 .omap2 = {
@@ -795,15 +758,9 @@ struct omap_hwmod omap2xxx_counter_32k_hwmod = {
795}; 758};
796 759
797/* gpmc */ 760/* gpmc */
798static struct omap_hwmod_irq_info omap2xxx_gpmc_irqs[] = {
799 { .irq = 20 + OMAP_INTC_START, },
800 { .irq = -1 }
801};
802
803struct omap_hwmod omap2xxx_gpmc_hwmod = { 761struct omap_hwmod omap2xxx_gpmc_hwmod = {
804 .name = "gpmc", 762 .name = "gpmc",
805 .class = &omap2xxx_gpmc_hwmod_class, 763 .class = &omap2xxx_gpmc_hwmod_class,
806 .mpu_irqs = omap2xxx_gpmc_irqs,
807 .main_clk = "gpmc_fck", 764 .main_clk = "gpmc_fck",
808 /* 765 /*
809 * XXX HWMOD_INIT_NO_RESET should not be needed for this IP 766 * XXX HWMOD_INIT_NO_RESET should not be needed for this IP
@@ -840,14 +797,8 @@ static struct omap_hwmod_class omap2_rng_hwmod_class = {
840 .sysc = &omap2_rng_sysc, 797 .sysc = &omap2_rng_sysc,
841}; 798};
842 799
843static struct omap_hwmod_irq_info omap2_rng_mpu_irqs[] = {
844 { .irq = 52 + OMAP_INTC_START, },
845 { .irq = -1 }
846};
847
848struct omap_hwmod omap2xxx_rng_hwmod = { 800struct omap_hwmod omap2xxx_rng_hwmod = {
849 .name = "rng", 801 .name = "rng",
850 .mpu_irqs = omap2_rng_mpu_irqs,
851 .main_clk = "l4_ck", 802 .main_clk = "l4_ck",
852 .prcm = { 803 .prcm = {
853 .omap2 = { 804 .omap2 = {
@@ -884,20 +835,8 @@ static struct omap_hwmod_class omap2xxx_sham_class = {
884 .sysc = &omap2_sham_sysc, 835 .sysc = &omap2_sham_sysc,
885}; 836};
886 837
887static struct omap_hwmod_irq_info omap2_sham_mpu_irqs[] = {
888 { .irq = 51 + OMAP_INTC_START, },
889 { .irq = -1 }
890};
891
892static struct omap_hwmod_dma_info omap2_sham_sdma_chs[] = {
893 { .name = "rx", .dma_req = 13 },
894 { .dma_req = -1 }
895};
896
897struct omap_hwmod omap2xxx_sham_hwmod = { 838struct omap_hwmod omap2xxx_sham_hwmod = {
898 .name = "sham", 839 .name = "sham",
899 .mpu_irqs = omap2_sham_mpu_irqs,
900 .sdma_reqs = omap2_sham_sdma_chs,
901 .main_clk = "l4_ck", 840 .main_clk = "l4_ck",
902 .prcm = { 841 .prcm = {
903 .omap2 = { 842 .omap2 = {
@@ -927,15 +866,8 @@ static struct omap_hwmod_class omap2xxx_aes_class = {
927 .sysc = &omap2_aes_sysc, 866 .sysc = &omap2_aes_sysc,
928}; 867};
929 868
930static struct omap_hwmod_dma_info omap2_aes_sdma_chs[] = {
931 { .name = "tx", .dma_req = 9 },
932 { .name = "rx", .dma_req = 10 },
933 { .dma_req = -1 }
934};
935
936struct omap_hwmod omap2xxx_aes_hwmod = { 869struct omap_hwmod omap2xxx_aes_hwmod = {
937 .name = "aes", 870 .name = "aes",
938 .sdma_reqs = omap2_aes_sdma_chs,
939 .main_clk = "l4_ck", 871 .main_clk = "l4_ck",
940 .prcm = { 872 .prcm = {
941 .omap2 = { 873 .omap2 = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index 6e04ff7065e1..2c38c6b0ee03 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -18,9 +18,6 @@
18#include "common.h" 18#include "common.h"
19#include "display.h" 19#include "display.h"
20 20
21/* Common address space across OMAP2xxx */
22extern struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[];
23
24/* Common address space across OMAP2xxx/3xxx */ 21/* Common address space across OMAP2xxx/3xxx */
25extern struct omap_hwmod_addr_space omap2_i2c1_addr_space[]; 22extern struct omap_hwmod_addr_space omap2_i2c1_addr_space[];
26extern struct omap_hwmod_addr_space omap2_i2c2_addr_space[]; 23extern struct omap_hwmod_addr_space omap2_i2c2_addr_space[];
@@ -41,8 +38,6 @@ extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[];
41extern struct omap_hwmod_addr_space omap2_hdq1w_addr_space[]; 38extern struct omap_hwmod_addr_space omap2_hdq1w_addr_space[];
42 39
43/* Common IP block data across OMAP2xxx */ 40/* Common IP block data across OMAP2xxx */
44extern struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[];
45extern struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[];
46extern struct omap_gpio_dev_attr omap2xxx_gpio_dev_attr; 41extern struct omap_gpio_dev_attr omap2xxx_gpio_dev_attr;
47extern struct omap_hwmod omap2xxx_l3_main_hwmod; 42extern struct omap_hwmod omap2xxx_l3_main_hwmod;
48extern struct omap_hwmod omap2xxx_l4_core_hwmod; 43extern struct omap_hwmod omap2xxx_l4_core_hwmod;
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 39f020c982e8..3d5b24dcd9a4 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/davinci_emac.h>
11#include <linux/gpio.h> 12#include <linux/gpio.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
@@ -16,6 +17,7 @@
16 17
17#include <linux/platform_data/pinctrl-single.h> 18#include <linux/platform_data/pinctrl-single.h>
18 19
20#include "am35xx.h"
19#include "common.h" 21#include "common.h"
20#include "common-board-devices.h" 22#include "common-board-devices.h"
21#include "dss-common.h" 23#include "dss-common.h"
@@ -26,6 +28,9 @@ struct pdata_init {
26 void (*fn)(void); 28 void (*fn)(void);
27}; 29};
28 30
31struct of_dev_auxdata omap_auxdata_lookup[];
32static struct twl4030_gpio_platform_data twl_gpio_auxdata;
33
29/* 34/*
30 * Create alias for USB host PHY clock. 35 * Create alias for USB host PHY clock.
31 * Remove this when clock phandle can be provided via DT 36 * Remove this when clock phandle can be provided via DT
@@ -68,6 +73,15 @@ static inline void legacy_init_wl12xx(unsigned ref_clock,
68} 73}
69#endif 74#endif
70 75
76#ifdef CONFIG_MACH_NOKIA_N8X0
77static void __init omap2420_n8x0_legacy_init(void)
78{
79 omap_auxdata_lookup[0].platform_data = n8x0_legacy_init();
80}
81#else
82#define omap2420_n8x0_legacy_init NULL
83#endif
84
71#ifdef CONFIG_ARCH_OMAP3 85#ifdef CONFIG_ARCH_OMAP3
72static void __init hsmmc2_internal_input_clk(void) 86static void __init hsmmc2_internal_input_clk(void)
73{ 87{
@@ -78,6 +92,33 @@ static void __init hsmmc2_internal_input_clk(void)
78 omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1); 92 omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
79} 93}
80 94
95static int omap3_sbc_t3730_twl_callback(struct device *dev,
96 unsigned gpio,
97 unsigned ngpio)
98{
99 int res;
100
101 res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
102 "wlan rst");
103 if (res)
104 return res;
105
106 gpio_export(gpio, 0);
107
108 return 0;
109}
110
111static void __init omap3_sbc_t3730_twl_init(void)
112{
113 twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
114}
115
116static void __init omap3_sbc_t3730_legacy_init(void)
117{
118 legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 136);
119 omap_ads7846_init(1, 57, 0, NULL);
120}
121
81static void __init omap3_igep0020_legacy_init(void) 122static void __init omap3_igep0020_legacy_init(void)
82{ 123{
83 omap3_igep2_display_init_of(); 124 omap3_igep2_display_init_of();
@@ -92,6 +133,42 @@ static void __init omap3_zoom_legacy_init(void)
92{ 133{
93 legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162); 134 legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162);
94} 135}
136
137static void am35xx_enable_emac_int(void)
138{
139 u32 v;
140
141 v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
142 v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR |
143 AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
144 omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
145 omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
146}
147
148static void am35xx_disable_emac_int(void)
149{
150 u32 v;
151
152 v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
153 v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
154 omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
155 omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
156}
157
158static struct emac_platform_data am35xx_emac_pdata = {
159 .interrupt_enable = am35xx_enable_emac_int,
160 .interrupt_disable = am35xx_disable_emac_int,
161};
162
163static void __init am3517_evm_legacy_init(void)
164{
165 u32 v;
166
167 v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
168 v &= ~AM35XX_CPGMACSS_SW_RST;
169 omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
170 omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
171}
95#endif /* CONFIG_ARCH_OMAP3 */ 172#endif /* CONFIG_ARCH_OMAP3 */
96 173
97#ifdef CONFIG_ARCH_OMAP4 174#ifdef CONFIG_ARCH_OMAP4
@@ -125,10 +202,48 @@ void omap_pcs_legacy_init(int irq, void (*rearm)(void))
125 pcs_pdata.rearm = rearm; 202 pcs_pdata.rearm = rearm;
126} 203}
127 204
205/*
206 * GPIOs for TWL are initialized by the I2C bus and need custom
207 * handing until DSS has device tree bindings.
208 */
209void omap_auxdata_legacy_init(struct device *dev)
210{
211 if (dev->platform_data)
212 return;
213
214 if (strcmp("twl4030-gpio", dev_name(dev)))
215 return;
216
217 dev->platform_data = &twl_gpio_auxdata;
218}
219
220/*
221 * Few boards still need auxdata populated before we populate
222 * the dev entries in of_platform_populate().
223 */
224static struct pdata_init auxdata_quirks[] __initdata = {
225#ifdef CONFIG_SOC_OMAP2420
226 { "nokia,n800", omap2420_n8x0_legacy_init, },
227 { "nokia,n810", omap2420_n8x0_legacy_init, },
228 { "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
229#endif
230#ifdef CONFIG_ARCH_OMAP3
231 { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
232#endif
233 { /* sentinel */ },
234};
235
128struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { 236struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
237#ifdef CONFIG_MACH_NOKIA_N8X0
238 OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
239#endif
129#ifdef CONFIG_ARCH_OMAP3 240#ifdef CONFIG_ARCH_OMAP3
130 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata), 241 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
131 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata), 242 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
243 /* Only on am3517 */
244 OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
245 OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
246 &am35xx_emac_pdata),
132#endif 247#endif
133#ifdef CONFIG_ARCH_OMAP4 248#ifdef CONFIG_ARCH_OMAP4
134 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata), 249 OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
@@ -137,14 +252,20 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
137 { /* sentinel */ }, 252 { /* sentinel */ },
138}; 253};
139 254
255/*
256 * Few boards still need to initialize some legacy devices with
257 * platform data until the drivers support device tree.
258 */
140static struct pdata_init pdata_quirks[] __initdata = { 259static struct pdata_init pdata_quirks[] __initdata = {
141#ifdef CONFIG_ARCH_OMAP3 260#ifdef CONFIG_ARCH_OMAP3
261 { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
142 { "nokia,omap3-n900", hsmmc2_internal_input_clk, }, 262 { "nokia,omap3-n900", hsmmc2_internal_input_clk, },
143 { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, 263 { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
144 { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, 264 { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
145 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, 265 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, },
146 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, }, 266 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
147 { "ti,omap3-zoom3", omap3_zoom_legacy_init, }, 267 { "ti,omap3-zoom3", omap3_zoom_legacy_init, },
268 { "ti,am3517-evm", am3517_evm_legacy_init, },
148#endif 269#endif
149#ifdef CONFIG_ARCH_OMAP4 270#ifdef CONFIG_ARCH_OMAP4
150 { "ti,omap4-sdp", omap4_sdp_legacy_init, }, 271 { "ti,omap4-sdp", omap4_sdp_legacy_init, },
@@ -156,14 +277,8 @@ static struct pdata_init pdata_quirks[] __initdata = {
156 { /* sentinel */ }, 277 { /* sentinel */ },
157}; 278};
158 279
159void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table) 280static void pdata_quirks_check(struct pdata_init *quirks)
160{ 281{
161 struct pdata_init *quirks = pdata_quirks;
162
163 omap_sdrc_init(NULL, NULL);
164 of_platform_populate(NULL, omap_dt_match_table,
165 omap_auxdata_lookup, NULL);
166
167 while (quirks->compatible) { 282 while (quirks->compatible) {
168 if (of_machine_is_compatible(quirks->compatible)) { 283 if (of_machine_is_compatible(quirks->compatible)) {
169 if (quirks->fn) 284 if (quirks->fn)
@@ -173,3 +288,12 @@ void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
173 quirks++; 288 quirks++;
174 } 289 }
175} 290}
291
292void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
293{
294 omap_sdrc_init(NULL, NULL);
295 pdata_quirks_check(auxdata_quirks);
296 of_platform_populate(NULL, omap_dt_match_table,
297 omap_auxdata_lookup, NULL);
298 pdata_quirks_check(pdata_quirks);
299}
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 82f0698933d8..eefb30cfcabd 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -24,6 +24,8 @@
24#include "powerdomain.h" 24#include "powerdomain.h"
25#include "pm.h" 25#include "pm.h"
26 26
27u16 pm44xx_errata;
28
27struct power_state { 29struct power_state {
28 struct powerdomain *pwrdm; 30 struct powerdomain *pwrdm;
29 u32 next_state; 31 u32 next_state;
@@ -199,6 +201,19 @@ static inline int omap4_init_static_deps(void)
199} 201}
200 202
201/** 203/**
204 * omap4_pm_init_early - Does early initialization necessary for OMAP4+ devices
205 *
206 * Initializes basic stuff for power management functionality.
207 */
208int __init omap4_pm_init_early(void)
209{
210 if (cpu_is_omap446x())
211 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
212
213 return 0;
214}
215
216/**
202 * omap4_pm_init - Init routine for OMAP4+ devices 217 * omap4_pm_init - Init routine for OMAP4+ devices
203 * 218 *
204 * Initializes all powerdomain and clockdomain target states 219 * Initializes all powerdomain and clockdomain target states
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index ac25ae6667cf..623db40fdbbd 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -18,6 +18,7 @@
18# ifndef __ASSEMBLER__ 18# ifndef __ASSEMBLER__
19extern void __iomem *prm_base; 19extern void __iomem *prm_base;
20extern void omap2_set_globals_prm(void __iomem *prm); 20extern void omap2_set_globals_prm(void __iomem *prm);
21int of_prcm_init(void);
21# endif 22# endif
22 23
23 24
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index a2e1174ad1b6..b4c4ab9c8044 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -23,6 +23,10 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/of.h>
27#include <linux/of_address.h>
28#include <linux/clk-provider.h>
29#include <linux/clk/ti.h>
26 30
27#include "soc.h" 31#include "soc.h"
28#include "prm2xxx_3xxx.h" 32#include "prm2xxx_3xxx.h"
@@ -30,6 +34,7 @@
30#include "prm3xxx.h" 34#include "prm3xxx.h"
31#include "prm44xx.h" 35#include "prm44xx.h"
32#include "common.h" 36#include "common.h"
37#include "clock.h"
33 38
34/* 39/*
35 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs 40 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
@@ -464,3 +469,64 @@ int prm_unregister(struct prm_ll_data *pld)
464 469
465 return 0; 470 return 0;
466} 471}
472
473static struct of_device_id omap_prcm_dt_match_table[] = {
474 { .compatible = "ti,am3-prcm" },
475 { .compatible = "ti,am3-scrm" },
476 { .compatible = "ti,am4-prcm" },
477 { .compatible = "ti,am4-scrm" },
478 { .compatible = "ti,omap3-prm" },
479 { .compatible = "ti,omap3-cm" },
480 { .compatible = "ti,omap3-scrm" },
481 { .compatible = "ti,omap4-cm1" },
482 { .compatible = "ti,omap4-prm" },
483 { .compatible = "ti,omap4-cm2" },
484 { .compatible = "ti,omap4-scrm" },
485 { .compatible = "ti,omap5-prm" },
486 { .compatible = "ti,omap5-cm-core-aon" },
487 { .compatible = "ti,omap5-scrm" },
488 { .compatible = "ti,omap5-cm-core" },
489 { .compatible = "ti,dra7-prm" },
490 { .compatible = "ti,dra7-cm-core-aon" },
491 { .compatible = "ti,dra7-cm-core" },
492 { }
493};
494
495static struct clk_hw_omap memmap_dummy_ck = {
496 .flags = MEMMAP_ADDRESSING,
497};
498
499static u32 prm_clk_readl(void __iomem *reg)
500{
501 return omap2_clk_readl(&memmap_dummy_ck, reg);
502}
503
504static void prm_clk_writel(u32 val, void __iomem *reg)
505{
506 omap2_clk_writel(val, &memmap_dummy_ck, reg);
507}
508
509static struct ti_clk_ll_ops omap_clk_ll_ops = {
510 .clk_readl = prm_clk_readl,
511 .clk_writel = prm_clk_writel,
512};
513
514int __init of_prcm_init(void)
515{
516 struct device_node *np;
517 void __iomem *mem;
518 int memmap_index = 0;
519
520 ti_clk_ll_ops = &omap_clk_ll_ops;
521
522 for_each_matching_node(np, omap_prcm_dt_match_table) {
523 mem = of_iomap(np, 0);
524 clk_memmaps[memmap_index] = mem;
525 ti_dt_clk_init_provider(np, memmap_index);
526 memmap_index++;
527 }
528
529 ti_dt_clockdomains_setup();
530
531 return 0;
532}
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 3ca81e0ada5e..74044aaf438b 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -379,7 +379,7 @@ static struct clocksource clocksource_gpt = {
379 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 379 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
380}; 380};
381 381
382static u32 notrace dmtimer_read_sched_clock(void) 382static u64 notrace dmtimer_read_sched_clock(void)
383{ 383{
384 if (clksrc.reserved) 384 if (clksrc.reserved)
385 return __omap_dm_timer_read_counter(&clksrc, 385 return __omap_dm_timer_read_counter(&clksrc,
@@ -471,7 +471,7 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
471 __omap_dm_timer_load_start(&clksrc, 471 __omap_dm_timer_load_start(&clksrc,
472 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 472 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0,
473 OMAP_TIMER_NONPOSTED); 473 OMAP_TIMER_NONPOSTED);
474 setup_sched_clock(dmtimer_read_sched_clock, 32, clksrc.rate); 474 sched_clock_register(dmtimer_read_sched_clock, 32, clksrc.rate);
475 475
476 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate)) 476 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
477 pr_err("Could not register clocksource %s\n", 477 pr_err("Could not register clocksource %s\n",
@@ -570,8 +570,7 @@ static inline void __init realtime_counter_init(void)
570 clksrc_nr, clksrc_src, clksrc_prop) \ 570 clksrc_nr, clksrc_src, clksrc_prop) \
571void __init omap##name##_gptimer_timer_init(void) \ 571void __init omap##name##_gptimer_timer_init(void) \
572{ \ 572{ \
573 if (omap_clk_init) \ 573 omap_clk_init(); \
574 omap_clk_init(); \
575 omap_dmtimer_init(); \ 574 omap_dmtimer_init(); \
576 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 575 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
577 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \ 576 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \
@@ -582,8 +581,7 @@ void __init omap##name##_gptimer_timer_init(void) \
582 clksrc_nr, clksrc_src, clksrc_prop) \ 581 clksrc_nr, clksrc_src, clksrc_prop) \
583void __init omap##name##_sync32k_timer_init(void) \ 582void __init omap##name##_sync32k_timer_init(void) \
584{ \ 583{ \
585 if (omap_clk_init) \ 584 omap_clk_init(); \
586 omap_clk_init(); \
587 omap_dmtimer_init(); \ 585 omap_dmtimer_init(); \
588 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 586 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
589 /* Enable the use of clocksource="gp_timer" kernel parameter */ \ 587 /* Enable the use of clocksource="gp_timer" kernel parameter */ \
diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c
index b91002ca92f3..c134a826070a 100644
--- a/arch/arm/mach-orion5x/board-dt.c
+++ b/arch/arm/mach-orion5x/board-dt.c
@@ -21,7 +21,7 @@
21#include <plat/irq.h> 21#include <plat/irq.h>
22#include "common.h" 22#include "common.h"
23 23
24struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = { 24static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = {
25 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), 25 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
26 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", 26 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
27 NULL), 27 NULL),
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 91a5852b44f3..3f1de1111e0f 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -24,7 +24,6 @@
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/system_misc.h> 26#include <asm/system_misc.h>
27#include <asm/timex.h>
28#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
29#include <asm/mach/map.h> 28#include <asm/mach/map.h>
30#include <asm/mach/time.h> 29#include <asm/mach/time.h>
@@ -135,7 +134,7 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
135/***************************************************************************** 134/*****************************************************************************
136 * SPI 135 * SPI
137 ****************************************************************************/ 136 ****************************************************************************/
138void __init orion5x_spi_init() 137void __init orion5x_spi_init(void)
139{ 138{
140 orion_spi_init(SPI_PHYS_BASE); 139 orion_spi_init(SPI_PHYS_BASE);
141} 140}
@@ -185,7 +184,7 @@ static void __init orion5x_crypto_init(void)
185/***************************************************************************** 184/*****************************************************************************
186 * Watchdog 185 * Watchdog
187 ****************************************************************************/ 186 ****************************************************************************/
188void __init orion5x_wdt_init(void) 187static void __init orion5x_wdt_init(void)
189{ 188{
190 orion_wdt_init(); 189 orion_wdt_init();
191} 190}
@@ -246,7 +245,7 @@ void orion5x_setup_wins(void)
246 245
247int orion5x_tclk; 246int orion5x_tclk;
248 247
249int __init orion5x_find_tclk(void) 248static int __init orion5x_find_tclk(void)
250{ 249{
251 u32 dev, rev; 250 u32 dev, rev;
252 251
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index 4b2aefd1d961..dc01c4ffc9a8 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -202,7 +202,7 @@ __initcall(db88f5281_7seg_init);
202 * PCI 202 * PCI
203 ****************************************************************************/ 203 ****************************************************************************/
204 204
205void __init db88f5281_pci_preinit(void) 205static void __init db88f5281_pci_preinit(void)
206{ 206{
207 int pin; 207 int pin;
208 208
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 30a192b9c517..9654b0cc5892 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -16,6 +16,7 @@
16#include <mach/bridge-regs.h> 16#include <mach/bridge-regs.h>
17#include <plat/orion-gpio.h> 17#include <plat/orion-gpio.h>
18#include <plat/irq.h> 18#include <plat/irq.h>
19#include "common.h"
19 20
20static int __initdata gpio0_irqs[4] = { 21static int __initdata gpio0_irqs[4] = {
21 IRQ_ORION5X_GPIO_0_7, 22 IRQ_ORION5X_GPIO_0_7,
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index 7fab67053030..87a12d6930ff 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -240,11 +240,11 @@ static int __init pcie_setup(struct pci_sys_data *sys)
240#define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \ 240#define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \
241 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \ 241 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \
242 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \ 242 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \
243 ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0) 243 ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : NULL)
244#define PCI_BAR_REMAP_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \ 244#define PCI_BAR_REMAP_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \
245 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \ 245 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \
246 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \ 246 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \
247 ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0) 247 ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : NULL)
248#define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c) 248#define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c)
249#define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c) 249#define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c)
250 250
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index b1cf68493ffc..b576ef5f18a1 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -108,7 +108,7 @@ static struct platform_device rd88f5182_gpio_leds = {
108 * PCI 108 * PCI
109 ****************************************************************************/ 109 ****************************************************************************/
110 110
111void __init rd88f5182_pci_preinit(void) 111static void __init rd88f5182_pci_preinit(void)
112{ 112{
113 int pin; 113 int pin;
114 114
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c
index 7e9064844698..6208d125c1b9 100644
--- a/arch/arm/mach-orion5x/terastation_pro2-setup.c
+++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c
@@ -77,7 +77,7 @@ static struct platform_device tsp2_nor_flash = {
77#define TSP2_PCI_SLOT0_OFFS 7 77#define TSP2_PCI_SLOT0_OFFS 7
78#define TSP2_PCI_SLOT0_IRQ_PIN 11 78#define TSP2_PCI_SLOT0_IRQ_PIN 11
79 79
80void __init tsp2_pci_preinit(void) 80static void __init tsp2_pci_preinit(void)
81{ 81{
82 int pin; 82 int pin;
83 83
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index e90c0618fdad..9136797addb2 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -106,7 +106,7 @@ static struct platform_device qnap_ts209_nor_flash = {
106#define QNAP_TS209_PCI_SLOT0_IRQ_PIN 6 106#define QNAP_TS209_PCI_SLOT0_IRQ_PIN 6
107#define QNAP_TS209_PCI_SLOT1_IRQ_PIN 7 107#define QNAP_TS209_PCI_SLOT1_IRQ_PIN 7
108 108
109void __init qnap_ts209_pci_preinit(void) 109static void __init qnap_ts209_pci_preinit(void)
110{ 110{
111 int pin; 111 int pin;
112 112
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index e960855d32ac..db16dae441e2 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -57,7 +57,7 @@ static struct map_desc ts78xx_io_desc[] __initdata = {
57 }, 57 },
58}; 58};
59 59
60void __init ts78xx_map_io(void) 60static void __init ts78xx_map_io(void)
61{ 61{
62 orion5x_map_io(); 62 orion5x_map_io();
63 iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc)); 63 iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc));
diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c
index 3dbcb1ab6e37..e358b0736dea 100644
--- a/arch/arm/mach-prima2/platsmp.c
+++ b/arch/arm/mach-prima2/platsmp.c
@@ -106,8 +106,7 @@ static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle)
106 * "cpu" is Linux's internal ID. 106 * "cpu" is Linux's internal ID.
107 */ 107 */
108 pen_release = cpu_logical_map(cpu); 108 pen_release = cpu_logical_map(cpu);
109 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); 109 sync_cache_w(&pen_release);
110 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
111 110
112 /* 111 /*
113 * Send the secondary CPU SEV, thereby causing the boot monitor to read 112 * Send the secondary CPU SEV, thereby causing the boot monitor to read
diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
index ffa6d811aad8..12fb0f4ae359 100644
--- a/arch/arm/mach-pxa/am200epd.c
+++ b/arch/arm/mach-pxa/am200epd.c
@@ -293,8 +293,7 @@ static int am200_setup_irq(struct fb_info *info)
293 int ret; 293 int ret;
294 294
295 ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am200_handle_irq, 295 ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am200_handle_irq,
296 IRQF_DISABLED|IRQF_TRIGGER_FALLING, 296 IRQF_TRIGGER_FALLING, "AM200", info->par);
297 "AM200", info->par);
298 if (ret) 297 if (ret)
299 dev_err(&am200_device->dev, "request_irq failed: %d\n", ret); 298 dev_err(&am200_device->dev, "request_irq failed: %d\n", ret);
300 299
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
index 3dfec1ec462d..c9f309ae88c5 100644
--- a/arch/arm/mach-pxa/am300epd.c
+++ b/arch/arm/mach-pxa/am300epd.c
@@ -241,8 +241,7 @@ static int am300_setup_irq(struct fb_info *info)
241 struct broadsheetfb_par *par = info->par; 241 struct broadsheetfb_par *par = info->par;
242 242
243 ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am300_handle_irq, 243 ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am300_handle_irq,
244 IRQF_DISABLED|IRQF_TRIGGER_RISING, 244 IRQF_TRIGGER_RISING, "AM300", par);
245 "AM300", par);
246 if (ret) 245 if (ret)
247 dev_err(&am300_device->dev, "request_irq failed: %d\n", ret); 246 dev_err(&am300_device->dev, "request_irq failed: %d\n", ret);
248 247
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 8eb4e23c561d..6915a9f6b3a3 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -564,8 +564,7 @@ static int em_x270_mci_init(struct device *dev,
564 } 564 }
565 565
566 err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int, 566 err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
567 IRQF_DISABLED | IRQF_TRIGGER_RISING | 567 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
568 IRQF_TRIGGER_FALLING,
569 "MMC card detect", data); 568 "MMC card detect", data);
570 if (err) { 569 if (err) {
571 dev_err(dev, "can't request MMC card detect IRQ: %d\n", err); 570 dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index b6cc1816463e..0eecd83c624e 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -235,8 +235,6 @@ static const struct of_device_id intc_ids[] __initconst = {
235void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int)) 235void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
236{ 236{
237 struct device_node *node; 237 struct device_node *node;
238 const struct of_device_id *of_id;
239 struct pxa_intc_conf *conf;
240 struct resource res; 238 struct resource res;
241 int n, ret; 239 int n, ret;
242 240
@@ -245,8 +243,6 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
245 pr_err("Failed to find interrupt controller in arch-pxa\n"); 243 pr_err("Failed to find interrupt controller in arch-pxa\n");
246 return; 244 return;
247 } 245 }
248 of_id = of_match_node(intc_ids, node);
249 conf = of_id->data;
250 246
251 ret = of_property_read_u32(node, "marvell,intc-nr-irqs", 247 ret = of_property_read_u32(node, "marvell,intc-nr-irqs",
252 &pxa_internal_irq_nr); 248 &pxa_internal_irq_nr);
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index fab30d666cc7..a9761c293028 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -634,7 +634,7 @@ static struct platform_device bq24022 = {
634static int magician_mci_init(struct device *dev, 634static int magician_mci_init(struct device *dev,
635 irq_handler_t detect_irq, void *data) 635 irq_handler_t detect_irq, void *data)
636{ 636{
637 return request_irq(IRQ_MAGICIAN_SD, detect_irq, IRQF_DISABLED, 637 return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0,
638 "mmc card detect", data); 638 "mmc card detect", data);
639} 639}
640 640
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 08ccc0718f31..78b84c0dfc79 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -401,7 +401,7 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in
401 */ 401 */
402 MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL; 402 MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL;
403 403
404 err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, IRQF_DISABLED, 404 err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, 0,
405 "MMC card detect", data); 405 "MMC card detect", data);
406 if (err) 406 if (err)
407 printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); 407 printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 9a4e470f162b..2897da2a5df6 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -327,7 +327,7 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int,
327{ 327{
328 int err; 328 int err;
329 329
330 err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED, 330 err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, 0,
331 "MMC card detect", data); 331 "MMC card detect", data);
332 if (err) 332 if (err)
333 printk(KERN_ERR "pcm990_mci_init: MMC/SD: can't request MMC " 333 printk(KERN_ERR "pcm990_mci_init: MMC/SD: can't request MMC "
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 0a36d3585f26..051a6555cbf9 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -860,18 +860,18 @@ static int sharpsl_pm_probe(struct platform_device *pdev)
860 860
861 /* Register interrupt handlers */ 861 /* Register interrupt handlers */
862 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_acin); 862 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_acin);
863 if (request_irq(irq, sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) { 863 if (request_irq(irq, sharpsl_ac_isr, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
864 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); 864 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
865 } 865 }
866 866
867 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock); 867 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock);
868 if (request_irq(irq, sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) { 868 if (request_irq(irq, sharpsl_fatal_isr, IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) {
869 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); 869 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
870 } 870 }
871 871
872 if (sharpsl_pm.machinfo->gpio_fatal) { 872 if (sharpsl_pm.machinfo->gpio_fatal) {
873 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal); 873 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal);
874 if (request_irq(irq, sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) { 874 if (request_irq(irq, sharpsl_fatal_isr, IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) {
875 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); 875 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
876 } 876 }
877 } 877 }
@@ -879,7 +879,7 @@ static int sharpsl_pm_probe(struct platform_device *pdev)
879 if (sharpsl_pm.machinfo->batfull_irq) { 879 if (sharpsl_pm.machinfo->batfull_irq) {
880 /* Register interrupt handler. */ 880 /* Register interrupt handler. */
881 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull); 881 irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull);
882 if (request_irq(irq, sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) { 882 if (request_irq(irq, sharpsl_chrg_full_isr, IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
883 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq); 883 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
884 } 884 }
885 } 885 }
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 9aa852a8fab9..fca174e3865d 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -33,7 +33,7 @@
33 * calls to sched_clock() which should always be the case in practice. 33 * calls to sched_clock() which should always be the case in practice.
34 */ 34 */
35 35
36static u32 notrace pxa_read_sched_clock(void) 36static u64 notrace pxa_read_sched_clock(void)
37{ 37{
38 return readl_relaxed(OSCR); 38 return readl_relaxed(OSCR);
39} 39}
@@ -137,7 +137,7 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
137 137
138static struct irqaction pxa_ost0_irq = { 138static struct irqaction pxa_ost0_irq = {
139 .name = "ost0", 139 .name = "ost0",
140 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 140 .flags = IRQF_TIMER | IRQF_IRQPOLL,
141 .handler = pxa_ost0_interrupt, 141 .handler = pxa_ost0_interrupt,
142 .dev_id = &ckevt_pxa_osmr0, 142 .dev_id = &ckevt_pxa_osmr0,
143}; 143};
@@ -149,7 +149,7 @@ void __init pxa_timer_init(void)
149 writel_relaxed(0, OIER); 149 writel_relaxed(0, OIER);
150 writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); 150 writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR);
151 151
152 setup_sched_clock(pxa_read_sched_clock, 32, clock_tick_rate); 152 sched_clock_register(pxa_read_sched_clock, 32, clock_tick_rate);
153 153
154 ckevt_pxa_osmr0.cpumask = cpumask_of(0); 154 ckevt_pxa_osmr0.cpumask = cpumask_of(0);
155 155
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index c58043462acd..872dcb20e757 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -332,8 +332,7 @@ static int trizeps4_mci_init(struct device *dev, irq_handler_t mci_detect_int,
332 int err; 332 int err;
333 333
334 err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int, 334 err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int,
335 IRQF_DISABLED | IRQF_TRIGGER_RISING, 335 IRQF_TRIGGER_RISING, "MMC card detect", data);
336 "MMC card detect", data);
337 if (err) { 336 if (err) {
338 printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request" 337 printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request"
339 "MMC card detect IRQ\n"); 338 "MMC card detect IRQ\n");
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 8f1d327e0cd1..d876431d64c0 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -180,27 +180,6 @@ config CPU_LLSERIAL_S3C2440
180 Selected if there is an S3C2440 (or register compatible) serial 180 Selected if there is an S3C2440 (or register compatible) serial
181 low-level implementation needed 181 low-level implementation needed
182 182
183# gpio configurations
184
185config S3C24XX_GPIO_EXTRA
186 int
187 default 128 if S3C24XX_GPIO_EXTRA128
188 default 64 if S3C24XX_GPIO_EXTRA64
189 default 16 if ARCH_H1940
190 default 0
191
192config S3C24XX_GPIO_EXTRA64
193 bool
194 help
195 Add an extra 64 gpio numbers to the available GPIO pool. This is
196 available for boards that need extra gpios for external devices.
197
198config S3C24XX_GPIO_EXTRA128
199 bool
200 help
201 Add an extra 128 gpio numbers to the available GPIO pool. This is
202 available for boards that need extra gpios for external devices.
203
204config S3C24XX_PLL 183config S3C24XX_PLL
205 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)" 184 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
206 depends on ARM_S3C24XX_CPUFREQ 185 depends on ARM_S3C24XX_CPUFREQ
diff --git a/arch/arm/mach-s3c24xx/common-smdk.c b/arch/arm/mach-s3c24xx/common-smdk.c
index 404444dd3840..e9fbcc91c5c0 100644
--- a/arch/arm/mach-s3c24xx/common-smdk.c
+++ b/arch/arm/mach-s3c24xx/common-smdk.c
@@ -37,8 +37,8 @@
37#include <asm/irq.h> 37#include <asm/irq.h>
38 38
39#include <mach/regs-gpio.h> 39#include <mach/regs-gpio.h>
40#include <mach/gpio-samsung.h>
40#include <linux/platform_data/leds-s3c24xx.h> 41#include <linux/platform_data/leds-s3c24xx.h>
41
42#include <linux/platform_data/mtd-nand-s3c2410.h> 42#include <linux/platform_data/mtd-nand-s3c2410.h>
43 43
44#include <plat/gpio-cfg.h> 44#include <plat/gpio-cfg.h>
diff --git a/arch/arm/mach-s3c24xx/dma.c b/arch/arm/mach-s3c24xx/dma.c
index 4a65cba3295d..a8dafc174fe3 100644
--- a/arch/arm/mach-s3c24xx/dma.c
+++ b/arch/arm/mach-s3c24xx/dma.c
@@ -742,7 +742,7 @@ int s3c2410_dma_request(enum dma_ch channel,
742 chan->irq_claimed = 1; 742 chan->irq_claimed = 1;
743 local_irq_restore(flags); 743 local_irq_restore(flags);
744 744
745 err = request_irq(chan->irq, s3c2410_dma_irq, IRQF_DISABLED, 745 err = request_irq(chan->irq, s3c2410_dma_irq, 0,
746 client->name, (void *)chan); 746 client->name, (void *)chan);
747 747
748 local_irq_save(flags); 748 local_irq_save(flags);
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
index 5b98bfd1df43..b4d14b864367 100644
--- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
@@ -19,8 +19,10 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/rfkill.h> 20#include <linux/rfkill.h>
21 21
22#include <plat/gpio-cfg.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <mach/regs-gpio.h> 24#include <mach/regs-gpio.h>
25#include <mach/gpio-samsung.h>
24 26
25#include "h1940.h" 27#include "h1940.h"
26 28
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio.h b/arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h
index 14591563ca70..528fcdc4f63e 100644
--- a/arch/arm/mach-s3c24xx/include/mach/gpio.h
+++ b/arch/arm/mach-s3c24xx/include/mach/gpio-samsung.h
@@ -14,16 +14,8 @@
14 * devices that need GPIO. 14 * devices that need GPIO.
15 */ 15 */
16 16
17#ifndef __MACH_GPIO_H 17#ifndef GPIO_SAMSUNG_S3C24XX_H
18#define __MACH_GPIO_H __FILE__ 18#define GPIO_SAMSUNG_S3C24XX_H
19
20#ifdef CONFIG_CPU_S3C244X
21#define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
22#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
23#define ARCH_NR_GPIOS (32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)
24#else
25#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)
26#endif
27 19
28/* 20/*
29 * GPIO sizes for various SoCs: 21 * GPIO sizes for various SoCs:
@@ -31,17 +23,17 @@
31 * 2410 2412 2440 2443 2416 23 * 2410 2412 2440 2443 2416
32 * 2442 24 * 2442
33 * ---- ---- ---- ---- ---- 25 * ---- ---- ---- ---- ----
34 * A 23 22 25 16 25 26 * A 23 22 25 16 27
35 * B 11 11 11 11 9 27 * B 11 11 11 11 11
36 * C 16 15 16 16 16 28 * C 16 16 16 16 16
37 * D 16 16 16 16 16 29 * D 16 16 16 16 16
38 * E 16 16 16 16 16 30 * E 16 16 16 16 16
39 * F 8 8 8 8 8 31 * F 8 8 8 8 8
40 * G 16 16 16 16 8 32 * G 16 16 16 16 8
41 * H 11 11 9 15 15 33 * H 11 11 11 15 15
42 * J -- -- 13 16 -- 34 * J -- -- 13 16 --
43 * K -- -- -- -- 16 35 * K -- -- -- -- 16
44 * L -- -- -- 15 7 36 * L -- -- -- 15 14
45 * M -- -- -- 2 2 37 * M -- -- -- 2 2
46 */ 38 */
47 39
@@ -101,8 +93,6 @@ enum s3c_gpio_number {
101#define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr)) 93#define S3C2410_GPL(_nr) (S3C2410_GPIO_L_START + (_nr))
102#define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr)) 94#define S3C2410_GPM(_nr) (S3C2410_GPIO_M_START + (_nr))
103 95
104#include <plat/gpio-cfg.h>
105
106#ifdef CONFIG_CPU_S3C244X 96#ifdef CONFIG_CPU_S3C244X
107#define S3C_GPIO_END (S3C2410_GPJ(0) + 32) 97#define S3C_GPIO_END (S3C2410_GPJ(0) + 32)
108#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416) 98#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
@@ -111,4 +101,4 @@ enum s3c_gpio_number {
111#define S3C_GPIO_END (S3C2410_GPH(0) + 32) 101#define S3C_GPIO_END (S3C2410_GPH(0) + 32)
112#endif 102#endif
113 103
114#endif /* __MACH_GPIO_H */ 104#endif /* GPIO_SAMSUNG_S3C24XX_H */
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index e27b5c91b3db..284ea1f44205 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -52,6 +52,7 @@
52#include <plat/regs-serial.h> 52#include <plat/regs-serial.h>
53#include <mach/regs-lcd.h> 53#include <mach/regs-lcd.h>
54#include <mach/regs-gpio.h> 54#include <mach/regs-gpio.h>
55#include <mach/gpio-samsung.h>
55 56
56#include <linux/platform_data/i2c-s3c2410.h> 57#include <linux/platform_data/i2c-s3c2410.h>
57#include <plat/devs.h> 58#include <plat/devs.h>
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index c1fb6c37867f..2a16f8fb3584 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -35,6 +35,7 @@
35#include <plat/regs-serial.h> 35#include <plat/regs-serial.h>
36#include <mach/regs-gpio.h> 36#include <mach/regs-gpio.h>
37#include <mach/regs-lcd.h> 37#include <mach/regs-lcd.h>
38#include <mach/gpio-samsung.h>
38#include <linux/platform_data/mtd-nand-s3c2410.h> 39#include <linux/platform_data/mtd-nand-s3c2410.h>
39#include <linux/platform_data/i2c-s3c2410.h> 40#include <linux/platform_data/i2c-s3c2410.h>
40 41
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index 6dfeeb7ef469..6beab674c147 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -36,6 +36,7 @@
36#include <plat/regs-serial.h> 36#include <plat/regs-serial.h>
37#include <mach/regs-gpio.h> 37#include <mach/regs-gpio.h>
38#include <mach/regs-lcd.h> 38#include <mach/regs-lcd.h>
39#include <mach/gpio-samsung.h>
39#include <linux/platform_data/mtd-nand-s3c2410.h> 40#include <linux/platform_data/mtd-nand-s3c2410.h>
40#include <linux/platform_data/i2c-s3c2410.h> 41#include <linux/platform_data/i2c-s3c2410.h>
41 42
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 22d6ae926d91..981ba1eb9fdc 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -48,6 +48,7 @@
48#include <mach/hardware.h> 48#include <mach/hardware.h>
49#include <mach/regs-gpio.h> 49#include <mach/regs-gpio.h>
50#include <mach/regs-lcd.h> 50#include <mach/regs-lcd.h>
51#include <mach/gpio-samsung.h>
51 52
52#include <plat/clock.h> 53#include <plat/clock.h>
53#include <plat/cpu.h> 54#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 13d8d073675a..d9170e9f8ccd 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -75,6 +75,7 @@
75#include <mach/hardware.h> 75#include <mach/hardware.h>
76#include <mach/regs-gpio.h> 76#include <mach/regs-gpio.h>
77#include <mach/regs-irq.h> 77#include <mach/regs-irq.h>
78#include <mach/gpio-samsung.h>
78 79
79#include <plat/cpu.h> 80#include <plat/cpu.h>
80#include <plat/devs.h> 81#include <plat/devs.h>
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 952b6a040d1f..de0832181d8c 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -54,6 +54,7 @@
54#include <mach/regs-clock.h> 54#include <mach/regs-clock.h>
55#include <mach/regs-gpio.h> 55#include <mach/regs-gpio.h>
56#include <mach/regs-lcd.h> 56#include <mach/regs-lcd.h>
57#include <mach/gpio-samsung.h>
57 58
58#include <plat/clock.h> 59#include <plat/clock.h>
59#include <plat/cpu.h> 60#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index 43c23e220f5b..67cb8e948b7e 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -38,6 +38,7 @@
38#include <mach/regs-gpio.h> 38#include <mach/regs-gpio.h>
39#include <mach/regs-lcd.h> 39#include <mach/regs-lcd.h>
40#include <mach/fb.h> 40#include <mach/fb.h>
41#include <mach/gpio-samsung.h>
41 42
42#include <asm/mach-types.h> 43#include <asm/mach-types.h>
43 44
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 4a18d49a63e0..1f1559713d8b 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -42,6 +42,7 @@
42#include <linux/platform_data/leds-s3c24xx.h> 42#include <linux/platform_data/leds-s3c24xx.h>
43#include <mach/regs-lcd.h> 43#include <mach/regs-lcd.h>
44#include <mach/irqs.h> 44#include <mach/irqs.h>
45#include <mach/gpio-samsung.h>
45#include <linux/platform_data/mtd-nand-s3c2410.h> 46#include <linux/platform_data/mtd-nand-s3c2410.h>
46#include <linux/platform_data/i2c-s3c2410.h> 47#include <linux/platform_data/i2c-s3c2410.h>
47#include <linux/platform_data/mmc-s3cmci.h> 48#include <linux/platform_data/mmc-s3cmci.h>
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index 2cb46c37c920..997684f17930 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -36,6 +36,7 @@
36#include <linux/platform_data/leds-s3c24xx.h> 36#include <linux/platform_data/leds-s3c24xx.h>
37#include <mach/regs-gpio.h> 37#include <mach/regs-gpio.h>
38#include <mach/regs-lcd.h> 38#include <mach/regs-lcd.h>
39#include <mach/gpio-samsung.h>
39 40
40#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
41#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 01f4354206f9..575d28c9e6c6 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -37,6 +37,7 @@
37 37
38//#include <asm/debug-ll.h> 38//#include <asm/debug-ll.h>
39#include <mach/regs-gpio.h> 39#include <mach/regs-gpio.h>
40#include <mach/gpio-samsung.h>
40#include <plat/regs-serial.h> 41#include <plat/regs-serial.h>
41#include <linux/platform_data/i2c-s3c2410.h> 42#include <linux/platform_data/i2c-s3c2410.h>
42 43
diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
index 45e74363aaa9..33afb9190091 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
@@ -20,6 +20,7 @@
20#include <linux/i2c/tps65010.h> 20#include <linux/i2c/tps65010.h>
21 21
22#include <plat/cpu-freq.h> 22#include <plat/cpu-freq.h>
23#include <mach/gpio-samsung.h>
23 24
24#define OSIRIS_GPIO_DVS S3C2410_GPB(5) 25#define OSIRIS_GPIO_DVS S3C2410_GPB(5)
25 26
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index 58d6fbe5bf1f..f84f2a4c0c6d 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -50,6 +50,7 @@
50#include <mach/hardware.h> 50#include <mach/hardware.h>
51#include <mach/regs-gpio.h> 51#include <mach/regs-gpio.h>
52#include <mach/regs-lcd.h> 52#include <mach/regs-lcd.h>
53#include <mach/gpio-samsung.h>
53 54
54#include "common.h" 55#include "common.h"
55#include "osiris.h" 56#include "osiris.h"
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index f8feaeadb55a..b534b76812e3 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -54,6 +54,7 @@
54#include <linux/platform_data/mtd-nand-s3c2410.h> 54#include <linux/platform_data/mtd-nand-s3c2410.h>
55#include <linux/platform_data/usb-s3c2410_udc.h> 55#include <linux/platform_data/usb-s3c2410_udc.h>
56#include <linux/platform_data/i2c-s3c2410.h> 56#include <linux/platform_data/i2c-s3c2410.h>
57#include <mach/gpio-samsung.h>
57 58
58#include <plat/gpio-cfg.h> 59#include <plat/gpio-cfg.h>
59#include <plat/devs.h> 60#include <plat/devs.h>
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 034b7fe45c49..0a5456cda1bc 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -51,6 +51,7 @@
51#include <mach/fb.h> 51#include <mach/fb.h>
52#include <mach/regs-gpio.h> 52#include <mach/regs-gpio.h>
53#include <mach/regs-lcd.h> 53#include <mach/regs-lcd.h>
54#include <mach/gpio-samsung.h>
54 55
55#include <plat/clock.h> 56#include <plat/clock.h>
56#include <plat/cpu.h> 57#include <plat/cpu.h>
@@ -58,6 +59,7 @@
58#include <plat/pm.h> 59#include <plat/pm.h>
59#include <plat/regs-serial.h> 60#include <plat/regs-serial.h>
60#include <plat/samsung-time.h> 61#include <plat/samsung-time.h>
62#include <plat/gpio-cfg.h>
61 63
62#include "common.h" 64#include "common.h"
63#include "h1940.h" 65#include "h1940.h"
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index 3bc6231d0a1f..b36edce8b2b8 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -43,6 +43,7 @@
43#include <mach/hardware.h> 43#include <mach/hardware.h>
44#include <mach/regs-gpio.h> 44#include <mach/regs-gpio.h>
45#include <mach/regs-lcd.h> 45#include <mach/regs-lcd.h>
46#include <mach/gpio-samsung.h>
46 47
47#include <plat/clock.h> 48#include <plat/clock.h>
48#include <plat/cpu.h> 49#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index c9d31ef28dd1..f5bc721217e3 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -39,6 +39,7 @@
39 39
40#include <linux/platform_data/usb-s3c2410_udc.h> 40#include <linux/platform_data/usb-s3c2410_udc.h>
41#include <linux/platform_data/i2c-s3c2410.h> 41#include <linux/platform_data/i2c-s3c2410.h>
42#include <mach/gpio-samsung.h>
42#include <mach/fb.h> 43#include <mach/fb.h>
43 44
44#include <plat/clock.h> 45#include <plat/clock.h>
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index f88e672ad1e4..12023cae4378 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -38,6 +38,7 @@
38#include <mach/regs-gpio.h> 38#include <mach/regs-gpio.h>
39#include <mach/regs-lcd.h> 39#include <mach/regs-lcd.h>
40#include <mach/regs-s3c2443-clock.h> 40#include <mach/regs-s3c2443-clock.h>
41#include <mach/gpio-samsung.h>
41 42
42#include <linux/platform_data/leds-s3c24xx.h> 43#include <linux/platform_data/leds-s3c24xx.h>
43#include <linux/platform_data/i2c-s3c2410.h> 44#include <linux/platform_data/i2c-s3c2410.h>
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 42e7187fed60..755df489a45f 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -40,6 +40,7 @@
40 40
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/regs-gpio.h> 42#include <mach/regs-gpio.h>
43#include <mach/gpio-samsung.h>
43 44
44#include <plat/clock.h> 45#include <plat/clock.h>
45#include <plat/cpu.h> 46#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2410.c b/arch/arm/mach-s3c24xx/pm-s3c2410.c
index 2d82c4f116cd..20e481d8a33a 100644
--- a/arch/arm/mach-s3c24xx/pm-s3c2410.c
+++ b/arch/arm/mach-s3c24xx/pm-s3c2410.c
@@ -33,7 +33,9 @@
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/regs-gpio.h> 35#include <mach/regs-gpio.h>
36#include <mach/gpio-samsung.h>
36 37
38#include <plat/gpio-cfg.h>
37#include <plat/cpu.h> 39#include <plat/cpu.h>
38#include <plat/pm.h> 40#include <plat/pm.h>
39 41
diff --git a/arch/arm/mach-s3c24xx/pm.c b/arch/arm/mach-s3c24xx/pm.c
index caa5b7211380..052ca23393a7 100644
--- a/arch/arm/mach-s3c24xx/pm.c
+++ b/arch/arm/mach-s3c24xx/pm.c
@@ -39,6 +39,7 @@
39#include <mach/regs-clock.h> 39#include <mach/regs-clock.h>
40#include <mach/regs-gpio.h> 40#include <mach/regs-gpio.h>
41#include <mach/regs-irq.h> 41#include <mach/regs-irq.h>
42#include <mach/gpio-samsung.h>
42 43
43#include <asm/mach/time.h> 44#include <asm/mach/time.h>
44 45
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 34676d1d5fec..ffb92cbca08c 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -30,6 +30,7 @@
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/gpio-samsung.h>
33#include <asm/irq.h> 34#include <asm/irq.h>
34#include <asm/system_misc.h> 35#include <asm/system_misc.h>
35 36
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
index 9ef3ccfbe196..8e01b4f2df35 100644
--- a/arch/arm/mach-s3c24xx/s3c2416.c
+++ b/arch/arm/mach-s3c24xx/s3c2416.c
@@ -42,6 +42,7 @@
42#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
43 43
44#include <mach/hardware.h> 44#include <mach/hardware.h>
45#include <mach/gpio-samsung.h>
45#include <asm/proc-fns.h> 46#include <asm/proc-fns.h>
46#include <asm/irq.h> 47#include <asm/irq.h>
47#include <asm/system_misc.h> 48#include <asm/system_misc.h>
diff --git a/arch/arm/mach-s3c24xx/s3c2440.c b/arch/arm/mach-s3c24xx/s3c2440.c
index 5f9d6569475d..03d379f1fc52 100644
--- a/arch/arm/mach-s3c24xx/s3c2440.c
+++ b/arch/arm/mach-s3c24xx/s3c2440.c
@@ -29,6 +29,7 @@
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/gpio-samsung.h>
32#include <asm/irq.h> 33#include <asm/irq.h>
33 34
34#include <plat/devs.h> 35#include <plat/devs.h>
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c
index 6819961f6b19..2c8adc028538 100644
--- a/arch/arm/mach-s3c24xx/s3c2442.c
+++ b/arch/arm/mach-s3c24xx/s3c2442.c
@@ -37,6 +37,7 @@
37#include <linux/io.h> 37#include <linux/io.h>
38 38
39#include <mach/hardware.h> 39#include <mach/hardware.h>
40#include <mach/gpio-samsung.h>
40#include <linux/atomic.h> 41#include <linux/atomic.h>
41#include <asm/irq.h> 42#include <asm/irq.h>
42 43
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
index b6c71918b25c..886c2147062b 100644
--- a/arch/arm/mach-s3c24xx/s3c2443.c
+++ b/arch/arm/mach-s3c24xx/s3c2443.c
@@ -29,6 +29,7 @@
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/gpio-samsung.h>
32#include <asm/irq.h> 33#include <asm/irq.h>
33#include <asm/system_misc.h> 34#include <asm/system_misc.h>
34 35
diff --git a/arch/arm/mach-s3c24xx/setup-i2c.c b/arch/arm/mach-s3c24xx/setup-i2c.c
index 7b4f33332d19..1852696ca16e 100644
--- a/arch/arm/mach-s3c24xx/setup-i2c.c
+++ b/arch/arm/mach-s3c24xx/setup-i2c.c
@@ -19,6 +19,7 @@ struct platform_device;
19#include <linux/platform_data/i2c-s3c2410.h> 19#include <linux/platform_data/i2c-s3c2410.h>
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <mach/regs-gpio.h> 21#include <mach/regs-gpio.h>
22#include <mach/gpio-samsung.h>
22 23
23void s3c_i2c0_cfg_gpio(struct platform_device *dev) 24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
24{ 25{
diff --git a/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c b/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
index f65cb3ef16ce..c99b0f664db7 100644
--- a/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
@@ -20,6 +20,7 @@
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21 21
22#include <mach/regs-gpio.h> 22#include <mach/regs-gpio.h>
23#include <mach/gpio-samsung.h>
23#include <plat/gpio-cfg.h> 24#include <plat/gpio-cfg.h>
24 25
25void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 26void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
diff --git a/arch/arm/mach-s3c24xx/setup-ts.c b/arch/arm/mach-s3c24xx/setup-ts.c
index 4e11affce3a8..46466d20257e 100644
--- a/arch/arm/mach-s3c24xx/setup-ts.c
+++ b/arch/arm/mach-s3c24xx/setup-ts.c
@@ -15,7 +15,9 @@
15 15
16struct platform_device; /* don't need the contents */ 16struct platform_device; /* don't need the contents */
17 17
18#include <plat/gpio-cfg.h>
18#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <mach/gpio-samsung.h>
19 21
20/** 22/**
21 * s3c24xx_ts_cfg_gpio - configure gpio for s3c2410 systems 23 * s3c24xx_ts_cfg_gpio - configure gpio for s3c2410 systems
diff --git a/arch/arm/mach-s3c24xx/simtec-usb.c b/arch/arm/mach-s3c24xx/simtec-usb.c
index 2ed2e32430dc..b70aa66efebe 100644
--- a/arch/arm/mach-s3c24xx/simtec-usb.c
+++ b/arch/arm/mach-s3c24xx/simtec-usb.c
@@ -29,6 +29,7 @@
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/gpio-samsung.h>
32#include <asm/irq.h> 33#include <asm/irq.h>
33 34
34#include <linux/platform_data/usb-ohci-s3c2410.h> 35#include <linux/platform_data/usb-ohci-s3c2410.h>
@@ -78,8 +79,7 @@ static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on)
78 79
79 if (on) { 80 if (on) {
80 ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq, 81 ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq,
81 IRQF_DISABLED | IRQF_TRIGGER_RISING | 82 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
82 IRQF_TRIGGER_FALLING,
83 "USB Over-current", info); 83 "USB Over-current", info);
84 if (ret != 0) { 84 if (ret != 0) {
85 printk(KERN_ERR "failed to request usb oc irq\n"); 85 printk(KERN_ERR "failed to request usb oc irq\n");
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 2cb8dc55b50e..64f04e6f9c31 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -17,9 +17,10 @@ config CPU_S3C6410
17 help 17 help
18 Enable S3C6410 CPU support 18 Enable S3C6410 CPU support
19 19
20config S3C64XX_DMA 20config S3C64XX_PL080
21 bool "S3C64XX DMA" 21 bool "S3C64XX DMA using generic PL08x driver"
22 select S3C_DMA 22 select AMBA_PL08X
23 select SAMSUNG_DMADEV
23 24
24config S3C64XX_SETUP_SDHCI 25config S3C64XX_SETUP_SDHCI
25 bool 26 bool
@@ -192,7 +193,6 @@ config SMDK6410_WM1190_EV1
192 select MFD_WM8350_I2C 193 select MFD_WM8350_I2C
193 select REGULATOR 194 select REGULATOR
194 select REGULATOR_WM8350 195 select REGULATOR_WM8350
195 select SAMSUNG_GPIO_EXTRA64
196 help 196 help
197 The Wolfson Microelectronics 1190-EV1 is a WM835x based PMIC 197 The Wolfson Microelectronics 1190-EV1 is a WM835x based PMIC
198 and audio daughtercard for the Samsung SMDK6410 reference 198 and audio daughtercard for the Samsung SMDK6410 reference
@@ -208,7 +208,6 @@ config SMDK6410_WM1192_EV1
208 select MFD_WM831X_I2C 208 select MFD_WM831X_I2C
209 select REGULATOR 209 select REGULATOR
210 select REGULATOR_WM831X 210 select REGULATOR_WM831X
211 select SAMSUNG_GPIO_EXTRA64
212 help 211 help
213 The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC 212 The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC
214 daughtercard for the Samsung SMDK6410 reference platform. 213 daughtercard for the Samsung SMDK6410 reference platform.
@@ -294,7 +293,6 @@ config MACH_WLF_CRAGG_6410
294 select SAMSUNG_DEV_ADC 293 select SAMSUNG_DEV_ADC
295 select SAMSUNG_DEV_KEYPAD 294 select SAMSUNG_DEV_KEYPAD
296 select SAMSUNG_DEV_PWM 295 select SAMSUNG_DEV_PWM
297 select SAMSUNG_GPIO_EXTRA128
298 help 296 help
299 Machine support for the Wolfson Cragganmore S3C6410 variant. 297 Machine support for the Wolfson Cragganmore S3C6410 variant.
300 298
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 6faedcffce04..58069a702a43 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -26,7 +26,7 @@ obj-$(CONFIG_CPU_IDLE) += cpuidle.o
26 26
27# DMA support 27# DMA support
28 28
29obj-$(CONFIG_S3C64XX_DMA) += dma.o 29obj-$(CONFIG_S3C64XX_PL080) += pl080.o
30 30
31# Device support 31# Device support
32 32
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 7a3ce4c39e5f..76ab595d849b 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -41,6 +41,7 @@
41#include <mach/map.h> 41#include <mach/map.h>
42#include <mach/hardware.h> 42#include <mach/hardware.h>
43#include <mach/regs-gpio.h> 43#include <mach/regs-gpio.h>
44#include <mach/gpio-samsung.h>
44 45
45#include <plat/cpu.h> 46#include <plat/cpu.h>
46#include <plat/devs.h> 47#include <plat/devs.h>
diff --git a/arch/arm/mach-s3c64xx/common.h b/arch/arm/mach-s3c64xx/common.h
index bd3bd562011e..7043e7a3a67e 100644
--- a/arch/arm/mach-s3c64xx/common.h
+++ b/arch/arm/mach-s3c64xx/common.h
@@ -58,4 +58,9 @@ int __init s3c64xx_pm_late_initcall(void);
58static inline int s3c64xx_pm_late_initcall(void) { return 0; } 58static inline int s3c64xx_pm_late_initcall(void) { return 0; }
59#endif 59#endif
60 60
61#ifdef CONFIG_S3C64XX_PL080
62extern struct pl08x_platform_data s3c64xx_dma0_plat_data;
63extern struct pl08x_platform_data s3c64xx_dma1_plat_data;
64#endif
65
61#endif /* __ARCH_ARM_MACH_S3C64XX_COMMON_H */ 66#endif /* __ARCH_ARM_MACH_S3C64XX_COMMON_H */
diff --git a/arch/arm/mach-s3c64xx/crag6410.h b/arch/arm/mach-s3c64xx/crag6410.h
index 4c3c9994fc2c..7bc66682687e 100644
--- a/arch/arm/mach-s3c64xx/crag6410.h
+++ b/arch/arm/mach-s3c64xx/crag6410.h
@@ -11,7 +11,7 @@
11#ifndef MACH_CRAG6410_H 11#ifndef MACH_CRAG6410_H
12#define MACH_CRAG6410_H 12#define MACH_CRAG6410_H
13 13
14#include <linux/gpio.h> 14#include <mach/gpio-samsung.h>
15 15
16#define GLENFARCLAS_PMIC_IRQ_BASE IRQ_BOARD_START 16#define GLENFARCLAS_PMIC_IRQ_BASE IRQ_BOARD_START
17 17
diff --git a/arch/arm/mach-s3c64xx/dev-audio.c b/arch/arm/mach-s3c64xx/dev-audio.c
index e367e87bbc29..ff780a8d8366 100644
--- a/arch/arm/mach-s3c64xx/dev-audio.c
+++ b/arch/arm/mach-s3c64xx/dev-audio.c
@@ -22,6 +22,7 @@
22#include <plat/devs.h> 22#include <plat/devs.h>
23#include <linux/platform_data/asoc-s3c.h> 23#include <linux/platform_data/asoc-s3c.h>
24#include <plat/gpio-cfg.h> 24#include <plat/gpio-cfg.h>
25#include <mach/gpio-samsung.h>
25 26
26static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev) 27static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
27{ 28{
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
deleted file mode 100644
index 7e22c2113816..000000000000
--- a/arch/arm/mach-s3c64xx/dma.c
+++ /dev/null
@@ -1,762 +0,0 @@
1/* linux/arch/arm/plat-s3c64xx/dma.c
2 *
3 * Copyright 2009 Openmoko, Inc.
4 * Copyright 2009 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C64XX DMA core
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/*
16 * NOTE: Code in this file is not used when booting with Device Tree support.
17 */
18
19#include <linux/kernel.h>
20#include <linux/module.h>
21#include <linux/interrupt.h>
22#include <linux/dmapool.h>
23#include <linux/device.h>
24#include <linux/errno.h>
25#include <linux/slab.h>
26#include <linux/delay.h>
27#include <linux/clk.h>
28#include <linux/err.h>
29#include <linux/io.h>
30#include <linux/amba/pl080.h>
31#include <linux/of.h>
32
33#include <mach/dma.h>
34#include <mach/map.h>
35#include <mach/irqs.h>
36
37#include "regs-sys.h"
38
39/* dma channel state information */
40
41struct s3c64xx_dmac {
42 struct device dev;
43 struct clk *clk;
44 void __iomem *regs;
45 struct s3c2410_dma_chan *channels;
46 enum dma_ch chanbase;
47};
48
49/* pool to provide LLI buffers */
50static struct dma_pool *dma_pool;
51
52/* Debug configuration and code */
53
54static unsigned char debug_show_buffs = 0;
55
56static void dbg_showchan(struct s3c2410_dma_chan *chan)
57{
58 pr_debug("DMA%d: %08x->%08x L %08x C %08x,%08x S %08x\n",
59 chan->number,
60 readl(chan->regs + PL080_CH_SRC_ADDR),
61 readl(chan->regs + PL080_CH_DST_ADDR),
62 readl(chan->regs + PL080_CH_LLI),
63 readl(chan->regs + PL080_CH_CONTROL),
64 readl(chan->regs + PL080S_CH_CONTROL2),
65 readl(chan->regs + PL080S_CH_CONFIG));
66}
67
68static void show_lli(struct pl080s_lli *lli)
69{
70 pr_debug("LLI[%p] %08x->%08x, NL %08x C %08x,%08x\n",
71 lli, lli->src_addr, lli->dst_addr, lli->next_lli,
72 lli->control0, lli->control1);
73}
74
75static void dbg_showbuffs(struct s3c2410_dma_chan *chan)
76{
77 struct s3c64xx_dma_buff *ptr;
78 struct s3c64xx_dma_buff *end;
79
80 pr_debug("DMA%d: buffs next %p, curr %p, end %p\n",
81 chan->number, chan->next, chan->curr, chan->end);
82
83 ptr = chan->next;
84 end = chan->end;
85
86 if (debug_show_buffs) {
87 for (; ptr != NULL; ptr = ptr->next) {
88 pr_debug("DMA%d: %08x ",
89 chan->number, ptr->lli_dma);
90 show_lli(ptr->lli);
91 }
92 }
93}
94
95/* End of Debug */
96
97static struct s3c2410_dma_chan *s3c64xx_dma_map_channel(unsigned int channel)
98{
99 struct s3c2410_dma_chan *chan;
100 unsigned int start, offs;
101
102 start = 0;
103
104 if (channel >= DMACH_PCM1_TX)
105 start = 8;
106
107 for (offs = 0; offs < 8; offs++) {
108 chan = &s3c2410_chans[start + offs];
109 if (!chan->in_use)
110 goto found;
111 }
112
113 return NULL;
114
115found:
116 s3c_dma_chan_map[channel] = chan;
117 return chan;
118}
119
120int s3c2410_dma_config(enum dma_ch channel, int xferunit)
121{
122 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
123
124 if (chan == NULL)
125 return -EINVAL;
126
127 switch (xferunit) {
128 case 1:
129 chan->hw_width = 0;
130 break;
131 case 2:
132 chan->hw_width = 1;
133 break;
134 case 4:
135 chan->hw_width = 2;
136 break;
137 default:
138 printk(KERN_ERR "%s: illegal width %d\n", __func__, xferunit);
139 return -EINVAL;
140 }
141
142 return 0;
143}
144EXPORT_SYMBOL(s3c2410_dma_config);
145
146static void s3c64xx_dma_fill_lli(struct s3c2410_dma_chan *chan,
147 struct pl080s_lli *lli,
148 dma_addr_t data, int size)
149{
150 dma_addr_t src, dst;
151 u32 control0, control1;
152
153 switch (chan->source) {
154 case DMA_FROM_DEVICE:
155 src = chan->dev_addr;
156 dst = data;
157 control0 = PL080_CONTROL_SRC_AHB2;
158 control0 |= PL080_CONTROL_DST_INCR;
159 break;
160
161 case DMA_TO_DEVICE:
162 src = data;
163 dst = chan->dev_addr;
164 control0 = PL080_CONTROL_DST_AHB2;
165 control0 |= PL080_CONTROL_SRC_INCR;
166 break;
167 default:
168 BUG();
169 }
170
171 /* note, we do not currently setup any of the burst controls */
172
173 control1 = size >> chan->hw_width; /* size in no of xfers */
174 control0 |= PL080_CONTROL_PROT_SYS; /* always in priv. mode */
175 control0 |= PL080_CONTROL_TC_IRQ_EN; /* always fire IRQ */
176 control0 |= (u32)chan->hw_width << PL080_CONTROL_DWIDTH_SHIFT;
177 control0 |= (u32)chan->hw_width << PL080_CONTROL_SWIDTH_SHIFT;
178
179 lli->src_addr = src;
180 lli->dst_addr = dst;
181 lli->next_lli = 0;
182 lli->control0 = control0;
183 lli->control1 = control1;
184}
185
186static void s3c64xx_lli_to_regs(struct s3c2410_dma_chan *chan,
187 struct pl080s_lli *lli)
188{
189 void __iomem *regs = chan->regs;
190
191 pr_debug("%s: LLI %p => regs\n", __func__, lli);
192 show_lli(lli);
193
194 writel(lli->src_addr, regs + PL080_CH_SRC_ADDR);
195 writel(lli->dst_addr, regs + PL080_CH_DST_ADDR);
196 writel(lli->next_lli, regs + PL080_CH_LLI);
197 writel(lli->control0, regs + PL080_CH_CONTROL);
198 writel(lli->control1, regs + PL080S_CH_CONTROL2);
199}
200
201static int s3c64xx_dma_start(struct s3c2410_dma_chan *chan)
202{
203 struct s3c64xx_dmac *dmac = chan->dmac;
204 u32 config;
205 u32 bit = chan->bit;
206
207 dbg_showchan(chan);
208
209 pr_debug("%s: clearing interrupts\n", __func__);
210
211 /* clear interrupts */
212 writel(bit, dmac->regs + PL080_TC_CLEAR);
213 writel(bit, dmac->regs + PL080_ERR_CLEAR);
214
215 pr_debug("%s: starting channel\n", __func__);
216
217 config = readl(chan->regs + PL080S_CH_CONFIG);
218 config |= PL080_CONFIG_ENABLE;
219 config &= ~PL080_CONFIG_HALT;
220
221 pr_debug("%s: writing config %08x\n", __func__, config);
222 writel(config, chan->regs + PL080S_CH_CONFIG);
223
224 return 0;
225}
226
227static int s3c64xx_dma_stop(struct s3c2410_dma_chan *chan)
228{
229 u32 config;
230 int timeout;
231
232 pr_debug("%s: stopping channel\n", __func__);
233
234 dbg_showchan(chan);
235
236 config = readl(chan->regs + PL080S_CH_CONFIG);
237 config |= PL080_CONFIG_HALT;
238 writel(config, chan->regs + PL080S_CH_CONFIG);
239
240 timeout = 1000;
241 do {
242 config = readl(chan->regs + PL080S_CH_CONFIG);
243 pr_debug("%s: %d - config %08x\n", __func__, timeout, config);
244 if (config & PL080_CONFIG_ACTIVE)
245 udelay(10);
246 else
247 break;
248 } while (--timeout > 0);
249
250 if (config & PL080_CONFIG_ACTIVE) {
251 printk(KERN_ERR "%s: channel still active\n", __func__);
252 return -EFAULT;
253 }
254
255 config = readl(chan->regs + PL080S_CH_CONFIG);
256 config &= ~PL080_CONFIG_ENABLE;
257 writel(config, chan->regs + PL080S_CH_CONFIG);
258
259 return 0;
260}
261
262static inline void s3c64xx_dma_bufffdone(struct s3c2410_dma_chan *chan,
263 struct s3c64xx_dma_buff *buf,
264 enum s3c2410_dma_buffresult result)
265{
266 if (chan->callback_fn != NULL)
267 (chan->callback_fn)(chan, buf->pw, 0, result);
268}
269
270static void s3c64xx_dma_freebuff(struct s3c64xx_dma_buff *buff)
271{
272 dma_pool_free(dma_pool, buff->lli, buff->lli_dma);
273 kfree(buff);
274}
275
276static int s3c64xx_dma_flush(struct s3c2410_dma_chan *chan)
277{
278 struct s3c64xx_dma_buff *buff, *next;
279 u32 config;
280
281 dbg_showchan(chan);
282
283 pr_debug("%s: flushing channel\n", __func__);
284
285 config = readl(chan->regs + PL080S_CH_CONFIG);
286 config &= ~PL080_CONFIG_ENABLE;
287 writel(config, chan->regs + PL080S_CH_CONFIG);
288
289 /* dump all the buffers associated with this channel */
290
291 for (buff = chan->curr; buff != NULL; buff = next) {
292 next = buff->next;
293 pr_debug("%s: buff %p (next %p)\n", __func__, buff, buff->next);
294
295 s3c64xx_dma_bufffdone(chan, buff, S3C2410_RES_ABORT);
296 s3c64xx_dma_freebuff(buff);
297 }
298
299 chan->curr = chan->next = chan->end = NULL;
300
301 return 0;
302}
303
304int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op)
305{
306 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
307
308 WARN_ON(!chan);
309 if (!chan)
310 return -EINVAL;
311
312 switch (op) {
313 case S3C2410_DMAOP_START:
314 return s3c64xx_dma_start(chan);
315
316 case S3C2410_DMAOP_STOP:
317 return s3c64xx_dma_stop(chan);
318
319 case S3C2410_DMAOP_FLUSH:
320 return s3c64xx_dma_flush(chan);
321
322 /* believe PAUSE/RESUME are no-ops */
323 case S3C2410_DMAOP_PAUSE:
324 case S3C2410_DMAOP_RESUME:
325 case S3C2410_DMAOP_STARTED:
326 case S3C2410_DMAOP_TIMEOUT:
327 return 0;
328 }
329
330 return -ENOENT;
331}
332EXPORT_SYMBOL(s3c2410_dma_ctrl);
333
334/* s3c2410_dma_enque
335 *
336 */
337
338int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
339 dma_addr_t data, int size)
340{
341 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
342 struct s3c64xx_dma_buff *next;
343 struct s3c64xx_dma_buff *buff;
344 struct pl080s_lli *lli;
345 unsigned long flags;
346 int ret;
347
348 WARN_ON(!chan);
349 if (!chan)
350 return -EINVAL;
351
352 buff = kzalloc(sizeof(struct s3c64xx_dma_buff), GFP_ATOMIC);
353 if (!buff) {
354 printk(KERN_ERR "%s: no memory for buffer\n", __func__);
355 return -ENOMEM;
356 }
357
358 lli = dma_pool_alloc(dma_pool, GFP_ATOMIC, &buff->lli_dma);
359 if (!lli) {
360 printk(KERN_ERR "%s: no memory for lli\n", __func__);
361 ret = -ENOMEM;
362 goto err_buff;
363 }
364
365 pr_debug("%s: buff %p, dp %08x lli (%p, %08x) %d\n",
366 __func__, buff, data, lli, (u32)buff->lli_dma, size);
367
368 buff->lli = lli;
369 buff->pw = id;
370
371 s3c64xx_dma_fill_lli(chan, lli, data, size);
372
373 local_irq_save(flags);
374
375 if ((next = chan->next) != NULL) {
376 struct s3c64xx_dma_buff *end = chan->end;
377 struct pl080s_lli *endlli = end->lli;
378
379 pr_debug("enquing onto channel\n");
380
381 end->next = buff;
382 endlli->next_lli = buff->lli_dma;
383
384 if (chan->flags & S3C2410_DMAF_CIRCULAR) {
385 struct s3c64xx_dma_buff *curr = chan->curr;
386 lli->next_lli = curr->lli_dma;
387 }
388
389 if (next == chan->curr) {
390 writel(buff->lli_dma, chan->regs + PL080_CH_LLI);
391 chan->next = buff;
392 }
393
394 show_lli(endlli);
395 chan->end = buff;
396 } else {
397 pr_debug("enquing onto empty channel\n");
398
399 chan->curr = buff;
400 chan->next = buff;
401 chan->end = buff;
402
403 s3c64xx_lli_to_regs(chan, lli);
404 }
405
406 local_irq_restore(flags);
407
408 show_lli(lli);
409
410 dbg_showchan(chan);
411 dbg_showbuffs(chan);
412 return 0;
413
414err_buff:
415 kfree(buff);
416 return ret;
417}
418
419EXPORT_SYMBOL(s3c2410_dma_enqueue);
420
421
422int s3c2410_dma_devconfig(enum dma_ch channel,
423 enum dma_data_direction source,
424 unsigned long devaddr)
425{
426 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
427 u32 peripheral;
428 u32 config = 0;
429
430 pr_debug("%s: channel %d, source %d, dev %08lx, chan %p\n",
431 __func__, channel, source, devaddr, chan);
432
433 WARN_ON(!chan);
434 if (!chan)
435 return -EINVAL;
436
437 peripheral = (chan->peripheral & 0xf);
438 chan->source = source;
439 chan->dev_addr = devaddr;
440
441 pr_debug("%s: peripheral %d\n", __func__, peripheral);
442
443 switch (source) {
444 case DMA_FROM_DEVICE:
445 config = 2 << PL080_CONFIG_FLOW_CONTROL_SHIFT;
446 config |= peripheral << PL080_CONFIG_SRC_SEL_SHIFT;
447 break;
448 case DMA_TO_DEVICE:
449 config = 1 << PL080_CONFIG_FLOW_CONTROL_SHIFT;
450 config |= peripheral << PL080_CONFIG_DST_SEL_SHIFT;
451 break;
452 default:
453 printk(KERN_ERR "%s: bad source\n", __func__);
454 return -EINVAL;
455 }
456
457 /* allow TC and ERR interrupts */
458 config |= PL080_CONFIG_TC_IRQ_MASK;
459 config |= PL080_CONFIG_ERR_IRQ_MASK;
460
461 pr_debug("%s: config %08x\n", __func__, config);
462
463 writel(config, chan->regs + PL080S_CH_CONFIG);
464
465 return 0;
466}
467EXPORT_SYMBOL(s3c2410_dma_devconfig);
468
469
470int s3c2410_dma_getposition(enum dma_ch channel,
471 dma_addr_t *src, dma_addr_t *dst)
472{
473 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
474
475 WARN_ON(!chan);
476 if (!chan)
477 return -EINVAL;
478
479 if (src != NULL)
480 *src = readl(chan->regs + PL080_CH_SRC_ADDR);
481
482 if (dst != NULL)
483 *dst = readl(chan->regs + PL080_CH_DST_ADDR);
484
485 return 0;
486}
487EXPORT_SYMBOL(s3c2410_dma_getposition);
488
489/* s3c2410_request_dma
490 *
491 * get control of an dma channel
492*/
493
494int s3c2410_dma_request(enum dma_ch channel,
495 struct s3c2410_dma_client *client,
496 void *dev)
497{
498 struct s3c2410_dma_chan *chan;
499 unsigned long flags;
500
501 pr_debug("dma%d: s3c2410_request_dma: client=%s, dev=%p\n",
502 channel, client->name, dev);
503
504 local_irq_save(flags);
505
506 chan = s3c64xx_dma_map_channel(channel);
507 if (chan == NULL) {
508 local_irq_restore(flags);
509 return -EBUSY;
510 }
511
512 dbg_showchan(chan);
513
514 chan->client = client;
515 chan->in_use = 1;
516 chan->peripheral = channel;
517 chan->flags = 0;
518
519 local_irq_restore(flags);
520
521 /* need to setup */
522
523 pr_debug("%s: channel initialised, %p\n", __func__, chan);
524
525 return chan->number | DMACH_LOW_LEVEL;
526}
527
528EXPORT_SYMBOL(s3c2410_dma_request);
529
530/* s3c2410_dma_free
531 *
532 * release the given channel back to the system, will stop and flush
533 * any outstanding transfers, and ensure the channel is ready for the
534 * next claimant.
535 *
536 * Note, although a warning is currently printed if the freeing client
537 * info is not the same as the registrant's client info, the free is still
538 * allowed to go through.
539*/
540
541int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *client)
542{
543 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
544 unsigned long flags;
545
546 if (chan == NULL)
547 return -EINVAL;
548
549 local_irq_save(flags);
550
551 if (chan->client != client) {
552 printk(KERN_WARNING "dma%d: possible free from different client (channel %p, passed %p)\n",
553 channel, chan->client, client);
554 }
555
556 /* sort out stopping and freeing the channel */
557
558
559 chan->client = NULL;
560 chan->in_use = 0;
561
562 if (!(channel & DMACH_LOW_LEVEL))
563 s3c_dma_chan_map[channel] = NULL;
564
565 local_irq_restore(flags);
566
567 return 0;
568}
569
570EXPORT_SYMBOL(s3c2410_dma_free);
571
572static irqreturn_t s3c64xx_dma_irq(int irq, void *pw)
573{
574 struct s3c64xx_dmac *dmac = pw;
575 struct s3c2410_dma_chan *chan;
576 enum s3c2410_dma_buffresult res;
577 u32 tcstat, errstat;
578 u32 bit;
579 int offs;
580
581 tcstat = readl(dmac->regs + PL080_TC_STATUS);
582 errstat = readl(dmac->regs + PL080_ERR_STATUS);
583
584 for (offs = 0, bit = 1; offs < 8; offs++, bit <<= 1) {
585 struct s3c64xx_dma_buff *buff;
586
587 if (!(errstat & bit) && !(tcstat & bit))
588 continue;
589
590 chan = dmac->channels + offs;
591 res = S3C2410_RES_ERR;
592
593 if (tcstat & bit) {
594 writel(bit, dmac->regs + PL080_TC_CLEAR);
595 res = S3C2410_RES_OK;
596 }
597
598 if (errstat & bit)
599 writel(bit, dmac->regs + PL080_ERR_CLEAR);
600
601 /* 'next' points to the buffer that is next to the
602 * currently active buffer.
603 * For CIRCULAR queues, 'next' will be same as 'curr'
604 * when 'end' is the active buffer.
605 */
606 buff = chan->curr;
607 while (buff && buff != chan->next
608 && buff->next != chan->next)
609 buff = buff->next;
610
611 if (!buff)
612 BUG();
613
614 if (buff == chan->next)
615 buff = chan->end;
616
617 s3c64xx_dma_bufffdone(chan, buff, res);
618
619 /* Free the node and update curr, if non-circular queue */
620 if (!(chan->flags & S3C2410_DMAF_CIRCULAR)) {
621 chan->curr = buff->next;
622 s3c64xx_dma_freebuff(buff);
623 }
624
625 /* Update 'next' */
626 buff = chan->next;
627 if (chan->next == chan->end) {
628 chan->next = chan->curr;
629 if (!(chan->flags & S3C2410_DMAF_CIRCULAR))
630 chan->end = NULL;
631 } else {
632 chan->next = buff->next;
633 }
634 }
635
636 return IRQ_HANDLED;
637}
638
639static struct bus_type dma_subsys = {
640 .name = "s3c64xx-dma",
641 .dev_name = "s3c64xx-dma",
642};
643
644static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
645 int irq, unsigned int base)
646{
647 struct s3c2410_dma_chan *chptr = &s3c2410_chans[chno];
648 struct s3c64xx_dmac *dmac;
649 char clkname[16];
650 void __iomem *regs;
651 void __iomem *regptr;
652 int err, ch;
653
654 dmac = kzalloc(sizeof(struct s3c64xx_dmac), GFP_KERNEL);
655 if (!dmac) {
656 printk(KERN_ERR "%s: failed to alloc mem\n", __func__);
657 return -ENOMEM;
658 }
659
660 dmac->dev.id = chno / 8;
661 dmac->dev.bus = &dma_subsys;
662
663 err = device_register(&dmac->dev);
664 if (err) {
665 printk(KERN_ERR "%s: failed to register device\n", __func__);
666 goto err_alloc;
667 }
668
669 regs = ioremap(base, 0x200);
670 if (!regs) {
671 printk(KERN_ERR "%s: failed to ioremap()\n", __func__);
672 err = -ENXIO;
673 goto err_dev;
674 }
675
676 snprintf(clkname, sizeof(clkname), "dma%d", dmac->dev.id);
677
678 dmac->clk = clk_get(NULL, clkname);
679 if (IS_ERR(dmac->clk)) {
680 printk(KERN_ERR "%s: failed to get clock %s\n", __func__, clkname);
681 err = PTR_ERR(dmac->clk);
682 goto err_map;
683 }
684
685 clk_prepare_enable(dmac->clk);
686
687 dmac->regs = regs;
688 dmac->chanbase = chbase;
689 dmac->channels = chptr;
690
691 err = request_irq(irq, s3c64xx_dma_irq, 0, "DMA", dmac);
692 if (err < 0) {
693 printk(KERN_ERR "%s: failed to get irq\n", __func__);
694 goto err_clk;
695 }
696
697 regptr = regs + PL080_Cx_BASE(0);
698
699 for (ch = 0; ch < 8; ch++, chptr++) {
700 pr_debug("%s: registering DMA %d (%p)\n",
701 __func__, chno + ch, regptr);
702
703 chptr->bit = 1 << ch;
704 chptr->number = chno + ch;
705 chptr->dmac = dmac;
706 chptr->regs = regptr;
707 regptr += PL080_Cx_STRIDE;
708 }
709
710 /* for the moment, permanently enable the controller */
711 writel(PL080_CONFIG_ENABLE, regs + PL080_CONFIG);
712
713 printk(KERN_INFO "PL080: IRQ %d, at %p, channels %d..%d\n",
714 irq, regs, chno, chno+8);
715
716 return 0;
717
718err_clk:
719 clk_disable_unprepare(dmac->clk);
720 clk_put(dmac->clk);
721err_map:
722 iounmap(regs);
723err_dev:
724 device_unregister(&dmac->dev);
725err_alloc:
726 kfree(dmac);
727 return err;
728}
729
730static int __init s3c64xx_dma_init(void)
731{
732 int ret;
733
734 /* This driver is not supported when booting with device tree. */
735 if (of_have_populated_dt())
736 return -ENODEV;
737
738 printk(KERN_INFO "%s: Registering DMA channels\n", __func__);
739
740 dma_pool = dma_pool_create("DMA-LLI", NULL, sizeof(struct pl080s_lli), 16, 0);
741 if (!dma_pool) {
742 printk(KERN_ERR "%s: failed to create pool\n", __func__);
743 return -ENOMEM;
744 }
745
746 ret = subsys_system_register(&dma_subsys, NULL);
747 if (ret) {
748 printk(KERN_ERR "%s: failed to create subsys\n", __func__);
749 return -ENOMEM;
750 }
751
752 /* Set all DMA configuration to be DMA, not SDMA */
753 writel(0xffffff, S3C64XX_SDMA_SEL);
754
755 /* Register standard DMA controllers */
756 s3c64xx_dma_init1(0, DMACH_UART0, IRQ_DMA0, 0x75000000);
757 s3c64xx_dma_init1(8, DMACH_PCM1_TX, IRQ_DMA1, 0x75100000);
758
759 return 0;
760}
761
762arch_initcall(s3c64xx_dma_init);
diff --git a/arch/arm/mach-s3c64xx/include/mach/dma.h b/arch/arm/mach-s3c64xx/include/mach/dma.h
index fe1a98cf0e4c..059b1fc85037 100644
--- a/arch/arm/mach-s3c64xx/include/mach/dma.h
+++ b/arch/arm/mach-s3c64xx/include/mach/dma.h
@@ -11,51 +11,48 @@
11#ifndef __ASM_ARCH_DMA_H 11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H __FILE__ 12#define __ASM_ARCH_DMA_H __FILE__
13 13
14#define S3C_DMA_CHANNELS (16) 14#define S3C64XX_DMA_CHAN(name) ((unsigned long)(name))
15
16/* DMA0/SDMA0 */
17#define DMACH_UART0 S3C64XX_DMA_CHAN("uart0_tx")
18#define DMACH_UART0_SRC2 S3C64XX_DMA_CHAN("uart0_rx")
19#define DMACH_UART1 S3C64XX_DMA_CHAN("uart1_tx")
20#define DMACH_UART1_SRC2 S3C64XX_DMA_CHAN("uart1_rx")
21#define DMACH_UART2 S3C64XX_DMA_CHAN("uart2_tx")
22#define DMACH_UART2_SRC2 S3C64XX_DMA_CHAN("uart2_rx")
23#define DMACH_UART3 S3C64XX_DMA_CHAN("uart3_tx")
24#define DMACH_UART3_SRC2 S3C64XX_DMA_CHAN("uart3_rx")
25#define DMACH_PCM0_TX S3C64XX_DMA_CHAN("pcm0_tx")
26#define DMACH_PCM0_RX S3C64XX_DMA_CHAN("pcm0_rx")
27#define DMACH_I2S0_OUT S3C64XX_DMA_CHAN("i2s0_tx")
28#define DMACH_I2S0_IN S3C64XX_DMA_CHAN("i2s0_rx")
29#define DMACH_SPI0_TX S3C64XX_DMA_CHAN("spi0_tx")
30#define DMACH_SPI0_RX S3C64XX_DMA_CHAN("spi0_rx")
31#define DMACH_HSI_I2SV40_TX S3C64XX_DMA_CHAN("i2s2_tx")
32#define DMACH_HSI_I2SV40_RX S3C64XX_DMA_CHAN("i2s2_rx")
33
34/* DMA1/SDMA1 */
35#define DMACH_PCM1_TX S3C64XX_DMA_CHAN("pcm1_tx")
36#define DMACH_PCM1_RX S3C64XX_DMA_CHAN("pcm1_rx")
37#define DMACH_I2S1_OUT S3C64XX_DMA_CHAN("i2s1_tx")
38#define DMACH_I2S1_IN S3C64XX_DMA_CHAN("i2s1_rx")
39#define DMACH_SPI1_TX S3C64XX_DMA_CHAN("spi1_tx")
40#define DMACH_SPI1_RX S3C64XX_DMA_CHAN("spi1_rx")
41#define DMACH_AC97_PCMOUT S3C64XX_DMA_CHAN("ac97_out")
42#define DMACH_AC97_PCMIN S3C64XX_DMA_CHAN("ac97_in")
43#define DMACH_AC97_MICIN S3C64XX_DMA_CHAN("ac97_mic")
44#define DMACH_PWM S3C64XX_DMA_CHAN("pwm")
45#define DMACH_IRDA S3C64XX_DMA_CHAN("irda")
46#define DMACH_EXTERNAL S3C64XX_DMA_CHAN("external")
47#define DMACH_SECURITY_RX S3C64XX_DMA_CHAN("sec_rx")
48#define DMACH_SECURITY_TX S3C64XX_DMA_CHAN("sec_tx")
15 49
16/* see mach-s3c2410/dma.h for notes on dma channel numbers */
17
18/* Note, for the S3C64XX architecture we keep the DMACH_
19 * defines in the order they are allocated to [S]DMA0/[S]DMA1
20 * so that is easy to do DHACH_ -> DMA controller conversion
21 */
22enum dma_ch { 50enum dma_ch {
23 /* DMA0/SDMA0 */ 51 DMACH_MAX = 32
24 DMACH_UART0 = 0, 52};
25 DMACH_UART0_SRC2,
26 DMACH_UART1,
27 DMACH_UART1_SRC2,
28 DMACH_UART2,
29 DMACH_UART2_SRC2,
30 DMACH_UART3,
31 DMACH_UART3_SRC2,
32 DMACH_PCM0_TX,
33 DMACH_PCM0_RX,
34 DMACH_I2S0_OUT,
35 DMACH_I2S0_IN,
36 DMACH_SPI0_TX,
37 DMACH_SPI0_RX,
38 DMACH_HSI_I2SV40_TX,
39 DMACH_HSI_I2SV40_RX,
40 53
41 /* DMA1/SDMA1 */ 54struct s3c2410_dma_client {
42 DMACH_PCM1_TX = 16, 55 char *name;
43 DMACH_PCM1_RX,
44 DMACH_I2S1_OUT,
45 DMACH_I2S1_IN,
46 DMACH_SPI1_TX,
47 DMACH_SPI1_RX,
48 DMACH_AC97_PCMOUT,
49 DMACH_AC97_PCMIN,
50 DMACH_AC97_MICIN,
51 DMACH_PWM,
52 DMACH_IRDA,
53 DMACH_EXTERNAL,
54 DMACH_RES1,
55 DMACH_RES2,
56 DMACH_SECURITY_RX, /* SDMA1 only */
57 DMACH_SECURITY_TX, /* SDMA1 only */
58 DMACH_MAX /* the end */
59}; 56};
60 57
61static inline bool samsung_dma_has_circular(void) 58static inline bool samsung_dma_has_circular(void)
@@ -65,67 +62,10 @@ static inline bool samsung_dma_has_circular(void)
65 62
66static inline bool samsung_dma_is_dmadev(void) 63static inline bool samsung_dma_is_dmadev(void)
67{ 64{
68 return false; 65 return true;
69} 66}
70#define S3C2410_DMAF_CIRCULAR (1 << 0)
71
72#include <plat/dma.h>
73
74#define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
75
76struct s3c64xx_dma_buff;
77
78/** s3c64xx_dma_buff - S3C64XX DMA buffer descriptor
79 * @next: Pointer to next buffer in queue or ring.
80 * @pw: Client provided identifier
81 * @lli: Pointer to hardware descriptor this buffer is associated with.
82 * @lli_dma: Hardare address of the descriptor.
83 */
84struct s3c64xx_dma_buff {
85 struct s3c64xx_dma_buff *next;
86
87 void *pw;
88 struct pl080s_lli *lli;
89 dma_addr_t lli_dma;
90};
91
92struct s3c64xx_dmac;
93
94struct s3c2410_dma_chan {
95 unsigned char number; /* number of this dma channel */
96 unsigned char in_use; /* channel allocated */
97 unsigned char bit; /* bit for enable/disable/etc */
98 unsigned char hw_width;
99 unsigned char peripheral;
100
101 unsigned int flags;
102 enum dma_data_direction source;
103
104
105 dma_addr_t dev_addr;
106
107 struct s3c2410_dma_client *client;
108 struct s3c64xx_dmac *dmac; /* pointer to controller */
109
110 void __iomem *regs;
111
112 /* cdriver callbacks */
113 s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */
114 s3c2410_dma_opfn_t op_fn; /* channel op callback */
115
116 /* buffer list and information */
117 struct s3c64xx_dma_buff *curr; /* current dma buffer */
118 struct s3c64xx_dma_buff *next; /* next buffer to load */
119 struct s3c64xx_dma_buff *end; /* end of queue */
120
121 /* note, when channel is running in circular mode, curr is the
122 * first buffer enqueued, end is the last and curr is where the
123 * last buffer-done event is set-at. The buffers are not freed
124 * and the last buffer hardware descriptor points back to the
125 * first.
126 */
127};
128 67
129#include <plat/dma-core.h> 68#include <linux/amba/pl08x.h>
69#include <plat/dma-ops.h>
130 70
131#endif /* __ASM_ARCH_IRQ_H */ 71#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio.h b/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
index 8b540c42d5dd..9c81fac3b2d5 100644
--- a/arch/arm/mach-s3c64xx/include/mach/gpio.h
+++ b/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
@@ -1,5 +1,4 @@
1/* arch/arm/mach-s3c6400/include/mach/gpio.h 1/*
2 *
3 * Copyright 2008 Openmoko, Inc. 2 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics 3 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
@@ -12,6 +11,9 @@
12 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
13*/ 12*/
14 13
14#ifndef GPIO_SAMSUNG_S3C64XX_H
15#define GPIO_SAMSUNG_S3C64XX_H
16
15/* GPIO bank sizes */ 17/* GPIO bank sizes */
16#define S3C64XX_GPIO_A_NR (8) 18#define S3C64XX_GPIO_A_NR (8)
17#define S3C64XX_GPIO_B_NR (7) 19#define S3C64XX_GPIO_B_NR (7)
@@ -88,6 +90,5 @@ enum s3c_gpio_number {
88/* define the number of gpios we need to the one after the GPQ() range */ 90/* define the number of gpios we need to the one after the GPQ() range */
89#define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1) 91#define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
90 92
91#define BOARD_NR_GPIOS (16 + CONFIG_SAMSUNG_GPIO_EXTRA) 93#endif /* GPIO_SAMSUNG_S3C64XX_H */
92 94
93#define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS)
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index d266dd5f7060..ddeb0e51a962 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -49,6 +49,7 @@
49#include <plat/devs.h> 49#include <plat/devs.h>
50#include <plat/cpu.h> 50#include <plat/cpu.h>
51#include <mach/regs-gpio.h> 51#include <mach/regs-gpio.h>
52#include <mach/gpio-samsung.h>
52#include <plat/samsung-time.h> 53#include <plat/samsung-time.h>
53 54
54#include "common.h" 55#include "common.h"
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 758e31b26550..3df3c372ee1f 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -48,8 +48,8 @@
48#include <video/samsung_fimd.h> 48#include <video/samsung_fimd.h>
49#include <mach/hardware.h> 49#include <mach/hardware.h>
50#include <mach/map.h> 50#include <mach/map.h>
51
52#include <mach/regs-gpio.h> 51#include <mach/regs-gpio.h>
52#include <mach/gpio-samsung.h>
53 53
54#include <plat/regs-serial.h> 54#include <plat/regs-serial.h>
55#include <plat/fb.h> 55#include <plat/fb.h>
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 614a03a92cf7..0431016925b9 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -35,6 +35,7 @@
35 35
36#include <plat/regs-serial.h> 36#include <plat/regs-serial.h>
37#include <linux/platform_data/i2c-s3c2410.h> 37#include <linux/platform_data/i2c-s3c2410.h>
38#include <mach/gpio-samsung.h>
38#include <plat/fb.h> 39#include <plat/fb.h>
39#include <linux/platform_data/mtd-nand-s3c2410.h> 40#include <linux/platform_data/mtd-nand-s3c2410.h>
40 41
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 58d46a3d7b78..8d553a418e1c 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -30,13 +30,16 @@
30 30
31#include <mach/map.h> 31#include <mach/map.h>
32#include <mach/regs-gpio.h> 32#include <mach/regs-gpio.h>
33#include <mach/gpio-samsung.h>
33 34
34#include <plat/adc.h> 35#include <plat/adc.h>
35#include <plat/cpu.h> 36#include <plat/cpu.h>
36#include <plat/devs.h> 37#include <plat/devs.h>
37#include <plat/fb.h> 38#include <plat/fb.h>
38#include <linux/platform_data/mtd-nand-s3c2410.h> 39#include <linux/platform_data/mtd-nand-s3c2410.h>
40#include <linux/platform_data/mmc-sdhci-s3c.h>
39#include <plat/regs-serial.h> 41#include <plat/regs-serial.h>
42#include <plat/sdhci.h>
40#include <linux/platform_data/touchscreen-s3c2410.h> 43#include <linux/platform_data/touchscreen-s3c2410.h>
41 44
42#include <video/platform_lcd.h> 45#include <video/platform_lcd.h>
@@ -214,6 +217,13 @@ static struct platform_device mini6410_lcd_powerdev = {
214 .dev.platform_data = &mini6410_lcd_power_data, 217 .dev.platform_data = &mini6410_lcd_power_data,
215}; 218};
216 219
220static struct s3c_sdhci_platdata mini6410_hsmmc1_pdata = {
221 .max_width = 4,
222 .cd_type = S3C_SDHCI_CD_GPIO,
223 .ext_cd_gpio = S3C64XX_GPN(10),
224 .ext_cd_gpio_invert = true,
225};
226
217static struct platform_device *mini6410_devices[] __initdata = { 227static struct platform_device *mini6410_devices[] __initdata = {
218 &mini6410_device_eth, 228 &mini6410_device_eth,
219 &s3c_device_hsmmc0, 229 &s3c_device_hsmmc0,
@@ -321,6 +331,7 @@ static void __init mini6410_machine_init(void)
321 331
322 s3c_nand_set_platdata(&mini6410_nand_info); 332 s3c_nand_set_platdata(&mini6410_nand_info);
323 s3c_fb_set_platdata(&mini6410_lcd_pdata[features.lcd_index]); 333 s3c_fb_set_platdata(&mini6410_lcd_pdata[features.lcd_index]);
334 s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);
324 s3c24xx_ts_set_platdata(NULL); 335 s3c24xx_ts_set_platdata(NULL);
325 336
326 /* configure nCS1 width to 16 bits */ 337 /* configure nCS1 width to 16 bits */
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 8bed37b3d5ac..5152026f0e19 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -31,6 +31,7 @@
31 31
32#include <mach/map.h> 32#include <mach/map.h>
33#include <mach/regs-gpio.h> 33#include <mach/regs-gpio.h>
34#include <mach/gpio-samsung.h>
34 35
35#include <plat/adc.h> 36#include <plat/adc.h>
36#include <plat/cpu.h> 37#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index a6b338fd0470..6e72bd5c1d0c 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -25,6 +25,7 @@
25 25
26#include <mach/map.h> 26#include <mach/map.h>
27#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <mach/gpio-samsung.h>
28 29
29#include <plat/clock.h> 30#include <plat/clock.h>
30#include <plat/cpu.h> 31#include <plat/cpu.h>
@@ -106,7 +107,7 @@ static void smartq_usb_host_enableoc(struct s3c2410_hcd_info *info, int on)
106 107
107 if (on) { 108 if (on) {
108 ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)), 109 ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)),
109 smartq_usb_host_ocirq, IRQF_DISABLED | 110 smartq_usb_host_ocirq,
110 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 111 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
111 "USB host overcurrent", info); 112 "USB host overcurrent", info);
112 if (ret != 0) 113 if (ret != 0)
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 8aca5daf3d05..dec4c08e834f 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -23,6 +23,7 @@
23#include <video/samsung_fimd.h> 23#include <video/samsung_fimd.h>
24#include <mach/map.h> 24#include <mach/map.h>
25#include <mach/regs-gpio.h> 25#include <mach/regs-gpio.h>
26#include <mach/gpio-samsung.h>
26 27
27#include <plat/cpu.h> 28#include <plat/cpu.h>
28#include <plat/devs.h> 29#include <plat/devs.h>
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index a052e107c0b4..27b322069c7d 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -23,6 +23,7 @@
23#include <video/samsung_fimd.h> 23#include <video/samsung_fimd.h>
24#include <mach/map.h> 24#include <mach/map.h>
25#include <mach/regs-gpio.h> 25#include <mach/regs-gpio.h>
26#include <mach/gpio-samsung.h>
26 27
27#include <plat/cpu.h> 28#include <plat/cpu.h>
28#include <plat/devs.h> 29#include <plat/devs.h>
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index 27381cfcabbe..150f55fb9e33 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -35,6 +35,7 @@
35#include <plat/devs.h> 35#include <plat/devs.h>
36#include <plat/cpu.h> 36#include <plat/cpu.h>
37#include <linux/platform_data/i2c-s3c2410.h> 37#include <linux/platform_data/i2c-s3c2410.h>
38#include <mach/gpio-samsung.h>
38#include <plat/samsung-time.h> 39#include <plat/samsung-time.h>
39 40
40#include "common.h" 41#include "common.h"
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index d5ea938cc9a1..43261d24a0a5 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -57,6 +57,7 @@
57 57
58#include <plat/regs-serial.h> 58#include <plat/regs-serial.h>
59#include <mach/regs-gpio.h> 59#include <mach/regs-gpio.h>
60#include <mach/gpio-samsung.h>
60#include <linux/platform_data/ata-samsung_cf.h> 61#include <linux/platform_data/ata-samsung_cf.h>
61#include <linux/platform_data/i2c-s3c2410.h> 62#include <linux/platform_data/i2c-s3c2410.h>
62#include <plat/fb.h> 63#include <plat/fb.h>
diff --git a/arch/arm/mach-s3c64xx/pl080.c b/arch/arm/mach-s3c64xx/pl080.c
new file mode 100644
index 000000000000..901a984bddc2
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/pl080.c
@@ -0,0 +1,244 @@
1/*
2 * Samsung's S3C64XX generic DMA support using amba-pl08x driver.
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/kernel.h>
12#include <linux/amba/bus.h>
13#include <linux/amba/pl080.h>
14#include <linux/amba/pl08x.h>
15#include <linux/of.h>
16
17#include <mach/irqs.h>
18#include <mach/map.h>
19
20#include "regs-sys.h"
21
22static int pl08x_get_xfer_signal(const struct pl08x_channel_data *cd)
23{
24 return cd->min_signal;
25}
26
27static void pl08x_put_xfer_signal(const struct pl08x_channel_data *cd, int ch)
28{
29}
30
31/*
32 * DMA0
33 */
34
35static struct pl08x_channel_data s3c64xx_dma0_info[] = {
36 {
37 .bus_id = "uart0_tx",
38 .min_signal = 0,
39 .max_signal = 0,
40 .periph_buses = PL08X_AHB2,
41 }, {
42 .bus_id = "uart0_rx",
43 .min_signal = 1,
44 .max_signal = 1,
45 .periph_buses = PL08X_AHB2,
46 }, {
47 .bus_id = "uart1_tx",
48 .min_signal = 2,
49 .max_signal = 2,
50 .periph_buses = PL08X_AHB2,
51 }, {
52 .bus_id = "uart1_rx",
53 .min_signal = 3,
54 .max_signal = 3,
55 .periph_buses = PL08X_AHB2,
56 }, {
57 .bus_id = "uart2_tx",
58 .min_signal = 4,
59 .max_signal = 4,
60 .periph_buses = PL08X_AHB2,
61 }, {
62 .bus_id = "uart2_rx",
63 .min_signal = 5,
64 .max_signal = 5,
65 .periph_buses = PL08X_AHB2,
66 }, {
67 .bus_id = "uart3_tx",
68 .min_signal = 6,
69 .max_signal = 6,
70 .periph_buses = PL08X_AHB2,
71 }, {
72 .bus_id = "uart3_rx",
73 .min_signal = 7,
74 .max_signal = 7,
75 .periph_buses = PL08X_AHB2,
76 }, {
77 .bus_id = "pcm0_tx",
78 .min_signal = 8,
79 .max_signal = 8,
80 .periph_buses = PL08X_AHB2,
81 }, {
82 .bus_id = "pcm0_rx",
83 .min_signal = 9,
84 .max_signal = 9,
85 .periph_buses = PL08X_AHB2,
86 }, {
87 .bus_id = "i2s0_tx",
88 .min_signal = 10,
89 .max_signal = 10,
90 .periph_buses = PL08X_AHB2,
91 }, {
92 .bus_id = "i2s0_rx",
93 .min_signal = 11,
94 .max_signal = 11,
95 .periph_buses = PL08X_AHB2,
96 }, {
97 .bus_id = "spi0_tx",
98 .min_signal = 12,
99 .max_signal = 12,
100 .periph_buses = PL08X_AHB2,
101 }, {
102 .bus_id = "spi0_rx",
103 .min_signal = 13,
104 .max_signal = 13,
105 .periph_buses = PL08X_AHB2,
106 }, {
107 .bus_id = "i2s2_tx",
108 .min_signal = 14,
109 .max_signal = 14,
110 .periph_buses = PL08X_AHB2,
111 }, {
112 .bus_id = "i2s2_rx",
113 .min_signal = 15,
114 .max_signal = 15,
115 .periph_buses = PL08X_AHB2,
116 }
117};
118
119struct pl08x_platform_data s3c64xx_dma0_plat_data = {
120 .memcpy_channel = {
121 .bus_id = "memcpy",
122 .cctl_memcpy =
123 (PL080_BSIZE_4 << PL080_CONTROL_SB_SIZE_SHIFT |
124 PL080_BSIZE_4 << PL080_CONTROL_DB_SIZE_SHIFT |
125 PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT |
126 PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT |
127 PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE |
128 PL080_CONTROL_PROT_SYS),
129 },
130 .lli_buses = PL08X_AHB1,
131 .mem_buses = PL08X_AHB1,
132 .get_xfer_signal = pl08x_get_xfer_signal,
133 .put_xfer_signal = pl08x_put_xfer_signal,
134 .slave_channels = s3c64xx_dma0_info,
135 .num_slave_channels = ARRAY_SIZE(s3c64xx_dma0_info),
136};
137
138static AMBA_AHB_DEVICE(s3c64xx_dma0, "dma-pl080s.0", 0,
139 0x75000000, {IRQ_DMA0}, &s3c64xx_dma0_plat_data);
140
141/*
142 * DMA1
143 */
144
145static struct pl08x_channel_data s3c64xx_dma1_info[] = {
146 {
147 .bus_id = "pcm1_tx",
148 .min_signal = 0,
149 .max_signal = 0,
150 .periph_buses = PL08X_AHB2,
151 }, {
152 .bus_id = "pcm1_rx",
153 .min_signal = 1,
154 .max_signal = 1,
155 .periph_buses = PL08X_AHB2,
156 }, {
157 .bus_id = "i2s1_tx",
158 .min_signal = 2,
159 .max_signal = 2,
160 .periph_buses = PL08X_AHB2,
161 }, {
162 .bus_id = "i2s1_rx",
163 .min_signal = 3,
164 .max_signal = 3,
165 .periph_buses = PL08X_AHB2,
166 }, {
167 .bus_id = "spi1_tx",
168 .min_signal = 4,
169 .max_signal = 4,
170 .periph_buses = PL08X_AHB2,
171 }, {
172 .bus_id = "spi1_rx",
173 .min_signal = 5,
174 .max_signal = 5,
175 .periph_buses = PL08X_AHB2,
176 }, {
177 .bus_id = "ac97_out",
178 .min_signal = 6,
179 .max_signal = 6,
180 .periph_buses = PL08X_AHB2,
181 }, {
182 .bus_id = "ac97_in",
183 .min_signal = 7,
184 .max_signal = 7,
185 .periph_buses = PL08X_AHB2,
186 }, {
187 .bus_id = "ac97_mic",
188 .min_signal = 8,
189 .max_signal = 8,
190 .periph_buses = PL08X_AHB2,
191 }, {
192 .bus_id = "pwm",
193 .min_signal = 9,
194 .max_signal = 9,
195 .periph_buses = PL08X_AHB2,
196 }, {
197 .bus_id = "irda",
198 .min_signal = 10,
199 .max_signal = 10,
200 .periph_buses = PL08X_AHB2,
201 }, {
202 .bus_id = "external",
203 .min_signal = 11,
204 .max_signal = 11,
205 .periph_buses = PL08X_AHB2,
206 },
207};
208
209struct pl08x_platform_data s3c64xx_dma1_plat_data = {
210 .memcpy_channel = {
211 .bus_id = "memcpy",
212 .cctl_memcpy =
213 (PL080_BSIZE_4 << PL080_CONTROL_SB_SIZE_SHIFT |
214 PL080_BSIZE_4 << PL080_CONTROL_DB_SIZE_SHIFT |
215 PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT |
216 PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT |
217 PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE |
218 PL080_CONTROL_PROT_SYS),
219 },
220 .lli_buses = PL08X_AHB1,
221 .mem_buses = PL08X_AHB1,
222 .get_xfer_signal = pl08x_get_xfer_signal,
223 .put_xfer_signal = pl08x_put_xfer_signal,
224 .slave_channels = s3c64xx_dma1_info,
225 .num_slave_channels = ARRAY_SIZE(s3c64xx_dma1_info),
226};
227
228static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0,
229 0x75100000, {IRQ_DMA1}, &s3c64xx_dma1_plat_data);
230
231static int __init s3c64xx_pl080_init(void)
232{
233 /* Set all DMA configuration to be DMA, not SDMA */
234 writel(0xffffff, S3C64XX_SDMA_SEL);
235
236 if (of_have_populated_dt())
237 return 0;
238
239 amba_device_register(&s3c64xx_dma0_device, &iomem_resource);
240 amba_device_register(&s3c64xx_dma1_device, &iomem_resource);
241
242 return 0;
243}
244arch_initcall(s3c64xx_pl080_init);
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index 8cdb824a3b43..b5a66986a529 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -28,6 +28,7 @@
28 28
29#include <mach/regs-gpio.h> 29#include <mach/regs-gpio.h>
30#include <mach/regs-clock.h> 30#include <mach/regs-clock.h>
31#include <mach/gpio-samsung.h>
31 32
32#include "regs-gpio-memport.h" 33#include "regs-gpio-memport.h"
33#include "regs-modem.h" 34#include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
index 2cf80026c58d..9d17bff12d4d 100644
--- a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
+++ b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
@@ -19,6 +19,7 @@
19 19
20#include <plat/fb.h> 20#include <plat/fb.h>
21#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <mach/gpio-samsung.h>
22 23
23void s3c64xx_fb_gpio_setup_24bpp(void) 24void s3c64xx_fb_gpio_setup_24bpp(void)
24{ 25{
diff --git a/arch/arm/mach-s3c64xx/setup-i2c0.c b/arch/arm/mach-s3c64xx/setup-i2c0.c
index 40666ba8d607..4b8c1cfdd1fc 100644
--- a/arch/arm/mach-s3c64xx/setup-i2c0.c
+++ b/arch/arm/mach-s3c64xx/setup-i2c0.c
@@ -20,6 +20,7 @@ struct platform_device; /* don't need the contents */
20 20
21#include <linux/platform_data/i2c-s3c2410.h> 21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h> 22#include <plat/gpio-cfg.h>
23#include <mach/gpio-samsung.h>
23 24
24void s3c_i2c0_cfg_gpio(struct platform_device *dev) 25void s3c_i2c0_cfg_gpio(struct platform_device *dev)
25{ 26{
diff --git a/arch/arm/mach-s3c64xx/setup-i2c1.c b/arch/arm/mach-s3c64xx/setup-i2c1.c
index 3fdb24c4e62a..cd1df71ee13b 100644
--- a/arch/arm/mach-s3c64xx/setup-i2c1.c
+++ b/arch/arm/mach-s3c64xx/setup-i2c1.c
@@ -20,6 +20,7 @@ struct platform_device; /* don't need the contents */
20 20
21#include <linux/platform_data/i2c-s3c2410.h> 21#include <linux/platform_data/i2c-s3c2410.h>
22#include <plat/gpio-cfg.h> 22#include <plat/gpio-cfg.h>
23#include <mach/gpio-samsung.h>
23 24
24void s3c_i2c1_cfg_gpio(struct platform_device *dev) 25void s3c_i2c1_cfg_gpio(struct platform_device *dev)
25{ 26{
diff --git a/arch/arm/mach-s3c64xx/setup-ide.c b/arch/arm/mach-s3c64xx/setup-ide.c
index 648d8b85bf6b..689fb72e715c 100644
--- a/arch/arm/mach-s3c64xx/setup-ide.c
+++ b/arch/arm/mach-s3c64xx/setup-ide.c
@@ -17,6 +17,7 @@
17#include <mach/map.h> 17#include <mach/map.h>
18#include <mach/regs-clock.h> 18#include <mach/regs-clock.h>
19#include <plat/gpio-cfg.h> 19#include <plat/gpio-cfg.h>
20#include <mach/gpio-samsung.h>
20#include <linux/platform_data/ata-samsung_cf.h> 21#include <linux/platform_data/ata-samsung_cf.h>
21 22
22void s3c64xx_ide_setup_gpio(void) 23void s3c64xx_ide_setup_gpio(void)
diff --git a/arch/arm/mach-s3c64xx/setup-keypad.c b/arch/arm/mach-s3c64xx/setup-keypad.c
index 1d4d0ee9e870..6ad9a89dfddf 100644
--- a/arch/arm/mach-s3c64xx/setup-keypad.c
+++ b/arch/arm/mach-s3c64xx/setup-keypad.c
@@ -13,6 +13,7 @@
13#include <linux/gpio.h> 13#include <linux/gpio.h>
14#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
15#include <plat/keypad.h> 15#include <plat/keypad.h>
16#include <mach/gpio-samsung.h>
16 17
17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) 18void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
18{ 19{
diff --git a/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c b/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
index 6eac071afae2..f426b7a16c16 100644
--- a/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
@@ -20,6 +20,7 @@
20 20
21#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <plat/sdhci.h> 22#include <plat/sdhci.h>
23#include <mach/gpio-samsung.h>
23 24
24void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 25void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
25{ 26{
diff --git a/arch/arm/mach-s3c64xx/setup-spi.c b/arch/arm/mach-s3c64xx/setup-spi.c
index 4dc53450d715..5fd1a315c901 100644
--- a/arch/arm/mach-s3c64xx/setup-spi.c
+++ b/arch/arm/mach-s3c64xx/setup-spi.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h> 12#include <plat/gpio-cfg.h>
13#include <mach/gpio-samsung.h>
13 14
14#ifdef CONFIG_S3C64XX_DEV_SPI0 15#ifdef CONFIG_S3C64XX_DEV_SPI0
15int s3c64xx_spi0_cfg_gpio(void) 16int s3c64xx_spi0_cfg_gpio(void)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index c9808c684152..8443a27bca2f 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -75,12 +75,143 @@ void ASSABET_BCR_frob(unsigned int mask, unsigned int val)
75 75
76EXPORT_SYMBOL(ASSABET_BCR_frob); 76EXPORT_SYMBOL(ASSABET_BCR_frob);
77 77
78/*
79 * The codec reset goes to three devices, so we need to release
80 * the rest when any one of these requests it. However, that
81 * causes the ADV7171 to consume around 100mA - more than half
82 * the LCD-blanked power.
83 *
84 * With the ADV7171, LCD and backlight enabled, we go over
85 * budget on the MAX846 Li-Ion charger, and if no Li-Ion battery
86 * is connected, the Assabet crashes.
87 */
88#define RST_UCB1X00 (1 << 0)
89#define RST_UDA1341 (1 << 1)
90#define RST_ADV7171 (1 << 2)
91
92#define SDA GPIO_GPIO(15)
93#define SCK GPIO_GPIO(18)
94#define MOD GPIO_GPIO(17)
95
96static void adv7171_start(void)
97{
98 GPSR = SCK;
99 udelay(1);
100 GPSR = SDA;
101 udelay(2);
102 GPCR = SDA;
103}
104
105static void adv7171_stop(void)
106{
107 GPSR = SCK;
108 udelay(2);
109 GPSR = SDA;
110 udelay(1);
111}
112
113static void adv7171_send(unsigned byte)
114{
115 unsigned i;
116
117 for (i = 0; i < 8; i++, byte <<= 1) {
118 GPCR = SCK;
119 udelay(1);
120 if (byte & 0x80)
121 GPSR = SDA;
122 else
123 GPCR = SDA;
124 udelay(1);
125 GPSR = SCK;
126 udelay(1);
127 }
128 GPCR = SCK;
129 udelay(1);
130 GPSR = SDA;
131 udelay(1);
132 GPDR &= ~SDA;
133 GPSR = SCK;
134 udelay(1);
135 if (GPLR & SDA)
136 printk(KERN_WARNING "No ACK from ADV7171\n");
137 udelay(1);
138 GPCR = SCK | SDA;
139 udelay(1);
140 GPDR |= SDA;
141 udelay(1);
142}
143
144static void adv7171_write(unsigned reg, unsigned val)
145{
146 unsigned gpdr = GPDR;
147 unsigned gplr = GPLR;
148
149 ASSABET_BCR = BCR_value | ASSABET_BCR_AUDIO_ON;
150 udelay(100);
151
152 GPCR = SDA | SCK | MOD; /* clear L3 mode to ensure UDA1341 doesn't respond */
153 GPDR = (GPDR | SCK | MOD) & ~SDA;
154 udelay(10);
155 if (!(GPLR & SDA))
156 printk(KERN_WARNING "Something dragging SDA down?\n");
157 GPDR |= SDA;
158
159 adv7171_start();
160 adv7171_send(0x54);
161 adv7171_send(reg);
162 adv7171_send(val);
163 adv7171_stop();
164
165 /* Restore GPIO state for L3 bus */
166 GPSR = gplr & (SDA | SCK | MOD);
167 GPCR = (~gplr) & (SDA | SCK | MOD);
168 GPDR = gpdr;
169}
170
171static void adv7171_sleep(void)
172{
173 /* Put the ADV7171 into sleep mode */
174 adv7171_write(0x04, 0x40);
175}
176
177static unsigned codec_nreset;
178
179static void assabet_codec_reset(unsigned mask, int set)
180{
181 unsigned long flags;
182 bool old;
183
184 local_irq_save(flags);
185 old = !codec_nreset;
186 if (set)
187 codec_nreset &= ~mask;
188 else
189 codec_nreset |= mask;
190
191 if (old != !codec_nreset) {
192 if (codec_nreset) {
193 ASSABET_BCR_set(ASSABET_BCR_NCODEC_RST);
194 adv7171_sleep();
195 } else {
196 ASSABET_BCR_clear(ASSABET_BCR_NCODEC_RST);
197 }
198 }
199 local_irq_restore(flags);
200}
201
78static void assabet_ucb1x00_reset(enum ucb1x00_reset state) 202static void assabet_ucb1x00_reset(enum ucb1x00_reset state)
79{ 203{
80 if (state == UCB_RST_PROBE) 204 int set = state == UCB_RST_REMOVE || state == UCB_RST_SUSPEND ||
81 ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); 205 state == UCB_RST_PROBE_FAIL;
206 assabet_codec_reset(RST_UCB1X00, set);
82} 207}
83 208
209void assabet_uda1341_reset(int set)
210{
211 assabet_codec_reset(RST_UDA1341, set);
212}
213EXPORT_SYMBOL(assabet_uda1341_reset);
214
84 215
85/* 216/*
86 * Assabet flash support code. 217 * Assabet flash support code.
@@ -155,12 +286,9 @@ static int assabet_irda_set_power(struct device *dev, unsigned int state)
155 0 286 0
156 }; 287 };
157 288
158 if (state < 4) { 289 if (state < 4)
159 state = bcr_state[state]; 290 ASSABET_BCR_frob(ASSABET_BCR_IRDA_MD1 | ASSABET_BCR_IRDA_MD0,
160 ASSABET_BCR_clear(state ^ (ASSABET_BCR_IRDA_MD1| 291 bcr_state[state]);
161 ASSABET_BCR_IRDA_MD0));
162 ASSABET_BCR_set(state);
163 }
164 return 0; 292 return 0;
165} 293}
166 294
@@ -180,6 +308,7 @@ static struct irda_platform_data assabet_irda_data = {
180static struct ucb1x00_plat_data assabet_ucb1x00_data = { 308static struct ucb1x00_plat_data assabet_ucb1x00_data = {
181 .reset = assabet_ucb1x00_reset, 309 .reset = assabet_ucb1x00_reset,
182 .gpio_base = -1, 310 .gpio_base = -1,
311 .can_wakeup = 1,
183}; 312};
184 313
185static struct mcp_plat_data assabet_mcp_data = { 314static struct mcp_plat_data assabet_mcp_data = {
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index 172ebd0ee0a2..9fa6a990cf03 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -33,6 +33,13 @@ struct clk clk_##_name = { \
33 33
34static DEFINE_SPINLOCK(clocks_lock); 34static DEFINE_SPINLOCK(clocks_lock);
35 35
36/* Dummy clk routine to build generic kernel parts that may be using them */
37unsigned long clk_get_rate(struct clk *clk)
38{
39 return 0;
40}
41EXPORT_SYMBOL(clk_get_rate);
42
36static void clk_gpio27_enable(struct clk *clk) 43static void clk_gpio27_enable(struct clk *clk)
37{ 44{
38 /* 45 /*
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 7fb96ebdc0fb..831a15824ec8 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -27,6 +27,8 @@
27#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/timer.h> 29#include <linux/timer.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
30#include <linux/gpio.h> 32#include <linux/gpio.h>
31#include <linux/pda_power.h> 33#include <linux/pda_power.h>
32 34
@@ -242,10 +244,43 @@ struct platform_device collie_locomo_device = {
242 .resource = locomo_resources, 244 .resource = locomo_resources,
243}; 245};
244 246
247static struct gpio_keys_button collie_gpio_keys[] = {
248 {
249 .type = EV_PWR,
250 .code = KEY_RESERVED,
251 .gpio = COLLIE_GPIO_ON_KEY,
252 .desc = "On key",
253 .wakeup = 1,
254 .active_low = 1,
255 },
256 {
257 .type = EV_PWR,
258 .code = KEY_WAKEUP,
259 .gpio = COLLIE_GPIO_WAKEUP,
260 .desc = "Sync",
261 .wakeup = 1,
262 .active_low = 1,
263 },
264};
265
266static struct gpio_keys_platform_data collie_gpio_keys_data = {
267 .buttons = collie_gpio_keys,
268 .nbuttons = ARRAY_SIZE(collie_gpio_keys),
269};
270
271static struct platform_device collie_gpio_keys_device = {
272 .name = "gpio-keys",
273 .id = -1,
274 .dev = {
275 .platform_data = &collie_gpio_keys_data,
276 },
277};
278
245static struct platform_device *devices[] __initdata = { 279static struct platform_device *devices[] __initdata = {
246 &collie_locomo_device, 280 &collie_locomo_device,
247 &colliescoop_device, 281 &colliescoop_device,
248 &collie_power_device, 282 &collie_power_device,
283 &collie_gpio_keys_device,
249}; 284};
250 285
251static struct mtd_partition collie_partitions[] = { 286static struct mtd_partition collie_partitions[] = {
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
index b8f2b151539b..daa27c474c13 100644
--- a/arch/arm/mach-sa1100/h3100.c
+++ b/arch/arm/mach-sa1100/h3100.c
@@ -28,15 +28,35 @@
28/* 28/*
29 * helper for sa1100fb 29 * helper for sa1100fb
30 */ 30 */
31static struct gpio h3100_lcd_gpio[] = {
32 { H3100_GPIO_LCD_3V_ON, GPIOF_OUT_INIT_LOW, "LCD 3V" },
33 { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD ON" },
34};
35
36static bool h3100_lcd_request(void)
37{
38 static bool h3100_lcd_ok;
39 int rc;
40
41 if (h3100_lcd_ok)
42 return true;
43
44 rc = gpio_request_array(h3100_lcd_gpio, ARRAY_SIZE(h3100_lcd_gpio));
45 if (rc)
46 pr_err("%s: can't request GPIOs\n", __func__);
47 else
48 h3100_lcd_ok = true;
49
50 return h3100_lcd_ok;
51}
52
31static void h3100_lcd_power(int enable) 53static void h3100_lcd_power(int enable)
32{ 54{
33 if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) { 55 if (!h3100_lcd_request())
34 gpio_set_value(H3100_GPIO_LCD_3V_ON, enable); 56 return;
35 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable); 57
36 gpio_free(H3XXX_EGPIO_LCD_ON); 58 gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
37 } else { 59 gpio_set_value(H3XXX_EGPIO_LCD_ON, enable);
38 pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__);
39 }
40} 60}
41 61
42static struct sa1100fb_mach_info h3100_lcd_info = { 62static struct sa1100fb_mach_info h3100_lcd_info = {
@@ -69,6 +89,11 @@ static void __init h3100_map_io(void)
69/* 89/*
70 * This turns the IRDA power on or off on the Compaq H3100 90 * This turns the IRDA power on or off on the Compaq H3100
71 */ 91 */
92static struct gpio h3100_irda_gpio[] = {
93 { H3100_GPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" },
94 { H3100_GPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" },
95};
96
72static int h3100_irda_set_power(struct device *dev, unsigned int state) 97static int h3100_irda_set_power(struct device *dev, unsigned int state)
73{ 98{
74 gpio_set_value(H3100_GPIO_IR_ON, state); 99 gpio_set_value(H3100_GPIO_IR_ON, state);
@@ -80,18 +105,27 @@ static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
80 gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000)); 105 gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
81} 106}
82 107
108static int h3100_irda_startup(struct device *dev)
109{
110 return gpio_request_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
111}
112
113static void h3100_irda_shutdown(struct device *dev)
114{
115 return gpio_free_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
116}
117
83static struct irda_platform_data h3100_irda_data = { 118static struct irda_platform_data h3100_irda_data = {
84 .set_power = h3100_irda_set_power, 119 .set_power = h3100_irda_set_power,
85 .set_speed = h3100_irda_set_speed, 120 .set_speed = h3100_irda_set_speed,
121 .startup = h3100_irda_startup,
122 .shutdown = h3100_irda_shutdown,
86}; 123};
87 124
88static struct gpio_default_state h3100_default_gpio[] = { 125static struct gpio_default_state h3100_default_gpio[] = {
89 { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
90 { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
91 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, 126 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
92 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, 127 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
93 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, 128 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
94 { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
95}; 129};
96 130
97static void __init h3100_mach_init(void) 131static void __init h3100_mach_init(void)
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index b8dc5bd22623..a663e7230141 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -28,35 +28,39 @@
28/* 28/*
29 * helper for sa1100fb 29 * helper for sa1100fb
30 */ 30 */
31static struct gpio h3600_lcd_gpio[] = {
32 { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD power" },
33 { H3600_EGPIO_LCD_PCI, GPIOF_OUT_INIT_LOW, "LCD control" },
34 { H3600_EGPIO_LCD_5V_ON, GPIOF_OUT_INIT_LOW, "LCD 5v" },
35 { H3600_EGPIO_LVDD_ON, GPIOF_OUT_INIT_LOW, "LCD 9v/-6.5v" },
36};
37
38static bool h3600_lcd_request(void)
39{
40 static bool h3600_lcd_ok;
41 int rc;
42
43 if (h3600_lcd_ok)
44 return true;
45
46 rc = gpio_request_array(h3600_lcd_gpio, ARRAY_SIZE(h3600_lcd_gpio));
47 if (rc)
48 pr_err("%s: can't request GPIOs\n", __func__);
49 else
50 h3600_lcd_ok = true;
51
52 return h3600_lcd_ok;
53}
54
31static void h3600_lcd_power(int enable) 55static void h3600_lcd_power(int enable)
32{ 56{
33 if (gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power")) { 57 if (!h3600_lcd_request())
34 pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__); 58 return;
35 goto err1;
36 }
37 if (gpio_request(H3600_EGPIO_LCD_PCI, "LCD control")) {
38 pr_err("%s: can't request H3XXX_EGPIO_LCD_PCI\n", __func__);
39 goto err2;
40 }
41 if (gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v")) {
42 pr_err("%s: can't request H3XXX_EGPIO_LCD_5V_ON\n", __func__);
43 goto err3;
44 }
45 if (gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v")) {
46 pr_err("%s: can't request H3600_EGPIO_LVDD_ON\n", __func__);
47 goto err4;
48 }
49 59
50 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable); 60 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
51 gpio_direction_output(H3600_EGPIO_LCD_PCI, enable); 61 gpio_direction_output(H3600_EGPIO_LCD_PCI, enable);
52 gpio_direction_output(H3600_EGPIO_LCD_5V_ON, enable); 62 gpio_direction_output(H3600_EGPIO_LCD_5V_ON, enable);
53 gpio_direction_output(H3600_EGPIO_LVDD_ON, enable); 63 gpio_direction_output(H3600_EGPIO_LVDD_ON, enable);
54
55 gpio_free(H3600_EGPIO_LVDD_ON);
56err4: gpio_free(H3600_EGPIO_LCD_5V_ON);
57err3: gpio_free(H3600_EGPIO_LCD_PCI);
58err2: gpio_free(H3XXX_EGPIO_LCD_ON);
59err1: return;
60} 64}
61 65
62static const struct sa1100fb_rgb h3600_rgb_16 = { 66static const struct sa1100fb_rgb h3600_rgb_16 = {
@@ -93,6 +97,11 @@ static void __init h3600_map_io(void)
93/* 97/*
94 * This turns the IRDA power on or off on the Compaq H3600 98 * This turns the IRDA power on or off on the Compaq H3600
95 */ 99 */
100static struct gpio h3600_irda_gpio[] = {
101 { H3600_EGPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" },
102 { H3600_EGPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" },
103};
104
96static int h3600_irda_set_power(struct device *dev, unsigned int state) 105static int h3600_irda_set_power(struct device *dev, unsigned int state)
97{ 106{
98 gpio_set_value(H3600_EGPIO_IR_ON, state); 107 gpio_set_value(H3600_EGPIO_IR_ON, state);
@@ -106,29 +115,12 @@ static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
106 115
107static int h3600_irda_startup(struct device *dev) 116static int h3600_irda_startup(struct device *dev)
108{ 117{
109 int err = gpio_request(H3600_EGPIO_IR_ON, "IrDA power"); 118 return gpio_request_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
110 if (err)
111 goto err1;
112 err = gpio_direction_output(H3600_EGPIO_IR_ON, 0);
113 if (err)
114 goto err2;
115 err = gpio_request(H3600_EGPIO_IR_FSEL, "IrDA fsel");
116 if (err)
117 goto err2;
118 err = gpio_direction_output(H3600_EGPIO_IR_FSEL, 0);
119 if (err)
120 goto err3;
121 return 0;
122
123err3: gpio_free(H3600_EGPIO_IR_FSEL);
124err2: gpio_free(H3600_EGPIO_IR_ON);
125err1: return err;
126} 119}
127 120
128static void h3600_irda_shutdown(struct device *dev) 121static void h3600_irda_shutdown(struct device *dev)
129{ 122{
130 gpio_free(H3600_EGPIO_IR_ON); 123 return gpio_free_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
131 gpio_free(H3600_EGPIO_IR_FSEL);
132} 124}
133 125
134static struct irda_platform_data h3600_irda_data = { 126static struct irda_platform_data h3600_irda_data = {
diff --git a/arch/arm/mach-sa1100/include/mach/assabet.h b/arch/arm/mach-sa1100/include/mach/assabet.h
index 307391488c22..c23fcdb047a5 100644
--- a/arch/arm/mach-sa1100/include/mach/assabet.h
+++ b/arch/arm/mach-sa1100/include/mach/assabet.h
@@ -39,8 +39,8 @@ extern unsigned long SCR_value;
39 39
40#define ASSABET_BCR_CF_PWR (1<<0) /* Compact Flash Power (1 = 3.3v, 0 = off) */ 40#define ASSABET_BCR_CF_PWR (1<<0) /* Compact Flash Power (1 = 3.3v, 0 = off) */
41#define ASSABET_BCR_CF_RST (1<<1) /* Compact Flash Reset (1 = power up reset) */ 41#define ASSABET_BCR_CF_RST (1<<1) /* Compact Flash Reset (1 = power up reset) */
42#define ASSABET_BCR_GFX_RST (1<<1) /* Graphics Accelerator Reset (0 = hold reset) */ 42#define ASSABET_BCR_NGFX_RST (1<<1) /* Graphics Accelerator Reset (0 = hold reset) */
43#define ASSABET_BCR_CODEC_RST (1<<2) /* 0 = Holds UCB1300, ADI7171, and UDA1341 in reset */ 43#define ASSABET_BCR_NCODEC_RST (1<<2) /* 0 = Holds UCB1300, ADI7171, and UDA1341 in reset */
44#define ASSABET_BCR_IRDA_FSEL (1<<3) /* IRDA Frequency select (0 = SIR, 1 = MIR/ FIR) */ 44#define ASSABET_BCR_IRDA_FSEL (1<<3) /* IRDA Frequency select (0 = SIR, 1 = MIR/ FIR) */
45#define ASSABET_BCR_IRDA_MD0 (1<<4) /* Range/Power select */ 45#define ASSABET_BCR_IRDA_MD0 (1<<4) /* Range/Power select */
46#define ASSABET_BCR_IRDA_MD1 (1<<5) /* Range/Power select */ 46#define ASSABET_BCR_IRDA_MD1 (1<<5) /* Range/Power select */
@@ -69,6 +69,8 @@ extern void ASSABET_BCR_frob(unsigned int mask, unsigned int set);
69#define ASSABET_BCR_frob(x,y) do { } while (0) 69#define ASSABET_BCR_frob(x,y) do { } while (0)
70#endif 70#endif
71 71
72extern void assabet_uda1341_reset(int set);
73
72#define ASSABET_BCR_set(x) ASSABET_BCR_frob((x), (x)) 74#define ASSABET_BCR_set(x) ASSABET_BCR_frob((x), (x))
73#define ASSABET_BCR_clear(x) ASSABET_BCR_frob((x), 0) 75#define ASSABET_BCR_clear(x) ASSABET_BCR_frob((x), 0)
74 76
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 713c86cd3d64..6fd4acb8f187 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -20,7 +20,7 @@
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <mach/irqs.h> 21#include <mach/irqs.h>
22 22
23static u32 notrace sa1100_read_sched_clock(void) 23static u64 notrace sa1100_read_sched_clock(void)
24{ 24{
25 return readl_relaxed(OSCR); 25 return readl_relaxed(OSCR);
26} 26}
@@ -122,7 +122,7 @@ void __init sa1100_timer_init(void)
122 writel_relaxed(0, OIER); 122 writel_relaxed(0, OIER);
123 writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); 123 writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR);
124 124
125 setup_sched_clock(sa1100_read_sched_clock, 32, 3686400); 125 sched_clock_register(sa1100_read_sched_clock, 32, 3686400);
126 126
127 ckevt_sa1100_osmr0.cpumask = cpumask_of(0); 127 ckevt_sa1100_osmr0.cpumask = cpumask_of(0);
128 128
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index a4a4b75109b2..338640631e08 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -1,6 +1,10 @@
1config ARCH_SHMOBILE
2 bool
3
1config ARCH_SHMOBILE_MULTI 4config ARCH_SHMOBILE_MULTI
2 bool "SH-Mobile Series" if ARCH_MULTI_V7 5 bool "Renesas ARM SoCs" if ARCH_MULTI_V7
3 depends on MMU 6 depends on MMU
7 select ARCH_SHMOBILE
4 select CPU_V7 8 select CPU_V7
5 select GENERIC_CLOCKEVENTS 9 select GENERIC_CLOCKEVENTS
6 select HAVE_ARM_SCU if SMP 10 select HAVE_ARM_SCU if SMP
@@ -8,6 +12,7 @@ config ARCH_SHMOBILE_MULTI
8 select HAVE_SMP 12 select HAVE_SMP
9 select ARM_GIC 13 select ARM_GIC
10 select MIGHT_HAVE_CACHE_L2X0 14 select MIGHT_HAVE_CACHE_L2X0
15 select MIGHT_HAVE_PCI
11 select NO_IOPORT 16 select NO_IOPORT
12 select PINCTRL 17 select PINCTRL
13 select ARCH_REQUIRE_GPIOLIB 18 select ARCH_REQUIRE_GPIOLIB
@@ -15,24 +20,47 @@ config ARCH_SHMOBILE_MULTI
15 20
16if ARCH_SHMOBILE_MULTI 21if ARCH_SHMOBILE_MULTI
17 22
18comment "SH-Mobile System Type" 23comment "Renesas ARM SoCs System Type"
19 24
20config ARCH_EMEV2 25config ARCH_EMEV2
21 bool "Emma Mobile EV2" 26 bool "Emma Mobile EV2"
22 27
23comment "SH-Mobile Board Type" 28config ARCH_R7S72100
29 bool "RZ/A1H (R7S72100)"
30
31config ARCH_R8A7790
32 bool "R-Car H2 (R8A77900)"
33 select RENESAS_IRQC
34
35config ARCH_R8A7791
36 bool "R-Car M2 (R8A77910)"
37 select RENESAS_IRQC
38
39comment "Renesas ARM SoCs Board Type"
40
41config MACH_GENMAI
42 bool "Genmai board"
43 depends on ARCH_R7S72100
44
45config MACH_KOELSCH
46 bool "Koelsch board"
47 depends on ARCH_R8A7791
24 48
25config MACH_KZM9D 49config MACH_KZM9D
26 bool "KZM9D board" 50 bool "KZM9D board"
27 depends on ARCH_EMEV2 51 depends on ARCH_EMEV2
28 select REGULATOR_FIXED_VOLTAGE if REGULATOR 52 select REGULATOR_FIXED_VOLTAGE if REGULATOR
29 53
30comment "SH-Mobile System Configuration" 54config MACH_LAGER
55 bool "Lager board"
56 depends on ARCH_R8A7790
57
58comment "Renesas ARM SoCs System Configuration"
31endif 59endif
32 60
33if ARCH_SHMOBILE 61if ARCH_SHMOBILE_LEGACY
34 62
35comment "SH-Mobile System Type" 63comment "Renesas ARM SoCs System Type"
36 64
37config ARCH_SH7372 65config ARCH_SH7372
38 bool "SH-Mobile AP4 (SH7372)" 66 bool "SH-Mobile AP4 (SH7372)"
@@ -92,28 +120,36 @@ config ARCH_R8A7790
92 select ARCH_WANT_OPTIONAL_GPIOLIB 120 select ARCH_WANT_OPTIONAL_GPIOLIB
93 select ARM_GIC 121 select ARM_GIC
94 select CPU_V7 122 select CPU_V7
123 select MIGHT_HAVE_PCI
95 select SH_CLK_CPG 124 select SH_CLK_CPG
96 select RENESAS_IRQC 125 select RENESAS_IRQC
97 126
98config ARCH_R8A7791 127config ARCH_R8A7791
99 bool "R-Car M2 (R8A77910)" 128 bool "R-Car M2 (R8A77910)"
129 select ARCH_WANT_OPTIONAL_GPIOLIB
100 select ARM_GIC 130 select ARM_GIC
101 select CPU_V7 131 select CPU_V7
132 select MIGHT_HAVE_PCI
102 select SH_CLK_CPG 133 select SH_CLK_CPG
134 select RENESAS_IRQC
103 135
104config ARCH_EMEV2 136config ARCH_EMEV2
105 bool "Emma Mobile EV2" 137 bool "Emma Mobile EV2"
106 select ARCH_WANT_OPTIONAL_GPIOLIB 138 select ARCH_WANT_OPTIONAL_GPIOLIB
107 select ARM_GIC 139 select ARM_GIC
108 select CPU_V7 140 select CPU_V7
141 select MIGHT_HAVE_PCI
142 select USE_OF
143 select AUTO_ZRELADDR
109 144
110config ARCH_R7S72100 145config ARCH_R7S72100
111 bool "RZ/A1H (R7S72100)" 146 bool "RZ/A1H (R7S72100)"
147 select ARCH_WANT_OPTIONAL_GPIOLIB
112 select ARM_GIC 148 select ARM_GIC
113 select CPU_V7 149 select CPU_V7
114 select SH_CLK_CPG 150 select SH_CLK_CPG
115 151
116comment "SH-Mobile Board Type" 152comment "Renesas ARM SoCs Board Type"
117 153
118config MACH_APE6EVM 154config MACH_APE6EVM
119 bool "APE6EVM board" 155 bool "APE6EVM board"
@@ -190,6 +226,17 @@ config MACH_GENMAI
190 depends on ARCH_R7S72100 226 depends on ARCH_R7S72100
191 select USE_OF 227 select USE_OF
192 228
229config MACH_GENMAI_REFERENCE
230 bool "Genmai board - Reference Device Tree Implementation"
231 depends on ARCH_R7S72100
232 select USE_OF
233 ---help---
234 Use reference implementation of Genmai board support
235 which makes use of device tree at the expense
236 of not supporting a number of devices.
237
238 This is intended to aid developers
239
193config MACH_MARZEN 240config MACH_MARZEN
194 bool "MARZEN board" 241 bool "MARZEN board"
195 depends on ARCH_R8A7779 242 depends on ARCH_R8A7779
@@ -215,27 +262,11 @@ config MACH_LAGER
215 depends on ARCH_R8A7790 262 depends on ARCH_R8A7790
216 select USE_OF 263 select USE_OF
217 264
218config MACH_LAGER_REFERENCE
219 bool "Lager board - Reference Device Tree Implementation"
220 depends on ARCH_R8A7790
221 select USE_OF
222 ---help---
223 Use reference implementation of Lager board support
224 which makes use of device tree at the expense
225 of not supporting a number of devices.
226
227 This is intended to aid developers
228
229config MACH_KOELSCH 265config MACH_KOELSCH
230 bool "Koelsch board" 266 bool "Koelsch board"
231 depends on ARCH_R8A7791 267 depends on ARCH_R8A7791
232 select USE_OF 268 select USE_OF
233 269 select MICREL_PHY if SH_ETH
234config MACH_KZM9D
235 bool "KZM9D board"
236 depends on ARCH_EMEV2
237 select REGULATOR_FIXED_VOLTAGE if REGULATOR
238 select USE_OF
239 270
240config MACH_KZM9G 271config MACH_KZM9G
241 bool "KZM-A9-GT board" 272 bool "KZM-A9-GT board"
@@ -261,7 +292,7 @@ config MACH_KZM9G_REFERENCE
261 292
262 This is intended to aid developers 293 This is intended to aid developers
263 294
264comment "SH-Mobile System Configuration" 295comment "Renesas ARM SoCs System Configuration"
265 296
266config CPU_HAS_INTEVT 297config CPU_HAS_INTEVT
267 bool 298 bool
@@ -274,7 +305,7 @@ source "drivers/sh/Kconfig"
274 305
275endif 306endif
276 307
277if ARCH_SHMOBILE || ARCH_SHMOBILE_MULTI 308if ARCH_SHMOBILE
278 309
279menu "Timer and clock configuration" 310menu "Timer and clock configuration"
280 311
@@ -286,8 +317,8 @@ config SHMOBILE_TIMER_HZ
286 Allows the configuration of the timer frequency. It is customary 317 Allows the configuration of the timer frequency. It is customary
287 to have the timer interrupt run at 1000 Hz or 100 Hz, but in the 318 to have the timer interrupt run at 1000 Hz or 100 Hz, but in the
288 case of low timer frequencies other values may be more suitable. 319 case of low timer frequencies other values may be more suitable.
289 SH-Mobile systems using a 32768 Hz RCLK for clock events may want 320 Renesas ARM SoC systems using a 32768 Hz RCLK for clock events may
290 to select a HZ value such as 128 that can evenly divide RCLK. 321 want to select a HZ value such as 128 that can evenly divide RCLK.
291 A HZ value that does not divide evenly may cause timer drift. 322 A HZ value that does not divide evenly may cause timer drift.
292 323
293config SH_TIMER_CMT 324config SH_TIMER_CMT
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 51db2bcafabf..fe7d4ff706e4 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -56,7 +56,10 @@ obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o
56 56
57# Board objects 57# Board objects
58ifdef CONFIG_ARCH_SHMOBILE_MULTI 58ifdef CONFIG_ARCH_SHMOBILE_MULTI
59obj-$(CONFIG_MACH_GENMAI) += board-genmai-reference.o
60obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o
59obj-$(CONFIG_MACH_KZM9D) += board-kzm9d-reference.o 61obj-$(CONFIG_MACH_KZM9D) += board-kzm9d-reference.o
62obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o
60else 63else
61obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o 64obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o
62obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o 65obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o
@@ -64,14 +67,13 @@ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
64obj-$(CONFIG_MACH_BOCKW) += board-bockw.o 67obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
65obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o 68obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
66obj-$(CONFIG_MACH_GENMAI) += board-genmai.o 69obj-$(CONFIG_MACH_GENMAI) += board-genmai.o
70obj-$(CONFIG_MACH_GENMAI_REFERENCE) += board-genmai-reference.o
67obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 71obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
68obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o 72obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
69obj-$(CONFIG_MACH_LAGER) += board-lager.o 73obj-$(CONFIG_MACH_LAGER) += board-lager.o
70obj-$(CONFIG_MACH_LAGER_REFERENCE) += board-lager-reference.o
71obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 74obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
72obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o 75obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
73obj-$(CONFIG_MACH_KOELSCH) += board-koelsch.o 76obj-$(CONFIG_MACH_KOELSCH) += board-koelsch.o
74obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
75obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 77obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
76obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o 78obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
77endif 79endif
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 391d72a5536c..99455ecafa05 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -6,13 +6,12 @@ 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 9loadaddr-$(CONFIG_MACH_GENMAI) += 0x08008000
10loadaddr-$(CONFIG_MACH_GENMAI_REFERENCE) += 0x08008000
10loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000 11loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000
11loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
12loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000 12loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
13loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000 13loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
14loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000 14loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
15loadaddr-$(CONFIG_MACH_LAGER_REFERENCE) += 0x40008000
16loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000 15loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
17loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000 16loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
18loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000 17loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index 0fa068e30a30..fe071a9130b7 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -168,7 +168,7 @@ static const struct sh_mmcif_plat_data mmcif0_pdata __initconst = {
168}; 168};
169 169
170static const struct resource mmcif0_resources[] __initconst = { 170static const struct resource mmcif0_resources[] __initconst = {
171 DEFINE_RES_MEM_NAMED(0xee200000, 0x100, "MMCIF0"), 171 DEFINE_RES_MEM(0xee200000, 0x100),
172 DEFINE_RES_IRQ(gic_spi(169)), 172 DEFINE_RES_IRQ(gic_spi(169)),
173}; 173};
174 174
@@ -179,7 +179,7 @@ static const struct sh_mobile_sdhi_info sdhi0_pdata __initconst = {
179}; 179};
180 180
181static const struct resource sdhi0_resources[] __initconst = { 181static const struct resource sdhi0_resources[] __initconst = {
182 DEFINE_RES_MEM_NAMED(0xee100000, 0x100, "SDHI0"), 182 DEFINE_RES_MEM(0xee100000, 0x100),
183 DEFINE_RES_IRQ(gic_spi(165)), 183 DEFINE_RES_IRQ(gic_spi(165)),
184}; 184};
185 185
@@ -191,7 +191,7 @@ static const struct sh_mobile_sdhi_info sdhi1_pdata __initconst = {
191}; 191};
192 192
193static const struct resource sdhi1_resources[] __initconst = { 193static const struct resource sdhi1_resources[] __initconst = {
194 DEFINE_RES_MEM_NAMED(0xee120000, 0x100, "SDHI1"), 194 DEFINE_RES_MEM(0xee120000, 0x100),
195 DEFINE_RES_IRQ(gic_spi(166)), 195 DEFINE_RES_IRQ(gic_spi(166)),
196}; 196};
197 197
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 8ea87bd45c33..93533e2710a8 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -423,7 +423,7 @@ static struct platform_pwm_backlight_data pwm_backlight_data = {
423 .max_brightness = 255, 423 .max_brightness = 255,
424 .dft_brightness = 255, 424 .dft_brightness = 255,
425 .pwm_period_ns = 33333, /* 30kHz */ 425 .pwm_period_ns = 33333, /* 30kHz */
426 .enable_gpio = -1, 426 .enable_gpio = 61,
427}; 427};
428 428
429static struct platform_device pwm_backlight_device = { 429static struct platform_device pwm_backlight_device = {
@@ -963,7 +963,7 @@ static struct resource fsi_resources[] = {
963 [0] = { 963 [0] = {
964 .name = "FSI", 964 .name = "FSI",
965 .start = 0xfe1f0000, 965 .start = 0xfe1f0000,
966 .end = 0xfe1f8400 - 1, 966 .end = 0xfe1f0400 - 1,
967 .flags = IORESOURCE_MEM, 967 .flags = IORESOURCE_MEM,
968 }, 968 },
969 [1] = { 969 [1] = {
@@ -1210,9 +1210,6 @@ static void __init eva_init(void)
1210 r8a7740_pinmux_init(); 1210 r8a7740_pinmux_init();
1211 r8a7740_meram_workaround(); 1211 r8a7740_meram_workaround();
1212 1212
1213 /* LCDC0 */
1214 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1215
1216 /* GETHER */ 1213 /* GETHER */
1217 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ 1214 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
1218 1215
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index ae88fdad4b3a..027373f8de82 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -19,7 +19,6 @@
19 */ 19 */
20 20
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/pinctrl/machine.h>
23#include <mach/common.h> 22#include <mach/common.h>
24#include <mach/r8a7778.h> 23#include <mach/r8a7778.h>
25#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
@@ -28,27 +27,19 @@
28 * see board-bock.c for checking detail of dip-switch 27 * see board-bock.c for checking detail of dip-switch
29 */ 28 */
30 29
31static const struct pinctrl_map bockw_pinctrl_map[] = {
32 /* SCIF0 */
33 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
34 "scif0_data_a", "scif0"),
35 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
36 "scif0_ctrl", "scif0"),
37};
38
39#define FPGA 0x18200000 30#define FPGA 0x18200000
40#define IRQ0MR 0x30 31#define IRQ0MR 0x30
41#define COMCTLR 0x101c 32#define COMCTLR 0x101c
33
34#define PFC 0xfffc0000
35#define PUPR4 0x110
42static void __init bockw_init(void) 36static void __init bockw_init(void)
43{ 37{
44 static void __iomem *fpga; 38 void __iomem *fpga;
39 void __iomem *pfc;
45 40
46 r8a7778_clock_init(); 41 r8a7778_clock_init();
47 r8a7778_init_irq_extpin_dt(1); 42 r8a7778_init_irq_extpin_dt(1);
48
49 pinctrl_register_mappings(bockw_pinctrl_map,
50 ARRAY_SIZE(bockw_pinctrl_map));
51 r8a7778_pinmux_init();
52 r8a7778_add_dt_devices(); 43 r8a7778_add_dt_devices();
53 44
54 fpga = ioremap_nocache(FPGA, SZ_1M); 45 fpga = ioremap_nocache(FPGA, SZ_1M);
@@ -63,6 +54,19 @@ static void __init bockw_init(void)
63 u16 val = ioread16(fpga + IRQ0MR); 54 u16 val = ioread16(fpga + IRQ0MR);
64 val &= ~(1 << 4); /* enable SMSC911x */ 55 val &= ~(1 << 4); /* enable SMSC911x */
65 iowrite16(val, fpga + IRQ0MR); 56 iowrite16(val, fpga + IRQ0MR);
57
58 iounmap(fpga);
59 }
60
61 pfc = ioremap_nocache(PFC, 0x200);
62 if (pfc) {
63 /*
64 * FIXME
65 *
66 * SDHI CD/WP pin needs pull-up
67 */
68 iowrite32(ioread32(pfc + PUPR4) | (3 << 26), pfc + PUPR4);
69 iounmap(pfc);
66 } 70 }
67 71
68 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 72 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 3c4995aebd22..c475220545f2 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -25,6 +25,7 @@
25#include <linux/mmc/sh_mmcif.h> 25#include <linux/mmc/sh_mmcif.h>
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/pinctrl/machine.h> 27#include <linux/pinctrl/machine.h>
28#include <linux/platform_data/camera-rcar.h>
28#include <linux/platform_data/usb-rcar-phy.h> 29#include <linux/platform_data/usb-rcar-phy.h>
29#include <linux/platform_device.h> 30#include <linux/platform_device.h>
30#include <linux/regulator/fixed.h> 31#include <linux/regulator/fixed.h>
@@ -116,6 +117,11 @@ static struct regulator_consumer_supply dummy_supplies[] = {
116 REGULATOR_SUPPLY("vdd33a", "smsc911x"), 117 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
117}; 118};
118 119
120static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
121 REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
122 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
123};
124
119static struct smsc911x_platform_config smsc911x_data __initdata = { 125static struct smsc911x_platform_config smsc911x_data __initdata = {
120 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 126 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
121 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, 127 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
@@ -271,7 +277,6 @@ static struct resource mmc_resources[] __initdata = {
271 277
272static struct sh_mmcif_plat_data sh_mmcif_plat __initdata = { 278static struct sh_mmcif_plat_data sh_mmcif_plat __initdata = {
273 .sup_pclk = 0, 279 .sup_pclk = 0,
274 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
275 .caps = MMC_CAP_4_BIT_DATA | 280 .caps = MMC_CAP_4_BIT_DATA |
276 MMC_CAP_8_BIT_DATA | 281 MMC_CAP_8_BIT_DATA |
277 MMC_CAP_NEEDS_POLL, 282 MMC_CAP_NEEDS_POLL,
@@ -328,11 +333,11 @@ static struct rsnd_ssi_platform_info rsnd_ssi[] = {
328 RSND_SSI_UNUSED, /* SSI 1 */ 333 RSND_SSI_UNUSED, /* SSI 1 */
329 RSND_SSI_UNUSED, /* SSI 2 */ 334 RSND_SSI_UNUSED, /* SSI 2 */
330 RSND_SSI_SET(1, 0, gic_iid(0x85), RSND_SSI_PLAY), 335 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), 336 RSND_SSI_SET(2, 0, gic_iid(0x85), RSND_SSI_CLK_PIN_SHARE),
332 RSND_SSI_SET(0, 0, gic_iid(0x86), RSND_SSI_PLAY), 337 RSND_SSI_SET(0, 0, gic_iid(0x86), RSND_SSI_PLAY),
333 RSND_SSI_SET(0, 0, gic_iid(0x86), 0), 338 RSND_SSI_SET(0, 0, gic_iid(0x86), 0),
334 RSND_SSI_SET(3, 0, gic_iid(0x86), RSND_SSI_PLAY), 339 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), 340 RSND_SSI_SET(4, 0, gic_iid(0x86), RSND_SSI_CLK_PIN_SHARE),
336}; 341};
337 342
338static struct rsnd_scu_platform_info rsnd_scu[9] = { 343static struct rsnd_scu_platform_info rsnd_scu[9] = {
@@ -614,6 +619,10 @@ static void __init bockw_init(void)
614 &usb_phy_platform_data, 619 &usb_phy_platform_data,
615 sizeof(struct rcar_phy_platform_data)); 620 sizeof(struct rcar_phy_platform_data));
616 621
622 regulator_register_fixed(0, dummy_supplies,
623 ARRAY_SIZE(dummy_supplies));
624 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
625 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
617 626
618 /* for SMSC */ 627 /* for SMSC */
619 fpga = ioremap_nocache(FPGA, SZ_1M); 628 fpga = ioremap_nocache(FPGA, SZ_1M);
@@ -629,9 +638,6 @@ static void __init bockw_init(void)
629 val &= ~(1 << 4); /* enable SMSC911x */ 638 val &= ~(1 << 4); /* enable SMSC911x */
630 iowrite16(val, fpga + IRQ0MR); 639 iowrite16(val, fpga + IRQ0MR);
631 640
632 regulator_register_fixed(0, dummy_supplies,
633 ARRAY_SIZE(dummy_supplies));
634
635 platform_device_register_resndata( 641 platform_device_register_resndata(
636 &platform_bus, "smsc911x", -1, 642 &platform_bus, "smsc911x", -1,
637 smsc911x_resources, ARRAY_SIZE(smsc911x_resources), 643 smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
new file mode 100644
index 000000000000..7630c1053e32
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-genmai-reference.c
@@ -0,0 +1,49 @@
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/clk-provider.h>
22#include <linux/kernel.h>
23#include <linux/of_platform.h>
24#include <mach/common.h>
25#include <mach/r7s72100.h>
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28
29static void __init genmai_add_standard_devices(void)
30{
31#ifdef CONFIG_COMMON_CLK
32 of_clk_init(NULL);
33#else
34 r7s72100_clock_init();
35#endif
36 r7s72100_add_dt_devices();
37 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
38}
39
40static const char * const genmai_boards_compat_dt[] __initconst = {
41 "renesas,genmai-reference",
42 NULL,
43};
44
45DT_MACHINE_START(GENMAI_DT, "genmai")
46 .init_early = r7s72100_init_early,
47 .init_machine = genmai_add_standard_devices,
48 .dt_compat = genmai_boards_compat_dt,
49MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
new file mode 100644
index 000000000000..652b59268416
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
@@ -0,0 +1,79 @@
1/*
2 * Koelsch board support - Reference DT implementation
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 * Copyright (C) 2013 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <linux/clk.h>
23#include <linux/clkdev.h>
24#include <linux/kernel.h>
25#include <linux/of_platform.h>
26#include <mach/common.h>
27#include <mach/rcar-gen2.h>
28#include <mach/r8a7791.h>
29#include <asm/mach/arch.h>
30
31static void __init koelsch_add_standard_devices(void)
32{
33#ifdef CONFIG_COMMON_CLK
34 /*
35 * This is a really crude hack to provide clkdev support to the SCIF
36 * and CMT devices until they get moved to DT.
37 */
38 static const char * const scif_names[] = {
39 "scifa0", "scifa1", "scifb0", "scifb1", "scifb2", "scifa2",
40 "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scifa3",
41 "scifa4", "scifa5",
42 };
43 struct clk *clk;
44 unsigned int i;
45
46 for (i = 0; i < ARRAY_SIZE(scif_names); ++i) {
47 clk = clk_get(NULL, scif_names[i]);
48 if (clk) {
49 clk_register_clkdev(clk, NULL, "sh-sci.%u", i);
50 clk_put(clk);
51 }
52 }
53
54 clk = clk_get(NULL, "cmt0");
55 if (clk) {
56 clk_register_clkdev(clk, NULL, "sh_cmt.0");
57 clk_put(clk);
58 }
59#else
60 r8a7791_clock_init();
61#endif
62 r8a7791_add_dt_devices();
63 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
64}
65
66static const char * const koelsch_boards_compat_dt[] __initconst = {
67 "renesas,koelsch",
68 "renesas,koelsch-reference",
69 NULL,
70};
71
72DT_MACHINE_START(KOELSCH_DT, "koelsch")
73 .smp = smp_ops(r8a7791_smp_ops),
74 .init_early = r8a7791_init_early,
75 .init_time = rcar_gen2_timer_init,
76 .init_machine = koelsch_add_standard_devices,
77 .init_late = shmobile_init_late,
78 .dt_compat = koelsch_boards_compat_dt,
79MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index ace1711a6cd8..de7cc64b1f37 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -19,18 +19,205 @@
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 21
22#include <linux/dma-mapping.h>
23#include <linux/gpio.h>
24#include <linux/gpio_keys.h>
25#include <linux/input.h>
22#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/leds.h>
28#include <linux/phy.h>
29#include <linux/pinctrl/machine.h>
30#include <linux/platform_data/gpio-rcar.h>
31#include <linux/platform_data/rcar-du.h>
23#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/sh_eth.h>
24#include <mach/common.h> 34#include <mach/common.h>
35#include <mach/irqs.h>
25#include <mach/r8a7791.h> 36#include <mach/r8a7791.h>
26#include <mach/rcar-gen2.h> 37#include <mach/rcar-gen2.h>
27#include <asm/mach-types.h> 38#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
29 40
41/* DU */
42static struct rcar_du_encoder_data koelsch_du_encoders[] = {
43 {
44 .type = RCAR_DU_ENCODER_NONE,
45 .output = RCAR_DU_OUTPUT_LVDS0,
46 .connector.lvds.panel = {
47 .width_mm = 210,
48 .height_mm = 158,
49 .mode = {
50 .clock = 65000,
51 .hdisplay = 1024,
52 .hsync_start = 1048,
53 .hsync_end = 1184,
54 .htotal = 1344,
55 .vdisplay = 768,
56 .vsync_start = 771,
57 .vsync_end = 777,
58 .vtotal = 806,
59 .flags = 0,
60 },
61 },
62 },
63};
64
65static const struct rcar_du_platform_data koelsch_du_pdata __initconst = {
66 .encoders = koelsch_du_encoders,
67 .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
68};
69
70static const struct resource du_resources[] __initconst = {
71 DEFINE_RES_MEM(0xfeb00000, 0x40000),
72 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
73 DEFINE_RES_IRQ(gic_spi(256)),
74 DEFINE_RES_IRQ(gic_spi(268)),
75};
76
77static void __init koelsch_add_du_device(void)
78{
79 struct platform_device_info info = {
80 .name = "rcar-du-r8a7791",
81 .id = -1,
82 .res = du_resources,
83 .num_res = ARRAY_SIZE(du_resources),
84 .data = &koelsch_du_pdata,
85 .size_data = sizeof(koelsch_du_pdata),
86 .dma_mask = DMA_BIT_MASK(32),
87 };
88
89 platform_device_register_full(&info);
90}
91
92/* Ether */
93static const struct sh_eth_plat_data ether_pdata __initconst = {
94 .phy = 0x1,
95 .edmac_endian = EDMAC_LITTLE_ENDIAN,
96 .phy_interface = PHY_INTERFACE_MODE_RMII,
97 .ether_link_active_low = 1,
98};
99
100static const struct resource ether_resources[] __initconst = {
101 DEFINE_RES_MEM(0xee700000, 0x400),
102 DEFINE_RES_IRQ(gic_spi(162)),
103};
104
105/* LEDS */
106static struct gpio_led koelsch_leds[] = {
107 {
108 .name = "led8",
109 .gpio = RCAR_GP_PIN(2, 21),
110 .default_state = LEDS_GPIO_DEFSTATE_ON,
111 }, {
112 .name = "led7",
113 .gpio = RCAR_GP_PIN(2, 20),
114 .default_state = LEDS_GPIO_DEFSTATE_ON,
115 }, {
116 .name = "led6",
117 .gpio = RCAR_GP_PIN(2, 19),
118 .default_state = LEDS_GPIO_DEFSTATE_ON,
119 },
120};
121
122static const struct gpio_led_platform_data koelsch_leds_pdata __initconst = {
123 .leds = koelsch_leds,
124 .num_leds = ARRAY_SIZE(koelsch_leds),
125};
126
127/* GPIO KEY */
128#define GPIO_KEY(c, g, d, ...) \
129 { .code = c, .gpio = g, .desc = d, .active_low = 1, \
130 .wakeup = 1, .debounce_interval = 20 }
131
132static struct gpio_keys_button gpio_buttons[] = {
133 GPIO_KEY(KEY_4, RCAR_GP_PIN(5, 3), "SW2-pin4"),
134 GPIO_KEY(KEY_3, RCAR_GP_PIN(5, 2), "SW2-pin3"),
135 GPIO_KEY(KEY_2, RCAR_GP_PIN(5, 1), "SW2-pin2"),
136 GPIO_KEY(KEY_1, RCAR_GP_PIN(5, 0), "SW2-pin1"),
137 GPIO_KEY(KEY_G, RCAR_GP_PIN(7, 6), "SW36"),
138 GPIO_KEY(KEY_F, RCAR_GP_PIN(7, 5), "SW35"),
139 GPIO_KEY(KEY_E, RCAR_GP_PIN(7, 4), "SW34"),
140 GPIO_KEY(KEY_D, RCAR_GP_PIN(7, 3), "SW33"),
141 GPIO_KEY(KEY_C, RCAR_GP_PIN(7, 2), "SW32"),
142 GPIO_KEY(KEY_B, RCAR_GP_PIN(7, 1), "SW31"),
143 GPIO_KEY(KEY_A, RCAR_GP_PIN(7, 0), "SW30"),
144};
145
146static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = {
147 .buttons = gpio_buttons,
148 .nbuttons = ARRAY_SIZE(gpio_buttons),
149};
150
151static const struct pinctrl_map koelsch_pinctrl_map[] = {
152 /* DU */
153 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
154 "du_rgb666", "du"),
155 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
156 "du_sync", "du"),
157 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
158 "du_clk_out_0", "du"),
159 /* Ether */
160 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
161 "eth_link", "eth"),
162 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
163 "eth_mdio", "eth"),
164 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
165 "eth_rmii", "eth"),
166 PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
167 "intc_irq0", "intc"),
168 /* SCIF0 (CN19: DEBUG SERIAL0) */
169 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7791",
170 "scif0_data_d", "scif0"),
171 /* SCIF1 (CN20: DEBUG SERIAL1) */
172 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791",
173 "scif1_data_d", "scif1"),
174};
175
30static void __init koelsch_add_standard_devices(void) 176static void __init koelsch_add_standard_devices(void)
31{ 177{
32 r8a7791_clock_init(); 178 r8a7791_clock_init();
179 pinctrl_register_mappings(koelsch_pinctrl_map,
180 ARRAY_SIZE(koelsch_pinctrl_map));
181 r8a7791_pinmux_init();
33 r8a7791_add_standard_devices(); 182 r8a7791_add_standard_devices();
183 platform_device_register_resndata(&platform_bus, "r8a7791-ether", -1,
184 ether_resources,
185 ARRAY_SIZE(ether_resources),
186 &ether_pdata, sizeof(ether_pdata));
187 platform_device_register_data(&platform_bus, "leds-gpio", -1,
188 &koelsch_leds_pdata,
189 sizeof(koelsch_leds_pdata));
190 platform_device_register_data(&platform_bus, "gpio-keys", -1,
191 &koelsch_keys_pdata,
192 sizeof(koelsch_keys_pdata));
193
194 koelsch_add_du_device();
195}
196
197/*
198 * Ether LEDs on the Koelsch board are named LINK and ACTIVE which corresponds
199 * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits
200 * 14-15. We have to set them back to 01 from the default 00 value each time
201 * the PHY is reset. It's also important because the PHY's LED0 signal is
202 * connected to SoC's ETH_LINK signal and in the PHY's default mode it will
203 * bounce on and off after each packet, which we apparently want to avoid.
204 */
205static int koelsch_ksz8041_fixup(struct phy_device *phydev)
206{
207 u16 phyctrl1 = phy_read(phydev, 0x1e);
208
209 phyctrl1 &= ~0xc000;
210 phyctrl1 |= 0x4000;
211 return phy_write(phydev, 0x1e, phyctrl1);
212}
213
214static void __init koelsch_init(void)
215{
216 koelsch_add_standard_devices();
217
218 if (IS_ENABLED(CONFIG_PHYLIB))
219 phy_register_fixup_for_id("r8a7791-ether-ff:01",
220 koelsch_ksz8041_fixup);
34} 221}
35 222
36static const char * const koelsch_boards_compat_dt[] __initconst = { 223static const char * const koelsch_boards_compat_dt[] __initconst = {
@@ -41,7 +228,8 @@ static const char * const koelsch_boards_compat_dt[] __initconst = {
41DT_MACHINE_START(KOELSCH_DT, "koelsch") 228DT_MACHINE_START(KOELSCH_DT, "koelsch")
42 .smp = smp_ops(r8a7791_smp_ops), 229 .smp = smp_ops(r8a7791_smp_ops),
43 .init_early = r8a7791_init_early, 230 .init_early = r8a7791_init_early,
44 .init_machine = koelsch_add_standard_devices,
45 .init_time = rcar_gen2_timer_init, 231 .init_time = rcar_gen2_timer_init,
232 .init_machine = koelsch_init,
233 .init_late = shmobile_init_late,
46 .dt_compat = koelsch_boards_compat_dt, 234 .dt_compat = koelsch_boards_compat_dt,
47MACHINE_END 235MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
deleted file mode 100644
index 30c2cc695b12..000000000000
--- a/arch/arm/mach-shmobile/board-kzm9d.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * kzm9d board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 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/interrupt.h>
23#include <linux/platform_device.h>
24#include <linux/regulator/fixed.h>
25#include <linux/regulator/machine.h>
26#include <linux/smsc911x.h>
27#include <mach/common.h>
28#include <mach/emev2.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31
32/* Dummy supplies, where voltage doesn't matter */
33static struct regulator_consumer_supply dummy_supplies[] = {
34 REGULATOR_SUPPLY("vddvario", "smsc911x"),
35 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
36};
37
38/* Ether */
39static struct resource smsc911x_resources[] = {
40 [0] = {
41 .start = 0x20000000,
42 .end = 0x2000ffff,
43 .flags = IORESOURCE_MEM,
44 },
45 [1] = {
46 .start = EMEV2_GPIO_IRQ(1),
47 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
48 },
49};
50
51static struct smsc911x_platform_config smsc911x_platdata = {
52 .flags = SMSC911X_USE_32BIT,
53 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
54 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
55};
56
57static struct platform_device smsc91x_device = {
58 .name = "smsc911x",
59 .id = -1,
60 .dev = {
61 .platform_data = &smsc911x_platdata,
62 },
63 .num_resources = ARRAY_SIZE(smsc911x_resources),
64 .resource = smsc911x_resources,
65};
66
67static struct platform_device *kzm9d_devices[] __initdata = {
68 &smsc91x_device,
69};
70
71void __init kzm9d_add_standard_devices(void)
72{
73 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
74
75 emev2_add_standard_devices();
76
77 platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
78}
79
80static const char *kzm9d_boards_compat_dt[] __initdata = {
81 "renesas,kzm9d",
82 NULL,
83};
84
85DT_MACHINE_START(KZM9D_DT, "kzm9d")
86 .smp = smp_ops(emev2_smp_ops),
87 .map_io = emev2_map_io,
88 .init_early = emev2_init_delay,
89 .init_machine = kzm9d_add_standard_devices,
90 .init_late = shmobile_init_late,
91 .dt_compat = kzm9d_boards_compat_dt,
92MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index 1a1a4a888632..a6e271d92af0 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -18,21 +18,53 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21#include <linux/clk.h>
22#include <linux/clkdev.h>
21#include <linux/init.h> 23#include <linux/init.h>
22#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <mach/common.h>
26#include <mach/rcar-gen2.h>
23#include <mach/r8a7790.h> 27#include <mach/r8a7790.h>
24#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
25 29
26static void __init lager_add_standard_devices(void) 30static void __init lager_add_standard_devices(void)
27{ 31{
28 /* clocks are setup late during boot in the case of DT */ 32#ifdef CONFIG_COMMON_CLK
33 /*
34 * This is a really crude hack to provide clkdev support to the SCIF
35 * and CMT devices until they get moved to DT.
36 */
37 static const char * const scif_names[] = {
38 "scifa0", "scifa1", "scifb0", "scifb1",
39 "scifb2", "scifa2", "scif0", "scif1",
40 "hscif0", "hscif1",
41 };
42 struct clk *clk;
43 unsigned int i;
44
45 for (i = 0; i < ARRAY_SIZE(scif_names); ++i) {
46 clk = clk_get(NULL, scif_names[i]);
47 if (clk) {
48 clk_register_clkdev(clk, NULL, "sh-sci.%u", i);
49 clk_put(clk);
50 }
51 }
52
53 clk = clk_get(NULL, "cmt0");
54 if (clk) {
55 clk_register_clkdev(clk, NULL, "sh_cmt.0");
56 clk_put(clk);
57 }
58#else
29 r8a7790_clock_init(); 59 r8a7790_clock_init();
60#endif
30 61
31 r8a7790_add_dt_devices(); 62 r8a7790_add_dt_devices();
32 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 63 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
33} 64}
34 65
35static const char *lager_boards_compat_dt[] __initdata = { 66static const char *lager_boards_compat_dt[] __initdata = {
67 "renesas,lager",
36 "renesas,lager-reference", 68 "renesas,lager-reference",
37 NULL, 69 NULL,
38}; 70};
@@ -42,5 +74,6 @@ DT_MACHINE_START(LAGER_DT, "lager")
42 .init_early = r8a7790_init_early, 74 .init_early = r8a7790_init_early,
43 .init_time = rcar_gen2_timer_init, 75 .init_time = rcar_gen2_timer_init,
44 .init_machine = lager_add_standard_devices, 76 .init_machine = lager_add_standard_devices,
77 .init_late = shmobile_init_late,
45 .dt_compat = lager_boards_compat_dt, 78 .dt_compat = lager_boards_compat_dt,
46MACHINE_END 79MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index e0406fd37390..f20c10a18543 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -31,7 +31,9 @@
31#include <linux/platform_data/rcar-du.h> 31#include <linux/platform_data/rcar-du.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/phy.h> 33#include <linux/phy.h>
34#include <linux/regulator/driver.h>
34#include <linux/regulator/fixed.h> 35#include <linux/regulator/fixed.h>
36#include <linux/regulator/gpio-regulator.h>
35#include <linux/regulator/machine.h> 37#include <linux/regulator/machine.h>
36#include <linux/sh_eth.h> 38#include <linux/sh_eth.h>
37#include <mach/common.h> 39#include <mach/common.h>
@@ -39,6 +41,11 @@
39#include <mach/r8a7790.h> 41#include <mach/r8a7790.h>
40#include <asm/mach-types.h> 42#include <asm/mach-types.h>
41#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
44#include <linux/mtd/partitions.h>
45#include <linux/mtd/mtd.h>
46#include <linux/spi/flash.h>
47#include <linux/spi/rspi.h>
48#include <linux/spi/spi.h>
42 49
43/* DU */ 50/* DU */
44static struct rcar_du_encoder_data lager_du_encoders[] = { 51static struct rcar_du_encoder_data lager_du_encoders[] = {
@@ -120,7 +127,8 @@ static const struct gpio_led_platform_data lager_leds_pdata __initconst = {
120 127
121/* GPIO KEY */ 128/* GPIO KEY */
122#define GPIO_KEY(c, g, d, ...) \ 129#define GPIO_KEY(c, g, d, ...) \
123 { .code = c, .gpio = g, .desc = d, .active_low = 1 } 130 { .code = c, .gpio = g, .desc = d, .active_low = 1, \
131 .wakeup = 1, .debounce_interval = 20 }
124 132
125static struct gpio_keys_button gpio_buttons[] = { 133static struct gpio_keys_button gpio_buttons[] = {
126 GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"), 134 GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"),
@@ -140,6 +148,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] =
140 REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"), 148 REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
141}; 149};
142 150
151/*
152 * SDHI regulator macro
153 *
154 ** FIXME**
155 * Lager board vqmmc is provided via DA9063 PMIC chip,
156 * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
157 * but, it doesn't have regulator support at this point.
158 * It uses gpio-regulator for vqmmc as quick-hack.
159 */
160#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin) \
161static struct regulator_consumer_supply vcc_sdhi##idx##_consumer = \
162 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx); \
163 \
164static struct regulator_init_data vcc_sdhi##idx##_init_data = { \
165 .constraints = { \
166 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
167 }, \
168 .consumer_supplies = &vcc_sdhi##idx##_consumer, \
169 .num_consumer_supplies = 1, \
170}; \
171 \
172static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
173 .supply_name = "SDHI" #idx "Vcc", \
174 .microvolts = 3300000, \
175 .gpio = vdd_pin, \
176 .enable_high = 1, \
177 .init_data = &vcc_sdhi##idx##_init_data, \
178}; \
179 \
180static struct regulator_consumer_supply vccq_sdhi##idx##_consumer = \
181 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx); \
182 \
183static struct regulator_init_data vccq_sdhi##idx##_init_data = { \
184 .constraints = { \
185 .input_uV = 3300000, \
186 .min_uV = 1800000, \
187 .max_uV = 3300000, \
188 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | \
189 REGULATOR_CHANGE_STATUS, \
190 }, \
191 .consumer_supplies = &vccq_sdhi##idx##_consumer, \
192 .num_consumer_supplies = 1, \
193}; \
194 \
195static struct gpio vccq_sdhi##idx##_gpio = \
196 { vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx }; \
197 \
198static struct gpio_regulator_state vccq_sdhi##idx##_states[] = { \
199 { .value = 1800000, .gpios = 0 }, \
200 { .value = 3300000, .gpios = 1 }, \
201}; \
202 \
203static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
204 .supply_name = "vqmmc", \
205 .gpios = &vccq_sdhi##idx##_gpio, \
206 .nr_gpios = 1, \
207 .states = vccq_sdhi##idx##_states, \
208 .nr_states = ARRAY_SIZE(vccq_sdhi##idx##_states), \
209 .type = REGULATOR_VOLTAGE, \
210 .init_data = &vccq_sdhi##idx##_init_data, \
211};
212
213SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
214SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
215
143/* MMCIF */ 216/* MMCIF */
144static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = { 217static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
145 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 218 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
@@ -148,7 +221,7 @@ static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
148}; 221};
149 222
150static const struct resource mmcif1_resources[] __initconst = { 223static const struct resource mmcif1_resources[] __initconst = {
151 DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"), 224 DEFINE_RES_MEM(0xee220000, 0x80),
152 DEFINE_RES_IRQ(gic_spi(170)), 225 DEFINE_RES_IRQ(gic_spi(170)),
153}; 226};
154 227
@@ -165,6 +238,59 @@ static const struct resource ether_resources[] __initconst = {
165 DEFINE_RES_IRQ(gic_spi(162)), 238 DEFINE_RES_IRQ(gic_spi(162)),
166}; 239};
167 240
241/* SPI Flash memory (Spansion S25FL512SAGMFIG11 64Mb) */
242static struct mtd_partition spi_flash_part[] = {
243 /* Reserved for user loader program, read-only */
244 {
245 .name = "loader",
246 .offset = 0,
247 .size = SZ_256K,
248 .mask_flags = MTD_WRITEABLE,
249 },
250 /* Reserved for user program, read-only */
251 {
252 .name = "user",
253 .offset = MTDPART_OFS_APPEND,
254 .size = SZ_4M,
255 .mask_flags = MTD_WRITEABLE,
256 },
257 /* All else is writable (e.g. JFFS2) */
258 {
259 .name = "flash",
260 .offset = MTDPART_OFS_APPEND,
261 .size = MTDPART_SIZ_FULL,
262 .mask_flags = 0,
263 },
264};
265
266static struct flash_platform_data spi_flash_data = {
267 .name = "m25p80",
268 .parts = spi_flash_part,
269 .nr_parts = ARRAY_SIZE(spi_flash_part),
270 .type = "s25fl512s",
271};
272
273static const struct rspi_plat_data qspi_pdata __initconst = {
274 .num_chipselect = 1,
275};
276
277static const struct spi_board_info spi_info[] __initconst = {
278 {
279 .modalias = "m25p80",
280 .platform_data = &spi_flash_data,
281 .mode = SPI_MODE_0,
282 .max_speed_hz = 30000000,
283 .bus_num = 0,
284 .chip_select = 0,
285 },
286};
287
288/* QSPI resource */
289static const struct resource qspi_resources[] __initconst = {
290 DEFINE_RES_MEM(0xe6b10000, 0x1000),
291 DEFINE_RES_IRQ(gic_spi(184)),
292};
293
168static const struct pinctrl_map lager_pinctrl_map[] = { 294static const struct pinctrl_map lager_pinctrl_map[] = {
169 /* DU (CN10: ARGB0, CN13: LVDS) */ 295 /* DU (CN10: ARGB0, CN13: LVDS) */
170 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", 296 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -197,6 +323,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
197 323
198static void __init lager_add_standard_devices(void) 324static void __init lager_add_standard_devices(void)
199{ 325{
326 int fixed_regulator_idx = 0;
327 int gpio_regulator_idx = 0;
328
200 r8a7790_clock_init(); 329 r8a7790_clock_init();
201 330
202 pinctrl_register_mappings(lager_pinctrl_map, 331 pinctrl_register_mappings(lager_pinctrl_map,
@@ -210,7 +339,8 @@ static void __init lager_add_standard_devices(void)
210 platform_device_register_data(&platform_bus, "gpio-keys", -1, 339 platform_device_register_data(&platform_bus, "gpio-keys", -1,
211 &lager_keys_pdata, 340 &lager_keys_pdata,
212 sizeof(lager_keys_pdata)); 341 sizeof(lager_keys_pdata));
213 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 342 regulator_register_always_on(fixed_regulator_idx++,
343 "fixed-3.3V", fixed3v3_power_consumers,
214 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 344 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
215 platform_device_register_resndata(&platform_bus, "sh_mmcif", 1, 345 platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
216 mmcif1_resources, ARRAY_SIZE(mmcif1_resources), 346 mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -222,6 +352,22 @@ static void __init lager_add_standard_devices(void)
222 &ether_pdata, sizeof(ether_pdata)); 352 &ether_pdata, sizeof(ether_pdata));
223 353
224 lager_add_du_device(); 354 lager_add_du_device();
355
356 platform_device_register_resndata(&platform_bus, "qspi", 0,
357 qspi_resources,
358 ARRAY_SIZE(qspi_resources),
359 &qspi_pdata, sizeof(qspi_pdata));
360 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
361
362 platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
363 &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
364 platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
365 &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
366
367 platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
368 &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
369 platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
370 &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
225} 371}
226 372
227/* 373/*
@@ -260,5 +406,6 @@ DT_MACHINE_START(LAGER_DT, "lager")
260 .init_early = r8a7790_init_early, 406 .init_early = r8a7790_init_early,
261 .init_time = rcar_gen2_timer_init, 407 .init_time = rcar_gen2_timer_init,
262 .init_machine = lager_init, 408 .init_machine = lager_init,
409 .init_late = shmobile_init_late,
263 .dt_compat = lager_boards_compat_dt, 410 .dt_compat = lager_boards_compat_dt,
264MACHINE_END 411MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index e721d2ccceae..3aba0372f630 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -41,6 +41,7 @@
41#include <linux/mtd/physmap.h> 41#include <linux/mtd/physmap.h>
42#include <linux/mtd/sh_flctl.h> 42#include <linux/mtd/sh_flctl.h>
43#include <linux/pinctrl/machine.h> 43#include <linux/pinctrl/machine.h>
44#include <linux/pinctrl/pinconf-generic.h>
44#include <linux/platform_data/gpio_backlight.h> 45#include <linux/platform_data/gpio_backlight.h>
45#include <linux/pm_clock.h> 46#include <linux/pm_clock.h>
46#include <linux/regulator/fixed.h> 47#include <linux/regulator/fixed.h>
@@ -548,9 +549,9 @@ static void __init hdmi_init_pm_clock(void)
548 clk_get_rate(&sh7372_pllc2_clk)); 549 clk_get_rate(&sh7372_pllc2_clk));
549 550
550 rate = clk_round_rate(&sh7372_pllc2_clk, 594000000); 551 rate = clk_round_rate(&sh7372_pllc2_clk, 594000000);
551 if (rate < 0) { 552 if (rate <= 0) {
552 pr_err("Cannot get suitable rate: %ld\n", rate); 553 pr_err("Cannot get suitable rate: %ld\n", rate);
553 ret = rate; 554 ret = -EINVAL;
554 goto out; 555 goto out;
555 } 556 }
556 557
@@ -1311,6 +1312,10 @@ static struct i2c_board_info i2c1_devices[] = {
1311 }, 1312 },
1312}; 1313};
1313 1314
1315static unsigned long pin_pulldown_conf[] = {
1316 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 0),
1317};
1318
1314static const struct pinctrl_map mackerel_pinctrl_map[] = { 1319static const struct pinctrl_map mackerel_pinctrl_map[] = {
1315 /* ADXL34X */ 1320 /* ADXL34X */
1316 PIN_MAP_MUX_GROUP_DEFAULT("1-0053", "pfc-sh7372", 1321 PIN_MAP_MUX_GROUP_DEFAULT("1-0053", "pfc-sh7372",
@@ -1396,17 +1401,19 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = {
1396 /* USBHS0 */ 1401 /* USBHS0 */
1397 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372", 1402 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372",
1398 "usb0_vbus", "usb0"), 1403 "usb0_vbus", "usb0"),
1404 PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372",
1405 "usb0_vbus", pin_pulldown_conf),
1399 /* USBHS1 */ 1406 /* USBHS1 */
1400 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372", 1407 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
1401 "usb1_vbus", "usb1"), 1408 "usb1_vbus", "usb1"),
1409 PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
1410 "usb1_vbus", pin_pulldown_conf),
1402 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372", 1411 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
1403 "usb1_otg_id_0", "usb1"), 1412 "usb1_otg_id_0", "usb1"),
1404}; 1413};
1405 1414
1406#define GPIO_PORT9CR IOMEM(0xE6051009) 1415#define GPIO_PORT9CR IOMEM(0xE6051009)
1407#define GPIO_PORT10CR IOMEM(0xE605100A) 1416#define GPIO_PORT10CR IOMEM(0xE605100A)
1408#define GPIO_PORT167CR IOMEM(0xE60520A7)
1409#define GPIO_PORT168CR IOMEM(0xE60520A8)
1410#define SRCR4 IOMEM(0xe61580bc) 1417#define SRCR4 IOMEM(0xe61580bc)
1411#define USCCR1 IOMEM(0xE6058144) 1418#define USCCR1 IOMEM(0xE6058144)
1412static void __init mackerel_init(void) 1419static void __init mackerel_init(void)
@@ -1446,12 +1453,6 @@ static void __init mackerel_init(void)
1446 1453
1447 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1454 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1448 1455
1449 /* USBHS0 */
1450 gpio_request_pulldown(GPIO_PORT168CR); /* VBUS0_0 pull down */
1451
1452 /* USBHS1 */
1453 gpio_request_pulldown(GPIO_PORT167CR); /* VBUS0_1 pull down */
1454
1455 /* FSI2 port A (ak4643) */ 1456 /* FSI2 port A (ak4643) */
1456 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */ 1457 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
1457 1458
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index da1352f5f71b..d832a4477b4b 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -29,6 +29,7 @@
29#include <linux/leds.h> 29#include <linux/leds.h>
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/camera-rcar.h>
32#include <linux/platform_data/gpio-rcar.h> 33#include <linux/platform_data/gpio-rcar.h>
33#include <linux/platform_data/rcar-du.h> 34#include <linux/platform_data/rcar-du.h>
34#include <linux/platform_data/usb-rcar-phy.h> 35#include <linux/platform_data/usb-rcar-phy.h>
@@ -259,10 +260,30 @@ static struct platform_device leds_device = {
259 }, 260 },
260}; 261};
261 262
263/* VIN */
262static struct rcar_vin_platform_data vin_platform_data __initdata = { 264static struct rcar_vin_platform_data vin_platform_data __initdata = {
263 .flags = RCAR_VIN_BT656, 265 .flags = RCAR_VIN_BT656,
264}; 266};
265 267
268#define MARZEN_VIN(idx) \
269static struct resource vin##idx##_resources[] __initdata = { \
270 DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \
271 DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \
272}; \
273 \
274static struct platform_device_info vin##idx##_info __initdata = { \
275 .parent = &platform_bus, \
276 .name = "r8a7779-vin", \
277 .id = idx, \
278 .res = vin##idx##_resources, \
279 .num_res = ARRAY_SIZE(vin##idx##_resources), \
280 .dma_mask = DMA_BIT_MASK(32), \
281 .data = &vin_platform_data, \
282 .size_data = sizeof(vin_platform_data), \
283}
284MARZEN_VIN(1);
285MARZEN_VIN(3);
286
266#define MARZEN_CAMERA(idx) \ 287#define MARZEN_CAMERA(idx) \
267static struct i2c_board_info camera##idx##_info = { \ 288static struct i2c_board_info camera##idx##_info = { \
268 I2C_BOARD_INFO("adv7180", 0x20 + (idx)), \ 289 I2C_BOARD_INFO("adv7180", 0x20 + (idx)), \
@@ -326,8 +347,6 @@ static const struct pinctrl_map marzen_pinctrl_map[] = {
326 "sdhi0_ctrl", "sdhi0"), 347 "sdhi0_ctrl", "sdhi0"),
327 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779", 348 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
328 "sdhi0_cd", "sdhi0"), 349 "sdhi0_cd", "sdhi0"),
329 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
330 "sdhi0_wp", "sdhi0"),
331 /* SMSC */ 350 /* SMSC */
332 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779", 351 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
333 "intc_irq1_b", "intc"), 352 "intc_irq1_b", "intc"),
@@ -367,8 +386,8 @@ static void __init marzen_init(void)
367 r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */ 386 r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
368 387
369 r8a7779_add_standard_devices(); 388 r8a7779_add_standard_devices();
370 r8a7779_add_vin_device(1, &vin_platform_data); 389 platform_device_register_full(&vin1_info);
371 r8a7779_add_vin_device(3, &vin_platform_data); 390 platform_device_register_full(&vin3_info);
372 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 391 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
373 marzen_add_du_device(); 392 marzen_add_du_device();
374} 393}
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
index 4aba20ca127e..e6ab0cd5b286 100644
--- a/arch/arm/mach-shmobile/clock-r7s72100.c
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -27,6 +27,7 @@
27#define FRQCR2 0xfcfe0014 27#define FRQCR2 0xfcfe0014
28#define STBCR3 0xfcfe0420 28#define STBCR3 0xfcfe0420
29#define STBCR4 0xfcfe0424 29#define STBCR4 0xfcfe0424
30#define STBCR9 0xfcfe0438
30 31
31#define PLL_RATE 30 32#define PLL_RATE 30
32 33
@@ -144,10 +145,15 @@ struct clk div4_clks[DIV4_NR] = {
144 | CLK_ENABLE_ON_INIT), 145 | CLK_ENABLE_ON_INIT),
145}; 146};
146 147
147enum { MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40, 148enum { MSTP97, MSTP96, MSTP95, MSTP94,
149 MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40,
148 MSTP33, MSTP_NR }; 150 MSTP33, MSTP_NR };
149 151
150static struct clk mstp_clks[MSTP_NR] = { 152static struct clk mstp_clks[MSTP_NR] = {
153 [MSTP97] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 7, 0), /* RIIC0 */
154 [MSTP96] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 6, 0), /* RIIC1 */
155 [MSTP95] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 5, 0), /* RIIC2 */
156 [MSTP94] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 4, 0), /* RIIC3 */
151 [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */ 157 [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */
152 [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */ 158 [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */
153 [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */ 159 [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */
@@ -170,6 +176,9 @@ static struct clk_lookup lookups[] = {
170 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), 176 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
171 177
172 /* MSTP clocks */ 178 /* MSTP clocks */
179 CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]),
180
181 /* ICK */
173 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]), 182 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]),
174 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]), 183 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]),
175 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]), 184 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index 571409b611d3..7348d58f500e 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -584,15 +584,15 @@ static struct clk_lookup lookups[] = {
584 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 584 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
585 CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]), 585 CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]),
586 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), 586 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
587 CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]), 587 CLKDEV_DEV_ID("ee220000.mmc", &mstp_clks[MSTP305]),
588 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]), 588 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
589 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP312]), 589 CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP312]),
590 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), 590 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
591 CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]), 591 CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]),
592 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 592 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
593 CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]), 593 CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]),
594 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]), 594 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]),
595 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]), 595 CLKDEV_DEV_ID("ee200000.mmc", &mstp_clks[MSTP315]),
596 CLKDEV_DEV_ID("e6550000.i2c", &mstp_clks[MSTP316]), 596 CLKDEV_DEV_ID("e6550000.i2c", &mstp_clks[MSTP316]),
597 CLKDEV_DEV_ID("e6560000.i2c", &mstp_clks[MSTP317]), 597 CLKDEV_DEV_ID("e6560000.i2c", &mstp_clks[MSTP317]),
598 CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]), 598 CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index c826bca4024e..dd989f93498f 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -585,22 +585,23 @@ static struct clk_lookup lookups[] = {
585 585
586 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), 586 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
587 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), 587 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
588 CLKDEV_DEV_ID("fe1f0000.sound", &mstp_clks[MSTP328]),
588 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), 589 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
589 CLKDEV_DEV_ID("e6c20000.i2c", &mstp_clks[MSTP323]), 590 CLKDEV_DEV_ID("e6c20000.i2c", &mstp_clks[MSTP323]),
590 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]), 591 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]),
591 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 592 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
592 CLKDEV_DEV_ID("e6850000.sdhi", &mstp_clks[MSTP314]), 593 CLKDEV_DEV_ID("e6850000.sd", &mstp_clks[MSTP314]),
593 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), 594 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
594 CLKDEV_DEV_ID("e6860000.sdhi", &mstp_clks[MSTP313]), 595 CLKDEV_DEV_ID("e6860000.sd", &mstp_clks[MSTP313]),
595 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), 596 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
596 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), 597 CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]),
597 CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]), 598 CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]),
598 CLKDEV_DEV_ID("e9a00000.sh-eth", &mstp_clks[MSTP309]), 599 CLKDEV_DEV_ID("e9a00000.sh-eth", &mstp_clks[MSTP309]),
599 CLKDEV_DEV_ID("renesas-tpu-pwm", &mstp_clks[MSTP304]), 600 CLKDEV_DEV_ID("renesas-tpu-pwm", &mstp_clks[MSTP304]),
600 CLKDEV_DEV_ID("e6600000.pwm", &mstp_clks[MSTP304]), 601 CLKDEV_DEV_ID("e6600000.pwm", &mstp_clks[MSTP304]),
601 602
602 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), 603 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
603 CLKDEV_DEV_ID("e6870000.sdhi", &mstp_clks[MSTP415]), 604 CLKDEV_DEV_ID("e6870000.sd", &mstp_clks[MSTP415]),
604 605
605 /* ICK */ 606 /* ICK */
606 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]), 607 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index fb6af83858e3..9783945f8bc7 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -115,6 +115,8 @@ static struct clk *main_clks[] = {
115}; 115};
116 116
117enum { 117enum {
118 MSTP531, MSTP530,
119 MSTP529, MSTP528, MSTP527, MSTP526, MSTP525, MSTP524, MSTP523,
118 MSTP331, 120 MSTP331,
119 MSTP323, MSTP322, MSTP321, 121 MSTP323, MSTP322, MSTP321,
120 MSTP311, MSTP310, 122 MSTP311, MSTP310,
@@ -129,6 +131,15 @@ enum {
129 MSTP_NR }; 131 MSTP_NR };
130 132
131static struct clk mstp_clks[MSTP_NR] = { 133static struct clk mstp_clks[MSTP_NR] = {
134 [MSTP531] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 31, 0), /* SCU0 */
135 [MSTP530] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 30, 0), /* SCU1 */
136 [MSTP529] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 29, 0), /* SCU2 */
137 [MSTP528] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 28, 0), /* SCU3 */
138 [MSTP527] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 27, 0), /* SCU4 */
139 [MSTP526] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 26, 0), /* SCU5 */
140 [MSTP525] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 25, 0), /* SCU6 */
141 [MSTP524] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 24, 0), /* SCU7 */
142 [MSTP523] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 23, 0), /* SCU8 */
132 [MSTP331] = SH_CLK_MSTP32(&s4_clk, MSTPCR3, 31, 0), /* MMC */ 143 [MSTP331] = SH_CLK_MSTP32(&s4_clk, MSTPCR3, 31, 0), /* MMC */
133 [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */ 144 [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */
134 [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */ 145 [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */
@@ -173,9 +184,13 @@ static struct clk_lookup lookups[] = {
173 184
174 /* MSTP32 clocks */ 185 /* MSTP32 clocks */
175 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP331]), /* MMC */ 186 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP331]), /* MMC */
187 CLKDEV_DEV_ID("ffe4e000.mmc", &mstp_clks[MSTP331]), /* MMC */
176 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */ 188 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
189 CLKDEV_DEV_ID("ffe4c000.sd", &mstp_clks[MSTP323]), /* SDHI0 */
177 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ 190 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
191 CLKDEV_DEV_ID("ffe4d000.sd", &mstp_clks[MSTP322]), /* SDHI1 */
178 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ 192 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
193 CLKDEV_DEV_ID("ffe4f000.sd", &mstp_clks[MSTP321]), /* SDHI2 */
179 CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */ 194 CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
180 CLKDEV_DEV_ID("r8a7778-vin.0", &mstp_clks[MSTP110]), /* VIN0 */ 195 CLKDEV_DEV_ID("r8a7778-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
181 CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */ 196 CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */
@@ -183,9 +198,13 @@ static struct clk_lookup lookups[] = {
183 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ 198 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
184 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP100]), /* USB FUNC */ 199 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP100]), /* USB FUNC */
185 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ 200 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
201 CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */
186 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */ 202 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
203 CLKDEV_DEV_ID("ffc71000.i2c", &mstp_clks[MSTP029]), /* I2C1 */
187 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */ 204 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
205 CLKDEV_DEV_ID("ffc72000.i2c", &mstp_clks[MSTP028]), /* I2C2 */
188 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */ 206 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
207 CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */
189 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */ 208 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
190 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */ 209 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
191 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */ 210 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
@@ -195,8 +214,11 @@ static struct clk_lookup lookups[] = {
195 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */ 214 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */
196 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP015]), /* TMU01 */ 215 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP015]), /* TMU01 */
197 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */ 216 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
217 CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
198 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */ 218 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
219 CLKDEV_DEV_ID("fffc8000.spi", &mstp_clks[MSTP007]), /* HSPI1 */
199 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */ 220 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
221 CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */
200 CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP008]), /* SRU */ 222 CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP008]), /* SRU */
201 223
202 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP012]), 224 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP012]),
@@ -208,6 +230,15 @@ static struct clk_lookup lookups[] = {
208 CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP309]), 230 CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP309]),
209 CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP308]), 231 CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP308]),
210 CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP307]), 232 CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP307]),
233 CLKDEV_ICK_ID("scu.0", "rcar_sound", &mstp_clks[MSTP531]),
234 CLKDEV_ICK_ID("scu.1", "rcar_sound", &mstp_clks[MSTP530]),
235 CLKDEV_ICK_ID("scu.2", "rcar_sound", &mstp_clks[MSTP529]),
236 CLKDEV_ICK_ID("scu.3", "rcar_sound", &mstp_clks[MSTP528]),
237 CLKDEV_ICK_ID("scu.4", "rcar_sound", &mstp_clks[MSTP527]),
238 CLKDEV_ICK_ID("scu.5", "rcar_sound", &mstp_clks[MSTP526]),
239 CLKDEV_ICK_ID("scu.6", "rcar_sound", &mstp_clks[MSTP525]),
240 CLKDEV_ICK_ID("scu.7", "rcar_sound", &mstp_clks[MSTP524]),
241 CLKDEV_ICK_ID("scu.8", "rcar_sound", &mstp_clks[MSTP523]),
211}; 242};
212 243
213void __init r8a7778_clock_init(void) 244void __init r8a7778_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 1f7080fab0a5..f1fb89b76786 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -184,9 +184,13 @@ static struct clk_lookup lookups[] = {
184 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */ 184 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */
185 CLKDEV_DEV_ID("sh_tmu.2", &mstp_clks[MSTP016]), /* TMU02 */ 185 CLKDEV_DEV_ID("sh_tmu.2", &mstp_clks[MSTP016]), /* TMU02 */
186 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ 186 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
187 CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */
187 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */ 188 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
189 CLKDEV_DEV_ID("ffc71000.i2c", &mstp_clks[MSTP029]), /* I2C1 */
188 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */ 190 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
191 CLKDEV_DEV_ID("ffc72000.i2c", &mstp_clks[MSTP028]), /* I2C2 */
189 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */ 192 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
193 CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */
190 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */ 194 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
191 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */ 195 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
192 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */ 196 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
@@ -194,12 +198,19 @@ static struct clk_lookup lookups[] = {
194 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */ 198 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
195 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */ 199 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
196 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */ 200 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
201 CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
197 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */ 202 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
203 CLKDEV_DEV_ID("fffc8000.spi", &mstp_clks[MSTP007]), /* HSPI1 */
198 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */ 204 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
205 CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */
199 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */ 206 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
207 CLKDEV_DEV_ID("ffe4c000.sd", &mstp_clks[MSTP323]), /* SDHI0 */
200 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ 208 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
209 CLKDEV_DEV_ID("ffe4d000.sd", &mstp_clks[MSTP322]), /* SDHI1 */
201 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ 210 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
211 CLKDEV_DEV_ID("ffe4e000.sd", &mstp_clks[MSTP321]), /* SDHI2 */
202 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ 212 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */
213 CLKDEV_DEV_ID("ffe4f000.sd", &mstp_clks[MSTP320]), /* SDHI3 */
203 CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */ 214 CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */
204}; 215};
205 216
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index a64f965c7da1..f44987a92ad4 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -53,6 +53,7 @@
53#define SMSTPCR7 0xe615014c 53#define SMSTPCR7 0xe615014c
54#define SMSTPCR8 0xe6150990 54#define SMSTPCR8 0xe6150990
55#define SMSTPCR9 0xe6150994 55#define SMSTPCR9 0xe6150994
56#define SMSTPCR10 0xe6150998
56 57
57#define SDCKCR 0xE6150074 58#define SDCKCR 0xE6150074
58#define SD2CKCR 0xE6150078 59#define SD2CKCR 0xE6150078
@@ -77,7 +78,7 @@ static struct sh_clk_ops followparent_clk_ops = {
77}; 78};
78 79
79static struct clk main_clk = { 80static struct clk main_clk = {
80 /* .parent will be set r8a73a4_clock_init */ 81 /* .parent will be set r8a7790_clock_init */
81 .ops = &followparent_clk_ops, 82 .ops = &followparent_clk_ops,
82}; 83};
83 84
@@ -182,10 +183,14 @@ static struct clk div6_clks[DIV6_NR] = {
182 183
183/* MSTP */ 184/* MSTP */
184enum { 185enum {
186 MSTP1015, MSTP1014, MSTP1013, MSTP1012, MSTP1011, MSTP1010,
187 MSTP1009, MSTP1008, MSTP1007, MSTP1006, MSTP1005,
185 MSTP931, MSTP930, MSTP929, MSTP928, 188 MSTP931, MSTP930, MSTP929, MSTP928,
189 MSTP917,
186 MSTP813, 190 MSTP813,
187 MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720, 191 MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720,
188 MSTP717, MSTP716, 192 MSTP717, MSTP716,
193 MSTP704,
189 MSTP522, 194 MSTP522,
190 MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304, 195 MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304,
191 MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, 196 MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202,
@@ -194,10 +199,22 @@ enum {
194}; 199};
195 200
196static struct clk mstp_clks[MSTP_NR] = { 201static struct clk mstp_clks[MSTP_NR] = {
197 [MSTP931] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 31, 0), /* I2C0 */ 202 [MSTP1015] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 15, 0), /* SSI0 */
198 [MSTP930] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 30, 0), /* I2C1 */ 203 [MSTP1014] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 14, 0), /* SSI1 */
199 [MSTP929] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 29, 0), /* I2C2 */ 204 [MSTP1013] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 13, 0), /* SSI2 */
200 [MSTP928] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 28, 0), /* I2C3 */ 205 [MSTP1012] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 12, 0), /* SSI3 */
206 [MSTP1011] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 11, 0), /* SSI4 */
207 [MSTP1010] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 10, 0), /* SSI5 */
208 [MSTP1009] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 9, 0), /* SSI6 */
209 [MSTP1008] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 8, 0), /* SSI7 */
210 [MSTP1007] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 7, 0), /* SSI8 */
211 [MSTP1006] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 6, 0), /* SSI9 */
212 [MSTP1005] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 5, 0), /* SSI ALL */
213 [MSTP931] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 31, 0), /* I2C0 */
214 [MSTP930] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 30, 0), /* I2C1 */
215 [MSTP929] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 29, 0), /* I2C2 */
216 [MSTP928] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 28, 0), /* I2C3 */
217 [MSTP917] = SH_CLK_MSTP32(&qspi_clk, SMSTPCR9, 17, 0), /* QSPI */
201 [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */ 218 [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */
202 [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */ 219 [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */
203 [MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */ 220 [MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */
@@ -208,6 +225,7 @@ static struct clk mstp_clks[MSTP_NR] = {
208 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */ 225 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
209 [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */ 226 [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */
210 [MSTP716] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 16, 0), /* HSCIF1 */ 227 [MSTP716] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 16, 0), /* HSCIF1 */
228 [MSTP704] = SH_CLK_MSTP32(&mp_clk, SMSTPCR7, 4, 0), /* HSUSB */
211 [MSTP522] = SH_CLK_MSTP32(&extal_clk, SMSTPCR5, 22, 0), /* Thermal */ 229 [MSTP522] = SH_CLK_MSTP32(&extal_clk, SMSTPCR5, 22, 0), /* Thermal */
212 [MSTP315] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC0], SMSTPCR3, 15, 0), /* MMC0 */ 230 [MSTP315] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC0], SMSTPCR3, 15, 0), /* MMC0 */
213 [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_SD0], SMSTPCR3, 14, 0), /* SDHI0 */ 231 [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_SD0], SMSTPCR3, 14, 0), /* SDHI0 */
@@ -262,11 +280,7 @@ static struct clk_lookup lookups[] = {
262 CLKDEV_CON_ID("ssprs", &div6_clks[DIV6_SSPRS]), 280 CLKDEV_CON_ID("ssprs", &div6_clks[DIV6_SSPRS]),
263 281
264 /* MSTP */ 282 /* MSTP */
265 CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]), 283 CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP1005]),
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]),
270 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 284 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
271 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 285 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
272 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), 286 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
@@ -278,24 +292,50 @@ static struct clk_lookup lookups[] = {
278 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]), 292 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]),
279 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]), 293 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]),
280 CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]), 294 CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]),
295 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]),
281 CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]), 296 CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]),
297 CLKDEV_DEV_ID("i2c-rcar_gen2.1", &mstp_clks[MSTP930]),
282 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]), 298 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]),
299 CLKDEV_DEV_ID("i2c-rcar_gen2.2", &mstp_clks[MSTP929]),
283 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]), 300 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]),
301 CLKDEV_DEV_ID("i2c-rcar_gen2.3", &mstp_clks[MSTP928]),
284 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]), 302 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]),
303 CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]),
285 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 304 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
286 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]), 305 CLKDEV_DEV_ID("ee200000.mmc", &mstp_clks[MSTP315]),
287 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]), 306 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]),
288 CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]), 307 CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]),
289 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 308 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
290 CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]), 309 CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]),
291 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), 310 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
292 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP312]), 311 CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP312]),
293 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]), 312 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
294 CLKDEV_DEV_ID("ee160000.sdhi", &mstp_clks[MSTP311]), 313 CLKDEV_DEV_ID("ee160000.sd", &mstp_clks[MSTP311]),
295 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]), 314 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]),
296 CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]), 315 CLKDEV_DEV_ID("ee220000.mmc", &mstp_clks[MSTP305]),
297 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), 316 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
298 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), 317 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
318 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
319 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP704]),
320
321 /* ICK */
322 CLKDEV_ICK_ID("usbhs", "usb_phy_rcar_gen2", &mstp_clks[MSTP704]),
323 CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]),
324 CLKDEV_ICK_ID("lvds.1", "rcar-du-r8a7790", &mstp_clks[MSTP725]),
325 CLKDEV_ICK_ID("du.0", "rcar-du-r8a7790", &mstp_clks[MSTP724]),
326 CLKDEV_ICK_ID("du.1", "rcar-du-r8a7790", &mstp_clks[MSTP723]),
327 CLKDEV_ICK_ID("du.2", "rcar-du-r8a7790", &mstp_clks[MSTP722]),
328 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP1015]),
329 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP1014]),
330 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP1013]),
331 CLKDEV_ICK_ID("ssi.3", "rcar_sound", &mstp_clks[MSTP1012]),
332 CLKDEV_ICK_ID("ssi.4", "rcar_sound", &mstp_clks[MSTP1011]),
333 CLKDEV_ICK_ID("ssi.5", "rcar_sound", &mstp_clks[MSTP1010]),
334 CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP1009]),
335 CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP1008]),
336 CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP1007]),
337 CLKDEV_ICK_ID("ssi.9", "rcar_sound", &mstp_clks[MSTP1006]),
338
299}; 339};
300 340
301#define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31) \ 341#define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31) \
@@ -321,10 +361,10 @@ void __init r8a7790_clock_init(void)
321 R8A7790_CLOCK_ROOT(20, &extal_clk, 130, 156, 80, 66); 361 R8A7790_CLOCK_ROOT(20, &extal_clk, 130, 156, 80, 66);
322 break; 362 break;
323 case MD(14): 363 case MD(14):
324 R8A7790_CLOCK_ROOT(26, &extal_div2_clk, 200, 240, 122, 102); 364 R8A7790_CLOCK_ROOT(26 / 2, &extal_div2_clk, 200, 240, 122, 102);
325 break; 365 break;
326 case MD(13) | MD(14): 366 case MD(13) | MD(14):
327 R8A7790_CLOCK_ROOT(30, &extal_div2_clk, 172, 208, 106, 88); 367 R8A7790_CLOCK_ROOT(30 / 2, &extal_div2_clk, 172, 208, 106, 88);
328 break; 368 break;
329 } 369 }
330 370
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
index c9a26f16ce5b..f5461262ee25 100644
--- a/arch/arm/mach-shmobile/clock-r8a7791.c
+++ b/arch/arm/mach-shmobile/clock-r8a7791.c
@@ -103,6 +103,7 @@ SH_FIXED_RATIO_CLK_SET(hp_clk, pll1_clk, 1, 12);
103SH_FIXED_RATIO_CLK_SET(p_clk, pll1_clk, 1, 24); 103SH_FIXED_RATIO_CLK_SET(p_clk, pll1_clk, 1, 24);
104SH_FIXED_RATIO_CLK_SET(rclk_clk, pll1_clk, 1, (48 * 1024)); 104SH_FIXED_RATIO_CLK_SET(rclk_clk, pll1_clk, 1, (48 * 1024));
105SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15); 105SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15);
106SH_FIXED_RATIO_CLK_SET(zx_clk, pll1_clk, 1, 3);
106 107
107static struct clk *main_clks[] = { 108static struct clk *main_clks[] = {
108 &extal_clk, 109 &extal_clk,
@@ -116,12 +117,15 @@ static struct clk *main_clks[] = {
116 &rclk_clk, 117 &rclk_clk,
117 &mp_clk, 118 &mp_clk,
118 &cp_clk, 119 &cp_clk,
120 &zx_clk,
119}; 121};
120 122
121/* MSTP */ 123/* MSTP */
122enum { 124enum {
123 MSTP721, MSTP720, 125 MSTP813,
126 MSTP726, MSTP724, MSTP723, MSTP721, MSTP720,
124 MSTP719, MSTP718, MSTP715, MSTP714, 127 MSTP719, MSTP718, MSTP715, MSTP714,
128 MSTP522,
125 MSTP216, MSTP207, MSTP206, 129 MSTP216, MSTP207, MSTP206,
126 MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107, 130 MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107,
127 MSTP124, 131 MSTP124,
@@ -129,12 +133,17 @@ enum {
129}; 133};
130 134
131static struct clk mstp_clks[MSTP_NR] = { 135static struct clk mstp_clks[MSTP_NR] = {
136 [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */
137 [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */
138 [MSTP724] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 24, 0), /* DU0 */
139 [MSTP723] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 23, 0), /* DU1 */
132 [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */ 140 [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */
133 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */ 141 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
134 [MSTP719] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 19, 0), /* SCIF2 */ 142 [MSTP719] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 19, 0), /* SCIF2 */
135 [MSTP718] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 18, 0), /* SCIF3 */ 143 [MSTP718] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 18, 0), /* SCIF3 */
136 [MSTP715] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 15, 0), /* SCIF4 */ 144 [MSTP715] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 15, 0), /* SCIF4 */
137 [MSTP714] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 14, 0), /* SCIF5 */ 145 [MSTP714] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 14, 0), /* SCIF5 */
146 [MSTP522] = SH_CLK_MSTP32(&extal_clk, SMSTPCR5, 22, 0), /* Thermal */
138 [MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */ 147 [MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */
139 [MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */ 148 [MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */
140 [MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */ 149 [MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */
@@ -164,6 +173,9 @@ static struct clk_lookup lookups[] = {
164 CLKDEV_CON_ID("peripheral_clk", &hp_clk), 173 CLKDEV_CON_ID("peripheral_clk", &hp_clk),
165 174
166 /* MSTP */ 175 /* MSTP */
176 CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7791", &mstp_clks[MSTP726]),
177 CLKDEV_ICK_ID("du.0", "rcar-du-r8a7791", &mstp_clks[MSTP724]),
178 CLKDEV_ICK_ID("du.1", "rcar-du-r8a7791", &mstp_clks[MSTP723]),
167 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ 179 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
168 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */ 180 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
169 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), /* SCIFB0 */ 181 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), /* SCIFB0 */
@@ -180,6 +192,9 @@ static struct clk_lookup lookups[] = {
180 CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1106]), /* SCIFA4 */ 192 CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1106]), /* SCIFA4 */
181 CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1107]), /* SCIFA5 */ 193 CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1107]), /* SCIFA5 */
182 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), 194 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
195 CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]),
196 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
197 CLKDEV_DEV_ID("r8a7791-ether", &mstp_clks[MSTP813]), /* Ether */
183}; 198};
184 199
185#define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31) \ 200#define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31) \
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 5390c6bbbc02..28489978b09c 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -504,10 +504,6 @@ static struct clk_lookup lookups[] = {
504 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]), 504 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]),
505 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]), 505 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]),
506 CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]), 506 CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]),
507 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
508 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
509 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
510 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
511 507
512 /* MSTP32 clocks */ 508 /* MSTP32 clocks */
513 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */ 509 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */
@@ -574,6 +570,11 @@ static struct clk_lookup lookups[] = {
574 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 570 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
575 CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */ 571 CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */
576 572
573 /* ICK */
574 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
575 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
576 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
577 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
577 CLKDEV_ICK_ID("hdmi", "sh_mobile_lcdc_fb.1", 578 CLKDEV_ICK_ID("hdmi", "sh_mobile_lcdc_fb.1",
578 &div6_reparent_clks[DIV6_HDMI]), 579 &div6_reparent_clks[DIV6_HDMI]),
579 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), 580 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index c92c023f0d27..23edf8360c27 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -625,12 +625,6 @@ static struct clk_lookup lookups[] = {
625 CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]), 625 CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]),
626 CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]), 626 CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]),
627 CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]), 627 CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]),
628 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
629 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
630 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
631 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
632 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
633 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
634 628
635 /* MSTP32 clocks */ 629 /* MSTP32 clocks */
636 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ 630 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
@@ -658,18 +652,19 @@ static struct clk_lookup lookups[] = {
658 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ 652 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
659 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ 653 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
660 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */ 654 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */
655 CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */
661 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ 656 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
662 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ 657 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */
663 CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ 658 CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */
664 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */ 659 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */
665 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 660 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
666 CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]), /* SDHI0 */ 661 CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]), /* SDHI0 */
667 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 662 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
668 CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]), /* SDHI1 */ 663 CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]), /* SDHI1 */
669 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ 664 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
670 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */ 665 CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]), /* MMCIF0 */
671 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ 666 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
672 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP311]), /* SDHI2 */ 667 CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP311]), /* SDHI2 */
673 CLKDEV_DEV_ID("renesas-tpu-pwm.0", &mstp_clks[MSTP304]), /* TPU0 */ 668 CLKDEV_DEV_ID("renesas-tpu-pwm.0", &mstp_clks[MSTP304]), /* TPU0 */
674 CLKDEV_DEV_ID("renesas-tpu-pwm.1", &mstp_clks[MSTP303]), /* TPU1 */ 669 CLKDEV_DEV_ID("renesas-tpu-pwm.1", &mstp_clks[MSTP303]), /* TPU1 */
675 CLKDEV_DEV_ID("renesas-tpu-pwm.2", &mstp_clks[MSTP302]), /* TPU2 */ 670 CLKDEV_DEV_ID("renesas-tpu-pwm.2", &mstp_clks[MSTP302]), /* TPU2 */
@@ -680,6 +675,14 @@ static struct clk_lookup lookups[] = {
680 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ 675 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
681 CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */ 676 CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */
682 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 677 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
678
679 /* ICK */
680 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
681 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
682 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
683 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
684 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
685 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
683}; 686};
684 687
685void __init sh73a0_clock_init(void) 688void __init sh73a0_clock_init(void)
diff --git a/arch/arm/mach-shmobile/include/mach/emev2.h b/arch/arm/mach-shmobile/include/mach/emev2.h
index c2eb7568d9be..fcb142a14e07 100644
--- a/arch/arm/mach-shmobile/include/mach/emev2.h
+++ b/arch/arm/mach-shmobile/include/mach/emev2.h
@@ -3,12 +3,7 @@
3 3
4extern void emev2_map_io(void); 4extern void emev2_map_io(void);
5extern void emev2_init_delay(void); 5extern void emev2_init_delay(void);
6extern void emev2_add_standard_devices(void);
7extern void emev2_clock_init(void); 6extern void emev2_clock_init(void);
8
9#define EMEV2_GPIO_BASE 200
10#define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
11
12extern struct smp_operations emev2_smp_ops; 7extern struct smp_operations emev2_smp_ops;
13 8
14#endif /* __ASM_EMEV2_H__ */ 9#endif /* __ASM_EMEV2_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h
index 441886c9714b..f4076a50e970 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -20,13 +20,50 @@
20#define __ASM_R8A7778_H__ 20#define __ASM_R8A7778_H__
21 21
22#include <linux/sh_eth.h> 22#include <linux/sh_eth.h>
23#include <linux/platform_data/camera-rcar.h>
24 23
25/* HPB-DMA slave IDs */ 24/* HPB-DMA slave IDs */
26enum { 25enum {
27 HPBDMA_SLAVE_DUMMY, 26 HPBDMA_SLAVE_DUMMY,
28 HPBDMA_SLAVE_SDHI0_TX, 27 HPBDMA_SLAVE_SDHI0_TX,
29 HPBDMA_SLAVE_SDHI0_RX, 28 HPBDMA_SLAVE_SDHI0_RX,
29 HPBDMA_SLAVE_SSI0_TX,
30 HPBDMA_SLAVE_SSI0_RX,
31 HPBDMA_SLAVE_SSI1_TX,
32 HPBDMA_SLAVE_SSI1_RX,
33 HPBDMA_SLAVE_SSI2_TX,
34 HPBDMA_SLAVE_SSI2_RX,
35 HPBDMA_SLAVE_SSI3_TX,
36 HPBDMA_SLAVE_SSI3_RX,
37 HPBDMA_SLAVE_SSI4_TX,
38 HPBDMA_SLAVE_SSI4_RX,
39 HPBDMA_SLAVE_SSI5_TX,
40 HPBDMA_SLAVE_SSI5_RX,
41 HPBDMA_SLAVE_SSI6_TX,
42 HPBDMA_SLAVE_SSI6_RX,
43 HPBDMA_SLAVE_SSI7_TX,
44 HPBDMA_SLAVE_SSI7_RX,
45 HPBDMA_SLAVE_SSI8_TX,
46 HPBDMA_SLAVE_SSI8_RX,
47 HPBDMA_SLAVE_HPBIF0_TX,
48 HPBDMA_SLAVE_HPBIF0_RX,
49 HPBDMA_SLAVE_HPBIF1_TX,
50 HPBDMA_SLAVE_HPBIF1_RX,
51 HPBDMA_SLAVE_HPBIF2_TX,
52 HPBDMA_SLAVE_HPBIF2_RX,
53 HPBDMA_SLAVE_HPBIF3_TX,
54 HPBDMA_SLAVE_HPBIF3_RX,
55 HPBDMA_SLAVE_HPBIF4_TX,
56 HPBDMA_SLAVE_HPBIF4_RX,
57 HPBDMA_SLAVE_HPBIF5_TX,
58 HPBDMA_SLAVE_HPBIF5_RX,
59 HPBDMA_SLAVE_HPBIF6_TX,
60 HPBDMA_SLAVE_HPBIF6_RX,
61 HPBDMA_SLAVE_HPBIF7_TX,
62 HPBDMA_SLAVE_HPBIF7_RX,
63 HPBDMA_SLAVE_HPBIF8_TX,
64 HPBDMA_SLAVE_HPBIF8_RX,
65 HPBDMA_SLAVE_USBFUNC_TX,
66 HPBDMA_SLAVE_USBFUNC_RX,
30}; 67};
31 68
32extern void r8a7778_add_standard_devices(void); 69extern void r8a7778_add_standard_devices(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 17af34ed89c8..b40e13631f6a 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -3,8 +3,6 @@
3 3
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5#include <linux/pm_domain.h> 5#include <linux/pm_domain.h>
6#include <linux/sh_eth.h>
7#include <linux/platform_data/camera-rcar.h>
8 6
9/* HPB-DMA slave IDs */ 7/* HPB-DMA slave IDs */
10enum { 8enum {
@@ -13,8 +11,6 @@ enum {
13 HPBDMA_SLAVE_SDHI0_RX, 11 HPBDMA_SLAVE_SDHI0_RX,
14}; 12};
15 13
16struct platform_device;
17
18struct r8a7779_pm_ch { 14struct r8a7779_pm_ch {
19 unsigned long chan_offs; 15 unsigned long chan_offs;
20 unsigned int chan_bit; 16 unsigned int chan_bit;
@@ -40,9 +36,6 @@ extern void r8a7779_earlytimer_init(void);
40extern void r8a7779_add_early_devices(void); 36extern void r8a7779_add_early_devices(void);
41extern void r8a7779_add_standard_devices(void); 37extern void r8a7779_add_standard_devices(void);
42extern void r8a7779_add_standard_devices_dt(void); 38extern void r8a7779_add_standard_devices_dt(void);
43extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata);
44extern void r8a7779_add_vin_device(int idx,
45 struct rcar_vin_platform_data *pdata);
46extern void r8a7779_init_late(void); 39extern void r8a7779_init_late(void);
47extern void r8a7779_clock_init(void); 40extern void r8a7779_clock_init(void);
48extern void r8a7779_pinmux_init(void); 41extern void r8a7779_pinmux_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/include/mach/r8a7791.h
index 051ead3c286e..200fa699f730 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7791.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7791.h
@@ -4,6 +4,7 @@
4void r8a7791_add_standard_devices(void); 4void r8a7791_add_standard_devices(void);
5void r8a7791_add_dt_devices(void); 5void r8a7791_add_dt_devices(void);
6void r8a7791_clock_init(void); 6void r8a7791_clock_init(void);
7void r8a7791_pinmux_init(void);
7void r8a7791_init_early(void); 8void r8a7791_init_early(void);
8extern struct smp_operations r8a7791_smp_ops; 9extern struct smp_operations r8a7791_smp_ops;
9 10
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index 3ad531caf4f0..c8f2a1a69a52 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -16,24 +16,15 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */ 18 */
19#include <linux/clk-provider.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/platform_device.h>
24#include <linux/platform_data/gpio-em.h>
25#include <linux/of_platform.h> 22#include <linux/of_platform.h>
26#include <linux/delay.h>
27#include <linux/input.h>
28#include <linux/io.h>
29#include <linux/irqchip/arm-gic.h>
30#include <mach/common.h> 23#include <mach/common.h>
31#include <mach/emev2.h> 24#include <mach/emev2.h>
32#include <mach/irqs.h>
33#include <asm/mach-types.h> 25#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
35#include <asm/mach/map.h> 27#include <asm/mach/map.h>
36#include <asm/mach/time.h>
37 28
38static struct map_desc emev2_io_desc[] __initdata = { 29static struct map_desc emev2_io_desc[] __initdata = {
39#ifdef CONFIG_SMP 30#ifdef CONFIG_SMP
@@ -52,150 +43,20 @@ void __init emev2_map_io(void)
52 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc)); 43 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
53} 44}
54 45
55/* UART */
56static struct resource uart0_resources[] = {
57 DEFINE_RES_MEM(0xe1020000, 0x38),
58 DEFINE_RES_IRQ(40),
59};
60
61static struct resource uart1_resources[] = {
62 DEFINE_RES_MEM(0xe1030000, 0x38),
63 DEFINE_RES_IRQ(41),
64};
65
66static struct resource uart2_resources[] = {
67 DEFINE_RES_MEM(0xe1040000, 0x38),
68 DEFINE_RES_IRQ(42),
69};
70
71static struct resource uart3_resources[] = {
72 DEFINE_RES_MEM(0xe1050000, 0x38),
73 DEFINE_RES_IRQ(43),
74};
75
76#define emev2_register_uart(idx) \
77 platform_device_register_simple("serial8250-em", idx, \
78 uart##idx##_resources, \
79 ARRAY_SIZE(uart##idx##_resources))
80
81/* STI */
82static struct resource sti_resources[] = {
83 DEFINE_RES_MEM(0xe0180000, 0x54),
84 DEFINE_RES_IRQ(157),
85};
86
87#define emev2_register_sti() \
88 platform_device_register_simple("em_sti", 0, \
89 sti_resources, \
90 ARRAY_SIZE(sti_resources))
91
92/* GIO */
93static struct gpio_em_config gio0_config = {
94 .gpio_base = 0,
95 .irq_base = EMEV2_GPIO_IRQ(0),
96 .number_of_pins = 32,
97};
98
99static struct resource gio0_resources[] = {
100 DEFINE_RES_MEM(0xe0050000, 0x2c),
101 DEFINE_RES_MEM(0xe0050040, 0x20),
102 DEFINE_RES_IRQ(99),
103 DEFINE_RES_IRQ(100),
104};
105
106static struct gpio_em_config gio1_config = {
107 .gpio_base = 32,
108 .irq_base = EMEV2_GPIO_IRQ(32),
109 .number_of_pins = 32,
110};
111
112static struct resource gio1_resources[] = {
113 DEFINE_RES_MEM(0xe0050080, 0x2c),
114 DEFINE_RES_MEM(0xe00500c0, 0x20),
115 DEFINE_RES_IRQ(101),
116 DEFINE_RES_IRQ(102),
117};
118
119static struct gpio_em_config gio2_config = {
120 .gpio_base = 64,
121 .irq_base = EMEV2_GPIO_IRQ(64),
122 .number_of_pins = 32,
123};
124
125static struct resource gio2_resources[] = {
126 DEFINE_RES_MEM(0xe0050100, 0x2c),
127 DEFINE_RES_MEM(0xe0050140, 0x20),
128 DEFINE_RES_IRQ(103),
129 DEFINE_RES_IRQ(104),
130};
131
132static struct gpio_em_config gio3_config = {
133 .gpio_base = 96,
134 .irq_base = EMEV2_GPIO_IRQ(96),
135 .number_of_pins = 32,
136};
137
138static struct resource gio3_resources[] = {
139 DEFINE_RES_MEM(0xe0050180, 0x2c),
140 DEFINE_RES_MEM(0xe00501c0, 0x20),
141 DEFINE_RES_IRQ(105),
142 DEFINE_RES_IRQ(106),
143};
144
145static struct gpio_em_config gio4_config = {
146 .gpio_base = 128,
147 .irq_base = EMEV2_GPIO_IRQ(128),
148 .number_of_pins = 31,
149};
150
151static struct resource gio4_resources[] = {
152 DEFINE_RES_MEM(0xe0050200, 0x2c),
153 DEFINE_RES_MEM(0xe0050240, 0x20),
154 DEFINE_RES_IRQ(107),
155 DEFINE_RES_IRQ(108),
156};
157
158#define emev2_register_gio(idx) \
159 platform_device_register_resndata(&platform_bus, "em_gio", \
160 idx, gio##idx##_resources, \
161 ARRAY_SIZE(gio##idx##_resources), \
162 &gio##idx##_config, \
163 sizeof(struct gpio_em_config))
164
165static struct resource pmu_resources[] = {
166 DEFINE_RES_IRQ(152),
167 DEFINE_RES_IRQ(153),
168};
169
170#define emev2_register_pmu() \
171 platform_device_register_simple("arm-pmu", -1, \
172 pmu_resources, \
173 ARRAY_SIZE(pmu_resources))
174
175void __init emev2_add_standard_devices(void)
176{
177 if (!IS_ENABLED(CONFIG_COMMON_CLK))
178 emev2_clock_init();
179
180 emev2_register_uart(0);
181 emev2_register_uart(1);
182 emev2_register_uart(2);
183 emev2_register_uart(3);
184 emev2_register_sti();
185 emev2_register_gio(0);
186 emev2_register_gio(1);
187 emev2_register_gio(2);
188 emev2_register_gio(3);
189 emev2_register_gio(4);
190 emev2_register_pmu();
191}
192
193void __init emev2_init_delay(void) 46void __init emev2_init_delay(void)
194{ 47{
195 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */ 48 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
196} 49}
197 50
198#ifdef CONFIG_USE_OF 51static void __init emev2_add_standard_devices_dt(void)
52{
53#ifdef CONFIG_COMMON_CLK
54 of_clk_init(NULL);
55#else
56 emev2_clock_init();
57#endif
58 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
59}
199 60
200static const char *emev2_boards_compat_dt[] __initdata = { 61static const char *emev2_boards_compat_dt[] __initdata = {
201 "renesas,emev2", 62 "renesas,emev2",
@@ -206,7 +67,7 @@ DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
206 .smp = smp_ops(emev2_smp_ops), 67 .smp = smp_ops(emev2_smp_ops),
207 .map_io = emev2_map_io, 68 .map_io = emev2_map_io,
208 .init_early = emev2_init_delay, 69 .init_early = emev2_init_delay,
70 .init_machine = emev2_add_standard_devices_dt,
71 .init_late = shmobile_init_late,
209 .dt_compat = emev2_boards_compat_dt, 72 .dt_compat = emev2_boards_compat_dt,
210MACHINE_END 73MACHINE_END
211
212#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index d4eb509a1c87..9c0b3a9d5f7a 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -22,52 +22,76 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/serial_sci.h> 24#include <linux/serial_sci.h>
25#include <linux/sh_timer.h>
25#include <mach/common.h> 26#include <mach/common.h>
26#include <mach/irqs.h> 27#include <mach/irqs.h>
27#include <mach/r7s72100.h> 28#include <mach/r7s72100.h>
28#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
29 30
30#define SCIF_DATA(index, baseaddr, irq) \ 31#define R7S72100_SCIF(index, baseaddr, irq) \
31[index] = { \ 32static const struct plat_sci_port scif##index##_platform_data = { \
32 .type = PORT_SCIF, \ 33 .type = PORT_SCIF, \
33 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, \ 34 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, \
34 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \ 35 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
35 .scbrr_algo_id = SCBRR_ALGO_2, \
36 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \ 36 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \
37 SCSCR_REIE, \ 37 SCSCR_REIE, \
38 .mapbase = baseaddr, \ 38}; \
39 .irqs = { irq + 1, irq + 2, irq + 3, irq }, \ 39 \
40} 40static struct resource scif##index##_resources[] = { \
41 DEFINE_RES_MEM(baseaddr, 0x100), \
42 DEFINE_RES_IRQ(irq + 1), \
43 DEFINE_RES_IRQ(irq + 2), \
44 DEFINE_RES_IRQ(irq + 3), \
45 DEFINE_RES_IRQ(irq), \
46} \
47
48R7S72100_SCIF(0, 0xe8007000, gic_iid(221));
49R7S72100_SCIF(1, 0xe8007800, gic_iid(225));
50R7S72100_SCIF(2, 0xe8008000, gic_iid(229));
51R7S72100_SCIF(3, 0xe8008800, gic_iid(233));
52R7S72100_SCIF(4, 0xe8009000, gic_iid(237));
53R7S72100_SCIF(5, 0xe8009800, gic_iid(241));
54R7S72100_SCIF(6, 0xe800a000, gic_iid(245));
55R7S72100_SCIF(7, 0xe800a800, gic_iid(249));
41 56
42enum { SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5, SCIF6, SCIF7 }; 57#define r7s72100_register_scif(index) \
58 platform_device_register_resndata(&platform_bus, "sh-sci", index, \
59 scif##index##_resources, \
60 ARRAY_SIZE(scif##index##_resources), \
61 &scif##index##_platform_data, \
62 sizeof(scif##index##_platform_data))
43 63
44static const struct plat_sci_port scif[] __initconst = { 64
45 SCIF_DATA(SCIF0, 0xe8007000, gic_iid(221)), /* SCIF0 */ 65static struct sh_timer_config mtu2_0_platform_data __initdata = {
46 SCIF_DATA(SCIF1, 0xe8007800, gic_iid(225)), /* SCIF1 */ 66 .name = "MTU2_0",
47 SCIF_DATA(SCIF2, 0xe8008000, gic_iid(229)), /* SCIF2 */ 67 .timer_bit = 0,
48 SCIF_DATA(SCIF3, 0xe8008800, gic_iid(233)), /* SCIF3 */ 68 .channel_offset = -0x80,
49 SCIF_DATA(SCIF4, 0xe8009000, gic_iid(237)), /* SCIF4 */ 69 .clockevent_rating = 200,
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}; 70};
54 71
55static inline void r7s72100_register_scif(int idx) 72static struct resource mtu2_0_resources[] __initdata = {
56{ 73 DEFINE_RES_MEM(0xfcff0300, 0x27),
57 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx], 74 DEFINE_RES_IRQ(gic_iid(139)), /* MTU2 TGI0A */
58 sizeof(struct plat_sci_port)); 75};
59} 76
77#define r7s72100_register_mtu2(idx) \
78 platform_device_register_resndata(&platform_bus, "sh_mtu2", \
79 idx, mtu2_##idx##_resources, \
80 ARRAY_SIZE(mtu2_##idx##_resources), \
81 &mtu2_##idx##_platform_data, \
82 sizeof(struct sh_timer_config))
60 83
61void __init r7s72100_add_dt_devices(void) 84void __init r7s72100_add_dt_devices(void)
62{ 85{
63 r7s72100_register_scif(SCIF0); 86 r7s72100_register_scif(0);
64 r7s72100_register_scif(SCIF1); 87 r7s72100_register_scif(1);
65 r7s72100_register_scif(SCIF2); 88 r7s72100_register_scif(2);
66 r7s72100_register_scif(SCIF3); 89 r7s72100_register_scif(3);
67 r7s72100_register_scif(SCIF4); 90 r7s72100_register_scif(4);
68 r7s72100_register_scif(SCIF5); 91 r7s72100_register_scif(5);
69 r7s72100_register_scif(SCIF6); 92 r7s72100_register_scif(6);
70 r7s72100_register_scif(SCIF7); 93 r7s72100_register_scif(7);
94 r7s72100_register_mtu2(0);
71} 95}
72 96
73void __init r7s72100_init_early(void) 97void __init r7s72100_init_early(void)
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index b0f2749071be..cd36f8078325 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -40,41 +40,39 @@ void __init r8a73a4_pinmux_init(void)
40 ARRAY_SIZE(pfc_resources)); 40 ARRAY_SIZE(pfc_resources));
41} 41}
42 42
43#define SCIF_COMMON(scif_type, baseaddr, irq) \ 43#define R8A73A4_SCIF(scif_type, _scscr, index, baseaddr, irq) \
44static struct plat_sci_port scif##index##_platform_data = { \
44 .type = scif_type, \ 45 .type = scif_type, \
45 .mapbase = baseaddr, \
46 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \ 46 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
47 .scbrr_algo_id = SCBRR_ALGO_4, \ 47 .scscr = _scscr, \
48 .irqs = SCIx_IRQ_MUXED(irq) 48}; \
49 49 \
50#define SCIFA_DATA(index, baseaddr, irq) \ 50static struct resource scif##index##_resources[] = { \
51[index] = { \ 51 DEFINE_RES_MEM(baseaddr, 0x100), \
52 SCIF_COMMON(PORT_SCIFA, baseaddr, irq), \ 52 DEFINE_RES_IRQ(irq), \
53 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \
54} 53}
55 54
56#define SCIFB_DATA(index, baseaddr, irq) \ 55#define R8A73A4_SCIFA(index, baseaddr, irq) \
57[index] = { \ 56 R8A73A4_SCIF(PORT_SCIFA, SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \
58 SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \ 57 index, baseaddr, irq)
59 .scscr = SCSCR_RE | SCSCR_TE, \
60}
61 58
62enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFB3 }; 59#define R8A73A4_SCIFB(index, baseaddr, irq) \
60 R8A73A4_SCIF(PORT_SCIFB, SCSCR_RE | SCSCR_TE, \
61 index, baseaddr, irq)
63 62
64static const struct plat_sci_port scif[] = { 63R8A73A4_SCIFA(0, 0xe6c40000, gic_spi(144)); /* SCIFA0 */
65 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ 64R8A73A4_SCIFA(1, 0xe6c50000, gic_spi(145)); /* SCIFA1 */
66 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ 65R8A73A4_SCIFB(2, 0xe6c20000, gic_spi(148)); /* SCIFB0 */
67 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */ 66R8A73A4_SCIFB(3, 0xe6c30000, gic_spi(149)); /* SCIFB1 */
68 SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */ 67R8A73A4_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
69 SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */ 68R8A73A4_SCIFB(5, 0xe6cf0000, gic_spi(151)); /* SCIFB3 */
70 SCIFB_DATA(SCIFB3, 0xe6cf0000, gic_spi(151)), /* SCIFB3 */
71};
72 69
73static inline void r8a73a4_register_scif(int idx) 70#define r8a73a4_register_scif(index) \
74{ 71 platform_device_register_resndata(&platform_bus, "sh-sci", index, \
75 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx], 72 scif##index##_resources, \
76 sizeof(struct plat_sci_port)); 73 ARRAY_SIZE(scif##index##_resources), \
77} 74 &scif##index##_platform_data, \
75 sizeof(scif##index##_platform_data))
78 76
79static const struct renesas_irqc_config irqc0_data = { 77static const struct renesas_irqc_config irqc0_data = {
80 .irq_base = irq_pin(0), /* IRQ0 -> IRQ31 */ 78 .irq_base = irq_pin(0), /* IRQ0 -> IRQ31 */
@@ -192,12 +190,12 @@ static struct resource cmt10_resources[] = {
192 190
193void __init r8a73a4_add_dt_devices(void) 191void __init r8a73a4_add_dt_devices(void)
194{ 192{
195 r8a73a4_register_scif(SCIFA0); 193 r8a73a4_register_scif(0);
196 r8a73a4_register_scif(SCIFA1); 194 r8a73a4_register_scif(1);
197 r8a73a4_register_scif(SCIFB0); 195 r8a73a4_register_scif(2);
198 r8a73a4_register_scif(SCIFB1); 196 r8a73a4_register_scif(3);
199 r8a73a4_register_scif(SCIFB2); 197 r8a73a4_register_scif(4);
200 r8a73a4_register_scif(SCIFB3); 198 r8a73a4_register_scif(5);
201 r8a7790_register_cmt(10); 199 r8a7790_register_cmt(10);
202} 200}
203 201
@@ -275,7 +273,7 @@ static const struct sh_dmae_pdata dma_pdata = {
275 273
276static struct resource dma_resources[] = { 274static struct resource dma_resources[] = {
277 DEFINE_RES_MEM(0xe6700020, 0x89e0), 275 DEFINE_RES_MEM(0xe6700020, 0x89e0),
278 DEFINE_RES_IRQ_NAMED(gic_spi(220), "error_irq"), 276 DEFINE_RES_IRQ(gic_spi(220)),
279 { 277 {
280 /* IRQ for channels 0-19 */ 278 /* IRQ for channels 0-19 */
281 .start = gic_spi(200), 279 .start = gic_spi(200),
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index b7d4b2c3bc29..8f3c68101d59 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -203,167 +203,38 @@ static struct platform_device irqpin3_device = {
203 }, 203 },
204}; 204};
205 205
206/* SCIFA0 */ 206/* SCIF */
207static struct plat_sci_port scif0_platform_data = { 207#define R8A7740_SCIF(scif_type, index, baseaddr, irq) \
208 .mapbase = 0xe6c40000, 208static struct plat_sci_port scif##index##_platform_data = { \
209 .flags = UPF_BOOT_AUTOCONF, 209 .type = scif_type, \
210 .scscr = SCSCR_RE | SCSCR_TE, 210 .flags = UPF_BOOT_AUTOCONF, \
211 .scbrr_algo_id = SCBRR_ALGO_4, 211 .scscr = SCSCR_RE | SCSCR_TE, \
212 .type = PORT_SCIFA, 212}; \
213 .irqs = SCIx_IRQ_MUXED(gic_spi(100)), 213 \
214}; 214static struct resource scif##index##_resources[] = { \
215 215 DEFINE_RES_MEM(baseaddr, 0x100), \
216static struct platform_device scif0_device = { 216 DEFINE_RES_IRQ(irq), \
217 .name = "sh-sci", 217}; \
218 .id = 0, 218 \
219 .dev = { 219static struct platform_device scif##index##_device = { \
220 .platform_data = &scif0_platform_data, 220 .name = "sh-sci", \
221 }, 221 .id = index, \
222}; 222 .resource = scif##index##_resources, \
223 223 .num_resources = ARRAY_SIZE(scif##index##_resources), \
224/* SCIFA1 */ 224 .dev = { \
225static struct plat_sci_port scif1_platform_data = { 225 .platform_data = &scif##index##_platform_data, \
226 .mapbase = 0xe6c50000, 226 }, \
227 .flags = UPF_BOOT_AUTOCONF, 227}
228 .scscr = SCSCR_RE | SCSCR_TE,
229 .scbrr_algo_id = SCBRR_ALGO_4,
230 .type = PORT_SCIFA,
231 .irqs = SCIx_IRQ_MUXED(gic_spi(101)),
232};
233
234static struct platform_device scif1_device = {
235 .name = "sh-sci",
236 .id = 1,
237 .dev = {
238 .platform_data = &scif1_platform_data,
239 },
240};
241
242/* SCIFA2 */
243static struct plat_sci_port scif2_platform_data = {
244 .mapbase = 0xe6c60000,
245 .flags = UPF_BOOT_AUTOCONF,
246 .scscr = SCSCR_RE | SCSCR_TE,
247 .scbrr_algo_id = SCBRR_ALGO_4,
248 .type = PORT_SCIFA,
249 .irqs = SCIx_IRQ_MUXED(gic_spi(102)),
250};
251
252static struct platform_device scif2_device = {
253 .name = "sh-sci",
254 .id = 2,
255 .dev = {
256 .platform_data = &scif2_platform_data,
257 },
258};
259
260/* SCIFA3 */
261static struct plat_sci_port scif3_platform_data = {
262 .mapbase = 0xe6c70000,
263 .flags = UPF_BOOT_AUTOCONF,
264 .scscr = SCSCR_RE | SCSCR_TE,
265 .scbrr_algo_id = SCBRR_ALGO_4,
266 .type = PORT_SCIFA,
267 .irqs = SCIx_IRQ_MUXED(gic_spi(103)),
268};
269
270static struct platform_device scif3_device = {
271 .name = "sh-sci",
272 .id = 3,
273 .dev = {
274 .platform_data = &scif3_platform_data,
275 },
276};
277
278/* SCIFA4 */
279static struct plat_sci_port scif4_platform_data = {
280 .mapbase = 0xe6c80000,
281 .flags = UPF_BOOT_AUTOCONF,
282 .scscr = SCSCR_RE | SCSCR_TE,
283 .scbrr_algo_id = SCBRR_ALGO_4,
284 .type = PORT_SCIFA,
285 .irqs = SCIx_IRQ_MUXED(gic_spi(104)),
286};
287
288static struct platform_device scif4_device = {
289 .name = "sh-sci",
290 .id = 4,
291 .dev = {
292 .platform_data = &scif4_platform_data,
293 },
294};
295
296/* SCIFA5 */
297static struct plat_sci_port scif5_platform_data = {
298 .mapbase = 0xe6cb0000,
299 .flags = UPF_BOOT_AUTOCONF,
300 .scscr = SCSCR_RE | SCSCR_TE,
301 .scbrr_algo_id = SCBRR_ALGO_4,
302 .type = PORT_SCIFA,
303 .irqs = SCIx_IRQ_MUXED(gic_spi(105)),
304};
305
306static struct platform_device scif5_device = {
307 .name = "sh-sci",
308 .id = 5,
309 .dev = {
310 .platform_data = &scif5_platform_data,
311 },
312};
313
314/* SCIFA6 */
315static struct plat_sci_port scif6_platform_data = {
316 .mapbase = 0xe6cc0000,
317 .flags = UPF_BOOT_AUTOCONF,
318 .scscr = SCSCR_RE | SCSCR_TE,
319 .scbrr_algo_id = SCBRR_ALGO_4,
320 .type = PORT_SCIFA,
321 .irqs = SCIx_IRQ_MUXED(gic_spi(106)),
322};
323
324static struct platform_device scif6_device = {
325 .name = "sh-sci",
326 .id = 6,
327 .dev = {
328 .platform_data = &scif6_platform_data,
329 },
330};
331
332/* SCIFA7 */
333static struct plat_sci_port scif7_platform_data = {
334 .mapbase = 0xe6cd0000,
335 .flags = UPF_BOOT_AUTOCONF,
336 .scscr = SCSCR_RE | SCSCR_TE,
337 .scbrr_algo_id = SCBRR_ALGO_4,
338 .type = PORT_SCIFA,
339 .irqs = SCIx_IRQ_MUXED(gic_spi(107)),
340};
341
342static struct platform_device scif7_device = {
343 .name = "sh-sci",
344 .id = 7,
345 .dev = {
346 .platform_data = &scif7_platform_data,
347 },
348};
349
350/* SCIFB */
351static struct plat_sci_port scifb_platform_data = {
352 .mapbase = 0xe6c30000,
353 .flags = UPF_BOOT_AUTOCONF,
354 .scscr = SCSCR_RE | SCSCR_TE,
355 .scbrr_algo_id = SCBRR_ALGO_4,
356 .type = PORT_SCIFB,
357 .irqs = SCIx_IRQ_MUXED(gic_spi(108)),
358};
359 228
360static struct platform_device scifb_device = { 229R8A7740_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(100));
361 .name = "sh-sci", 230R8A7740_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(101));
362 .id = 8, 231R8A7740_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(102));
363 .dev = { 232R8A7740_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(103));
364 .platform_data = &scifb_platform_data, 233R8A7740_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(104));
365 }, 234R8A7740_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(105));
366}; 235R8A7740_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(106));
236R8A7740_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(107));
237R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108));
367 238
368/* CMT */ 239/* CMT */
369static struct sh_timer_config cmt10_platform_data = { 240static struct sh_timer_config cmt10_platform_data = {
@@ -528,7 +399,7 @@ static struct platform_device *r8a7740_devices_dt[] __initdata = {
528 &scif5_device, 399 &scif5_device,
529 &scif6_device, 400 &scif6_device,
530 &scif7_device, 401 &scif7_device,
531 &scifb_device, 402 &scif8_device,
532 &cmt10_device, 403 &cmt10_device,
533}; 404};
534 405
@@ -981,7 +852,7 @@ void __init r8a7740_add_standard_devices(void)
981 rmobile_add_device_to_domain("A3SP", &scif5_device); 852 rmobile_add_device_to_domain("A3SP", &scif5_device);
982 rmobile_add_device_to_domain("A3SP", &scif6_device); 853 rmobile_add_device_to_domain("A3SP", &scif6_device);
983 rmobile_add_device_to_domain("A3SP", &scif7_device); 854 rmobile_add_device_to_domain("A3SP", &scif7_device);
984 rmobile_add_device_to_domain("A3SP", &scifb_device); 855 rmobile_add_device_to_domain("A3SP", &scif8_device);
985 rmobile_add_device_to_domain("A3SP", &i2c1_device); 856 rmobile_add_device_to_domain("A3SP", &i2c1_device);
986} 857}
987 858
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 03fcc5974ef9..6d694526e4ca 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -44,24 +44,31 @@
44#include <asm/hardware/cache-l2x0.h> 44#include <asm/hardware/cache-l2x0.h>
45 45
46/* SCIF */ 46/* SCIF */
47#define SCIF_INFO(baseaddr, irq) \ 47#define R8A7778_SCIF(index, baseaddr, irq) \
48{ \ 48static struct plat_sci_port scif##index##_platform_data = { \
49 .mapbase = baseaddr, \
50 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \ 49 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
51 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, \ 50 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, \
52 .scbrr_algo_id = SCBRR_ALGO_2, \
53 .type = PORT_SCIF, \ 51 .type = PORT_SCIF, \
54 .irqs = SCIx_IRQ_MUXED(irq), \ 52}; \
53 \
54static struct resource scif##index##_resources[] = { \
55 DEFINE_RES_MEM(baseaddr, 0x100), \
56 DEFINE_RES_IRQ(irq), \
55} 57}
56 58
57static struct plat_sci_port scif_platform_data[] __initdata = { 59R8A7778_SCIF(0, 0xffe40000, gic_iid(0x66));
58 SCIF_INFO(0xffe40000, gic_iid(0x66)), 60R8A7778_SCIF(1, 0xffe41000, gic_iid(0x67));
59 SCIF_INFO(0xffe41000, gic_iid(0x67)), 61R8A7778_SCIF(2, 0xffe42000, gic_iid(0x68));
60 SCIF_INFO(0xffe42000, gic_iid(0x68)), 62R8A7778_SCIF(3, 0xffe43000, gic_iid(0x69));
61 SCIF_INFO(0xffe43000, gic_iid(0x69)), 63R8A7778_SCIF(4, 0xffe44000, gic_iid(0x6a));
62 SCIF_INFO(0xffe44000, gic_iid(0x6a)), 64R8A7778_SCIF(5, 0xffe45000, gic_iid(0x6b));
63 SCIF_INFO(0xffe45000, gic_iid(0x6b)), 65
64}; 66#define r8a7778_register_scif(index) \
67 platform_device_register_resndata(&platform_bus, "sh-sci", index, \
68 scif##index##_resources, \
69 ARRAY_SIZE(scif##index##_resources), \
70 &scif##index##_platform_data, \
71 sizeof(scif##index##_platform_data))
65 72
66/* TMU */ 73/* TMU */
67static struct resource sh_tmu0_resources[] __initdata = { 74static struct resource sh_tmu0_resources[] __initdata = {
@@ -287,8 +294,6 @@ static void __init r8a7778_register_hspi(int id)
287 294
288void __init r8a7778_add_dt_devices(void) 295void __init r8a7778_add_dt_devices(void)
289{ 296{
290 int i;
291
292#ifdef CONFIG_CACHE_L2X0 297#ifdef CONFIG_CACHE_L2X0
293 void __iomem *base = ioremap_nocache(0xf0100000, 0x1000); 298 void __iomem *base = ioremap_nocache(0xf0100000, 0x1000);
294 if (base) { 299 if (base) {
@@ -300,11 +305,12 @@ void __init r8a7778_add_dt_devices(void)
300 } 305 }
301#endif 306#endif
302 307
303 for (i = 0; i < ARRAY_SIZE(scif_platform_data); i++) 308 r8a7778_register_scif(0);
304 platform_device_register_data(&platform_bus, "sh-sci", i, 309 r8a7778_register_scif(1);
305 &scif_platform_data[i], 310 r8a7778_register_scif(2);
306 sizeof(struct plat_sci_port)); 311 r8a7778_register_scif(3);
307 312 r8a7778_register_scif(4);
313 r8a7778_register_scif(5);
308 r8a7778_register_tmu(0); 314 r8a7778_register_tmu(0);
309 r8a7778_register_tmu(1); 315 r8a7778_register_tmu(1);
310} 316}
@@ -319,6 +325,52 @@ void __init r8a7778_add_dt_devices(void)
319#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */ 325#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */
320#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */ 326#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
321 327
328#define HPBDMA_SSI(_id) \
329{ \
330 .id = HPBDMA_SLAVE_SSI## _id ##_TX, \
331 .addr = 0xffd91008 + (_id * 0x40), \
332 .dcr = HPB_DMAE_DCR_CT | \
333 HPB_DMAE_DCR_DIP | \
334 HPB_DMAE_DCR_SPDS_32BIT | \
335 HPB_DMAE_DCR_DMDL | \
336 HPB_DMAE_DCR_DPDS_32BIT, \
337 .port = _id + (_id << 8), \
338 .dma_ch = (28 + _id), \
339}, { \
340 .id = HPBDMA_SLAVE_SSI## _id ##_RX, \
341 .addr = 0xffd9100c + (_id * 0x40), \
342 .dcr = HPB_DMAE_DCR_CT | \
343 HPB_DMAE_DCR_DIP | \
344 HPB_DMAE_DCR_SMDL | \
345 HPB_DMAE_DCR_SPDS_32BIT | \
346 HPB_DMAE_DCR_DPDS_32BIT, \
347 .port = _id + (_id << 8), \
348 .dma_ch = (28 + _id), \
349}
350
351#define HPBDMA_HPBIF(_id) \
352{ \
353 .id = HPBDMA_SLAVE_HPBIF## _id ##_TX, \
354 .addr = 0xffda0000 + (_id * 0x1000), \
355 .dcr = HPB_DMAE_DCR_CT | \
356 HPB_DMAE_DCR_DIP | \
357 HPB_DMAE_DCR_SPDS_32BIT | \
358 HPB_DMAE_DCR_DMDL | \
359 HPB_DMAE_DCR_DPDS_32BIT, \
360 .port = 0x1111, \
361 .dma_ch = (28 + _id), \
362}, { \
363 .id = HPBDMA_SLAVE_HPBIF## _id ##_RX, \
364 .addr = 0xffda0000 + (_id * 0x1000), \
365 .dcr = HPB_DMAE_DCR_CT | \
366 HPB_DMAE_DCR_DIP | \
367 HPB_DMAE_DCR_SMDL | \
368 HPB_DMAE_DCR_SPDS_32BIT | \
369 HPB_DMAE_DCR_DPDS_32BIT, \
370 .port = 0x1111, \
371 .dma_ch = (28 + _id), \
372}
373
322static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = { 374static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
323 { 375 {
324 .id = HPBDMA_SLAVE_SDHI0_TX, 376 .id = HPBDMA_SLAVE_SDHI0_TX,
@@ -348,12 +400,86 @@ static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
348 .port = 0x0D0C, 400 .port = 0x0D0C,
349 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE, 401 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
350 .dma_ch = 22, 402 .dma_ch = 22,
403 }, {
404 .id = HPBDMA_SLAVE_USBFUNC_TX, /* for D0 */
405 .addr = 0xffe60018,
406 .dcr = HPB_DMAE_DCR_SPDS_32BIT |
407 HPB_DMAE_DCR_DMDL |
408 HPB_DMAE_DCR_DPDS_32BIT,
409 .port = 0x0000,
410 .dma_ch = 14,
411 }, {
412 .id = HPBDMA_SLAVE_USBFUNC_RX, /* for D1 */
413 .addr = 0xffe6001c,
414 .dcr = HPB_DMAE_DCR_SMDL |
415 HPB_DMAE_DCR_SPDS_32BIT |
416 HPB_DMAE_DCR_DPDS_32BIT,
417 .port = 0x0101,
418 .dma_ch = 15,
351 }, 419 },
420
421 HPBDMA_SSI(0),
422 HPBDMA_SSI(1),
423 HPBDMA_SSI(2),
424 HPBDMA_SSI(3),
425 HPBDMA_SSI(4),
426 HPBDMA_SSI(5),
427 HPBDMA_SSI(6),
428 HPBDMA_SSI(7),
429 HPBDMA_SSI(8),
430
431 HPBDMA_HPBIF(0),
432 HPBDMA_HPBIF(1),
433 HPBDMA_HPBIF(2),
434 HPBDMA_HPBIF(3),
435 HPBDMA_HPBIF(4),
436 HPBDMA_HPBIF(5),
437 HPBDMA_HPBIF(6),
438 HPBDMA_HPBIF(7),
439 HPBDMA_HPBIF(8),
352}; 440};
353 441
354static const struct hpb_dmae_channel hpb_dmae_channels[] = { 442static const struct hpb_dmae_channel hpb_dmae_channels[] = {
443 HPB_DMAE_CHANNEL(0x7c, HPBDMA_SLAVE_USBFUNC_TX), /* ch. 14 */
444 HPB_DMAE_CHANNEL(0x7c, HPBDMA_SLAVE_USBFUNC_RX), /* ch. 15 */
355 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */ 445 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
356 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */ 446 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
447 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI0_TX), /* ch. 28 */
448 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI0_RX), /* ch. 28 */
449 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_TX), /* ch. 28 */
450 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_RX), /* ch. 28 */
451 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI1_TX), /* ch. 29 */
452 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI1_RX), /* ch. 29 */
453 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_TX), /* ch. 29 */
454 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_RX), /* ch. 29 */
455 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI2_TX), /* ch. 30 */
456 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI2_RX), /* ch. 30 */
457 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_TX), /* ch. 30 */
458 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_RX), /* ch. 30 */
459 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI3_TX), /* ch. 31 */
460 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI3_RX), /* ch. 31 */
461 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_TX), /* ch. 31 */
462 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_RX), /* ch. 31 */
463 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI4_TX), /* ch. 32 */
464 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI4_RX), /* ch. 32 */
465 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_TX), /* ch. 32 */
466 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_RX), /* ch. 32 */
467 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI5_TX), /* ch. 33 */
468 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI5_RX), /* ch. 33 */
469 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_TX), /* ch. 33 */
470 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_RX), /* ch. 33 */
471 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI6_TX), /* ch. 34 */
472 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI6_RX), /* ch. 34 */
473 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_TX), /* ch. 34 */
474 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_RX), /* ch. 34 */
475 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI7_TX), /* ch. 35 */
476 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI7_RX), /* ch. 35 */
477 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_TX), /* ch. 35 */
478 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_RX), /* ch. 35 */
479 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI8_TX), /* ch. 36 */
480 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI8_RX), /* ch. 36 */
481 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_TX), /* ch. 36 */
482 HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_RX), /* ch. 36 */
357}; 483};
358 484
359static struct hpb_dmae_pdata dma_platform_data __initdata = { 485static struct hpb_dmae_pdata dma_platform_data __initdata = {
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 13049e9d691c..8e860b36997a 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -188,107 +188,35 @@ void __init r8a7779_pinmux_init(void)
188 ARRAY_SIZE(r8a7779_pinctrl_devices)); 188 ARRAY_SIZE(r8a7779_pinctrl_devices));
189} 189}
190 190
191static struct plat_sci_port scif0_platform_data = { 191/* SCIF */
192 .mapbase = 0xffe40000, 192#define R8A7779_SCIF(index, baseaddr, irq) \
193 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 193static struct plat_sci_port scif##index##_platform_data = { \
194 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 194 .type = PORT_SCIF, \
195 .scbrr_algo_id = SCBRR_ALGO_2, 195 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
196 .type = PORT_SCIF, 196 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, \
197 .irqs = SCIx_IRQ_MUXED(gic_iid(0x78)), 197}; \
198}; 198 \
199 199static struct resource scif##index##_resources[] = { \
200static struct platform_device scif0_device = { 200 DEFINE_RES_MEM(baseaddr, 0x100), \
201 .name = "sh-sci", 201 DEFINE_RES_IRQ(irq), \
202 .id = 0, 202}; \
203 .dev = { 203 \
204 .platform_data = &scif0_platform_data, 204static struct platform_device scif##index##_device = { \
205 }, 205 .name = "sh-sci", \
206}; 206 .id = index, \
207 207 .resource = scif##index##_resources, \
208static struct plat_sci_port scif1_platform_data = { 208 .num_resources = ARRAY_SIZE(scif##index##_resources), \
209 .mapbase = 0xffe41000, 209 .dev = { \
210 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 210 .platform_data = &scif##index##_platform_data, \
211 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 211 }, \
212 .scbrr_algo_id = SCBRR_ALGO_2, 212}
213 .type = PORT_SCIF,
214 .irqs = SCIx_IRQ_MUXED(gic_iid(0x79)),
215};
216
217static struct platform_device scif1_device = {
218 .name = "sh-sci",
219 .id = 1,
220 .dev = {
221 .platform_data = &scif1_platform_data,
222 },
223};
224
225static struct plat_sci_port scif2_platform_data = {
226 .mapbase = 0xffe42000,
227 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
228 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
229 .scbrr_algo_id = SCBRR_ALGO_2,
230 .type = PORT_SCIF,
231 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7a)),
232};
233
234static struct platform_device scif2_device = {
235 .name = "sh-sci",
236 .id = 2,
237 .dev = {
238 .platform_data = &scif2_platform_data,
239 },
240};
241
242static struct plat_sci_port scif3_platform_data = {
243 .mapbase = 0xffe43000,
244 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
245 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
246 .scbrr_algo_id = SCBRR_ALGO_2,
247 .type = PORT_SCIF,
248 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7b)),
249};
250
251static struct platform_device scif3_device = {
252 .name = "sh-sci",
253 .id = 3,
254 .dev = {
255 .platform_data = &scif3_platform_data,
256 },
257};
258
259static struct plat_sci_port scif4_platform_data = {
260 .mapbase = 0xffe44000,
261 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
262 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
263 .scbrr_algo_id = SCBRR_ALGO_2,
264 .type = PORT_SCIF,
265 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7c)),
266};
267
268static struct platform_device scif4_device = {
269 .name = "sh-sci",
270 .id = 4,
271 .dev = {
272 .platform_data = &scif4_platform_data,
273 },
274};
275
276static struct plat_sci_port scif5_platform_data = {
277 .mapbase = 0xffe45000,
278 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
279 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
280 .scbrr_algo_id = SCBRR_ALGO_2,
281 .type = PORT_SCIF,
282 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7d)),
283};
284 213
285static struct platform_device scif5_device = { 214R8A7779_SCIF(0, 0xffe40000, gic_iid(0x78));
286 .name = "sh-sci", 215R8A7779_SCIF(1, 0xffe41000, gic_iid(0x79));
287 .id = 5, 216R8A7779_SCIF(2, 0xffe42000, gic_iid(0x7a));
288 .dev = { 217R8A7779_SCIF(3, 0xffe43000, gic_iid(0x7b));
289 .platform_data = &scif5_platform_data, 218R8A7779_SCIF(4, 0xffe44000, gic_iid(0x7c));
290 }, 219R8A7779_SCIF(5, 0xffe45000, gic_iid(0x7d));
291};
292 220
293/* TMU */ 221/* TMU */
294static struct sh_timer_config tmu00_platform_data = { 222static struct sh_timer_config tmu00_platform_data = {
@@ -598,45 +526,6 @@ static struct platform_device ohci1_device = {
598 .resource = ohci1_resources, 526 .resource = ohci1_resources,
599}; 527};
600 528
601/* Ether */
602static struct resource ether_resources[] __initdata = {
603 {
604 .start = 0xfde00000,
605 .end = 0xfde003ff,
606 .flags = IORESOURCE_MEM,
607 }, {
608 .start = gic_iid(0xb4),
609 .flags = IORESOURCE_IRQ,
610 },
611};
612
613#define R8A7779_VIN(idx) \
614static struct resource vin##idx##_resources[] __initdata = { \
615 DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \
616 DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \
617}; \
618 \
619static struct platform_device_info vin##idx##_info __initdata = { \
620 .parent = &platform_bus, \
621 .name = "r8a7779-vin", \
622 .id = idx, \
623 .res = vin##idx##_resources, \
624 .num_res = ARRAY_SIZE(vin##idx##_resources), \
625 .dma_mask = DMA_BIT_MASK(32), \
626}
627
628R8A7779_VIN(0);
629R8A7779_VIN(1);
630R8A7779_VIN(2);
631R8A7779_VIN(3);
632
633static struct platform_device_info *vin_info_table[] __initdata = {
634 &vin0_info,
635 &vin1_info,
636 &vin2_info,
637 &vin3_info,
638};
639
640/* HPB-DMA */ 529/* HPB-DMA */
641 530
642/* Asynchronous mode register bits */ 531/* Asynchronous mode register bits */
@@ -825,24 +714,6 @@ void __init r8a7779_add_standard_devices(void)
825 r8a7779_register_hpb_dmae(); 714 r8a7779_register_hpb_dmae();
826} 715}
827 716
828void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata)
829{
830 platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1,
831 ether_resources,
832 ARRAY_SIZE(ether_resources),
833 pdata, sizeof(*pdata));
834}
835
836void __init r8a7779_add_vin_device(int id, struct rcar_vin_platform_data *pdata)
837{
838 BUG_ON(id < 0 || id > 3);
839
840 vin_info_table[id]->data = pdata;
841 vin_info_table[id]->size_data = sizeof(*pdata);
842
843 platform_device_register_full(vin_info_table[id]);
844}
845
846/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 717/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
847void __init __weak r8a7779_register_twd(void) { } 718void __init __weak r8a7779_register_twd(void) { }
848 719
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index c47bcebbcb00..6ab37aa1e919 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -34,6 +34,10 @@ static const struct resource pfc_resources[] __initconst = {
34 DEFINE_RES_MEM(0xe6060000, 0x250), 34 DEFINE_RES_MEM(0xe6060000, 0x250),
35}; 35};
36 36
37#define r8a7790_register_pfc() \
38 platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, \
39 ARRAY_SIZE(pfc_resources))
40
37#define R8A7790_GPIO(idx) \ 41#define R8A7790_GPIO(idx) \
38static const struct resource r8a7790_gpio##idx##_resources[] __initconst = { \ 42static const struct resource r8a7790_gpio##idx##_resources[] __initconst = { \
39 DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \ 43 DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \
@@ -63,73 +67,87 @@ R8A7790_GPIO(5);
63 &r8a7790_gpio##idx##_platform_data, \ 67 &r8a7790_gpio##idx##_platform_data, \
64 sizeof(r8a7790_gpio##idx##_platform_data)) 68 sizeof(r8a7790_gpio##idx##_platform_data))
65 69
70static struct resource i2c_resources[] __initdata = {
71 /* I2C0 */
72 DEFINE_RES_MEM(0xE6508000, 0x40),
73 DEFINE_RES_IRQ(gic_spi(287)),
74 /* I2C1 */
75 DEFINE_RES_MEM(0xE6518000, 0x40),
76 DEFINE_RES_IRQ(gic_spi(288)),
77 /* I2C2 */
78 DEFINE_RES_MEM(0xE6530000, 0x40),
79 DEFINE_RES_IRQ(gic_spi(286)),
80 /* I2C3 */
81 DEFINE_RES_MEM(0xE6540000, 0x40),
82 DEFINE_RES_IRQ(gic_spi(290)),
83
84};
85
86#define r8a7790_register_i2c(idx) \
87 platform_device_register_simple( \
88 "i2c-rcar_gen2", idx, \
89 i2c_resources + (2 * idx), 2); \
90
66void __init r8a7790_pinmux_init(void) 91void __init r8a7790_pinmux_init(void)
67{ 92{
68 platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, 93 r8a7790_register_pfc();
69 ARRAY_SIZE(pfc_resources));
70 r8a7790_register_gpio(0); 94 r8a7790_register_gpio(0);
71 r8a7790_register_gpio(1); 95 r8a7790_register_gpio(1);
72 r8a7790_register_gpio(2); 96 r8a7790_register_gpio(2);
73 r8a7790_register_gpio(3); 97 r8a7790_register_gpio(3);
74 r8a7790_register_gpio(4); 98 r8a7790_register_gpio(4);
75 r8a7790_register_gpio(5); 99 r8a7790_register_gpio(5);
100 r8a7790_register_i2c(0);
101 r8a7790_register_i2c(1);
102 r8a7790_register_i2c(2);
103 r8a7790_register_i2c(3);
76} 104}
77 105
78#define SCIF_COMMON(scif_type, baseaddr, irq) \ 106#define __R8A7790_SCIF(scif_type, _scscr, index, baseaddr, irq) \
79 .type = scif_type, \ 107static struct plat_sci_port scif##index##_platform_data = { \
80 .mapbase = baseaddr, \ 108 .type = scif_type, \
81 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \ 109 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
82 .irqs = SCIx_IRQ_MUXED(irq) 110 .scscr = _scscr, \
83 111}; \
84#define SCIFA_DATA(index, baseaddr, irq) \ 112 \
85[index] = { \ 113static struct resource scif##index##_resources[] = { \
86 SCIF_COMMON(PORT_SCIFA, baseaddr, irq), \ 114 DEFINE_RES_MEM(baseaddr, 0x100), \
87 .scbrr_algo_id = SCBRR_ALGO_4, \ 115 DEFINE_RES_IRQ(irq), \
88 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \
89}
90
91#define SCIFB_DATA(index, baseaddr, irq) \
92[index] = { \
93 SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \
94 .scbrr_algo_id = SCBRR_ALGO_4, \
95 .scscr = SCSCR_RE | SCSCR_TE, \
96}
97
98#define SCIF_DATA(index, baseaddr, irq) \
99[index] = { \
100 SCIF_COMMON(PORT_SCIF, baseaddr, irq), \
101 .scbrr_algo_id = SCBRR_ALGO_2, \
102 .scscr = SCSCR_RE | SCSCR_TE, \
103}
104
105#define HSCIF_DATA(index, baseaddr, irq) \
106[index] = { \
107 SCIF_COMMON(PORT_HSCIF, baseaddr, irq), \
108 .scbrr_algo_id = SCBRR_ALGO_6, \
109 .scscr = SCSCR_RE | SCSCR_TE, \
110} 116}
111 117
112enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1, 118#define R8A7790_SCIF(index, baseaddr, irq) \
113 HSCIF0, HSCIF1 }; 119 __R8A7790_SCIF(PORT_SCIF, SCSCR_RE | SCSCR_TE, \
114 120 index, baseaddr, irq)
115static const struct plat_sci_port scif[] __initconst = { 121
116 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ 122#define R8A7790_SCIFA(index, baseaddr, irq) \
117 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ 123 __R8A7790_SCIF(PORT_SCIFA, SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \
118 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */ 124 index, baseaddr, irq)
119 SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */ 125
120 SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */ 126#define R8A7790_SCIFB(index, baseaddr, irq) \
121 SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */ 127 __R8A7790_SCIF(PORT_SCIFB, SCSCR_RE | SCSCR_TE, \
122 SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */ 128 index, baseaddr, irq)
123 SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */ 129
124 HSCIF_DATA(HSCIF0, 0xe62c0000, gic_spi(154)), /* HSCIF0 */ 130#define R8A7790_HSCIF(index, baseaddr, irq) \
125 HSCIF_DATA(HSCIF1, 0xe62c8000, gic_spi(155)), /* HSCIF1 */ 131 __R8A7790_SCIF(PORT_HSCIF, SCSCR_RE | SCSCR_TE, \
126}; 132 index, baseaddr, irq)
127 133
128static inline void r8a7790_register_scif(int idx) 134R8A7790_SCIFA(0, 0xe6c40000, gic_spi(144)); /* SCIFA0 */
129{ 135R8A7790_SCIFA(1, 0xe6c50000, gic_spi(145)); /* SCIFA1 */
130 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx], 136R8A7790_SCIFB(2, 0xe6c20000, gic_spi(148)); /* SCIFB0 */
131 sizeof(struct plat_sci_port)); 137R8A7790_SCIFB(3, 0xe6c30000, gic_spi(149)); /* SCIFB1 */
132} 138R8A7790_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
139R8A7790_SCIFA(5, 0xe6c60000, gic_spi(151)); /* SCIFA2 */
140R8A7790_SCIF(6, 0xe6e60000, gic_spi(152)); /* SCIF0 */
141R8A7790_SCIF(7, 0xe6e68000, gic_spi(153)); /* SCIF1 */
142R8A7790_HSCIF(8, 0xe62c0000, gic_spi(154)); /* HSCIF0 */
143R8A7790_HSCIF(9, 0xe62c8000, gic_spi(155)); /* HSCIF1 */
144
145#define r8a7790_register_scif(index) \
146 platform_device_register_resndata(&platform_bus, "sh-sci", index, \
147 scif##index##_resources, \
148 ARRAY_SIZE(scif##index##_resources), \
149 &scif##index##_platform_data, \
150 sizeof(scif##index##_platform_data))
133 151
134static const struct renesas_irqc_config irqc0_data __initconst = { 152static const struct renesas_irqc_config irqc0_data __initconst = {
135 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ 153 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
@@ -182,16 +200,16 @@ static const struct resource cmt00_resources[] __initconst = {
182 200
183void __init r8a7790_add_dt_devices(void) 201void __init r8a7790_add_dt_devices(void)
184{ 202{
185 r8a7790_register_scif(SCIFA0); 203 r8a7790_register_scif(0);
186 r8a7790_register_scif(SCIFA1); 204 r8a7790_register_scif(1);
187 r8a7790_register_scif(SCIFB0); 205 r8a7790_register_scif(2);
188 r8a7790_register_scif(SCIFB1); 206 r8a7790_register_scif(3);
189 r8a7790_register_scif(SCIFB2); 207 r8a7790_register_scif(4);
190 r8a7790_register_scif(SCIFA2); 208 r8a7790_register_scif(5);
191 r8a7790_register_scif(SCIF0); 209 r8a7790_register_scif(6);
192 r8a7790_register_scif(SCIF1); 210 r8a7790_register_scif(7);
193 r8a7790_register_scif(HSCIF0); 211 r8a7790_register_scif(8);
194 r8a7790_register_scif(HSCIF1); 212 r8a7790_register_scif(9);
195 r8a7790_register_cmt(00); 213 r8a7790_register_cmt(00);
196} 214}
197 215
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index d9393d61ee27..e28404e43860 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -22,6 +22,7 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/platform_data/gpio-rcar.h>
25#include <linux/platform_data/irq-renesas-irqc.h> 26#include <linux/platform_data/irq-renesas-irqc.h>
26#include <linux/serial_sci.h> 27#include <linux/serial_sci.h>
27#include <linux/sh_timer.h> 28#include <linux/sh_timer.h>
@@ -31,66 +32,101 @@
31#include <mach/rcar-gen2.h> 32#include <mach/rcar-gen2.h>
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
33 34
34#define SCIF_COMMON(scif_type, baseaddr, irq) \ 35static const struct resource pfc_resources[] __initconst = {
35 .type = scif_type, \ 36 DEFINE_RES_MEM(0xe6060000, 0x250),
36 .mapbase = baseaddr, \ 37};
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 38
54#define SCIF_DATA(index, baseaddr, irq) \ 39#define r8a7791_register_pfc() \
55[index] = { \ 40 platform_device_register_simple("pfc-r8a7791", -1, pfc_resources, \
56 SCIF_COMMON(PORT_SCIF, baseaddr, irq), \ 41 ARRAY_SIZE(pfc_resources))
57 .scbrr_algo_id = SCBRR_ALGO_2, \ 42
58 .scscr = SCSCR_RE | SCSCR_TE, \ 43#define R8A7791_GPIO(idx, base, nr) \
44static const struct resource r8a7791_gpio##idx##_resources[] __initconst = { \
45 DEFINE_RES_MEM((base), 0x50), \
46 DEFINE_RES_IRQ(gic_spi(4 + (idx))), \
47}; \
48 \
49static const struct gpio_rcar_config \
50r8a7791_gpio##idx##_platform_data __initconst = { \
51 .gpio_base = 32 * (idx), \
52 .irq_base = 0, \
53 .number_of_pins = (nr), \
54 .pctl_name = "pfc-r8a7791", \
55 .has_both_edge_trigger = 1, \
56}; \
57
58R8A7791_GPIO(0, 0xe6050000, 32);
59R8A7791_GPIO(1, 0xe6051000, 32);
60R8A7791_GPIO(2, 0xe6052000, 32);
61R8A7791_GPIO(3, 0xe6053000, 32);
62R8A7791_GPIO(4, 0xe6054000, 32);
63R8A7791_GPIO(5, 0xe6055000, 32);
64R8A7791_GPIO(6, 0xe6055400, 32);
65R8A7791_GPIO(7, 0xe6055800, 26);
66
67#define r8a7791_register_gpio(idx) \
68 platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \
69 r8a7791_gpio##idx##_resources, \
70 ARRAY_SIZE(r8a7791_gpio##idx##_resources), \
71 &r8a7791_gpio##idx##_platform_data, \
72 sizeof(r8a7791_gpio##idx##_platform_data))
73
74void __init r8a7791_pinmux_init(void)
75{
76 r8a7791_register_pfc();
77 r8a7791_register_gpio(0);
78 r8a7791_register_gpio(1);
79 r8a7791_register_gpio(2);
80 r8a7791_register_gpio(3);
81 r8a7791_register_gpio(4);
82 r8a7791_register_gpio(5);
83 r8a7791_register_gpio(6);
84 r8a7791_register_gpio(7);
59} 85}
60 86
61#define HSCIF_DATA(index, baseaddr, irq) \ 87#define __R8A7791_SCIF(scif_type, index, baseaddr, irq) \
62[index] = { \ 88static struct plat_sci_port scif##index##_platform_data = { \
63 SCIF_COMMON(PORT_HSCIF, baseaddr, irq), \ 89 .type = scif_type, \
64 .scbrr_algo_id = SCBRR_ALGO_6, \ 90 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
65 .scscr = SCSCR_RE | SCSCR_TE, \ 91 .scscr = SCSCR_RE | SCSCR_TE, \
92}; \
93 \
94static struct resource scif##index##_resources[] = { \
95 DEFINE_RES_MEM(baseaddr, 0x100), \
96 DEFINE_RES_IRQ(irq), \
66} 97}
67 98
68enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1, 99#define R8A7791_SCIF(index, baseaddr, irq) \
69 SCIF2, SCIF3, SCIF4, SCIF5, SCIFA3, SCIFA4, SCIFA5 }; 100 __R8A7791_SCIF(PORT_SCIF, index, baseaddr, irq)
70 101
71static const struct plat_sci_port scif[] __initconst = { 102#define R8A7791_SCIFA(index, baseaddr, irq) \
72 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ 103 __R8A7791_SCIF(PORT_SCIFA, index, baseaddr, irq)
73 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ 104
74 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */ 105#define R8A7791_SCIFB(index, baseaddr, irq) \
75 SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */ 106 __R8A7791_SCIF(PORT_SCIFB, index, baseaddr, irq)
76 SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */ 107
77 SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */ 108R8A7791_SCIFA(0, 0xe6c40000, gic_spi(144)); /* SCIFA0 */
78 SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */ 109R8A7791_SCIFA(1, 0xe6c50000, gic_spi(145)); /* SCIFA1 */
79 SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */ 110R8A7791_SCIFB(2, 0xe6c20000, gic_spi(148)); /* SCIFB0 */
80 SCIF_DATA(SCIF2, 0xe6e58000, gic_spi(22)), /* SCIF2 */ 111R8A7791_SCIFB(3, 0xe6c30000, gic_spi(149)); /* SCIFB1 */
81 SCIF_DATA(SCIF3, 0xe6ea8000, gic_spi(23)), /* SCIF3 */ 112R8A7791_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
82 SCIF_DATA(SCIF4, 0xe6ee0000, gic_spi(24)), /* SCIF4 */ 113R8A7791_SCIFA(5, 0xe6c60000, gic_spi(151)); /* SCIFA2 */
83 SCIF_DATA(SCIF5, 0xe6ee8000, gic_spi(25)), /* SCIF5 */ 114R8A7791_SCIF(6, 0xe6e60000, gic_spi(152)); /* SCIF0 */
84 SCIFA_DATA(SCIFA3, 0xe6c70000, gic_spi(29)), /* SCIFA3 */ 115R8A7791_SCIF(7, 0xe6e68000, gic_spi(153)); /* SCIF1 */
85 SCIFA_DATA(SCIFA4, 0xe6c78000, gic_spi(30)), /* SCIFA4 */ 116R8A7791_SCIF(8, 0xe6e58000, gic_spi(22)); /* SCIF2 */
86 SCIFA_DATA(SCIFA5, 0xe6c80000, gic_spi(31)), /* SCIFA5 */ 117R8A7791_SCIF(9, 0xe6ea8000, gic_spi(23)); /* SCIF3 */
87}; 118R8A7791_SCIF(10, 0xe6ee0000, gic_spi(24)); /* SCIF4 */
88 119R8A7791_SCIF(11, 0xe6ee8000, gic_spi(25)); /* SCIF5 */
89static inline void r8a7791_register_scif(int idx) 120R8A7791_SCIFA(12, 0xe6c70000, gic_spi(29)); /* SCIFA3 */
90{ 121R8A7791_SCIFA(13, 0xe6c78000, gic_spi(30)); /* SCIFA4 */
91 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx], 122R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */
92 sizeof(struct plat_sci_port)); 123
93} 124#define r8a7791_register_scif(index) \
125 platform_device_register_resndata(&platform_bus, "sh-sci", index, \
126 scif##index##_resources, \
127 ARRAY_SIZE(scif##index##_resources), \
128 &scif##index##_platform_data, \
129 sizeof(scif##index##_platform_data))
94 130
95static const struct sh_timer_config cmt00_platform_data __initconst = { 131static const struct sh_timer_config cmt00_platform_data __initconst = {
96 .name = "CMT00", 132 .name = "CMT00",
@@ -136,23 +172,34 @@ static struct resource irqc0_resources[] = {
136 &irqc##idx##_data, \ 172 &irqc##idx##_data, \
137 sizeof(struct renesas_irqc_config)) 173 sizeof(struct renesas_irqc_config))
138 174
175static const struct resource thermal_resources[] __initconst = {
176 DEFINE_RES_MEM(0xe61f0000, 0x14),
177 DEFINE_RES_MEM(0xe61f0100, 0x38),
178 DEFINE_RES_IRQ(gic_spi(69)),
179};
180
181#define r8a7791_register_thermal() \
182 platform_device_register_simple("rcar_thermal", -1, \
183 thermal_resources, \
184 ARRAY_SIZE(thermal_resources))
185
139void __init r8a7791_add_dt_devices(void) 186void __init r8a7791_add_dt_devices(void)
140{ 187{
141 r8a7791_register_scif(SCIFA0); 188 r8a7791_register_scif(0);
142 r8a7791_register_scif(SCIFA1); 189 r8a7791_register_scif(1);
143 r8a7791_register_scif(SCIFB0); 190 r8a7791_register_scif(2);
144 r8a7791_register_scif(SCIFB1); 191 r8a7791_register_scif(3);
145 r8a7791_register_scif(SCIFB2); 192 r8a7791_register_scif(4);
146 r8a7791_register_scif(SCIFA2); 193 r8a7791_register_scif(5);
147 r8a7791_register_scif(SCIF0); 194 r8a7791_register_scif(6);
148 r8a7791_register_scif(SCIF1); 195 r8a7791_register_scif(7);
149 r8a7791_register_scif(SCIF2); 196 r8a7791_register_scif(8);
150 r8a7791_register_scif(SCIF3); 197 r8a7791_register_scif(9);
151 r8a7791_register_scif(SCIF4); 198 r8a7791_register_scif(10);
152 r8a7791_register_scif(SCIF5); 199 r8a7791_register_scif(11);
153 r8a7791_register_scif(SCIFA3); 200 r8a7791_register_scif(12);
154 r8a7791_register_scif(SCIFA4); 201 r8a7791_register_scif(13);
155 r8a7791_register_scif(SCIFA5); 202 r8a7791_register_scif(14);
156 r8a7791_register_cmt(00); 203 r8a7791_register_cmt(00);
157} 204}
158 205
@@ -160,6 +207,7 @@ void __init r8a7791_add_standard_devices(void)
160{ 207{
161 r8a7791_add_dt_devices(); 208 r8a7791_add_dt_devices();
162 r8a7791_register_irqc(0); 209 r8a7791_register_irqc(0);
210 r8a7791_register_thermal();
163} 211}
164 212
165void __init r8a7791_init_early(void) 213void __init r8a7791_init_early(void)
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 5734c24bf6c7..69ccc6c6fd33 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -18,6 +18,7 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21#include <linux/clk/shmobile.h>
21#include <linux/clocksource.h> 22#include <linux/clocksource.h>
22#include <linux/io.h> 23#include <linux/io.h>
23#include <linux/kernel.h> 24#include <linux/kernel.h>
@@ -44,8 +45,10 @@ u32 __init rcar_gen2_read_mode_pins(void)
44 45
45void __init rcar_gen2_timer_init(void) 46void __init rcar_gen2_timer_init(void)
46{ 47{
47#ifdef CONFIG_ARM_ARCH_TIMER 48#if defined(CONFIG_ARM_ARCH_TIMER) || defined(CONFIG_COMMON_CLK)
48 u32 mode = rcar_gen2_read_mode_pins(); 49 u32 mode = rcar_gen2_read_mode_pins();
50#endif
51#ifdef CONFIG_ARM_ARCH_TIMER
49 void __iomem *base; 52 void __iomem *base;
50 int extal_mhz = 0; 53 int extal_mhz = 0;
51 u32 freq; 54 u32 freq;
@@ -78,14 +81,28 @@ void __init rcar_gen2_timer_init(void)
78 /* Remap "armgcnt address map" space */ 81 /* Remap "armgcnt address map" space */
79 base = ioremap(0xe6080000, PAGE_SIZE); 82 base = ioremap(0xe6080000, PAGE_SIZE);
80 83
81 /* Update registers with correct frequency */ 84 /*
82 iowrite32(freq, base + CNTFID0); 85 * Update the timer if it is either not running, or is not at the
83 asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq)); 86 * right frequency. The timer is only configurable in secure mode
87 * so this avoids an abort if the loader started the timer and
88 * entered the kernel in non-secure mode.
89 */
90
91 if ((ioread32(base + CNTCR) & 1) == 0 ||
92 ioread32(base + CNTFID0) != freq) {
93 /* Update registers with correct frequency */
94 iowrite32(freq, base + CNTFID0);
95 asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
96
97 /* make sure arch timer is started by setting bit 0 of CNTCR */
98 iowrite32(1, base + CNTCR);
99 }
84 100
85 /* make sure arch timer is started by setting bit 0 of CNTCR */
86 iowrite32(1, base + CNTCR);
87 iounmap(base); 101 iounmap(base);
88#endif /* CONFIG_ARM_ARCH_TIMER */ 102#endif /* CONFIG_ARM_ARCH_TIMER */
89 103
104#ifdef CONFIG_COMMON_CLK
105 rcar_gen2_clocks_init(mode);
106#endif
90 clocksource_of_init(); 107 clocksource_of_init();
91} 108}
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 311878391e18..27301278c208 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -86,138 +86,36 @@ void __init sh7372_pinmux_init(void)
86 platform_device_register(&sh7372_pfc_device); 86 platform_device_register(&sh7372_pfc_device);
87} 87}
88 88
89/* SCIFA0 */ 89/* SCIF */
90static struct plat_sci_port scif0_platform_data = { 90#define SH7372_SCIF(scif_type, index, baseaddr, irq) \
91 .mapbase = 0xe6c40000, 91static struct plat_sci_port scif##index##_platform_data = { \
92 .flags = UPF_BOOT_AUTOCONF, 92 .type = scif_type, \
93 .scscr = SCSCR_RE | SCSCR_TE, 93 .flags = UPF_BOOT_AUTOCONF, \
94 .scbrr_algo_id = SCBRR_ALGO_4, 94 .scscr = SCSCR_RE | SCSCR_TE, \
95 .type = PORT_SCIFA, 95}; \
96 .irqs = { evt2irq(0x0c00), evt2irq(0x0c00), 96 \
97 evt2irq(0x0c00), evt2irq(0x0c00) }, 97static struct resource scif##index##_resources[] = { \
98}; 98 DEFINE_RES_MEM(baseaddr, 0x100), \
99 99 DEFINE_RES_IRQ(irq), \
100static struct platform_device scif0_device = { 100}; \
101 .name = "sh-sci", 101 \
102 .id = 0, 102static struct platform_device scif##index##_device = { \
103 .dev = { 103 .name = "sh-sci", \
104 .platform_data = &scif0_platform_data, 104 .id = index, \
105 }, 105 .resource = scif##index##_resources, \
106}; 106 .num_resources = ARRAY_SIZE(scif##index##_resources), \
107 107 .dev = { \
108/* SCIFA1 */ 108 .platform_data = &scif##index##_platform_data, \
109static struct plat_sci_port scif1_platform_data = { 109 }, \
110 .mapbase = 0xe6c50000, 110}
111 .flags = UPF_BOOT_AUTOCONF,
112 .scscr = SCSCR_RE | SCSCR_TE,
113 .scbrr_algo_id = SCBRR_ALGO_4,
114 .type = PORT_SCIFA,
115 .irqs = { evt2irq(0x0c20), evt2irq(0x0c20),
116 evt2irq(0x0c20), evt2irq(0x0c20) },
117};
118
119static struct platform_device scif1_device = {
120 .name = "sh-sci",
121 .id = 1,
122 .dev = {
123 .platform_data = &scif1_platform_data,
124 },
125};
126
127/* SCIFA2 */
128static struct plat_sci_port scif2_platform_data = {
129 .mapbase = 0xe6c60000,
130 .flags = UPF_BOOT_AUTOCONF,
131 .scscr = SCSCR_RE | SCSCR_TE,
132 .scbrr_algo_id = SCBRR_ALGO_4,
133 .type = PORT_SCIFA,
134 .irqs = { evt2irq(0x0c40), evt2irq(0x0c40),
135 evt2irq(0x0c40), evt2irq(0x0c40) },
136};
137
138static struct platform_device scif2_device = {
139 .name = "sh-sci",
140 .id = 2,
141 .dev = {
142 .platform_data = &scif2_platform_data,
143 },
144};
145
146/* SCIFA3 */
147static struct plat_sci_port scif3_platform_data = {
148 .mapbase = 0xe6c70000,
149 .flags = UPF_BOOT_AUTOCONF,
150 .scscr = SCSCR_RE | SCSCR_TE,
151 .scbrr_algo_id = SCBRR_ALGO_4,
152 .type = PORT_SCIFA,
153 .irqs = { evt2irq(0x0c60), evt2irq(0x0c60),
154 evt2irq(0x0c60), evt2irq(0x0c60) },
155};
156
157static struct platform_device scif3_device = {
158 .name = "sh-sci",
159 .id = 3,
160 .dev = {
161 .platform_data = &scif3_platform_data,
162 },
163};
164
165/* SCIFA4 */
166static struct plat_sci_port scif4_platform_data = {
167 .mapbase = 0xe6c80000,
168 .flags = UPF_BOOT_AUTOCONF,
169 .scscr = SCSCR_RE | SCSCR_TE,
170 .scbrr_algo_id = SCBRR_ALGO_4,
171 .type = PORT_SCIFA,
172 .irqs = { evt2irq(0x0d20), evt2irq(0x0d20),
173 evt2irq(0x0d20), evt2irq(0x0d20) },
174};
175
176static struct platform_device scif4_device = {
177 .name = "sh-sci",
178 .id = 4,
179 .dev = {
180 .platform_data = &scif4_platform_data,
181 },
182};
183
184/* SCIFA5 */
185static struct plat_sci_port scif5_platform_data = {
186 .mapbase = 0xe6cb0000,
187 .flags = UPF_BOOT_AUTOCONF,
188 .scscr = SCSCR_RE | SCSCR_TE,
189 .scbrr_algo_id = SCBRR_ALGO_4,
190 .type = PORT_SCIFA,
191 .irqs = { evt2irq(0x0d40), evt2irq(0x0d40),
192 evt2irq(0x0d40), evt2irq(0x0d40) },
193};
194
195static struct platform_device scif5_device = {
196 .name = "sh-sci",
197 .id = 5,
198 .dev = {
199 .platform_data = &scif5_platform_data,
200 },
201};
202
203/* SCIFB */
204static struct plat_sci_port scif6_platform_data = {
205 .mapbase = 0xe6c30000,
206 .flags = UPF_BOOT_AUTOCONF,
207 .scscr = SCSCR_RE | SCSCR_TE,
208 .scbrr_algo_id = SCBRR_ALGO_4,
209 .type = PORT_SCIFB,
210 .irqs = { evt2irq(0x0d60), evt2irq(0x0d60),
211 evt2irq(0x0d60), evt2irq(0x0d60) },
212};
213 111
214static struct platform_device scif6_device = { 112SH7372_SCIF(PORT_SCIFA, 0, 0xe6c40000, evt2irq(0x0c00));
215 .name = "sh-sci", 113SH7372_SCIF(PORT_SCIFA, 1, 0xe6c50000, evt2irq(0x0c20));
216 .id = 6, 114SH7372_SCIF(PORT_SCIFA, 2, 0xe6c60000, evt2irq(0x0c40));
217 .dev = { 115SH7372_SCIF(PORT_SCIFA, 3, 0xe6c70000, evt2irq(0x0c60));
218 .platform_data = &scif6_platform_data, 116SH7372_SCIF(PORT_SCIFA, 4, 0xe6c80000, evt2irq(0x0d20));
219 }, 117SH7372_SCIF(PORT_SCIFA, 5, 0xe6cb0000, evt2irq(0x0d40));
220}; 118SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60));
221 119
222/* CMT */ 120/* CMT */
223static struct sh_timer_config cmt2_platform_data = { 121static struct sh_timer_config cmt2_platform_data = {
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 22de17417fd7..f74ab530c71d 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -71,167 +71,38 @@ void __init sh73a0_pinmux_init(void)
71 ARRAY_SIZE(pfc_resources)); 71 ARRAY_SIZE(pfc_resources));
72} 72}
73 73
74static struct plat_sci_port scif0_platform_data = { 74/* SCIF */
75 .mapbase = 0xe6c40000, 75#define SH73A0_SCIF(scif_type, index, baseaddr, irq) \
76 .flags = UPF_BOOT_AUTOCONF, 76static struct plat_sci_port scif##index##_platform_data = { \
77 .scscr = SCSCR_RE | SCSCR_TE, 77 .type = scif_type, \
78 .scbrr_algo_id = SCBRR_ALGO_4, 78 .flags = UPF_BOOT_AUTOCONF, \
79 .type = PORT_SCIFA, 79 .scscr = SCSCR_RE | SCSCR_TE, \
80 .irqs = { gic_spi(72), gic_spi(72), 80}; \
81 gic_spi(72), gic_spi(72) }, 81 \
82}; 82static struct resource scif##index##_resources[] = { \
83 83 DEFINE_RES_MEM(baseaddr, 0x100), \
84static struct platform_device scif0_device = { 84 DEFINE_RES_IRQ(irq), \
85 .name = "sh-sci", 85}; \
86 .id = 0, 86 \
87 .dev = { 87static struct platform_device scif##index##_device = { \
88 .platform_data = &scif0_platform_data, 88 .name = "sh-sci", \
89 }, 89 .id = index, \
90}; 90 .resource = scif##index##_resources, \
91 91 .num_resources = ARRAY_SIZE(scif##index##_resources), \
92static struct plat_sci_port scif1_platform_data = { 92 .dev = { \
93 .mapbase = 0xe6c50000, 93 .platform_data = &scif##index##_platform_data, \
94 .flags = UPF_BOOT_AUTOCONF, 94 }, \
95 .scscr = SCSCR_RE | SCSCR_TE, 95}
96 .scbrr_algo_id = SCBRR_ALGO_4,
97 .type = PORT_SCIFA,
98 .irqs = { gic_spi(73), gic_spi(73),
99 gic_spi(73), gic_spi(73) },
100};
101
102static struct platform_device scif1_device = {
103 .name = "sh-sci",
104 .id = 1,
105 .dev = {
106 .platform_data = &scif1_platform_data,
107 },
108};
109
110static struct plat_sci_port scif2_platform_data = {
111 .mapbase = 0xe6c60000,
112 .flags = UPF_BOOT_AUTOCONF,
113 .scscr = SCSCR_RE | SCSCR_TE,
114 .scbrr_algo_id = SCBRR_ALGO_4,
115 .type = PORT_SCIFA,
116 .irqs = { gic_spi(74), gic_spi(74),
117 gic_spi(74), gic_spi(74) },
118};
119
120static struct platform_device scif2_device = {
121 .name = "sh-sci",
122 .id = 2,
123 .dev = {
124 .platform_data = &scif2_platform_data,
125 },
126};
127
128static struct plat_sci_port scif3_platform_data = {
129 .mapbase = 0xe6c70000,
130 .flags = UPF_BOOT_AUTOCONF,
131 .scscr = SCSCR_RE | SCSCR_TE,
132 .scbrr_algo_id = SCBRR_ALGO_4,
133 .type = PORT_SCIFA,
134 .irqs = { gic_spi(75), gic_spi(75),
135 gic_spi(75), gic_spi(75) },
136};
137
138static struct platform_device scif3_device = {
139 .name = "sh-sci",
140 .id = 3,
141 .dev = {
142 .platform_data = &scif3_platform_data,
143 },
144};
145
146static struct plat_sci_port scif4_platform_data = {
147 .mapbase = 0xe6c80000,
148 .flags = UPF_BOOT_AUTOCONF,
149 .scscr = SCSCR_RE | SCSCR_TE,
150 .scbrr_algo_id = SCBRR_ALGO_4,
151 .type = PORT_SCIFA,
152 .irqs = { gic_spi(78), gic_spi(78),
153 gic_spi(78), gic_spi(78) },
154};
155
156static struct platform_device scif4_device = {
157 .name = "sh-sci",
158 .id = 4,
159 .dev = {
160 .platform_data = &scif4_platform_data,
161 },
162};
163
164static struct plat_sci_port scif5_platform_data = {
165 .mapbase = 0xe6cb0000,
166 .flags = UPF_BOOT_AUTOCONF,
167 .scscr = SCSCR_RE | SCSCR_TE,
168 .scbrr_algo_id = SCBRR_ALGO_4,
169 .type = PORT_SCIFA,
170 .irqs = { gic_spi(79), gic_spi(79),
171 gic_spi(79), gic_spi(79) },
172};
173
174static struct platform_device scif5_device = {
175 .name = "sh-sci",
176 .id = 5,
177 .dev = {
178 .platform_data = &scif5_platform_data,
179 },
180};
181
182static struct plat_sci_port scif6_platform_data = {
183 .mapbase = 0xe6cc0000,
184 .flags = UPF_BOOT_AUTOCONF,
185 .scscr = SCSCR_RE | SCSCR_TE,
186 .scbrr_algo_id = SCBRR_ALGO_4,
187 .type = PORT_SCIFA,
188 .irqs = { gic_spi(156), gic_spi(156),
189 gic_spi(156), gic_spi(156) },
190};
191
192static struct platform_device scif6_device = {
193 .name = "sh-sci",
194 .id = 6,
195 .dev = {
196 .platform_data = &scif6_platform_data,
197 },
198};
199
200static struct plat_sci_port scif7_platform_data = {
201 .mapbase = 0xe6cd0000,
202 .flags = UPF_BOOT_AUTOCONF,
203 .scscr = SCSCR_RE | SCSCR_TE,
204 .scbrr_algo_id = SCBRR_ALGO_4,
205 .type = PORT_SCIFA,
206 .irqs = { gic_spi(143), gic_spi(143),
207 gic_spi(143), gic_spi(143) },
208};
209
210static struct platform_device scif7_device = {
211 .name = "sh-sci",
212 .id = 7,
213 .dev = {
214 .platform_data = &scif7_platform_data,
215 },
216};
217
218static struct plat_sci_port scif8_platform_data = {
219 .mapbase = 0xe6c30000,
220 .flags = UPF_BOOT_AUTOCONF,
221 .scscr = SCSCR_RE | SCSCR_TE,
222 .scbrr_algo_id = SCBRR_ALGO_4,
223 .type = PORT_SCIFB,
224 .irqs = { gic_spi(80), gic_spi(80),
225 gic_spi(80), gic_spi(80) },
226};
227 96
228static struct platform_device scif8_device = { 97SH73A0_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(72));
229 .name = "sh-sci", 98SH73A0_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(73));
230 .id = 8, 99SH73A0_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(74));
231 .dev = { 100SH73A0_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(75));
232 .platform_data = &scif8_platform_data, 101SH73A0_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(78));
233 }, 102SH73A0_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(79));
234}; 103SH73A0_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(156));
104SH73A0_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(143));
105SH73A0_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(80));
235 106
236static struct sh_timer_config cmt10_platform_data = { 107static struct sh_timer_config cmt10_platform_data = {
237 .name = "CMT10", 108 .name = "CMT10",
@@ -273,7 +144,7 @@ static struct sh_timer_config tmu00_platform_data = {
273}; 144};
274 145
275static struct resource tmu00_resources[] = { 146static struct resource tmu00_resources[] = {
276 [0] = DEFINE_RES_MEM_NAMED(0xfff60008, 0xc, "TMU00"), 147 [0] = DEFINE_RES_MEM(0xfff60008, 0xc),
277 [1] = { 148 [1] = {
278 .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */ 149 .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
279 .flags = IORESOURCE_IRQ, 150 .flags = IORESOURCE_IRQ,
@@ -298,7 +169,7 @@ static struct sh_timer_config tmu01_platform_data = {
298}; 169};
299 170
300static struct resource tmu01_resources[] = { 171static struct resource tmu01_resources[] = {
301 [0] = DEFINE_RES_MEM_NAMED(0xfff60014, 0xc, "TMU00"), 172 [0] = DEFINE_RES_MEM(0xfff60014, 0xc),
302 [1] = { 173 [1] = {
303 .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */ 174 .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
304 .flags = IORESOURCE_IRQ, 175 .flags = IORESOURCE_IRQ,
@@ -316,7 +187,7 @@ static struct platform_device tmu01_device = {
316}; 187};
317 188
318static struct resource i2c0_resources[] = { 189static struct resource i2c0_resources[] = {
319 [0] = DEFINE_RES_MEM_NAMED(0xe6820000, 0x426, "IIC0"), 190 [0] = DEFINE_RES_MEM(0xe6820000, 0x426),
320 [1] = { 191 [1] = {
321 .start = gic_spi(167), 192 .start = gic_spi(167),
322 .end = gic_spi(170), 193 .end = gic_spi(170),
@@ -325,7 +196,7 @@ static struct resource i2c0_resources[] = {
325}; 196};
326 197
327static struct resource i2c1_resources[] = { 198static struct resource i2c1_resources[] = {
328 [0] = DEFINE_RES_MEM_NAMED(0xe6822000, 0x426, "IIC1"), 199 [0] = DEFINE_RES_MEM(0xe6822000, 0x426),
329 [1] = { 200 [1] = {
330 .start = gic_spi(51), 201 .start = gic_spi(51),
331 .end = gic_spi(54), 202 .end = gic_spi(54),
@@ -334,7 +205,7 @@ static struct resource i2c1_resources[] = {
334}; 205};
335 206
336static struct resource i2c2_resources[] = { 207static struct resource i2c2_resources[] = {
337 [0] = DEFINE_RES_MEM_NAMED(0xe6824000, 0x426, "IIC2"), 208 [0] = DEFINE_RES_MEM(0xe6824000, 0x426),
338 [1] = { 209 [1] = {
339 .start = gic_spi(171), 210 .start = gic_spi(171),
340 .end = gic_spi(174), 211 .end = gic_spi(174),
@@ -343,7 +214,7 @@ static struct resource i2c2_resources[] = {
343}; 214};
344 215
345static struct resource i2c3_resources[] = { 216static struct resource i2c3_resources[] = {
346 [0] = DEFINE_RES_MEM_NAMED(0xe6826000, 0x426, "IIC3"), 217 [0] = DEFINE_RES_MEM(0xe6826000, 0x426),
347 [1] = { 218 [1] = {
348 .start = gic_spi(183), 219 .start = gic_spi(183),
349 .end = gic_spi(186), 220 .end = gic_spi(186),
@@ -352,7 +223,7 @@ static struct resource i2c3_resources[] = {
352}; 223};
353 224
354static struct resource i2c4_resources[] = { 225static struct resource i2c4_resources[] = {
355 [0] = DEFINE_RES_MEM_NAMED(0xe6828000, 0x426, "IIC4"), 226 [0] = DEFINE_RES_MEM(0xe6828000, 0x426),
356 [1] = { 227 [1] = {
357 .start = gic_spi(187), 228 .start = gic_spi(187),
358 .end = gic_spi(190), 229 .end = gic_spi(190),
@@ -722,7 +593,7 @@ static struct platform_device pmu_device = {
722 593
723/* an IPMMU module for ICB */ 594/* an IPMMU module for ICB */
724static struct resource ipmmu_resources[] = { 595static struct resource ipmmu_resources[] = {
725 DEFINE_RES_MEM_NAMED(0xfe951000, 0x100, "IPMMU"), 596 DEFINE_RES_MEM(0xfe951000, 0x100),
726}; 597};
727 598
728static const char * const ipmmu_dev_names[] = { 599static const char * const ipmmu_dev_names[] = {
diff --git a/arch/arm/mach-shmobile/sh-gpio.h b/arch/arm/mach-shmobile/sh-gpio.h
index e834763ac2a5..2c4141413db9 100644
--- a/arch/arm/mach-shmobile/sh-gpio.h
+++ b/arch/arm/mach-shmobile/sh-gpio.h
@@ -26,23 +26,4 @@ static inline void __init gpio_direction_none(void __iomem * addr)
26 __raw_writeb(0x00, addr); 26 __raw_writeb(0x00, addr);
27} 27}
28 28
29static inline void __init gpio_request_pullup(void __iomem * addr)
30{
31 u8 data = __raw_readb(addr);
32
33 data &= 0x0F;
34 data |= 0xC0;
35 __raw_writeb(data, addr);
36}
37
38static inline void __init gpio_request_pulldown(void __iomem * addr)
39{
40 u8 data = __raw_readb(addr);
41
42 data &= 0x0F;
43 data |= 0xA0;
44
45 __raw_writeb(data, addr);
46}
47
48#endif /* __ASM_ARCH_GPIO_H */ 29#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
index dce50d983a8e..fa2c33ffac04 100644
--- a/arch/arm/mach-sti/platsmp.c
+++ b/arch/arm/mach-sti/platsmp.c
@@ -31,8 +31,7 @@ static void write_pen_release(int val)
31{ 31{
32 pen_release = val; 32 pen_release = val;
33 smp_wmb(); 33 smp_wmb();
34 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); 34 sync_cache_w(&pen_release);
35 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
36} 35}
37 36
38static DEFINE_SPINLOCK(boot_lock); 37static DEFINE_SPINLOCK(boot_lock);
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index bce0d4277f71..b9d6cad8669b 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1,7 +1,9 @@
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_HAS_RESET_CONTROLLER
3 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC 5 select ARM_GIC
6 select ARM_PSCI
5 select CLKSRC_MMIO 7 select CLKSRC_MMIO
6 select CLKSRC_OF 8 select CLKSRC_OF
7 select COMMON_CLK 9 select COMMON_CLK
@@ -10,6 +12,7 @@ config ARCH_SUNXI
10 select HAVE_SMP 12 select HAVE_SMP
11 select PINCTRL 13 select PINCTRL
12 select PINCTRL_SUNXI 14 select PINCTRL_SUNXI
15 select RESET_CONTROLLER
13 select SPARSE_IRQ 16 select SPARSE_IRQ
14 select SUN4I_TIMER 17 select SUN4I_TIMER
15 select SUN5I_HSTIMER 18 select SUN5I_HSTIMER
diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
index 93bebfc3ff9f..d9397202d6ec 100644
--- a/arch/arm/mach-sunxi/Makefile
+++ b/arch/arm/mach-sunxi/Makefile
@@ -1 +1,2 @@
1obj-$(CONFIG_ARCH_SUNXI) += sunxi.o 1obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
2obj-$(CONFIG_SMP) += platsmp.o headsmp.o
diff --git a/arch/arm/mach-sunxi/common.h b/arch/arm/mach-sunxi/common.h
new file mode 100644
index 000000000000..9e5ac4756cbb
--- /dev/null
+++ b/arch/arm/mach-sunxi/common.h
@@ -0,0 +1,19 @@
1/*
2 * Core functions for Allwinner SoCs
3 *
4 * Copyright (C) 2013 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef __ARCH_SUNXI_COMMON_H_
14#define __ARCH_SUNXI_COMMON_H_
15
16void sun6i_secondary_startup(void);
17extern struct smp_operations sun6i_smp_ops;
18
19#endif /* __ARCH_SUNXI_COMMON_H_ */
diff --git a/arch/arm/mach-sunxi/headsmp.S b/arch/arm/mach-sunxi/headsmp.S
new file mode 100644
index 000000000000..a10d494fb37b
--- /dev/null
+++ b/arch/arm/mach-sunxi/headsmp.S
@@ -0,0 +1,9 @@
1#include <linux/linkage.h>
2#include <linux/init.h>
3
4 .section ".text.head", "ax"
5
6ENTRY(sun6i_secondary_startup)
7 msr cpsr_fsxc, #0xd3
8 b secondary_startup
9ENDPROC(sun6i_secondary_startup)
diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c
new file mode 100644
index 000000000000..7b141d8342a1
--- /dev/null
+++ b/arch/arm/mach-sunxi/platsmp.c
@@ -0,0 +1,124 @@
1/*
2 * SMP support for Allwinner SoCs
3 *
4 * Copyright (C) 2013 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * Based on code
9 * Copyright (C) 2012-2013 Allwinner Ltd.
10 *
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
14 */
15
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/io.h>
19#include <linux/memory.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/smp.h>
23
24#include "common.h"
25
26#define CPUCFG_CPU_PWR_CLAMP_STATUS_REG(cpu) ((cpu) * 0x40 + 0x64)
27#define CPUCFG_CPU_RST_CTRL_REG(cpu) (((cpu) + 1) * 0x40)
28#define CPUCFG_CPU_CTRL_REG(cpu) (((cpu) + 1) * 0x40 + 0x04)
29#define CPUCFG_CPU_STATUS_REG(cpu) (((cpu) + 1) * 0x40 + 0x08)
30#define CPUCFG_GEN_CTRL_REG 0x184
31#define CPUCFG_PRIVATE0_REG 0x1a4
32#define CPUCFG_PRIVATE1_REG 0x1a8
33#define CPUCFG_DBG_CTL0_REG 0x1e0
34#define CPUCFG_DBG_CTL1_REG 0x1e4
35
36#define PRCM_CPU_PWROFF_REG 0x100
37#define PRCM_CPU_PWR_CLAMP_REG(cpu) (((cpu) * 4) + 0x140)
38
39static void __iomem *cpucfg_membase;
40static void __iomem *prcm_membase;
41
42static DEFINE_SPINLOCK(cpu_lock);
43
44static void __init sun6i_smp_prepare_cpus(unsigned int max_cpus)
45{
46 struct device_node *node;
47
48 node = of_find_compatible_node(NULL, NULL, "allwinner,sun6i-a31-prcm");
49 if (!node) {
50 pr_err("Missing A31 PRCM node in the device tree\n");
51 return;
52 }
53
54 prcm_membase = of_iomap(node, 0);
55 if (!prcm_membase) {
56 pr_err("Couldn't map A31 PRCM registers\n");
57 return;
58 }
59
60 node = of_find_compatible_node(NULL, NULL,
61 "allwinner,sun6i-a31-cpuconfig");
62 if (!node) {
63 pr_err("Missing A31 CPU config node in the device tree\n");
64 return;
65 }
66
67 cpucfg_membase = of_iomap(node, 0);
68 if (!cpucfg_membase)
69 pr_err("Couldn't map A31 CPU config registers\n");
70
71}
72
73static int sun6i_smp_boot_secondary(unsigned int cpu,
74 struct task_struct *idle)
75{
76 u32 reg;
77 int i;
78
79 if (!(prcm_membase && cpucfg_membase))
80 return -EFAULT;
81
82 spin_lock(&cpu_lock);
83
84 /* Set CPU boot address */
85 writel(virt_to_phys(sun6i_secondary_startup),
86 cpucfg_membase + CPUCFG_PRIVATE0_REG);
87
88 /* Assert the CPU core in reset */
89 writel(0, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
90
91 /* Assert the L1 cache in reset */
92 reg = readl(cpucfg_membase + CPUCFG_GEN_CTRL_REG);
93 writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_GEN_CTRL_REG);
94
95 /* Disable external debug access */
96 reg = readl(cpucfg_membase + CPUCFG_DBG_CTL1_REG);
97 writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_DBG_CTL1_REG);
98
99 /* Power up the CPU */
100 for (i = 0; i <= 8; i++)
101 writel(0xff >> i, prcm_membase + PRCM_CPU_PWR_CLAMP_REG(cpu));
102 mdelay(10);
103
104 /* Clear CPU power-off gating */
105 reg = readl(prcm_membase + PRCM_CPU_PWROFF_REG);
106 writel(reg & ~BIT(cpu), prcm_membase + PRCM_CPU_PWROFF_REG);
107 mdelay(1);
108
109 /* Deassert the CPU core reset */
110 writel(3, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
111
112 /* Enable back the external debug accesses */
113 reg = readl(cpucfg_membase + CPUCFG_DBG_CTL1_REG);
114 writel(reg | BIT(cpu), cpucfg_membase + CPUCFG_DBG_CTL1_REG);
115
116 spin_unlock(&cpu_lock);
117
118 return 0;
119}
120
121struct smp_operations sun6i_smp_ops __initdata = {
122 .smp_prepare_cpus = sun6i_smp_prepare_cpus,
123 .smp_boot_secondary = sun6i_smp_boot_secondary,
124};
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 61d3a387f01c..aeea6ceea725 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -10,6 +10,8 @@
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/clk-provider.h>
14#include <linux/clocksource.h>
13#include <linux/delay.h> 15#include <linux/delay.h>
14#include <linux/kernel.h> 16#include <linux/kernel.h>
15#include <linux/init.h> 17#include <linux/init.h>
@@ -23,6 +25,8 @@
23#include <asm/mach/map.h> 25#include <asm/mach/map.h>
24#include <asm/system_misc.h> 26#include <asm/system_misc.h>
25 27
28#include "common.h"
29
26#define SUN4I_WATCHDOG_CTRL_REG 0x00 30#define SUN4I_WATCHDOG_CTRL_REG 0x00
27#define SUN4I_WATCHDOG_CTRL_RESTART BIT(0) 31#define SUN4I_WATCHDOG_CTRL_RESTART BIT(0)
28#define SUN4I_WATCHDOG_MODE_REG 0x04 32#define SUN4I_WATCHDOG_MODE_REG 0x04
@@ -132,10 +136,20 @@ static const char * const sun6i_board_dt_compat[] = {
132 NULL, 136 NULL,
133}; 137};
134 138
139extern void __init sun6i_reset_init(void);
140static void __init sun6i_timer_init(void)
141{
142 of_clk_init(NULL);
143 sun6i_reset_init();
144 clocksource_of_init();
145}
146
135DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family") 147DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
136 .init_machine = sunxi_dt_init, 148 .init_machine = sunxi_dt_init,
149 .init_time = sun6i_timer_init,
137 .dt_compat = sun6i_board_dt_compat, 150 .dt_compat = sun6i_board_dt_compat,
138 .restart = sun6i_restart, 151 .restart = sun6i_restart,
152 .smp = smp_ops(sun6i_smp_ops),
139MACHINE_END 153MACHINE_END
140 154
141static const char * const sun7i_board_dt_compat[] = { 155static const char * const sun7i_board_dt_compat[] = {
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 09e740f58b27..b1232d8be6f5 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -2,6 +2,7 @@ config ARCH_TEGRA
2 bool "NVIDIA Tegra" if ARCH_MULTI_V7 2 bool "NVIDIA Tegra" if ARCH_MULTI_V7
3 select ARCH_HAS_CPUFREQ 3 select ARCH_HAS_CPUFREQ
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
5 select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
5 select ARM_GIC 6 select ARM_GIC
6 select CLKSRC_MMIO 7 select CLKSRC_MMIO
7 select CLKSRC_OF 8 select CLKSRC_OF
@@ -14,6 +15,8 @@ config ARCH_TEGRA
14 select MIGHT_HAVE_CACHE_L2X0 15 select MIGHT_HAVE_CACHE_L2X0
15 select MIGHT_HAVE_PCI 16 select MIGHT_HAVE_PCI
16 select PINCTRL 17 select PINCTRL
18 select ARCH_HAS_RESET_CONTROLLER
19 select RESET_CONTROLLER
17 select SOC_BUS 20 select SOC_BUS
18 select SPARSE_IRQ 21 select SPARSE_IRQ
19 select USB_ARCH_HAS_EHCI if USB_SUPPORT 22 select USB_ARCH_HAS_EHCI if USB_SUPPORT
@@ -63,6 +66,7 @@ config ARCH_TEGRA_124_SOC
63 bool "Enable support for Tegra124 family" 66 bool "Enable support for Tegra124 family"
64 select ARM_L1_CACHE_SHIFT_6 67 select ARM_L1_CACHE_SHIFT_6
65 select HAVE_ARM_ARCH_TIMER 68 select HAVE_ARM_ARCH_TIMER
69 select PINCTRL_TEGRA124
66 help 70 help
67 Support for NVIDIA Tegra T124 processor family, based on the 71 Support for NVIDIA Tegra T124 processor family, based on the
68 ARM CortexA15MP CPU 72 ARM CortexA15MP CPU
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 06f024070dab..e4dec9fcb084 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/gpio/driver.h>
21#include <linux/rfkill-gpio.h> 22#include <linux/rfkill-gpio.h>
22#include "board.h" 23#include "board.h"
23 24
@@ -36,7 +37,17 @@ static struct platform_device wifi_rfkill_device = {
36 }, 37 },
37}; 38};
38 39
40static struct gpiod_lookup_table wifi_gpio_lookup = {
41 .dev_id = "rfkill_gpio",
42 .table = {
43 GPIO_LOOKUP_IDX("tegra-gpio", 25, NULL, 0, 0),
44 GPIO_LOOKUP_IDX("tegra-gpio", 85, NULL, 1, 0),
45 { },
46 },
47};
48
39void __init tegra_paz00_wifikill_init(void) 49void __init tegra_paz00_wifikill_init(void)
40{ 50{
51 gpiod_add_lookup_table(&wifi_gpio_lookup);
41 platform_device_register(&wifi_rfkill_device); 52 platform_device_register(&wifi_rfkill_device);
42} 53}
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index 3a9c1f1c219d..c9ac23b385be 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -22,6 +22,7 @@
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/random.h>
25#include <linux/clk.h>
25#include <linux/tegra-soc.h> 26#include <linux/tegra-soc.h>
26 27
27#include "fuse.h" 28#include "fuse.h"
@@ -54,6 +55,7 @@ int tegra_cpu_speedo_id; /* only exist in Tegra30 and later */
54int tegra_soc_speedo_id; 55int tegra_soc_speedo_id;
55enum tegra_revision tegra_revision; 56enum tegra_revision tegra_revision;
56 57
58static struct clk *fuse_clk;
57static int tegra_fuse_spare_bit; 59static int tegra_fuse_spare_bit;
58static void (*tegra_init_speedo_data)(void); 60static void (*tegra_init_speedo_data)(void);
59 61
@@ -77,6 +79,22 @@ static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
77 [TEGRA_REVISION_A04] = "A04", 79 [TEGRA_REVISION_A04] = "A04",
78}; 80};
79 81
82static void tegra_fuse_enable_clk(void)
83{
84 if (IS_ERR(fuse_clk))
85 fuse_clk = clk_get_sys(NULL, "fuse");
86 if (IS_ERR(fuse_clk))
87 return;
88 clk_prepare_enable(fuse_clk);
89}
90
91static void tegra_fuse_disable_clk(void)
92{
93 if (IS_ERR(fuse_clk))
94 return;
95 clk_disable_unprepare(fuse_clk);
96}
97
80u32 tegra_fuse_readl(unsigned long offset) 98u32 tegra_fuse_readl(unsigned long offset)
81{ 99{
82 return tegra_apb_readl(TEGRA_FUSE_BASE + offset); 100 return tegra_apb_readl(TEGRA_FUSE_BASE + offset);
@@ -84,7 +102,15 @@ u32 tegra_fuse_readl(unsigned long offset)
84 102
85bool tegra_spare_fuse(int bit) 103bool tegra_spare_fuse(int bit)
86{ 104{
87 return tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4); 105 bool ret;
106
107 tegra_fuse_enable_clk();
108
109 ret = tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4);
110
111 tegra_fuse_disable_clk();
112
113 return ret;
88} 114}
89 115
90static enum tegra_revision tegra_get_revision(u32 id) 116static enum tegra_revision tegra_get_revision(u32 id)
@@ -113,10 +139,14 @@ static void tegra_get_process_id(void)
113{ 139{
114 u32 reg; 140 u32 reg;
115 141
142 tegra_fuse_enable_clk();
143
116 reg = tegra_fuse_readl(tegra_fuse_spare_bit); 144 reg = tegra_fuse_readl(tegra_fuse_spare_bit);
117 tegra_cpu_process_id = (reg >> 6) & 3; 145 tegra_cpu_process_id = (reg >> 6) & 3;
118 reg = tegra_fuse_readl(tegra_fuse_spare_bit); 146 reg = tegra_fuse_readl(tegra_fuse_spare_bit);
119 tegra_core_process_id = (reg >> 12) & 3; 147 tegra_core_process_id = (reg >> 12) & 3;
148
149 tegra_fuse_disable_clk();
120} 150}
121 151
122u32 tegra_read_chipid(void) 152u32 tegra_read_chipid(void)
@@ -159,6 +189,15 @@ void __init tegra_init_fuse(void)
159 reg |= 1 << 28; 189 reg |= 1 << 28;
160 writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48)); 190 writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
161 191
192 /*
193 * Enable FUSE clock. This needs to be hardcoded because the clock
194 * subsystem is not active during early boot.
195 */
196 reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
197 reg |= 1 << 7;
198 writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
199 fuse_clk = ERR_PTR(-EINVAL);
200
162 reg = tegra_fuse_readl(FUSE_SKU_INFO); 201 reg = tegra_fuse_readl(FUSE_SKU_INFO);
163 randomness[0] = reg; 202 randomness[0] = reg;
164 tegra_sku_id = reg & 0xFF; 203 tegra_sku_id = reg & 0xFF;
diff --git a/arch/arm/mach-tegra/iomap.h b/arch/arm/mach-tegra/iomap.h
index 26b1c2ad0ceb..ee79808e93a3 100644
--- a/arch/arm/mach-tegra/iomap.h
+++ b/arch/arm/mach-tegra/iomap.h
@@ -19,6 +19,7 @@
19#ifndef __MACH_TEGRA_IOMAP_H 19#ifndef __MACH_TEGRA_IOMAP_H
20#define __MACH_TEGRA_IOMAP_H 20#define __MACH_TEGRA_IOMAP_H
21 21
22#include <asm/pgtable.h>
22#include <asm/sizes.h> 23#include <asm/sizes.h>
23 24
24#define TEGRA_IRAM_BASE 0x40000000 25#define TEGRA_IRAM_BASE 0x40000000
@@ -115,27 +116,26 @@
115 * two 256MB io windows (that actually only use about 64KB 116 * two 256MB io windows (that actually only use about 64KB
116 * at the start of each). 117 * at the start of each).
117 * 118 *
118 * We will just map the first 1MB of each window (to minimize 119 * We will just map the first MMU section of each window (to minimize
119 * pt entries needed) and provide a macro to transform physical 120 * pt entries needed) and provide a macro to transform physical
120 * io addresses to an appropriate void __iomem *. 121 * io addresses to an appropriate void __iomem *.
121 *
122 */ 122 */
123 123
124#define IO_IRAM_PHYS 0x40000000 124#define IO_IRAM_PHYS 0x40000000
125#define IO_IRAM_VIRT IOMEM(0xFE400000) 125#define IO_IRAM_VIRT IOMEM(0xFE400000)
126#define IO_IRAM_SIZE SZ_256K 126#define IO_IRAM_SIZE SZ_256K
127 127
128#define IO_CPU_PHYS 0x50040000 128#define IO_CPU_PHYS 0x50040000
129#define IO_CPU_VIRT IOMEM(0xFE000000) 129#define IO_CPU_VIRT IOMEM(0xFE440000)
130#define IO_CPU_SIZE SZ_16K 130#define IO_CPU_SIZE SZ_16K
131 131
132#define IO_PPSB_PHYS 0x60000000 132#define IO_PPSB_PHYS 0x60000000
133#define IO_PPSB_VIRT IOMEM(0xFE200000) 133#define IO_PPSB_VIRT IOMEM(0xFE200000)
134#define IO_PPSB_SIZE SZ_1M 134#define IO_PPSB_SIZE SECTION_SIZE
135 135
136#define IO_APB_PHYS 0x70000000 136#define IO_APB_PHYS 0x70000000
137#define IO_APB_VIRT IOMEM(0xFE300000) 137#define IO_APB_VIRT IOMEM(0xFE000000)
138#define IO_APB_SIZE SZ_1M 138#define IO_APB_SIZE SECTION_SIZE
139 139
140#define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) 140#define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
141#define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst))) 141#define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst)))
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 85d28e756bb7..3d0c537d9b94 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -25,6 +25,7 @@
25#include <linux/export.h> 25#include <linux/export.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/reset.h>
28#include <linux/seq_file.h> 29#include <linux/seq_file.h>
29#include <linux/spinlock.h> 30#include <linux/spinlock.h>
30#include <linux/clk/tegra.h> 31#include <linux/clk/tegra.h>
@@ -33,6 +34,10 @@
33#include "fuse.h" 34#include "fuse.h"
34#include "iomap.h" 35#include "iomap.h"
35 36
37#define DPD_SAMPLE 0x020
38#define DPD_SAMPLE_ENABLE (1 << 0)
39#define DPD_SAMPLE_DISABLE (0 << 0)
40
36#define PWRGATE_TOGGLE 0x30 41#define PWRGATE_TOGGLE 0x30
37#define PWRGATE_TOGGLE_START (1 << 8) 42#define PWRGATE_TOGGLE_START (1 << 8)
38 43
@@ -40,6 +45,19 @@
40 45
41#define PWRGATE_STATUS 0x38 46#define PWRGATE_STATUS 0x38
42 47
48#define IO_DPD_REQ 0x1b8
49#define IO_DPD_REQ_CODE_IDLE (0 << 30)
50#define IO_DPD_REQ_CODE_OFF (1 << 30)
51#define IO_DPD_REQ_CODE_ON (2 << 30)
52#define IO_DPD_REQ_CODE_MASK (3 << 30)
53
54#define IO_DPD_STATUS 0x1bc
55#define IO_DPD2_REQ 0x1c0
56#define IO_DPD2_STATUS 0x1c4
57#define SEL_DPD_TIM 0x1c8
58
59#define GPU_RG_CNTRL 0x2d4
60
43static int tegra_num_powerdomains; 61static int tegra_num_powerdomains;
44static int tegra_num_cpu_domains; 62static int tegra_num_cpu_domains;
45static const u8 *tegra_cpu_domains; 63static const u8 *tegra_cpu_domains;
@@ -58,6 +76,13 @@ static const u8 tegra114_cpu_domains[] = {
58 TEGRA_POWERGATE_CPU3, 76 TEGRA_POWERGATE_CPU3,
59}; 77};
60 78
79static const u8 tegra124_cpu_domains[] = {
80 TEGRA_POWERGATE_CPU0,
81 TEGRA_POWERGATE_CPU1,
82 TEGRA_POWERGATE_CPU2,
83 TEGRA_POWERGATE_CPU3,
84};
85
61static DEFINE_SPINLOCK(tegra_powergate_lock); 86static DEFINE_SPINLOCK(tegra_powergate_lock);
62 87
63static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); 88static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
@@ -108,6 +133,7 @@ int tegra_powergate_power_off(int id)
108 133
109 return tegra_powergate_set(id, false); 134 return tegra_powergate_set(id, false);
110} 135}
136EXPORT_SYMBOL(tegra_powergate_power_off);
111 137
112int tegra_powergate_is_powered(int id) 138int tegra_powergate_is_powered(int id)
113{ 139{
@@ -128,12 +154,23 @@ int tegra_powergate_remove_clamping(int id)
128 return -EINVAL; 154 return -EINVAL;
129 155
130 /* 156 /*
157 * The Tegra124 GPU has a separate register (with different semantics)
158 * to remove clamps.
159 */
160 if (tegra_chip_id == TEGRA124) {
161 if (id == TEGRA_POWERGATE_3D) {
162 pmc_write(0, GPU_RG_CNTRL);
163 return 0;
164 }
165 }
166
167 /*
131 * Tegra 2 has a bug where PCIE and VDE clamping masks are 168 * Tegra 2 has a bug where PCIE and VDE clamping masks are
132 * swapped relatively to the partition ids 169 * swapped relatively to the partition ids
133 */ 170 */
134 if (id == TEGRA_POWERGATE_VDEC) 171 if (id == TEGRA_POWERGATE_VDEC)
135 mask = (1 << TEGRA_POWERGATE_PCIE); 172 mask = (1 << TEGRA_POWERGATE_PCIE);
136 else if (id == TEGRA_POWERGATE_PCIE) 173 else if (id == TEGRA_POWERGATE_PCIE)
137 mask = (1 << TEGRA_POWERGATE_VDEC); 174 mask = (1 << TEGRA_POWERGATE_VDEC);
138 else 175 else
139 mask = (1 << id); 176 mask = (1 << id);
@@ -142,13 +179,15 @@ int tegra_powergate_remove_clamping(int id)
142 179
143 return 0; 180 return 0;
144} 181}
182EXPORT_SYMBOL(tegra_powergate_remove_clamping);
145 183
146/* Must be called with clk disabled, and returns with clk enabled */ 184/* Must be called with clk disabled, and returns with clk enabled */
147int tegra_powergate_sequence_power_up(int id, struct clk *clk) 185int tegra_powergate_sequence_power_up(int id, struct clk *clk,
186 struct reset_control *rst)
148{ 187{
149 int ret; 188 int ret;
150 189
151 tegra_periph_reset_assert(clk); 190 reset_control_assert(rst);
152 191
153 ret = tegra_powergate_power_on(id); 192 ret = tegra_powergate_power_on(id);
154 if (ret) 193 if (ret)
@@ -165,7 +204,7 @@ int tegra_powergate_sequence_power_up(int id, struct clk *clk)
165 goto err_clamp; 204 goto err_clamp;
166 205
167 udelay(10); 206 udelay(10);
168 tegra_periph_reset_deassert(clk); 207 reset_control_deassert(rst);
169 208
170 return 0; 209 return 0;
171 210
@@ -202,6 +241,11 @@ int __init tegra_powergate_init(void)
202 tegra_num_cpu_domains = 4; 241 tegra_num_cpu_domains = 4;
203 tegra_cpu_domains = tegra114_cpu_domains; 242 tegra_cpu_domains = tegra114_cpu_domains;
204 break; 243 break;
244 case TEGRA124:
245 tegra_num_powerdomains = 25;
246 tegra_num_cpu_domains = 4;
247 tegra_cpu_domains = tegra124_cpu_domains;
248 break;
205 default: 249 default:
206 /* Unknown Tegra variant. Disable powergating */ 250 /* Unknown Tegra variant. Disable powergating */
207 tegra_num_powerdomains = 0; 251 tegra_num_powerdomains = 0;
@@ -243,12 +287,36 @@ static const char * const powergate_name_t30[] = {
243}; 287};
244 288
245static const char * const powergate_name_t114[] = { 289static const char * const powergate_name_t114[] = {
246 [TEGRA_POWERGATE_CPU] = "cpu0", 290 [TEGRA_POWERGATE_CPU] = "crail",
291 [TEGRA_POWERGATE_3D] = "3d",
292 [TEGRA_POWERGATE_VENC] = "venc",
293 [TEGRA_POWERGATE_VDEC] = "vdec",
294 [TEGRA_POWERGATE_MPE] = "mpe",
295 [TEGRA_POWERGATE_HEG] = "heg",
296 [TEGRA_POWERGATE_CPU1] = "cpu1",
297 [TEGRA_POWERGATE_CPU2] = "cpu2",
298 [TEGRA_POWERGATE_CPU3] = "cpu3",
299 [TEGRA_POWERGATE_CELP] = "celp",
300 [TEGRA_POWERGATE_CPU0] = "cpu0",
301 [TEGRA_POWERGATE_C0NC] = "c0nc",
302 [TEGRA_POWERGATE_C1NC] = "c1nc",
303 [TEGRA_POWERGATE_DIS] = "dis",
304 [TEGRA_POWERGATE_DISB] = "disb",
305 [TEGRA_POWERGATE_XUSBA] = "xusba",
306 [TEGRA_POWERGATE_XUSBB] = "xusbb",
307 [TEGRA_POWERGATE_XUSBC] = "xusbc",
308};
309
310static const char * const powergate_name_t124[] = {
311 [TEGRA_POWERGATE_CPU] = "crail",
247 [TEGRA_POWERGATE_3D] = "3d", 312 [TEGRA_POWERGATE_3D] = "3d",
248 [TEGRA_POWERGATE_VENC] = "venc", 313 [TEGRA_POWERGATE_VENC] = "venc",
314 [TEGRA_POWERGATE_PCIE] = "pcie",
249 [TEGRA_POWERGATE_VDEC] = "vdec", 315 [TEGRA_POWERGATE_VDEC] = "vdec",
316 [TEGRA_POWERGATE_L2] = "l2",
250 [TEGRA_POWERGATE_MPE] = "mpe", 317 [TEGRA_POWERGATE_MPE] = "mpe",
251 [TEGRA_POWERGATE_HEG] = "heg", 318 [TEGRA_POWERGATE_HEG] = "heg",
319 [TEGRA_POWERGATE_SATA] = "sata",
252 [TEGRA_POWERGATE_CPU1] = "cpu1", 320 [TEGRA_POWERGATE_CPU1] = "cpu1",
253 [TEGRA_POWERGATE_CPU2] = "cpu2", 321 [TEGRA_POWERGATE_CPU2] = "cpu2",
254 [TEGRA_POWERGATE_CPU3] = "cpu3", 322 [TEGRA_POWERGATE_CPU3] = "cpu3",
@@ -256,11 +324,14 @@ static const char * const powergate_name_t114[] = {
256 [TEGRA_POWERGATE_CPU0] = "cpu0", 324 [TEGRA_POWERGATE_CPU0] = "cpu0",
257 [TEGRA_POWERGATE_C0NC] = "c0nc", 325 [TEGRA_POWERGATE_C0NC] = "c0nc",
258 [TEGRA_POWERGATE_C1NC] = "c1nc", 326 [TEGRA_POWERGATE_C1NC] = "c1nc",
327 [TEGRA_POWERGATE_SOR] = "sor",
259 [TEGRA_POWERGATE_DIS] = "dis", 328 [TEGRA_POWERGATE_DIS] = "dis",
260 [TEGRA_POWERGATE_DISB] = "disb", 329 [TEGRA_POWERGATE_DISB] = "disb",
261 [TEGRA_POWERGATE_XUSBA] = "xusba", 330 [TEGRA_POWERGATE_XUSBA] = "xusba",
262 [TEGRA_POWERGATE_XUSBB] = "xusbb", 331 [TEGRA_POWERGATE_XUSBB] = "xusbb",
263 [TEGRA_POWERGATE_XUSBC] = "xusbc", 332 [TEGRA_POWERGATE_XUSBC] = "xusbc",
333 [TEGRA_POWERGATE_VIC] = "vic",
334 [TEGRA_POWERGATE_IRAM] = "iram",
264}; 335};
265 336
266static int powergate_show(struct seq_file *s, void *data) 337static int powergate_show(struct seq_file *s, void *data)
@@ -307,6 +378,9 @@ int __init tegra_powergate_debugfs_init(void)
307 case TEGRA114: 378 case TEGRA114:
308 powergate_name = powergate_name_t114; 379 powergate_name = powergate_name_t114;
309 break; 380 break;
381 case TEGRA124:
382 powergate_name = powergate_name_t124;
383 break;
310 } 384 }
311 385
312 if (powergate_name) { 386 if (powergate_name) {
@@ -320,3 +394,120 @@ int __init tegra_powergate_debugfs_init(void)
320} 394}
321 395
322#endif 396#endif
397
398static int tegra_io_rail_prepare(int id, unsigned long *request,
399 unsigned long *status, unsigned int *bit)
400{
401 unsigned long rate, value;
402 struct clk *clk;
403
404 *bit = id % 32;
405
406 /*
407 * There are two sets of 30 bits to select IO rails, but bits 30 and
408 * 31 are control bits rather than IO rail selection bits.
409 */
410 if (id > 63 || *bit == 30 || *bit == 31)
411 return -EINVAL;
412
413 if (id < 32) {
414 *status = IO_DPD_STATUS;
415 *request = IO_DPD_REQ;
416 } else {
417 *status = IO_DPD2_STATUS;
418 *request = IO_DPD2_REQ;
419 }
420
421 clk = clk_get_sys(NULL, "pclk");
422 if (IS_ERR(clk))
423 return PTR_ERR(clk);
424
425 rate = clk_get_rate(clk);
426 clk_put(clk);
427
428 pmc_write(DPD_SAMPLE_ENABLE, DPD_SAMPLE);
429
430 /* must be at least 200 ns, in APB (PCLK) clock cycles */
431 value = DIV_ROUND_UP(1000000000, rate);
432 value = DIV_ROUND_UP(200, value);
433 pmc_write(value, SEL_DPD_TIM);
434
435 return 0;
436}
437
438static int tegra_io_rail_poll(unsigned long offset, unsigned long mask,
439 unsigned long val, unsigned long timeout)
440{
441 unsigned long value;
442
443 timeout = jiffies + msecs_to_jiffies(timeout);
444
445 while (time_after(timeout, jiffies)) {
446 value = pmc_read(offset);
447 if ((value & mask) == val)
448 return 0;
449
450 usleep_range(250, 1000);
451 }
452
453 return -ETIMEDOUT;
454}
455
456static void tegra_io_rail_unprepare(void)
457{
458 pmc_write(DPD_SAMPLE_DISABLE, DPD_SAMPLE);
459}
460
461int tegra_io_rail_power_on(int id)
462{
463 unsigned long request, status, value;
464 unsigned int bit, mask;
465 int err;
466
467 err = tegra_io_rail_prepare(id, &request, &status, &bit);
468 if (err < 0)
469 return err;
470
471 mask = 1 << bit;
472
473 value = pmc_read(request);
474 value |= mask;
475 value &= ~IO_DPD_REQ_CODE_MASK;
476 value |= IO_DPD_REQ_CODE_OFF;
477 pmc_write(value, request);
478
479 err = tegra_io_rail_poll(status, mask, 0, 250);
480 if (err < 0)
481 return err;
482
483 tegra_io_rail_unprepare();
484
485 return 0;
486}
487
488int tegra_io_rail_power_off(int id)
489{
490 unsigned long request, status, value;
491 unsigned int bit, mask;
492 int err;
493
494 err = tegra_io_rail_prepare(id, &request, &status, &bit);
495 if (err < 0)
496 return err;
497
498 mask = 1 << bit;
499
500 value = pmc_read(request);
501 value |= mask;
502 value &= ~IO_DPD_REQ_CODE_MASK;
503 value |= IO_DPD_REQ_CODE_ON;
504 pmc_write(value, request);
505
506 err = tegra_io_rail_poll(status, mask, mask, 250);
507 if (err < 0)
508 return err;
509
510 tegra_io_rail_unprepare();
511
512 return 0;
513}
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index 568f5bbf979d..146fe8e0ae7c 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -21,6 +21,7 @@
21 21
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/hardware/cache-l2x0.h> 23#include <asm/hardware/cache-l2x0.h>
24#include <asm/firmware.h>
24 25
25#include "iomap.h" 26#include "iomap.h"
26#include "irammap.h" 27#include "irammap.h"
@@ -33,26 +34,18 @@
33 34
34static bool is_enabled; 35static bool is_enabled;
35 36
36static void __init tegra_cpu_reset_handler_enable(void) 37static void __init tegra_cpu_reset_handler_set(const u32 reset_address)
37{ 38{
38 void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
39 void __iomem *evp_cpu_reset = 39 void __iomem *evp_cpu_reset =
40 IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE + 0x100); 40 IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE + 0x100);
41 void __iomem *sb_ctrl = IO_ADDRESS(TEGRA_SB_BASE); 41 void __iomem *sb_ctrl = IO_ADDRESS(TEGRA_SB_BASE);
42 u32 reg; 42 u32 reg;
43 43
44 BUG_ON(is_enabled);
45 BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
46
47 memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
48 tegra_cpu_reset_handler_size);
49
50 /* 44 /*
51 * NOTE: This must be the one and only write to the EVP CPU reset 45 * NOTE: This must be the one and only write to the EVP CPU reset
52 * vector in the entire system. 46 * vector in the entire system.
53 */ 47 */
54 writel(TEGRA_IRAM_RESET_BASE + tegra_cpu_reset_handler_offset, 48 writel(reset_address, evp_cpu_reset);
55 evp_cpu_reset);
56 wmb(); 49 wmb();
57 reg = readl(evp_cpu_reset); 50 reg = readl(evp_cpu_reset);
58 51
@@ -66,8 +59,33 @@ static void __init tegra_cpu_reset_handler_enable(void)
66 writel(reg, sb_ctrl); 59 writel(reg, sb_ctrl);
67 wmb(); 60 wmb();
68 } 61 }
62}
63
64static void __init tegra_cpu_reset_handler_enable(void)
65{
66 void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
67 const u32 reset_address = TEGRA_IRAM_RESET_BASE +
68 tegra_cpu_reset_handler_offset;
69 int err;
70
71 BUG_ON(is_enabled);
72 BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
69 73
70 is_enabled = true; 74 memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
75 tegra_cpu_reset_handler_size);
76
77 err = call_firmware_op(set_cpu_boot_addr, 0, reset_address);
78 switch (err) {
79 case -ENOSYS:
80 tegra_cpu_reset_handler_set(reset_address);
81 /* pass-through */
82 case 0:
83 is_enabled = true;
84 break;
85 default:
86 pr_crit("Cannot set CPU reset handler: %d\n", err);
87 BUG();
88 }
71} 89}
72 90
73void __init tegra_cpu_reset_handler_init(void) 91void __init tegra_cpu_reset_handler_init(void)
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 73368176c6e8..303a285d80fd 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -40,6 +40,7 @@
40#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
41#include <asm/mach/time.h> 41#include <asm/mach/time.h>
42#include <asm/setup.h> 42#include <asm/setup.h>
43#include <asm/trusted_foundations.h>
43 44
44#include "apbio.h" 45#include "apbio.h"
45#include "board.h" 46#include "board.h"
@@ -60,15 +61,13 @@
60 * kernel is loaded. The data is declared here rather than debug-macro.S so 61 * 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 * that multiple inclusions of debug-macro.S point at the same data.
62 */ 63 */
63u32 tegra_uart_config[4] = { 64u32 tegra_uart_config[3] = {
64 /* Debug UART initialization required */ 65 /* Debug UART initialization required */
65 1, 66 1,
66 /* Debug UART physical address */ 67 /* Debug UART physical address */
67 0, 68 0,
68 /* Debug UART virtual address */ 69 /* Debug UART virtual address */
69 0, 70 0,
70 /* Scratch space for debug macro */
71 0,
72}; 71};
73 72
74static void __init tegra_init_cache(void) 73static void __init tegra_init_cache(void)
@@ -90,6 +89,7 @@ static void __init tegra_init_cache(void)
90 89
91static void __init tegra_init_early(void) 90static void __init tegra_init_early(void)
92{ 91{
92 of_register_trusted_foundations();
93 tegra_apb_io_init(); 93 tegra_apb_io_init();
94 tegra_init_fuse(); 94 tegra_init_fuse();
95 tegra_cpu_reset_handler_init(); 95 tegra_cpu_reset_handler_init();
diff --git a/arch/arm/mach-u300/regulator.c b/arch/arm/mach-u300/regulator.c
index bf40cd478fe9..0493a845b6bc 100644
--- a/arch/arm/mach-u300/regulator.c
+++ b/arch/arm/mach-u300/regulator.c
@@ -69,9 +69,9 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
69 return -ENODEV; 69 return -ENODEV;
70 } 70 }
71 regmap = syscon_node_to_regmap(syscon_np); 71 regmap = syscon_node_to_regmap(syscon_np);
72 if (!regmap) { 72 if (IS_ERR(regmap)) {
73 pr_crit("U300: could not locate syscon regmap\n"); 73 pr_crit("U300: could not locate syscon regmap\n");
74 return -ENODEV; 74 return PTR_ERR(regmap);
75 } 75 }
76 76
77 main_power_15 = regulator_get(&pdev->dev, "vana15"); 77 main_power_15 = regulator_get(&pdev->dev, "vana15");
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index 9a5f9fb352ce..fe08fd34c0ce 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -184,11 +184,13 @@
184#define U300_TIMER_APP_CRC (0x100) 184#define U300_TIMER_APP_CRC (0x100)
185#define U300_TIMER_APP_CRC_CLOCK_REQUEST_ENABLE (0x00000001) 185#define U300_TIMER_APP_CRC_CLOCK_REQUEST_ENABLE (0x00000001)
186 186
187#define TICKS_PER_JIFFY ((CLOCK_TICK_RATE + (HZ/2)) / HZ)
188#define US_PER_TICK ((1000000 + (HZ/2)) / HZ)
189
190static void __iomem *u300_timer_base; 187static void __iomem *u300_timer_base;
191 188
189struct u300_clockevent_data {
190 struct clock_event_device cevd;
191 unsigned ticks_per_jiffy;
192};
193
192/* 194/*
193 * The u300_set_mode() function is always called first, if we 195 * The u300_set_mode() function is always called first, if we
194 * have oneshot timer active, the oneshot scheduling function 196 * have oneshot timer active, the oneshot scheduling function
@@ -197,6 +199,9 @@ static void __iomem *u300_timer_base;
197static void u300_set_mode(enum clock_event_mode mode, 199static void u300_set_mode(enum clock_event_mode mode,
198 struct clock_event_device *evt) 200 struct clock_event_device *evt)
199{ 201{
202 struct u300_clockevent_data *cevdata =
203 container_of(evt, struct u300_clockevent_data, cevd);
204
200 switch (mode) { 205 switch (mode) {
201 case CLOCK_EVT_MODE_PERIODIC: 206 case CLOCK_EVT_MODE_PERIODIC:
202 /* Disable interrupts on GPT1 */ 207 /* Disable interrupts on GPT1 */
@@ -209,7 +214,7 @@ static void u300_set_mode(enum clock_event_mode mode,
209 * Set the periodic mode to a certain number of ticks per 214 * Set the periodic mode to a certain number of ticks per
210 * jiffy. 215 * jiffy.
211 */ 216 */
212 writel(TICKS_PER_JIFFY, 217 writel(cevdata->ticks_per_jiffy,
213 u300_timer_base + U300_TIMER_APP_GPT1TC); 218 u300_timer_base + U300_TIMER_APP_GPT1TC);
214 /* 219 /*
215 * Set continuous mode, so the timer keeps triggering 220 * Set continuous mode, so the timer keeps triggering
@@ -305,20 +310,23 @@ static int u300_set_next_event(unsigned long cycles,
305 return 0; 310 return 0;
306} 311}
307 312
308 313static struct u300_clockevent_data u300_clockevent_data = {
309/* Use general purpose timer 1 as clock event */ 314 /* Use general purpose timer 1 as clock event */
310static struct clock_event_device clockevent_u300_1mhz = { 315 .cevd = {
311 .name = "GPT1", 316 .name = "GPT1",
312 .rating = 300, /* Reasonably fast and accurate clock event */ 317 /* Reasonably fast and accurate clock event */
313 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 318 .rating = 300,
314 .set_next_event = u300_set_next_event, 319 .features = CLOCK_EVT_FEAT_PERIODIC |
315 .set_mode = u300_set_mode, 320 CLOCK_EVT_FEAT_ONESHOT,
321 .set_next_event = u300_set_next_event,
322 .set_mode = u300_set_mode,
323 },
316}; 324};
317 325
318/* Clock event timer interrupt handler */ 326/* Clock event timer interrupt handler */
319static irqreturn_t u300_timer_interrupt(int irq, void *dev_id) 327static irqreturn_t u300_timer_interrupt(int irq, void *dev_id)
320{ 328{
321 struct clock_event_device *evt = &clockevent_u300_1mhz; 329 struct clock_event_device *evt = &u300_clockevent_data.cevd;
322 /* ACK/Clear timer IRQ for the APP GPT1 Timer */ 330 /* ACK/Clear timer IRQ for the APP GPT1 Timer */
323 331
324 writel(U300_TIMER_APP_GPT1IA_IRQ_ACK, 332 writel(U300_TIMER_APP_GPT1IA_IRQ_ACK,
@@ -341,7 +349,7 @@ static struct irqaction u300_timer_irq = {
341 * stamp. (Inspired by OMAP implementation.) 349 * stamp. (Inspired by OMAP implementation.)
342 */ 350 */
343 351
344static u32 notrace u300_read_sched_clock(void) 352static u64 notrace u300_read_sched_clock(void)
345{ 353{
346 return readl(u300_timer_base + U300_TIMER_APP_GPT2CC); 354 return readl(u300_timer_base + U300_TIMER_APP_GPT2CC);
347} 355}
@@ -379,7 +387,9 @@ static void __init u300_timer_init_of(struct device_node *np)
379 clk_prepare_enable(clk); 387 clk_prepare_enable(clk);
380 rate = clk_get_rate(clk); 388 rate = clk_get_rate(clk);
381 389
382 setup_sched_clock(u300_read_sched_clock, 32, rate); 390 u300_clockevent_data.ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ);
391
392 sched_clock_register(u300_read_sched_clock, 32, rate);
383 393
384 u300_delay_timer.read_current_timer = &u300_read_current_timer; 394 u300_delay_timer.read_current_timer = &u300_read_current_timer;
385 u300_delay_timer.freq = rate; 395 u300_delay_timer.freq = rate;
@@ -428,7 +438,7 @@ static void __init u300_timer_init_of(struct device_node *np)
428 pr_err("timer: failed to initialize U300 clock source\n"); 438 pr_err("timer: failed to initialize U300 clock source\n");
429 439
430 /* Configure and register the clockevent */ 440 /* Configure and register the clockevent */
431 clockevents_config_and_register(&clockevent_u300_1mhz, rate, 441 clockevents_config_and_register(&u300_clockevent_data.cevd, rate,
432 1, 0xffffffff); 442 1, 0xffffffff);
433 443
434 /* 444 /*
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 616b96e86ad4..d05ba759da30 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -2,10 +2,10 @@
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 id.o timer.o pm.o 5obj-y := cpu.o id.o timer.o pm.o
6obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 6obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o 7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o
8obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \ 8obj-$(CONFIG_MACH_MOP500) += board-mop500-sdi.o \
9 board-mop500-regulators.o \ 9 board-mop500-regulators.o \
10 board-mop500-pins.o \ 10 board-mop500-pins.o \
11 board-mop500-audio.o 11 board-mop500-audio.o
diff --git a/arch/arm/mach-ux500/board-mop500-audio.c b/arch/arm/mach-ux500/board-mop500-audio.c
index 154e15f59702..9309ad4cbd09 100644
--- a/arch/arm/mach-ux500/board-mop500-audio.c
+++ b/arch/arm/mach-ux500/board-mop500-audio.c
@@ -7,16 +7,13 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/gpio.h> 9#include <linux/gpio.h>
10#include <linux/platform_data/pinctrl-nomadik.h>
11#include <linux/platform_data/dma-ste-dma40.h> 10#include <linux/platform_data/dma-ste-dma40.h>
12 11
13#include "devices.h"
14#include "irqs.h" 12#include "irqs.h"
15#include <linux/platform_data/asoc-ux500-msp.h> 13#include <linux/platform_data/asoc-ux500-msp.h>
16 14
17#include "ste-dma40-db8500.h" 15#include "ste-dma40-db8500.h"
18#include "board-mop500.h" 16#include "board-mop500.h"
19#include "devices-db8500.h"
20 17
21static struct stedma40_chan_cfg msp0_dma_rx = { 18static struct stedma40_chan_cfg msp0_dma_rx = {
22 .high_priority = true, 19 .high_priority = true,
@@ -31,7 +28,7 @@ static struct stedma40_chan_cfg msp0_dma_tx = {
31}; 28};
32 29
33struct msp_i2s_platform_data msp0_platform_data = { 30struct msp_i2s_platform_data msp0_platform_data = {
34 .id = MSP_I2S_0, 31 .id = 0,
35 .msp_i2s_dma_rx = &msp0_dma_rx, 32 .msp_i2s_dma_rx = &msp0_dma_rx,
36 .msp_i2s_dma_tx = &msp0_dma_tx, 33 .msp_i2s_dma_tx = &msp0_dma_tx,
37}; 34};
@@ -49,7 +46,7 @@ static struct stedma40_chan_cfg msp1_dma_tx = {
49}; 46};
50 47
51struct msp_i2s_platform_data msp1_platform_data = { 48struct msp_i2s_platform_data msp1_platform_data = {
52 .id = MSP_I2S_1, 49 .id = 1,
53 .msp_i2s_dma_rx = NULL, 50 .msp_i2s_dma_rx = NULL,
54 .msp_i2s_dma_tx = &msp1_dma_tx, 51 .msp_i2s_dma_tx = &msp1_dma_tx,
55}; 52};
@@ -69,13 +66,13 @@ static struct stedma40_chan_cfg msp2_dma_tx = {
69}; 66};
70 67
71struct msp_i2s_platform_data msp2_platform_data = { 68struct msp_i2s_platform_data msp2_platform_data = {
72 .id = MSP_I2S_2, 69 .id = 2,
73 .msp_i2s_dma_rx = &msp2_dma_rx, 70 .msp_i2s_dma_rx = &msp2_dma_rx,
74 .msp_i2s_dma_tx = &msp2_dma_tx, 71 .msp_i2s_dma_tx = &msp2_dma_tx,
75}; 72};
76 73
77struct msp_i2s_platform_data msp3_platform_data = { 74struct msp_i2s_platform_data msp3_platform_data = {
78 .id = MSP_I2S_3, 75 .id = 3,
79 .msp_i2s_dma_rx = &msp1_dma_rx, 76 .msp_i2s_dma_rx = &msp1_dma_rx,
80 .msp_i2s_dma_tx = NULL, 77 .msp_i2s_dma_tx = NULL,
81}; 78};
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index 0efb1560fc35..f63619b69113 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -10,94 +10,18 @@
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pinctrl/machine.h> 11#include <linux/pinctrl/machine.h>
12#include <linux/pinctrl/pinconf-generic.h> 12#include <linux/pinctrl/pinconf-generic.h>
13#include <linux/platform_data/pinctrl-nomadik.h>
14 13
15#include <asm/mach-types.h> 14#include <asm/mach-types.h>
16 15
17#include "board-mop500.h" 16#include "board-mop500.h"
18 17
19enum custom_pin_cfg_t {
20 PINS_FOR_DEFAULT,
21 PINS_FOR_U9500,
22};
23
24static enum custom_pin_cfg_t pinsfor;
25
26/* These simply sets bias for pins */ 18/* These simply sets bias for pins */
27#define BIAS(a,b) static unsigned long a[] = { b } 19#define BIAS(a,b) static unsigned long a[] = { b }
28 20
29BIAS(pd, PIN_PULL_DOWN);
30BIAS(in_nopull, PIN_INPUT_NOPULL);
31BIAS(in_nopull_slpm_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE);
32BIAS(in_pu, PIN_INPUT_PULLUP);
33BIAS(in_pd, PIN_INPUT_PULLDOWN);
34BIAS(out_hi, PIN_OUTPUT_HIGH);
35BIAS(out_lo, PIN_OUTPUT_LOW);
36BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE);
37
38BIAS(abx500_out_lo, PIN_CONF_PACKED(PIN_CONFIG_OUTPUT, 0)); 21BIAS(abx500_out_lo, PIN_CONF_PACKED(PIN_CONFIG_OUTPUT, 0));
39BIAS(abx500_in_pd, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 1)); 22BIAS(abx500_in_pd, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 1));
40BIAS(abx500_in_nopull, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 0)); 23BIAS(abx500_in_nopull, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 0));
41 24
42/* These also force them into GPIO mode */
43BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED);
44BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED);
45BIAS(gpio_in_pu_slpm_gpio_nopull, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
46BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
47BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED);
48BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED);
49/* Sleep modes */
50BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|
51 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
52BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
53 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
54BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|
55 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
56BIAS(slpm_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
57 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
58BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED|
59 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED);
60BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|
61 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
62BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|
63 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
64BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|
65 PIN_SLPM_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
66BIAS(slpm_in_pu_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_PULLUP|
67 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
68BIAS(slpm_out_wkup_pdis, PIN_SLEEPMODE_ENABLED|
69 PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
70BIAS(out_lo_wkup_pdis, PIN_SLPM_OUTPUT_LOW|
71 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
72BIAS(in_wkup_pdis_en, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
73 PIN_SLPM_PDIS_ENABLED);
74BIAS(in_wkup_pdis, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
75 PIN_SLPM_PDIS_DISABLED);
76BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|
77 PIN_SLPM_PDIS_DISABLED);
78
79/* We use these to define hog settings that are always done on boot */
80#define DB8500_MUX_HOG(group,func) \
81 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func)
82#define DB8500_PIN_HOG(pin,conf) \
83 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf)
84
85/* These are default states associated with device and changed runtime */
86#define DB8500_MUX(group,func,dev) \
87 PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func)
88#define DB8500_PIN(pin,conf,dev) \
89 PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf)
90#define DB8500_PIN_IDLE(pin, conf, dev) \
91 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_IDLE, "pinctrl-db8500", \
92 pin, conf)
93#define DB8500_PIN_SLEEP(pin, conf, dev) \
94 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \
95 pin, conf)
96#define DB8500_MUX_STATE(group, func, dev, state) \
97 PIN_MAP_MUX_GROUP(dev, state, "pinctrl-db8500", group, func)
98#define DB8500_PIN_STATE(pin, conf, dev, state) \
99 PIN_MAP_CONFIGS_PIN(dev, state, "pinctrl-db8500", pin, conf)
100
101#define AB8500_MUX_HOG(group, func) \ 25#define AB8500_MUX_HOG(group, func) \
102 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-ab8500.0", group, func) 26 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-ab8500.0", group, func)
103#define AB8500_PIN_HOG(pin, conf) \ 27#define AB8500_PIN_HOG(pin, conf) \
@@ -344,725 +268,8 @@ static struct pinctrl_map __initdata ab8505_pinmap[] = {
344 AB8505_PIN_HOG("GPIO53_D15", in_pd), 268 AB8505_PIN_HOG("GPIO53_D15", in_pd),
345}; 269};
346 270
347/* Pin control settings */
348static struct pinctrl_map __initdata mop500_family_pinmap[] = {
349 /*
350 * uMSP0, mux in 4 pins, regular placement of RX/TX
351 * explicitly set the pins to no pull
352 */
353 DB8500_MUX_HOG("msp0txrx_a_1", "msp0"),
354 DB8500_MUX_HOG("msp0tfstck_a_1", "msp0"),
355 DB8500_PIN_HOG("GPIO12_AC4", in_nopull), /* TXD */
356 DB8500_PIN_HOG("GPIO15_AC3", in_nopull), /* RXD */
357 DB8500_PIN_HOG("GPIO13_AF3", in_nopull), /* TFS */
358 DB8500_PIN_HOG("GPIO14_AE3", in_nopull), /* TCK */
359 /* MSP2 for HDMI, pull down TXD, TCK, TFS */
360 DB8500_MUX_HOG("msp2_a_1", "msp2"),
361 DB8500_PIN_HOG("GPIO193_AH27", in_pd), /* TXD */
362 DB8500_PIN_HOG("GPIO194_AF27", in_pd), /* TCK */
363 DB8500_PIN_HOG("GPIO195_AG28", in_pd), /* TFS */
364 DB8500_PIN_HOG("GPIO196_AG26", out_lo), /* RXD */
365 /*
366 * LCD, set TE0 (using LCD VSI0) and D14 (touch screen interrupt) to
367 * pull-up
368 * TODO: is this really correct? Snowball doesn't have a LCD.
369 */
370 DB8500_MUX_HOG("lcdvsi0_a_1", "lcd"),
371 DB8500_PIN_HOG("GPIO68_E1", in_pu),
372 DB8500_PIN_HOG("GPIO84_C2", gpio_in_pu),
373 /*
374 * STMPE1601/tc35893 keypad IRQ GPIO 218
375 * TODO: set for snowball and HREF really??
376 */
377 DB8500_PIN_HOG("GPIO218_AH11", gpio_in_pu),
378 /*
379 * UART0, we do not mux in u0 here.
380 * uart-0 pins gpio configuration should be kept intact to prevent
381 * a glitch in tx line when the tty dev is opened. Later these pins
382 * are configured by uart driver
383 */
384 DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */
385 DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */
386 DB8500_PIN_HOG("GPIO2_AH4", in_pu), /* RXD */
387 DB8500_PIN_HOG("GPIO3_AH3", out_hi), /* TXD */
388 /*
389 * Mux in UART2 on altfunction C and set pull-ups.
390 * TODO: is this used on U8500 variants and Snowball really?
391 * The setting on GPIO31 conflicts with magnetometer use on hrefv60
392 */
393 /* default state for UART2 */
394 DB8500_MUX("u2rxtx_c_1", "u2", "uart2"),
395 DB8500_PIN("GPIO29_W2", in_pu, "uart2"), /* RXD */
396 DB8500_PIN("GPIO30_W3", out_hi, "uart2"), /* TXD */
397 /* Sleep state for UART2 */
398 DB8500_PIN_SLEEP("GPIO29_W2", in_wkup_pdis, "uart2"),
399 DB8500_PIN_SLEEP("GPIO30_W3", out_wkup_pdis, "uart2"),
400 /*
401 * The following pin sets were known as "runtime pins" before being
402 * converted to the pinctrl model. Here we model them as "default"
403 * states.
404 */
405 /* Mux in UART0 after initialization */
406 DB8500_MUX("u0_a_1", "u0", "uart0"),
407 DB8500_PIN("GPIO0_AJ5", in_pu, "uart0"), /* CTS */
408 DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */
409 DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */
410 DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */
411 /* Sleep state for UART0 */
412 DB8500_PIN_SLEEP("GPIO0_AJ5", slpm_in_wkup_pdis, "uart0"),
413 DB8500_PIN_SLEEP("GPIO1_AJ3", slpm_out_hi_wkup_pdis, "uart0"),
414 DB8500_PIN_SLEEP("GPIO2_AH4", slpm_in_wkup_pdis, "uart0"),
415 DB8500_PIN_SLEEP("GPIO3_AH3", slpm_out_wkup_pdis, "uart0"),
416 /* Mux in UART1 after initialization */
417 DB8500_MUX("u1rxtx_a_1", "u1", "uart1"),
418 DB8500_PIN("GPIO4_AH6", in_pu, "uart1"), /* RXD */
419 DB8500_PIN("GPIO5_AG6", out_hi, "uart1"), /* TXD */
420 /* Sleep state for UART1 */
421 DB8500_PIN_SLEEP("GPIO4_AH6", slpm_in_wkup_pdis, "uart1"),
422 DB8500_PIN_SLEEP("GPIO5_AG6", slpm_out_wkup_pdis, "uart1"),
423 /* MSP1 for ALSA codec */
424 DB8500_MUX_HOG("msp1txrx_a_1", "msp1"),
425 DB8500_MUX_HOG("msp1_a_1", "msp1"),
426 DB8500_PIN_HOG("GPIO33_AF2", out_lo_slpm_nowkup),
427 DB8500_PIN_HOG("GPIO34_AE1", in_nopull_slpm_nowkup),
428 DB8500_PIN_HOG("GPIO35_AE2", in_nopull_slpm_nowkup),
429 DB8500_PIN_HOG("GPIO36_AG2", in_nopull_slpm_nowkup),
430 /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */
431 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"),
432 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"),
433 /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */
434 DB8500_MUX("lcdvsi1_a_1", "lcd", "0-0070"),
435 DB8500_PIN("GPIO69_E2", in_pu, "0-0070"),
436 /* LCD VSI1 sleep state */
437 DB8500_PIN_SLEEP("GPIO69_E2", slpm_in_wkup_pdis, "0-0070"),
438 /* Mux in i2c0 block, default state */
439 DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"),
440 /* i2c0 sleep state */
441 DB8500_PIN_SLEEP("GPIO147_C15", slpm_in_nopull_wkup_pdis, "nmk-i2c.0"), /* SDA */
442 DB8500_PIN_SLEEP("GPIO148_B16", slpm_in_nopull_wkup_pdis, "nmk-i2c.0"), /* SCL */
443 /* Mux in i2c1 block, default state */
444 DB8500_MUX("i2c1_b_2", "i2c1", "nmk-i2c.1"),
445 /* i2c1 sleep state */
446 DB8500_PIN_SLEEP("GPIO16_AD3", slpm_in_nopull_wkup_pdis, "nmk-i2c.1"), /* SDA */
447 DB8500_PIN_SLEEP("GPIO17_AD4", slpm_in_nopull_wkup_pdis, "nmk-i2c.1"), /* SCL */
448 /* Mux in i2c2 block, default state */
449 DB8500_MUX("i2c2_b_2", "i2c2", "nmk-i2c.2"),
450 /* i2c2 sleep state */
451 DB8500_PIN_SLEEP("GPIO10_AF5", slpm_in_nopull_wkup_pdis, "nmk-i2c.2"), /* SDA */
452 DB8500_PIN_SLEEP("GPIO11_AG4", slpm_in_nopull_wkup_pdis, "nmk-i2c.2"), /* SCL */
453 /* Mux in i2c3 block, default state */
454 DB8500_MUX("i2c3_c_2", "i2c3", "nmk-i2c.3"),
455 /* i2c3 sleep state */
456 DB8500_PIN_SLEEP("GPIO229_AG7", slpm_in_nopull_wkup_pdis, "nmk-i2c.3"), /* SDA */
457 DB8500_PIN_SLEEP("GPIO230_AF7", slpm_in_nopull_wkup_pdis, "nmk-i2c.3"), /* SCL */
458 /* Mux in SDI0 (here called MC0) used for removable MMC/SD/SDIO cards */
459 DB8500_MUX("mc0_a_1", "mc0", "sdi0"),
460 DB8500_PIN("GPIO18_AC2", out_hi, "sdi0"), /* CMDDIR */
461 DB8500_PIN("GPIO19_AC1", out_hi, "sdi0"), /* DAT0DIR */
462 DB8500_PIN("GPIO20_AB4", out_hi, "sdi0"), /* DAT2DIR */
463 DB8500_PIN("GPIO22_AA3", in_nopull, "sdi0"), /* FBCLK */
464 DB8500_PIN("GPIO23_AA4", out_lo, "sdi0"), /* CLK */
465 DB8500_PIN("GPIO24_AB2", in_pu, "sdi0"), /* CMD */
466 DB8500_PIN("GPIO25_Y4", in_pu, "sdi0"), /* DAT0 */
467 DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */
468 DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */
469 DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */
470 /* SDI0 sleep state */
471 DB8500_PIN_SLEEP("GPIO18_AC2", slpm_out_hi_wkup_pdis, "sdi0"),
472 DB8500_PIN_SLEEP("GPIO19_AC1", slpm_out_hi_wkup_pdis, "sdi0"),
473 DB8500_PIN_SLEEP("GPIO20_AB4", slpm_out_hi_wkup_pdis, "sdi0"),
474 DB8500_PIN_SLEEP("GPIO22_AA3", slpm_in_wkup_pdis, "sdi0"),
475 DB8500_PIN_SLEEP("GPIO23_AA4", slpm_out_lo_wkup_pdis, "sdi0"),
476 DB8500_PIN_SLEEP("GPIO24_AB2", slpm_in_wkup_pdis, "sdi0"),
477 DB8500_PIN_SLEEP("GPIO25_Y4", slpm_in_wkup_pdis, "sdi0"),
478 DB8500_PIN_SLEEP("GPIO26_Y2", slpm_in_wkup_pdis, "sdi0"),
479 DB8500_PIN_SLEEP("GPIO27_AA2", slpm_in_wkup_pdis, "sdi0"),
480 DB8500_PIN_SLEEP("GPIO28_AA1", slpm_in_wkup_pdis, "sdi0"),
481
482 /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */
483 DB8500_MUX("mc1_a_1", "mc1", "sdi1"),
484 DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */
485 DB8500_PIN("GPIO209_AG15", in_nopull, "sdi1"), /* FBCLK */
486 DB8500_PIN("GPIO210_AJ15", in_pu, "sdi1"), /* CMD */
487 DB8500_PIN("GPIO211_AG14", in_pu, "sdi1"), /* DAT0 */
488 DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */
489 DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */
490 DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */
491 /* SDI1 sleep state */
492 DB8500_PIN_SLEEP("GPIO208_AH16", slpm_out_lo_wkup_pdis, "sdi1"), /* CLK */
493 DB8500_PIN_SLEEP("GPIO209_AG15", slpm_in_wkup_pdis, "sdi1"), /* FBCLK */
494 DB8500_PIN_SLEEP("GPIO210_AJ15", slpm_in_wkup_pdis, "sdi1"), /* CMD */
495 DB8500_PIN_SLEEP("GPIO211_AG14", slpm_in_wkup_pdis, "sdi1"), /* DAT0 */
496 DB8500_PIN_SLEEP("GPIO212_AF13", slpm_in_wkup_pdis, "sdi1"), /* DAT1 */
497 DB8500_PIN_SLEEP("GPIO213_AG13", slpm_in_wkup_pdis, "sdi1"), /* DAT2 */
498 DB8500_PIN_SLEEP("GPIO214_AH15", slpm_in_wkup_pdis, "sdi1"), /* DAT3 */
499
500 /* Mux in SDI2 (here called MC2) used for for PoP eMMC */
501 DB8500_MUX("mc2_a_1", "mc2", "sdi2"),
502 DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */
503 DB8500_PIN("GPIO129_B4", in_pu, "sdi2"), /* CMD */
504 DB8500_PIN("GPIO130_C8", in_nopull, "sdi2"), /* FBCLK */
505 DB8500_PIN("GPIO131_A12", in_pu, "sdi2"), /* DAT0 */
506 DB8500_PIN("GPIO132_C10", in_pu, "sdi2"), /* DAT1 */
507 DB8500_PIN("GPIO133_B10", in_pu, "sdi2"), /* DAT2 */
508 DB8500_PIN("GPIO134_B9", in_pu, "sdi2"), /* DAT3 */
509 DB8500_PIN("GPIO135_A9", in_pu, "sdi2"), /* DAT4 */
510 DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */
511 DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */
512 DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */
513 /* SDI2 sleep state */
514 DB8500_PIN_SLEEP("GPIO128_A5", out_lo_wkup_pdis, "sdi2"), /* CLK */
515 DB8500_PIN_SLEEP("GPIO129_B4", in_wkup_pdis_en, "sdi2"), /* CMD */
516 DB8500_PIN_SLEEP("GPIO130_C8", in_wkup_pdis_en, "sdi2"), /* FBCLK */
517 DB8500_PIN_SLEEP("GPIO131_A12", in_wkup_pdis, "sdi2"), /* DAT0 */
518 DB8500_PIN_SLEEP("GPIO132_C10", in_wkup_pdis, "sdi2"), /* DAT1 */
519 DB8500_PIN_SLEEP("GPIO133_B10", in_wkup_pdis, "sdi2"), /* DAT2 */
520 DB8500_PIN_SLEEP("GPIO134_B9", in_wkup_pdis, "sdi2"), /* DAT3 */
521 DB8500_PIN_SLEEP("GPIO135_A9", in_wkup_pdis, "sdi2"), /* DAT4 */
522 DB8500_PIN_SLEEP("GPIO136_C7", in_wkup_pdis, "sdi2"), /* DAT5 */
523 DB8500_PIN_SLEEP("GPIO137_A7", in_wkup_pdis, "sdi2"), /* DAT6 */
524 DB8500_PIN_SLEEP("GPIO138_C5", in_wkup_pdis, "sdi2"), /* DAT7 */
525
526 /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */
527 DB8500_MUX("mc4_a_1", "mc4", "sdi4"),
528 DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */
529 DB8500_PIN("GPIO198_AG25", in_pu, "sdi4"), /* DAT2 */
530 DB8500_PIN("GPIO199_AH23", in_pu, "sdi4"), /* DAT1 */
531 DB8500_PIN("GPIO200_AH26", in_pu, "sdi4"), /* DAT0 */
532 DB8500_PIN("GPIO201_AF24", in_pu, "sdi4"), /* CMD */
533 DB8500_PIN("GPIO202_AF25", in_nopull, "sdi4"), /* FBCLK */
534 DB8500_PIN("GPIO203_AE23", out_lo, "sdi4"), /* CLK */
535 DB8500_PIN("GPIO204_AF23", in_pu, "sdi4"), /* DAT7 */
536 DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */
537 DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */
538 DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */
539 /*SDI4 sleep state */
540 DB8500_PIN_SLEEP("GPIO197_AH24", slpm_in_wkup_pdis, "sdi4"), /* DAT3 */
541 DB8500_PIN_SLEEP("GPIO198_AG25", slpm_in_wkup_pdis, "sdi4"), /* DAT2 */
542 DB8500_PIN_SLEEP("GPIO199_AH23", slpm_in_wkup_pdis, "sdi4"), /* DAT1 */
543 DB8500_PIN_SLEEP("GPIO200_AH26", slpm_in_wkup_pdis, "sdi4"), /* DAT0 */
544 DB8500_PIN_SLEEP("GPIO201_AF24", slpm_in_wkup_pdis, "sdi4"), /* CMD */
545 DB8500_PIN_SLEEP("GPIO202_AF25", slpm_in_wkup_pdis, "sdi4"), /* FBCLK */
546 DB8500_PIN_SLEEP("GPIO203_AE23", slpm_out_lo_wkup_pdis, "sdi4"), /* CLK */
547 DB8500_PIN_SLEEP("GPIO204_AF23", slpm_in_wkup_pdis, "sdi4"), /* DAT7 */
548 DB8500_PIN_SLEEP("GPIO205_AG23", slpm_in_wkup_pdis, "sdi4"), /* DAT6 */
549 DB8500_PIN_SLEEP("GPIO206_AG24", slpm_in_wkup_pdis, "sdi4"), /* DAT5 */
550 DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */
551
552 /* Mux in USB pins, drive STP high */
553 /* USB default state */
554 DB8500_MUX("usb_a_1", "usb", "ab8500-usb.0"),
555 DB8500_PIN("GPIO257_AE29", out_hi, "ab8500-usb.0"), /* STP */
556 /* USB sleep state */
557 DB8500_PIN_SLEEP("GPIO256_AF28", slpm_wkup_pdis_en, "ab8500-usb.0"), /* NXT */
558 DB8500_PIN_SLEEP("GPIO257_AE29", slpm_out_hi_wkup_pdis, "ab8500-usb.0"), /* STP */
559 DB8500_PIN_SLEEP("GPIO258_AD29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* XCLK */
560 DB8500_PIN_SLEEP("GPIO259_AC29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* DIR */
561 DB8500_PIN_SLEEP("GPIO260_AD28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT7 */
562 DB8500_PIN_SLEEP("GPIO261_AD26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT6 */
563 DB8500_PIN_SLEEP("GPIO262_AE26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT5 */
564 DB8500_PIN_SLEEP("GPIO263_AG29", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT4 */
565 DB8500_PIN_SLEEP("GPIO264_AE27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT3 */
566 DB8500_PIN_SLEEP("GPIO265_AD27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT2 */
567 DB8500_PIN_SLEEP("GPIO266_AC28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT1 */
568 DB8500_PIN_SLEEP("GPIO267_AC27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT0 */
569
570 /* Mux in SPI2 pins on the "other C1" altfunction */
571 DB8500_MUX("spi2_oc1_2", "spi2", "spi2"),
572 DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */
573 DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */
574 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */
575 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */
576 /* SPI2 idle state */
577 DB8500_PIN_IDLE("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
578 DB8500_PIN_IDLE("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
579 DB8500_PIN_IDLE("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
580 /* SPI2 sleep state */
581 DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */
582 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
583 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
584 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
585
586 /* ske default state */
587 DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
588 DB8500_PIN("GPIO153_B17", in_pd, "nmk-ske-keypad"), /* I7 */
589 DB8500_PIN("GPIO154_C16", in_pd, "nmk-ske-keypad"), /* I6 */
590 DB8500_PIN("GPIO155_C19", in_pd, "nmk-ske-keypad"), /* I5 */
591 DB8500_PIN("GPIO156_C17", in_pd, "nmk-ske-keypad"), /* I4 */
592 DB8500_PIN("GPIO161_D21", in_pd, "nmk-ske-keypad"), /* I3 */
593 DB8500_PIN("GPIO162_D20", in_pd, "nmk-ske-keypad"), /* I2 */
594 DB8500_PIN("GPIO163_C20", in_pd, "nmk-ske-keypad"), /* I1 */
595 DB8500_PIN("GPIO164_B21", in_pd, "nmk-ske-keypad"), /* I0 */
596 DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
597 DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
598 DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
599 DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
600 DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
601 DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
602 DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
603 DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
604 /* ske sleep state */
605 DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
606 DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
607 DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
608 DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
609 DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
610 DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
611 DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
612 DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
613 DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
614 DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
615 DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
616 DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
617 DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
618 DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
619 DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
620 DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
621
622 /* STM APE pins states */
623 DB8500_MUX_STATE("stmape_c_1", "stmape",
624 "stm", "ape_mipi34"),
625 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
626 "stm", "ape_mipi34"), /* clk */
627 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
628 "stm", "ape_mipi34"), /* dat3 */
629 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
630 "stm", "ape_mipi34"), /* dat2 */
631 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
632 "stm", "ape_mipi34"), /* dat1 */
633 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
634 "stm", "ape_mipi34"), /* dat0 */
635
636 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
637 "stm", "ape_mipi34_sleep"), /* clk */
638 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
639 "stm", "ape_mipi34_sleep"), /* dat3 */
640 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
641 "stm", "ape_mipi34_sleep"), /* dat2 */
642 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
643 "stm", "ape_mipi34_sleep"), /* dat1 */
644 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
645 "stm", "ape_mipi34_sleep"), /* dat0 */
646
647 DB8500_MUX_STATE("stmape_oc1_1", "stmape",
648 "stm", "ape_microsd"),
649 DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
650 "stm", "ape_microsd"), /* clk */
651 DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
652 "stm", "ape_microsd"), /* dat0 */
653 DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
654 "stm", "ape_microsd"), /* dat1 */
655 DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
656 "stm", "ape_microsd"), /* dat2 */
657 DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
658 "stm", "ape_microsd"), /* dat3 */
659
660 DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
661 "stm", "ape_microsd_sleep"), /* clk */
662 DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
663 "stm", "ape_microsd_sleep"), /* dat0 */
664 DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
665 "stm", "ape_microsd_sleep"), /* dat1 */
666 DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
667 "stm", "ape_microsd_sleep"), /* dat2 */
668 DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
669 "stm", "ape_microsd_sleep"), /* dat3 */
670
671 /* STM Modem pins states */
672 DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
673 "stm", "mod_mipi34"),
674 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
675 "stm", "mod_mipi34"),
676 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
677 "stm", "mod_mipi34"),
678 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
679 "stm", "mod_mipi34"), /* clk */
680 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
681 "stm", "mod_mipi34"), /* dat3 */
682 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
683 "stm", "mod_mipi34"), /* dat2 */
684 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
685 "stm", "mod_mipi34"), /* dat1 */
686 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
687 "stm", "mod_mipi34"), /* dat0 */
688 DB8500_PIN_STATE("GPIO75_H2", in_pu,
689 "stm", "mod_mipi34"), /* uartmod rx */
690 DB8500_PIN_STATE("GPIO76_J2", out_lo,
691 "stm", "mod_mipi34"), /* uartmod tx */
692
693 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
694 "stm", "mod_mipi34_sleep"), /* clk */
695 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
696 "stm", "mod_mipi34_sleep"), /* dat3 */
697 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
698 "stm", "mod_mipi34_sleep"), /* dat2 */
699 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
700 "stm", "mod_mipi34_sleep"), /* dat1 */
701 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
702 "stm", "mod_mipi34_sleep"), /* dat0 */
703 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
704 "stm", "mod_mipi34_sleep"), /* uartmod rx */
705 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
706 "stm", "mod_mipi34_sleep"), /* uartmod tx */
707
708 DB8500_MUX_STATE("stmmod_b_1", "stmmod",
709 "stm", "mod_microsd"),
710 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
711 "stm", "mod_microsd"),
712 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
713 "stm", "mod_microsd"),
714 DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
715 "stm", "mod_microsd"), /* clk */
716 DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
717 "stm", "mod_microsd"), /* dat0 */
718 DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
719 "stm", "mod_microsd"), /* dat1 */
720 DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
721 "stm", "mod_microsd"), /* dat2 */
722 DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
723 "stm", "mod_microsd"), /* dat3 */
724 DB8500_PIN_STATE("GPIO75_H2", in_pu,
725 "stm", "mod_microsd"), /* uartmod rx */
726 DB8500_PIN_STATE("GPIO76_J2", out_lo,
727 "stm", "mod_microsd"), /* uartmod tx */
728
729 DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
730 "stm", "mod_microsd_sleep"), /* clk */
731 DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
732 "stm", "mod_microsd_sleep"), /* dat0 */
733 DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
734 "stm", "mod_microsd_sleep"), /* dat1 */
735 DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
736 "stm", "mod_microsd_sleep"), /* dat2 */
737 DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
738 "stm", "mod_microsd_sleep"), /* dat3 */
739 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
740 "stm", "mod_microsd_sleep"), /* uartmod rx */
741 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
742 "stm", "mod_microsd_sleep"), /* uartmod tx */
743
744 /* STM dual Modem/APE pins state */
745 DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
746 "stm", "mod_mipi34_ape_mipi60"),
747 DB8500_MUX_STATE("stmape_c_2", "stmape",
748 "stm", "mod_mipi34_ape_mipi60"),
749 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
750 "stm", "mod_mipi34_ape_mipi60"),
751 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
752 "stm", "mod_mipi34_ape_mipi60"),
753 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
754 "stm", "mod_mipi34_ape_mipi60"), /* clk */
755 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
756 "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
757 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
758 "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
759 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
760 "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
761 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
762 "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
763 DB8500_PIN_STATE("GPIO75_H2", in_pu,
764 "stm", "mod_mipi34_ape_mipi60"), /* uartmod rx */
765 DB8500_PIN_STATE("GPIO76_J2", out_lo,
766 "stm", "mod_mipi34_ape_mipi60"), /* uartmod tx */
767 DB8500_PIN_STATE("GPIO155_C19", in_nopull,
768 "stm", "mod_mipi34_ape_mipi60"), /* clk */
769 DB8500_PIN_STATE("GPIO156_C17", in_nopull,
770 "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
771 DB8500_PIN_STATE("GPIO157_A18", in_nopull,
772 "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
773 DB8500_PIN_STATE("GPIO158_C18", in_nopull,
774 "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
775 DB8500_PIN_STATE("GPIO159_B19", in_nopull,
776 "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
777
778 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
779 "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
780 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
781 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
782 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
783 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
784 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
785 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
786 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
787 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
788 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
789 "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod rx */
790 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
791 "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod tx */
792 DB8500_PIN_STATE("GPIO155_C19", slpm_in_wkup_pdis,
793 "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
794 DB8500_PIN_STATE("GPIO156_C17", slpm_in_wkup_pdis,
795 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
796 DB8500_PIN_STATE("GPIO157_A18", slpm_in_wkup_pdis,
797 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
798 DB8500_PIN_STATE("GPIO158_C18", slpm_in_wkup_pdis,
799 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
800 DB8500_PIN_STATE("GPIO159_B19", slpm_in_wkup_pdis,
801 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
802};
803
804/*
805 * These are specifically for the MOP500 and HREFP (pre-v60) version of the
806 * board, which utilized a TC35892 GPIO expander instead of using a lot of
807 * on-chip pins as the HREFv60 and later does.
808 */
809static struct pinctrl_map __initdata mop500_pinmap[] = {
810 /* Mux in SSP0, pull down RXD pin */
811 DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
812 DB8500_PIN_HOG("GPIO145_C13", pd),
813 /*
814 * XENON Flashgun on image processor GPIO (controlled from image
815 * processor firmware), mux in these image processor GPIO lines 0
816 * (XENON_FLASH_ID) and 1 (XENON_READY) on altfunction C and pull up
817 * the pins.
818 */
819 DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
820 DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
821 DB8500_PIN_HOG("GPIO6_AF6", in_pu),
822 DB8500_PIN_HOG("GPIO7_AG5", in_pu),
823 /* TC35892 IRQ, pull up the line, let the driver mux in the pin */
824 DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu),
825 /* Mux in UART1 and set the pull-ups */
826 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
827 DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */
828 DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */
829 /*
830 * Runtime stuff: make it possible to mux in the SKE keypad
831 * and bias the pins
832 */
833 /* ske default state */
834 DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
835 DB8500_PIN("GPIO153_B17", in_pu, "nmk-ske-keypad"), /* I7 */
836 DB8500_PIN("GPIO154_C16", in_pu, "nmk-ske-keypad"), /* I6 */
837 DB8500_PIN("GPIO155_C19", in_pu, "nmk-ske-keypad"), /* I5 */
838 DB8500_PIN("GPIO156_C17", in_pu, "nmk-ske-keypad"), /* I4 */
839 DB8500_PIN("GPIO161_D21", in_pu, "nmk-ske-keypad"), /* I3 */
840 DB8500_PIN("GPIO162_D20", in_pu, "nmk-ske-keypad"), /* I2 */
841 DB8500_PIN("GPIO163_C20", in_pu, "nmk-ske-keypad"), /* I1 */
842 DB8500_PIN("GPIO164_B21", in_pu, "nmk-ske-keypad"), /* I0 */
843 DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
844 DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
845 DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
846 DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
847 DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
848 DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
849 DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
850 DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
851 /* ske sleep state */
852 DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
853 DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
854 DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
855 DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
856 DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
857 DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
858 DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
859 DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
860 DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
861 DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
862 DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
863 DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
864 DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
865 DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
866 DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
867 DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
868
869 /* Mux in and drive the SDI0 DAT31DIR line high at runtime */
870 DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"),
871 DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"),
872};
873
874/*
875 * The HREFv60 series of platforms is using available pins on the DB8500
876 * insteaf of the Toshiba I2C GPIO expander, reusing some pins like the SSP0
877 * and SSP1 ports (previously connected to the AB8500) as generic GPIO lines.
878 */
879static struct pinctrl_map __initdata hrefv60_pinmap[] = {
880 /* Drive WLAN_ENA low */
881 DB8500_PIN_HOG("GPIO85_D5", gpio_out_lo), /* WLAN_ENA */
882 /*
883 * XENON Flashgun on image processor GPIO (controlled from image
884 * processor firmware), mux in these image processor GPIO lines 0
885 * (XENON_FLASH_ID), 1 (XENON_READY) and there is an assistant
886 * LED on IP GPIO 4 (XENON_EN2) on altfunction C, that need bias
887 * from GPIO21 so pull up 0, 1 and drive 4 and GPIO21 low as output.
888 */
889 DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
890 DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
891 DB8500_MUX_HOG("ipgpio4_c_1", "ipgpio"),
892 DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* XENON_FLASH_ID */
893 DB8500_PIN_HOG("GPIO7_AG5", in_pu), /* XENON_READY */
894 DB8500_PIN_HOG("GPIO21_AB3", gpio_out_lo), /* XENON_EN1 */
895 DB8500_PIN_HOG("GPIO64_F3", out_lo), /* XENON_EN2 */
896 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
897 DB8500_PIN_HOG("GPIO31_V3", gpio_in_pu), /* EN1 */
898 DB8500_PIN_HOG("GPIO32_V2", gpio_in_pd), /* DRDY */
899 /*
900 * Display Interface 1 uses GPIO 65 for RST (reset).
901 * Display Interface 2 uses GPIO 66 for RST (reset).
902 * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
903 */
904 DB8500_PIN_HOG("GPIO65_F1", gpio_out_hi), /* DISP1 NO RST */
905 DB8500_PIN_HOG("GPIO66_G3", gpio_out_lo), /* DISP2 RST */
906 /*
907 * Touch screen uses GPIO 143 for RST1, GPIO 146 for RST2 and
908 * GPIO 67 for interrupts. Pull-up the IRQ line and drive both
909 * reset signals low.
910 */
911 DB8500_PIN_HOG("GPIO143_D12", gpio_out_lo), /* TOUCH_RST1 */
912 DB8500_PIN_HOG("GPIO67_G2", gpio_in_pu), /* TOUCH_INT2 */
913 DB8500_PIN_HOG("GPIO146_D13", gpio_out_lo), /* TOUCH_RST2 */
914 /*
915 * Drive D19-D23 for the ETM PTM trace interface low,
916 * (presumably pins are unconnected therefore grounded here,
917 * the "other alt C1" setting enables these pins)
918 */
919 DB8500_PIN_HOG("GPIO70_G5", gpio_out_lo),
920 DB8500_PIN_HOG("GPIO71_G4", gpio_out_lo),
921 DB8500_PIN_HOG("GPIO72_H4", gpio_out_lo),
922 DB8500_PIN_HOG("GPIO73_H3", gpio_out_lo),
923 DB8500_PIN_HOG("GPIO74_J3", gpio_out_lo),
924 /* NAHJ CTRL on GPIO 76 to low, CTRL_INV on GPIO216 to high */
925 DB8500_PIN_HOG("GPIO76_J2", gpio_out_lo), /* CTRL */
926 DB8500_PIN_HOG("GPIO216_AG12", gpio_out_hi), /* CTRL_INV */
927 /* NFC ENA and RESET to low, pulldown IRQ line */
928 DB8500_PIN_HOG("GPIO77_H1", gpio_out_lo), /* NFC_ENA */
929 DB8500_PIN_HOG("GPIO144_B13", gpio_in_pd), /* NFC_IRQ */
930 DB8500_PIN_HOG("GPIO142_C11", gpio_out_lo), /* NFC_RESET */
931 /*
932 * SKE keyboard partly on alt A and partly on "Other alt C1"
933 * Driver KP_O1,2,3,6,7 low and pull up KP_I 0,2,3 for three
934 * rows of 6 keys, then pull up force sensing interrup and
935 * drive reset and force sensing WU low.
936 */
937 DB8500_MUX_HOG("kp_a_1", "kp"),
938 DB8500_MUX_HOG("kp_oc1_1", "kp"),
939 DB8500_PIN_HOG("GPIO90_A3", out_lo), /* KP_O1 */
940 DB8500_PIN_HOG("GPIO87_B3", out_lo), /* KP_O2 */
941 DB8500_PIN_HOG("GPIO86_C6", out_lo), /* KP_O3 */
942 DB8500_PIN_HOG("GPIO96_D8", out_lo), /* KP_O6 */
943 DB8500_PIN_HOG("GPIO94_D7", out_lo), /* KP_O7 */
944 DB8500_PIN_HOG("GPIO93_B7", in_pu), /* KP_I0 */
945 DB8500_PIN_HOG("GPIO89_E6", in_pu), /* KP_I2 */
946 DB8500_PIN_HOG("GPIO88_C4", in_pu), /* KP_I3 */
947 DB8500_PIN_HOG("GPIO91_B6", gpio_in_pu), /* FORCE_SENSING_INT */
948 DB8500_PIN_HOG("GPIO92_D6", gpio_out_lo), /* FORCE_SENSING_RST */
949 DB8500_PIN_HOG("GPIO97_D9", gpio_out_lo), /* FORCE_SENSING_WU */
950 /* DiPro Sensor interrupt */
951 DB8500_PIN_HOG("GPIO139_C9", gpio_in_pu), /* DIPRO_INT */
952 /* Audio Amplifier HF enable */
953 DB8500_PIN_HOG("GPIO149_B14", gpio_out_hi), /* VAUDIO_HF_EN, enable MAX8968 */
954 /* GBF interface, pull low to reset state */
955 DB8500_PIN_HOG("GPIO171_D23", gpio_out_lo), /* GBF_ENA_RESET */
956 /* MSP : HDTV INTERFACE GPIO line */
957 DB8500_PIN_HOG("GPIO192_AJ27", gpio_in_pd),
958 /* Accelerometer interrupt lines */
959 DB8500_PIN_HOG("GPIO82_C1", gpio_in_pu), /* ACC_INT1 */
960 DB8500_PIN_HOG("GPIO83_D3", gpio_in_pu), /* ACC_INT2 */
961 /* SD card detect GPIO pin */
962 DB8500_PIN_HOG("GPIO95_E8", gpio_in_pu),
963 /*
964 * Runtime stuff
965 * Pull up/down of some sensor GPIO pins, for proximity, HAL sensor
966 * etc.
967 */
968 DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
969 DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"),
970 DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
971};
972
973static struct pinctrl_map __initdata u9500_pinmap[] = {
974 /* Mux in UART1 (just RX/TX) and set the pull-ups */
975 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
976 DB8500_PIN_HOG("GPIO4_AH6", in_pu),
977 DB8500_PIN_HOG("GPIO5_AG6", out_hi),
978 /* WLAN_IRQ line */
979 DB8500_PIN_HOG("GPIO144_B13", gpio_in_pu),
980 /* HSI */
981 DB8500_MUX_HOG("hsir_a_1", "hsi"),
982 DB8500_MUX_HOG("hsit_a_2", "hsi"),
983 DB8500_PIN_HOG("GPIO219_AG10", in_pd), /* RX FLA0 */
984 DB8500_PIN_HOG("GPIO220_AH10", in_pd), /* RX DAT0 */
985 DB8500_PIN_HOG("GPIO221_AJ11", out_lo), /* RX RDY0 */
986 DB8500_PIN_HOG("GPIO222_AJ9", out_lo), /* TX FLA0 */
987 DB8500_PIN_HOG("GPIO223_AH9", out_lo), /* TX DAT0 */
988 DB8500_PIN_HOG("GPIO224_AG9", in_pd), /* TX RDY0 */
989 DB8500_PIN_HOG("GPIO225_AG8", in_pd), /* CAWAKE0 */
990 DB8500_PIN_HOG("GPIO226_AF8", gpio_out_hi), /* ACWAKE0 */
991};
992
993static struct pinctrl_map __initdata u8500_pinmap[] = {
994 DB8500_PIN_HOG("GPIO226_AF8", gpio_out_lo), /* WLAN_PMU_EN */
995 DB8500_PIN_HOG("GPIO4_AH6", gpio_in_pu), /* WLAN_IRQ */
996};
997
998static struct pinctrl_map __initdata snowball_pinmap[] = {
999 /* Mux in SSP0 connected to AB8500, pull down RXD pin */
1000 DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
1001 DB8500_PIN_HOG("GPIO145_C13", pd),
1002 /* Always drive the MC0 DAT31DIR line high on these boards */
1003 DB8500_PIN_HOG("GPIO21_AB3", out_hi),
1004 /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */
1005 DB8500_MUX_HOG("sm_b_1", "sm"),
1006 /* User LED */
1007 DB8500_PIN_HOG("GPIO142_C11", gpio_out_hi),
1008 /* Drive RSTn_LAN high */
1009 DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi),
1010 /* Accelerometer/Magnetometer */
1011 DB8500_PIN_HOG("GPIO163_C20", gpio_in_pu), /* ACCEL_IRQ1 */
1012 DB8500_PIN_HOG("GPIO164_B21", gpio_in_pu), /* ACCEL_IRQ2 */
1013 DB8500_PIN_HOG("GPIO165_C21", gpio_in_pu), /* MAG_DRDY */
1014 /* WLAN/GBF */
1015 DB8500_PIN_HOG("GPIO161_D21", gpio_out_lo), /* WLAN_PMU_EN */
1016 DB8500_PIN_HOG("GPIO171_D23", gpio_out_hi), /* GBF_ENA */
1017 DB8500_PIN_HOG("GPIO215_AH13", gpio_out_lo), /* WLAN_ENA */
1018 DB8500_PIN_HOG("GPIO216_AG12", gpio_in_pu), /* WLAN_IRQ */
1019};
1020
1021/*
1022 * passing "pinsfor=" in kernel cmdline allows for custom
1023 * configuration of GPIOs on u8500 derived boards.
1024 */
1025static int __init early_pinsfor(char *p)
1026{
1027 pinsfor = PINS_FOR_DEFAULT;
1028
1029 if (strcmp(p, "u9500-21") == 0)
1030 pinsfor = PINS_FOR_U9500;
1031
1032 return 0;
1033}
1034early_param("pinsfor", early_pinsfor);
1035
1036int pins_for_u9500(void)
1037{
1038 if (pinsfor == PINS_FOR_U9500)
1039 return 1;
1040
1041 return 0;
1042}
1043
1044static void __init mop500_href_family_pinmaps_init(void)
1045{
1046 switch (pinsfor) {
1047 case PINS_FOR_U9500:
1048 pinctrl_register_mappings(u9500_pinmap,
1049 ARRAY_SIZE(u9500_pinmap));
1050 break;
1051 case PINS_FOR_DEFAULT:
1052 pinctrl_register_mappings(u8500_pinmap,
1053 ARRAY_SIZE(u8500_pinmap));
1054 default:
1055 break;
1056 }
1057}
1058
1059void __init mop500_pinmaps_init(void) 271void __init mop500_pinmaps_init(void)
1060{ 272{
1061 pinctrl_register_mappings(mop500_family_pinmap,
1062 ARRAY_SIZE(mop500_family_pinmap));
1063 pinctrl_register_mappings(mop500_pinmap,
1064 ARRAY_SIZE(mop500_pinmap));
1065 mop500_href_family_pinmaps_init();
1066 if (machine_is_u8520()) 273 if (machine_is_u8520())
1067 pinctrl_register_mappings(ab8505_pinmap, 274 pinctrl_register_mappings(ab8505_pinmap,
1068 ARRAY_SIZE(ab8505_pinmap)); 275 ARRAY_SIZE(ab8505_pinmap));
@@ -1073,23 +280,12 @@ void __init mop500_pinmaps_init(void)
1073 280
1074void __init snowball_pinmaps_init(void) 281void __init snowball_pinmaps_init(void)
1075{ 282{
1076 pinctrl_register_mappings(mop500_family_pinmap,
1077 ARRAY_SIZE(mop500_family_pinmap));
1078 pinctrl_register_mappings(snowball_pinmap,
1079 ARRAY_SIZE(snowball_pinmap));
1080 pinctrl_register_mappings(u8500_pinmap,
1081 ARRAY_SIZE(u8500_pinmap));
1082 pinctrl_register_mappings(ab8500_pinmap, 283 pinctrl_register_mappings(ab8500_pinmap,
1083 ARRAY_SIZE(ab8500_pinmap)); 284 ARRAY_SIZE(ab8500_pinmap));
1084} 285}
1085 286
1086void __init hrefv60_pinmaps_init(void) 287void __init hrefv60_pinmaps_init(void)
1087{ 288{
1088 pinctrl_register_mappings(mop500_family_pinmap,
1089 ARRAY_SIZE(mop500_family_pinmap));
1090 pinctrl_register_mappings(hrefv60_pinmap,
1091 ARRAY_SIZE(hrefv60_pinmap));
1092 mop500_href_family_pinmaps_init();
1093 pinctrl_register_mappings(ab8500_pinmap, 289 pinctrl_register_mappings(ab8500_pinmap,
1094 ARRAY_SIZE(ab8500_pinmap)); 290 ARRAY_SIZE(ab8500_pinmap));
1095} 291}
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index 0dc44c683427..a4e139aa2441 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -30,20 +30,6 @@ struct regulator_init_data gpio_en_3v3_regulator = {
30 .consumer_supplies = gpio_en_3v3_consumers, 30 .consumer_supplies = gpio_en_3v3_consumers,
31}; 31};
32 32
33static struct regulator_consumer_supply sdi0_reg_consumers[] = {
34 REGULATOR_SUPPLY("vqmmc", "sdi0"),
35};
36
37struct regulator_init_data sdi0_reg_init_data = {
38 .constraints = {
39 .min_uV = 1800000,
40 .max_uV = 2900000,
41 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE|REGULATOR_CHANGE_STATUS,
42 },
43 .num_consumer_supplies = ARRAY_SIZE(sdi0_reg_consumers),
44 .consumer_supplies = sdi0_reg_consumers,
45};
46
47/* 33/*
48 * TPS61052 regulator 34 * TPS61052 regulator
49 */ 35 */
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
index 039f5132c370..9bece38fe933 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.h
+++ b/arch/arm/mach-ux500/board-mop500-regulators.h
@@ -18,7 +18,6 @@ extern struct ab8500_regulator_platform_data ab8500_regulator_plat_data;
18extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data; 18extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data;
19extern struct regulator_init_data tps61052_regulator; 19extern struct regulator_init_data tps61052_regulator;
20extern struct regulator_init_data gpio_en_3v3_regulator; 20extern struct regulator_init_data gpio_en_3v3_regulator;
21extern struct regulator_init_data sdi0_reg_init_data;
22 21
23void mop500_regulator_init(void); 22void mop500_regulator_init(void);
24 23
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 26600a1c5319..fcbf3a13a539 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -14,10 +14,8 @@
14#include <linux/platform_data/dma-ste-dma40.h> 14#include <linux/platform_data/dma-ste-dma40.h>
15 15
16#include <asm/mach-types.h> 16#include <asm/mach-types.h>
17#include "devices.h"
18 17
19#include "db8500-regs.h" 18#include "db8500-regs.h"
20#include "devices-db8500.h"
21#include "board-mop500.h" 19#include "board-mop500.h"
22#include "ste-dma40-db8500.h" 20#include "ste-dma40-db8500.h"
23 21
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
deleted file mode 100644
index 514d40b625a4..000000000000
--- a/arch/arm/mach-ux500/board-mop500.c
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * Copyright (C) 2008-2012 ST-Ericsson
3 *
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
9 *
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/platform_device.h>
15#include <linux/clk.h>
16#include <linux/io.h>
17#include <linux/platform_data/db8500_thermal.h>
18#include <linux/amba/bus.h>
19#include <linux/amba/pl022.h>
20#include <linux/mfd/abx500/ab8500.h>
21#include <linux/regulator/ab8500.h>
22#include <linux/regulator/fixed.h>
23#include <linux/regulator/driver.h>
24#include <linux/mfd/tps6105x.h>
25#include <linux/platform_data/leds-lp55xx.h>
26#include <linux/input.h>
27#include <linux/delay.h>
28#include <linux/leds.h>
29#include <linux/pinctrl/consumer.h>
30#include <linux/platform_data/pinctrl-nomadik.h>
31#include <linux/platform_data/dma-ste-dma40.h>
32
33#include <asm/mach-types.h>
34
35#include "setup.h"
36#include "devices.h"
37#include "irqs.h"
38
39#include "ste-dma40-db8500.h"
40#include "db8500-regs.h"
41#include "devices-db8500.h"
42#include "board-mop500.h"
43#include "board-mop500-regulators.h"
44
45struct ab8500_platform_data ab8500_platdata = {
46 .irq_base = MOP500_AB8500_IRQ_BASE,
47 .regulator = &ab8500_regulator_plat_data,
48};
49
50#ifdef CONFIG_STE_DMA40
51static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
52 .mode = STEDMA40_MODE_LOGICAL,
53 .dir = DMA_DEV_TO_MEM,
54 .dev_type = DB8500_DMA_DEV8_SSP0,
55};
56
57static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
58 .mode = STEDMA40_MODE_LOGICAL,
59 .dir = DMA_MEM_TO_DEV,
60 .dev_type = DB8500_DMA_DEV8_SSP0,
61};
62#endif
63
64struct pl022_ssp_controller ssp0_plat = {
65 .bus_id = 0,
66#ifdef CONFIG_STE_DMA40
67 .enable_dma = 1,
68 .dma_filter = stedma40_filter,
69 .dma_rx_param = &ssp0_dma_cfg_rx,
70 .dma_tx_param = &ssp0_dma_cfg_tx,
71#else
72 .enable_dma = 0,
73#endif
74 /* on this platform, gpio 31,142,144,214 &
75 * 224 are connected as chip selects
76 */
77 .num_chipselect = 5,
78};
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 511d6febbe99..d48e8662c676 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -87,7 +87,6 @@ extern struct msp_i2s_platform_data msp0_platform_data;
87extern struct msp_i2s_platform_data msp1_platform_data; 87extern struct msp_i2s_platform_data msp1_platform_data;
88extern struct msp_i2s_platform_data msp2_platform_data; 88extern struct msp_i2s_platform_data msp2_platform_data;
89extern struct msp_i2s_platform_data msp3_platform_data; 89extern struct msp_i2s_platform_data msp3_platform_data;
90extern struct pl022_ssp_controller ssp0_plat;
91 90
92void __init mop500_pinmaps_init(void); 91void __init mop500_pinmaps_init(void);
93void __init snowball_pinmaps_init(void); 92void __init snowball_pinmaps_init(void);
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 12c7e5c03ea4..bc8a6183560d 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -21,21 +21,32 @@
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/regulator/machine.h> 23#include <linux/regulator/machine.h>
24#include <linux/platform_data/pinctrl-nomadik.h>
25#include <linux/random.h> 24#include <linux/random.h>
26 25
27#include <asm/pmu.h> 26#include <asm/pmu.h>
28#include <asm/mach/map.h> 27#include <asm/mach/map.h>
29 28
30#include "setup.h" 29#include "setup.h"
31#include "devices.h"
32#include "irqs.h" 30#include "irqs.h"
33 31
34#include "devices-db8500.h" 32#include "board-mop500-regulators.h"
35#include "db8500-regs.h"
36#include "board-mop500.h" 33#include "board-mop500.h"
34#include "db8500-regs.h"
37#include "id.h" 35#include "id.h"
38 36
37struct ab8500_platform_data ab8500_platdata = {
38 .irq_base = MOP500_AB8500_IRQ_BASE,
39 .regulator = &ab8500_regulator_plat_data,
40};
41
42struct prcmu_pdata db8500_prcmu_pdata = {
43 .ab_platdata = &ab8500_platdata,
44 .ab_irq = IRQ_DB8500_AB8500,
45 .irq_base = IRQ_PRCMU_BASE,
46 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
47 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET,
48};
49
39/* minimum static i/o mapping required to boot U8500 platforms */ 50/* minimum static i/o mapping required to boot U8500 platforms */
40static struct map_desc u8500_uart_io_desc[] __initdata = { 51static struct map_desc u8500_uart_io_desc[] __initdata = {
41 __IO_DEV_DESC(U8500_UART0_BASE, SZ_4K), 52 __IO_DEV_DESC(U8500_UART0_BASE, SZ_4K),
@@ -159,17 +170,10 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
159 OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL), 170 OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL),
160 OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0", 171 OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0",
161 NULL), 172 NULL),
162 /* Requires device name bindings. */
163 OF_DEV_AUXDATA("stericsson,db8500-pinctrl", U8500_PRCMU_BASE,
164 "pinctrl-db8500", NULL),
165 {}, 173 {},
166}; 174};
167 175
168static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = { 176static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = {
169 /* Requires DMA bindings. */
170 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", NULL),
171 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL),
172 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL),
173 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", 177 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu",
174 &db8500_prcmu_pdata), 178 &db8500_prcmu_pdata),
175 {}, 179 {},
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index f84d4397896b..d11ac4bf336c 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -25,7 +25,6 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include "setup.h" 27#include "setup.h"
28#include "devices.h"
29 28
30#include "board-mop500.h" 29#include "board-mop500.h"
31#include "db8500-regs.h" 30#include "db8500-regs.h"
@@ -64,12 +63,7 @@ void __init ux500_init_irq(void)
64 } else 63 } else
65 ux500_unknown_soc(); 64 ux500_unknown_soc();
66 65
67#ifdef CONFIG_OF 66 irqchip_init();
68 if (of_have_populated_dt())
69 irqchip_init();
70 else
71#endif
72 gic_init(0, 29, dist_base, cpu_base);
73 67
74 /* 68 /*
75 * Init clocks here so that they are available for system timer 69 * Init clocks here so that they are available for system timer
@@ -79,16 +73,11 @@ void __init ux500_init_irq(void)
79 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 73 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
80 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 74 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
81 75
82 if (of_have_populated_dt()) 76 u8500_of_clk_init(U8500_CLKRST1_BASE,
83 u8500_of_clk_init(U8500_CLKRST1_BASE, 77 U8500_CLKRST2_BASE,
84 U8500_CLKRST2_BASE, 78 U8500_CLKRST3_BASE,
85 U8500_CLKRST3_BASE, 79 U8500_CLKRST5_BASE,
86 U8500_CLKRST5_BASE, 80 U8500_CLKRST6_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);
92 } else if (cpu_is_u9540()) { 81 } else if (cpu_is_u9540()) {
93 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 82 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
94 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 83 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
deleted file mode 100644
index c59f89d058ff..000000000000
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ /dev/null
@@ -1,28 +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/platform_device.h>
10#include <linux/interrupt.h>
11#include <linux/io.h>
12#include <linux/amba/bus.h>
13#include <linux/amba/pl022.h>
14#include <linux/mfd/dbx500-prcmu.h>
15
16#include "setup.h"
17#include "irqs.h"
18
19#include "db8500-regs.h"
20#include "devices-db8500.h"
21
22struct prcmu_pdata db8500_prcmu_pdata = {
23 .ab_platdata = &ab8500_platdata,
24 .ab_irq = IRQ_DB8500_AB8500,
25 .irq_base = IRQ_PRCMU_BASE,
26 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
27 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET,
28};
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
deleted file mode 100644
index b8ffc9979bb2..000000000000
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ /dev/null
@@ -1,19 +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_DB8500_H
9#define __DEVICES_DB8500_H
10
11#include "irqs.h"
12#include "db8500-regs.h"
13
14struct platform_device;
15
16extern struct ab8500_platform_data ab8500_platdata;
17extern struct prcmu_pdata db8500_prcmu_pdata;
18
19#endif
diff --git a/arch/arm/mach-ux500/devices.c b/arch/arm/mach-ux500/devices.c
deleted file mode 100644
index 0f9e52b95935..000000000000
--- a/arch/arm/mach-ux500/devices.c
+++ /dev/null
@@ -1,26 +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/platform_device.h>
10#include <linux/interrupt.h>
11#include <linux/io.h>
12#include <linux/amba/bus.h>
13
14#include "setup.h"
15
16#include "db8500-regs.h"
17
18void __init amba_add_devices(struct amba_device *devs[], int num)
19{
20 int i;
21
22 for (i = 0; i < num; i++) {
23 struct amba_device *d = devs[i];
24 amba_device_register(d, &iomem_resource);
25 }
26}
diff --git a/arch/arm/mach-ux500/devices.h b/arch/arm/mach-ux500/devices.h
deleted file mode 100644
index 5bca7c605cd6..000000000000
--- a/arch/arm/mach-ux500/devices.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef __ASM_ARCH_DEVICES_H__
8#define __ASM_ARCH_DEVICES_H__
9
10struct platform_device;
11struct amba_device;
12
13extern struct amba_device ux500_pl031_device;
14
15#endif
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index 1f296e796a4f..a44967f3168c 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -38,8 +38,7 @@ static void write_pen_release(int val)
38{ 38{
39 pen_release = val; 39 pen_release = val;
40 smp_wmb(); 40 smp_wmb();
41 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); 41 sync_cache_w(&pen_release);
42 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
43} 42}
44 43
45static void __iomem *scu_base_addr(void) 44static void __iomem *scu_base_addr(void)
diff --git a/arch/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c
index 1a468f0fd22e..b80a9a2e356e 100644
--- a/arch/arm/mach-ux500/pm.c
+++ b/arch/arm/mach-ux500/pm.c
@@ -3,6 +3,8 @@
3 * Author: Rickard Andersson <rickard.andersson@stericsson.com> for 3 * Author: Rickard Andersson <rickard.andersson@stericsson.com> for
4 * ST-Ericsson. 4 * ST-Ericsson.
5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro. 5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro.
6 * Author: Ulf Hansson <ulf.hansson@linaro.org> for Linaro.
7 *
6 * License terms: GNU General Public License (GPL) version 2 8 * License terms: GNU General Public License (GPL) version 2
7 * 9 *
8 */ 10 */
@@ -11,6 +13,7 @@
11#include <linux/irqchip/arm-gic.h> 13#include <linux/irqchip/arm-gic.h>
12#include <linux/delay.h> 14#include <linux/delay.h>
13#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/suspend.h>
14#include <linux/platform_data/arm-ux500-pm.h> 17#include <linux/platform_data/arm-ux500-pm.h>
15 18
16#include "db8500-regs.h" 19#include "db8500-regs.h"
@@ -152,6 +155,27 @@ int prcmu_copy_gic_settings(void)
152 return 0; 155 return 0;
153} 156}
154 157
158#ifdef CONFIG_SUSPEND
159static int ux500_suspend_enter(suspend_state_t state)
160{
161 cpu_do_idle();
162 return 0;
163}
164
165static int ux500_suspend_valid(suspend_state_t state)
166{
167 return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY;
168}
169
170static const struct platform_suspend_ops ux500_suspend_ops = {
171 .enter = ux500_suspend_enter,
172 .valid = ux500_suspend_valid,
173};
174#define UX500_SUSPEND_OPS (&ux500_suspend_ops)
175#else
176#define UX500_SUSPEND_OPS NULL
177#endif
178
155void __init ux500_pm_init(u32 phy_base, u32 size) 179void __init ux500_pm_init(u32 phy_base, u32 size)
156{ 180{
157 prcmu_base = ioremap(phy_base, size); 181 prcmu_base = ioremap(phy_base, size);
@@ -164,4 +188,7 @@ void __init ux500_pm_init(u32 phy_base, u32 size)
164 * This will make sure that the GIC is correctly configured. 188 * This will make sure that the GIC is correctly configured.
165 */ 189 */
166 prcmu_gic_recouple(); 190 prcmu_gic_recouple();
191
192 /* Set up ux500 suspend callbacks. */
193 suspend_set_ops(UX500_SUSPEND_OPS);
167} 194}
diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h
index bdb356498a74..2dea8b59d222 100644
--- a/arch/arm/mach-ux500/setup.h
+++ b/arch/arm/mach-ux500/setup.h
@@ -19,17 +19,11 @@
19void ux500_restart(enum reboot_mode mode, const char *cmd); 19void ux500_restart(enum reboot_mode mode, const char *cmd);
20 20
21void __init ux500_map_io(void); 21void __init ux500_map_io(void);
22extern void __init u8500_map_io(void);
23
24extern struct device * __init u8500_init_devices(void);
25 22
26extern void __init ux500_init_irq(void); 23extern void __init ux500_init_irq(void);
27 24
28extern struct device *ux500_soc_device_init(const char *soc_id); 25extern struct device *ux500_soc_device_init(const char *soc_id);
29 26
30struct amba_device;
31extern void __init amba_add_devices(struct amba_device *devs[], int num);
32
33extern void ux500_timer_init(void); 27extern void ux500_timer_init(void);
34 28
35#define __IO_DEV_DESC(x, sz) { \ 29#define __IO_DEV_DESC(x, sz) { \
@@ -43,7 +37,7 @@ extern void ux500_timer_init(void);
43 .virtual = IO_ADDRESS(x), \ 37 .virtual = IO_ADDRESS(x), \
44 .pfn = __phys_to_pfn(x), \ 38 .pfn = __phys_to_pfn(x), \
45 .length = sz, \ 39 .length = sz, \
46 .type = MT_MEMORY, \ 40 .type = MT_MEMORY_RWX, \
47} 41}
48 42
49extern struct smp_operations ux500_smp_ops; 43extern struct smp_operations ux500_smp_ops;
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index 05a4ff78b3bd..87efda0aa348 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -10,40 +10,12 @@
10#include <linux/clocksource.h> 10#include <linux/clocksource.h>
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/of_address.h> 12#include <linux/of_address.h>
13#include <linux/platform_data/clocksource-nomadik-mtu.h>
14
15#include <asm/smp_twd.h>
16 13
17#include "setup.h" 14#include "setup.h"
18#include "irqs.h"
19 15
20#include "db8500-regs.h" 16#include "db8500-regs.h"
21#include "id.h" 17#include "id.h"
22 18
23#ifdef CONFIG_HAVE_ARM_TWD
24static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer,
25 U8500_TWD_BASE, IRQ_LOCALTIMER);
26
27static void __init ux500_twd_init(void)
28{
29 struct twd_local_timer *twd_local_timer;
30 int err;
31
32 /* Use this to switch local timer base if changed in new ASICs */
33 twd_local_timer = &u8500_twd_local_timer;
34
35 if (of_have_populated_dt())
36 clocksource_of_init();
37 else {
38 err = twd_local_timer_register(twd_local_timer);
39 if (err)
40 pr_err("twd_local_timer_register failed %d\n", err);
41 }
42}
43#else
44#define ux500_twd_init() do { } while(0)
45#endif
46
47const static struct of_device_id prcmu_timer_of_match[] __initconst = { 19const static struct of_device_id prcmu_timer_of_match[] __initconst = {
48 { .compatible = "stericsson,db8500-prcmu-timer-4", }, 20 { .compatible = "stericsson,db8500-prcmu-timer-4", },
49 { }, 21 { },
@@ -51,54 +23,26 @@ const static struct of_device_id prcmu_timer_of_match[] __initconst = {
51 23
52void __init ux500_timer_init(void) 24void __init ux500_timer_init(void)
53{ 25{
54 void __iomem *mtu_timer_base;
55 void __iomem *prcmu_timer_base; 26 void __iomem *prcmu_timer_base;
56 void __iomem *tmp_base; 27 void __iomem *tmp_base;
57 struct device_node *np; 28 struct device_node *np;
58 29
59 if (cpu_is_u8500_family() || cpu_is_ux540_family()) { 30 if (cpu_is_u8500_family() || cpu_is_ux540_family())
60 mtu_timer_base = __io_address(U8500_MTU0_BASE);
61 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); 31 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE);
62 } else { 32 else
63 ux500_unknown_soc(); 33 ux500_unknown_soc();
64 }
65 34
66 /* TODO: Once MTU has been DT:ed place code above into else. */ 35 np = of_find_matching_node(NULL, prcmu_timer_of_match);
67 if (of_have_populated_dt()) { 36 if (!np)
68#ifdef CONFIG_OF 37 goto dt_fail;
69 np = of_find_matching_node(NULL, prcmu_timer_of_match);
70 if (!np)
71#endif
72 goto dt_fail;
73 38
74 tmp_base = of_iomap(np, 0); 39 tmp_base = of_iomap(np, 0);
75 if (!tmp_base) 40 if (!tmp_base)
76 goto dt_fail; 41 goto dt_fail;
77 42
78 prcmu_timer_base = tmp_base; 43 prcmu_timer_base = tmp_base;
79 }
80 44
81dt_fail: 45dt_fail:
82 /* Doing it the old fashioned way. */
83
84 /*
85 * Here we register the timerblocks active in the system.
86 * Localtimers (twd) is started when both cpu is up and running.
87 * MTU register a clocksource, clockevent and sched_clock.
88 * Since the MTU is located in the VAPE power domain
89 * it will be cleared in sleep which makes it unsuitable.
90 * We however need it as a timer tick (clockevent)
91 * during boot to calibrate delay until twd is started.
92 * RTC-RTT have problems as timer tick during boot since it is
93 * depending on delay which is not yet calibrated. RTC-RTT is in the
94 * always-on powerdomain and is used as clockevent instead of twd when
95 * sleeping.
96 * The PRCMU timer 4 register a clocksource and
97 * sched_clock with higher rating then MTU since is always-on.
98 *
99 */
100 if (!of_have_populated_dt())
101 nmdk_timer_init(mtu_timer_base, IRQ_MTU0);
102 clksrc_dbx500_prcmu_init(prcmu_timer_base); 46 clksrc_dbx500_prcmu_init(prcmu_timer_base);
103 ux500_twd_init(); 47 clocksource_of_init();
104} 48}
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 3b0572f30d56..a335126ae18f 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -570,6 +570,16 @@ static struct pl061_platform_data gpio1_plat_data = {
570 .irq_base = IRQ_GPIO1_START, 570 .irq_base = IRQ_GPIO1_START,
571}; 571};
572 572
573static struct pl061_platform_data gpio2_plat_data = {
574 .gpio_base = 16,
575 .irq_base = IRQ_GPIO2_START,
576};
577
578static struct pl061_platform_data gpio3_plat_data = {
579 .gpio_base = 24,
580 .irq_base = IRQ_GPIO3_START,
581};
582
573static struct pl022_ssp_controller ssp0_plat_data = { 583static struct pl022_ssp_controller ssp0_plat_data = {
574 .bus_id = 0, 584 .bus_id = 0,
575 .enable_dma = 0, 585 .enable_dma = 0,
@@ -596,6 +606,8 @@ static struct pl022_ssp_controller ssp0_plat_data = {
596#define WATCHDOG_IRQ { IRQ_WDOGINT } 606#define WATCHDOG_IRQ { IRQ_WDOGINT }
597#define GPIO0_IRQ { IRQ_GPIOINT0 } 607#define GPIO0_IRQ { IRQ_GPIOINT0 }
598#define GPIO1_IRQ { IRQ_GPIOINT1 } 608#define GPIO1_IRQ { IRQ_GPIOINT1 }
609#define GPIO2_IRQ { IRQ_GPIOINT2 }
610#define GPIO3_IRQ { IRQ_GPIOINT3 }
599#define RTC_IRQ { IRQ_RTCINT } 611#define RTC_IRQ { IRQ_RTCINT }
600 612
601/* 613/*
@@ -622,6 +634,8 @@ APB_DEVICE(sctl, "dev:e0", SCTL, NULL);
622APB_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); 634APB_DEVICE(wdog, "dev:e1", WATCHDOG, NULL);
623APB_DEVICE(gpio0, "dev:e4", GPIO0, &gpio0_plat_data); 635APB_DEVICE(gpio0, "dev:e4", GPIO0, &gpio0_plat_data);
624APB_DEVICE(gpio1, "dev:e5", GPIO1, &gpio1_plat_data); 636APB_DEVICE(gpio1, "dev:e5", GPIO1, &gpio1_plat_data);
637APB_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data);
638APB_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data);
625APB_DEVICE(rtc, "dev:e8", RTC, NULL); 639APB_DEVICE(rtc, "dev:e8", RTC, NULL);
626APB_DEVICE(sci0, "dev:f0", SCI, NULL); 640APB_DEVICE(sci0, "dev:f0", SCI, NULL);
627APB_DEVICE(uart0, "dev:f1", UART0, NULL); 641APB_DEVICE(uart0, "dev:f1", UART0, NULL);
@@ -641,6 +655,8 @@ static struct amba_device *amba_devs[] __initdata = {
641 &wdog_device, 655 &wdog_device,
642 &gpio0_device, 656 &gpio0_device,
643 &gpio1_device, 657 &gpio1_device,
658 &gpio2_device,
659 &gpio3_device,
644 &rtc_device, 660 &rtc_device,
645 &sci0_device, 661 &sci0_device,
646 &ssp0_device, 662 &ssp0_device,
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c
index 611d140c8695..9a53d0bd9144 100644
--- a/arch/arm/mach-versatile/versatile_pb.c
+++ b/arch/arm/mach-versatile/versatile_pb.c
@@ -47,27 +47,11 @@ static struct mmci_platform_data mmc1_plat_data = {
47 .gpio_cd = -1, 47 .gpio_cd = -1,
48}; 48};
49 49
50static struct pl061_platform_data gpio2_plat_data = {
51 .gpio_base = 16,
52 .irq_base = IRQ_GPIO2_START,
53};
54
55static struct pl061_platform_data gpio3_plat_data = {
56 .gpio_base = 24,
57 .irq_base = IRQ_GPIO3_START,
58};
59
60#define UART3_IRQ { IRQ_SIC_UART3 } 50#define UART3_IRQ { IRQ_SIC_UART3 }
61#define SCI1_IRQ { IRQ_SIC_SCI3 } 51#define SCI1_IRQ { IRQ_SIC_SCI3 }
62#define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B } 52#define MMCI1_IRQ { IRQ_MMCI1A, IRQ_SIC_MMCI1B }
63 53
64/* 54/*
65 * These devices are connected via the core APB bridge
66 */
67#define GPIO2_IRQ { IRQ_GPIOINT2 }
68#define GPIO3_IRQ { IRQ_GPIOINT3 }
69
70/*
71 * These devices are connected via the DMA APB bridge 55 * These devices are connected via the DMA APB bridge
72 */ 56 */
73 57
@@ -76,14 +60,9 @@ APB_DEVICE(uart3, "fpga:09", UART3, NULL);
76APB_DEVICE(sci1, "fpga:0a", SCI1, NULL); 60APB_DEVICE(sci1, "fpga:0a", SCI1, NULL);
77APB_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data); 61APB_DEVICE(mmc1, "fpga:0b", MMCI1, &mmc1_plat_data);
78 62
79/* DevChip Primecells */
80APB_DEVICE(gpio2, "dev:e6", GPIO2, &gpio2_plat_data);
81APB_DEVICE(gpio3, "dev:e7", GPIO3, &gpio3_plat_data);
82 63
83static struct amba_device *amba_devs[] __initdata = { 64static struct amba_device *amba_devs[] __initdata = {
84 &uart3_device, 65 &uart3_device,
85 &gpio2_device,
86 &gpio3_device,
87 &sci1_device, 66 &sci1_device,
88 &mmc1_device, 67 &mmc1_device,
89}; 68};
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 9a7bd137c8fd..1db2a5ca9ab8 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -25,6 +25,8 @@
25#include <linux/of_irq.h> 25#include <linux/of_irq.h>
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <linux/of.h> 27#include <linux/of.h>
28#include <linux/irqchip.h>
29#include <linux/irqchip/arm-gic.h>
28 30
29#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 32#include <asm/mach/map.h>
@@ -39,11 +41,6 @@
39 41
40void __iomem *zynq_scu_base; 42void __iomem *zynq_scu_base;
41 43
42static struct of_device_id zynq_of_bus_ids[] __initdata = {
43 { .compatible = "simple-bus", },
44 {}
45};
46
47static struct platform_device zynq_cpuidle_device = { 44static struct platform_device zynq_cpuidle_device = {
48 .name = "cpuidle-zynq", 45 .name = "cpuidle-zynq",
49}; 46};
@@ -59,7 +56,7 @@ static void __init zynq_init_machine(void)
59 */ 56 */
60 l2x0_of_init(0x02060000, 0xF0F0FFFF); 57 l2x0_of_init(0x02060000, 0xF0F0FFFF);
61 58
62 of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL); 59 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
63 60
64 platform_device_register(&zynq_cpuidle_device); 61 platform_device_register(&zynq_cpuidle_device);
65} 62}
@@ -97,6 +94,12 @@ static void __init zynq_map_io(void)
97 zynq_scu_map_io(); 94 zynq_scu_map_io();
98} 95}
99 96
97static void __init zynq_irq_init(void)
98{
99 gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
100 irqchip_init();
101}
102
100static void zynq_system_reset(enum reboot_mode mode, const char *cmd) 103static void zynq_system_reset(enum reboot_mode mode, const char *cmd)
101{ 104{
102 zynq_slcr_system_reset(); 105 zynq_slcr_system_reset();
@@ -110,6 +113,7 @@ static const char * const zynq_dt_match[] = {
110DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") 113DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
111 .smp = smp_ops(zynq_smp_ops), 114 .smp = smp_ops(zynq_smp_ops),
112 .map_io = zynq_map_io, 115 .map_io = zynq_map_io,
116 .init_irq = zynq_irq_init,
113 .init_machine = zynq_init_machine, 117 .init_machine = zynq_init_machine,
114 .init_time = zynq_timer_init, 118 .init_time = zynq_timer_init,
115 .dt_compat = zynq_dt_match, 119 .dt_compat = zynq_dt_match,
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index 3040d219570f..c22c92cea8cb 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -17,6 +17,8 @@
17#ifndef __MACH_ZYNQ_COMMON_H__ 17#ifndef __MACH_ZYNQ_COMMON_H__
18#define __MACH_ZYNQ_COMMON_H__ 18#define __MACH_ZYNQ_COMMON_H__
19 19
20void zynq_secondary_startup(void);
21
20extern int zynq_slcr_init(void); 22extern int zynq_slcr_init(void);
21extern void zynq_slcr_system_reset(void); 23extern void zynq_slcr_system_reset(void);
22extern void zynq_slcr_cpu_stop(int cpu); 24extern void zynq_slcr_cpu_stop(int cpu);
diff --git a/arch/arm/mach-zynq/headsmp.S b/arch/arm/mach-zynq/headsmp.S
index d4cd5f34fe5c..57a32869f0aa 100644
--- a/arch/arm/mach-zynq/headsmp.S
+++ b/arch/arm/mach-zynq/headsmp.S
@@ -18,5 +18,9 @@ zynq_secondary_trampoline_jump:
18 .word /* cpu 1 */ 18 .word /* cpu 1 */
19.globl zynq_secondary_trampoline_end 19.globl zynq_secondary_trampoline_end
20zynq_secondary_trampoline_end: 20zynq_secondary_trampoline_end:
21
22ENDPROC(zynq_secondary_trampoline) 21ENDPROC(zynq_secondary_trampoline)
22
23ENTRY(zynq_secondary_startup)
24 bl v7_invalidate_l1
25 b secondary_startup
26ENDPROC(zynq_secondary_startup)
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 689fbbc3d9c8..abc82ef085c1 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -39,11 +39,6 @@ int zynq_cpun_start(u32 address, int cpu)
39 u32 trampoline_code_size = &zynq_secondary_trampoline_end - 39 u32 trampoline_code_size = &zynq_secondary_trampoline_end -
40 &zynq_secondary_trampoline; 40 &zynq_secondary_trampoline;
41 41
42 if (cpu > ncores) {
43 pr_warn("CPU No. is not available in the system\n");
44 return -1;
45 }
46
47 /* MS: Expectation that SLCR are directly map and accessible */ 42 /* MS: Expectation that SLCR are directly map and accessible */
48 /* Not possible to jump to non aligned address */ 43 /* Not possible to jump to non aligned address */
49 if (!(address & 3) && (!address || (address >= trampoline_code_size))) { 44 if (!(address & 3) && (!address || (address >= trampoline_code_size))) {
@@ -95,7 +90,7 @@ EXPORT_SYMBOL(zynq_cpun_start);
95static int zynq_boot_secondary(unsigned int cpu, 90static int zynq_boot_secondary(unsigned int cpu,
96 struct task_struct *idle) 91 struct task_struct *idle)
97{ 92{
98 return zynq_cpun_start(virt_to_phys(secondary_startup), cpu); 93 return zynq_cpun_start(virt_to_phys(zynq_secondary_startup), cpu);
99} 94}
100 95
101/* 96/*
@@ -114,23 +109,23 @@ static void __init zynq_smp_init_cpus(void)
114 109
115static void __init zynq_smp_prepare_cpus(unsigned int max_cpus) 110static void __init zynq_smp_prepare_cpus(unsigned int max_cpus)
116{ 111{
117 int i;
118
119 /*
120 * Initialise the present map, which describes the set of CPUs
121 * actually populated at the present time.
122 */
123 for (i = 0; i < max_cpus; i++)
124 set_cpu_present(i, true);
125
126 scu_enable(zynq_scu_base); 112 scu_enable(zynq_scu_base);
127} 113}
128 114
115#ifdef CONFIG_HOTPLUG_CPU
116static int zynq_cpu_kill(unsigned cpu)
117{
118 zynq_slcr_cpu_stop(cpu);
119 return 1;
120}
121#endif
122
129struct smp_operations zynq_smp_ops __initdata = { 123struct smp_operations zynq_smp_ops __initdata = {
130 .smp_init_cpus = zynq_smp_init_cpus, 124 .smp_init_cpus = zynq_smp_init_cpus,
131 .smp_prepare_cpus = zynq_smp_prepare_cpus, 125 .smp_prepare_cpus = zynq_smp_prepare_cpus,
132 .smp_boot_secondary = zynq_boot_secondary, 126 .smp_boot_secondary = zynq_boot_secondary,
133#ifdef CONFIG_HOTPLUG_CPU 127#ifdef CONFIG_HOTPLUG_CPU
134 .cpu_die = zynq_platform_cpu_die, 128 .cpu_die = zynq_platform_cpu_die,
129 .cpu_kill = zynq_cpu_kill,
135#endif 130#endif
136}; 131};
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index ecfe6e53f6e0..7f39ce2f841f 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -12,6 +12,7 @@ ifneq ($(CONFIG_MMU),y)
12obj-y += nommu.o 12obj-y += nommu.o
13endif 13endif
14 14
15obj-$(CONFIG_ARM_PTDUMP) += dump.o
15obj-$(CONFIG_MODULES) += proc-syms.o 16obj-$(CONFIG_MODULES) += proc-syms.o
16 17
17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 18obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 447da6ffadd5..7abde2ce8973 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -25,6 +25,7 @@
25 25
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/hardware/cache-l2x0.h> 27#include <asm/hardware/cache-l2x0.h>
28#include "cache-tauros3.h"
28#include "cache-aurora-l2.h" 29#include "cache-aurora-l2.h"
29 30
30#define CACHE_LINE_SIZE 32 31#define CACHE_LINE_SIZE 32
@@ -767,6 +768,14 @@ static void aurora_save(void)
767 l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); 768 l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
768} 769}
769 770
771static void __init tauros3_save(void)
772{
773 l2x0_saved_regs.aux2_ctrl =
774 readl_relaxed(l2x0_base + TAUROS3_AUX2_CTRL);
775 l2x0_saved_regs.prefetch_ctrl =
776 readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
777}
778
770static void l2x0_resume(void) 779static void l2x0_resume(void)
771{ 780{
772 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { 781 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
@@ -821,6 +830,18 @@ static void aurora_resume(void)
821 } 830 }
822} 831}
823 832
833static void tauros3_resume(void)
834{
835 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
836 writel_relaxed(l2x0_saved_regs.aux2_ctrl,
837 l2x0_base + TAUROS3_AUX2_CTRL);
838 writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
839 l2x0_base + L2X0_PREFETCH_CTRL);
840 }
841
842 l2x0_resume();
843}
844
824static void __init aurora_broadcast_l2_commands(void) 845static void __init aurora_broadcast_l2_commands(void)
825{ 846{
826 __u32 u; 847 __u32 u;
@@ -906,6 +927,15 @@ static const struct l2x0_of_data aurora_no_outer_data = {
906 }, 927 },
907}; 928};
908 929
930static const struct l2x0_of_data tauros3_data = {
931 .setup = NULL,
932 .save = tauros3_save,
933 /* Tauros3 broadcasts L1 cache operations to L2 */
934 .outer_cache = {
935 .resume = tauros3_resume,
936 },
937};
938
909static const struct l2x0_of_data bcm_l2x0_data = { 939static const struct l2x0_of_data bcm_l2x0_data = {
910 .setup = pl310_of_setup, 940 .setup = pl310_of_setup,
911 .save = pl310_save, 941 .save = pl310_save,
@@ -922,17 +952,19 @@ static const struct l2x0_of_data bcm_l2x0_data = {
922}; 952};
923 953
924static const struct of_device_id l2x0_ids[] __initconst = { 954static const struct of_device_id l2x0_ids[] __initconst = {
925 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
926 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
927 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data }, 955 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
928 { .compatible = "marvell,aurora-system-cache", 956 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
929 .data = (void *)&aurora_no_outer_data}, 957 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
930 { .compatible = "marvell,aurora-outer-cache",
931 .data = (void *)&aurora_with_outer_data},
932 { .compatible = "brcm,bcm11351-a2-pl310-cache",
933 .data = (void *)&bcm_l2x0_data},
934 { .compatible = "bcm,bcm11351-a2-pl310-cache", /* deprecated name */ 958 { .compatible = "bcm,bcm11351-a2-pl310-cache", /* deprecated name */
935 .data = (void *)&bcm_l2x0_data}, 959 .data = (void *)&bcm_l2x0_data},
960 { .compatible = "brcm,bcm11351-a2-pl310-cache",
961 .data = (void *)&bcm_l2x0_data},
962 { .compatible = "marvell,aurora-outer-cache",
963 .data = (void *)&aurora_with_outer_data},
964 { .compatible = "marvell,aurora-system-cache",
965 .data = (void *)&aurora_no_outer_data},
966 { .compatible = "marvell,tauros3-cache",
967 .data = (void *)&tauros3_data },
936 {} 968 {}
937}; 969};
938 970
diff --git a/arch/arm/mm/cache-tauros3.h b/arch/arm/mm/cache-tauros3.h
new file mode 100644
index 000000000000..02c0a97cbc02
--- /dev/null
+++ b/arch/arm/mm/cache-tauros3.h
@@ -0,0 +1,41 @@
1/*
2 * Marvell Tauros3 cache controller includes
3 *
4 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
5 *
6 * based on GPL'ed 2.6 kernel sources
7 * (c) Marvell International Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License 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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __ASM_ARM_HARDWARE_TAUROS3_H
24#define __ASM_ARM_HARDWARE_TAUROS3_H
25
26/*
27 * Marvell Tauros3 L2CC is compatible with PL310 r0p0
28 * but with PREFETCH_CTRL (r2p0) and an additional event counter.
29 * Also, there is AUX2_CTRL for some Marvell specific control.
30 */
31
32#define TAUROS3_EVENT_CNT2_CFG 0x224
33#define TAUROS3_EVENT_CNT2_VAL 0x228
34#define TAUROS3_INV_ALL 0x780
35#define TAUROS3_CLEAN_ALL 0x784
36#define TAUROS3_AUX2_CTRL 0x820
37
38/* Registers shifts and masks */
39#define TAUROS3_AUX2_CTRL_LINEFILL_BURST8_EN (1 << 2)
40
41#endif
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index b5c467a65c27..778bcf88ee79 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -146,18 +146,18 @@ flush_levels:
146 ldr r7, =0x7fff 146 ldr r7, =0x7fff
147 ands r7, r7, r1, lsr #13 @ extract max number of the index size 147 ands r7, r7, r1, lsr #13 @ extract max number of the index size
148loop1: 148loop1:
149 mov r9, r4 @ create working copy of max way size 149 mov r9, r7 @ create working copy of max index
150loop2: 150loop2:
151 ARM( orr r11, r10, r9, lsl r5 ) @ factor way and cache number into r11 151 ARM( orr r11, r10, r4, lsl r5 ) @ factor way and cache number into r11
152 THUMB( lsl r6, r9, r5 ) 152 THUMB( lsl r6, r4, r5 )
153 THUMB( orr r11, r10, r6 ) @ factor way and cache number into r11 153 THUMB( orr r11, r10, r6 ) @ factor way and cache number into r11
154 ARM( orr r11, r11, r7, lsl r2 ) @ factor index number into r11 154 ARM( orr r11, r11, r9, lsl r2 ) @ factor index number into r11
155 THUMB( lsl r6, r7, r2 ) 155 THUMB( lsl r6, r9, r2 )
156 THUMB( orr r11, r11, r6 ) @ factor index number into r11 156 THUMB( orr r11, r11, r6 ) @ factor index number into r11
157 mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way 157 mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way
158 subs r9, r9, #1 @ decrement the way 158 subs r9, r9, #1 @ decrement the index
159 bge loop2 159 bge loop2
160 subs r7, r7, #1 @ decrement the index 160 subs r4, r4, #1 @ decrement the way
161 bge loop1 161 bge loop1
162skip: 162skip:
163 add r10, r10, #2 @ increment cache number 163 add r10, r10, #2 @ increment cache number
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index 84e6f772e204..6eb97b3a7481 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -36,8 +36,8 @@
36 * The context ID is used by debuggers and trace logic, and 36 * The context ID is used by debuggers and trace logic, and
37 * should be unique within all running processes. 37 * should be unique within all running processes.
38 * 38 *
39 * In big endian operation, the two 32 bit words are swapped if accesed by 39 * In big endian operation, the two 32 bit words are swapped if accessed
40 * non 64-bit operations. 40 * by non-64-bit operations.
41 */ 41 */
42#define ASID_FIRST_VERSION (1ULL << ASID_BITS) 42#define ASID_FIRST_VERSION (1ULL << ASID_BITS)
43#define NUM_USER_ASIDS ASID_FIRST_VERSION 43#define NUM_USER_ASIDS ASID_FIRST_VERSION
@@ -78,20 +78,21 @@ void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
78#endif 78#endif
79 79
80#ifdef CONFIG_ARM_LPAE 80#ifdef CONFIG_ARM_LPAE
81static void cpu_set_reserved_ttbr0(void) 81/*
82{ 82 * With LPAE, the ASID and page tables are updated atomicly, so there is
83 /* 83 * no need for a reserved set of tables (the active ASID tracking prevents
84 * Set TTBR0 to swapper_pg_dir which contains only global entries. The 84 * any issues across a rollover).
85 * ASID is set to 0. 85 */
86 */ 86#define cpu_set_reserved_ttbr0()
87 cpu_set_ttbr(0, __pa(swapper_pg_dir));
88 isb();
89}
90#else 87#else
91static void cpu_set_reserved_ttbr0(void) 88static void cpu_set_reserved_ttbr0(void)
92{ 89{
93 u32 ttb; 90 u32 ttb;
94 /* Copy TTBR1 into TTBR0 */ 91 /*
92 * Copy TTBR1 into TTBR0.
93 * This points at swapper_pg_dir, which contains only global
94 * entries so any speculative walks are perfectly safe.
95 */
95 asm volatile( 96 asm volatile(
96 " mrc p15, 0, %0, c2, c0, 1 @ read TTBR1\n" 97 " mrc p15, 0, %0, c2, c0, 1 @ read TTBR1\n"
97 " mcr p15, 0, %0, c2, c0, 0 @ set TTBR0\n" 98 " mcr p15, 0, %0, c2, c0, 0 @ set TTBR0\n"
@@ -179,6 +180,7 @@ static int is_reserved_asid(u64 asid)
179 180
180static u64 new_context(struct mm_struct *mm, unsigned int cpu) 181static u64 new_context(struct mm_struct *mm, unsigned int cpu)
181{ 182{
183 static u32 cur_idx = 1;
182 u64 asid = atomic64_read(&mm->context.id); 184 u64 asid = atomic64_read(&mm->context.id);
183 u64 generation = atomic64_read(&asid_generation); 185 u64 generation = atomic64_read(&asid_generation);
184 186
@@ -193,10 +195,13 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
193 * Allocate a free ASID. If we can't find one, take a 195 * Allocate a free ASID. If we can't find one, take a
194 * note of the currently active ASIDs and mark the TLBs 196 * note of the currently active ASIDs and mark the TLBs
195 * as requiring flushes. We always count from ASID #1, 197 * as requiring flushes. We always count from ASID #1,
196 * as we reserve ASID #0 to switch via TTBR0 and indicate 198 * as we reserve ASID #0 to switch via TTBR0 and to
197 * rollover events. 199 * avoid speculative page table walks from hitting in
200 * any partial walk caches, which could be populated
201 * from overlapping level-1 descriptors used to map both
202 * the module area and the userspace stack.
198 */ 203 */
199 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1); 204 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, cur_idx);
200 if (asid == NUM_USER_ASIDS) { 205 if (asid == NUM_USER_ASIDS) {
201 generation = atomic64_add_return(ASID_FIRST_VERSION, 206 generation = atomic64_add_return(ASID_FIRST_VERSION,
202 &asid_generation); 207 &asid_generation);
@@ -204,6 +209,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
204 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1); 209 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
205 } 210 }
206 __set_bit(asid, asid_map); 211 __set_bit(asid, asid_map);
212 cur_idx = asid;
207 asid |= generation; 213 asid |= generation;
208 cpumask_clear(mm_cpumask(mm)); 214 cpumask_clear(mm_cpumask(mm));
209 } 215 }
@@ -221,8 +227,9 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
221 __check_vmalloc_seq(mm); 227 __check_vmalloc_seq(mm);
222 228
223 /* 229 /*
224 * Required during context switch to avoid speculative page table 230 * We cannot update the pgd and the ASID atomicly with classic
225 * walking with the wrong TTBR. 231 * MMU, so switch exclusively to global mappings to avoid
232 * speculative page table walking with the wrong TTBR.
226 */ 233 */
227 cpu_set_reserved_ttbr0(); 234 cpu_set_reserved_ttbr0();
228 235
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index f61a5707823a..1a77450e728a 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -376,7 +376,7 @@ void __init init_dma_coherent_pool_size(unsigned long size)
376static int __init atomic_pool_init(void) 376static int __init atomic_pool_init(void)
377{ 377{
378 struct dma_pool *pool = &atomic_pool; 378 struct dma_pool *pool = &atomic_pool;
379 pgprot_t prot = pgprot_dmacoherent(pgprot_kernel); 379 pgprot_t prot = pgprot_dmacoherent(PAGE_KERNEL);
380 gfp_t gfp = GFP_KERNEL | GFP_DMA; 380 gfp_t gfp = GFP_KERNEL | GFP_DMA;
381 unsigned long nr_pages = pool->size >> PAGE_SHIFT; 381 unsigned long nr_pages = pool->size >> PAGE_SHIFT;
382 unsigned long *bitmap; 382 unsigned long *bitmap;
@@ -624,7 +624,7 @@ static void __free_from_contiguous(struct device *dev, struct page *page,
624 if (PageHighMem(page)) 624 if (PageHighMem(page))
625 __dma_free_remap(cpu_addr, size); 625 __dma_free_remap(cpu_addr, size);
626 else 626 else
627 __dma_remap(page, size, pgprot_kernel); 627 __dma_remap(page, size, PAGE_KERNEL);
628 dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT); 628 dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT);
629} 629}
630 630
@@ -1351,7 +1351,7 @@ static void __iommu_free_atomic(struct device *dev, void *cpu_addr,
1351static void *arm_iommu_alloc_attrs(struct device *dev, size_t size, 1351static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,
1352 dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs) 1352 dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
1353{ 1353{
1354 pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel); 1354 pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);
1355 struct page **pages; 1355 struct page **pages;
1356 void *addr = NULL; 1356 void *addr = NULL;
1357 1357
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
new file mode 100644
index 000000000000..2b3a56414271
--- /dev/null
+++ b/arch/arm/mm/dump.c
@@ -0,0 +1,345 @@
1/*
2 * Debug helper to dump the current kernel pagetables of the system
3 * so that we can see what the various memory ranges are set to.
4 *
5 * Derived from x86 implementation:
6 * (C) Copyright 2008 Intel Corporation
7 *
8 * Author: Arjan van de Ven <arjan@linux.intel.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; version 2
13 * of the License.
14 */
15#include <linux/debugfs.h>
16#include <linux/fs.h>
17#include <linux/mm.h>
18#include <linux/seq_file.h>
19
20#include <asm/fixmap.h>
21#include <asm/pgtable.h>
22
23struct addr_marker {
24 unsigned long start_address;
25 const char *name;
26};
27
28static struct addr_marker address_markers[] = {
29 { MODULES_VADDR, "Modules" },
30 { PAGE_OFFSET, "Kernel Mapping" },
31 { 0, "vmalloc() Area" },
32 { VMALLOC_END, "vmalloc() End" },
33 { FIXADDR_START, "Fixmap Area" },
34 { CONFIG_VECTORS_BASE, "Vectors" },
35 { CONFIG_VECTORS_BASE + PAGE_SIZE * 2, "Vectors End" },
36 { -1, NULL },
37};
38
39struct pg_state {
40 struct seq_file *seq;
41 const struct addr_marker *marker;
42 unsigned long start_address;
43 unsigned level;
44 u64 current_prot;
45};
46
47struct prot_bits {
48 u64 mask;
49 u64 val;
50 const char *set;
51 const char *clear;
52};
53
54static const struct prot_bits pte_bits[] = {
55 {
56 .mask = L_PTE_USER,
57 .val = L_PTE_USER,
58 .set = "USR",
59 .clear = " ",
60 }, {
61 .mask = L_PTE_RDONLY,
62 .val = L_PTE_RDONLY,
63 .set = "ro",
64 .clear = "RW",
65 }, {
66 .mask = L_PTE_XN,
67 .val = L_PTE_XN,
68 .set = "NX",
69 .clear = "x ",
70 }, {
71 .mask = L_PTE_SHARED,
72 .val = L_PTE_SHARED,
73 .set = "SHD",
74 .clear = " ",
75 }, {
76 .mask = L_PTE_MT_MASK,
77 .val = L_PTE_MT_UNCACHED,
78 .set = "SO/UNCACHED",
79 }, {
80 .mask = L_PTE_MT_MASK,
81 .val = L_PTE_MT_BUFFERABLE,
82 .set = "MEM/BUFFERABLE/WC",
83 }, {
84 .mask = L_PTE_MT_MASK,
85 .val = L_PTE_MT_WRITETHROUGH,
86 .set = "MEM/CACHED/WT",
87 }, {
88 .mask = L_PTE_MT_MASK,
89 .val = L_PTE_MT_WRITEBACK,
90 .set = "MEM/CACHED/WBRA",
91#ifndef CONFIG_ARM_LPAE
92 }, {
93 .mask = L_PTE_MT_MASK,
94 .val = L_PTE_MT_MINICACHE,
95 .set = "MEM/MINICACHE",
96#endif
97 }, {
98 .mask = L_PTE_MT_MASK,
99 .val = L_PTE_MT_WRITEALLOC,
100 .set = "MEM/CACHED/WBWA",
101 }, {
102 .mask = L_PTE_MT_MASK,
103 .val = L_PTE_MT_DEV_SHARED,
104 .set = "DEV/SHARED",
105#ifndef CONFIG_ARM_LPAE
106 }, {
107 .mask = L_PTE_MT_MASK,
108 .val = L_PTE_MT_DEV_NONSHARED,
109 .set = "DEV/NONSHARED",
110#endif
111 }, {
112 .mask = L_PTE_MT_MASK,
113 .val = L_PTE_MT_DEV_WC,
114 .set = "DEV/WC",
115 }, {
116 .mask = L_PTE_MT_MASK,
117 .val = L_PTE_MT_DEV_CACHED,
118 .set = "DEV/CACHED",
119 },
120};
121
122static const struct prot_bits section_bits[] = {
123#ifndef CONFIG_ARM_LPAE
124 /* These are approximate */
125 {
126 .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
127 .val = 0,
128 .set = " ro",
129 }, {
130 .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
131 .val = PMD_SECT_AP_WRITE,
132 .set = " RW",
133 }, {
134 .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
135 .val = PMD_SECT_AP_READ,
136 .set = "USR ro",
137 }, {
138 .mask = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
139 .val = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
140 .set = "USR RW",
141#else
142 {
143 .mask = PMD_SECT_USER,
144 .val = PMD_SECT_USER,
145 .set = "USR",
146 }, {
147 .mask = PMD_SECT_RDONLY,
148 .val = PMD_SECT_RDONLY,
149 .set = "ro",
150 .clear = "RW",
151#endif
152 }, {
153 .mask = PMD_SECT_XN,
154 .val = PMD_SECT_XN,
155 .set = "NX",
156 .clear = "x ",
157 }, {
158 .mask = PMD_SECT_S,
159 .val = PMD_SECT_S,
160 .set = "SHD",
161 .clear = " ",
162 },
163};
164
165struct pg_level {
166 const struct prot_bits *bits;
167 size_t num;
168 u64 mask;
169};
170
171static struct pg_level pg_level[] = {
172 {
173 }, { /* pgd */
174 }, { /* pud */
175 }, { /* pmd */
176 .bits = section_bits,
177 .num = ARRAY_SIZE(section_bits),
178 }, { /* pte */
179 .bits = pte_bits,
180 .num = ARRAY_SIZE(pte_bits),
181 },
182};
183
184static void dump_prot(struct pg_state *st, const struct prot_bits *bits, size_t num)
185{
186 unsigned i;
187
188 for (i = 0; i < num; i++, bits++) {
189 const char *s;
190
191 if ((st->current_prot & bits->mask) == bits->val)
192 s = bits->set;
193 else
194 s = bits->clear;
195
196 if (s)
197 seq_printf(st->seq, " %s", s);
198 }
199}
200
201static void note_page(struct pg_state *st, unsigned long addr, unsigned level, u64 val)
202{
203 static const char units[] = "KMGTPE";
204 u64 prot = val & pg_level[level].mask;
205
206 if (addr < USER_PGTABLES_CEILING)
207 return;
208
209 if (!st->level) {
210 st->level = level;
211 st->current_prot = prot;
212 seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
213 } else if (prot != st->current_prot || level != st->level ||
214 addr >= st->marker[1].start_address) {
215 const char *unit = units;
216 unsigned long delta;
217
218 if (st->current_prot) {
219 seq_printf(st->seq, "0x%08lx-0x%08lx ",
220 st->start_address, addr);
221
222 delta = (addr - st->start_address) >> 10;
223 while (!(delta & 1023) && unit[1]) {
224 delta >>= 10;
225 unit++;
226 }
227 seq_printf(st->seq, "%9lu%c", delta, *unit);
228 if (pg_level[st->level].bits)
229 dump_prot(st, pg_level[st->level].bits, pg_level[st->level].num);
230 seq_printf(st->seq, "\n");
231 }
232
233 if (addr >= st->marker[1].start_address) {
234 st->marker++;
235 seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
236 }
237 st->start_address = addr;
238 st->current_prot = prot;
239 st->level = level;
240 }
241}
242
243static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start)
244{
245 pte_t *pte = pte_offset_kernel(pmd, 0);
246 unsigned long addr;
247 unsigned i;
248
249 for (i = 0; i < PTRS_PER_PTE; i++, pte++) {
250 addr = start + i * PAGE_SIZE;
251 note_page(st, addr, 4, pte_val(*pte));
252 }
253}
254
255static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
256{
257 pmd_t *pmd = pmd_offset(pud, 0);
258 unsigned long addr;
259 unsigned i;
260
261 for (i = 0; i < PTRS_PER_PMD; i++, pmd++) {
262 addr = start + i * PMD_SIZE;
263 if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd))
264 note_page(st, addr, 3, pmd_val(*pmd));
265 else
266 walk_pte(st, pmd, addr);
267 }
268}
269
270static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start)
271{
272 pud_t *pud = pud_offset(pgd, 0);
273 unsigned long addr;
274 unsigned i;
275
276 for (i = 0; i < PTRS_PER_PUD; i++, pud++) {
277 addr = start + i * PUD_SIZE;
278 if (!pud_none(*pud)) {
279 walk_pmd(st, pud, addr);
280 } else {
281 note_page(st, addr, 2, pud_val(*pud));
282 }
283 }
284}
285
286static void walk_pgd(struct seq_file *m)
287{
288 pgd_t *pgd = swapper_pg_dir;
289 struct pg_state st;
290 unsigned long addr;
291 unsigned i, pgdoff = USER_PGTABLES_CEILING / PGDIR_SIZE;
292
293 memset(&st, 0, sizeof(st));
294 st.seq = m;
295 st.marker = address_markers;
296
297 pgd += pgdoff;
298
299 for (i = pgdoff; i < PTRS_PER_PGD; i++, pgd++) {
300 addr = i * PGDIR_SIZE;
301 if (!pgd_none(*pgd)) {
302 walk_pud(&st, pgd, addr);
303 } else {
304 note_page(&st, addr, 1, pgd_val(*pgd));
305 }
306 }
307
308 note_page(&st, 0, 0, 0);
309}
310
311static int ptdump_show(struct seq_file *m, void *v)
312{
313 walk_pgd(m);
314 return 0;
315}
316
317static int ptdump_open(struct inode *inode, struct file *file)
318{
319 return single_open(file, ptdump_show, NULL);
320}
321
322static const struct file_operations ptdump_fops = {
323 .open = ptdump_open,
324 .read = seq_read,
325 .llseek = seq_lseek,
326 .release = single_release,
327};
328
329static int ptdump_init(void)
330{
331 struct dentry *pe;
332 unsigned i, j;
333
334 for (i = 0; i < ARRAY_SIZE(pg_level); i++)
335 if (pg_level[i].bits)
336 for (j = 0; j < pg_level[i].num; j++)
337 pg_level[i].mask |= pg_level[i].bits[j].mask;
338
339 address_markers[2].start_address = VMALLOC_START;
340
341 pe = debugfs_create_file("kernel_page_tables", 0400, NULL, NULL,
342 &ptdump_fops);
343 return pe ? 0 : -ENOMEM;
344}
345__initcall(ptdump_init);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 3e8f106ee5fe..804d61566a53 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -92,9 +92,6 @@ void show_mem(unsigned int filter)
92 printk("Mem-info:\n"); 92 printk("Mem-info:\n");
93 show_free_areas(filter); 93 show_free_areas(filter);
94 94
95 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
96 return;
97
98 for_each_bank (i, mi) { 95 for_each_bank (i, mi) {
99 struct membank *bank = &mi->bank[i]; 96 struct membank *bank = &mi->bank[i];
100 unsigned int pfn1, pfn2; 97 unsigned int pfn1, pfn2;
@@ -145,58 +142,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low,
145 *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]); 142 *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]);
146} 143}
147 144
148static void __init arm_bootmem_init(unsigned long start_pfn,
149 unsigned long end_pfn)
150{
151 struct memblock_region *reg;
152 unsigned int boot_pages;
153 phys_addr_t bitmap;
154 pg_data_t *pgdat;
155
156 /*
157 * Allocate the bootmem bitmap page. This must be in a region
158 * of memory which has already been mapped.
159 */
160 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
161 bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
162 __pfn_to_phys(end_pfn));
163
164 /*
165 * Initialise the bootmem allocator, handing the
166 * memory banks over to bootmem.
167 */
168 node_set_online(0);
169 pgdat = NODE_DATA(0);
170 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
171
172 /* Free the lowmem regions from memblock into bootmem. */
173 for_each_memblock(memory, reg) {
174 unsigned long start = memblock_region_memory_base_pfn(reg);
175 unsigned long end = memblock_region_memory_end_pfn(reg);
176
177 if (end >= end_pfn)
178 end = end_pfn;
179 if (start >= end)
180 break;
181
182 free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
183 }
184
185 /* Reserve the lowmem memblock reserved regions in bootmem. */
186 for_each_memblock(reserved, reg) {
187 unsigned long start = memblock_region_reserved_base_pfn(reg);
188 unsigned long end = memblock_region_reserved_end_pfn(reg);
189
190 if (end >= end_pfn)
191 end = end_pfn;
192 if (start >= end)
193 break;
194
195 reserve_bootmem(__pfn_to_phys(start),
196 (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
197 }
198}
199
200#ifdef CONFIG_ZONE_DMA 145#ifdef CONFIG_ZONE_DMA
201 146
202phys_addr_t arm_dma_zone_size __read_mostly; 147phys_addr_t arm_dma_zone_size __read_mostly;
@@ -236,7 +181,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
236#endif 181#endif
237} 182}
238 183
239static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, 184static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
240 unsigned long max_high) 185 unsigned long max_high)
241{ 186{
242 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 187 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
@@ -345,10 +290,11 @@ void __init arm_memblock_init(struct meminfo *mi,
345#endif 290#endif
346#ifdef CONFIG_BLK_DEV_INITRD 291#ifdef CONFIG_BLK_DEV_INITRD
347 /* FDT scan will populate initrd_start */ 292 /* FDT scan will populate initrd_start */
348 if (initrd_start) { 293 if (initrd_start && !phys_initrd_size) {
349 phys_initrd_start = __virt_to_phys(initrd_start); 294 phys_initrd_start = __virt_to_phys(initrd_start);
350 phys_initrd_size = initrd_end - initrd_start; 295 phys_initrd_size = initrd_end - initrd_start;
351 } 296 }
297 initrd_start = initrd_end = 0;
352 if (phys_initrd_size && 298 if (phys_initrd_size &&
353 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { 299 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
354 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n", 300 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
@@ -384,7 +330,6 @@ void __init arm_memblock_init(struct meminfo *mi,
384 dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit)); 330 dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit));
385 331
386 arm_memblock_steal_permitted = false; 332 arm_memblock_steal_permitted = false;
387 memblock_allow_resize();
388 memblock_dump_all(); 333 memblock_dump_all();
389} 334}
390 335
@@ -392,12 +337,11 @@ void __init bootmem_init(void)
392{ 337{
393 unsigned long min, max_low, max_high; 338 unsigned long min, max_low, max_high;
394 339
340 memblock_allow_resize();
395 max_low = max_high = 0; 341 max_low = max_high = 0;
396 342
397 find_limits(&min, &max_low, &max_high); 343 find_limits(&min, &max_low, &max_high);
398 344
399 arm_bootmem_init(min, max_low);
400
401 /* 345 /*
402 * Sparsemem tries to allocate bootmem in memory_present(), 346 * Sparsemem tries to allocate bootmem in memory_present(),
403 * so must be done after the fixed reservations 347 * so must be done after the fixed reservations
@@ -414,7 +358,7 @@ void __init bootmem_init(void)
414 * the sparse mem_map arrays initialized by sparse_init() 358 * the sparse mem_map arrays initialized by sparse_init()
415 * for memmap_init_zone(), otherwise all PFNs are invalid. 359 * for memmap_init_zone(), otherwise all PFNs are invalid.
416 */ 360 */
417 arm_bootmem_free(min, max_low, max_high); 361 zone_sizes_init(min, max_low, max_high);
418 362
419 /* 363 /*
420 * This doesn't seem to be used by the Linux memory manager any 364 * This doesn't seem to be used by the Linux memory manager any
@@ -461,7 +405,7 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn)
461 * free the section of the memmap array. 405 * free the section of the memmap array.
462 */ 406 */
463 if (pg < pgend) 407 if (pg < pgend)
464 free_bootmem(pg, pgend - pg); 408 memblock_free_early(pg, pgend - pg);
465} 409}
466 410
467/* 411/*
@@ -587,7 +531,7 @@ void __init mem_init(void)
587 extern u32 itcm_end; 531 extern u32 itcm_end;
588#endif 532#endif
589 533
590 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 534 set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
591 535
592 /* this will put all unused low memory onto the freelists */ 536 /* this will put all unused low memory onto the freelists */
593 free_unused_memmap(&meminfo); 537 free_unused_memmap(&meminfo);
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index f123d6eb074b..f9c32ba73544 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -392,9 +392,9 @@ __arm_ioremap_exec(phys_addr_t phys_addr, size_t size, bool cached)
392 unsigned int mtype; 392 unsigned int mtype;
393 393
394 if (cached) 394 if (cached)
395 mtype = MT_MEMORY; 395 mtype = MT_MEMORY_RWX;
396 else 396 else
397 mtype = MT_MEMORY_NONCACHED; 397 mtype = MT_MEMORY_RWX_NONCACHED;
398 398
399 return __arm_ioremap_caller(phys_addr, size, mtype, 399 return __arm_ioremap_caller(phys_addr, size, mtype,
400 __builtin_return_address(0)); 400 __builtin_return_address(0));
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 580ef2de82d7..4f08c133cc25 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -22,6 +22,7 @@
22#include <asm/cputype.h> 22#include <asm/cputype.h>
23#include <asm/sections.h> 23#include <asm/sections.h>
24#include <asm/cachetype.h> 24#include <asm/cachetype.h>
25#include <asm/sections.h>
25#include <asm/setup.h> 26#include <asm/setup.h>
26#include <asm/smp_plat.h> 27#include <asm/smp_plat.h>
27#include <asm/tlb.h> 28#include <asm/tlb.h>
@@ -287,36 +288,43 @@ static struct mem_type mem_types[] = {
287 .prot_l1 = PMD_TYPE_TABLE, 288 .prot_l1 = PMD_TYPE_TABLE,
288 .domain = DOMAIN_USER, 289 .domain = DOMAIN_USER,
289 }, 290 },
290 [MT_MEMORY] = { 291 [MT_MEMORY_RWX] = {
291 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY, 292 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
292 .prot_l1 = PMD_TYPE_TABLE, 293 .prot_l1 = PMD_TYPE_TABLE,
293 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, 294 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
294 .domain = DOMAIN_KERNEL, 295 .domain = DOMAIN_KERNEL,
295 }, 296 },
297 [MT_MEMORY_RW] = {
298 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
299 L_PTE_XN,
300 .prot_l1 = PMD_TYPE_TABLE,
301 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
302 .domain = DOMAIN_KERNEL,
303 },
296 [MT_ROM] = { 304 [MT_ROM] = {
297 .prot_sect = PMD_TYPE_SECT, 305 .prot_sect = PMD_TYPE_SECT,
298 .domain = DOMAIN_KERNEL, 306 .domain = DOMAIN_KERNEL,
299 }, 307 },
300 [MT_MEMORY_NONCACHED] = { 308 [MT_MEMORY_RWX_NONCACHED] = {
301 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 309 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
302 L_PTE_MT_BUFFERABLE, 310 L_PTE_MT_BUFFERABLE,
303 .prot_l1 = PMD_TYPE_TABLE, 311 .prot_l1 = PMD_TYPE_TABLE,
304 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, 312 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
305 .domain = DOMAIN_KERNEL, 313 .domain = DOMAIN_KERNEL,
306 }, 314 },
307 [MT_MEMORY_DTCM] = { 315 [MT_MEMORY_RW_DTCM] = {
308 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 316 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
309 L_PTE_XN, 317 L_PTE_XN,
310 .prot_l1 = PMD_TYPE_TABLE, 318 .prot_l1 = PMD_TYPE_TABLE,
311 .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN, 319 .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN,
312 .domain = DOMAIN_KERNEL, 320 .domain = DOMAIN_KERNEL,
313 }, 321 },
314 [MT_MEMORY_ITCM] = { 322 [MT_MEMORY_RWX_ITCM] = {
315 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY, 323 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
316 .prot_l1 = PMD_TYPE_TABLE, 324 .prot_l1 = PMD_TYPE_TABLE,
317 .domain = DOMAIN_KERNEL, 325 .domain = DOMAIN_KERNEL,
318 }, 326 },
319 [MT_MEMORY_SO] = { 327 [MT_MEMORY_RW_SO] = {
320 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 328 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
321 L_PTE_MT_UNCACHED | L_PTE_XN, 329 L_PTE_MT_UNCACHED | L_PTE_XN,
322 .prot_l1 = PMD_TYPE_TABLE, 330 .prot_l1 = PMD_TYPE_TABLE,
@@ -325,7 +333,8 @@ static struct mem_type mem_types[] = {
325 .domain = DOMAIN_KERNEL, 333 .domain = DOMAIN_KERNEL,
326 }, 334 },
327 [MT_MEMORY_DMA_READY] = { 335 [MT_MEMORY_DMA_READY] = {
328 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY, 336 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
337 L_PTE_XN,
329 .prot_l1 = PMD_TYPE_TABLE, 338 .prot_l1 = PMD_TYPE_TABLE,
330 .domain = DOMAIN_KERNEL, 339 .domain = DOMAIN_KERNEL,
331 }, 340 },
@@ -337,6 +346,44 @@ const struct mem_type *get_mem_type(unsigned int type)
337} 346}
338EXPORT_SYMBOL(get_mem_type); 347EXPORT_SYMBOL(get_mem_type);
339 348
349#define PTE_SET_FN(_name, pteop) \
350static int pte_set_##_name(pte_t *ptep, pgtable_t token, unsigned long addr, \
351 void *data) \
352{ \
353 pte_t pte = pteop(*ptep); \
354\
355 set_pte_ext(ptep, pte, 0); \
356 return 0; \
357} \
358
359#define SET_MEMORY_FN(_name, callback) \
360int set_memory_##_name(unsigned long addr, int numpages) \
361{ \
362 unsigned long start = addr; \
363 unsigned long size = PAGE_SIZE*numpages; \
364 unsigned end = start + size; \
365\
366 if (start < MODULES_VADDR || start >= MODULES_END) \
367 return -EINVAL;\
368\
369 if (end < MODULES_VADDR || end >= MODULES_END) \
370 return -EINVAL; \
371\
372 apply_to_page_range(&init_mm, start, size, callback, NULL); \
373 flush_tlb_kernel_range(start, end); \
374 return 0;\
375}
376
377PTE_SET_FN(ro, pte_wrprotect)
378PTE_SET_FN(rw, pte_mkwrite)
379PTE_SET_FN(x, pte_mkexec)
380PTE_SET_FN(nx, pte_mknexec)
381
382SET_MEMORY_FN(ro, pte_set_ro)
383SET_MEMORY_FN(rw, pte_set_rw)
384SET_MEMORY_FN(x, pte_set_x)
385SET_MEMORY_FN(nx, pte_set_nx)
386
340/* 387/*
341 * Adjust the PMD section entries according to the CPU in use. 388 * Adjust the PMD section entries according to the CPU in use.
342 */ 389 */
@@ -410,6 +457,9 @@ static void __init build_mem_type_table(void)
410 mem_types[MT_DEVICE_NONSHARED].prot_sect |= PMD_SECT_XN; 457 mem_types[MT_DEVICE_NONSHARED].prot_sect |= PMD_SECT_XN;
411 mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_XN; 458 mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_XN;
412 mem_types[MT_DEVICE_WC].prot_sect |= PMD_SECT_XN; 459 mem_types[MT_DEVICE_WC].prot_sect |= PMD_SECT_XN;
460
461 /* Also setup NX memory mapping */
462 mem_types[MT_MEMORY_RW].prot_sect |= PMD_SECT_XN;
413 } 463 }
414 if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) { 464 if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
415 /* 465 /*
@@ -487,11 +537,13 @@ static void __init build_mem_type_table(void)
487 mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED; 537 mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED;
488 mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S; 538 mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S;
489 mem_types[MT_DEVICE_CACHED].prot_pte |= L_PTE_SHARED; 539 mem_types[MT_DEVICE_CACHED].prot_pte |= L_PTE_SHARED;
490 mem_types[MT_MEMORY].prot_sect |= PMD_SECT_S; 540 mem_types[MT_MEMORY_RWX].prot_sect |= PMD_SECT_S;
491 mem_types[MT_MEMORY].prot_pte |= L_PTE_SHARED; 541 mem_types[MT_MEMORY_RWX].prot_pte |= L_PTE_SHARED;
542 mem_types[MT_MEMORY_RW].prot_sect |= PMD_SECT_S;
543 mem_types[MT_MEMORY_RW].prot_pte |= L_PTE_SHARED;
492 mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED; 544 mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED;
493 mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S; 545 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= PMD_SECT_S;
494 mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED; 546 mem_types[MT_MEMORY_RWX_NONCACHED].prot_pte |= L_PTE_SHARED;
495 } 547 }
496 } 548 }
497 549
@@ -502,15 +554,15 @@ static void __init build_mem_type_table(void)
502 if (cpu_arch >= CPU_ARCH_ARMv6) { 554 if (cpu_arch >= CPU_ARCH_ARMv6) {
503 if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) { 555 if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
504 /* Non-cacheable Normal is XCB = 001 */ 556 /* Non-cacheable Normal is XCB = 001 */
505 mem_types[MT_MEMORY_NONCACHED].prot_sect |= 557 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=
506 PMD_SECT_BUFFERED; 558 PMD_SECT_BUFFERED;
507 } else { 559 } else {
508 /* For both ARMv6 and non-TEX-remapping ARMv7 */ 560 /* For both ARMv6 and non-TEX-remapping ARMv7 */
509 mem_types[MT_MEMORY_NONCACHED].prot_sect |= 561 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=
510 PMD_SECT_TEX(1); 562 PMD_SECT_TEX(1);
511 } 563 }
512 } else { 564 } else {
513 mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_BUFFERABLE; 565 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= PMD_SECT_BUFFERABLE;
514 } 566 }
515 567
516#ifdef CONFIG_ARM_LPAE 568#ifdef CONFIG_ARM_LPAE
@@ -543,10 +595,12 @@ static void __init build_mem_type_table(void)
543 595
544 mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask; 596 mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask;
545 mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask; 597 mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;
546 mem_types[MT_MEMORY].prot_sect |= ecc_mask | cp->pmd; 598 mem_types[MT_MEMORY_RWX].prot_sect |= ecc_mask | cp->pmd;
547 mem_types[MT_MEMORY].prot_pte |= kern_pgprot; 599 mem_types[MT_MEMORY_RWX].prot_pte |= kern_pgprot;
600 mem_types[MT_MEMORY_RW].prot_sect |= ecc_mask | cp->pmd;
601 mem_types[MT_MEMORY_RW].prot_pte |= kern_pgprot;
548 mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot; 602 mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot;
549 mem_types[MT_MEMORY_NONCACHED].prot_sect |= ecc_mask; 603 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= ecc_mask;
550 mem_types[MT_ROM].prot_sect |= cp->pmd; 604 mem_types[MT_ROM].prot_sect |= cp->pmd;
551 605
552 switch (cp->pmd) { 606 switch (cp->pmd) {
@@ -1296,6 +1350,8 @@ static void __init kmap_init(void)
1296static void __init map_lowmem(void) 1350static void __init map_lowmem(void)
1297{ 1351{
1298 struct memblock_region *reg; 1352 struct memblock_region *reg;
1353 unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
1354 unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
1299 1355
1300 /* Map all the lowmem memory banks. */ 1356 /* Map all the lowmem memory banks. */
1301 for_each_memblock(memory, reg) { 1357 for_each_memblock(memory, reg) {
@@ -1308,12 +1364,40 @@ static void __init map_lowmem(void)
1308 if (start >= end) 1364 if (start >= end)
1309 break; 1365 break;
1310 1366
1311 map.pfn = __phys_to_pfn(start); 1367 if (end < kernel_x_start || start >= kernel_x_end) {
1312 map.virtual = __phys_to_virt(start); 1368 map.pfn = __phys_to_pfn(start);
1313 map.length = end - start; 1369 map.virtual = __phys_to_virt(start);
1314 map.type = MT_MEMORY; 1370 map.length = end - start;
1371 map.type = MT_MEMORY_RWX;
1315 1372
1316 create_mapping(&map); 1373 create_mapping(&map);
1374 } else {
1375 /* This better cover the entire kernel */
1376 if (start < kernel_x_start) {
1377 map.pfn = __phys_to_pfn(start);
1378 map.virtual = __phys_to_virt(start);
1379 map.length = kernel_x_start - start;
1380 map.type = MT_MEMORY_RW;
1381
1382 create_mapping(&map);
1383 }
1384
1385 map.pfn = __phys_to_pfn(kernel_x_start);
1386 map.virtual = __phys_to_virt(kernel_x_start);
1387 map.length = kernel_x_end - kernel_x_start;
1388 map.type = MT_MEMORY_RWX;
1389
1390 create_mapping(&map);
1391
1392 if (kernel_x_end < end) {
1393 map.pfn = __phys_to_pfn(kernel_x_end);
1394 map.virtual = __phys_to_virt(kernel_x_end);
1395 map.length = end - kernel_x_end;
1396 map.type = MT_MEMORY_RW;
1397
1398 create_mapping(&map);
1399 }
1400 }
1317 } 1401 }
1318} 1402}
1319 1403
diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c
index 1046b373d1ae..249379535be2 100644
--- a/arch/arm/mm/pgd.c
+++ b/arch/arm/mm/pgd.c
@@ -23,7 +23,7 @@
23#define __pgd_alloc() kmalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL) 23#define __pgd_alloc() kmalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL)
24#define __pgd_free(pgd) kfree(pgd) 24#define __pgd_free(pgd) kfree(pgd)
25#else 25#else
26#define __pgd_alloc() (pgd_t *)__get_free_pages(GFP_KERNEL, 2) 26#define __pgd_alloc() (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_REPEAT, 2)
27#define __pgd_free(pgd) free_pages((unsigned long)pgd, 2) 27#define __pgd_free(pgd) free_pages((unsigned long)pgd, 2)
28#endif 28#endif
29 29
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 29606bd75f3f..d70b73364a3f 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -54,7 +54,7 @@ static struct clocksource iop_clocksource = {
54/* 54/*
55 * IOP sched_clock() implementation via its clocksource. 55 * IOP sched_clock() implementation via its clocksource.
56 */ 56 */
57static u32 notrace iop_read_sched_clock(void) 57static u64 notrace iop_read_sched_clock(void)
58{ 58{
59 return 0xffffffffu - read_tcr1(); 59 return 0xffffffffu - read_tcr1();
60} 60}
@@ -142,7 +142,7 @@ void __init iop_init_time(unsigned long tick_rate)
142{ 142{
143 u32 timer_ctl; 143 u32 timer_ctl;
144 144
145 setup_sched_clock(iop_read_sched_clock, 32, tick_rate); 145 sched_clock_register(iop_read_sched_clock, 32, tick_rate);
146 146
147 ticks_per_jiffy = DIV_ROUND_CLOSEST(tick_rate, HZ); 147 ticks_per_jiffy = DIV_ROUND_CLOSEST(tick_rate, HZ);
148 iop_tick_rate = tick_rate; 148 iop_tick_rate = tick_rate;
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index d9bc98eb2a6b..384a776d8eb2 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -38,7 +38,7 @@
38 */ 38 */
39static void __iomem *sync32k_cnt_reg; 39static void __iomem *sync32k_cnt_reg;
40 40
41static u32 notrace omap_32k_read_sched_clock(void) 41static u64 notrace omap_32k_read_sched_clock(void)
42{ 42{
43 return sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; 43 return sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0;
44} 44}
@@ -115,7 +115,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)
115 return ret; 115 return ret;
116 } 116 }
117 117
118 setup_sched_clock(omap_32k_read_sched_clock, 32, 32768); 118 sched_clock_register(omap_32k_read_sched_clock, 32, 32768);
119 register_persistent_clock(NULL, omap_read_persistent_clock); 119 register_persistent_clock(NULL, omap_read_persistent_clock);
120 pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n"); 120 pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n");
121 121
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index c66d163d7a2a..830ff07f3385 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -22,6 +22,7 @@
22#include <linux/platform_data/dma-mv_xor.h> 22#include <linux/platform_data/dma-mv_xor.h>
23#include <linux/platform_data/usb-ehci-orion.h> 23#include <linux/platform_data/usb-ehci-orion.h>
24#include <mach/bridge-regs.h> 24#include <mach/bridge-regs.h>
25#include <plat/common.h>
25 26
26/* Create a clkdev entry for a given device/clk */ 27/* Create a clkdev entry for a given device/clk */
27void __init orion_clkdev_add(const char *con_id, const char *dev_id, 28void __init orion_clkdev_add(const char *con_id, const char *dev_id,
@@ -256,7 +257,7 @@ static __init void ge_complete(
256/***************************************************************************** 257/*****************************************************************************
257 * GE00 258 * GE00
258 ****************************************************************************/ 259 ****************************************************************************/
259struct mv643xx_eth_shared_platform_data orion_ge00_shared_data; 260static struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
260 261
261static struct resource orion_ge00_shared_resources[] = { 262static struct resource orion_ge00_shared_resources[] = {
262 { 263 {
@@ -322,7 +323,7 @@ void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
322/***************************************************************************** 323/*****************************************************************************
323 * GE01 324 * GE01
324 ****************************************************************************/ 325 ****************************************************************************/
325struct mv643xx_eth_shared_platform_data orion_ge01_shared_data; 326static struct mv643xx_eth_shared_platform_data orion_ge01_shared_data;
326 327
327static struct resource orion_ge01_shared_resources[] = { 328static struct resource orion_ge01_shared_resources[] = {
328 { 329 {
@@ -373,7 +374,7 @@ void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
373/***************************************************************************** 374/*****************************************************************************
374 * GE10 375 * GE10
375 ****************************************************************************/ 376 ****************************************************************************/
376struct mv643xx_eth_shared_platform_data orion_ge10_shared_data; 377static struct mv643xx_eth_shared_platform_data orion_ge10_shared_data;
377 378
378static struct resource orion_ge10_shared_resources[] = { 379static struct resource orion_ge10_shared_resources[] = {
379 { 380 {
@@ -422,7 +423,7 @@ void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
422/***************************************************************************** 423/*****************************************************************************
423 * GE11 424 * GE11
424 ****************************************************************************/ 425 ****************************************************************************/
425struct mv643xx_eth_shared_platform_data orion_ge11_shared_data; 426static struct mv643xx_eth_shared_platform_data orion_ge11_shared_data;
426 427
427static struct resource orion_ge11_shared_resources[] = { 428static struct resource orion_ge11_shared_resources[] = {
428 { 429 {
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index c492e1b3dfdb..807df142444b 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -15,8 +15,51 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/of_address.h> 16#include <linux/of_address.h>
17#include <linux/of_irq.h> 17#include <linux/of_irq.h>
18#include <asm/exception.h>
18#include <plat/irq.h> 19#include <plat/irq.h>
19#include <plat/orion-gpio.h> 20#include <plat/orion-gpio.h>
21#include <mach/bridge-regs.h>
22
23#ifdef CONFIG_MULTI_IRQ_HANDLER
24/*
25 * Compiling with both non-DT and DT support enabled, will
26 * break asm irq handler used by non-DT boards. Therefore,
27 * we provide a C-style irq handler even for non-DT boards,
28 * if MULTI_IRQ_HANDLER is set.
29 *
30 * Notes:
31 * - this is prepared for Kirkwood and Dove only, update
32 * accordingly if you add Orion5x or MV78x00.
33 * - Orion5x uses different macro names and has only one
34 * set of CAUSE/MASK registers.
35 * - MV78x00 uses the same macro names but has a third
36 * set of CAUSE/MASK registers.
37 *
38 */
39
40static void __iomem *orion_irq_base = IRQ_VIRT_BASE;
41
42asmlinkage void
43__exception_irq_entry orion_legacy_handle_irq(struct pt_regs *regs)
44{
45 u32 stat;
46
47 stat = readl_relaxed(orion_irq_base + IRQ_CAUSE_LOW_OFF);
48 stat &= readl_relaxed(orion_irq_base + IRQ_MASK_LOW_OFF);
49 if (stat) {
50 unsigned int hwirq = __fls(stat);
51 handle_IRQ(hwirq, regs);
52 return;
53 }
54 stat = readl_relaxed(orion_irq_base + IRQ_CAUSE_HIGH_OFF);
55 stat &= readl_relaxed(orion_irq_base + IRQ_MASK_HIGH_OFF);
56 if (stat) {
57 unsigned int hwirq = 32 + __fls(stat);
58 handle_IRQ(hwirq, regs);
59 return;
60 }
61}
62#endif
20 63
21void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) 64void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
22{ 65{
@@ -35,6 +78,10 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
35 ct->chip.irq_unmask = irq_gc_mask_set_bit; 78 ct->chip.irq_unmask = irq_gc_mask_set_bit;
36 irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE, 79 irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE,
37 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); 80 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
81
82#ifdef CONFIG_MULTI_IRQ_HANDLER
83 set_handle_irq(orion_legacy_handle_irq);
84#endif
38} 85}
39 86
40#ifdef CONFIG_OF 87#ifdef CONFIG_OF
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 9d2b2ac74938..261258f717fc 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -17,6 +17,7 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/sched_clock.h> 19#include <linux/sched_clock.h>
20#include <plat/time.h>
20 21
21/* 22/*
22 * MBus bridge block registers. 23 * MBus bridge block registers.
@@ -60,7 +61,7 @@ static u32 ticks_per_jiffy;
60 * at least 7.5ns (133MHz TCLK). 61 * at least 7.5ns (133MHz TCLK).
61 */ 62 */
62 63
63static u32 notrace orion_read_sched_clock(void) 64static u64 notrace orion_read_sched_clock(void)
64{ 65{
65 return ~readl(timer_base + TIMER0_VAL_OFF); 66 return ~readl(timer_base + TIMER0_VAL_OFF);
66} 67}
@@ -174,7 +175,7 @@ static irqreturn_t orion_timer_interrupt(int irq, void *dev_id)
174 175
175static struct irqaction orion_timer_irq = { 176static struct irqaction orion_timer_irq = {
176 .name = "orion_tick", 177 .name = "orion_tick",
177 .flags = IRQF_DISABLED | IRQF_TIMER, 178 .flags = IRQF_TIMER,
178 .handler = orion_timer_interrupt 179 .handler = orion_timer_interrupt
179}; 180};
180 181
@@ -201,7 +202,7 @@ orion_time_init(void __iomem *_bridge_base, u32 _bridge_timer1_clr_mask,
201 /* 202 /*
202 * Set scale and timer for sched_clock. 203 * Set scale and timer for sched_clock.
203 */ 204 */
204 setup_sched_clock(orion_read_sched_clock, 32, tclk); 205 sched_clock_register(orion_read_sched_clock, 32, tclk);
205 206
206 /* 207 /*
207 * Setup free-running clocksource timer (interrupts 208 * Setup free-running clocksource timer (interrupts
diff --git a/arch/arm/plat-pxa/dma.c b/arch/arm/plat-pxa/dma.c
index 79ef102e3b2b..054fc5a1a11c 100644
--- a/arch/arm/plat-pxa/dma.c
+++ b/arch/arm/plat-pxa/dma.c
@@ -377,7 +377,7 @@ int __init pxa_init_dma(int irq, int num_ch)
377 spin_lock_init(&dma_channels[i].lock); 377 spin_lock_init(&dma_channels[i].lock);
378 } 378 }
379 379
380 ret = request_irq(irq, dma_irq_handler, IRQF_DISABLED, "DMA", NULL); 380 ret = request_irq(irq, dma_irq_handler, 0, "DMA", NULL);
381 if (ret) { 381 if (ret) {
382 printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n"); 382 printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n");
383 kfree(dma_channels); 383 kfree(dma_channels);
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 6d95d60276d6..58645a58d0d8 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -24,7 +24,6 @@ config PLAT_S5P
24 select S3C_GPIO_TRACK 24 select S3C_GPIO_TRACK
25 select S5P_GPIO_DRVSTR 25 select S5P_GPIO_DRVSTR
26 select SAMSUNG_CLKSRC if !COMMON_CLK 26 select SAMSUNG_CLKSRC if !COMMON_CLK
27 select SAMSUNG_GPIOLIB_4BIT
28 help 27 help
29 Base platform code for Samsung's S5P series SoC. 28 Base platform code for Samsung's S5P series SoC.
30 29
@@ -115,13 +114,6 @@ config S5P_GPIO_INT
115 114
116# options for gpio configuration support 115# options for gpio configuration support
117 116
118config SAMSUNG_GPIOLIB_4BIT
119 bool
120 help
121 GPIOlib file contains the 4 bit modification functions for gpio
122 configuration. GPIOlib shall be compiled only for S3C64XX and S5P
123 series of processors.
124
125config S5P_GPIO_DRVSTR 117config S5P_GPIO_DRVSTR
126 bool 118 bool
127 help 119 help
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 99a3590f0349..ac07e871f6a7 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -1468,6 +1468,8 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1468 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; 1468 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
1469#if defined(CONFIG_PL330_DMA) 1469#if defined(CONFIG_PL330_DMA)
1470 pd.filter = pl330_filter; 1470 pd.filter = pl330_filter;
1471#elif defined(CONFIG_S3C64XX_PL080)
1472 pd.filter = pl08x_filter_id;
1471#elif defined(CONFIG_S3C24XX_DMAC) 1473#elif defined(CONFIG_S3C24XX_DMAC)
1472 pd.filter = s3c24xx_dma_filter; 1474 pd.filter = s3c24xx_dma_filter;
1473#endif 1475#endif
@@ -1509,8 +1511,10 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1509 pd.num_cs = num_cs; 1511 pd.num_cs = num_cs;
1510 pd.src_clk_nr = src_clk_nr; 1512 pd.src_clk_nr = src_clk_nr;
1511 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio; 1513 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
1512#ifdef CONFIG_PL330_DMA 1514#if defined(CONFIG_PL330_DMA)
1513 pd.filter = pl330_filter; 1515 pd.filter = pl330_filter;
1516#elif defined(CONFIG_S3C64XX_PL080)
1517 pd.filter = pl08x_filter_id;
1514#endif 1518#endif
1515 1519
1516 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1); 1520 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
@@ -1550,8 +1554,10 @@ void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1550 pd.num_cs = num_cs; 1554 pd.num_cs = num_cs;
1551 pd.src_clk_nr = src_clk_nr; 1555 pd.src_clk_nr = src_clk_nr;
1552 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio; 1556 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
1553#ifdef CONFIG_PL330_DMA 1557#if defined(CONFIG_PL330_DMA)
1554 pd.filter = pl330_filter; 1558 pd.filter = pl330_filter;
1559#elif defined(CONFIG_S3C64XX_PL080)
1560 pd.filter = pl08x_filter_id;
1555#endif 1561#endif
1556 1562
1557 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2); 1563 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c
index ec0d731b0e7b..886326ee6f6c 100644
--- a/arch/arm/plat-samsung/dma-ops.c
+++ b/arch/arm/plat-samsung/dma-ops.c
@@ -18,6 +18,12 @@
18 18
19#include <mach/dma.h> 19#include <mach/dma.h>
20 20
21#if defined(CONFIG_PL330_DMA)
22#define dma_filter pl330_filter
23#elif defined(CONFIG_S3C64XX_PL080)
24#define dma_filter pl08x_filter_id
25#endif
26
21static unsigned samsung_dmadev_request(enum dma_ch dma_ch, 27static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
22 struct samsung_dma_req *param, 28 struct samsung_dma_req *param,
23 struct device *dev, char *ch_name) 29 struct device *dev, char *ch_name)
@@ -30,7 +36,7 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
30 if (dev->of_node) 36 if (dev->of_node)
31 return (unsigned)dma_request_slave_channel(dev, ch_name); 37 return (unsigned)dma_request_slave_channel(dev, ch_name);
32 else 38 else
33 return (unsigned)dma_request_channel(mask, pl330_filter, 39 return (unsigned)dma_request_channel(mask, dma_filter,
34 (void *)dma_ch); 40 (void *)dma_ch);
35} 41}
36 42
diff --git a/arch/arm/plat-samsung/include/plat/fiq.h b/arch/arm/plat-samsung/include/plat/fiq.h
deleted file mode 100644
index 535d06a35628..000000000000
--- a/arch/arm/plat-samsung/include/plat/fiq.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/fiq.h
2 *
3 * Copyright (c) 2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU FIQ support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13extern int s3c24xx_set_fiq(unsigned int irq, bool on);
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index 6bc1a8f471e3..ff6063f0d5ea 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -101,8 +101,8 @@ struct pm_uart_save {
101/* helper functions to save/restore lists of registers. */ 101/* helper functions to save/restore lists of registers. */
102 102
103extern void s3c_pm_do_save(struct sleep_save *ptr, int count); 103extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
104extern void s3c_pm_do_restore(struct sleep_save *ptr, int count); 104extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
105extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); 105extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
106 106
107#ifdef CONFIG_SAMSUNG_PM 107#ifdef CONFIG_SAMSUNG_PM
108extern int s3c_irq_wake(struct irq_data *data, unsigned int state); 108extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
diff --git a/arch/arm/plat-samsung/include/plat/regs-ata.h b/arch/arm/plat-samsung/include/plat/regs-ata.h
deleted file mode 100644
index f5df92fdae26..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-ata.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/regs-ata.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Samsung CF-ATA register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_PLAT_REGS_ATA_H
14#define __ASM_PLAT_REGS_ATA_H __FILE__
15
16#define S3C_CFATA_REG(x) (x)
17
18#define S3C_CFATA_MUX S3C_CFATA_REG(0x0)
19
20#define S3C_ATA_CTRL S3C_CFATA_REG(0x0)
21#define S3C_ATA_STATUS S3C_CFATA_REG(0x4)
22#define S3C_ATA_CMD S3C_CFATA_REG(0x8)
23#define S3C_ATA_SWRST S3C_CFATA_REG(0xc)
24#define S3C_ATA_IRQ S3C_CFATA_REG(0x10)
25#define S3C_ATA_IRQ_MSK S3C_CFATA_REG(0x14)
26#define S3C_ATA_CFG S3C_CFATA_REG(0x18)
27
28#define S3C_ATA_MDMA_TIME S3C_CFATA_REG(0x28)
29#define S3C_ATA_PIO_TIME S3C_CFATA_REG(0x2c)
30#define S3C_ATA_UDMA_TIME S3C_CFATA_REG(0x30)
31#define S3C_ATA_XFR_NUM S3C_CFATA_REG(0x34)
32#define S3C_ATA_XFR_CNT S3C_CFATA_REG(0x38)
33#define S3C_ATA_TBUF_START S3C_CFATA_REG(0x3c)
34#define S3C_ATA_TBUF_SIZE S3C_CFATA_REG(0x40)
35#define S3C_ATA_SBUF_START S3C_CFATA_REG(0x44)
36#define S3C_ATA_SBUF_SIZE S3C_CFATA_REG(0x48)
37#define S3C_ATA_CADR_TBUF S3C_CFATA_REG(0x4c)
38#define S3C_ATA_CADR_SBUF S3C_CFATA_REG(0x50)
39#define S3C_ATA_PIO_DTR S3C_CFATA_REG(0x54)
40#define S3C_ATA_PIO_FED S3C_CFATA_REG(0x58)
41#define S3C_ATA_PIO_SCR S3C_CFATA_REG(0x5c)
42#define S3C_ATA_PIO_LLR S3C_CFATA_REG(0x60)
43#define S3C_ATA_PIO_LMR S3C_CFATA_REG(0x64)
44#define S3C_ATA_PIO_LHR S3C_CFATA_REG(0x68)
45#define S3C_ATA_PIO_DVR S3C_CFATA_REG(0x6c)
46#define S3C_ATA_PIO_CSD S3C_CFATA_REG(0x70)
47#define S3C_ATA_PIO_DAD S3C_CFATA_REG(0x74)
48#define S3C_ATA_PIO_READY S3C_CFATA_REG(0x78)
49#define S3C_ATA_PIO_RDATA S3C_CFATA_REG(0x7c)
50
51#define S3C_CFATA_MUX_TRUEIDE 0x01
52
53#define S3C_ATA_CFG_SWAP 0x40
54#define S3C_ATA_CFG_IORDYEN 0x02
55
56#endif /* __ASM_PLAT_REGS_ATA_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-nand.h b/arch/arm/plat-samsung/include/plat/regs-nand.h
deleted file mode 100644
index 238efea7b9e4..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-nand.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-nand.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C2410 NAND register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_NAND
14#define __ASM_ARM_REGS_NAND
15
16
17#define S3C2410_NFREG(x) (x)
18
19#define S3C2410_NFCONF S3C2410_NFREG(0x00)
20#define S3C2410_NFCMD S3C2410_NFREG(0x04)
21#define S3C2410_NFADDR S3C2410_NFREG(0x08)
22#define S3C2410_NFDATA S3C2410_NFREG(0x0C)
23#define S3C2410_NFSTAT S3C2410_NFREG(0x10)
24#define S3C2410_NFECC S3C2410_NFREG(0x14)
25
26#define S3C2440_NFCONT S3C2410_NFREG(0x04)
27#define S3C2440_NFCMD S3C2410_NFREG(0x08)
28#define S3C2440_NFADDR S3C2410_NFREG(0x0C)
29#define S3C2440_NFDATA S3C2410_NFREG(0x10)
30#define S3C2440_NFECCD0 S3C2410_NFREG(0x14)
31#define S3C2440_NFECCD1 S3C2410_NFREG(0x18)
32#define S3C2440_NFECCD S3C2410_NFREG(0x1C)
33#define S3C2440_NFSTAT S3C2410_NFREG(0x20)
34#define S3C2440_NFESTAT0 S3C2410_NFREG(0x24)
35#define S3C2440_NFESTAT1 S3C2410_NFREG(0x28)
36#define S3C2440_NFMECC0 S3C2410_NFREG(0x2C)
37#define S3C2440_NFMECC1 S3C2410_NFREG(0x30)
38#define S3C2440_NFSECC S3C2410_NFREG(0x34)
39#define S3C2440_NFSBLK S3C2410_NFREG(0x38)
40#define S3C2440_NFEBLK S3C2410_NFREG(0x3C)
41
42#define S3C2412_NFSBLK S3C2410_NFREG(0x20)
43#define S3C2412_NFEBLK S3C2410_NFREG(0x24)
44#define S3C2412_NFSTAT S3C2410_NFREG(0x28)
45#define S3C2412_NFMECC_ERR0 S3C2410_NFREG(0x2C)
46#define S3C2412_NFMECC_ERR1 S3C2410_NFREG(0x30)
47#define S3C2412_NFMECC0 S3C2410_NFREG(0x34)
48#define S3C2412_NFMECC1 S3C2410_NFREG(0x38)
49#define S3C2412_NFSECC S3C2410_NFREG(0x3C)
50
51#define S3C2410_NFCONF_EN (1<<15)
52#define S3C2410_NFCONF_512BYTE (1<<14)
53#define S3C2410_NFCONF_4STEP (1<<13)
54#define S3C2410_NFCONF_INITECC (1<<12)
55#define S3C2410_NFCONF_nFCE (1<<11)
56#define S3C2410_NFCONF_TACLS(x) ((x)<<8)
57#define S3C2410_NFCONF_TWRPH0(x) ((x)<<4)
58#define S3C2410_NFCONF_TWRPH1(x) ((x)<<0)
59
60#define S3C2410_NFSTAT_BUSY (1<<0)
61
62#define S3C2440_NFCONF_BUSWIDTH_8 (0<<0)
63#define S3C2440_NFCONF_BUSWIDTH_16 (1<<0)
64#define S3C2440_NFCONF_ADVFLASH (1<<3)
65#define S3C2440_NFCONF_TACLS(x) ((x)<<12)
66#define S3C2440_NFCONF_TWRPH0(x) ((x)<<8)
67#define S3C2440_NFCONF_TWRPH1(x) ((x)<<4)
68
69#define S3C2440_NFCONT_LOCKTIGHT (1<<13)
70#define S3C2440_NFCONT_SOFTLOCK (1<<12)
71#define S3C2440_NFCONT_ILLEGALACC_EN (1<<10)
72#define S3C2440_NFCONT_RNBINT_EN (1<<9)
73#define S3C2440_NFCONT_RN_FALLING (1<<8)
74#define S3C2440_NFCONT_SPARE_ECCLOCK (1<<6)
75#define S3C2440_NFCONT_MAIN_ECCLOCK (1<<5)
76#define S3C2440_NFCONT_INITECC (1<<4)
77#define S3C2440_NFCONT_nFCE (1<<1)
78#define S3C2440_NFCONT_ENABLE (1<<0)
79
80#define S3C2440_NFSTAT_READY (1<<0)
81#define S3C2440_NFSTAT_nCE (1<<1)
82#define S3C2440_NFSTAT_RnB_CHANGE (1<<2)
83#define S3C2440_NFSTAT_ILLEGAL_ACCESS (1<<3)
84
85#define S3C2412_NFCONF_NANDBOOT (1<<31)
86#define S3C2412_NFCONF_ECCCLKCON (1<<30)
87#define S3C2412_NFCONF_ECC_MLC (1<<24)
88#define S3C2412_NFCONF_TACLS_MASK (7<<12) /* 1 extra bit of Tacls */
89
90#define S3C2412_NFCONT_ECC4_DIRWR (1<<18)
91#define S3C2412_NFCONT_LOCKTIGHT (1<<17)
92#define S3C2412_NFCONT_SOFTLOCK (1<<16)
93#define S3C2412_NFCONT_ECC4_ENCINT (1<<13)
94#define S3C2412_NFCONT_ECC4_DECINT (1<<12)
95#define S3C2412_NFCONT_MAIN_ECC_LOCK (1<<7)
96#define S3C2412_NFCONT_INIT_MAIN_ECC (1<<5)
97#define S3C2412_NFCONT_nFCE1 (1<<2)
98#define S3C2412_NFCONT_nFCE0 (1<<1)
99
100#define S3C2412_NFSTAT_ECC_ENCDONE (1<<7)
101#define S3C2412_NFSTAT_ECC_DECDONE (1<<6)
102#define S3C2412_NFSTAT_ILLEGAL_ACCESS (1<<5)
103#define S3C2412_NFSTAT_RnB_CHANGE (1<<4)
104#define S3C2412_NFSTAT_nFCE1 (1<<3)
105#define S3C2412_NFSTAT_nFCE0 (1<<2)
106#define S3C2412_NFSTAT_Res1 (1<<1)
107#define S3C2412_NFSTAT_READY (1<<0)
108
109#define S3C2412_NFECCERR_SERRDATA(x) (((x) >> 21) & 0xf)
110#define S3C2412_NFECCERR_SERRBIT(x) (((x) >> 18) & 0x7)
111#define S3C2412_NFECCERR_MERRDATA(x) (((x) >> 7) & 0x3ff)
112#define S3C2412_NFECCERR_MERRBIT(x) (((x) >> 4) & 0x7)
113#define S3C2412_NFECCERR_SPARE_ERR(x) (((x) >> 2) & 0x3)
114#define S3C2412_NFECCERR_MAIN_ERR(x) (((x) >> 2) & 0x3)
115#define S3C2412_NFECCERR_NONE (0)
116#define S3C2412_NFECCERR_1BIT (1)
117#define S3C2412_NFECCERR_MULTIBIT (2)
118#define S3C2412_NFECCERR_ECCAREA (3)
119
120
121
122#endif /* __ASM_ARM_REGS_NAND */
123
diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h
index 4afc32f90b6d..f48dc0a4736c 100644
--- a/arch/arm/plat-samsung/include/plat/uncompress.h
+++ b/arch/arm/plat-samsung/include/plat/uncompress.h
@@ -145,6 +145,8 @@ static inline void arch_enable_uart_fifo(void)
145 if (!(fifocon & S3C2410_UFCON_RESETBOTH)) 145 if (!(fifocon & S3C2410_UFCON_RESETBOTH))
146 break; 146 break;
147 } 147 }
148
149 uart_wr(S3C2410_UFCON, S3C2410_UFCON_FIFOMODE);
148 } 150 }
149} 151}
150#else 152#else
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index a8de3cfe2ee1..dd4c15d0d68f 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -19,6 +19,10 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21 21
22#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
23#include <mach/gpio-samsung.h>
24#endif
25
22#include <plat/gpio-core.h> 26#include <plat/gpio-core.h>
23#include <plat/pm.h> 27#include <plat/pm.h>
24 28
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index d0c23010b693..e5b0f2c2d884 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -28,8 +28,10 @@
28#ifdef CONFIG_SAMSUNG_ATAGS 28#ifdef CONFIG_SAMSUNG_ATAGS
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/map.h> 30#include <mach/map.h>
31#ifndef CONFIG_ARCH_EXYNOS
31#include <mach/regs-clock.h> 32#include <mach/regs-clock.h>
32#include <mach/regs-irq.h> 33#include <mach/regs-irq.h>
34#endif
33#include <mach/irqs.h> 35#include <mach/irqs.h>
34#endif 36#endif
35 37
@@ -182,7 +184,7 @@ void s3c_pm_do_save(struct sleep_save *ptr, int count)
182 * restore the UARTs state yet 184 * restore the UARTs state yet
183*/ 185*/
184 186
185void s3c_pm_do_restore(struct sleep_save *ptr, int count) 187void s3c_pm_do_restore(const struct sleep_save *ptr, int count)
186{ 188{
187 for (; count > 0; count--, ptr++) { 189 for (; count > 0; count--, ptr++) {
188 printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n", 190 printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n",
@@ -203,7 +205,7 @@ void s3c_pm_do_restore(struct sleep_save *ptr, int count)
203 * peripherals, as things may be changing! 205 * peripherals, as things may be changing!
204*/ 206*/
205 207
206void s3c_pm_do_restore_core(struct sleep_save *ptr, int count) 208void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
207{ 209{
208 for (; count > 0; count--, ptr++) 210 for (; count > 0; count--, ptr++)
209 __raw_writel(ptr->val, ptr->reg); 211 __raw_writel(ptr->val, ptr->reg);
diff --git a/arch/arm/plat-samsung/s5p-irq-eint.c b/arch/arm/plat-samsung/s5p-irq-eint.c
index faa651602780..ebee4dc11a94 100644
--- a/arch/arm/plat-samsung/s5p-irq-eint.c
+++ b/arch/arm/plat-samsung/s5p-irq-eint.c
@@ -16,6 +16,7 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/irqchip/arm-vic.h> 18#include <linux/irqchip/arm-vic.h>
19#include <linux/of.h>
19 20
20#include <plat/regs-irqtype.h> 21#include <plat/regs-irqtype.h>
21 22
@@ -202,6 +203,9 @@ static int __init s5p_init_irq_eint(void)
202{ 203{
203 int irq; 204 int irq;
204 205
206 if (of_have_populated_dt())
207 return -ENODEV;
208
205 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++) 209 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++)
206 irq_set_chip(irq, &s5p_irq_vic_eint); 210 irq_set_chip(irq, &s5p_irq_vic_eint);
207 211
diff --git a/arch/arm/plat-samsung/s5p-irq-pm.c b/arch/arm/plat-samsung/s5p-irq-pm.c
index 7c1e3b7072fc..591498035916 100644
--- a/arch/arm/plat-samsung/s5p-irq-pm.c
+++ b/arch/arm/plat-samsung/s5p-irq-pm.c
@@ -22,7 +22,10 @@
22#include <mach/map.h> 22#include <mach/map.h>
23 23
24#include <mach/regs-gpio.h> 24#include <mach/regs-gpio.h>
25
26#ifndef CONFIG_ARCH_EXYNOS
25#include <mach/regs-irq.h> 27#include <mach/regs-irq.h>
28#endif
26 29
27/* state for IRQs over sleep */ 30/* state for IRQs over sleep */
28 31
diff --git a/arch/arm/plat-samsung/setup-camif.c b/arch/arm/plat-samsung/setup-camif.c
index e01bf760af2c..72d8edb8927a 100644
--- a/arch/arm/plat-samsung/setup-camif.c
+++ b/arch/arm/plat-samsung/setup-camif.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <plat/gpio-cfg.h> 12#include <plat/gpio-cfg.h>
13#include <mach/gpio-samsung.h>
13 14
14/* Number of camera port pins, without FIELD */ 15/* Number of camera port pins, without FIELD */
15#define S3C_CAMIF_NUM_GPIOS 13 16#define S3C_CAMIF_NUM_GPIOS 13
diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c
index 39895d892c3b..53feb90c840c 100644
--- a/arch/arm/plat-versatile/platsmp.c
+++ b/arch/arm/plat-versatile/platsmp.c
@@ -27,8 +27,7 @@ static void write_pen_release(int val)
27{ 27{
28 pen_release = val; 28 pen_release = val;
29 smp_wmb(); 29 smp_wmb();
30 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); 30 sync_cache_w(&pen_release);
31 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
32} 31}
33 32
34static DEFINE_SPINLOCK(boot_lock); 33static DEFINE_SPINLOCK(boot_lock);
diff --git a/arch/arm/plat-versatile/sched-clock.c b/arch/arm/plat-versatile/sched-clock.c
index 51b109e3b6c3..c966ae90f4a0 100644
--- a/arch/arm/plat-versatile/sched-clock.c
+++ b/arch/arm/plat-versatile/sched-clock.c
@@ -26,7 +26,7 @@
26 26
27static void __iomem *ctr; 27static void __iomem *ctr;
28 28
29static u32 notrace versatile_read_sched_clock(void) 29static u64 notrace versatile_read_sched_clock(void)
30{ 30{
31 if (ctr) 31 if (ctr)
32 return readl(ctr); 32 return readl(ctr);
@@ -37,5 +37,5 @@ static u32 notrace versatile_read_sched_clock(void)
37void __init versatile_sched_clock_init(void __iomem *reg, unsigned long rate) 37void __init versatile_sched_clock_init(void __iomem *reg, unsigned long rate)
38{ 38{
39 ctr = reg; 39 ctr = reg;
40 setup_sched_clock(versatile_read_sched_clock, 32, rate); 40 sched_clock_register(versatile_read_sched_clock, 32, rate);
41} 41}
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 85501238b425..b96723e258a0 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -23,6 +23,7 @@
23#include <linux/of_address.h> 23#include <linux/of_address.h>
24#include <linux/cpuidle.h> 24#include <linux/cpuidle.h>
25#include <linux/cpufreq.h> 25#include <linux/cpufreq.h>
26#include <linux/cpu.h>
26 27
27#include <linux/mm.h> 28#include <linux/mm.h>
28 29
@@ -154,7 +155,7 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
154} 155}
155EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range); 156EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
156 157
157static void __init xen_percpu_init(void *unused) 158static void xen_percpu_init(void)
158{ 159{
159 struct vcpu_register_vcpu_info info; 160 struct vcpu_register_vcpu_info info;
160 struct vcpu_info *vcpup; 161 struct vcpu_info *vcpup;
@@ -193,6 +194,31 @@ static void xen_power_off(void)
193 BUG(); 194 BUG();
194} 195}
195 196
197static int xen_cpu_notification(struct notifier_block *self,
198 unsigned long action,
199 void *hcpu)
200{
201 switch (action) {
202 case CPU_STARTING:
203 xen_percpu_init();
204 break;
205 default:
206 break;
207 }
208
209 return NOTIFY_OK;
210}
211
212static struct notifier_block xen_cpu_notifier = {
213 .notifier_call = xen_cpu_notification,
214};
215
216static irqreturn_t xen_arm_callback(int irq, void *arg)
217{
218 xen_hvm_evtchn_do_upcall();
219 return IRQ_HANDLED;
220}
221
196/* 222/*
197 * see Documentation/devicetree/bindings/arm/xen.txt for the 223 * see Documentation/devicetree/bindings/arm/xen.txt for the
198 * documentation of the Xen Device Tree format. 224 * documentation of the Xen Device Tree format.
@@ -208,6 +234,7 @@ static int __init xen_guest_init(void)
208 const char *version = NULL; 234 const char *version = NULL;
209 const char *xen_prefix = "xen,xen-"; 235 const char *xen_prefix = "xen,xen-";
210 struct resource res; 236 struct resource res;
237 phys_addr_t grant_frames;
211 238
212 node = of_find_compatible_node(NULL, NULL, "xen,xen"); 239 node = of_find_compatible_node(NULL, NULL, "xen,xen");
213 if (!node) { 240 if (!node) {
@@ -224,10 +251,14 @@ static int __init xen_guest_init(void)
224 } 251 }
225 if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res)) 252 if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
226 return 0; 253 return 0;
227 xen_hvm_resume_frames = res.start; 254 grant_frames = res.start;
228 xen_events_irq = irq_of_parse_and_map(node, 0); 255 xen_events_irq = irq_of_parse_and_map(node, 0);
229 pr_info("Xen %s support found, events_irq=%d gnttab_frame_pfn=%lx\n", 256 pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
230 version, xen_events_irq, (xen_hvm_resume_frames >> PAGE_SHIFT)); 257 version, xen_events_irq, &grant_frames);
258
259 if (xen_events_irq < 0)
260 return -ENODEV;
261
231 xen_domain_type = XEN_HVM_DOMAIN; 262 xen_domain_type = XEN_HVM_DOMAIN;
232 263
233 xen_setup_features(); 264 xen_setup_features();
@@ -265,6 +296,10 @@ static int __init xen_guest_init(void)
265 if (xen_vcpu_info == NULL) 296 if (xen_vcpu_info == NULL)
266 return -ENOMEM; 297 return -ENOMEM;
267 298
299 if (gnttab_setup_auto_xlat_frames(grant_frames)) {
300 free_percpu(xen_vcpu_info);
301 return -ENOMEM;
302 }
268 gnttab_init(); 303 gnttab_init();
269 if (!xen_initial_domain()) 304 if (!xen_initial_domain())
270 xenbus_probe(NULL); 305 xenbus_probe(NULL);
@@ -276,9 +311,21 @@ static int __init xen_guest_init(void)
276 disable_cpuidle(); 311 disable_cpuidle();
277 disable_cpufreq(); 312 disable_cpufreq();
278 313
314 xen_init_IRQ();
315
316 if (request_percpu_irq(xen_events_irq, xen_arm_callback,
317 "events", &xen_vcpu)) {
318 pr_err("Error request IRQ %d\n", xen_events_irq);
319 return -EINVAL;
320 }
321
322 xen_percpu_init();
323
324 register_cpu_notifier(&xen_cpu_notifier);
325
279 return 0; 326 return 0;
280} 327}
281core_initcall(xen_guest_init); 328early_initcall(xen_guest_init);
282 329
283static int __init xen_pm_init(void) 330static int __init xen_pm_init(void)
284{ 331{
@@ -292,31 +339,6 @@ static int __init xen_pm_init(void)
292} 339}
293late_initcall(xen_pm_init); 340late_initcall(xen_pm_init);
294 341
295static irqreturn_t xen_arm_callback(int irq, void *arg)
296{
297 xen_hvm_evtchn_do_upcall();
298 return IRQ_HANDLED;
299}
300
301static int __init xen_init_events(void)
302{
303 if (!xen_domain() || xen_events_irq < 0)
304 return -ENODEV;
305
306 xen_init_IRQ();
307
308 if (request_percpu_irq(xen_events_irq, xen_arm_callback,
309 "events", &xen_vcpu)) {
310 pr_err("Error requesting IRQ %d\n", xen_events_irq);
311 return -EINVAL;
312 }
313
314 on_each_cpu(xen_percpu_init, NULL, 0);
315
316 return 0;
317}
318postcore_initcall(xen_init_events);
319
320/* In the hypervisor.S file. */ 342/* In the hypervisor.S file. */
321EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op); 343EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);
322EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op); 344EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6d4dd22ee4b7..dd4327f09ba4 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -2,6 +2,7 @@ config 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_USE_CMPXCHG_LOCKREF
5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
5 select ARCH_WANT_OPTIONAL_GPIOLIB 6 select ARCH_WANT_OPTIONAL_GPIOLIB
6 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 7 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
7 select ARCH_WANT_FRAME_POINTERS 8 select ARCH_WANT_FRAME_POINTERS
@@ -11,19 +12,27 @@ config ARM64
11 select BUILDTIME_EXTABLE_SORT 12 select BUILDTIME_EXTABLE_SORT
12 select CLONE_BACKWARDS 13 select CLONE_BACKWARDS
13 select COMMON_CLK 14 select COMMON_CLK
15 select CPU_PM if (SUSPEND || CPU_IDLE)
16 select DCACHE_WORD_ACCESS
14 select GENERIC_CLOCKEVENTS 17 select GENERIC_CLOCKEVENTS
18 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
15 select GENERIC_IOMAP 19 select GENERIC_IOMAP
16 select GENERIC_IRQ_PROBE 20 select GENERIC_IRQ_PROBE
17 select GENERIC_IRQ_SHOW 21 select GENERIC_IRQ_SHOW
18 select GENERIC_SCHED_CLOCK 22 select GENERIC_SCHED_CLOCK
19 select GENERIC_SMP_IDLE_THREAD 23 select GENERIC_SMP_IDLE_THREAD
24 select GENERIC_STRNCPY_FROM_USER
25 select GENERIC_STRNLEN_USER
20 select GENERIC_TIME_VSYSCALL 26 select GENERIC_TIME_VSYSCALL
21 select HARDIRQS_SW_RESEND 27 select HARDIRQS_SW_RESEND
28 select HAVE_ARCH_JUMP_LABEL
22 select HAVE_ARCH_TRACEHOOK 29 select HAVE_ARCH_TRACEHOOK
23 select HAVE_DEBUG_BUGVERBOSE 30 select HAVE_DEBUG_BUGVERBOSE
24 select HAVE_DEBUG_KMEMLEAK 31 select HAVE_DEBUG_KMEMLEAK
25 select HAVE_DMA_API_DEBUG 32 select HAVE_DMA_API_DEBUG
26 select HAVE_DMA_ATTRS 33 select HAVE_DMA_ATTRS
34 select HAVE_DMA_CONTIGUOUS
35 select HAVE_EFFICIENT_UNALIGNED_ACCESS
27 select HAVE_GENERIC_DMA_COHERENT 36 select HAVE_GENERIC_DMA_COHERENT
28 select HAVE_HW_BREAKPOINT if PERF_EVENTS 37 select HAVE_HW_BREAKPOINT if PERF_EVENTS
29 select HAVE_MEMBLOCK 38 select HAVE_MEMBLOCK
@@ -275,6 +284,24 @@ config SYSVIPC_COMPAT
275 284
276endmenu 285endmenu
277 286
287menu "Power management options"
288
289source "kernel/power/Kconfig"
290
291config ARCH_SUSPEND_POSSIBLE
292 def_bool y
293
294config ARM64_CPU_SUSPEND
295 def_bool PM_SLEEP
296
297endmenu
298
299menu "CPU Power Management"
300
301source "drivers/cpuidle/Kconfig"
302
303endmenu
304
278source "net/Kconfig" 305source "net/Kconfig"
279 306
280source "drivers/Kconfig" 307source "drivers/Kconfig"
diff --git a/arch/arm64/boot/dts/foundation-v8.dts b/arch/arm64/boot/dts/foundation-v8.dts
index 519c4b2c0687..4a060906809d 100644
--- a/arch/arm64/boot/dts/foundation-v8.dts
+++ b/arch/arm64/boot/dts/foundation-v8.dts
@@ -224,7 +224,7 @@
224 224
225 virtio_block@0130000 { 225 virtio_block@0130000 {
226 compatible = "virtio,mmio"; 226 compatible = "virtio,mmio";
227 reg = <0x130000 0x1000>; 227 reg = <0x130000 0x200>;
228 interrupts = <42>; 228 interrupts = <42>;
229 }; 229 };
230 }; 230 };
diff --git a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
index b45e5f39f577..2f2ecd217363 100644
--- a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
+++ b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
@@ -183,6 +183,12 @@
183 clocks = <&v2m_oscclk1>, <&v2m_clk24mhz>; 183 clocks = <&v2m_oscclk1>, <&v2m_clk24mhz>;
184 clock-names = "clcdclk", "apb_pclk"; 184 clock-names = "clcdclk", "apb_pclk";
185 }; 185 };
186
187 virtio_block@0130000 {
188 compatible = "virtio,mmio";
189 reg = <0x130000 0x200>;
190 interrupts = <42>;
191 };
186 }; 192 };
187 193
188 v2m_fixed_3v3: fixedregulator@0 { 194 v2m_fixed_3v3: fixedregulator@0 {
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 519f89f5b6a3..71c53ecfcc3a 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -26,7 +26,6 @@ generic-y += mman.h
26generic-y += msgbuf.h 26generic-y += msgbuf.h
27generic-y += mutex.h 27generic-y += mutex.h
28generic-y += pci.h 28generic-y += pci.h
29generic-y += percpu.h
30generic-y += poll.h 29generic-y += poll.h
31generic-y += posix_types.h 30generic-y += posix_types.h
32generic-y += resource.h 31generic-y += resource.h
@@ -51,3 +50,4 @@ generic-y += user.h
51generic-y += vga.h 50generic-y += vga.h
52generic-y += xor.h 51generic-y += xor.h
53generic-y += preempt.h 52generic-y += preempt.h
53generic-y += hash.h
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 3914c0dcd09c..56166d7f4a25 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -158,17 +158,23 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
158 return ret; 158 return ret;
159} 159}
160 160
161#define cmpxchg(ptr,o,n) \ 161#define cmpxchg(ptr, o, n) \
162 ((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \ 162({ \
163 (unsigned long)(o), \ 163 __typeof__(*(ptr)) __ret; \
164 (unsigned long)(n), \ 164 __ret = (__typeof__(*(ptr))) \
165 sizeof(*(ptr)))) 165 __cmpxchg_mb((ptr), (unsigned long)(o), (unsigned long)(n), \
166 166 sizeof(*(ptr))); \
167#define cmpxchg_local(ptr,o,n) \ 167 __ret; \
168 ((__typeof__(*(ptr)))__cmpxchg((ptr), \ 168})
169 (unsigned long)(o), \ 169
170 (unsigned long)(n), \ 170#define cmpxchg_local(ptr, o, n) \
171 sizeof(*(ptr)))) 171({ \
172 __typeof__(*(ptr)) __ret; \
173 __ret = (__typeof__(*(ptr))) \
174 __cmpxchg((ptr), (unsigned long)(o), \
175 (unsigned long)(n), sizeof(*(ptr))); \
176 __ret; \
177})
172 178
173#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) 179#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
174#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) 180#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n))
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h
index c4cdb5e5b73d..152413076503 100644
--- a/arch/arm64/include/asm/cpu_ops.h
+++ b/arch/arm64/include/asm/cpu_ops.h
@@ -39,6 +39,9 @@ struct device_node;
39 * from the cpu to be killed. 39 * from the cpu to be killed.
40 * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the 40 * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the
41 * cpu being killed. 41 * cpu being killed.
42 * @cpu_suspend: Suspends a cpu and saves the required context. May fail owing
43 * to wrong parameters or error conditions. Called from the
44 * CPU being suspended. Must be called with IRQs disabled.
42 */ 45 */
43struct cpu_operations { 46struct cpu_operations {
44 const char *name; 47 const char *name;
@@ -50,6 +53,9 @@ struct cpu_operations {
50 int (*cpu_disable)(unsigned int cpu); 53 int (*cpu_disable)(unsigned int cpu);
51 void (*cpu_die)(unsigned int cpu); 54 void (*cpu_die)(unsigned int cpu);
52#endif 55#endif
56#ifdef CONFIG_ARM64_CPU_SUSPEND
57 int (*cpu_suspend)(unsigned long);
58#endif
53}; 59};
54 60
55extern const struct cpu_operations *cpu_ops[NR_CPUS]; 61extern const struct cpu_operations *cpu_ops[NR_CPUS];
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index 5fe138e0b828..c404fb0df3a6 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -16,23 +16,23 @@
16#ifndef __ASM_CPUTYPE_H 16#ifndef __ASM_CPUTYPE_H
17#define __ASM_CPUTYPE_H 17#define __ASM_CPUTYPE_H
18 18
19#define ID_MIDR_EL1 "midr_el1"
20#define ID_MPIDR_EL1 "mpidr_el1"
21#define ID_CTR_EL0 "ctr_el0"
22
23#define ID_AA64PFR0_EL1 "id_aa64pfr0_el1"
24#define ID_AA64DFR0_EL1 "id_aa64dfr0_el1"
25#define ID_AA64AFR0_EL1 "id_aa64afr0_el1"
26#define ID_AA64ISAR0_EL1 "id_aa64isar0_el1"
27#define ID_AA64MMFR0_EL1 "id_aa64mmfr0_el1"
28
29#define INVALID_HWID ULONG_MAX 19#define INVALID_HWID ULONG_MAX
30 20
31#define MPIDR_HWID_BITMASK 0xff00ffffff 21#define MPIDR_HWID_BITMASK 0xff00ffffff
32 22
23#define MPIDR_LEVEL_BITS_SHIFT 3
24#define MPIDR_LEVEL_BITS (1 << MPIDR_LEVEL_BITS_SHIFT)
25#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1)
26
27#define MPIDR_LEVEL_SHIFT(level) \
28 (((1 << level) >> 1) << MPIDR_LEVEL_BITS_SHIFT)
29
30#define MPIDR_AFFINITY_LEVEL(mpidr, level) \
31 ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)
32
33#define read_cpuid(reg) ({ \ 33#define read_cpuid(reg) ({ \
34 u64 __val; \ 34 u64 __val; \
35 asm("mrs %0, " reg : "=r" (__val)); \ 35 asm("mrs %0, " #reg : "=r" (__val)); \
36 __val; \ 36 __val; \
37}) 37})
38 38
@@ -54,12 +54,12 @@
54 */ 54 */
55static inline u32 __attribute_const__ read_cpuid_id(void) 55static inline u32 __attribute_const__ read_cpuid_id(void)
56{ 56{
57 return read_cpuid(ID_MIDR_EL1); 57 return read_cpuid(MIDR_EL1);
58} 58}
59 59
60static inline u64 __attribute_const__ read_cpuid_mpidr(void) 60static inline u64 __attribute_const__ read_cpuid_mpidr(void)
61{ 61{
62 return read_cpuid(ID_MPIDR_EL1); 62 return read_cpuid(MPIDR_EL1);
63} 63}
64 64
65static inline unsigned int __attribute_const__ read_cpuid_implementor(void) 65static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
@@ -74,7 +74,7 @@ static inline unsigned int __attribute_const__ read_cpuid_part_number(void)
74 74
75static inline u32 __attribute_const__ read_cpuid_cachetype(void) 75static inline u32 __attribute_const__ read_cpuid_cachetype(void)
76{ 76{
77 return read_cpuid(ID_CTR_EL0); 77 return read_cpuid(CTR_EL0);
78} 78}
79 79
80#endif /* __ASSEMBLY__ */ 80#endif /* __ASSEMBLY__ */
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index a2232d07be9d..62314791570c 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -62,6 +62,27 @@ struct task_struct;
62 62
63#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */ 63#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
64 64
65#define DBG_HOOK_HANDLED 0
66#define DBG_HOOK_ERROR 1
67
68struct step_hook {
69 struct list_head node;
70 int (*fn)(struct pt_regs *regs, unsigned int esr);
71};
72
73void register_step_hook(struct step_hook *hook);
74void unregister_step_hook(struct step_hook *hook);
75
76struct break_hook {
77 struct list_head node;
78 u32 esr_val;
79 u32 esr_mask;
80 int (*fn)(struct pt_regs *regs, unsigned int esr);
81};
82
83void register_break_hook(struct break_hook *hook);
84void unregister_break_hook(struct break_hook *hook);
85
65u8 debug_monitors_arch(void); 86u8 debug_monitors_arch(void);
66 87
67void enable_debug_monitors(enum debug_el el); 88void enable_debug_monitors(enum debug_el el);
diff --git a/arch/arm64/include/asm/dma-contiguous.h b/arch/arm64/include/asm/dma-contiguous.h
new file mode 100644
index 000000000000..14c4c0ca7f2a
--- /dev/null
+++ b/arch/arm64/include/asm/dma-contiguous.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _ASM_DMA_CONTIGUOUS_H
15#define _ASM_DMA_CONTIGUOUS_H
16
17#ifdef __KERNEL__
18#ifdef CONFIG_DMA_CMA
19
20#include <linux/types.h>
21
22static inline void
23dma_contiguous_early_fixup(phys_addr_t base, unsigned long size) { }
24
25#endif
26#endif
27
28#endif
diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h
index c582fa316366..78cc3aba5d69 100644
--- a/arch/arm64/include/asm/futex.h
+++ b/arch/arm64/include/asm/futex.h
@@ -30,6 +30,7 @@
30" cbnz %w3, 1b\n" \ 30" cbnz %w3, 1b\n" \
31"3:\n" \ 31"3:\n" \
32" .pushsection .fixup,\"ax\"\n" \ 32" .pushsection .fixup,\"ax\"\n" \
33" .align 2\n" \
33"4: mov %w0, %w5\n" \ 34"4: mov %w0, %w5\n" \
34" b 3b\n" \ 35" b 3b\n" \
35" .popsection\n" \ 36" .popsection\n" \
diff --git a/arch/arm64/include/asm/hardirq.h b/arch/arm64/include/asm/hardirq.h
index 990c051e7829..ae4801d77514 100644
--- a/arch/arm64/include/asm/hardirq.h
+++ b/arch/arm64/include/asm/hardirq.h
@@ -20,7 +20,7 @@
20#include <linux/threads.h> 20#include <linux/threads.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22 22
23#define NR_IPI 4 23#define NR_IPI 5
24 24
25typedef struct { 25typedef struct {
26 unsigned int __softirq_pending; 26 unsigned int __softirq_pending;
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
new file mode 100644
index 000000000000..c44ad39ed310
--- /dev/null
+++ b/arch/arm64/include/asm/insn.h
@@ -0,0 +1,108 @@
1/*
2 * Copyright (C) 2013 Huawei Ltd.
3 * Author: Jiang Liu <liuj97@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * 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#ifndef __ASM_INSN_H
18#define __ASM_INSN_H
19#include <linux/types.h>
20
21/* A64 instructions are always 32 bits. */
22#define AARCH64_INSN_SIZE 4
23
24/*
25 * ARM Architecture Reference Manual for ARMv8 Profile-A, Issue A.a
26 * Section C3.1 "A64 instruction index by encoding":
27 * AArch64 main encoding table
28 * Bit position
29 * 28 27 26 25 Encoding Group
30 * 0 0 - - Unallocated
31 * 1 0 0 - Data processing, immediate
32 * 1 0 1 - Branch, exception generation and system instructions
33 * - 1 - 0 Loads and stores
34 * - 1 0 1 Data processing - register
35 * 0 1 1 1 Data processing - SIMD and floating point
36 * 1 1 1 1 Data processing - SIMD and floating point
37 * "-" means "don't care"
38 */
39enum aarch64_insn_encoding_class {
40 AARCH64_INSN_CLS_UNKNOWN, /* UNALLOCATED */
41 AARCH64_INSN_CLS_DP_IMM, /* Data processing - immediate */
42 AARCH64_INSN_CLS_DP_REG, /* Data processing - register */
43 AARCH64_INSN_CLS_DP_FPSIMD, /* Data processing - SIMD and FP */
44 AARCH64_INSN_CLS_LDST, /* Loads and stores */
45 AARCH64_INSN_CLS_BR_SYS, /* Branch, exception generation and
46 * system instructions */
47};
48
49enum aarch64_insn_hint_op {
50 AARCH64_INSN_HINT_NOP = 0x0 << 5,
51 AARCH64_INSN_HINT_YIELD = 0x1 << 5,
52 AARCH64_INSN_HINT_WFE = 0x2 << 5,
53 AARCH64_INSN_HINT_WFI = 0x3 << 5,
54 AARCH64_INSN_HINT_SEV = 0x4 << 5,
55 AARCH64_INSN_HINT_SEVL = 0x5 << 5,
56};
57
58enum aarch64_insn_imm_type {
59 AARCH64_INSN_IMM_ADR,
60 AARCH64_INSN_IMM_26,
61 AARCH64_INSN_IMM_19,
62 AARCH64_INSN_IMM_16,
63 AARCH64_INSN_IMM_14,
64 AARCH64_INSN_IMM_12,
65 AARCH64_INSN_IMM_9,
66 AARCH64_INSN_IMM_MAX
67};
68
69enum aarch64_insn_branch_type {
70 AARCH64_INSN_BRANCH_NOLINK,
71 AARCH64_INSN_BRANCH_LINK,
72};
73
74#define __AARCH64_INSN_FUNCS(abbr, mask, val) \
75static __always_inline bool aarch64_insn_is_##abbr(u32 code) \
76{ return (code & (mask)) == (val); } \
77static __always_inline u32 aarch64_insn_get_##abbr##_value(void) \
78{ return (val); }
79
80__AARCH64_INSN_FUNCS(b, 0xFC000000, 0x14000000)
81__AARCH64_INSN_FUNCS(bl, 0xFC000000, 0x94000000)
82__AARCH64_INSN_FUNCS(svc, 0xFFE0001F, 0xD4000001)
83__AARCH64_INSN_FUNCS(hvc, 0xFFE0001F, 0xD4000002)
84__AARCH64_INSN_FUNCS(smc, 0xFFE0001F, 0xD4000003)
85__AARCH64_INSN_FUNCS(brk, 0xFFE0001F, 0xD4200000)
86__AARCH64_INSN_FUNCS(hint, 0xFFFFF01F, 0xD503201F)
87
88#undef __AARCH64_INSN_FUNCS
89
90bool aarch64_insn_is_nop(u32 insn);
91
92int aarch64_insn_read(void *addr, u32 *insnp);
93int aarch64_insn_write(void *addr, u32 insn);
94enum aarch64_insn_encoding_class aarch64_get_insn_class(u32 insn);
95u32 aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
96 u32 insn, u64 imm);
97u32 aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr,
98 enum aarch64_insn_branch_type type);
99u32 aarch64_insn_gen_hint(enum aarch64_insn_hint_op op);
100u32 aarch64_insn_gen_nop(void);
101
102bool aarch64_insn_hotpatch_safe(u32 old_insn, u32 new_insn);
103
104int aarch64_insn_patch_text_nosync(void *addr, u32 insn);
105int aarch64_insn_patch_text_sync(void *addrs[], u32 insns[], int cnt);
106int aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt);
107
108#endif /* __ASM_INSN_H */
diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h
new file mode 100644
index 000000000000..076a1c714049
--- /dev/null
+++ b/arch/arm64/include/asm/jump_label.h
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2013 Huawei Ltd.
3 * Author: Jiang Liu <liuj97@gmail.com>
4 *
5 * Based on arch/arm/include/asm/jump_label.h
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef __ASM_JUMP_LABEL_H
20#define __ASM_JUMP_LABEL_H
21#include <linux/types.h>
22#include <asm/insn.h>
23
24#ifdef __KERNEL__
25
26#define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE
27
28static __always_inline bool arch_static_branch(struct static_key *key)
29{
30 asm goto("1: nop\n\t"
31 ".pushsection __jump_table, \"aw\"\n\t"
32 ".align 3\n\t"
33 ".quad 1b, %l[l_yes], %c0\n\t"
34 ".popsection\n\t"
35 : : "i"(key) : : l_yes);
36
37 return false;
38l_yes:
39 return true;
40}
41
42#endif /* __KERNEL__ */
43
44typedef u64 jump_label_t;
45
46struct jump_entry {
47 jump_label_t code;
48 jump_label_t target;
49 jump_label_t key;
50};
51
52#endif /* __ASM_JUMP_LABEL_H */
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 5d85a02d1231..0a1d69751562 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -26,7 +26,12 @@
26#include <asm/kvm_asm.h> 26#include <asm/kvm_asm.h>
27#include <asm/kvm_mmio.h> 27#include <asm/kvm_mmio.h>
28 28
29#define KVM_MAX_VCPUS 4 29#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
30#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
31#else
32#define KVM_MAX_VCPUS 0
33#endif
34
30#define KVM_USER_MEM_SLOTS 32 35#define KVM_USER_MEM_SLOTS 32
31#define KVM_PRIVATE_MEM_SLOTS 4 36#define KVM_PRIVATE_MEM_SLOTS 4
32#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 37#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index 680f74e67497..7f1f9408ff66 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -136,6 +136,7 @@ static inline void coherent_icache_guest_page(struct kvm *kvm, hva_t hva,
136} 136}
137 137
138#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l)) 138#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l))
139#define kvm_virt_to_phys(x) __virt_to_phys((unsigned long)(x))
139 140
140#endif /* __ASSEMBLY__ */ 141#endif /* __ASSEMBLY__ */
141#endif /* __ARM64_KVM_MMU_H__ */ 142#endif /* __ARM64_KVM_MMU_H__ */
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 37762175896f..9dc5dc39fded 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -146,8 +146,7 @@ static inline void *phys_to_virt(phys_addr_t x)
146#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 146#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
147 147
148#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 148#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
149#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ 149#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
150 ((void *)(kaddr) < (void *)high_memory))
151 150
152#endif 151#endif
153 152
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h
new file mode 100644
index 000000000000..13fb0b3efc5f
--- /dev/null
+++ b/arch/arm64/include/asm/percpu.h
@@ -0,0 +1,41 @@
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_PERCPU_H
17#define __ASM_PERCPU_H
18
19static inline void set_my_cpu_offset(unsigned long off)
20{
21 asm volatile("msr tpidr_el1, %0" :: "r" (off) : "memory");
22}
23
24static inline unsigned long __my_cpu_offset(void)
25{
26 unsigned long off;
27 register unsigned long *sp asm ("sp");
28
29 /*
30 * We want to allow caching the value, so avoid using volatile and
31 * instead use a fake stack read to hazard against barrier().
32 */
33 asm("mrs %0, tpidr_el1" : "=r" (off) : "Q" (*sp));
34
35 return off;
36}
37#define __my_cpu_offset __my_cpu_offset()
38
39#include <asm-generic/percpu.h>
40
41#endif /* __ASM_PERCPU_H */
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 7f2b60affbb4..b524dcd17243 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -28,7 +28,7 @@
28#define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */ 28#define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */
29#define PTE_DIRTY (_AT(pteval_t, 1) << 55) 29#define PTE_DIRTY (_AT(pteval_t, 1) << 55)
30#define PTE_SPECIAL (_AT(pteval_t, 1) << 56) 30#define PTE_SPECIAL (_AT(pteval_t, 1) << 56)
31 /* bit 57 for PMD_SECT_SPLITTING */ 31#define PTE_WRITE (_AT(pteval_t, 1) << 57)
32#define PTE_PROT_NONE (_AT(pteval_t, 1) << 58) /* only when !PTE_VALID */ 32#define PTE_PROT_NONE (_AT(pteval_t, 1) << 58) /* only when !PTE_VALID */
33 33
34/* 34/*
@@ -67,15 +67,15 @@ extern pgprot_t pgprot_default;
67 67
68#define _MOD_PROT(p, b) __pgprot_modify(p, 0, b) 68#define _MOD_PROT(p, b) __pgprot_modify(p, 0, b)
69 69
70#define PAGE_NONE __pgprot_modify(pgprot_default, PTE_TYPE_MASK, PTE_PROT_NONE | PTE_RDONLY | PTE_PXN | PTE_UXN) 70#define PAGE_NONE __pgprot_modify(pgprot_default, PTE_TYPE_MASK, PTE_PROT_NONE | PTE_PXN | PTE_UXN)
71#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) 71#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE)
72#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN) 72#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_WRITE)
73#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 73#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
74#define PAGE_COPY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY) 74#define PAGE_COPY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN)
75#define PAGE_READONLY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 75#define PAGE_READONLY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
76#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY) 76#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN)
77#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY) 77#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE)
78#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY) 78#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY | PTE_WRITE)
79 79
80#define PAGE_HYP _MOD_PROT(pgprot_default, PTE_HYP) 80#define PAGE_HYP _MOD_PROT(pgprot_default, PTE_HYP)
81#define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP) 81#define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP)
@@ -83,13 +83,13 @@ extern pgprot_t pgprot_default;
83#define PAGE_S2 __pgprot_modify(pgprot_default, PTE_S2_MEMATTR_MASK, PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY) 83#define PAGE_S2 __pgprot_modify(pgprot_default, PTE_S2_MEMATTR_MASK, PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY)
84#define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDWR | PTE_UXN) 84#define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDWR | PTE_UXN)
85 85
86#define __PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_RDONLY | PTE_PXN | PTE_UXN) 86#define __PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_PXN | PTE_UXN)
87#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) 87#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE)
88#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN) 88#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_WRITE)
89#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 89#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
90#define __PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY) 90#define __PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
91#define __PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 91#define __PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
92#define __PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY) 92#define __PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
93 93
94#endif /* __ASSEMBLY__ */ 94#endif /* __ASSEMBLY__ */
95 95
@@ -140,22 +140,53 @@ extern struct page *empty_zero_page;
140#define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY) 140#define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY)
141#define pte_young(pte) (pte_val(pte) & PTE_AF) 141#define pte_young(pte) (pte_val(pte) & PTE_AF)
142#define pte_special(pte) (pte_val(pte) & PTE_SPECIAL) 142#define pte_special(pte) (pte_val(pte) & PTE_SPECIAL)
143#define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY)) 143#define pte_write(pte) (pte_val(pte) & PTE_WRITE)
144#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN)) 144#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
145 145
146#define pte_valid_user(pte) \ 146#define pte_valid_user(pte) \
147 ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) 147 ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
148 148
149#define PTE_BIT_FUNC(fn,op) \ 149static inline pte_t pte_wrprotect(pte_t pte)
150static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } 150{
151 pte_val(pte) &= ~PTE_WRITE;
152 return pte;
153}
154
155static inline pte_t pte_mkwrite(pte_t pte)
156{
157 pte_val(pte) |= PTE_WRITE;
158 return pte;
159}
160
161static inline pte_t pte_mkclean(pte_t pte)
162{
163 pte_val(pte) &= ~PTE_DIRTY;
164 return pte;
165}
166
167static inline pte_t pte_mkdirty(pte_t pte)
168{
169 pte_val(pte) |= PTE_DIRTY;
170 return pte;
171}
151 172
152PTE_BIT_FUNC(wrprotect, |= PTE_RDONLY); 173static inline pte_t pte_mkold(pte_t pte)
153PTE_BIT_FUNC(mkwrite, &= ~PTE_RDONLY); 174{
154PTE_BIT_FUNC(mkclean, &= ~PTE_DIRTY); 175 pte_val(pte) &= ~PTE_AF;
155PTE_BIT_FUNC(mkdirty, |= PTE_DIRTY); 176 return pte;
156PTE_BIT_FUNC(mkold, &= ~PTE_AF); 177}
157PTE_BIT_FUNC(mkyoung, |= PTE_AF); 178
158PTE_BIT_FUNC(mkspecial, |= PTE_SPECIAL); 179static inline pte_t pte_mkyoung(pte_t pte)
180{
181 pte_val(pte) |= PTE_AF;
182 return pte;
183}
184
185static inline pte_t pte_mkspecial(pte_t pte)
186{
187 pte_val(pte) |= PTE_SPECIAL;
188 return pte;
189}
159 190
160static inline void set_pte(pte_t *ptep, pte_t pte) 191static inline void set_pte(pte_t *ptep, pte_t pte)
161{ 192{
@@ -170,8 +201,10 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
170 if (pte_valid_user(pte)) { 201 if (pte_valid_user(pte)) {
171 if (pte_exec(pte)) 202 if (pte_exec(pte))
172 __sync_icache_dcache(pte, addr); 203 __sync_icache_dcache(pte, addr);
173 if (!pte_dirty(pte)) 204 if (pte_dirty(pte) && pte_write(pte))
174 pte = pte_wrprotect(pte); 205 pte_val(pte) &= ~PTE_RDONLY;
206 else
207 pte_val(pte) |= PTE_RDONLY;
175 } 208 }
176 209
177 set_pte(ptep, pte); 210 set_pte(ptep, pte);
@@ -345,7 +378,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
345static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 378static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
346{ 379{
347 const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | 380 const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY |
348 PTE_PROT_NONE | PTE_VALID; 381 PTE_PROT_NONE | PTE_VALID | PTE_WRITE;
349 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 382 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
350 return pte; 383 return pte;
351} 384}
diff --git a/arch/arm64/include/asm/proc-fns.h b/arch/arm64/include/asm/proc-fns.h
index 7cdf466fd0c5..0c657bb54597 100644
--- a/arch/arm64/include/asm/proc-fns.h
+++ b/arch/arm64/include/asm/proc-fns.h
@@ -26,11 +26,14 @@
26#include <asm/page.h> 26#include <asm/page.h>
27 27
28struct mm_struct; 28struct mm_struct;
29struct cpu_suspend_ctx;
29 30
30extern void cpu_cache_off(void); 31extern void cpu_cache_off(void);
31extern void cpu_do_idle(void); 32extern void cpu_do_idle(void);
32extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm); 33extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
33extern void cpu_reset(unsigned long addr) __attribute__((noreturn)); 34extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
35extern void cpu_do_suspend(struct cpu_suspend_ctx *ptr);
36extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr);
34 37
35#include <asm/memory.h> 38#include <asm/memory.h>
36 39
diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h
index ed43a0d2b1b2..59e282311b58 100644
--- a/arch/arm64/include/asm/smp_plat.h
+++ b/arch/arm64/include/asm/smp_plat.h
@@ -21,6 +21,19 @@
21 21
22#include <asm/types.h> 22#include <asm/types.h>
23 23
24struct mpidr_hash {
25 u64 mask;
26 u32 shift_aff[4];
27 u32 bits;
28};
29
30extern struct mpidr_hash mpidr_hash;
31
32static inline u32 mpidr_hash_size(void)
33{
34 return 1 << mpidr_hash.bits;
35}
36
24/* 37/*
25 * Logical CPU mapping. 38 * Logical CPU mapping.
26 */ 39 */
diff --git a/arch/arm64/include/asm/suspend.h b/arch/arm64/include/asm/suspend.h
new file mode 100644
index 000000000000..e9c149c042e0
--- /dev/null
+++ b/arch/arm64/include/asm/suspend.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_SUSPEND_H
2#define __ASM_SUSPEND_H
3
4#define NR_CTX_REGS 11
5
6/*
7 * struct cpu_suspend_ctx must be 16-byte aligned since it is allocated on
8 * the stack, which must be 16-byte aligned on v8
9 */
10struct cpu_suspend_ctx {
11 /*
12 * This struct must be kept in sync with
13 * cpu_do_{suspend/resume} in mm/proc.S
14 */
15 u64 ctx_regs[NR_CTX_REGS];
16 u64 sp;
17} __aligned(16);
18
19struct sleep_save_sp {
20 phys_addr_t *save_ptr_stash;
21 phys_addr_t save_ptr_stash_phys;
22};
23
24extern void cpu_resume(void);
25extern int cpu_suspend(unsigned long);
26
27#endif
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index 7ecc2b23882e..6c0f684aca81 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -100,6 +100,7 @@ static inline void set_fs(mm_segment_t fs)
100}) 100})
101 101
102#define access_ok(type, addr, size) __range_ok(addr, size) 102#define access_ok(type, addr, size) __range_ok(addr, size)
103#define user_addr_max get_fs
103 104
104/* 105/*
105 * The "__xxx" versions of the user access functions do not verify the address 106 * The "__xxx" versions of the user access functions do not verify the address
@@ -240,9 +241,6 @@ extern unsigned long __must_check __copy_to_user(void __user *to, const void *fr
240extern unsigned long __must_check __copy_in_user(void __user *to, const void __user *from, unsigned long n); 241extern unsigned long __must_check __copy_in_user(void __user *to, const void __user *from, unsigned long n);
241extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n); 242extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n);
242 243
243extern unsigned long __must_check __strncpy_from_user(char *to, const char __user *from, unsigned long count);
244extern unsigned long __must_check __strnlen_user(const char __user *s, long n);
245
246static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n) 244static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
247{ 245{
248 if (access_ok(VERIFY_READ, from, n)) 246 if (access_ok(VERIFY_READ, from, n))
@@ -276,24 +274,9 @@ static inline unsigned long __must_check clear_user(void __user *to, unsigned lo
276 return n; 274 return n;
277} 275}
278 276
279static inline long __must_check strncpy_from_user(char *dst, const char __user *src, long count) 277extern long strncpy_from_user(char *dest, const char __user *src, long count);
280{
281 long res = -EFAULT;
282 if (access_ok(VERIFY_READ, src, 1))
283 res = __strncpy_from_user(dst, src, count);
284 return res;
285}
286
287#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
288 278
289static inline long __must_check strnlen_user(const char __user *s, long n) 279extern __must_check long strlen_user(const char __user *str);
290{ 280extern __must_check long strnlen_user(const char __user *str, long n);
291 unsigned long res = 0;
292
293 if (__addr_ok(s))
294 res = __strnlen_user(s, n);
295
296 return res;
297}
298 281
299#endif /* __ASM_UACCESS_H */ 282#endif /* __ASM_UACCESS_H */
diff --git a/arch/arm64/include/asm/word-at-a-time.h b/arch/arm64/include/asm/word-at-a-time.h
new file mode 100644
index 000000000000..aab5bf09e9d9
--- /dev/null
+++ b/arch/arm64/include/asm/word-at-a-time.h
@@ -0,0 +1,94 @@
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_WORD_AT_A_TIME_H
17#define __ASM_WORD_AT_A_TIME_H
18
19#ifndef __AARCH64EB__
20
21#include <linux/kernel.h>
22
23struct word_at_a_time {
24 const unsigned long one_bits, high_bits;
25};
26
27#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) }
28
29static inline unsigned long has_zero(unsigned long a, unsigned long *bits,
30 const struct word_at_a_time *c)
31{
32 unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits;
33 *bits = mask;
34 return mask;
35}
36
37#define prep_zero_mask(a, bits, c) (bits)
38
39static inline unsigned long create_zero_mask(unsigned long bits)
40{
41 bits = (bits - 1) & ~bits;
42 return bits >> 7;
43}
44
45static inline unsigned long find_zero(unsigned long mask)
46{
47 return fls64(mask) >> 3;
48}
49
50#define zero_bytemask(mask) (mask)
51
52#else /* __AARCH64EB__ */
53#include <asm-generic/word-at-a-time.h>
54#endif
55
56/*
57 * Load an unaligned word from kernel space.
58 *
59 * In the (very unlikely) case of the word being a page-crosser
60 * and the next page not being mapped, take the exception and
61 * return zeroes in the non-existing part.
62 */
63static inline unsigned long load_unaligned_zeropad(const void *addr)
64{
65 unsigned long ret, offset;
66
67 /* Load word from unaligned pointer addr */
68 asm(
69 "1: ldr %0, %3\n"
70 "2:\n"
71 " .pushsection .fixup,\"ax\"\n"
72 " .align 2\n"
73 "3: and %1, %2, #0x7\n"
74 " bic %2, %2, #0x7\n"
75 " ldr %0, [%2]\n"
76 " lsl %1, %1, #0x3\n"
77#ifndef __AARCH64EB__
78 " lsr %0, %0, %1\n"
79#else
80 " lsl %0, %0, %1\n"
81#endif
82 " b 2b\n"
83 " .popsection\n"
84 " .pushsection __ex_table,\"a\"\n"
85 " .align 3\n"
86 " .quad 1b, 3b\n"
87 " .popsection"
88 : "=&r" (ret), "=&r" (offset)
89 : "r" (addr), "Q" (*(unsigned long *)addr));
90
91 return ret;
92}
93
94#endif /* __ASM_WORD_AT_A_TIME_H */
diff --git a/arch/arm64/include/uapi/asm/hwcap.h b/arch/arm64/include/uapi/asm/hwcap.h
index 9b12476e9c85..73cf0f54d57c 100644
--- a/arch/arm64/include/uapi/asm/hwcap.h
+++ b/arch/arm64/include/uapi/asm/hwcap.h
@@ -22,6 +22,10 @@
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#define HWCAP_EVTSTRM (1 << 2)
25 25#define HWCAP_AES (1 << 3)
26#define HWCAP_PMULL (1 << 4)
27#define HWCAP_SHA1 (1 << 5)
28#define HWCAP_SHA2 (1 << 6)
29#define HWCAP_CRC32 (1 << 7)
26 30
27#endif /* _UAPI__ASM_HWCAP_H */ 31#endif /* _UAPI__ASM_HWCAP_H */
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index 5031f4263937..495ab6f84a61 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -55,8 +55,9 @@ struct kvm_regs {
55#define KVM_ARM_TARGET_AEM_V8 0 55#define KVM_ARM_TARGET_AEM_V8 0
56#define KVM_ARM_TARGET_FOUNDATION_V8 1 56#define KVM_ARM_TARGET_FOUNDATION_V8 1
57#define KVM_ARM_TARGET_CORTEX_A57 2 57#define KVM_ARM_TARGET_CORTEX_A57 2
58#define KVM_ARM_TARGET_XGENE_POTENZA 3
58 59
59#define KVM_ARM_NUM_TARGETS 3 60#define KVM_ARM_NUM_TARGETS 4
60 61
61/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ 62/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
62#define KVM_ARM_DEVICE_TYPE_SHIFT 0 63#define KVM_ARM_DEVICE_TYPE_SHIFT 0
@@ -129,6 +130,24 @@ struct kvm_arch_memory_slot {
129#define KVM_REG_ARM64_SYSREG_OP2_MASK 0x0000000000000007 130#define KVM_REG_ARM64_SYSREG_OP2_MASK 0x0000000000000007
130#define KVM_REG_ARM64_SYSREG_OP2_SHIFT 0 131#define KVM_REG_ARM64_SYSREG_OP2_SHIFT 0
131 132
133#define ARM64_SYS_REG_SHIFT_MASK(x,n) \
134 (((x) << KVM_REG_ARM64_SYSREG_ ## n ## _SHIFT) & \
135 KVM_REG_ARM64_SYSREG_ ## n ## _MASK)
136
137#define __ARM64_SYS_REG(op0,op1,crn,crm,op2) \
138 (KVM_REG_ARM64 | KVM_REG_ARM64_SYSREG | \
139 ARM64_SYS_REG_SHIFT_MASK(op0, OP0) | \
140 ARM64_SYS_REG_SHIFT_MASK(op1, OP1) | \
141 ARM64_SYS_REG_SHIFT_MASK(crn, CRN) | \
142 ARM64_SYS_REG_SHIFT_MASK(crm, CRM) | \
143 ARM64_SYS_REG_SHIFT_MASK(op2, OP2))
144
145#define ARM64_SYS_REG(...) (__ARM64_SYS_REG(__VA_ARGS__) | KVM_REG_SIZE_U64)
146
147#define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1)
148#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
149#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
150
132/* KVM_IRQ_LINE irq field index values */ 151/* KVM_IRQ_LINE irq field index values */
133#define KVM_ARM_IRQ_TYPE_SHIFT 24 152#define KVM_ARM_IRQ_TYPE_SHIFT 24
134#define KVM_ARM_IRQ_TYPE_MASK 0xff 153#define KVM_ARM_IRQ_TYPE_MASK 0xff
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 5ba2fd43a75b..2d4554b13410 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -9,7 +9,7 @@ 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 cpu_ops.o 12 hyp-stub.o psci.o cpu_ops.o insn.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
@@ -18,6 +18,8 @@ arm64-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
21arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o
22arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o
21 23
22obj-y += $(arm64-obj-y) vdso/ 24obj-y += $(arm64-obj-y) vdso/
23obj-m += $(arm64-obj-m) 25obj-m += $(arm64-obj-m)
diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c
index e7ee770c0697..338b568cd8ae 100644
--- a/arch/arm64/kernel/arm64ksyms.c
+++ b/arch/arm64/kernel/arm64ksyms.c
@@ -29,13 +29,10 @@
29 29
30#include <asm/checksum.h> 30#include <asm/checksum.h>
31 31
32 /* user mem (segment) */
33EXPORT_SYMBOL(__strnlen_user);
34EXPORT_SYMBOL(__strncpy_from_user);
35
36EXPORT_SYMBOL(copy_page); 32EXPORT_SYMBOL(copy_page);
37EXPORT_SYMBOL(clear_page); 33EXPORT_SYMBOL(clear_page);
38 34
35 /* user mem (segment) */
39EXPORT_SYMBOL(__copy_from_user); 36EXPORT_SYMBOL(__copy_from_user);
40EXPORT_SYMBOL(__copy_to_user); 37EXPORT_SYMBOL(__copy_to_user);
41EXPORT_SYMBOL(__clear_user); 38EXPORT_SYMBOL(__clear_user);
diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
index 666e231d410b..646f888387cd 100644
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -25,6 +25,8 @@
25#include <asm/thread_info.h> 25#include <asm/thread_info.h>
26#include <asm/memory.h> 26#include <asm/memory.h>
27#include <asm/cputable.h> 27#include <asm/cputable.h>
28#include <asm/smp_plat.h>
29#include <asm/suspend.h>
28#include <asm/vdso_datapage.h> 30#include <asm/vdso_datapage.h>
29#include <linux/kbuild.h> 31#include <linux/kbuild.h>
30 32
@@ -138,5 +140,14 @@ int main(void)
138 DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr)); 140 DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr));
139 DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base)); 141 DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base));
140#endif 142#endif
143#ifdef CONFIG_ARM64_CPU_SUSPEND
144 DEFINE(CPU_SUSPEND_SZ, sizeof(struct cpu_suspend_ctx));
145 DEFINE(CPU_CTX_SP, offsetof(struct cpu_suspend_ctx, sp));
146 DEFINE(MPIDR_HASH_MASK, offsetof(struct mpidr_hash, mask));
147 DEFINE(MPIDR_HASH_SHIFTS, offsetof(struct mpidr_hash, shift_aff));
148 DEFINE(SLEEP_SAVE_SP_SZ, sizeof(struct sleep_save_sp));
149 DEFINE(SLEEP_SAVE_SP_PHYS, offsetof(struct sleep_save_sp, save_ptr_stash_phys));
150 DEFINE(SLEEP_SAVE_SP_VIRT, offsetof(struct sleep_save_sp, save_ptr_stash));
151#endif
141 return 0; 152 return 0;
142} 153}
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 4ae68579031d..636ba8b6240b 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -187,6 +187,48 @@ static void clear_regs_spsr_ss(struct pt_regs *regs)
187 regs->pstate = spsr; 187 regs->pstate = spsr;
188} 188}
189 189
190/* EL1 Single Step Handler hooks */
191static LIST_HEAD(step_hook);
192DEFINE_RWLOCK(step_hook_lock);
193
194void register_step_hook(struct step_hook *hook)
195{
196 write_lock(&step_hook_lock);
197 list_add(&hook->node, &step_hook);
198 write_unlock(&step_hook_lock);
199}
200
201void unregister_step_hook(struct step_hook *hook)
202{
203 write_lock(&step_hook_lock);
204 list_del(&hook->node);
205 write_unlock(&step_hook_lock);
206}
207
208/*
209 * Call registered single step handers
210 * There is no Syndrome info to check for determining the handler.
211 * So we call all the registered handlers, until the right handler is
212 * found which returns zero.
213 */
214static int call_step_hook(struct pt_regs *regs, unsigned int esr)
215{
216 struct step_hook *hook;
217 int retval = DBG_HOOK_ERROR;
218
219 read_lock(&step_hook_lock);
220
221 list_for_each_entry(hook, &step_hook, node) {
222 retval = hook->fn(regs, esr);
223 if (retval == DBG_HOOK_HANDLED)
224 break;
225 }
226
227 read_unlock(&step_hook_lock);
228
229 return retval;
230}
231
190static int single_step_handler(unsigned long addr, unsigned int esr, 232static int single_step_handler(unsigned long addr, unsigned int esr,
191 struct pt_regs *regs) 233 struct pt_regs *regs)
192{ 234{
@@ -214,7 +256,9 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
214 */ 256 */
215 user_rewind_single_step(current); 257 user_rewind_single_step(current);
216 } else { 258 } else {
217 /* TODO: route to KGDB */ 259 if (call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
260 return 0;
261
218 pr_warning("Unexpected kernel single-step exception at EL1\n"); 262 pr_warning("Unexpected kernel single-step exception at EL1\n");
219 /* 263 /*
220 * Re-enable stepping since we know that we will be 264 * Re-enable stepping since we know that we will be
@@ -226,11 +270,53 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
226 return 0; 270 return 0;
227} 271}
228 272
273/*
274 * Breakpoint handler is re-entrant as another breakpoint can
275 * hit within breakpoint handler, especically in kprobes.
276 * Use reader/writer locks instead of plain spinlock.
277 */
278static LIST_HEAD(break_hook);
279DEFINE_RWLOCK(break_hook_lock);
280
281void register_break_hook(struct break_hook *hook)
282{
283 write_lock(&break_hook_lock);
284 list_add(&hook->node, &break_hook);
285 write_unlock(&break_hook_lock);
286}
287
288void unregister_break_hook(struct break_hook *hook)
289{
290 write_lock(&break_hook_lock);
291 list_del(&hook->node);
292 write_unlock(&break_hook_lock);
293}
294
295static int call_break_hook(struct pt_regs *regs, unsigned int esr)
296{
297 struct break_hook *hook;
298 int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL;
299
300 read_lock(&break_hook_lock);
301 list_for_each_entry(hook, &break_hook, node)
302 if ((esr & hook->esr_mask) == hook->esr_val)
303 fn = hook->fn;
304 read_unlock(&break_hook_lock);
305
306 return fn ? fn(regs, esr) : DBG_HOOK_ERROR;
307}
308
229static int brk_handler(unsigned long addr, unsigned int esr, 309static int brk_handler(unsigned long addr, unsigned int esr,
230 struct pt_regs *regs) 310 struct pt_regs *regs)
231{ 311{
232 siginfo_t info; 312 siginfo_t info;
233 313
314 if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED)
315 return 0;
316
317 pr_warn("unexpected brk exception at %lx, esr=0x%x\n",
318 (long)instruction_pointer(regs), esr);
319
234 if (!user_mode(regs)) 320 if (!user_mode(regs))
235 return -EFAULT; 321 return -EFAULT;
236 322
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 4d2c6f3f0c41..39ac630d83de 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -288,6 +288,8 @@ el1_dbg:
288 /* 288 /*
289 * Debug exception handling 289 * Debug exception handling
290 */ 290 */
291 cmp x24, #ESR_EL1_EC_BRK64 // if BRK64
292 cinc x24, x24, eq // set bit '0'
291 tbz x24, #0, el1_inv // EL1 only 293 tbz x24, #0, el1_inv // EL1 only
292 mrs x0, far_el1 294 mrs x0, far_el1
293 mov x2, sp // struct pt_regs 295 mov x2, sp // struct pt_regs
@@ -314,7 +316,7 @@ el1_irq:
314 316
315#ifdef CONFIG_PREEMPT 317#ifdef CONFIG_PREEMPT
316 get_thread_info tsk 318 get_thread_info tsk
317 ldr w24, [tsk, #TI_PREEMPT] // restore preempt count 319 ldr w24, [tsk, #TI_PREEMPT] // get preempt count
318 cbnz w24, 1f // preempt count != 0 320 cbnz w24, 1f // preempt count != 0
319 ldr x0, [tsk, #TI_FLAGS] // get flags 321 ldr x0, [tsk, #TI_FLAGS] // get flags
320 tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? 322 tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling?
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index bb785d23dbde..4aef42a04bdc 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -17,6 +17,7 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/cpu_pm.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/sched.h> 23#include <linux/sched.h>
@@ -113,6 +114,39 @@ EXPORT_SYMBOL(kernel_neon_end);
113 114
114#endif /* CONFIG_KERNEL_MODE_NEON */ 115#endif /* CONFIG_KERNEL_MODE_NEON */
115 116
117#ifdef CONFIG_CPU_PM
118static int fpsimd_cpu_pm_notifier(struct notifier_block *self,
119 unsigned long cmd, void *v)
120{
121 switch (cmd) {
122 case CPU_PM_ENTER:
123 if (current->mm)
124 fpsimd_save_state(&current->thread.fpsimd_state);
125 break;
126 case CPU_PM_EXIT:
127 if (current->mm)
128 fpsimd_load_state(&current->thread.fpsimd_state);
129 break;
130 case CPU_PM_ENTER_FAILED:
131 default:
132 return NOTIFY_DONE;
133 }
134 return NOTIFY_OK;
135}
136
137static struct notifier_block fpsimd_cpu_pm_notifier_block = {
138 .notifier_call = fpsimd_cpu_pm_notifier,
139};
140
141static void fpsimd_pm_init(void)
142{
143 cpu_pm_register_notifier(&fpsimd_cpu_pm_notifier_block);
144}
145
146#else
147static inline void fpsimd_pm_init(void) { }
148#endif /* CONFIG_CPU_PM */
149
116/* 150/*
117 * FP/SIMD support code initialisation. 151 * FP/SIMD support code initialisation.
118 */ 152 */
@@ -131,6 +165,8 @@ static int __init fpsimd_init(void)
131 else 165 else
132 elf_hwcap |= HWCAP_ASIMD; 166 elf_hwcap |= HWCAP_ASIMD;
133 167
168 fpsimd_pm_init();
169
134 return 0; 170 return 0;
135} 171}
136late_initcall(fpsimd_init); 172late_initcall(fpsimd_init);
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index c68cca5c3523..0b281fffda51 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -482,8 +482,6 @@ ENDPROC(__create_page_tables)
482 .type __switch_data, %object 482 .type __switch_data, %object
483__switch_data: 483__switch_data:
484 .quad __mmap_switched 484 .quad __mmap_switched
485 .quad __data_loc // x4
486 .quad _data // x5
487 .quad __bss_start // x6 485 .quad __bss_start // x6
488 .quad _end // x7 486 .quad _end // x7
489 .quad processor_id // x4 487 .quad processor_id // x4
@@ -498,15 +496,7 @@ __switch_data:
498__mmap_switched: 496__mmap_switched:
499 adr x3, __switch_data + 8 497 adr x3, __switch_data + 8
500 498
501 ldp x4, x5, [x3], #16
502 ldp x6, x7, [x3], #16 499 ldp x6, x7, [x3], #16
503 cmp x4, x5 // Copy data segment if needed
5041: ccmp x5, x6, #4, ne
505 b.eq 2f
506 ldr x16, [x4], #8
507 str x16, [x5], #8
508 b 1b
5092:
5101: cmp x6, x7 5001: cmp x6, x7
511 b.hs 2f 501 b.hs 2f
512 str xzr, [x6], #8 // Clear BSS 502 str xzr, [x6], #8 // Clear BSS
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index ff516f6691e4..f17f581116fc 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -20,6 +20,7 @@
20 20
21#define pr_fmt(fmt) "hw-breakpoint: " fmt 21#define pr_fmt(fmt) "hw-breakpoint: " fmt
22 22
23#include <linux/cpu_pm.h>
23#include <linux/errno.h> 24#include <linux/errno.h>
24#include <linux/hw_breakpoint.h> 25#include <linux/hw_breakpoint.h>
25#include <linux/perf_event.h> 26#include <linux/perf_event.h>
@@ -169,15 +170,68 @@ static enum debug_el debug_exception_level(int privilege)
169 } 170 }
170} 171}
171 172
172/* 173enum hw_breakpoint_ops {
173 * Install a perf counter breakpoint. 174 HW_BREAKPOINT_INSTALL,
175 HW_BREAKPOINT_UNINSTALL,
176 HW_BREAKPOINT_RESTORE
177};
178
179/**
180 * hw_breakpoint_slot_setup - Find and setup a perf slot according to
181 * operations
182 *
183 * @slots: pointer to array of slots
184 * @max_slots: max number of slots
185 * @bp: perf_event to setup
186 * @ops: operation to be carried out on the slot
187 *
188 * Return:
189 * slot index on success
190 * -ENOSPC if no slot is available/matches
191 * -EINVAL on wrong operations parameter
174 */ 192 */
175int arch_install_hw_breakpoint(struct perf_event *bp) 193static int hw_breakpoint_slot_setup(struct perf_event **slots, int max_slots,
194 struct perf_event *bp,
195 enum hw_breakpoint_ops ops)
196{
197 int i;
198 struct perf_event **slot;
199
200 for (i = 0; i < max_slots; ++i) {
201 slot = &slots[i];
202 switch (ops) {
203 case HW_BREAKPOINT_INSTALL:
204 if (!*slot) {
205 *slot = bp;
206 return i;
207 }
208 break;
209 case HW_BREAKPOINT_UNINSTALL:
210 if (*slot == bp) {
211 *slot = NULL;
212 return i;
213 }
214 break;
215 case HW_BREAKPOINT_RESTORE:
216 if (*slot == bp)
217 return i;
218 break;
219 default:
220 pr_warn_once("Unhandled hw breakpoint ops %d\n", ops);
221 return -EINVAL;
222 }
223 }
224 return -ENOSPC;
225}
226
227static int hw_breakpoint_control(struct perf_event *bp,
228 enum hw_breakpoint_ops ops)
176{ 229{
177 struct arch_hw_breakpoint *info = counter_arch_bp(bp); 230 struct arch_hw_breakpoint *info = counter_arch_bp(bp);
178 struct perf_event **slot, **slots; 231 struct perf_event **slots;
179 struct debug_info *debug_info = &current->thread.debug; 232 struct debug_info *debug_info = &current->thread.debug;
180 int i, max_slots, ctrl_reg, val_reg, reg_enable; 233 int i, max_slots, ctrl_reg, val_reg, reg_enable;
234 enum debug_el dbg_el = debug_exception_level(info->ctrl.privilege);
181 u32 ctrl; 235 u32 ctrl;
182 236
183 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) { 237 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) {
@@ -196,67 +250,54 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
196 reg_enable = !debug_info->wps_disabled; 250 reg_enable = !debug_info->wps_disabled;
197 } 251 }
198 252
199 for (i = 0; i < max_slots; ++i) { 253 i = hw_breakpoint_slot_setup(slots, max_slots, bp, ops);
200 slot = &slots[i];
201
202 if (!*slot) {
203 *slot = bp;
204 break;
205 }
206 }
207
208 if (WARN_ONCE(i == max_slots, "Can't find any breakpoint slot"))
209 return -ENOSPC;
210 254
211 /* Ensure debug monitors are enabled at the correct exception level. */ 255 if (WARN_ONCE(i < 0, "Can't find any breakpoint slot"))
212 enable_debug_monitors(debug_exception_level(info->ctrl.privilege)); 256 return i;
213 257
214 /* Setup the address register. */ 258 switch (ops) {
215 write_wb_reg(val_reg, i, info->address); 259 case HW_BREAKPOINT_INSTALL:
260 /*
261 * Ensure debug monitors are enabled at the correct exception
262 * level.
263 */
264 enable_debug_monitors(dbg_el);
265 /* Fall through */
266 case HW_BREAKPOINT_RESTORE:
267 /* Setup the address register. */
268 write_wb_reg(val_reg, i, info->address);
269
270 /* Setup the control register. */
271 ctrl = encode_ctrl_reg(info->ctrl);
272 write_wb_reg(ctrl_reg, i,
273 reg_enable ? ctrl | 0x1 : ctrl & ~0x1);
274 break;
275 case HW_BREAKPOINT_UNINSTALL:
276 /* Reset the control register. */
277 write_wb_reg(ctrl_reg, i, 0);
216 278
217 /* Setup the control register. */ 279 /*
218 ctrl = encode_ctrl_reg(info->ctrl); 280 * Release the debug monitors for the correct exception
219 write_wb_reg(ctrl_reg, i, reg_enable ? ctrl | 0x1 : ctrl & ~0x1); 281 * level.
282 */
283 disable_debug_monitors(dbg_el);
284 break;
285 }
220 286
221 return 0; 287 return 0;
222} 288}
223 289
224void arch_uninstall_hw_breakpoint(struct perf_event *bp) 290/*
291 * Install a perf counter breakpoint.
292 */
293int arch_install_hw_breakpoint(struct perf_event *bp)
225{ 294{
226 struct arch_hw_breakpoint *info = counter_arch_bp(bp); 295 return hw_breakpoint_control(bp, HW_BREAKPOINT_INSTALL);
227 struct perf_event **slot, **slots; 296}
228 int i, max_slots, base;
229
230 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) {
231 /* Breakpoint */
232 base = AARCH64_DBG_REG_BCR;
233 slots = this_cpu_ptr(bp_on_reg);
234 max_slots = core_num_brps;
235 } else {
236 /* Watchpoint */
237 base = AARCH64_DBG_REG_WCR;
238 slots = this_cpu_ptr(wp_on_reg);
239 max_slots = core_num_wrps;
240 }
241
242 /* Remove the breakpoint. */
243 for (i = 0; i < max_slots; ++i) {
244 slot = &slots[i];
245
246 if (*slot == bp) {
247 *slot = NULL;
248 break;
249 }
250 }
251
252 if (WARN_ONCE(i == max_slots, "Can't find any breakpoint slot"))
253 return;
254
255 /* Reset the control register. */
256 write_wb_reg(base, i, 0);
257 297
258 /* Release the debug monitors for the correct exception level. */ 298void arch_uninstall_hw_breakpoint(struct perf_event *bp)
259 disable_debug_monitors(debug_exception_level(info->ctrl.privilege)); 299{
300 hw_breakpoint_control(bp, HW_BREAKPOINT_UNINSTALL);
260} 301}
261 302
262static int get_hbp_len(u8 hbp_len) 303static int get_hbp_len(u8 hbp_len)
@@ -806,18 +847,36 @@ void hw_breakpoint_thread_switch(struct task_struct *next)
806/* 847/*
807 * CPU initialisation. 848 * CPU initialisation.
808 */ 849 */
809static void reset_ctrl_regs(void *unused) 850static void hw_breakpoint_reset(void *unused)
810{ 851{
811 int i; 852 int i;
812 853 struct perf_event **slots;
813 for (i = 0; i < core_num_brps; ++i) { 854 /*
814 write_wb_reg(AARCH64_DBG_REG_BCR, i, 0UL); 855 * When a CPU goes through cold-boot, it does not have any installed
815 write_wb_reg(AARCH64_DBG_REG_BVR, i, 0UL); 856 * slot, so it is safe to share the same function for restoring and
857 * resetting breakpoints; when a CPU is hotplugged in, it goes
858 * through the slots, which are all empty, hence it just resets control
859 * and value for debug registers.
860 * When this function is triggered on warm-boot through a CPU PM
861 * notifier some slots might be initialized; if so they are
862 * reprogrammed according to the debug slots content.
863 */
864 for (slots = this_cpu_ptr(bp_on_reg), i = 0; i < core_num_brps; ++i) {
865 if (slots[i]) {
866 hw_breakpoint_control(slots[i], HW_BREAKPOINT_RESTORE);
867 } else {
868 write_wb_reg(AARCH64_DBG_REG_BCR, i, 0UL);
869 write_wb_reg(AARCH64_DBG_REG_BVR, i, 0UL);
870 }
816 } 871 }
817 872
818 for (i = 0; i < core_num_wrps; ++i) { 873 for (slots = this_cpu_ptr(wp_on_reg), i = 0; i < core_num_wrps; ++i) {
819 write_wb_reg(AARCH64_DBG_REG_WCR, i, 0UL); 874 if (slots[i]) {
820 write_wb_reg(AARCH64_DBG_REG_WVR, i, 0UL); 875 hw_breakpoint_control(slots[i], HW_BREAKPOINT_RESTORE);
876 } else {
877 write_wb_reg(AARCH64_DBG_REG_WCR, i, 0UL);
878 write_wb_reg(AARCH64_DBG_REG_WVR, i, 0UL);
879 }
821 } 880 }
822} 881}
823 882
@@ -827,7 +886,7 @@ static int hw_breakpoint_reset_notify(struct notifier_block *self,
827{ 886{
828 int cpu = (long)hcpu; 887 int cpu = (long)hcpu;
829 if (action == CPU_ONLINE) 888 if (action == CPU_ONLINE)
830 smp_call_function_single(cpu, reset_ctrl_regs, NULL, 1); 889 smp_call_function_single(cpu, hw_breakpoint_reset, NULL, 1);
831 return NOTIFY_OK; 890 return NOTIFY_OK;
832} 891}
833 892
@@ -835,6 +894,14 @@ static struct notifier_block hw_breakpoint_reset_nb = {
835 .notifier_call = hw_breakpoint_reset_notify, 894 .notifier_call = hw_breakpoint_reset_notify,
836}; 895};
837 896
897#ifdef CONFIG_ARM64_CPU_SUSPEND
898extern void cpu_suspend_set_dbg_restorer(void (*hw_bp_restore)(void *));
899#else
900static inline void cpu_suspend_set_dbg_restorer(void (*hw_bp_restore)(void *))
901{
902}
903#endif
904
838/* 905/*
839 * One-time initialisation. 906 * One-time initialisation.
840 */ 907 */
@@ -850,8 +917,8 @@ static int __init arch_hw_breakpoint_init(void)
850 * Reset the breakpoint resources. We assume that a halting 917 * Reset the breakpoint resources. We assume that a halting
851 * debugger will leave the world in a nice state for us. 918 * debugger will leave the world in a nice state for us.
852 */ 919 */
853 smp_call_function(reset_ctrl_regs, NULL, 1); 920 smp_call_function(hw_breakpoint_reset, NULL, 1);
854 reset_ctrl_regs(NULL); 921 hw_breakpoint_reset(NULL);
855 922
856 /* Register debug fault handlers. */ 923 /* Register debug fault handlers. */
857 hook_debug_fault_code(DBG_ESR_EVT_HWBP, breakpoint_handler, SIGTRAP, 924 hook_debug_fault_code(DBG_ESR_EVT_HWBP, breakpoint_handler, SIGTRAP,
@@ -861,6 +928,8 @@ static int __init arch_hw_breakpoint_init(void)
861 928
862 /* Register hotplug notifier. */ 929 /* Register hotplug notifier. */
863 register_cpu_notifier(&hw_breakpoint_reset_nb); 930 register_cpu_notifier(&hw_breakpoint_reset_nb);
931 /* Register cpu_suspend hw breakpoint restore hook */
932 cpu_suspend_set_dbg_restorer(hw_breakpoint_reset);
864 933
865 return 0; 934 return 0;
866} 935}
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
new file mode 100644
index 000000000000..92f36835486b
--- /dev/null
+++ b/arch/arm64/kernel/insn.c
@@ -0,0 +1,304 @@
1/*
2 * Copyright (C) 2013 Huawei Ltd.
3 * Author: Jiang Liu <liuj97@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * 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#include <linux/bitops.h>
18#include <linux/compiler.h>
19#include <linux/kernel.h>
20#include <linux/smp.h>
21#include <linux/stop_machine.h>
22#include <linux/uaccess.h>
23#include <asm/cacheflush.h>
24#include <asm/insn.h>
25
26static int aarch64_insn_encoding_class[] = {
27 AARCH64_INSN_CLS_UNKNOWN,
28 AARCH64_INSN_CLS_UNKNOWN,
29 AARCH64_INSN_CLS_UNKNOWN,
30 AARCH64_INSN_CLS_UNKNOWN,
31 AARCH64_INSN_CLS_LDST,
32 AARCH64_INSN_CLS_DP_REG,
33 AARCH64_INSN_CLS_LDST,
34 AARCH64_INSN_CLS_DP_FPSIMD,
35 AARCH64_INSN_CLS_DP_IMM,
36 AARCH64_INSN_CLS_DP_IMM,
37 AARCH64_INSN_CLS_BR_SYS,
38 AARCH64_INSN_CLS_BR_SYS,
39 AARCH64_INSN_CLS_LDST,
40 AARCH64_INSN_CLS_DP_REG,
41 AARCH64_INSN_CLS_LDST,
42 AARCH64_INSN_CLS_DP_FPSIMD,
43};
44
45enum aarch64_insn_encoding_class __kprobes aarch64_get_insn_class(u32 insn)
46{
47 return aarch64_insn_encoding_class[(insn >> 25) & 0xf];
48}
49
50/* NOP is an alias of HINT */
51bool __kprobes aarch64_insn_is_nop(u32 insn)
52{
53 if (!aarch64_insn_is_hint(insn))
54 return false;
55
56 switch (insn & 0xFE0) {
57 case AARCH64_INSN_HINT_YIELD:
58 case AARCH64_INSN_HINT_WFE:
59 case AARCH64_INSN_HINT_WFI:
60 case AARCH64_INSN_HINT_SEV:
61 case AARCH64_INSN_HINT_SEVL:
62 return false;
63 default:
64 return true;
65 }
66}
67
68/*
69 * In ARMv8-A, A64 instructions have a fixed length of 32 bits and are always
70 * little-endian.
71 */
72int __kprobes aarch64_insn_read(void *addr, u32 *insnp)
73{
74 int ret;
75 u32 val;
76
77 ret = probe_kernel_read(&val, addr, AARCH64_INSN_SIZE);
78 if (!ret)
79 *insnp = le32_to_cpu(val);
80
81 return ret;
82}
83
84int __kprobes aarch64_insn_write(void *addr, u32 insn)
85{
86 insn = cpu_to_le32(insn);
87 return probe_kernel_write(addr, &insn, AARCH64_INSN_SIZE);
88}
89
90static bool __kprobes __aarch64_insn_hotpatch_safe(u32 insn)
91{
92 if (aarch64_get_insn_class(insn) != AARCH64_INSN_CLS_BR_SYS)
93 return false;
94
95 return aarch64_insn_is_b(insn) ||
96 aarch64_insn_is_bl(insn) ||
97 aarch64_insn_is_svc(insn) ||
98 aarch64_insn_is_hvc(insn) ||
99 aarch64_insn_is_smc(insn) ||
100 aarch64_insn_is_brk(insn) ||
101 aarch64_insn_is_nop(insn);
102}
103
104/*
105 * ARM Architecture Reference Manual for ARMv8 Profile-A, Issue A.a
106 * Section B2.6.5 "Concurrent modification and execution of instructions":
107 * Concurrent modification and execution of instructions can lead to the
108 * resulting instruction performing any behavior that can be achieved by
109 * executing any sequence of instructions that can be executed from the
110 * same Exception level, except where the instruction before modification
111 * and the instruction after modification is a B, BL, NOP, BKPT, SVC, HVC,
112 * or SMC instruction.
113 */
114bool __kprobes aarch64_insn_hotpatch_safe(u32 old_insn, u32 new_insn)
115{
116 return __aarch64_insn_hotpatch_safe(old_insn) &&
117 __aarch64_insn_hotpatch_safe(new_insn);
118}
119
120int __kprobes aarch64_insn_patch_text_nosync(void *addr, u32 insn)
121{
122 u32 *tp = addr;
123 int ret;
124
125 /* A64 instructions must be word aligned */
126 if ((uintptr_t)tp & 0x3)
127 return -EINVAL;
128
129 ret = aarch64_insn_write(tp, insn);
130 if (ret == 0)
131 flush_icache_range((uintptr_t)tp,
132 (uintptr_t)tp + AARCH64_INSN_SIZE);
133
134 return ret;
135}
136
137struct aarch64_insn_patch {
138 void **text_addrs;
139 u32 *new_insns;
140 int insn_cnt;
141 atomic_t cpu_count;
142};
143
144static int __kprobes aarch64_insn_patch_text_cb(void *arg)
145{
146 int i, ret = 0;
147 struct aarch64_insn_patch *pp = arg;
148
149 /* The first CPU becomes master */
150 if (atomic_inc_return(&pp->cpu_count) == 1) {
151 for (i = 0; ret == 0 && i < pp->insn_cnt; i++)
152 ret = aarch64_insn_patch_text_nosync(pp->text_addrs[i],
153 pp->new_insns[i]);
154 /*
155 * aarch64_insn_patch_text_nosync() calls flush_icache_range(),
156 * which ends with "dsb; isb" pair guaranteeing global
157 * visibility.
158 */
159 atomic_set(&pp->cpu_count, -1);
160 } else {
161 while (atomic_read(&pp->cpu_count) != -1)
162 cpu_relax();
163 isb();
164 }
165
166 return ret;
167}
168
169int __kprobes aarch64_insn_patch_text_sync(void *addrs[], u32 insns[], int cnt)
170{
171 struct aarch64_insn_patch patch = {
172 .text_addrs = addrs,
173 .new_insns = insns,
174 .insn_cnt = cnt,
175 .cpu_count = ATOMIC_INIT(0),
176 };
177
178 if (cnt <= 0)
179 return -EINVAL;
180
181 return stop_machine(aarch64_insn_patch_text_cb, &patch,
182 cpu_online_mask);
183}
184
185int __kprobes aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt)
186{
187 int ret;
188 u32 insn;
189
190 /* Unsafe to patch multiple instructions without synchronizaiton */
191 if (cnt == 1) {
192 ret = aarch64_insn_read(addrs[0], &insn);
193 if (ret)
194 return ret;
195
196 if (aarch64_insn_hotpatch_safe(insn, insns[0])) {
197 /*
198 * ARMv8 architecture doesn't guarantee all CPUs see
199 * the new instruction after returning from function
200 * aarch64_insn_patch_text_nosync(). So send IPIs to
201 * all other CPUs to achieve instruction
202 * synchronization.
203 */
204 ret = aarch64_insn_patch_text_nosync(addrs[0], insns[0]);
205 kick_all_cpus_sync();
206 return ret;
207 }
208 }
209
210 return aarch64_insn_patch_text_sync(addrs, insns, cnt);
211}
212
213u32 __kprobes aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
214 u32 insn, u64 imm)
215{
216 u32 immlo, immhi, lomask, himask, mask;
217 int shift;
218
219 switch (type) {
220 case AARCH64_INSN_IMM_ADR:
221 lomask = 0x3;
222 himask = 0x7ffff;
223 immlo = imm & lomask;
224 imm >>= 2;
225 immhi = imm & himask;
226 imm = (immlo << 24) | (immhi);
227 mask = (lomask << 24) | (himask);
228 shift = 5;
229 break;
230 case AARCH64_INSN_IMM_26:
231 mask = BIT(26) - 1;
232 shift = 0;
233 break;
234 case AARCH64_INSN_IMM_19:
235 mask = BIT(19) - 1;
236 shift = 5;
237 break;
238 case AARCH64_INSN_IMM_16:
239 mask = BIT(16) - 1;
240 shift = 5;
241 break;
242 case AARCH64_INSN_IMM_14:
243 mask = BIT(14) - 1;
244 shift = 5;
245 break;
246 case AARCH64_INSN_IMM_12:
247 mask = BIT(12) - 1;
248 shift = 10;
249 break;
250 case AARCH64_INSN_IMM_9:
251 mask = BIT(9) - 1;
252 shift = 12;
253 break;
254 default:
255 pr_err("aarch64_insn_encode_immediate: unknown immediate encoding %d\n",
256 type);
257 return 0;
258 }
259
260 /* Update the immediate field. */
261 insn &= ~(mask << shift);
262 insn |= (imm & mask) << shift;
263
264 return insn;
265}
266
267u32 __kprobes aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr,
268 enum aarch64_insn_branch_type type)
269{
270 u32 insn;
271 long offset;
272
273 /*
274 * PC: A 64-bit Program Counter holding the address of the current
275 * instruction. A64 instructions must be word-aligned.
276 */
277 BUG_ON((pc & 0x3) || (addr & 0x3));
278
279 /*
280 * B/BL support [-128M, 128M) offset
281 * ARM64 virtual address arrangement guarantees all kernel and module
282 * texts are within +/-128M.
283 */
284 offset = ((long)addr - (long)pc);
285 BUG_ON(offset < -SZ_128M || offset >= SZ_128M);
286
287 if (type == AARCH64_INSN_BRANCH_LINK)
288 insn = aarch64_insn_get_bl_value();
289 else
290 insn = aarch64_insn_get_b_value();
291
292 return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_26, insn,
293 offset >> 2);
294}
295
296u32 __kprobes aarch64_insn_gen_hint(enum aarch64_insn_hint_op op)
297{
298 return aarch64_insn_get_hint_value() | op;
299}
300
301u32 __kprobes aarch64_insn_gen_nop(void)
302{
303 return aarch64_insn_gen_hint(AARCH64_INSN_HINT_NOP);
304}
diff --git a/arch/arm64/kernel/jump_label.c b/arch/arm64/kernel/jump_label.c
new file mode 100644
index 000000000000..263a166291fb
--- /dev/null
+++ b/arch/arm64/kernel/jump_label.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2013 Huawei Ltd.
3 * Author: Jiang Liu <liuj97@gmail.com>
4 *
5 * Based on arch/arm/kernel/jump_label.c
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#include <linux/kernel.h>
20#include <linux/jump_label.h>
21#include <asm/insn.h>
22
23#ifdef HAVE_JUMP_LABEL
24
25static void __arch_jump_label_transform(struct jump_entry *entry,
26 enum jump_label_type type,
27 bool is_static)
28{
29 void *addr = (void *)entry->code;
30 u32 insn;
31
32 if (type == JUMP_LABEL_ENABLE) {
33 insn = aarch64_insn_gen_branch_imm(entry->code,
34 entry->target,
35 AARCH64_INSN_BRANCH_NOLINK);
36 } else {
37 insn = aarch64_insn_gen_nop();
38 }
39
40 if (is_static)
41 aarch64_insn_patch_text_nosync(addr, insn);
42 else
43 aarch64_insn_patch_text(&addr, &insn, 1);
44}
45
46void arch_jump_label_transform(struct jump_entry *entry,
47 enum jump_label_type type)
48{
49 __arch_jump_label_transform(entry, type, false);
50}
51
52void arch_jump_label_transform_static(struct jump_entry *entry,
53 enum jump_label_type type)
54{
55 __arch_jump_label_transform(entry, type, true);
56}
57
58#endif /* HAVE_JUMP_LABEL */
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
index e2ad0d87721f..1eb1cc955139 100644
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -25,6 +25,10 @@
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/moduleloader.h> 26#include <linux/moduleloader.h>
27#include <linux/vmalloc.h> 27#include <linux/vmalloc.h>
28#include <asm/insn.h>
29
30#define AARCH64_INSN_IMM_MOVNZ AARCH64_INSN_IMM_MAX
31#define AARCH64_INSN_IMM_MOVK AARCH64_INSN_IMM_16
28 32
29void *module_alloc(unsigned long size) 33void *module_alloc(unsigned long size)
30{ 34{
@@ -94,28 +98,18 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
94 return 0; 98 return 0;
95} 99}
96 100
97enum aarch64_imm_type { 101static int reloc_insn_movw(enum aarch64_reloc_op op, void *place, u64 val,
98 INSN_IMM_MOVNZ, 102 int lsb, enum aarch64_insn_imm_type imm_type)
99 INSN_IMM_MOVK,
100 INSN_IMM_ADR,
101 INSN_IMM_26,
102 INSN_IMM_19,
103 INSN_IMM_16,
104 INSN_IMM_14,
105 INSN_IMM_12,
106 INSN_IMM_9,
107};
108
109static u32 encode_insn_immediate(enum aarch64_imm_type type, u32 insn, u64 imm)
110{ 103{
111 u32 immlo, immhi, lomask, himask, mask; 104 u64 imm, limit = 0;
112 int shift; 105 s64 sval;
106 u32 insn = le32_to_cpu(*(u32 *)place);
113 107
114 /* The instruction stream is always little endian. */ 108 sval = do_reloc(op, place, val);
115 insn = le32_to_cpu(insn); 109 sval >>= lsb;
110 imm = sval & 0xffff;
116 111
117 switch (type) { 112 if (imm_type == AARCH64_INSN_IMM_MOVNZ) {
118 case INSN_IMM_MOVNZ:
119 /* 113 /*
120 * For signed MOVW relocations, we have to manipulate the 114 * For signed MOVW relocations, we have to manipulate the
121 * instruction encoding depending on whether or not the 115 * instruction encoding depending on whether or not the
@@ -134,70 +128,12 @@ static u32 encode_insn_immediate(enum aarch64_imm_type type, u32 insn, u64 imm)
134 */ 128 */
135 imm = ~imm; 129 imm = ~imm;
136 } 130 }
137 case INSN_IMM_MOVK: 131 imm_type = AARCH64_INSN_IMM_MOVK;
138 mask = BIT(16) - 1;
139 shift = 5;
140 break;
141 case INSN_IMM_ADR:
142 lomask = 0x3;
143 himask = 0x7ffff;
144 immlo = imm & lomask;
145 imm >>= 2;
146 immhi = imm & himask;
147 imm = (immlo << 24) | (immhi);
148 mask = (lomask << 24) | (himask);
149 shift = 5;
150 break;
151 case INSN_IMM_26:
152 mask = BIT(26) - 1;
153 shift = 0;
154 break;
155 case INSN_IMM_19:
156 mask = BIT(19) - 1;
157 shift = 5;
158 break;
159 case INSN_IMM_16:
160 mask = BIT(16) - 1;
161 shift = 5;
162 break;
163 case INSN_IMM_14:
164 mask = BIT(14) - 1;
165 shift = 5;
166 break;
167 case INSN_IMM_12:
168 mask = BIT(12) - 1;
169 shift = 10;
170 break;
171 case INSN_IMM_9:
172 mask = BIT(9) - 1;
173 shift = 12;
174 break;
175 default:
176 pr_err("encode_insn_immediate: unknown immediate encoding %d\n",
177 type);
178 return 0;
179 } 132 }
180 133
181 /* Update the immediate field. */
182 insn &= ~(mask << shift);
183 insn |= (imm & mask) << shift;
184
185 return cpu_to_le32(insn);
186}
187
188static int reloc_insn_movw(enum aarch64_reloc_op op, void *place, u64 val,
189 int lsb, enum aarch64_imm_type imm_type)
190{
191 u64 imm, limit = 0;
192 s64 sval;
193 u32 insn = *(u32 *)place;
194
195 sval = do_reloc(op, place, val);
196 sval >>= lsb;
197 imm = sval & 0xffff;
198
199 /* Update the instruction with the new encoding. */ 134 /* Update the instruction with the new encoding. */
200 *(u32 *)place = encode_insn_immediate(imm_type, insn, imm); 135 insn = aarch64_insn_encode_immediate(imm_type, insn, imm);
136 *(u32 *)place = cpu_to_le32(insn);
201 137
202 /* Shift out the immediate field. */ 138 /* Shift out the immediate field. */
203 sval >>= 16; 139 sval >>= 16;
@@ -206,9 +142,9 @@ static int reloc_insn_movw(enum aarch64_reloc_op op, void *place, u64 val,
206 * For unsigned immediates, the overflow check is straightforward. 142 * For unsigned immediates, the overflow check is straightforward.
207 * For signed immediates, the sign bit is actually the bit past the 143 * For signed immediates, the sign bit is actually the bit past the
208 * most significant bit of the field. 144 * most significant bit of the field.
209 * The INSN_IMM_16 immediate type is unsigned. 145 * The AARCH64_INSN_IMM_16 immediate type is unsigned.
210 */ 146 */
211 if (imm_type != INSN_IMM_16) { 147 if (imm_type != AARCH64_INSN_IMM_16) {
212 sval++; 148 sval++;
213 limit++; 149 limit++;
214 } 150 }
@@ -221,11 +157,11 @@ static int reloc_insn_movw(enum aarch64_reloc_op op, void *place, u64 val,
221} 157}
222 158
223static int reloc_insn_imm(enum aarch64_reloc_op op, void *place, u64 val, 159static int reloc_insn_imm(enum aarch64_reloc_op op, void *place, u64 val,
224 int lsb, int len, enum aarch64_imm_type imm_type) 160 int lsb, int len, enum aarch64_insn_imm_type imm_type)
225{ 161{
226 u64 imm, imm_mask; 162 u64 imm, imm_mask;
227 s64 sval; 163 s64 sval;
228 u32 insn = *(u32 *)place; 164 u32 insn = le32_to_cpu(*(u32 *)place);
229 165
230 /* Calculate the relocation value. */ 166 /* Calculate the relocation value. */
231 sval = do_reloc(op, place, val); 167 sval = do_reloc(op, place, val);
@@ -236,7 +172,8 @@ static int reloc_insn_imm(enum aarch64_reloc_op op, void *place, u64 val,
236 imm = sval & imm_mask; 172 imm = sval & imm_mask;
237 173
238 /* Update the instruction's immediate field. */ 174 /* Update the instruction's immediate field. */
239 *(u32 *)place = encode_insn_immediate(imm_type, insn, imm); 175 insn = aarch64_insn_encode_immediate(imm_type, insn, imm);
176 *(u32 *)place = cpu_to_le32(insn);
240 177
241 /* 178 /*
242 * Extract the upper value bits (including the sign bit) and 179 * Extract the upper value bits (including the sign bit) and
@@ -318,125 +255,125 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
318 overflow_check = false; 255 overflow_check = false;
319 case R_AARCH64_MOVW_UABS_G0: 256 case R_AARCH64_MOVW_UABS_G0:
320 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0, 257 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0,
321 INSN_IMM_16); 258 AARCH64_INSN_IMM_16);
322 break; 259 break;
323 case R_AARCH64_MOVW_UABS_G1_NC: 260 case R_AARCH64_MOVW_UABS_G1_NC:
324 overflow_check = false; 261 overflow_check = false;
325 case R_AARCH64_MOVW_UABS_G1: 262 case R_AARCH64_MOVW_UABS_G1:
326 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16, 263 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16,
327 INSN_IMM_16); 264 AARCH64_INSN_IMM_16);
328 break; 265 break;
329 case R_AARCH64_MOVW_UABS_G2_NC: 266 case R_AARCH64_MOVW_UABS_G2_NC:
330 overflow_check = false; 267 overflow_check = false;
331 case R_AARCH64_MOVW_UABS_G2: 268 case R_AARCH64_MOVW_UABS_G2:
332 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32, 269 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32,
333 INSN_IMM_16); 270 AARCH64_INSN_IMM_16);
334 break; 271 break;
335 case R_AARCH64_MOVW_UABS_G3: 272 case R_AARCH64_MOVW_UABS_G3:
336 /* We're using the top bits so we can't overflow. */ 273 /* We're using the top bits so we can't overflow. */
337 overflow_check = false; 274 overflow_check = false;
338 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 48, 275 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 48,
339 INSN_IMM_16); 276 AARCH64_INSN_IMM_16);
340 break; 277 break;
341 case R_AARCH64_MOVW_SABS_G0: 278 case R_AARCH64_MOVW_SABS_G0:
342 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0, 279 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0,
343 INSN_IMM_MOVNZ); 280 AARCH64_INSN_IMM_MOVNZ);
344 break; 281 break;
345 case R_AARCH64_MOVW_SABS_G1: 282 case R_AARCH64_MOVW_SABS_G1:
346 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16, 283 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16,
347 INSN_IMM_MOVNZ); 284 AARCH64_INSN_IMM_MOVNZ);
348 break; 285 break;
349 case R_AARCH64_MOVW_SABS_G2: 286 case R_AARCH64_MOVW_SABS_G2:
350 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32, 287 ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32,
351 INSN_IMM_MOVNZ); 288 AARCH64_INSN_IMM_MOVNZ);
352 break; 289 break;
353 case R_AARCH64_MOVW_PREL_G0_NC: 290 case R_AARCH64_MOVW_PREL_G0_NC:
354 overflow_check = false; 291 overflow_check = false;
355 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 0, 292 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 0,
356 INSN_IMM_MOVK); 293 AARCH64_INSN_IMM_MOVK);
357 break; 294 break;
358 case R_AARCH64_MOVW_PREL_G0: 295 case R_AARCH64_MOVW_PREL_G0:
359 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 0, 296 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 0,
360 INSN_IMM_MOVNZ); 297 AARCH64_INSN_IMM_MOVNZ);
361 break; 298 break;
362 case R_AARCH64_MOVW_PREL_G1_NC: 299 case R_AARCH64_MOVW_PREL_G1_NC:
363 overflow_check = false; 300 overflow_check = false;
364 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 16, 301 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 16,
365 INSN_IMM_MOVK); 302 AARCH64_INSN_IMM_MOVK);
366 break; 303 break;
367 case R_AARCH64_MOVW_PREL_G1: 304 case R_AARCH64_MOVW_PREL_G1:
368 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 16, 305 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 16,
369 INSN_IMM_MOVNZ); 306 AARCH64_INSN_IMM_MOVNZ);
370 break; 307 break;
371 case R_AARCH64_MOVW_PREL_G2_NC: 308 case R_AARCH64_MOVW_PREL_G2_NC:
372 overflow_check = false; 309 overflow_check = false;
373 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 32, 310 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 32,
374 INSN_IMM_MOVK); 311 AARCH64_INSN_IMM_MOVK);
375 break; 312 break;
376 case R_AARCH64_MOVW_PREL_G2: 313 case R_AARCH64_MOVW_PREL_G2:
377 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 32, 314 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 32,
378 INSN_IMM_MOVNZ); 315 AARCH64_INSN_IMM_MOVNZ);
379 break; 316 break;
380 case R_AARCH64_MOVW_PREL_G3: 317 case R_AARCH64_MOVW_PREL_G3:
381 /* We're using the top bits so we can't overflow. */ 318 /* We're using the top bits so we can't overflow. */
382 overflow_check = false; 319 overflow_check = false;
383 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 48, 320 ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 48,
384 INSN_IMM_MOVNZ); 321 AARCH64_INSN_IMM_MOVNZ);
385 break; 322 break;
386 323
387 /* Immediate instruction relocations. */ 324 /* Immediate instruction relocations. */
388 case R_AARCH64_LD_PREL_LO19: 325 case R_AARCH64_LD_PREL_LO19:
389 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 19, 326 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 19,
390 INSN_IMM_19); 327 AARCH64_INSN_IMM_19);
391 break; 328 break;
392 case R_AARCH64_ADR_PREL_LO21: 329 case R_AARCH64_ADR_PREL_LO21:
393 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 0, 21, 330 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 0, 21,
394 INSN_IMM_ADR); 331 AARCH64_INSN_IMM_ADR);
395 break; 332 break;
396 case R_AARCH64_ADR_PREL_PG_HI21_NC: 333 case R_AARCH64_ADR_PREL_PG_HI21_NC:
397 overflow_check = false; 334 overflow_check = false;
398 case R_AARCH64_ADR_PREL_PG_HI21: 335 case R_AARCH64_ADR_PREL_PG_HI21:
399 ovf = reloc_insn_imm(RELOC_OP_PAGE, loc, val, 12, 21, 336 ovf = reloc_insn_imm(RELOC_OP_PAGE, loc, val, 12, 21,
400 INSN_IMM_ADR); 337 AARCH64_INSN_IMM_ADR);
401 break; 338 break;
402 case R_AARCH64_ADD_ABS_LO12_NC: 339 case R_AARCH64_ADD_ABS_LO12_NC:
403 case R_AARCH64_LDST8_ABS_LO12_NC: 340 case R_AARCH64_LDST8_ABS_LO12_NC:
404 overflow_check = false; 341 overflow_check = false;
405 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 0, 12, 342 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 0, 12,
406 INSN_IMM_12); 343 AARCH64_INSN_IMM_12);
407 break; 344 break;
408 case R_AARCH64_LDST16_ABS_LO12_NC: 345 case R_AARCH64_LDST16_ABS_LO12_NC:
409 overflow_check = false; 346 overflow_check = false;
410 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 1, 11, 347 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 1, 11,
411 INSN_IMM_12); 348 AARCH64_INSN_IMM_12);
412 break; 349 break;
413 case R_AARCH64_LDST32_ABS_LO12_NC: 350 case R_AARCH64_LDST32_ABS_LO12_NC:
414 overflow_check = false; 351 overflow_check = false;
415 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 2, 10, 352 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 2, 10,
416 INSN_IMM_12); 353 AARCH64_INSN_IMM_12);
417 break; 354 break;
418 case R_AARCH64_LDST64_ABS_LO12_NC: 355 case R_AARCH64_LDST64_ABS_LO12_NC:
419 overflow_check = false; 356 overflow_check = false;
420 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 3, 9, 357 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 3, 9,
421 INSN_IMM_12); 358 AARCH64_INSN_IMM_12);
422 break; 359 break;
423 case R_AARCH64_LDST128_ABS_LO12_NC: 360 case R_AARCH64_LDST128_ABS_LO12_NC:
424 overflow_check = false; 361 overflow_check = false;
425 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 4, 8, 362 ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 4, 8,
426 INSN_IMM_12); 363 AARCH64_INSN_IMM_12);
427 break; 364 break;
428 case R_AARCH64_TSTBR14: 365 case R_AARCH64_TSTBR14:
429 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 14, 366 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 14,
430 INSN_IMM_14); 367 AARCH64_INSN_IMM_14);
431 break; 368 break;
432 case R_AARCH64_CONDBR19: 369 case R_AARCH64_CONDBR19:
433 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 19, 370 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 19,
434 INSN_IMM_19); 371 AARCH64_INSN_IMM_19);
435 break; 372 break;
436 case R_AARCH64_JUMP26: 373 case R_AARCH64_JUMP26:
437 case R_AARCH64_CALL26: 374 case R_AARCH64_CALL26:
438 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 26, 375 ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 26,
439 INSN_IMM_26); 376 AARCH64_INSN_IMM_26);
440 break; 377 break;
441 378
442 default: 379 default:
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 0e63c98d224c..5b1cd792274a 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/bitmap.h> 23#include <linux/bitmap.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/irq.h>
25#include <linux/kernel.h> 26#include <linux/kernel.h>
26#include <linux/export.h> 27#include <linux/export.h>
27#include <linux/perf_event.h> 28#include <linux/perf_event.h>
@@ -363,26 +364,53 @@ validate_group(struct perf_event *event)
363} 364}
364 365
365static void 366static void
367armpmu_disable_percpu_irq(void *data)
368{
369 unsigned int irq = *(unsigned int *)data;
370 disable_percpu_irq(irq);
371}
372
373static void
366armpmu_release_hardware(struct arm_pmu *armpmu) 374armpmu_release_hardware(struct arm_pmu *armpmu)
367{ 375{
368 int i, irq, irqs; 376 int irq;
377 unsigned int i, irqs;
369 struct platform_device *pmu_device = armpmu->plat_device; 378 struct platform_device *pmu_device = armpmu->plat_device;
370 379
371 irqs = min(pmu_device->num_resources, num_possible_cpus()); 380 irqs = min(pmu_device->num_resources, num_possible_cpus());
381 if (!irqs)
382 return;
372 383
373 for (i = 0; i < irqs; ++i) { 384 irq = platform_get_irq(pmu_device, 0);
374 if (!cpumask_test_and_clear_cpu(i, &armpmu->active_irqs)) 385 if (irq <= 0)
375 continue; 386 return;
376 irq = platform_get_irq(pmu_device, i); 387
377 if (irq >= 0) 388 if (irq_is_percpu(irq)) {
378 free_irq(irq, armpmu); 389 on_each_cpu(armpmu_disable_percpu_irq, &irq, 1);
390 free_percpu_irq(irq, &cpu_hw_events);
391 } else {
392 for (i = 0; i < irqs; ++i) {
393 if (!cpumask_test_and_clear_cpu(i, &armpmu->active_irqs))
394 continue;
395 irq = platform_get_irq(pmu_device, i);
396 if (irq > 0)
397 free_irq(irq, armpmu);
398 }
379 } 399 }
380} 400}
381 401
402static void
403armpmu_enable_percpu_irq(void *data)
404{
405 unsigned int irq = *(unsigned int *)data;
406 enable_percpu_irq(irq, IRQ_TYPE_NONE);
407}
408
382static int 409static int
383armpmu_reserve_hardware(struct arm_pmu *armpmu) 410armpmu_reserve_hardware(struct arm_pmu *armpmu)
384{ 411{
385 int i, err, irq, irqs; 412 int err, irq;
413 unsigned int i, irqs;
386 struct platform_device *pmu_device = armpmu->plat_device; 414 struct platform_device *pmu_device = armpmu->plat_device;
387 415
388 if (!pmu_device) { 416 if (!pmu_device) {
@@ -391,39 +419,59 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)
391 } 419 }
392 420
393 irqs = min(pmu_device->num_resources, num_possible_cpus()); 421 irqs = min(pmu_device->num_resources, num_possible_cpus());
394 if (irqs < 1) { 422 if (!irqs) {
395 pr_err("no irqs for PMUs defined\n"); 423 pr_err("no irqs for PMUs defined\n");
396 return -ENODEV; 424 return -ENODEV;
397 } 425 }
398 426
399 for (i = 0; i < irqs; ++i) { 427 irq = platform_get_irq(pmu_device, 0);
400 err = 0; 428 if (irq <= 0) {
401 irq = platform_get_irq(pmu_device, i); 429 pr_err("failed to get valid irq for PMU device\n");
402 if (irq < 0) 430 return -ENODEV;
403 continue; 431 }
404 432
405 /* 433 if (irq_is_percpu(irq)) {
406 * If we have a single PMU interrupt that we can't shift, 434 err = request_percpu_irq(irq, armpmu->handle_irq,
407 * assume that we're running on a uniprocessor machine and 435 "arm-pmu", &cpu_hw_events);
408 * continue. Otherwise, continue without this interrupt.
409 */
410 if (irq_set_affinity(irq, cpumask_of(i)) && irqs > 1) {
411 pr_warning("unable to set irq affinity (irq=%d, cpu=%u)\n",
412 irq, i);
413 continue;
414 }
415 436
416 err = request_irq(irq, armpmu->handle_irq,
417 IRQF_NOBALANCING,
418 "arm-pmu", armpmu);
419 if (err) { 437 if (err) {
420 pr_err("unable to request IRQ%d for ARM PMU counters\n", 438 pr_err("unable to request percpu IRQ%d for ARM PMU counters\n",
421 irq); 439 irq);
422 armpmu_release_hardware(armpmu); 440 armpmu_release_hardware(armpmu);
423 return err; 441 return err;
424 } 442 }
425 443
426 cpumask_set_cpu(i, &armpmu->active_irqs); 444 on_each_cpu(armpmu_enable_percpu_irq, &irq, 1);
445 } else {
446 for (i = 0; i < irqs; ++i) {
447 err = 0;
448 irq = platform_get_irq(pmu_device, i);
449 if (irq <= 0)
450 continue;
451
452 /*
453 * If we have a single PMU interrupt that we can't shift,
454 * assume that we're running on a uniprocessor machine and
455 * continue. Otherwise, continue without this interrupt.
456 */
457 if (irq_set_affinity(irq, cpumask_of(i)) && irqs > 1) {
458 pr_warning("unable to set irq affinity (irq=%d, cpu=%u)\n",
459 irq, i);
460 continue;
461 }
462
463 err = request_irq(irq, armpmu->handle_irq,
464 IRQF_NOBALANCING,
465 "arm-pmu", armpmu);
466 if (err) {
467 pr_err("unable to request IRQ%d for ARM PMU counters\n",
468 irq);
469 armpmu_release_hardware(armpmu);
470 return err;
471 }
472
473 cpumask_set_cpu(i, &armpmu->active_irqs);
474 }
427 } 475 }
428 476
429 return 0; 477 return 0;
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index de17c89985db..1c0a9be2ffa8 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -33,6 +33,7 @@
33#include <linux/kallsyms.h> 33#include <linux/kallsyms.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/cpu.h> 35#include <linux/cpu.h>
36#include <linux/cpuidle.h>
36#include <linux/elfcore.h> 37#include <linux/elfcore.h>
37#include <linux/pm.h> 38#include <linux/pm.h>
38#include <linux/tick.h> 39#include <linux/tick.h>
@@ -84,11 +85,6 @@ EXPORT_SYMBOL_GPL(pm_power_off);
84void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); 85void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
85EXPORT_SYMBOL_GPL(arm_pm_restart); 86EXPORT_SYMBOL_GPL(arm_pm_restart);
86 87
87void arch_cpu_idle_prepare(void)
88{
89 local_fiq_enable();
90}
91
92/* 88/*
93 * This is our default idle handler. 89 * This is our default idle handler.
94 */ 90 */
@@ -98,8 +94,10 @@ void arch_cpu_idle(void)
98 * This should do all the clock switching and wait for interrupt 94 * This should do all the clock switching and wait for interrupt
99 * tricks 95 * tricks
100 */ 96 */
101 cpu_do_idle(); 97 if (cpuidle_idle_call()) {
102 local_irq_enable(); 98 cpu_do_idle();
99 local_irq_enable();
100 }
103} 101}
104 102
105#ifdef CONFIG_HOTPLUG_CPU 103#ifdef CONFIG_HOTPLUG_CPU
@@ -135,7 +133,6 @@ void machine_restart(char *cmd)
135 133
136 /* Disable interrupts first */ 134 /* Disable interrupts first */
137 local_irq_disable(); 135 local_irq_disable();
138 local_fiq_disable();
139 136
140 /* Now call the architecture specific reboot code. */ 137 /* Now call the architecture specific reboot code. */
141 if (arm_pm_restart) 138 if (arm_pm_restart)
@@ -308,6 +305,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
308unsigned long get_wchan(struct task_struct *p) 305unsigned long get_wchan(struct task_struct *p)
309{ 306{
310 struct stackframe frame; 307 struct stackframe frame;
308 unsigned long stack_page;
311 int count = 0; 309 int count = 0;
312 if (!p || p == current || p->state == TASK_RUNNING) 310 if (!p || p == current || p->state == TASK_RUNNING)
313 return 0; 311 return 0;
@@ -315,9 +313,11 @@ unsigned long get_wchan(struct task_struct *p)
315 frame.fp = thread_saved_fp(p); 313 frame.fp = thread_saved_fp(p);
316 frame.sp = thread_saved_sp(p); 314 frame.sp = thread_saved_sp(p);
317 frame.pc = thread_saved_pc(p); 315 frame.pc = thread_saved_pc(p);
316 stack_page = (unsigned long)task_stack_page(p);
318 do { 317 do {
319 int ret = unwind_frame(&frame); 318 if (frame.sp < stack_page ||
320 if (ret < 0) 319 frame.sp >= stack_page + THREAD_SIZE ||
320 unwind_frame(&frame))
321 return 0; 321 return 0;
322 if (!in_sched_functions(frame.pc)) 322 if (!in_sched_functions(frame.pc))
323 return frame.pc; 323 return frame.pc;
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index bd9bbd0e44ed..c8e9effe52e1 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -108,20 +108,95 @@ void __init early_print(const char *str, ...)
108 printk("%s", buf); 108 printk("%s", buf);
109} 109}
110 110
111void __init smp_setup_processor_id(void)
112{
113 /*
114 * clear __my_cpu_offset on boot CPU to avoid hang caused by
115 * using percpu variable early, for example, lockdep will
116 * access percpu variable inside lock_release
117 */
118 set_my_cpu_offset(0);
119}
120
111bool arch_match_cpu_phys_id(int cpu, u64 phys_id) 121bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
112{ 122{
113 return phys_id == cpu_logical_map(cpu); 123 return phys_id == cpu_logical_map(cpu);
114} 124}
115 125
126struct mpidr_hash mpidr_hash;
127#ifdef CONFIG_SMP
128/**
129 * smp_build_mpidr_hash - Pre-compute shifts required at each affinity
130 * level in order to build a linear index from an
131 * MPIDR value. Resulting algorithm is a collision
132 * free hash carried out through shifting and ORing
133 */
134static void __init smp_build_mpidr_hash(void)
135{
136 u32 i, affinity, fs[4], bits[4], ls;
137 u64 mask = 0;
138 /*
139 * Pre-scan the list of MPIDRS and filter out bits that do
140 * not contribute to affinity levels, ie they never toggle.
141 */
142 for_each_possible_cpu(i)
143 mask |= (cpu_logical_map(i) ^ cpu_logical_map(0));
144 pr_debug("mask of set bits %#llx\n", mask);
145 /*
146 * Find and stash the last and first bit set at all affinity levels to
147 * check how many bits are required to represent them.
148 */
149 for (i = 0; i < 4; i++) {
150 affinity = MPIDR_AFFINITY_LEVEL(mask, i);
151 /*
152 * Find the MSB bit and LSB bits position
153 * to determine how many bits are required
154 * to express the affinity level.
155 */
156 ls = fls(affinity);
157 fs[i] = affinity ? ffs(affinity) - 1 : 0;
158 bits[i] = ls - fs[i];
159 }
160 /*
161 * An index can be created from the MPIDR_EL1 by isolating the
162 * significant bits at each affinity level and by shifting
163 * them in order to compress the 32 bits values space to a
164 * compressed set of values. This is equivalent to hashing
165 * the MPIDR_EL1 through shifting and ORing. It is a collision free
166 * hash though not minimal since some levels might contain a number
167 * of CPUs that is not an exact power of 2 and their bit
168 * representation might contain holes, eg MPIDR_EL1[7:0] = {0x2, 0x80}.
169 */
170 mpidr_hash.shift_aff[0] = MPIDR_LEVEL_SHIFT(0) + fs[0];
171 mpidr_hash.shift_aff[1] = MPIDR_LEVEL_SHIFT(1) + fs[1] - bits[0];
172 mpidr_hash.shift_aff[2] = MPIDR_LEVEL_SHIFT(2) + fs[2] -
173 (bits[1] + bits[0]);
174 mpidr_hash.shift_aff[3] = MPIDR_LEVEL_SHIFT(3) +
175 fs[3] - (bits[2] + bits[1] + bits[0]);
176 mpidr_hash.mask = mask;
177 mpidr_hash.bits = bits[3] + bits[2] + bits[1] + bits[0];
178 pr_debug("MPIDR hash: aff0[%u] aff1[%u] aff2[%u] aff3[%u] mask[%#llx] bits[%u]\n",
179 mpidr_hash.shift_aff[0],
180 mpidr_hash.shift_aff[1],
181 mpidr_hash.shift_aff[2],
182 mpidr_hash.shift_aff[3],
183 mpidr_hash.mask,
184 mpidr_hash.bits);
185 /*
186 * 4x is an arbitrary value used to warn on a hash table much bigger
187 * than expected on most systems.
188 */
189 if (mpidr_hash_size() > 4 * num_possible_cpus())
190 pr_warn("Large number of MPIDR hash buckets detected\n");
191 __flush_dcache_area(&mpidr_hash, sizeof(struct mpidr_hash));
192}
193#endif
194
116static void __init setup_processor(void) 195static void __init setup_processor(void)
117{ 196{
118 struct cpu_info *cpu_info; 197 struct cpu_info *cpu_info;
198 u64 features, block;
119 199
120 /*
121 * locate processor in the list of supported processor
122 * types. The linker builds this table for us from the
123 * entries in arch/arm/mm/proc.S
124 */
125 cpu_info = lookup_processor_type(read_cpuid_id()); 200 cpu_info = lookup_processor_type(read_cpuid_id());
126 if (!cpu_info) { 201 if (!cpu_info) {
127 printk("CPU configuration botched (ID %08x), unable to continue.\n", 202 printk("CPU configuration botched (ID %08x), unable to continue.\n",
@@ -136,6 +211,37 @@ static void __init setup_processor(void)
136 211
137 sprintf(init_utsname()->machine, ELF_PLATFORM); 212 sprintf(init_utsname()->machine, ELF_PLATFORM);
138 elf_hwcap = 0; 213 elf_hwcap = 0;
214
215 /*
216 * ID_AA64ISAR0_EL1 contains 4-bit wide signed feature blocks.
217 * The blocks we test below represent incremental functionality
218 * for non-negative values. Negative values are reserved.
219 */
220 features = read_cpuid(ID_AA64ISAR0_EL1);
221 block = (features >> 4) & 0xf;
222 if (!(block & 0x8)) {
223 switch (block) {
224 default:
225 case 2:
226 elf_hwcap |= HWCAP_PMULL;
227 case 1:
228 elf_hwcap |= HWCAP_AES;
229 case 0:
230 break;
231 }
232 }
233
234 block = (features >> 8) & 0xf;
235 if (block && !(block & 0x8))
236 elf_hwcap |= HWCAP_SHA1;
237
238 block = (features >> 12) & 0xf;
239 if (block && !(block & 0x8))
240 elf_hwcap |= HWCAP_SHA2;
241
242 block = (features >> 16) & 0xf;
243 if (block && !(block & 0x8))
244 elf_hwcap |= HWCAP_CRC32;
139} 245}
140 246
141static void __init setup_machine_fdt(phys_addr_t dt_phys) 247static void __init setup_machine_fdt(phys_addr_t dt_phys)
@@ -236,6 +342,7 @@ void __init setup_arch(char **cmdline_p)
236 cpu_read_bootcpu_ops(); 342 cpu_read_bootcpu_ops();
237#ifdef CONFIG_SMP 343#ifdef CONFIG_SMP
238 smp_init_cpus(); 344 smp_init_cpus();
345 smp_build_mpidr_hash();
239#endif 346#endif
240 347
241#ifdef CONFIG_VT 348#ifdef CONFIG_VT
@@ -275,6 +382,11 @@ static const char *hwcap_str[] = {
275 "fp", 382 "fp",
276 "asimd", 383 "asimd",
277 "evtstrm", 384 "evtstrm",
385 "aes",
386 "pmull",
387 "sha1",
388 "sha2",
389 "crc32",
278 NULL 390 NULL
279}; 391};
280 392
diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
new file mode 100644
index 000000000000..b1925729c692
--- /dev/null
+++ b/arch/arm64/kernel/sleep.S
@@ -0,0 +1,184 @@
1#include <linux/errno.h>
2#include <linux/linkage.h>
3#include <asm/asm-offsets.h>
4#include <asm/assembler.h>
5
6 .text
7/*
8 * Implementation of MPIDR_EL1 hash algorithm through shifting
9 * and OR'ing.
10 *
11 * @dst: register containing hash result
12 * @rs0: register containing affinity level 0 bit shift
13 * @rs1: register containing affinity level 1 bit shift
14 * @rs2: register containing affinity level 2 bit shift
15 * @rs3: register containing affinity level 3 bit shift
16 * @mpidr: register containing MPIDR_EL1 value
17 * @mask: register containing MPIDR mask
18 *
19 * Pseudo C-code:
20 *
21 *u32 dst;
22 *
23 *compute_mpidr_hash(u32 rs0, u32 rs1, u32 rs2, u32 rs3, u64 mpidr, u64 mask) {
24 * u32 aff0, aff1, aff2, aff3;
25 * u64 mpidr_masked = mpidr & mask;
26 * aff0 = mpidr_masked & 0xff;
27 * aff1 = mpidr_masked & 0xff00;
28 * aff2 = mpidr_masked & 0xff0000;
29 * aff2 = mpidr_masked & 0xff00000000;
30 * dst = (aff0 >> rs0 | aff1 >> rs1 | aff2 >> rs2 | aff3 >> rs3);
31 *}
32 * Input registers: rs0, rs1, rs2, rs3, mpidr, mask
33 * Output register: dst
34 * Note: input and output registers must be disjoint register sets
35 (eg: a macro instance with mpidr = x1 and dst = x1 is invalid)
36 */
37 .macro compute_mpidr_hash dst, rs0, rs1, rs2, rs3, mpidr, mask
38 and \mpidr, \mpidr, \mask // mask out MPIDR bits
39 and \dst, \mpidr, #0xff // mask=aff0
40 lsr \dst ,\dst, \rs0 // dst=aff0>>rs0
41 and \mask, \mpidr, #0xff00 // mask = aff1
42 lsr \mask ,\mask, \rs1
43 orr \dst, \dst, \mask // dst|=(aff1>>rs1)
44 and \mask, \mpidr, #0xff0000 // mask = aff2
45 lsr \mask ,\mask, \rs2
46 orr \dst, \dst, \mask // dst|=(aff2>>rs2)
47 and \mask, \mpidr, #0xff00000000 // mask = aff3
48 lsr \mask ,\mask, \rs3
49 orr \dst, \dst, \mask // dst|=(aff3>>rs3)
50 .endm
51/*
52 * Save CPU state for a suspend. This saves callee registers, and allocates
53 * space on the kernel stack to save the CPU specific registers + some
54 * other data for resume.
55 *
56 * x0 = suspend finisher argument
57 */
58ENTRY(__cpu_suspend)
59 stp x29, lr, [sp, #-96]!
60 stp x19, x20, [sp,#16]
61 stp x21, x22, [sp,#32]
62 stp x23, x24, [sp,#48]
63 stp x25, x26, [sp,#64]
64 stp x27, x28, [sp,#80]
65 mov x2, sp
66 sub sp, sp, #CPU_SUSPEND_SZ // allocate cpu_suspend_ctx
67 mov x1, sp
68 /*
69 * x1 now points to struct cpu_suspend_ctx allocated on the stack
70 */
71 str x2, [x1, #CPU_CTX_SP]
72 ldr x2, =sleep_save_sp
73 ldr x2, [x2, #SLEEP_SAVE_SP_VIRT]
74#ifdef CONFIG_SMP
75 mrs x7, mpidr_el1
76 ldr x9, =mpidr_hash
77 ldr x10, [x9, #MPIDR_HASH_MASK]
78 /*
79 * Following code relies on the struct mpidr_hash
80 * members size.
81 */
82 ldp w3, w4, [x9, #MPIDR_HASH_SHIFTS]
83 ldp w5, w6, [x9, #(MPIDR_HASH_SHIFTS + 8)]
84 compute_mpidr_hash x8, x3, x4, x5, x6, x7, x10
85 add x2, x2, x8, lsl #3
86#endif
87 bl __cpu_suspend_finisher
88 /*
89 * Never gets here, unless suspend fails.
90 * Successful cpu_suspend should return from cpu_resume, returning
91 * through this code path is considered an error
92 * If the return value is set to 0 force x0 = -EOPNOTSUPP
93 * to make sure a proper error condition is propagated
94 */
95 cmp x0, #0
96 mov x3, #-EOPNOTSUPP
97 csel x0, x3, x0, eq
98 add sp, sp, #CPU_SUSPEND_SZ // rewind stack pointer
99 ldp x19, x20, [sp, #16]
100 ldp x21, x22, [sp, #32]
101 ldp x23, x24, [sp, #48]
102 ldp x25, x26, [sp, #64]
103 ldp x27, x28, [sp, #80]
104 ldp x29, lr, [sp], #96
105 ret
106ENDPROC(__cpu_suspend)
107 .ltorg
108
109/*
110 * x0 must contain the sctlr value retrieved from restored context
111 */
112ENTRY(cpu_resume_mmu)
113 ldr x3, =cpu_resume_after_mmu
114 msr sctlr_el1, x0 // restore sctlr_el1
115 isb
116 br x3 // global jump to virtual address
117ENDPROC(cpu_resume_mmu)
118cpu_resume_after_mmu:
119 mov x0, #0 // return zero on success
120 ldp x19, x20, [sp, #16]
121 ldp x21, x22, [sp, #32]
122 ldp x23, x24, [sp, #48]
123 ldp x25, x26, [sp, #64]
124 ldp x27, x28, [sp, #80]
125 ldp x29, lr, [sp], #96
126 ret
127ENDPROC(cpu_resume_after_mmu)
128
129 .data
130ENTRY(cpu_resume)
131 bl el2_setup // if in EL2 drop to EL1 cleanly
132#ifdef CONFIG_SMP
133 mrs x1, mpidr_el1
134 adr x4, mpidr_hash_ptr
135 ldr x5, [x4]
136 add x8, x4, x5 // x8 = struct mpidr_hash phys address
137 /* retrieve mpidr_hash members to compute the hash */
138 ldr x2, [x8, #MPIDR_HASH_MASK]
139 ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS]
140 ldp w5, w6, [x8, #(MPIDR_HASH_SHIFTS + 8)]
141 compute_mpidr_hash x7, x3, x4, x5, x6, x1, x2
142 /* x7 contains hash index, let's use it to grab context pointer */
143#else
144 mov x7, xzr
145#endif
146 adr x0, sleep_save_sp
147 ldr x0, [x0, #SLEEP_SAVE_SP_PHYS]
148 ldr x0, [x0, x7, lsl #3]
149 /* load sp from context */
150 ldr x2, [x0, #CPU_CTX_SP]
151 adr x1, sleep_idmap_phys
152 /* load physical address of identity map page table in x1 */
153 ldr x1, [x1]
154 mov sp, x2
155 /*
156 * cpu_do_resume expects x0 to contain context physical address
157 * pointer and x1 to contain physical address of 1:1 page tables
158 */
159 bl cpu_do_resume // PC relative jump, MMU off
160 b cpu_resume_mmu // Resume MMU, never returns
161ENDPROC(cpu_resume)
162
163 .align 3
164mpidr_hash_ptr:
165 /*
166 * offset of mpidr_hash symbol from current location
167 * used to obtain run-time mpidr_hash address with MMU off
168 */
169 .quad mpidr_hash - .
170/*
171 * physical address of identity mapped page tables
172 */
173 .type sleep_idmap_phys, #object
174ENTRY(sleep_idmap_phys)
175 .quad 0
176/*
177 * struct sleep_save_sp {
178 * phys_addr_t *save_ptr_stash;
179 * phys_addr_t save_ptr_stash_phys;
180 * };
181 */
182 .type sleep_save_sp, #object
183ENTRY(sleep_save_sp)
184 .space SLEEP_SAVE_SP_SZ // struct sleep_save_sp
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index a0c2ca602cf8..7cfb92a4ab66 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -61,6 +61,7 @@ enum ipi_msg_type {
61 IPI_CALL_FUNC, 61 IPI_CALL_FUNC,
62 IPI_CALL_FUNC_SINGLE, 62 IPI_CALL_FUNC_SINGLE,
63 IPI_CPU_STOP, 63 IPI_CPU_STOP,
64 IPI_TIMER,
64}; 65};
65 66
66/* 67/*
@@ -122,8 +123,6 @@ asmlinkage void secondary_start_kernel(void)
122 struct mm_struct *mm = &init_mm; 123 struct mm_struct *mm = &init_mm;
123 unsigned int cpu = smp_processor_id(); 124 unsigned int cpu = smp_processor_id();
124 125
125 printk("CPU%u: Booted secondary processor\n", cpu);
126
127 /* 126 /*
128 * All kernel threads share the same mm context; grab a 127 * All kernel threads share the same mm context; grab a
129 * reference and switch to it. 128 * reference and switch to it.
@@ -132,6 +131,9 @@ asmlinkage void secondary_start_kernel(void)
132 current->active_mm = mm; 131 current->active_mm = mm;
133 cpumask_set_cpu(cpu, mm_cpumask(mm)); 132 cpumask_set_cpu(cpu, mm_cpumask(mm));
134 133
134 set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
135 printk("CPU%u: Booted secondary processor\n", cpu);
136
135 /* 137 /*
136 * TTBR0 is only used for the identity mapping at this stage. Make it 138 * TTBR0 is only used for the identity mapping at this stage. Make it
137 * point to zero page to avoid speculatively fetching new entries. 139 * point to zero page to avoid speculatively fetching new entries.
@@ -159,7 +161,6 @@ asmlinkage void secondary_start_kernel(void)
159 complete(&cpu_running); 161 complete(&cpu_running);
160 162
161 local_irq_enable(); 163 local_irq_enable();
162 local_fiq_enable();
163 local_async_enable(); 164 local_async_enable();
164 165
165 /* 166 /*
@@ -271,6 +272,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
271 272
272void __init smp_prepare_boot_cpu(void) 273void __init smp_prepare_boot_cpu(void)
273{ 274{
275 set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
274} 276}
275 277
276static void (*smp_cross_call)(const struct cpumask *, unsigned int); 278static void (*smp_cross_call)(const struct cpumask *, unsigned int);
@@ -447,6 +449,7 @@ static const char *ipi_types[NR_IPI] = {
447 S(IPI_CALL_FUNC, "Function call interrupts"), 449 S(IPI_CALL_FUNC, "Function call interrupts"),
448 S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"), 450 S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"),
449 S(IPI_CPU_STOP, "CPU stop interrupts"), 451 S(IPI_CPU_STOP, "CPU stop interrupts"),
452 S(IPI_TIMER, "Timer broadcast interrupts"),
450}; 453};
451 454
452void show_ipi_list(struct seq_file *p, int prec) 455void show_ipi_list(struct seq_file *p, int prec)
@@ -491,7 +494,6 @@ static void ipi_cpu_stop(unsigned int cpu)
491 494
492 set_cpu_online(cpu, false); 495 set_cpu_online(cpu, false);
493 496
494 local_fiq_disable();
495 local_irq_disable(); 497 local_irq_disable();
496 498
497 while (1) 499 while (1)
@@ -532,6 +534,14 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
532 irq_exit(); 534 irq_exit();
533 break; 535 break;
534 536
537#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
538 case IPI_TIMER:
539 irq_enter();
540 tick_receive_broadcast();
541 irq_exit();
542 break;
543#endif
544
535 default: 545 default:
536 pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr); 546 pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr);
537 break; 547 break;
@@ -544,6 +554,13 @@ void smp_send_reschedule(int cpu)
544 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); 554 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
545} 555}
546 556
557#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
558void tick_broadcast(const struct cpumask *mask)
559{
560 smp_cross_call(mask, IPI_TIMER);
561}
562#endif
563
547void smp_send_stop(void) 564void smp_send_stop(void)
548{ 565{
549 unsigned long timeout; 566 unsigned long timeout;
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index d25459ff57fc..c3b6c63ea5fb 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -43,7 +43,7 @@ int unwind_frame(struct stackframe *frame)
43 low = frame->sp; 43 low = frame->sp;
44 high = ALIGN(low, THREAD_SIZE); 44 high = ALIGN(low, THREAD_SIZE);
45 45
46 if (fp < low || fp > high || fp & 0xf) 46 if (fp < low || fp > high - 0x18 || fp & 0xf)
47 return -EINVAL; 47 return -EINVAL;
48 48
49 frame->sp = fp + 0x10; 49 frame->sp = fp + 0x10;
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
new file mode 100644
index 000000000000..1fa9ce4afd8f
--- /dev/null
+++ b/arch/arm64/kernel/suspend.c
@@ -0,0 +1,140 @@
1#include <linux/percpu.h>
2#include <linux/slab.h>
3#include <asm/cacheflush.h>
4#include <asm/cpu_ops.h>
5#include <asm/debug-monitors.h>
6#include <asm/pgtable.h>
7#include <asm/memory.h>
8#include <asm/smp_plat.h>
9#include <asm/suspend.h>
10#include <asm/tlbflush.h>
11
12extern int __cpu_suspend(unsigned long);
13/*
14 * This is called by __cpu_suspend() to save the state, and do whatever
15 * flushing is required to ensure that when the CPU goes to sleep we have
16 * the necessary data available when the caches are not searched.
17 *
18 * @arg: Argument to pass to suspend operations
19 * @ptr: CPU context virtual address
20 * @save_ptr: address of the location where the context physical address
21 * must be saved
22 */
23int __cpu_suspend_finisher(unsigned long arg, struct cpu_suspend_ctx *ptr,
24 phys_addr_t *save_ptr)
25{
26 int cpu = smp_processor_id();
27
28 *save_ptr = virt_to_phys(ptr);
29
30 cpu_do_suspend(ptr);
31 /*
32 * Only flush the context that must be retrieved with the MMU
33 * off. VA primitives ensure the flush is applied to all
34 * cache levels so context is pushed to DRAM.
35 */
36 __flush_dcache_area(ptr, sizeof(*ptr));
37 __flush_dcache_area(save_ptr, sizeof(*save_ptr));
38
39 return cpu_ops[cpu]->cpu_suspend(arg);
40}
41
42/*
43 * This hook is provided so that cpu_suspend code can restore HW
44 * breakpoints as early as possible in the resume path, before reenabling
45 * debug exceptions. Code cannot be run from a CPU PM notifier since by the
46 * time the notifier runs debug exceptions might have been enabled already,
47 * with HW breakpoints registers content still in an unknown state.
48 */
49void (*hw_breakpoint_restore)(void *);
50void __init cpu_suspend_set_dbg_restorer(void (*hw_bp_restore)(void *))
51{
52 /* Prevent multiple restore hook initializations */
53 if (WARN_ON(hw_breakpoint_restore))
54 return;
55 hw_breakpoint_restore = hw_bp_restore;
56}
57
58/**
59 * cpu_suspend
60 *
61 * @arg: argument to pass to the finisher function
62 */
63int cpu_suspend(unsigned long arg)
64{
65 struct mm_struct *mm = current->active_mm;
66 int ret, cpu = smp_processor_id();
67 unsigned long flags;
68
69 /*
70 * If cpu_ops have not been registered or suspend
71 * has not been initialized, cpu_suspend call fails early.
72 */
73 if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_suspend)
74 return -EOPNOTSUPP;
75
76 /*
77 * From this point debug exceptions are disabled to prevent
78 * updates to mdscr register (saved and restored along with
79 * general purpose registers) from kernel debuggers.
80 */
81 local_dbg_save(flags);
82
83 /*
84 * mm context saved on the stack, it will be restored when
85 * the cpu comes out of reset through the identity mapped
86 * page tables, so that the thread address space is properly
87 * set-up on function return.
88 */
89 ret = __cpu_suspend(arg);
90 if (ret == 0) {
91 cpu_switch_mm(mm->pgd, mm);
92 flush_tlb_all();
93
94 /*
95 * Restore per-cpu offset before any kernel
96 * subsystem relying on it has a chance to run.
97 */
98 set_my_cpu_offset(per_cpu_offset(cpu));
99
100 /*
101 * Restore HW breakpoint registers to sane values
102 * before debug exceptions are possibly reenabled
103 * through local_dbg_restore.
104 */
105 if (hw_breakpoint_restore)
106 hw_breakpoint_restore(NULL);
107 }
108
109 /*
110 * Restore pstate flags. OS lock and mdscr have been already
111 * restored, so from this point onwards, debugging is fully
112 * renabled if it was enabled when core started shutdown.
113 */
114 local_dbg_restore(flags);
115
116 return ret;
117}
118
119extern struct sleep_save_sp sleep_save_sp;
120extern phys_addr_t sleep_idmap_phys;
121
122static int cpu_suspend_init(void)
123{
124 void *ctx_ptr;
125
126 /* ctx_ptr is an array of physical addresses */
127 ctx_ptr = kcalloc(mpidr_hash_size(), sizeof(phys_addr_t), GFP_KERNEL);
128
129 if (WARN_ON(!ctx_ptr))
130 return -ENOMEM;
131
132 sleep_save_sp.save_ptr_stash = ctx_ptr;
133 sleep_save_sp.save_ptr_stash_phys = virt_to_phys(ctx_ptr);
134 sleep_idmap_phys = virt_to_phys(idmap_pg_dir);
135 __flush_dcache_area(&sleep_save_sp, sizeof(struct sleep_save_sp));
136 __flush_dcache_area(&sleep_idmap_phys, sizeof(sleep_idmap_phys));
137
138 return 0;
139}
140early_initcall(cpu_suspend_init);
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 5161ad992091..4ba7a55b49c7 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -99,17 +99,14 @@ SECTIONS
99 99
100 . = ALIGN(PAGE_SIZE); 100 . = ALIGN(PAGE_SIZE);
101 _data = .; 101 _data = .;
102 __data_loc = _data - LOAD_OFFSET;
103 _sdata = .; 102 _sdata = .;
104 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE) 103 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
105 _edata = .; 104 _edata = .;
106 _edata_loc = __data_loc + SIZEOF(.data);
107 105
108 BSS_SECTION(0, 0, 0) 106 BSS_SECTION(0, 0, 0)
109 _end = .; 107 _end = .;
110 108
111 STABS_DEBUG 109 STABS_DEBUG
112 .comment 0 : { *(.comment) }
113} 110}
114 111
115/* 112/*
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index 4480ab339a00..8ba85e9ea388 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -36,6 +36,17 @@ config KVM_ARM_HOST
36 ---help--- 36 ---help---
37 Provides host support for ARM processors. 37 Provides host support for ARM processors.
38 38
39config KVM_ARM_MAX_VCPUS
40 int "Number maximum supported virtual CPUs per VM"
41 depends on KVM_ARM_HOST
42 default 4
43 help
44 Static number of max supported virtual CPUs per VM.
45
46 If you choose a high number, the vcpu structures will be quite
47 large, so only choose a reasonable number that you expect to
48 actually use.
49
39config KVM_ARM_VGIC 50config KVM_ARM_VGIC
40 bool 51 bool
41 depends on KVM_ARM_HOST && OF 52 depends on KVM_ARM_HOST && OF
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 3f0731e53274..08745578d54d 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -207,20 +207,26 @@ int __attribute_const__ kvm_target_cpu(void)
207 unsigned long implementor = read_cpuid_implementor(); 207 unsigned long implementor = read_cpuid_implementor();
208 unsigned long part_number = read_cpuid_part_number(); 208 unsigned long part_number = read_cpuid_part_number();
209 209
210 if (implementor != ARM_CPU_IMP_ARM) 210 switch (implementor) {
211 return -EINVAL; 211 case ARM_CPU_IMP_ARM:
212 switch (part_number) {
213 case ARM_CPU_PART_AEM_V8:
214 return KVM_ARM_TARGET_AEM_V8;
215 case ARM_CPU_PART_FOUNDATION:
216 return KVM_ARM_TARGET_FOUNDATION_V8;
217 case ARM_CPU_PART_CORTEX_A57:
218 return KVM_ARM_TARGET_CORTEX_A57;
219 };
220 break;
221 case ARM_CPU_IMP_APM:
222 switch (part_number) {
223 case APM_CPU_PART_POTENZA:
224 return KVM_ARM_TARGET_XGENE_POTENZA;
225 };
226 break;
227 };
212 228
213 switch (part_number) { 229 return -EINVAL;
214 case ARM_CPU_PART_AEM_V8:
215 return KVM_ARM_TARGET_AEM_V8;
216 case ARM_CPU_PART_FOUNDATION:
217 return KVM_ARM_TARGET_FOUNDATION_V8;
218 case ARM_CPU_PART_CORTEX_A57:
219 /* Currently handled by the generic backend */
220 return KVM_ARM_TARGET_CORTEX_A57;
221 default:
222 return -EINVAL;
223 }
224} 230}
225 231
226int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, 232int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index 8da56067c304..7bc41eab4c64 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -39,9 +39,6 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
39 39
40static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run) 40static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
41{ 41{
42 if (kvm_psci_call(vcpu))
43 return 1;
44
45 kvm_inject_undefined(vcpu); 42 kvm_inject_undefined(vcpu);
46 return 1; 43 return 1;
47} 44}
@@ -90,7 +87,7 @@ static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu)
90 87
91 if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) || 88 if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
92 !arm_exit_handlers[hsr_ec]) { 89 !arm_exit_handlers[hsr_ec]) {
93 kvm_err("Unkown exception class: hsr: %#08x\n", 90 kvm_err("Unknown exception class: hsr: %#08x\n",
94 (unsigned int)kvm_vcpu_get_hsr(vcpu)); 91 (unsigned int)kvm_vcpu_get_hsr(vcpu));
95 BUG(); 92 BUG();
96 } 93 }
diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c
index 4268ab9356b1..8fe6f76b0edc 100644
--- a/arch/arm64/kvm/sys_regs_generic_v8.c
+++ b/arch/arm64/kvm/sys_regs_generic_v8.c
@@ -90,6 +90,9 @@ static int __init sys_reg_genericv8_init(void)
90 &genericv8_target_table); 90 &genericv8_target_table);
91 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57, 91 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57,
92 &genericv8_target_table); 92 &genericv8_target_table);
93 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_XGENE_POTENZA,
94 &genericv8_target_table);
95
93 return 0; 96 return 0;
94} 97}
95late_initcall(sys_reg_genericv8_init); 98late_initcall(sys_reg_genericv8_init);
diff --git a/arch/arm64/lib/Makefile b/arch/arm64/lib/Makefile
index 59acc0ef0462..328ce1a99daa 100644
--- a/arch/arm64/lib/Makefile
+++ b/arch/arm64/lib/Makefile
@@ -1,6 +1,4 @@
1lib-y := bitops.o delay.o \ 1lib-y := bitops.o clear_user.o delay.o copy_from_user.o \
2 strncpy_from_user.o strnlen_user.o clear_user.o \ 2 copy_to_user.o copy_in_user.o copy_page.o \
3 copy_from_user.o copy_to_user.o copy_in_user.o \ 3 clear_page.o memchr.o memcpy.o memmove.o memset.o \
4 copy_page.o clear_page.o \
5 memchr.o memcpy.o memmove.o memset.o \
6 strchr.o strrchr.o 4 strchr.o strrchr.o
diff --git a/arch/arm64/lib/strncpy_from_user.S b/arch/arm64/lib/strncpy_from_user.S
deleted file mode 100644
index 56e448a831a0..000000000000
--- a/arch/arm64/lib/strncpy_from_user.S
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Based on arch/arm/lib/strncpy_from_user.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 * Copyright (C) 2012 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/linkage.h>
21#include <asm/assembler.h>
22#include <asm/errno.h>
23
24 .text
25 .align 5
26
27/*
28 * Copy a string from user space to kernel space.
29 * x0 = dst, x1 = src, x2 = byte length
30 * returns the number of characters copied (strlen of copied string),
31 * -EFAULT on exception, or "len" if we fill the whole buffer
32 */
33ENTRY(__strncpy_from_user)
34 mov x4, x1
351: subs x2, x2, #1
36 bmi 2f
37USER(9f, ldrb w3, [x1], #1 )
38 strb w3, [x0], #1
39 cbnz w3, 1b
40 sub x1, x1, #1 // take NUL character out of count
412: sub x0, x1, x4
42 ret
43ENDPROC(__strncpy_from_user)
44
45 .section .fixup,"ax"
46 .align 0
479: strb wzr, [x0] // null terminate
48 mov x0, #-EFAULT
49 ret
50 .previous
diff --git a/arch/arm64/lib/strnlen_user.S b/arch/arm64/lib/strnlen_user.S
deleted file mode 100644
index 7f7b176a5646..000000000000
--- a/arch/arm64/lib/strnlen_user.S
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * Based on arch/arm/lib/strnlen_user.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 * Copyright (C) 2012 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/linkage.h>
21#include <asm/assembler.h>
22#include <asm/errno.h>
23
24 .text
25 .align 5
26
27/* Prototype: unsigned long __strnlen_user(const char *str, long n)
28 * Purpose : get length of a string in user memory
29 * Params : str - address of string in user memory
30 * Returns : length of string *including terminator*
31 * or zero on exception, or n if too long
32 */
33ENTRY(__strnlen_user)
34 mov x2, x0
351: subs x1, x1, #1
36 b.mi 2f
37USER(9f, ldrb w3, [x0], #1 )
38 cbnz w3, 1b
392: sub x0, x0, x2
40 ret
41ENDPROC(__strnlen_user)
42
43 .section .fixup,"ax"
44 .align 0
459: mov x0, #0
46 ret
47 .previous
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 48a386094fa3..1ea9f26d1b70 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -146,7 +146,7 @@ ENDPROC(flush_icache_range)
146ENDPROC(__flush_cache_user_range) 146ENDPROC(__flush_cache_user_range)
147 147
148/* 148/*
149 * __flush_kern_dcache_page(kaddr) 149 * __flush_dcache_area(kaddr, size)
150 * 150 *
151 * Ensure that the data held in the page kaddr is written back to the 151 * Ensure that the data held in the page kaddr is written back to the
152 * page in question. 152 * page in question.
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 4bd7579ec9e6..45b5ab54c9ee 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -21,6 +21,7 @@
21#include <linux/export.h> 21#include <linux/export.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/dma-contiguous.h>
24#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
25#include <linux/swiotlb.h> 26#include <linux/swiotlb.h>
26 27
@@ -33,17 +34,47 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
33 dma_addr_t *dma_handle, gfp_t flags, 34 dma_addr_t *dma_handle, gfp_t flags,
34 struct dma_attrs *attrs) 35 struct dma_attrs *attrs)
35{ 36{
37 if (dev == NULL) {
38 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
39 return NULL;
40 }
41
36 if (IS_ENABLED(CONFIG_ZONE_DMA32) && 42 if (IS_ENABLED(CONFIG_ZONE_DMA32) &&
37 dev->coherent_dma_mask <= DMA_BIT_MASK(32)) 43 dev->coherent_dma_mask <= DMA_BIT_MASK(32))
38 flags |= GFP_DMA32; 44 flags |= GFP_DMA32;
39 return swiotlb_alloc_coherent(dev, size, dma_handle, flags); 45 if (IS_ENABLED(CONFIG_DMA_CMA)) {
46 struct page *page;
47
48 page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT,
49 get_order(size));
50 if (!page)
51 return NULL;
52
53 *dma_handle = phys_to_dma(dev, page_to_phys(page));
54 return page_address(page);
55 } else {
56 return swiotlb_alloc_coherent(dev, size, dma_handle, flags);
57 }
40} 58}
41 59
42static void arm64_swiotlb_free_coherent(struct device *dev, size_t size, 60static void arm64_swiotlb_free_coherent(struct device *dev, size_t size,
43 void *vaddr, dma_addr_t dma_handle, 61 void *vaddr, dma_addr_t dma_handle,
44 struct dma_attrs *attrs) 62 struct dma_attrs *attrs)
45{ 63{
46 swiotlb_free_coherent(dev, size, vaddr, dma_handle); 64 if (dev == NULL) {
65 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
66 return;
67 }
68
69 if (IS_ENABLED(CONFIG_DMA_CMA)) {
70 phys_addr_t paddr = dma_to_phys(dev, dma_handle);
71
72 dma_release_from_contiguous(dev,
73 phys_to_page(paddr),
74 size >> PAGE_SHIFT);
75 } else {
76 swiotlb_free_coherent(dev, size, vaddr, dma_handle);
77 }
47} 78}
48 79
49static struct dma_map_ops arm64_swiotlb_dma_ops = { 80static struct dma_map_ops arm64_swiotlb_dma_ops = {
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 0cb8742de4f2..d0b4c2efda90 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -30,6 +30,7 @@
30#include <linux/memblock.h> 30#include <linux/memblock.h>
31#include <linux/sort.h> 31#include <linux/sort.h>
32#include <linux/of_fdt.h> 32#include <linux/of_fdt.h>
33#include <linux/dma-contiguous.h>
33 34
34#include <asm/sections.h> 35#include <asm/sections.h>
35#include <asm/setup.h> 36#include <asm/setup.h>
@@ -159,6 +160,8 @@ void __init arm64_memblock_init(void)
159 memblock_reserve(base, size); 160 memblock_reserve(base, size);
160 } 161 }
161 162
163 dma_contiguous_reserve(0);
164
162 memblock_allow_resize(); 165 memblock_allow_resize();
163 memblock_dump_all(); 166 memblock_dump_all();
164} 167}
diff --git a/arch/arm64/mm/proc-macros.S b/arch/arm64/mm/proc-macros.S
index 8957b822010b..005d29e2977d 100644
--- a/arch/arm64/mm/proc-macros.S
+++ b/arch/arm64/mm/proc-macros.S
@@ -38,8 +38,7 @@
38 */ 38 */
39 .macro dcache_line_size, reg, tmp 39 .macro dcache_line_size, reg, tmp
40 mrs \tmp, ctr_el0 // read CTR 40 mrs \tmp, ctr_el0 // read CTR
41 lsr \tmp, \tmp, #16 41 ubfm \tmp, \tmp, #16, #19 // cache line size encoding
42 and \tmp, \tmp, #0xf // cache line size encoding
43 mov \reg, #4 // bytes per word 42 mov \reg, #4 // bytes per word
44 lsl \reg, \reg, \tmp // actual cache line size 43 lsl \reg, \reg, \tmp // actual cache line size
45 .endm 44 .endm
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index 0f7fec52c7f8..1333e6f9a8e5 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -80,8 +80,77 @@ ENTRY(cpu_do_idle)
80 ret 80 ret
81ENDPROC(cpu_do_idle) 81ENDPROC(cpu_do_idle)
82 82
83#ifdef CONFIG_ARM64_CPU_SUSPEND
84/**
85 * cpu_do_suspend - save CPU registers context
86 *
87 * x0: virtual address of context pointer
88 */
89ENTRY(cpu_do_suspend)
90 mrs x2, tpidr_el0
91 mrs x3, tpidrro_el0
92 mrs x4, contextidr_el1
93 mrs x5, mair_el1
94 mrs x6, cpacr_el1
95 mrs x7, ttbr1_el1
96 mrs x8, tcr_el1
97 mrs x9, vbar_el1
98 mrs x10, mdscr_el1
99 mrs x11, oslsr_el1
100 mrs x12, sctlr_el1
101 stp x2, x3, [x0]
102 stp x4, x5, [x0, #16]
103 stp x6, x7, [x0, #32]
104 stp x8, x9, [x0, #48]
105 stp x10, x11, [x0, #64]
106 str x12, [x0, #80]
107 ret
108ENDPROC(cpu_do_suspend)
109
110/**
111 * cpu_do_resume - restore CPU register context
112 *
113 * x0: Physical address of context pointer
114 * x1: ttbr0_el1 to be restored
115 *
116 * Returns:
117 * sctlr_el1 value in x0
118 */
119ENTRY(cpu_do_resume)
120 /*
121 * Invalidate local tlb entries before turning on MMU
122 */
123 tlbi vmalle1
124 ldp x2, x3, [x0]
125 ldp x4, x5, [x0, #16]
126 ldp x6, x7, [x0, #32]
127 ldp x8, x9, [x0, #48]
128 ldp x10, x11, [x0, #64]
129 ldr x12, [x0, #80]
130 msr tpidr_el0, x2
131 msr tpidrro_el0, x3
132 msr contextidr_el1, x4
133 msr mair_el1, x5
134 msr cpacr_el1, x6
135 msr ttbr0_el1, x1
136 msr ttbr1_el1, x7
137 msr tcr_el1, x8
138 msr vbar_el1, x9
139 msr mdscr_el1, x10
140 /*
141 * Restore oslsr_el1 by writing oslar_el1
142 */
143 ubfx x11, x11, #1, #1
144 msr oslar_el1, x11
145 mov x0, x12
146 dsb nsh // Make sure local tlb invalidation completed
147 isb
148 ret
149ENDPROC(cpu_do_resume)
150#endif
151
83/* 152/*
84 * cpu_switch_mm(pgd_phys, tsk) 153 * cpu_do_switch_mm(pgd_phys, tsk)
85 * 154 *
86 * Set the translation table base pointer to be pgd_phys. 155 * Set the translation table base pointer to be pgd_phys.
87 * 156 *
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 658001b52400..cfb9fe1b8df9 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -18,3 +18,4 @@ generic-y += sections.h
18generic-y += topology.h 18generic-y += topology.h
19generic-y += trace_clock.h 19generic-y += trace_clock.h
20generic-y += xor.h 20generic-y += xor.h
21generic-y += hash.h
diff --git a/arch/avr32/include/uapi/asm/socket.h b/arch/avr32/include/uapi/asm/socket.h
index cbf902e4cd9e..6e6cd159924b 100644
--- a/arch/avr32/include/uapi/asm/socket.h
+++ b/arch/avr32/include/uapi/asm/socket.h
@@ -78,4 +78,6 @@
78 78
79#define SO_MAX_PACING_RATE 47 79#define SO_MAX_PACING_RATE 47
80 80
81#define SO_BPF_EXTENSIONS 48
82
81#endif /* _UAPI__ASM_AVR32_SOCKET_H */ 83#endif /* _UAPI__ASM_AVR32_SOCKET_H */
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 90b175323644..af2738c7441b 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -146,6 +146,7 @@ CONFIG_USB_DEVICEFS=y
146CONFIG_USB_OTG_BLACKLIST_HUB=y 146CONFIG_USB_OTG_BLACKLIST_HUB=y
147CONFIG_USB_MON=y 147CONFIG_USB_MON=y
148CONFIG_USB_MUSB_HDRC=y 148CONFIG_USB_MUSB_HDRC=y
149CONFIG_MUSB_PIO_ONLY=y
149CONFIG_USB_MUSB_BLACKFIN=y 150CONFIG_USB_MUSB_BLACKFIN=y
150CONFIG_MUSB_PIO_ONLY=y 151CONFIG_MUSB_PIO_ONLY=y
151CONFIG_USB_STORAGE=y 152CONFIG_USB_STORAGE=y
diff --git a/arch/blackfin/configs/BF538-EZKIT_defconfig b/arch/blackfin/configs/BF538-EZKIT_defconfig
index 972aa6263ad0..be03be6ba543 100644
--- a/arch/blackfin/configs/BF538-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF538-EZKIT_defconfig
@@ -59,7 +59,6 @@ CONFIG_BFIN_SIR=m
59CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 59CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
60# CONFIG_FW_LOADER is not set 60# CONFIG_FW_LOADER is not set
61CONFIG_MTD=y 61CONFIG_MTD=y
62CONFIG_MTD_PARTITIONS=y
63CONFIG_MTD_CMDLINE_PARTS=y 62CONFIG_MTD_CMDLINE_PARTS=y
64CONFIG_MTD_CHAR=m 63CONFIG_MTD_CHAR=m
65CONFIG_MTD_BLOCK=y 64CONFIG_MTD_BLOCK=y
diff --git a/arch/blackfin/configs/BF561-ACVILON_defconfig b/arch/blackfin/configs/BF561-ACVILON_defconfig
index 91988370b75e..802f9c421621 100644
--- a/arch/blackfin/configs/BF561-ACVILON_defconfig
+++ b/arch/blackfin/configs/BF561-ACVILON_defconfig
@@ -49,7 +49,6 @@ CONFIG_SYN_COOKIES=y
49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
50# CONFIG_FW_LOADER is not set 50# CONFIG_FW_LOADER is not set
51CONFIG_MTD=y 51CONFIG_MTD=y
52CONFIG_MTD_PARTITIONS=y
53CONFIG_MTD_CMDLINE_PARTS=y 52CONFIG_MTD_CMDLINE_PARTS=y
54CONFIG_MTD_CHAR=y 53CONFIG_MTD_CHAR=y
55CONFIG_MTD_BLOCK=y 54CONFIG_MTD_BLOCK=y
diff --git a/arch/blackfin/configs/BlackStamp_defconfig b/arch/blackfin/configs/BlackStamp_defconfig
index 7b982d0502ad..3853c473b443 100644
--- a/arch/blackfin/configs/BlackStamp_defconfig
+++ b/arch/blackfin/configs/BlackStamp_defconfig
@@ -44,7 +44,6 @@ CONFIG_IP_PNP=y
44CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 44CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
45# CONFIG_FW_LOADER is not set 45# CONFIG_FW_LOADER is not set
46CONFIG_MTD=y 46CONFIG_MTD=y
47CONFIG_MTD_PARTITIONS=y
48CONFIG_MTD_CMDLINE_PARTS=y 47CONFIG_MTD_CMDLINE_PARTS=y
49CONFIG_MTD_CHAR=m 48CONFIG_MTD_CHAR=m
50CONFIG_MTD_BLOCK=y 49CONFIG_MTD_BLOCK=y
diff --git a/arch/blackfin/configs/CM-BF533_defconfig b/arch/blackfin/configs/CM-BF533_defconfig
index c940a1e3ab36..5e0db82b679e 100644
--- a/arch/blackfin/configs/CM-BF533_defconfig
+++ b/arch/blackfin/configs/CM-BF533_defconfig
@@ -36,7 +36,6 @@ CONFIG_UNIX=y
36# CONFIG_WIRELESS is not set 36# CONFIG_WIRELESS is not set
37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
38CONFIG_MTD=y 38CONFIG_MTD=y
39CONFIG_MTD_PARTITIONS=y
40CONFIG_MTD_CMDLINE_PARTS=y 39CONFIG_MTD_CMDLINE_PARTS=y
41CONFIG_MTD_CHAR=y 40CONFIG_MTD_CHAR=y
42CONFIG_MTD_BLOCK=y 41CONFIG_MTD_BLOCK=y
diff --git a/arch/blackfin/configs/CM-BF548_defconfig b/arch/blackfin/configs/CM-BF548_defconfig
index e961483f1879..b9af4fa69984 100644
--- a/arch/blackfin/configs/CM-BF548_defconfig
+++ b/arch/blackfin/configs/CM-BF548_defconfig
@@ -53,7 +53,6 @@ CONFIG_INET_XFRM_MODE_BEET=m
53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
54# CONFIG_FW_LOADER is not set 54# CONFIG_FW_LOADER is not set
55CONFIG_MTD=y 55CONFIG_MTD=y
56CONFIG_MTD_PARTITIONS=y
57CONFIG_MTD_CMDLINE_PARTS=y 56CONFIG_MTD_CMDLINE_PARTS=y
58CONFIG_MTD_CHAR=y 57CONFIG_MTD_CHAR=y
59CONFIG_MTD_BLOCK=y 58CONFIG_MTD_BLOCK=y
diff --git a/arch/blackfin/configs/CM-BF561_defconfig b/arch/blackfin/configs/CM-BF561_defconfig
index 24936b91a6ee..d6dd98e67146 100644
--- a/arch/blackfin/configs/CM-BF561_defconfig
+++ b/arch/blackfin/configs/CM-BF561_defconfig
@@ -51,7 +51,6 @@ CONFIG_INET=y
51# CONFIG_WIRELESS is not set 51# CONFIG_WIRELESS is not set
52CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 52CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
53CONFIG_MTD=y 53CONFIG_MTD=y
54CONFIG_MTD_PARTITIONS=y
55CONFIG_MTD_CMDLINE_PARTS=y 54CONFIG_MTD_CMDLINE_PARTS=y
56CONFIG_MTD_CHAR=y 55CONFIG_MTD_CHAR=y
57CONFIG_MTD_BLOCK=y 56CONFIG_MTD_BLOCK=y
diff --git a/arch/blackfin/configs/DNP5370_defconfig b/arch/blackfin/configs/DNP5370_defconfig
index 89162d0fff9e..2b58cb221283 100644
--- a/arch/blackfin/configs/DNP5370_defconfig
+++ b/arch/blackfin/configs/DNP5370_defconfig
@@ -36,7 +36,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
36CONFIG_MTD=y 36CONFIG_MTD=y
37CONFIG_MTD_DEBUG=y 37CONFIG_MTD_DEBUG=y
38CONFIG_MTD_DEBUG_VERBOSE=1 38CONFIG_MTD_DEBUG_VERBOSE=1
39CONFIG_MTD_PARTITIONS=y
40CONFIG_MTD_CHAR=y 39CONFIG_MTD_CHAR=y
41CONFIG_MTD_BLOCK=y 40CONFIG_MTD_BLOCK=y
42CONFIG_NFTL=y 41CONFIG_NFTL=y
diff --git a/arch/blackfin/configs/H8606_defconfig b/arch/blackfin/configs/H8606_defconfig
index a26436bf50ff..f754e490bbfd 100644
--- a/arch/blackfin/configs/H8606_defconfig
+++ b/arch/blackfin/configs/H8606_defconfig
@@ -36,7 +36,6 @@ CONFIG_IRTTY_SIR=m
36# CONFIG_WIRELESS is not set 36# CONFIG_WIRELESS is not set
37# CONFIG_FW_LOADER is not set 37# CONFIG_FW_LOADER is not set
38CONFIG_MTD=y 38CONFIG_MTD=y
39CONFIG_MTD_PARTITIONS=y
40CONFIG_MTD_CHAR=y 39CONFIG_MTD_CHAR=y
41CONFIG_MTD_BLOCK=y 40CONFIG_MTD_BLOCK=y
42CONFIG_MTD_RAM=y 41CONFIG_MTD_RAM=y
diff --git a/arch/blackfin/configs/IP0X_defconfig b/arch/blackfin/configs/IP0X_defconfig
index 647991514ac9..629516578760 100644
--- a/arch/blackfin/configs/IP0X_defconfig
+++ b/arch/blackfin/configs/IP0X_defconfig
@@ -43,7 +43,6 @@ CONFIG_IP_NF_TARGET_REJECT=y
43CONFIG_IP_NF_MANGLE=y 43CONFIG_IP_NF_MANGLE=y
44# CONFIG_WIRELESS is not set 44# CONFIG_WIRELESS is not set
45CONFIG_MTD=y 45CONFIG_MTD=y
46CONFIG_MTD_PARTITIONS=y
47CONFIG_MTD_CHAR=y 46CONFIG_MTD_CHAR=y
48CONFIG_MTD_BLOCK=y 47CONFIG_MTD_BLOCK=y
49CONFIG_MTD_CFI=y 48CONFIG_MTD_CFI=y
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index 8fd9b446d658..a6a7298962ed 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -46,7 +46,6 @@ CONFIG_IP_PNP=y
46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
47# CONFIG_FW_LOADER is not set 47# CONFIG_FW_LOADER is not set
48CONFIG_MTD=y 48CONFIG_MTD=y
49CONFIG_MTD_PARTITIONS=y
50CONFIG_MTD_CHAR=m 49CONFIG_MTD_CHAR=m
51CONFIG_MTD_BLOCK=y 50CONFIG_MTD_BLOCK=y
52CONFIG_MTD_RAM=y 51CONFIG_MTD_RAM=y
diff --git a/arch/blackfin/configs/SRV1_defconfig b/arch/blackfin/configs/SRV1_defconfig
index 0520c160230d..bc216646fe18 100644
--- a/arch/blackfin/configs/SRV1_defconfig
+++ b/arch/blackfin/configs/SRV1_defconfig
@@ -38,7 +38,6 @@ CONFIG_IRTTY_SIR=m
38# CONFIG_WIRELESS is not set 38# CONFIG_WIRELESS is not set
39# CONFIG_FW_LOADER is not set 39# CONFIG_FW_LOADER is not set
40CONFIG_MTD=y 40CONFIG_MTD=y
41CONFIG_MTD_PARTITIONS=y
42CONFIG_MTD_CHAR=m 41CONFIG_MTD_CHAR=m
43CONFIG_MTD_BLOCK=y 42CONFIG_MTD_BLOCK=y
44CONFIG_MTD_JEDECPROBE=m 43CONFIG_MTD_JEDECPROBE=m
diff --git a/arch/blackfin/configs/TCM-BF518_defconfig b/arch/blackfin/configs/TCM-BF518_defconfig
index e4ed865b885e..ea88158ab432 100644
--- a/arch/blackfin/configs/TCM-BF518_defconfig
+++ b/arch/blackfin/configs/TCM-BF518_defconfig
@@ -54,7 +54,6 @@ CONFIG_IP_PNP=y
54CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 54CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
55# CONFIG_FW_LOADER is not set 55# CONFIG_FW_LOADER is not set
56CONFIG_MTD=y 56CONFIG_MTD=y
57CONFIG_MTD_PARTITIONS=y
58CONFIG_MTD_CMDLINE_PARTS=y 57CONFIG_MTD_CMDLINE_PARTS=y
59CONFIG_MTD_CHAR=y 58CONFIG_MTD_CHAR=y
60CONFIG_MTD_BLOCK=y 59CONFIG_MTD_BLOCK=y
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index f2b43474b0e2..359d36fdc247 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -45,3 +45,4 @@ generic-y += unaligned.h
45generic-y += user.h 45generic-y += user.h
46generic-y += xor.h 46generic-y += xor.h
47generic-y += preempt.h 47generic-y += preempt.h
48generic-y += hash.h
diff --git a/arch/blackfin/include/asm/clkdev.h b/arch/blackfin/include/asm/clkdev.h
index 9053beda8c50..7ac2436856a5 100644
--- a/arch/blackfin/include/asm/clkdev.h
+++ b/arch/blackfin/include/asm/clkdev.h
@@ -8,7 +8,9 @@ static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
8 return kzalloc(size, GFP_KERNEL); 8 return kzalloc(size, GFP_KERNEL);
9} 9}
10 10
11#ifndef CONFIG_COMMON_CLK
11#define __clk_put(clk) 12#define __clk_put(clk)
12#define __clk_get(clk) ({ 1; }) 13#define __clk_get(clk) ({ 1; })
14#endif
13 15
14#endif 16#endif
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h
index ca67145c6a45..c5c8d8a3a5fa 100644
--- a/arch/blackfin/include/asm/def_LPBlackfin.h
+++ b/arch/blackfin/include/asm/def_LPBlackfin.h
@@ -544,6 +544,7 @@ do { \
544#define DCBS_P 0x04 /* L1 Data Cache Bank Select */ 544#define DCBS_P 0x04 /* L1 Data Cache Bank Select */
545#define PORT_PREF0_P 0x12 /* DAG0 Port Preference */ 545#define PORT_PREF0_P 0x12 /* DAG0 Port Preference */
546#define PORT_PREF1_P 0x13 /* DAG1 Port Preference */ 546#define PORT_PREF1_P 0x13 /* DAG1 Port Preference */
547#define RDCHK 0x9 /* Enable L1 Parity Check */
547 548
548/* Masks */ 549/* Masks */
549#define ENDM 0x00000001 /* (doesn't really exist) Enable 550#define ENDM 0x00000001 /* (doesn't really exist) Enable
diff --git a/arch/blackfin/include/uapi/asm/byteorder.h b/arch/blackfin/include/uapi/asm/byteorder.h
index 9558416d578b..3b125da5dcb2 100644
--- a/arch/blackfin/include/uapi/asm/byteorder.h
+++ b/arch/blackfin/include/uapi/asm/byteorder.h
@@ -1 +1,6 @@
1#ifndef _UAPI__BFIN_ASM_BYTEORDER_H
2#define _UAPI__BFIN_ASM_BYTEORDER_H
3
1#include <linux/byteorder/little_endian.h> 4#include <linux/byteorder/little_endian.h>
5
6#endif /* _UAPI__BFIN_ASM_BYTEORDER_H */
diff --git a/arch/blackfin/include/uapi/asm/cachectl.h b/arch/blackfin/include/uapi/asm/cachectl.h
index 03255df6c1ea..4fdab75dee15 100644
--- a/arch/blackfin/include/uapi/asm/cachectl.h
+++ b/arch/blackfin/include/uapi/asm/cachectl.h
@@ -7,8 +7,8 @@
7 * Licensed under the GPL-2 or later. 7 * Licensed under the GPL-2 or later.
8 */ 8 */
9 9
10#ifndef _ASM_CACHECTL 10#ifndef _UAPI_ASM_CACHECTL
11#define _ASM_CACHECTL 11#define _UAPI_ASM_CACHECTL
12 12
13/* 13/*
14 * Options for cacheflush system call 14 * Options for cacheflush system call
@@ -17,4 +17,4 @@
17#define DCACHE (1<<1) /* writeback and flush data cache */ 17#define DCACHE (1<<1) /* writeback and flush data cache */
18#define BCACHE (ICACHE|DCACHE) /* flush both caches */ 18#define BCACHE (ICACHE|DCACHE) /* flush both caches */
19 19
20#endif /* _ASM_CACHECTL */ 20#endif /* _UAPI_ASM_CACHECTL */
diff --git a/arch/blackfin/include/uapi/asm/fcntl.h b/arch/blackfin/include/uapi/asm/fcntl.h
index 251c911d59c1..f51ad9a4f617 100644
--- a/arch/blackfin/include/uapi/asm/fcntl.h
+++ b/arch/blackfin/include/uapi/asm/fcntl.h
@@ -4,8 +4,8 @@
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
6 6
7#ifndef _BFIN_FCNTL_H 7#ifndef _UAPI_BFIN_FCNTL_H
8#define _BFIN_FCNTL_H 8#define _UAPI_BFIN_FCNTL_H
9 9
10#define O_DIRECTORY 040000 /* must be a directory */ 10#define O_DIRECTORY 040000 /* must be a directory */
11#define O_NOFOLLOW 0100000 /* don't follow links */ 11#define O_NOFOLLOW 0100000 /* don't follow links */
@@ -14,4 +14,4 @@
14 14
15#include <asm-generic/fcntl.h> 15#include <asm-generic/fcntl.h>
16 16
17#endif 17#endif /* _UAPI_BFIN_FCNTL_H */
diff --git a/arch/blackfin/include/uapi/asm/ioctls.h b/arch/blackfin/include/uapi/asm/ioctls.h
index eca8d75b0a8a..9a41c20fc83d 100644
--- a/arch/blackfin/include/uapi/asm/ioctls.h
+++ b/arch/blackfin/include/uapi/asm/ioctls.h
@@ -1,7 +1,7 @@
1#ifndef __ARCH_BFIN_IOCTLS_H__ 1#ifndef _UAPI__ARCH_BFIN_IOCTLS_H__
2#define __ARCH_BFIN_IOCTLS_H__ 2#define _UAPI__ARCH_BFIN_IOCTLS_H__
3 3
4#define FIOQSIZE 0x545E 4#define FIOQSIZE 0x545E
5#include <asm-generic/ioctls.h> 5#include <asm-generic/ioctls.h>
6 6
7#endif 7#endif /* _UAPI__ARCH_BFIN_IOCTLS_H__ */
diff --git a/arch/blackfin/include/uapi/asm/poll.h b/arch/blackfin/include/uapi/asm/poll.h
index 072d8966c5c3..99c7d6816da0 100644
--- a/arch/blackfin/include/uapi/asm/poll.h
+++ b/arch/blackfin/include/uapi/asm/poll.h
@@ -5,12 +5,12 @@
5 * 5 *
6 */ 6 */
7 7
8#ifndef __BFIN_POLL_H 8#ifndef _UAPI__BFIN_POLL_H
9#define __BFIN_POLL_H 9#define _UAPI__BFIN_POLL_H
10 10
11#define POLLWRNORM 4 /* POLLOUT */ 11#define POLLWRNORM 4 /* POLLOUT */
12#define POLLWRBAND 256 12#define POLLWRBAND 256
13 13
14#include <asm-generic/poll.h> 14#include <asm-generic/poll.h>
15 15
16#endif 16#endif /* _UAPI__BFIN_POLL_H */
diff --git a/arch/blackfin/include/uapi/asm/posix_types.h b/arch/blackfin/include/uapi/asm/posix_types.h
index 1bd3436db6a7..9608ef64dc47 100644
--- a/arch/blackfin/include/uapi/asm/posix_types.h
+++ b/arch/blackfin/include/uapi/asm/posix_types.h
@@ -4,8 +4,8 @@
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
6 6
7#ifndef __ARCH_BFIN_POSIX_TYPES_H 7#ifndef _UAPI__ARCH_BFIN_POSIX_TYPES_H
8#define __ARCH_BFIN_POSIX_TYPES_H 8#define _UAPI__ARCH_BFIN_POSIX_TYPES_H
9 9
10typedef unsigned short __kernel_mode_t; 10typedef unsigned short __kernel_mode_t;
11#define __kernel_mode_t __kernel_mode_t 11#define __kernel_mode_t __kernel_mode_t
@@ -27,4 +27,4 @@ typedef unsigned short __kernel_old_dev_t;
27 27
28#include <asm-generic/posix_types.h> 28#include <asm-generic/posix_types.h>
29 29
30#endif 30#endif /* _UAPI__ARCH_BFIN_POSIX_TYPES_H */
diff --git a/arch/blackfin/include/uapi/asm/sigcontext.h b/arch/blackfin/include/uapi/asm/sigcontext.h
index 906bdc1f5fda..b58f12dc27bd 100644
--- a/arch/blackfin/include/uapi/asm/sigcontext.h
+++ b/arch/blackfin/include/uapi/asm/sigcontext.h
@@ -4,8 +4,8 @@
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
6 6
7#ifndef _ASM_BLACKFIN_SIGCONTEXT_H 7#ifndef _UAPI_ASM_BLACKFIN_SIGCONTEXT_H
8#define _ASM_BLACKFIN_SIGCONTEXT_H 8#define _UAPI_ASM_BLACKFIN_SIGCONTEXT_H
9 9
10/* Add new entries at the end of the structure only. */ 10/* Add new entries at the end of the structure only. */
11struct sigcontext { 11struct sigcontext {
@@ -58,4 +58,4 @@ struct sigcontext {
58 unsigned long sc_seqstat; 58 unsigned long sc_seqstat;
59}; 59};
60 60
61#endif 61#endif /* _UAPI_ASM_BLACKFIN_SIGCONTEXT_H */
diff --git a/arch/blackfin/include/uapi/asm/siginfo.h b/arch/blackfin/include/uapi/asm/siginfo.h
index 3e81306394e2..c72f4e6e386f 100644
--- a/arch/blackfin/include/uapi/asm/siginfo.h
+++ b/arch/blackfin/include/uapi/asm/siginfo.h
@@ -4,8 +4,8 @@
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
6 6
7#ifndef _BFIN_SIGINFO_H 7#ifndef _UAPI_BFIN_SIGINFO_H
8#define _BFIN_SIGINFO_H 8#define _UAPI_BFIN_SIGINFO_H
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <asm-generic/siginfo.h> 11#include <asm-generic/siginfo.h>
@@ -38,4 +38,4 @@
38 */ 38 */
39#define SEGV_STACKFLOW (__SI_FAULT|3) /* stack overflow */ 39#define SEGV_STACKFLOW (__SI_FAULT|3) /* stack overflow */
40 40
41#endif 41#endif /* _UAPI_BFIN_SIGINFO_H */
diff --git a/arch/blackfin/include/uapi/asm/signal.h b/arch/blackfin/include/uapi/asm/signal.h
index 77a3bf37b69d..f0a0d8b6663a 100644
--- a/arch/blackfin/include/uapi/asm/signal.h
+++ b/arch/blackfin/include/uapi/asm/signal.h
@@ -1,7 +1,7 @@
1#ifndef _BLACKFIN_SIGNAL_H 1#ifndef _UAPI_BLACKFIN_SIGNAL_H
2#define _BLACKFIN_SIGNAL_H 2#define _UAPI_BLACKFIN_SIGNAL_H
3 3
4#define SA_RESTORER 0x04000000 4#define SA_RESTORER 0x04000000
5#include <asm-generic/signal.h> 5#include <asm-generic/signal.h>
6 6
7#endif 7#endif /* _UAPI_BLACKFIN_SIGNAL_H */
diff --git a/arch/blackfin/include/uapi/asm/stat.h b/arch/blackfin/include/uapi/asm/stat.h
index 2e27665c4e91..d3068a750b94 100644
--- a/arch/blackfin/include/uapi/asm/stat.h
+++ b/arch/blackfin/include/uapi/asm/stat.h
@@ -4,8 +4,8 @@
4 * Licensed under the GPL-2. 4 * Licensed under the GPL-2.
5 */ 5 */
6 6
7#ifndef _BFIN_STAT_H 7#ifndef _UAPI_BFIN_STAT_H
8#define _BFIN_STAT_H 8#define _UAPI_BFIN_STAT_H
9 9
10struct stat { 10struct stat {
11 unsigned short st_dev; 11 unsigned short st_dev;
@@ -66,4 +66,4 @@ struct stat64 {
66 unsigned long long st_ino; 66 unsigned long long st_ino;
67}; 67};
68 68
69#endif /* _BFIN_STAT_H */ 69#endif /* _UAPI_BFIN_STAT_H */
diff --git a/arch/blackfin/include/uapi/asm/swab.h b/arch/blackfin/include/uapi/asm/swab.h
index 89de6507ca2b..f5626b77684a 100644
--- a/arch/blackfin/include/uapi/asm/swab.h
+++ b/arch/blackfin/include/uapi/asm/swab.h
@@ -4,8 +4,8 @@
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
6 6
7#ifndef _BLACKFIN_SWAB_H 7#ifndef _UAPI_BLACKFIN_SWAB_H
8#define _BLACKFIN_SWAB_H 8#define _UAPI_BLACKFIN_SWAB_H
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <asm-generic/swab.h> 11#include <asm-generic/swab.h>
@@ -47,4 +47,4 @@ static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx)
47 47
48#endif /* __GNUC__ */ 48#endif /* __GNUC__ */
49 49
50#endif /* _BLACKFIN_SWAB_H */ 50#endif /* _UAPI_BLACKFIN_SWAB_H */
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 396193042127..4f424ae3b36d 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -17,7 +17,7 @@
17#ifdef CONFIG_MTD_UCLINUX 17#ifdef CONFIG_MTD_UCLINUX
18#include <linux/mtd/map.h> 18#include <linux/mtd/map.h>
19#include <linux/ext2_fs.h> 19#include <linux/ext2_fs.h>
20#include <linux/cramfs_fs.h> 20#include <uapi/linux/cramfs_fs.h>
21#include <linux/romfs_fs.h> 21#include <linux/romfs_fs.h>
22#endif 22#endif
23 23
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 4a8c2e3fd7e5..4da70c47cc05 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -370,7 +370,8 @@ static struct platform_device bfin_sir0_device = {
370#endif 370#endif
371#endif 371#endif
372 372
373#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 373#if defined(CONFIG_SERIAL_BFIN_SPORT) || \
374 defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
374#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART 375#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
375static struct resource bfin_sport0_uart_resources[] = { 376static struct resource bfin_sport0_uart_resources[] = {
376 { 377 {
@@ -441,6 +442,50 @@ static struct platform_device bfin_sport1_uart_device = {
441#endif 442#endif
442#endif 443#endif
443 444
445#if defined(CONFIG_BFIN_SPORT) || defined(CONFIG_BFIN_SPORT_MODULE)
446static struct resource bfin_sport0_resources[] = {
447 {
448 .start = SPORT0_TCR1,
449 .end = SPORT0_MRCS3+4,
450 .flags = IORESOURCE_MEM,
451 },
452 {
453 .start = IRQ_SPORT0_TX,
454 .end = IRQ_SPORT0_TX+1,
455 .flags = IORESOURCE_IRQ,
456 },
457 {
458 .start = IRQ_SPORT0_RX,
459 .end = IRQ_SPORT0_RX+1,
460 .flags = IORESOURCE_IRQ,
461 },
462 {
463 .start = IRQ_SPORT0_ERROR,
464 .end = IRQ_SPORT0_ERROR,
465 .flags = IORESOURCE_IRQ,
466 },
467 {
468 .start = CH_SPORT0_TX,
469 .end = CH_SPORT0_TX,
470 .flags = IORESOURCE_DMA,
471 },
472 {
473 .start = CH_SPORT0_RX,
474 .end = CH_SPORT0_RX,
475 .flags = IORESOURCE_DMA,
476 },
477};
478static struct platform_device bfin_sport0_device = {
479 .name = "bfin_sport_raw",
480 .id = 0,
481 .num_resources = ARRAY_SIZE(bfin_sport0_resources),
482 .resource = bfin_sport0_resources,
483 .dev = {
484 .platform_data = &bfin_sport0_peripherals,
485 },
486};
487#endif
488
444#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 489#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
445#include <linux/input.h> 490#include <linux/input.h>
446#include <linux/gpio_keys.h> 491#include <linux/gpio_keys.h>
diff --git a/arch/blackfin/mach-bf609/Kconfig b/arch/blackfin/mach-bf609/Kconfig
index b0fca44110b0..6584190faeb8 100644
--- a/arch/blackfin/mach-bf609/Kconfig
+++ b/arch/blackfin/mach-bf609/Kconfig
@@ -17,6 +17,12 @@ config SEC_IRQ_PRIORITY_LEVELS
17 Divide the total number of interrupt priority levels into sub-levels. 17 Divide the total number of interrupt priority levels into sub-levels.
18 There is 2 ^ (SEC_IRQ_PRIORITY_LEVELS + 1) different levels. 18 There is 2 ^ (SEC_IRQ_PRIORITY_LEVELS + 1) different levels.
19 19
20config L1_PARITY_CHECK
21 bool "Enable L1 parity check"
22 default n
23 help
24 Enable the L1 parity check in L1 sram. A fault event is raised
25 when L1 parity error is found.
20 26
21comment "System Cross Bar Priority Assignment" 27comment "System Cross Bar Priority Assignment"
22 28
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c
index 82beedd953f6..8de8bc690b36 100644
--- a/arch/blackfin/mach-bf609/boards/ezkit.c
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -117,7 +117,7 @@ static struct stmmac_dma_cfg eth_dma_cfg = {
117 .pbl = 2, 117 .pbl = 2,
118}; 118};
119 119
120int stmmac_ptp_clk_init(struct platform_device *pdev) 120int stmmac_ptp_clk_init(struct platform_device *pdev, void *priv)
121{ 121{
122 bfin_write32(PADS0_EMAC_PTP_CLKSEL, 0); 122 bfin_write32(PADS0_EMAC_PTP_CLKSEL, 0);
123 return 0; 123 return 0;
@@ -1025,7 +1025,9 @@ static struct adv7842_platform_data adv7842_data = {
1025 .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1, 1025 .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
1026 .prim_mode = ADV7842_PRIM_MODE_SDP, 1026 .prim_mode = ADV7842_PRIM_MODE_SDP,
1027 .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1, 1027 .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
1028 .inp_color_space = ADV7842_INP_COLOR_SPACE_AUTO, 1028 .hdmi_free_run_enable = 1,
1029 .sdp_free_run_auto = 1,
1030 .llc_dll_phase = 0x10,
1029 .i2c_sdp_io = 0x40, 1031 .i2c_sdp_io = 0x40,
1030 .i2c_sdp = 0x41, 1032 .i2c_sdp = 0x41,
1031 .i2c_cp = 0x42, 1033 .i2c_cp = 0x42,
diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
index dab8849af884..13644ed25489 100644
--- a/arch/blackfin/mach-bf609/clock.c
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -120,6 +120,7 @@ void clk_disable(struct clk *clk)
120} 120}
121EXPORT_SYMBOL(clk_disable); 121EXPORT_SYMBOL(clk_disable);
122 122
123
123unsigned long clk_get_rate(struct clk *clk) 124unsigned long clk_get_rate(struct clk *clk)
124{ 125{
125 unsigned long ret = 0; 126 unsigned long ret = 0;
@@ -131,7 +132,7 @@ EXPORT_SYMBOL(clk_get_rate);
131 132
132long clk_round_rate(struct clk *clk, unsigned long rate) 133long clk_round_rate(struct clk *clk, unsigned long rate)
133{ 134{
134 long ret = -EIO; 135 long ret = 0;
135 if (clk->ops && clk->ops->round_rate) 136 if (clk->ops && clk->ops->round_rate)
136 ret = clk->ops->round_rate(clk, rate); 137 ret = clk->ops->round_rate(clk, rate);
137 return ret; 138 return ret;
diff --git a/arch/blackfin/mach-bf609/include/mach/anomaly.h b/arch/blackfin/mach-bf609/include/mach/anomaly.h
index 7a07374308ac..696786e9a531 100644
--- a/arch/blackfin/mach-bf609/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf609/include/mach/anomaly.h
@@ -23,11 +23,11 @@
23/* TRU_STAT.ADDRERR and TRU_ERRADDR.ADDR May Not Reflect the Correct Status */ 23/* TRU_STAT.ADDRERR and TRU_ERRADDR.ADDR May Not Reflect the Correct Status */
24#define ANOMALY_16000003 (1) 24#define ANOMALY_16000003 (1)
25/* The EPPI Data Enable (DEN) Signal is Not Functional */ 25/* The EPPI Data Enable (DEN) Signal is Not Functional */
26#define ANOMALY_16000004 (1) 26#define ANOMALY_16000004 (__SILICON_REVISION__ < 1)
27/* Using L1 Instruction Cache with Parity Enabled is Unreliable */ 27/* Using L1 Instruction Cache with Parity Enabled is Unreliable */
28#define ANOMALY_16000005 (1) 28#define ANOMALY_16000005 (__SILICON_REVISION__ < 1)
29/* SEQSTAT.SYSNMI Clears Upon Entering the NMI ISR */ 29/* SEQSTAT.SYSNMI Clears Upon Entering the NMI ISR */
30#define ANOMALY_16000006 (1) 30#define ANOMALY_16000006 (__SILICON_REVISION__ < 1)
31/* DDR2 Memory Reads May Fail Intermittently */ 31/* DDR2 Memory Reads May Fail Intermittently */
32#define ANOMALY_16000007 (1) 32#define ANOMALY_16000007 (1)
33/* Instruction Memory Stalls Can Cause IFLUSH to Fail */ 33/* Instruction Memory Stalls Can Cause IFLUSH to Fail */
@@ -49,19 +49,53 @@
49/* Speculative Fetches Can Cause Undesired External FIFO Operations */ 49/* Speculative Fetches Can Cause Undesired External FIFO Operations */
50#define ANOMALY_16000017 (1) 50#define ANOMALY_16000017 (1)
51/* RSI Boot Cleanup Routine Does Not Clear Registers */ 51/* RSI Boot Cleanup Routine Does Not Clear Registers */
52#define ANOMALY_16000018 (1) 52#define ANOMALY_16000018 (__SILICON_REVISION__ < 1)
53/* SPI Master Boot Device Auto-detection Frequency is Set Incorrectly */ 53/* SPI Master Boot Device Auto-detection Frequency is Set Incorrectly */
54#define ANOMALY_16000019 (1) 54#define ANOMALY_16000019 (__SILICON_REVISION__ < 1)
55/* rom_SysControl() Fails to Set DDR0_CTL.INIT for Wakeup From Hibernate */ 55/* rom_SysControl() Fails to Set DDR0_CTL.INIT for Wakeup From Hibernate */
56#define ANOMALY_16000020 (1) 56#define ANOMALY_16000020 (__SILICON_REVISION__ < 1)
57/* rom_SysControl() Fails to Save and Restore DDR0_PHYCTL3 for Hibernate/Wakeup Sequence */ 57/* rom_SysControl() Fails to Save and Restore DDR0_PHYCTL3 for Hibernate/Wakeup Sequence */
58#define ANOMALY_16000021 (1) 58#define ANOMALY_16000021 (__SILICON_REVISION__ < 1)
59/* Boot Code Fails to Enable Parity Fault Detection */ 59/* Boot Code Fails to Enable Parity Fault Detection */
60#define ANOMALY_16000022 (1) 60#define ANOMALY_16000022 (__SILICON_REVISION__ < 1)
61/* Rom_SysControl Does not Update CGU0_CLKOUTSEL */
62#define ANOMALY_16000023 (__SILICON_REVISION__ < 1)
63/* Spurious Fault Signaled After Clearing an Externally Generated Fault */
64#define ANOMALY_16000024 (1)
65/* SPORT May Drive Data Pins During Inactive Channels in Multichannel Mode */
66#define ANOMALY_16000025 (1)
61/* USB DMA interrupt status do not show the DMA channel interrupt in the DMA ISR */ 67/* USB DMA interrupt status do not show the DMA channel interrupt in the DMA ISR */
62#define ANOMALY_16000027 (1) 68#define ANOMALY_16000027 (__SILICON_REVISION__ < 1)
69/* Default SPI Master Boot Mode Setting is Incorrect */
70#define ANOMALY_16000028 (__SILICON_REVISION__ < 1)
71/* PPI tDFSPI Timing Does Not Meet Data Sheet Specification */
72#define ANOMALY_16000027 (__SILICON_REVISION__ < 1)
63/* Interrupted Core Reads of MMRs May Cause Data Loss */ 73/* Interrupted Core Reads of MMRs May Cause Data Loss */
64#define ANOMALY_16000030 (1) 74#define ANOMALY_16000030 (__SILICON_REVISION__ < 1)
75/* Incorrect Default USB_PLL_OSC.PLLM Value */
76#define ANOMALY_16000031 (__SILICON_REVISION__ < 1)
77/* Core Reads of System MMRs May Cause the Core to Hang */
78#define ANOMALY_16000032 (__SILICON_REVISION__ < 1)
79/* PPI Data Underflow on First Word Not Reported in Certain Modes */
80#define ANOMALY_16000033 (1)
81/* CNV1 Red Pixel Substitution feature not functional in the PVP */
82#define ANOMALY_16000034 (__SILICON_REVISION__ < 1)
83/* IPF0 Output Port Color Separation feature not functional */
84#define ANOMALY_16000035 (__SILICON_REVISION__ < 1)
85/* Spurious USB Wake From Hibernate May Occur When USB_VBUS is Low */
86#define ANOMALY_16000036 (__SILICON_REVISION__ < 1)
87/* Core RAISE 2 Instruction Not Latched When Executed at Priority Level 0, 1, or 2 */
88#define ANOMALY_16000037 (__SILICON_REVISION__ < 1)
89/* Spurious Unhandled NMI or L1 Memory Parity Error Interrupt May Occur Upon Entering the NMI ISR */
90#define ANOMALY_16000038 (__SILICON_REVISION__ < 1)
91/* CGU_STAT.PLOCKERR Bit May be Unreliable */
92#define ANOMALY_16000039 (1)
93/* JTAG Emulator Reads of SDU_IDCODE Alter Register Contents */
94#define ANOMALY_16000040 (1)
95/* IFLUSH Instruction Causes Parity Error When Parity Is Enabled */
96#define ANOMALY_16000041 (1)
97/* Instruction Cache Failure When Parity Is Enabled */
98#define ANOMALY_16000042 (__SILICON_REVISION__ == 1)
65 99
66/* Anomalies that don't exist on this proc */ 100/* Anomalies that don't exist on this proc */
67#define ANOMALY_05000158 (0) 101#define ANOMALY_05000158 (0)
diff --git a/arch/blackfin/mach-common/cache-c.c b/arch/blackfin/mach-common/cache-c.c
index 0e1e451fd7d8..f4adedc92895 100644
--- a/arch/blackfin/mach-common/cache-c.c
+++ b/arch/blackfin/mach-common/cache-c.c
@@ -6,7 +6,6 @@
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
9#include <linux/init.h>
10#include <asm/blackfin.h> 9#include <asm/blackfin.h>
11#include <asm/cplbinit.h> 10#include <asm/cplbinit.h>
12 11
@@ -42,6 +41,16 @@ bfin_cache_init(struct cplb_entry *cplb_tbl, unsigned long cplb_addr,
42 unsigned long mem_mask) 41 unsigned long mem_mask)
43{ 42{
44 int i; 43 int i;
44#ifdef CONFIG_L1_PARITY_CHECK
45 u32 ctrl;
46
47 if (cplb_addr == DCPLB_ADDR0) {
48 ctrl = bfin_read32(mem_control) | (1 << RDCHK);
49 CSYNC();
50 bfin_write32(mem_control, ctrl);
51 SSYNC();
52 }
53#endif
45 54
46 for (i = 0; i < MAX_CPLBS; i++) { 55 for (i = 0; i < MAX_CPLBS; i++) {
47 bfin_write32(cplb_addr + i * 4, cplb_tbl[i].addr); 56 bfin_write32(cplb_addr + i * 4, cplb_tbl[i].addr);
diff --git a/arch/blackfin/mach-common/clocks-init.c b/arch/blackfin/mach-common/clocks-init.c
index 2308ce52f849..d436bd907fc8 100644
--- a/arch/blackfin/mach-common/clocks-init.c
+++ b/arch/blackfin/mach-common/clocks-init.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/init.h>
11#include <asm/blackfin.h> 10#include <asm/blackfin.h>
12 11
13#include <asm/dma.h> 12#include <asm/dma.h>
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index ca75613231c8..867b7cef204c 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -471,13 +471,8 @@ void handle_sec_ssi_fault(uint32_t gstat)
471 471
472} 472}
473 473
474void handle_sec_fault(unsigned int irq, struct irq_desc *desc) 474void handle_sec_fault(uint32_t sec_gstat)
475{ 475{
476 uint32_t sec_gstat;
477
478 raw_spin_lock(&desc->lock);
479
480 sec_gstat = bfin_read32(SEC_GSTAT);
481 if (sec_gstat & SEC_GSTAT_ERR) { 476 if (sec_gstat & SEC_GSTAT_ERR) {
482 477
483 switch (sec_gstat & SEC_GSTAT_ERRC) { 478 switch (sec_gstat & SEC_GSTAT_ERRC) {
@@ -494,18 +489,16 @@ void handle_sec_fault(unsigned int irq, struct irq_desc *desc)
494 489
495 490
496 } 491 }
497
498 raw_spin_unlock(&desc->lock);
499
500 handle_fasteoi_irq(irq, desc);
501} 492}
502 493
503void handle_core_fault(unsigned int irq, struct irq_desc *desc) 494static struct irqaction bfin_fault_irq = {
495 .name = "Blackfin fault",
496};
497
498static irqreturn_t bfin_fault_routine(int irq, void *data)
504{ 499{
505 struct pt_regs *fp = get_irq_regs(); 500 struct pt_regs *fp = get_irq_regs();
506 501
507 raw_spin_lock(&desc->lock);
508
509 switch (irq) { 502 switch (irq) {
510 case IRQ_C0_DBL_FAULT: 503 case IRQ_C0_DBL_FAULT:
511 double_fault_c(fp); 504 double_fault_c(fp);
@@ -522,11 +515,15 @@ void handle_core_fault(unsigned int irq, struct irq_desc *desc)
522 case IRQ_C0_NMI_L1_PARITY_ERR: 515 case IRQ_C0_NMI_L1_PARITY_ERR:
523 panic("Core 0 NMI L1 parity error"); 516 panic("Core 0 NMI L1 parity error");
524 break; 517 break;
518 case IRQ_SEC_ERR:
519 pr_err("SEC error\n");
520 handle_sec_fault(bfin_read32(SEC_GSTAT));
521 break;
525 default: 522 default:
526 panic("Core 1 fault %d occurs unexpectedly", irq); 523 panic("Unknown fault %d", irq);
527 } 524 }
528 525
529 raw_spin_unlock(&desc->lock); 526 return IRQ_HANDLED;
530} 527}
531#endif /* SEC_GCTL */ 528#endif /* SEC_GCTL */
532 529
@@ -1195,12 +1192,7 @@ int __init init_arch_irq(void)
1195 handle_percpu_irq); 1192 handle_percpu_irq);
1196 } else { 1193 } else {
1197 irq_set_chip(irq, &bfin_sec_irqchip); 1194 irq_set_chip(irq, &bfin_sec_irqchip);
1198 if (irq == IRQ_SEC_ERR) 1195 irq_set_handler(irq, handle_fasteoi_irq);
1199 irq_set_handler(irq, handle_sec_fault);
1200 else if (irq >= IRQ_C0_DBL_FAULT && irq < CORE_IRQS)
1201 irq_set_handler(irq, handle_core_fault);
1202 else
1203 irq_set_handler(irq, handle_fasteoi_irq);
1204 __irq_set_preflow_handler(irq, bfin_sec_preflow_handler); 1196 __irq_set_preflow_handler(irq, bfin_sec_preflow_handler);
1205 } 1197 }
1206 } 1198 }
@@ -1239,6 +1231,13 @@ int __init init_arch_irq(void)
1239 register_syscore_ops(&sec_pm_syscore_ops); 1231 register_syscore_ops(&sec_pm_syscore_ops);
1240#endif 1232#endif
1241 1233
1234 bfin_fault_irq.handler = bfin_fault_routine;
1235#ifdef CONFIG_L1_PARITY_CHECK
1236 setup_irq(IRQ_C0_NMI_L1_PARITY_ERR, &bfin_fault_irq);
1237#endif
1238 setup_irq(IRQ_C0_DBL_FAULT, &bfin_fault_irq);
1239 setup_irq(IRQ_SEC_ERR, &bfin_fault_irq);
1240
1242 return 0; 1241 return 0;
1243} 1242}
1244 1243
diff --git a/arch/blackfin/mach-common/scb-init.c b/arch/blackfin/mach-common/scb-init.c
index 2cbfb0b5679e..8923398db66f 100644
--- a/arch/blackfin/mach-common/scb-init.c
+++ b/arch/blackfin/mach-common/scb-init.c
@@ -6,7 +6,6 @@
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
9#include <linux/init.h>
10#include <linux/errno.h> 9#include <linux/errno.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <asm/scb.h> 11#include <asm/scb.h>
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 2bbae0783819..ba6c30d8534d 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -53,7 +53,6 @@ enum ipi_message_type {
53 BFIN_IPI_TIMER, 53 BFIN_IPI_TIMER,
54 BFIN_IPI_RESCHEDULE, 54 BFIN_IPI_RESCHEDULE,
55 BFIN_IPI_CALL_FUNC, 55 BFIN_IPI_CALL_FUNC,
56 BFIN_IPI_CALL_FUNC_SINGLE,
57 BFIN_IPI_CPU_STOP, 56 BFIN_IPI_CPU_STOP,
58}; 57};
59 58
@@ -162,9 +161,6 @@ static irqreturn_t ipi_handler_int1(int irq, void *dev_instance)
162 case BFIN_IPI_CALL_FUNC: 161 case BFIN_IPI_CALL_FUNC:
163 generic_smp_call_function_interrupt(); 162 generic_smp_call_function_interrupt();
164 break; 163 break;
165 case BFIN_IPI_CALL_FUNC_SINGLE:
166 generic_smp_call_function_single_interrupt();
167 break;
168 case BFIN_IPI_CPU_STOP: 164 case BFIN_IPI_CPU_STOP:
169 ipi_cpu_stop(cpu); 165 ipi_cpu_stop(cpu);
170 break; 166 break;
@@ -210,7 +206,7 @@ void send_ipi(const struct cpumask *cpumask, enum ipi_message_type msg)
210 206
211void arch_send_call_function_single_ipi(int cpu) 207void arch_send_call_function_single_ipi(int cpu)
212{ 208{
213 send_ipi(cpumask_of(cpu), BFIN_IPI_CALL_FUNC_SINGLE); 209 send_ipi(cpumask_of(cpu), BFIN_IPI_CALL_FUNC);
214} 210}
215 211
216void arch_send_call_function_ipi_mask(const struct cpumask *mask) 212void arch_send_call_function_ipi_mask(const struct cpumask *mask)
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index fc0b3c356027..d73bb85ccdd3 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -57,3 +57,4 @@ generic-y += user.h
57generic-y += vga.h 57generic-y += vga.h
58generic-y += xor.h 58generic-y += xor.h
59generic-y += preempt.h 59generic-y += preempt.h
60generic-y += hash.h
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 9c957c81c688..ed0fcdf7e990 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -122,12 +122,6 @@ config ETRAX100LX_V2
122 help 122 help
123 Support version 2 of the ETRAX 100LX. 123 Support version 2 of the ETRAX 100LX.
124 124
125config SVINTO_SIM
126 bool "ETRAX-100LX-for-xsim-simulator"
127 select ARCH_USES_GETTIMEOFFSET
128 help
129 Support the xsim ETRAX Simulator.
130
131config ETRAXFS 125config ETRAXFS
132 bool "ETRAX-FS-V32" 126 bool "ETRAX-FS-V32"
133 help 127 help
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index 609d5510410e..f4374bae4fb4 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -838,13 +838,13 @@ static int __init gpio_init(void)
838 * in some tests. 838 * in some tests.
839 */ 839 */
840 res = request_irq(TIMER0_IRQ_NBR, gpio_poll_timer_interrupt, 840 res = request_irq(TIMER0_IRQ_NBR, gpio_poll_timer_interrupt,
841 IRQF_SHARED | IRQF_DISABLED, "gpio poll", gpio_name); 841 IRQF_SHARED, "gpio poll", gpio_name);
842 if (res) { 842 if (res) {
843 printk(KERN_CRIT "err: timer0 irq for gpio\n"); 843 printk(KERN_CRIT "err: timer0 irq for gpio\n");
844 return res; 844 return res;
845 } 845 }
846 res = request_irq(PA_IRQ_NBR, gpio_interrupt, 846 res = request_irq(PA_IRQ_NBR, gpio_interrupt,
847 IRQF_SHARED | IRQF_DISABLED, "gpio PA", gpio_name); 847 IRQF_SHARED, "gpio PA", gpio_name);
848 if (res) 848 if (res)
849 printk(KERN_CRIT "err: PA irq for gpio\n"); 849 printk(KERN_CRIT "err: PA irq for gpio\n");
850 850
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index a1c498d18d31..29eb02ab3f25 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/timer.h> 24#include <linux/timer.h>
25#include <linux/wait.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/dma.h> 27#include <asm/dma.h>
27#include <asm/io.h> 28#include <asm/io.h>
@@ -580,7 +581,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
580 if (port == &ports[0]) { 581 if (port == &ports[0]) {
581 if (request_irq(8, 582 if (request_irq(8,
582 manual_interrupt, 583 manual_interrupt,
583 IRQF_SHARED | IRQF_DISABLED, 584 IRQF_SHARED,
584 "synchronous serial manual irq", 585 "synchronous serial manual irq",
585 &ports[0])) { 586 &ports[0])) {
586 printk(KERN_CRIT "Can't alloc " 587 printk(KERN_CRIT "Can't alloc "
@@ -590,7 +591,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
590 } else if (port == &ports[1]) { 591 } else if (port == &ports[1]) {
591 if (request_irq(8, 592 if (request_irq(8,
592 manual_interrupt, 593 manual_interrupt,
593 IRQF_SHARED | IRQF_DISABLED, 594 IRQF_SHARED,
594 "synchronous serial manual irq", 595 "synchronous serial manual irq",
595 &ports[1])) { 596 &ports[1])) {
596 printk(KERN_CRIT "Can't alloc " 597 printk(KERN_CRIT "Can't alloc "
@@ -1136,7 +1137,8 @@ static ssize_t sync_serial_read(struct file *file, char *buf,
1136 if (file->f_flags & O_NONBLOCK) 1137 if (file->f_flags & O_NONBLOCK)
1137 return -EAGAIN; 1138 return -EAGAIN;
1138 1139
1139 interruptible_sleep_on(&port->in_wait_q); 1140 wait_event_interruptible(port->in_wait_q,
1141 !(start == end && !port->full));
1140 if (signal_pending(current)) 1142 if (signal_pending(current))
1141 return -EINTR; 1143 return -EINTR;
1142 1144
diff --git a/arch/cris/arch-v10/kernel/Makefile b/arch/cris/arch-v10/kernel/Makefile
index dcfec41d3533..4841e822cdd1 100644
--- a/arch/cris/arch-v10/kernel/Makefile
+++ b/arch/cris/arch-v10/kernel/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.6 2004/12/13 12:21:51 starvik Exp $
2# 1#
3# Makefile for the linux kernel. 2# Makefile for the linux kernel.
4# 3#
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index f932c85fbde4..7d307cce8bd8 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -19,7 +19,6 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/tty.h> 20#include <linux/tty.h>
21#include <arch/svinto.h> 21#include <arch/svinto.h>
22#include <asm/io.h> /* Get SIMCOUT. */
23 22
24extern void reset_watchdog(void); 23extern void reset_watchdog(void);
25 24
@@ -318,12 +317,6 @@ console_write(struct console *co, const char *buf, unsigned int len)
318 if (!port) 317 if (!port)
319 return; 318 return;
320 319
321#ifdef CONFIG_SVINTO_SIM
322 /* no use to simulate the serial debug output */
323 SIMCOUT(buf, len);
324 return;
325#endif
326
327 console_write_direct(co, buf, len); 320 console_write_direct(co, buf, len);
328} 321}
329 322
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 897bba67bf7a..81570fcd0412 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -13,8 +13,8 @@
13 * after a timer-interrupt and after each system call. 13 * after a timer-interrupt and after each system call.
14 * 14 *
15 * Stack layout in 'ret_from_system_call': 15 * Stack layout in 'ret_from_system_call':
16 * ptrace needs to have all regs on the stack. 16 * ptrace needs to have all regs on the stack.
17 * if the order here is changed, it needs to be 17 * if the order here is changed, it needs to be
18 * updated in fork.c:copy_process, signal.c:do_signal, 18 * updated in fork.c:copy_process, signal.c:do_signal,
19 * ptrace.c and ptrace.h 19 * ptrace.c and ptrace.h
20 * 20 *
@@ -31,7 +31,7 @@
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32 32
33 ;; functions exported from this file 33 ;; functions exported from this file
34 34
35 .globl system_call 35 .globl system_call
36 .globl ret_from_intr 36 .globl ret_from_intr
37 .globl ret_from_fork 37 .globl ret_from_fork
@@ -46,10 +46,10 @@
46 .globl do_sigtrap 46 .globl do_sigtrap
47 .globl gdb_handle_breakpoint 47 .globl gdb_handle_breakpoint
48 .globl sys_call_table 48 .globl sys_call_table
49 49
50 ;; below are various parts of system_call which are not in the fast-path 50 ;; below are various parts of system_call which are not in the fast-path
51 51
52#ifdef CONFIG_PREEMPT 52#ifdef CONFIG_PREEMPT
53 ; Check if preemptive kernel scheduling should be done 53 ; Check if preemptive kernel scheduling should be done
54_resume_kernel: 54_resume_kernel:
55 di 55 di
@@ -74,7 +74,7 @@ _need_resched:
74 nop 74 nop
75#else 75#else
76#define _resume_kernel _Rexit 76#define _resume_kernel _Rexit
77#endif 77#endif
78 78
79 ; Called at exit from fork. schedule_tail must be called to drop 79 ; Called at exit from fork. schedule_tail must be called to drop
80 ; spinlock if CONFIG_PREEMPT 80 ; spinlock if CONFIG_PREEMPT
@@ -91,16 +91,16 @@ ret_from_kernel_thread:
91 ba ret_from_sys_call 91 ba ret_from_sys_call
92 92
93ret_from_intr: 93ret_from_intr:
94 ;; check for resched if preemptive kernel or if we're going back to user-mode 94 ;; check for resched if preemptive kernel or if we're going back to user-mode
95 ;; this test matches the user_regs(regs) macro 95 ;; this test matches the user_regs(regs) macro
96 ;; we cannot simply test $dccr, because that does not necessarily 96 ;; we cannot simply test $dccr, because that does not necessarily
97 ;; reflect what mode we'll return into. 97 ;; reflect what mode we'll return into.
98 98
99 move.d [$sp + PT_dccr], $r0; regs->dccr 99 move.d [$sp + PT_dccr], $r0; regs->dccr
100 btstq 8, $r0 ; U-flag 100 btstq 8, $r0 ; U-flag
101 bpl _resume_kernel 101 bpl _resume_kernel
102 ; Note that di below is in delay slot 102 ; Note that di below is in delay slot
103 103
104_resume_userspace: 104_resume_userspace:
105 di ; so need_resched and sigpending don't change 105 di ; so need_resched and sigpending don't change
106 106
@@ -113,7 +113,7 @@ _resume_userspace:
113 nop 113 nop
114 ba _Rexit 114 ba _Rexit
115 nop 115 nop
116 116
117 ;; The system_call is called by a BREAK instruction, which works like 117 ;; The system_call is called by a BREAK instruction, which works like
118 ;; an interrupt call but it stores the return PC in BRP instead of IRP. 118 ;; an interrupt call but it stores the return PC in BRP instead of IRP.
119 ;; Since we dont really want to have two epilogues (one for system calls 119 ;; Since we dont really want to have two epilogues (one for system calls
@@ -123,7 +123,7 @@ _resume_userspace:
123 ;; 123 ;;
124 ;; Since we can't have system calls inside interrupts, it should not matter 124 ;; Since we can't have system calls inside interrupts, it should not matter
125 ;; that we don't stack IRP. 125 ;; that we don't stack IRP.
126 ;; 126 ;;
127 ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,r13,mof,srp 127 ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,r13,mof,srp
128 ;; 128 ;;
129 ;; This function looks on the _surface_ like spaghetti programming, but it's 129 ;; This function looks on the _surface_ like spaghetti programming, but it's
@@ -140,7 +140,7 @@ system_call:
140 movem $r13, [$sp] ; push r0-r13 140 movem $r13, [$sp] ; push r0-r13
141 push $r10 ; push orig_r10 141 push $r10 ; push orig_r10
142 clear.d [$sp=$sp-4] ; frametype == 0, normal stackframe 142 clear.d [$sp=$sp-4] ; frametype == 0, normal stackframe
143 143
144 movs.w -ENOSYS, $r0 144 movs.w -ENOSYS, $r0
145 move.d $r0, [$sp+PT_r10] ; put the default return value in r10 in the frame 145 move.d $r0, [$sp+PT_r10] ; put the default return value in r10 in the frame
146 146
@@ -148,17 +148,17 @@ system_call:
148 148
149 movs.w -8192, $r0 ; THREAD_SIZE == 8192 149 movs.w -8192, $r0 ; THREAD_SIZE == 8192
150 and.d $sp, $r0 150 and.d $sp, $r0
151 151
152 move.d [$r0+TI_flags], $r0 152 move.d [$r0+TI_flags], $r0
153 btstq TIF_SYSCALL_TRACE, $r0 153 btstq TIF_SYSCALL_TRACE, $r0
154 bmi _syscall_trace_entry 154 bmi _syscall_trace_entry
155 nop 155 nop
156 156
157_syscall_traced: 157_syscall_traced:
158 158
159 ;; check for sanity in the requested syscall number 159 ;; check for sanity in the requested syscall number
160 160
161 cmpu.w NR_syscalls, $r9 161 cmpu.w NR_syscalls, $r9
162 bcc ret_from_sys_call 162 bcc ret_from_sys_call
163 lslq 2, $r9 ; multiply by 4, in the delay slot 163 lslq 2, $r9 ; multiply by 4, in the delay slot
164 164
@@ -166,28 +166,28 @@ _syscall_traced:
166 ;; of the register structure itself. some syscalls need this. 166 ;; of the register structure itself. some syscalls need this.
167 167
168 push $sp 168 push $sp
169 169
170 ;; the parameter carrying registers r10, r11, r12 and 13 are intact. 170 ;; the parameter carrying registers r10, r11, r12 and 13 are intact.
171 ;; the fifth and sixth parameters (if any) was in mof and srp 171 ;; the fifth and sixth parameters (if any) was in mof and srp
172 ;; respectively, and we need to put them on the stack. 172 ;; respectively, and we need to put them on the stack.
173 173
174 push $srp 174 push $srp
175 push $mof 175 push $mof
176 176
177 jsr [$r9+sys_call_table] ; actually do the system call 177 jsr [$r9+sys_call_table] ; actually do the system call
178 addq 3*4, $sp ; pop the mof, srp and regs parameters 178 addq 3*4, $sp ; pop the mof, srp and regs parameters
179 move.d $r10, [$sp+PT_r10] ; save the return value 179 move.d $r10, [$sp+PT_r10] ; save the return value
180 180
181 moveq 1, $r9 ; "parameter" to ret_from_sys_call to show it was a sys call 181 moveq 1, $r9 ; "parameter" to ret_from_sys_call to show it was a sys call
182 182
183 ;; fall through into ret_from_sys_call to return 183 ;; fall through into ret_from_sys_call to return
184 184
185ret_from_sys_call: 185ret_from_sys_call:
186 ;; r9 is a parameter - if >=1 we came from a syscall, if 0, from an irq 186 ;; r9 is a parameter - if >=1 we came from a syscall, if 0, from an irq
187 187
188 ;; get the current task-struct pointer (see top for defs) 188 ;; get the current task-struct pointer (see top for defs)
189 189
190 movs.w -8192, $r0 ; THREAD_SIZE == 8192 190 movs.w -8192, $r0 ; THREAD_SIZE == 8192
191 and.d $sp, $r0 191 and.d $sp, $r0
192 192
193 di ; make sure need_resched and sigpending don't change 193 di ; make sure need_resched and sigpending don't change
@@ -202,7 +202,7 @@ _Rexit:
202 bne _RBFexit ; was not CRIS_FRAME_NORMAL, handle otherwise 202 bne _RBFexit ; was not CRIS_FRAME_NORMAL, handle otherwise
203 addq 4, $sp ; skip orig_r10, in delayslot 203 addq 4, $sp ; skip orig_r10, in delayslot
204 movem [$sp+], $r13 ; registers r0-r13 204 movem [$sp+], $r13 ; registers r0-r13
205 pop $mof ; multiply overflow register 205 pop $mof ; multiply overflow register
206 pop $dccr ; condition codes 206 pop $dccr ; condition codes
207 pop $srp ; subroutine return pointer 207 pop $srp ; subroutine return pointer
208 ;; now we have a 4-word SBFS frame which we do not want to restore 208 ;; now we have a 4-word SBFS frame which we do not want to restore
@@ -216,14 +216,14 @@ _Rexit:
216 216
217_RBFexit: 217_RBFexit:
218 movem [$sp+], $r13 ; registers r0-r13, in delay slot 218 movem [$sp+], $r13 ; registers r0-r13, in delay slot
219 pop $mof ; multiply overflow register 219 pop $mof ; multiply overflow register
220 pop $dccr ; condition codes 220 pop $dccr ; condition codes
221 pop $srp ; subroutine return pointer 221 pop $srp ; subroutine return pointer
222 rbf [$sp+] ; return by popping the CPU status 222 rbf [$sp+] ; return by popping the CPU status
223 223
224 ;; We get here after doing a syscall if extra work might need to be done 224 ;; We get here after doing a syscall if extra work might need to be done
225 ;; perform syscall exit tracing if needed 225 ;; perform syscall exit tracing if needed
226 226
227_syscall_exit_work: 227_syscall_exit_work:
228 ;; $r0 contains current at this point and irq's are disabled 228 ;; $r0 contains current at this point and irq's are disabled
229 229
@@ -231,22 +231,22 @@ _syscall_exit_work:
231 btstq TIF_SYSCALL_TRACE, $r1 231 btstq TIF_SYSCALL_TRACE, $r1
232 bpl _work_pending 232 bpl _work_pending
233 nop 233 nop
234 234
235 ei 235 ei
236 236
237 move.d $r9, $r1 ; preserve r9 237 move.d $r9, $r1 ; preserve r9
238 jsr do_syscall_trace 238 jsr do_syscall_trace
239 move.d $r1, $r9 239 move.d $r1, $r9
240 240
241 ba _resume_userspace 241 ba _resume_userspace
242 nop 242 nop
243 243
244_work_pending: 244_work_pending:
245 move.d [$r0+TI_flags], $r1 245 move.d [$r0+TI_flags], $r1
246 btstq TIF_NEED_RESCHED, $r1 246 btstq TIF_NEED_RESCHED, $r1
247 bpl _work_notifysig ; was neither trace nor sched, must be signal/notify 247 bpl _work_notifysig ; was neither trace nor sched, must be signal/notify
248 nop 248 nop
249 249
250_work_resched: 250_work_resched:
251 move.d $r9, $r1 ; preserve r9 251 move.d $r9, $r1 ; preserve r9
252 jsr schedule 252 jsr schedule
@@ -268,17 +268,17 @@ _work_notifysig:
268 move.d $sp, $r11 ; the regs param 268 move.d $sp, $r11 ; the regs param
269 move.d $r1, $r12 ; the thread_info_flags parameter 269 move.d $r1, $r12 ; the thread_info_flags parameter
270 jsr do_notify_resume 270 jsr do_notify_resume
271 271
272 ba _Rexit 272 ba _Rexit
273 nop 273 nop
274 274
275 ;; We get here as a sidetrack when we've entered a syscall with the 275 ;; We get here as a sidetrack when we've entered a syscall with the
276 ;; trace-bit set. We need to call do_syscall_trace and then continue 276 ;; trace-bit set. We need to call do_syscall_trace and then continue
277 ;; with the call. 277 ;; with the call.
278 278
279_syscall_trace_entry: 279_syscall_trace_entry:
280 ;; PT_r10 in the frame contains -ENOSYS as required, at this point 280 ;; PT_r10 in the frame contains -ENOSYS as required, at this point
281 281
282 jsr do_syscall_trace 282 jsr do_syscall_trace
283 283
284 ;; now re-enter the syscall code to do the syscall itself 284 ;; now re-enter the syscall code to do the syscall itself
@@ -292,10 +292,10 @@ _syscall_trace_entry:
292 move.d [$sp+PT_r13], $r13 292 move.d [$sp+PT_r13], $r13
293 move [$sp+PT_mof], $mof 293 move [$sp+PT_mof], $mof
294 move [$sp+PT_srp], $srp 294 move [$sp+PT_srp], $srp
295 295
296 ba _syscall_traced 296 ba _syscall_traced
297 nop 297 nop
298 298
299 ;; resume performs the actual task-switching, by switching stack pointers 299 ;; resume performs the actual task-switching, by switching stack pointers
300 ;; input arguments: r10 = prev, r11 = next, r12 = thread offset in task struct 300 ;; input arguments: r10 = prev, r11 = next, r12 = thread offset in task struct
301 ;; returns old current in r10 301 ;; returns old current in r10
@@ -303,29 +303,29 @@ _syscall_trace_entry:
303 ;; TODO: see the i386 version. The switch_to which calls resume in our version 303 ;; TODO: see the i386 version. The switch_to which calls resume in our version
304 ;; could really be an inline asm of this. 304 ;; could really be an inline asm of this.
305 305
306resume: 306resume:
307 push $srp ; we keep the old/new PC on the stack 307 push $srp ; we keep the old/new PC on the stack
308 add.d $r12, $r10 ; r10 = current tasks tss 308 add.d $r12, $r10 ; r10 = current tasks tss
309 move $dccr, [$r10+THREAD_dccr]; save irq enable state 309 move $dccr, [$r10+THREAD_dccr]; save irq enable state
310 di 310 di
311 311
312 move $usp, [$r10+ THREAD_usp] ; save user-mode stackpointer 312 move $usp, [$r10+ THREAD_usp] ; save user-mode stackpointer
313 313
314 ;; See copy_thread for the reason why register R9 is saved. 314 ;; See copy_thread for the reason why register R9 is saved.
315 subq 10*4, $sp 315 subq 10*4, $sp
316 movem $r9, [$sp] ; save non-scratch registers and R9. 316 movem $r9, [$sp] ; save non-scratch registers and R9.
317 317
318 move.d $sp, [$r10+THREAD_ksp] ; save the kernel stack pointer for the old task 318 move.d $sp, [$r10+THREAD_ksp] ; save the kernel stack pointer for the old task
319 move.d $sp, $r10 ; return last running task in r10 319 move.d $sp, $r10 ; return last running task in r10
320 and.d -8192, $r10 ; get thread_info from stackpointer 320 and.d -8192, $r10 ; get thread_info from stackpointer
321 move.d [$r10+TI_task], $r10 ; get task 321 move.d [$r10+TI_task], $r10 ; get task
322 add.d $r12, $r11 ; find the new tasks tss 322 add.d $r12, $r11 ; find the new tasks tss
323 move.d [$r11+THREAD_ksp], $sp ; switch into the new stackframe by restoring kernel sp 323 move.d [$r11+THREAD_ksp], $sp ; switch into the new stackframe by restoring kernel sp
324 324
325 movem [$sp+], $r9 ; restore non-scratch registers and R9. 325 movem [$sp+], $r9 ; restore non-scratch registers and R9.
326 326
327 move [$r11+THREAD_usp], $usp ; restore user-mode stackpointer 327 move [$r11+THREAD_usp], $usp ; restore user-mode stackpointer
328 328
329 move [$r11+THREAD_dccr], $dccr ; restore irq enable status 329 move [$r11+THREAD_dccr], $dccr ; restore irq enable status
330 jump [$sp+] ; restore PC 330 jump [$sp+] ; restore PC
331 331
@@ -401,7 +401,7 @@ mmu_bus_fault:
401 push $r10 ; frametype == 1, BUSFAULT frame type 401 push $r10 ; frametype == 1, BUSFAULT frame type
402 402
403 move.d $sp, $r10 ; pt_regs argument to handle_mmu_bus_fault 403 move.d $sp, $r10 ; pt_regs argument to handle_mmu_bus_fault
404 404
405 jsr handle_mmu_bus_fault ; in arch/cris/arch-v10/mm/fault.c 405 jsr handle_mmu_bus_fault ; in arch/cris/arch-v10/mm/fault.c
406 406
407 ;; now we need to return through the normal path, we cannot just 407 ;; now we need to return through the normal path, we cannot just
@@ -410,10 +410,10 @@ mmu_bus_fault:
410 ;; whatever. 410 ;; whatever.
411 411
412 moveq 0, $r9 ; busfault is equivalent to an irq 412 moveq 0, $r9 ; busfault is equivalent to an irq
413 413
414 ba ret_from_intr 414 ba ret_from_intr
415 nop 415 nop
416 416
417 ;; special handlers for breakpoint and NMI 417 ;; special handlers for breakpoint and NMI
418hwbreakpoint: 418hwbreakpoint:
419 push $dccr 419 push $dccr
@@ -429,7 +429,7 @@ hwbreakpoint:
429 pop $dccr 429 pop $dccr
430 retb 430 retb
431 nop 431 nop
432 432
433IRQ1_interrupt: 433IRQ1_interrupt:
434 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!! 434 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
435 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame 435 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
@@ -457,7 +457,7 @@ IRQ1_interrupt:
457 ba _Rexit ; Return the standard way 457 ba _Rexit ; Return the standard way
458 nop 458 nop
459wdog: 459wdog:
460#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 460#if defined(CONFIG_ETRAX_WATCHDOG)
461;; Check if we're waiting for reset to happen, as signalled by 461;; Check if we're waiting for reset to happen, as signalled by
462;; hard_reset_now setting cause_of_death to a magic value. If so, just 462;; hard_reset_now setting cause_of_death to a magic value. If so, just
463;; get stuck until reset happens. 463;; get stuck until reset happens.
@@ -500,7 +500,7 @@ Watchdog_bite:
500 move.d $r10, [$r11] 500 move.d $r10, [$r11]
501 501
502#endif 502#endif
503 503
504;; Note that we don't do "setf m" here (or after two necessary NOPs), 504;; Note that we don't do "setf m" here (or after two necessary NOPs),
505;; since *not* doing that saves us from re-entrancy checks. We don't want 505;; since *not* doing that saves us from re-entrancy checks. We don't want
506;; to get here again due to possible subsequent NMIs; we want the watchdog 506;; to get here again due to possible subsequent NMIs; we want the watchdog
@@ -523,16 +523,16 @@ _watchdogmsg:
523 .ascii "Oops: bitten by watchdog\n\0" 523 .ascii "Oops: bitten by watchdog\n\0"
524 .previous 524 .previous
525 525
526#endif /* CONFIG_ETRAX_WATCHDOG and not CONFIG_SVINTO_SIM */ 526#endif /* CONFIG_ETRAX_WATCHDOG */
527 527
528spurious_interrupt: 528spurious_interrupt:
529 di 529 di
530 jump hard_reset_now 530 jump hard_reset_now
531 531
532 ;; this handles the case when multiple interrupts arrive at the same time 532 ;; this handles the case when multiple interrupts arrive at the same time
533 ;; we jump to the first set interrupt bit in a priority fashion 533 ;; we jump to the first set interrupt bit in a priority fashion
534 ;; the hardware will call the unserved interrupts after the handler finishes 534 ;; the hardware will call the unserved interrupts after the handler finishes
535 535
536multiple_interrupt: 536multiple_interrupt:
537 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!! 537 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
538 move $irp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame 538 move $irp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
@@ -551,7 +551,7 @@ multiple_interrupt:
551 jump ret_from_intr 551 jump ret_from_intr
552 552
553do_sigtrap: 553do_sigtrap:
554 ;; 554 ;;
555 ;; SIGTRAP the process that executed the break instruction. 555 ;; SIGTRAP the process that executed the break instruction.
556 ;; Make a frame that Rexit in entry.S expects. 556 ;; Make a frame that Rexit in entry.S expects.
557 ;; 557 ;;
@@ -568,30 +568,30 @@ do_sigtrap:
568 movs.w -8192,$r9 ; THREAD_SIZE == 8192 568 movs.w -8192,$r9 ; THREAD_SIZE == 8192
569 and.d $sp, $r9 569 and.d $sp, $r9
570 move.d [$r9+TI_task], $r10 570 move.d [$r9+TI_task], $r10
571 move.d [$r10+TASK_pid], $r10 ; current->pid as arg1. 571 move.d [$r10+TASK_pid], $r10 ; current->pid as arg1.
572 moveq 5, $r11 ; SIGTRAP as arg2. 572 moveq 5, $r11 ; SIGTRAP as arg2.
573 jsr sys_kill 573 jsr sys_kill
574 jump ret_from_intr ; Use the return routine for interrupts. 574 jump ret_from_intr ; Use the return routine for interrupts.
575 575
576gdb_handle_breakpoint: 576gdb_handle_breakpoint:
577 push $dccr 577 push $dccr
578 push $r0 578 push $r0
579#ifdef CONFIG_ETRAX_KGDB 579#ifdef CONFIG_ETRAX_KGDB
580 move $dccr, $r0 ; U-flag not affected by previous insns. 580 move $dccr, $r0 ; U-flag not affected by previous insns.
581 btstq 8, $r0 ; Test the U-flag. 581 btstq 8, $r0 ; Test the U-flag.
582 bmi _ugdb_handle_breakpoint ; Go to user mode debugging. 582 bmi _ugdb_handle_breakpoint ; Go to user mode debugging.
583 nop ; Empty delay slot (cannot pop r0 here). 583 nop ; Empty delay slot (cannot pop r0 here).
584 pop $r0 ; Restore r0. 584 pop $r0 ; Restore r0.
585 ba kgdb_handle_breakpoint ; Go to kernel debugging. 585 ba kgdb_handle_breakpoint ; Go to kernel debugging.
586 pop $dccr ; Restore dccr in delay slot. 586 pop $dccr ; Restore dccr in delay slot.
587#endif 587#endif
588 588
589_ugdb_handle_breakpoint: 589_ugdb_handle_breakpoint:
590 move $brp, $r0 ; Use r0 temporarily for calculation. 590 move $brp, $r0 ; Use r0 temporarily for calculation.
591 subq 2, $r0 ; Set to address of previous instruction. 591 subq 2, $r0 ; Set to address of previous instruction.
592 move $r0, $brp 592 move $r0, $brp
593 pop $r0 ; Restore r0. 593 pop $r0 ; Restore r0.
594 ba do_sigtrap ; SIGTRAP the offending process. 594 ba do_sigtrap ; SIGTRAP the offending process.
595 pop $dccr ; Restore dccr in delay slot. 595 pop $dccr ; Restore dccr in delay slot.
596 596
597 .data 597 .data
@@ -602,7 +602,7 @@ hw_bp_trig_ptr:
602 .dword hw_bp_trigs 602 .dword hw_bp_trigs
603 603
604 .section .rodata,"a" 604 .section .rodata,"a"
605sys_call_table: 605sys_call_table:
606 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ 606 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
607 .long sys_exit 607 .long sys_exit
608 .long sys_fork 608 .long sys_fork
@@ -713,7 +713,7 @@ sys_call_table:
713 .long sys_newlstat 713 .long sys_newlstat
714 .long sys_newfstat 714 .long sys_newfstat
715 .long sys_ni_syscall /* old sys_uname holder */ 715 .long sys_ni_syscall /* old sys_uname holder */
716 .long sys_ni_syscall /* sys_iopl in i386 */ 716 .long sys_ni_syscall /* 110 */ /* sys_iopl in i386 */
717 .long sys_vhangup 717 .long sys_vhangup
718 .long sys_ni_syscall /* old "idle" system call */ 718 .long sys_ni_syscall /* old "idle" system call */
719 .long sys_ni_syscall /* vm86old in i386 */ 719 .long sys_ni_syscall /* vm86old in i386 */
@@ -730,7 +730,7 @@ sys_call_table:
730 .long sys_adjtimex 730 .long sys_adjtimex
731 .long sys_mprotect /* 125 */ 731 .long sys_mprotect /* 125 */
732 .long sys_sigprocmask 732 .long sys_sigprocmask
733 .long sys_ni_syscall /* old "create_module" */ 733 .long sys_ni_syscall /* old "create_module" */
734 .long sys_init_module 734 .long sys_init_module
735 .long sys_delete_module 735 .long sys_delete_module
736 .long sys_ni_syscall /* 130: old "get_kernel_syms" */ 736 .long sys_ni_syscall /* 130: old "get_kernel_syms" */
@@ -795,7 +795,7 @@ sys_call_table:
795 .long sys_ni_syscall /* streams2 */ 795 .long sys_ni_syscall /* streams2 */
796 .long sys_vfork /* 190 */ 796 .long sys_vfork /* 190 */
797 .long sys_getrlimit 797 .long sys_getrlimit
798 .long sys_mmap2 798 .long sys_mmap2 /* mmap_pgoff */
799 .long sys_truncate64 799 .long sys_truncate64
800 .long sys_ftruncate64 800 .long sys_ftruncate64
801 .long sys_stat64 /* 195 */ 801 .long sys_stat64 /* 195 */
@@ -861,21 +861,21 @@ sys_call_table:
861 .long sys_epoll_ctl /* 255 */ 861 .long sys_epoll_ctl /* 255 */
862 .long sys_epoll_wait 862 .long sys_epoll_wait
863 .long sys_remap_file_pages 863 .long sys_remap_file_pages
864 .long sys_set_tid_address 864 .long sys_set_tid_address
865 .long sys_timer_create 865 .long sys_timer_create
866 .long sys_timer_settime /* 260 */ 866 .long sys_timer_settime /* 260 */
867 .long sys_timer_gettime 867 .long sys_timer_gettime
868 .long sys_timer_getoverrun 868 .long sys_timer_getoverrun
869 .long sys_timer_delete 869 .long sys_timer_delete
870 .long sys_clock_settime 870 .long sys_clock_settime
871 .long sys_clock_gettime /* 265 */ 871 .long sys_clock_gettime /* 265 */
872 .long sys_clock_getres 872 .long sys_clock_getres
873 .long sys_clock_nanosleep 873 .long sys_clock_nanosleep
874 .long sys_statfs64 874 .long sys_statfs64
875 .long sys_fstatfs64 875 .long sys_fstatfs64
876 .long sys_tgkill /* 270 */ 876 .long sys_tgkill /* 270 */
877 .long sys_utimes 877 .long sys_utimes
878 .long sys_fadvise64_64 878 .long sys_fadvise64_64
879 .long sys_ni_syscall /* sys_vserver */ 879 .long sys_ni_syscall /* sys_vserver */
880 .long sys_ni_syscall /* sys_mbind */ 880 .long sys_ni_syscall /* sys_mbind */
881 .long sys_ni_syscall /* 275 sys_get_mempolicy */ 881 .long sys_ni_syscall /* 275 sys_get_mempolicy */
@@ -886,7 +886,7 @@ sys_call_table:
886 .long sys_mq_timedreceive /* 280 */ 886 .long sys_mq_timedreceive /* 280 */
887 .long sys_mq_notify 887 .long sys_mq_notify
888 .long sys_mq_getsetattr 888 .long sys_mq_getsetattr
889 .long sys_ni_syscall /* reserved for kexec */ 889 .long sys_ni_syscall
890 .long sys_waitid 890 .long sys_waitid
891 .long sys_ni_syscall /* 285 */ /* available */ 891 .long sys_ni_syscall /* 285 */ /* available */
892 .long sys_add_key 892 .long sys_add_key
@@ -939,6 +939,22 @@ sys_call_table:
939 .long sys_preadv 939 .long sys_preadv
940 .long sys_pwritev 940 .long sys_pwritev
941 .long sys_setns /* 335 */ 941 .long sys_setns /* 335 */
942 .long sys_name_to_handle_at
943 .long sys_open_by_handle_at
944 .long sys_rt_tgsigqueueinfo
945 .long sys_perf_event_open
946 .long sys_recvmmsg /* 340 */
947 .long sys_accept4
948 .long sys_fanotify_init
949 .long sys_fanotify_mark
950 .long sys_prlimit64
951 .long sys_clock_adjtime /* 345 */
952 .long sys_syncfs
953 .long sys_sendmmsg
954 .long sys_process_vm_readv
955 .long sys_process_vm_writev
956 .long sys_kcmp /* 350 */
957 .long sys_finit_module
942 958
943 /* 959 /*
944 * NOTE!! This doesn't have to be exact - we just have 960 * NOTE!! This doesn't have to be exact - we just have
@@ -950,4 +966,4 @@ sys_call_table:
950 .rept NR_syscalls-(.-sys_call_table)/4 966 .rept NR_syscalls-(.-sys_call_table)/4
951 .long sys_ni_syscall 967 .long sys_ni_syscall
952 .endr 968 .endr
953 969
diff --git a/arch/cris/arch-v10/kernel/head.S b/arch/cris/arch-v10/kernel/head.S
index a1f2014b4e3b..4a146e1749c9 100644
--- a/arch/cris/arch-v10/kernel/head.S
+++ b/arch/cris/arch-v10/kernel/head.S
@@ -1,12 +1,10 @@
1/* 1/*
2 * Head of the kernel - alter with care 2 * Head of the kernel - alter with care
3 * 3 *
4 * Copyright (C) 2000, 2001 Axis Communications AB 4 * Copyright (C) 2000, 2001, 2010 Axis Communications AB
5 * 5 *
6 * Authors: Bjorn Wesen (bjornw@axis.com)
7 *
8 */ 6 */
9 7
10#define ASSEMBLER_MACROS_ONLY 8#define ASSEMBLER_MACROS_ONLY
11/* The IO_* macros use the ## token concatenation operator, so 9/* The IO_* macros use the ## token concatenation operator, so
12 -traditional must not be used when assembling this file. */ 10 -traditional must not be used when assembling this file. */
@@ -18,15 +16,15 @@
18 16
19#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\ 17#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\
20 IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) 18 IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk)
21 19
22 ;; exported symbols 20 ;; exported symbols
23 21
24 .globl etrax_irv 22 .globl etrax_irv
25 .globl romfs_start 23 .globl romfs_start
26 .globl romfs_length 24 .globl romfs_length
27 .globl romfs_in_flash 25 .globl romfs_in_flash
28 .globl swapper_pg_dir 26 .globl swapper_pg_dir
29 27
30 .text 28 .text
31 29
32 ;; This is the entry point of the kernel. We are in supervisor mode. 30 ;; This is the entry point of the kernel. We are in supervisor mode.
@@ -35,10 +33,10 @@
35 ;; put a nop (2 bytes) here first so we dont accidentally skip the di 33 ;; put a nop (2 bytes) here first so we dont accidentally skip the di
36 ;; 34 ;;
37 ;; NOTICE! The registers r8 and r9 are used as parameters carrying 35 ;; NOTICE! The registers r8 and r9 are used as parameters carrying
38 ;; information from the decompressor (if the kernel was compressed). 36 ;; information from the decompressor (if the kernel was compressed).
39 ;; They should not be used in the code below until read. 37 ;; They should not be used in the code below until read.
40 38
41 nop 39 nop
42 di 40 di
43 41
44 ;; First setup the kseg_c mapping from where the kernel is linked 42 ;; First setup the kseg_c mapping from where the kernel is linked
@@ -58,19 +56,19 @@
58 56
59#ifdef CONFIG_CRIS_LOW_MAP 57#ifdef CONFIG_CRIS_LOW_MAP
60 ; kseg mappings, temporary map of 0xc0->0x40 58 ; kseg mappings, temporary map of 0xc0->0x40
61 move.d IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \ 59 move.d IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \
62 | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb) \ 60 | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb) \
63 | IO_FIELD (R_MMU_KBASE_HI, base_9, 9) \ 61 | IO_FIELD (R_MMU_KBASE_HI, base_9, 9) \
64 | IO_FIELD (R_MMU_KBASE_HI, base_8, 8), $r0 62 | IO_FIELD (R_MMU_KBASE_HI, base_8, 8), $r0
65 move.d $r0, [R_MMU_KBASE_HI] 63 move.d $r0, [R_MMU_KBASE_HI]
66 64
67 ; temporary map of 0x40->0x40 and 0x60->0x40 65 ; temporary map of 0x40->0x40 and 0x60->0x40
68 move.d IO_FIELD (R_MMU_KBASE_LO, base_6, 4) \ 66 move.d IO_FIELD (R_MMU_KBASE_LO, base_6, 4) \
69 | IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0 67 | IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0
70 move.d $r0, [R_MMU_KBASE_LO] 68 move.d $r0, [R_MMU_KBASE_LO]
71 69
72 ; mmu enable, segs e,c,b,a,6,5,4,0 segment mapped 70 ; mmu enable, segs e,c,b,a,6,5,4,0 segment mapped
73 move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \ 71 move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \
74 | IO_STATE (R_MMU_CONFIG, inv_excp, enable) \ 72 | IO_STATE (R_MMU_CONFIG, inv_excp, enable) \
75 | IO_STATE (R_MMU_CONFIG, acc_excp, enable) \ 73 | IO_STATE (R_MMU_CONFIG, acc_excp, enable) \
76 | IO_STATE (R_MMU_CONFIG, we_excp, enable) \ 74 | IO_STATE (R_MMU_CONFIG, we_excp, enable) \
@@ -93,17 +91,17 @@
93 move.d $r0, [R_MMU_CONFIG] 91 move.d $r0, [R_MMU_CONFIG]
94#else 92#else
95 ; kseg mappings 93 ; kseg mappings
96 move.d IO_FIELD (R_MMU_KBASE_HI, base_e, 8) \ 94 move.d IO_FIELD (R_MMU_KBASE_HI, base_e, 8) \
97 | IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \ 95 | IO_FIELD (R_MMU_KBASE_HI, base_c, 4) \
98 | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb), $r0 96 | IO_FIELD (R_MMU_KBASE_HI, base_b, 0xb), $r0
99 move.d $r0, [R_MMU_KBASE_HI] 97 move.d $r0, [R_MMU_KBASE_HI]
100 98
101 ; temporary map of 0x40->0x40 and 0x00->0x00 99 ; temporary map of 0x40->0x40 and 0x00->0x00
102 move.d IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0 100 move.d IO_FIELD (R_MMU_KBASE_LO, base_4, 4), $r0
103 move.d $r0, [R_MMU_KBASE_LO] 101 move.d $r0, [R_MMU_KBASE_LO]
104 102
105 ; mmu enable, segs f,e,c,b,4,0 segment mapped 103 ; mmu enable, segs f,e,c,b,4,0 segment mapped
106 move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \ 104 move.d IO_STATE (R_MMU_CONFIG, mmu_enable, enable) \
107 | IO_STATE (R_MMU_CONFIG, inv_excp, enable) \ 105 | IO_STATE (R_MMU_CONFIG, inv_excp, enable) \
108 | IO_STATE (R_MMU_CONFIG, acc_excp, enable) \ 106 | IO_STATE (R_MMU_CONFIG, acc_excp, enable) \
109 | IO_STATE (R_MMU_CONFIG, we_excp, enable) \ 107 | IO_STATE (R_MMU_CONFIG, we_excp, enable) \
@@ -141,12 +139,12 @@
141 ;; 139 ;;
142 ;; In both cases, we start in un-cached mode, and need to jump into a 140 ;; In both cases, we start in un-cached mode, and need to jump into a
143 ;; cached PC after we're done fiddling around with the segments. 141 ;; cached PC after we're done fiddling around with the segments.
144 ;; 142 ;;
145 ;; arch/etrax100/etrax100.ld sets some symbols that define the start 143 ;; arch/etrax100/etrax100.ld sets some symbols that define the start
146 ;; and end of each segment. 144 ;; and end of each segment.
147 145
148 ;; Check if we start from DRAM or FLASH by testing PC 146 ;; Check if we start from DRAM or FLASH by testing PC
149 147
150 move.d $pc,$r0 148 move.d $pc,$r0
151 and.d 0x7fffffff,$r0 ; get rid of the non-cache bit 149 and.d 0x7fffffff,$r0 ; get rid of the non-cache bit
152 cmp.d 0x10000,$r0 ; arbitrary... just something above this code 150 cmp.d 0x10000,$r0 ; arbitrary... just something above this code
@@ -163,30 +161,28 @@ _inflash0:
163 ;; after init. 161 ;; after init.
164 .section ".init.text", "ax" 162 .section ".init.text", "ax"
165_inflash: 163_inflash:
166#ifdef CONFIG_ETRAX_ETHERNET 164#ifdef CONFIG_ETRAX_ETHERNET
167 ;; Start MII clock to make sure it is running when tranceiver is reset 165 ;; Start MII clock to make sure it is running when tranceiver is reset
168 move.d START_ETHERNET_CLOCK, $r0 166 move.d START_ETHERNET_CLOCK, $r0
169 move.d $r0, [R_NETWORK_GEN_CONFIG] 167 move.d $r0, [R_NETWORK_GEN_CONFIG]
170#endif 168#endif
171 169
172 ;; Set up waitstates etc according to kernel configuration. 170 ;; Set up waitstates etc according to kernel configuration.
173#ifndef CONFIG_SVINTO_SIM
174 move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0 171 move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0
175 move.d $r0, [R_WAITSTATES] 172 move.d $r0, [R_WAITSTATES]
176 173
177 move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0 174 move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0
178 move.d $r0, [R_BUS_CONFIG] 175 move.d $r0, [R_BUS_CONFIG]
179#endif
180 176
181 ;; We need to initialze DRAM registers before we start using the DRAM 177 ;; We need to initialze DRAM registers before we start using the DRAM
182 178
183 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized? 179 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
184 beq _dram_init_finished 180 beq _dram_init_finished
185 nop 181 nop
186 182
187#include "../lib/dram_init.S" 183#include "../lib/dram_init.S"
188 184
189_dram_init_finished: 185_dram_init_finished:
190 ;; Copy text+data to DRAM 186 ;; Copy text+data to DRAM
191 ;; This is fragile - the calculation of r4 as the image size depends 187 ;; This is fragile - the calculation of r4 as the image size depends
192 ;; on that the labels below actually are the first and last positions 188 ;; on that the labels below actually are the first and last positions
@@ -198,7 +194,7 @@ _dram_init_finished:
198 ;; between the physical start of the flash and the flash-image start, 194 ;; between the physical start of the flash and the flash-image start,
199 ;; and when run with compression, the kernel is actually unpacked to 195 ;; and when run with compression, the kernel is actually unpacked to
200 ;; DRAM and we never get here in the first place :)) 196 ;; DRAM and we never get here in the first place :))
201 197
202 moveq 0, $r0 ; source 198 moveq 0, $r0 ; source
203 move.d text_start, $r1 ; destination 199 move.d text_start, $r1 ; destination
204 move.d __vmlinux_end, $r2 ; end destination 200 move.d __vmlinux_end, $r2 ; end destination
@@ -229,10 +225,10 @@ _dram_init_finished:
229 add.d 0xf0000000, $r4 ; add flash start in virtual memory (cached) 225 add.d 0xf0000000, $r4 ; add flash start in virtual memory (cached)
230#endif 226#endif
231 move.d $r4, [romfs_start] 227 move.d $r4, [romfs_start]
2321: 2281:
233 moveq 1, $r0 229 moveq 1, $r0
234 move.d $r0, [romfs_in_flash] 230 move.d $r0, [romfs_in_flash]
235 231
236 jump _start_it ; enter code, cached this time 232 jump _start_it ; enter code, cached this time
237 233
238_inram: 234_inram:
@@ -241,7 +237,7 @@ _inram:
241 237
242 moveq 0, $r0 238 moveq 0, $r0
243 move.d $r0, [romfs_length] ; default if there is no cramfs 239 move.d $r0, [romfs_length] ; default if there is no cramfs
244 240
245 ;; The kernel could have been unpacked to DRAM by the loader, but 241 ;; The kernel could have been unpacked to DRAM by the loader, but
246 ;; the cramfs image could still be in the Flash directly after the 242 ;; the cramfs image could still be in the Flash directly after the
247 ;; compressed kernel image. The loader passes the address of the 243 ;; compressed kernel image. The loader passes the address of the
@@ -251,7 +247,7 @@ _inram:
251 ;; (Notice that if this is not booted from the loader, r9 will be 247 ;; (Notice that if this is not booted from the loader, r9 will be
252 ;; garbage but we do sanity checks on it, the chance that it points 248 ;; garbage but we do sanity checks on it, the chance that it points
253 ;; to a cramfs magic is small.. ) 249 ;; to a cramfs magic is small.. )
254 250
255 cmp.d 0x0ffffff8, $r9 251 cmp.d 0x0ffffff8, $r9
256 bhs _no_romfs_in_flash ; r9 points outside the flash area 252 bhs _no_romfs_in_flash ; r9 points outside the flash area
257 nop 253 nop
@@ -274,7 +270,7 @@ _inram:
274 jump _start_it ; enter code, cached this time 270 jump _start_it ; enter code, cached this time
275 271
276_no_romfs_in_flash: 272_no_romfs_in_flash:
277 273
278 ;; Check if there is a cramfs (magic value). 274 ;; Check if there is a cramfs (magic value).
279 ;; Notice that we check for cramfs magic value - which is 275 ;; Notice that we check for cramfs magic value - which is
280 ;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does 276 ;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does
@@ -286,8 +282,8 @@ _no_romfs_in_flash:
286 bne 2f 282 bne 2f
287 nop 283 nop
288 284
289 ;; Ok. What is its size ? 285 ;; Ok. What is its size ?
290 286
291 move.d [$r0 + 4], $r2 ; cramfs_super.size (again, no need to swapwb) 287 move.d [$r0 + 4], $r2 ; cramfs_super.size (again, no need to swapwb)
292 288
293 ;; We want to copy it to the end of the BSS 289 ;; We want to copy it to the end of the BSS
@@ -303,7 +299,7 @@ _no_romfs_in_flash:
303 299
304 add.d $r2, $r0 300 add.d $r2, $r0
305 add.d $r2, $r1 301 add.d $r2, $r1
306 302
307 ;; Go ahead. Make my loop. 303 ;; Go ahead. Make my loop.
308 304
309 lsrq 1, $r2 ; size is in bytes, we copy words 305 lsrq 1, $r2 ; size is in bytes, we copy words
@@ -314,14 +310,14 @@ _no_romfs_in_flash:
314 bne 1b 310 bne 1b
315 nop 311 nop
316 312
3172: 3132:
318 ;; Dont worry that the BSS is tainted. It will be cleared later. 314 ;; Dont worry that the BSS is tainted. It will be cleared later.
319 315
320 moveq 0, $r0 316 moveq 0, $r0
321 move.d $r0, [romfs_in_flash] 317 move.d $r0, [romfs_in_flash]
322 318
323 jump _start_it ; better skip the additional cramfs check below 319 jump _start_it ; better skip the additional cramfs check below
324 320
325_start_it: 321_start_it:
326 322
327 ;; Check if kernel command line is supplied 323 ;; Check if kernel command line is supplied
@@ -348,7 +344,7 @@ no_command_line:
348 move.d ibr_start,$r0 ; this symbol is set by the linker script 344 move.d ibr_start,$r0 ; this symbol is set by the linker script
349 move $r0,$ibr 345 move $r0,$ibr
350 move.d $r0,[etrax_irv] ; set the interrupt base register and pointer 346 move.d $r0,[etrax_irv] ; set the interrupt base register and pointer
351 347
352 ;; Clear BSS region, from _bss_start to _end 348 ;; Clear BSS region, from _bss_start to _end
353 349
354 move.d __bss_start, $r0 350 move.d __bss_start, $r0
@@ -357,7 +353,7 @@ no_command_line:
357 cmp.d $r1, $r0 353 cmp.d $r1, $r0
358 blo 1b 354 blo 1b
359 nop 355 nop
360 356
361#ifdef CONFIG_BLK_DEV_ETRAXIDE 357#ifdef CONFIG_BLK_DEV_ETRAXIDE
362 ;; disable ATA before enabling it in genconfig below 358 ;; disable ATA before enabling it in genconfig below
363 moveq 0,$r0 359 moveq 0,$r0
@@ -380,7 +376,7 @@ no_command_line:
380 376
381#ifdef CONFIG_JULIETTE 377#ifdef CONFIG_JULIETTE
382 ;; configure external DMA channel 0 before enabling it in genconfig 378 ;; configure external DMA channel 0 before enabling it in genconfig
383 379
384 moveq 0,$r0 380 moveq 0,$r0
385 move.d $r0,[R_EXT_DMA_0_ADDR] 381 move.d $r0,[R_EXT_DMA_0_ADDR]
386 ; cnt enable, word size, output, stop, size 0 382 ; cnt enable, word size, output, stop, size 0
@@ -395,7 +391,7 @@ no_command_line:
395 move.d $r0,[R_EXT_DMA_0_CMD] 391 move.d $r0,[R_EXT_DMA_0_CMD]
396 392
397 ;; reset dma4 and wait for completion 393 ;; reset dma4 and wait for completion
398 394
399 moveq IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0 395 moveq IO_STATE (R_DMA_CH4_CMD, cmd, reset),$r0
400 move.b $r0,[R_DMA_CH4_CMD] 396 move.b $r0,[R_DMA_CH4_CMD]
4011: move.b [R_DMA_CH4_CMD],$r0 3971: move.b [R_DMA_CH4_CMD],$r0
@@ -405,7 +401,7 @@ no_command_line:
405 nop 401 nop
406 402
407 ;; reset dma5 and wait for completion 403 ;; reset dma5 and wait for completion
408 404
409 moveq IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0 405 moveq IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0
410 move.b $r0,[R_DMA_CH5_CMD] 406 move.b $r0,[R_DMA_CH5_CMD]
4111: move.b [R_DMA_CH5_CMD],$r0 4071: move.b [R_DMA_CH5_CMD],$r0
@@ -413,8 +409,8 @@ no_command_line:
413 cmp.b IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0 409 cmp.b IO_STATE (R_DMA_CH5_CMD, cmd, reset),$r0
414 beq 1b 410 beq 1b
415 nop 411 nop
416#endif 412#endif
417 413
418 ;; Etrax product HW genconfig setup 414 ;; Etrax product HW genconfig setup
419 415
420 moveq 0,$r0 416 moveq 0,$r0
@@ -468,7 +464,6 @@ no_command_line:
468 464
469 move.d $r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG 465 move.d $r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG
470 466
471#ifndef CONFIG_SVINTO_SIM
472 move.d $r0,[R_GEN_CONFIG] 467 move.d $r0,[R_GEN_CONFIG]
473 468
474#if 0 469#if 0
@@ -486,7 +481,7 @@ no_command_line:
486 beq 1b 481 beq 1b
487 nop 482 nop
488#endif 483#endif
489 484
490 moveq IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0 485 moveq IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0
491 move.b $r0,[R_DMA_CH8_CMD] ; reset (ser1 dma out) 486 move.b $r0,[R_DMA_CH8_CMD] ; reset (ser1 dma out)
492 move.b $r0,[R_DMA_CH9_CMD] ; reset (ser1 dma in) 487 move.b $r0,[R_DMA_CH9_CMD] ; reset (ser1 dma in)
@@ -503,7 +498,7 @@ no_command_line:
503 498
504 ;; setup port PA and PB default initial directions and data 499 ;; setup port PA and PB default initial directions and data
505 ;; including their shadow registers 500 ;; including their shadow registers
506 501
507 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR,$r0 502 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR,$r0
508#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7) 503#if defined(CONFIG_BLUETOOTH) && defined(CONFIG_BLUETOOTH_RESET_PA7)
509 or.b IO_STATE (R_PORT_PA_DIR, dir7, output),$r0 504 or.b IO_STATE (R_PORT_PA_DIR, dir7, output),$r0
@@ -520,7 +515,7 @@ no_command_line:
520#endif 515#endif
521 move.b $r0,[port_pa_data_shadow] 516 move.b $r0,[port_pa_data_shadow]
522 move.b $r0,[R_PORT_PA_DATA] 517 move.b $r0,[R_PORT_PA_DATA]
523 518
524 move.b CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG,$r0 519 move.b CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG,$r0
525 move.b $r0,[port_pb_config_shadow] 520 move.b $r0,[port_pb_config_shadow]
526 move.b $r0,[R_PORT_PB_CONFIG] 521 move.b $r0,[R_PORT_PB_CONFIG]
@@ -562,13 +557,13 @@ no_command_line:
562#endif 557#endif
563 move.d $r0,[port_g_data_shadow] 558 move.d $r0,[port_g_data_shadow]
564 move.d $r0,[R_PORT_G_DATA] 559 move.d $r0,[R_PORT_G_DATA]
565 560
566 ;; setup the serial port 0 at 115200 baud for debug purposes 561 ;; setup the serial port 0 at 115200 baud for debug purposes
567 562
568 moveq IO_STATE (R_SERIAL0_XOFF, tx_stop, enable) \ 563 moveq IO_STATE (R_SERIAL0_XOFF, tx_stop, enable) \
569 | IO_STATE (R_SERIAL0_XOFF, auto_xoff, disable) \ 564 | IO_STATE (R_SERIAL0_XOFF, auto_xoff, disable) \
570 | IO_FIELD (R_SERIAL0_XOFF, xoff_char, 0),$r0 565 | IO_FIELD (R_SERIAL0_XOFF, xoff_char, 0),$r0
571 move.d $r0,[R_SERIAL0_XOFF] 566 move.d $r0,[R_SERIAL0_XOFF]
572 567
573 ; 115.2kbaud for both transmit and receive 568 ; 115.2kbaud for both transmit and receive
574 move.b IO_STATE (R_SERIAL0_BAUD, tr_baud, c115k2Hz) \ 569 move.b IO_STATE (R_SERIAL0_BAUD, tr_baud, c115k2Hz) \
@@ -584,8 +579,8 @@ no_command_line:
584 | IO_STATE (R_SERIAL0_REC_CTRL, rec_par, even) \ 579 | IO_STATE (R_SERIAL0_REC_CTRL, rec_par, even) \
585 | IO_STATE (R_SERIAL0_REC_CTRL, rec_par_en, disable) \ 580 | IO_STATE (R_SERIAL0_REC_CTRL, rec_par_en, disable) \
586 | IO_STATE (R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit),$r0 581 | IO_STATE (R_SERIAL0_REC_CTRL, rec_bitnr, rec_8bit),$r0
587 move.b $r0,[R_SERIAL0_REC_CTRL] 582 move.b $r0,[R_SERIAL0_REC_CTRL]
588 583
589 ; Set up and enable the serial0 transmitter. 584 ; Set up and enable the serial0 transmitter.
590 move.b IO_FIELD (R_SERIAL0_TR_CTRL, txd, 0) \ 585 move.b IO_FIELD (R_SERIAL0_TR_CTRL, txd, 0) \
591 | IO_STATE (R_SERIAL0_TR_CTRL, tr_enable, enable) \ 586 | IO_STATE (R_SERIAL0_TR_CTRL, tr_enable, enable) \
@@ -598,11 +593,11 @@ no_command_line:
598 move.b $r0,[R_SERIAL0_TR_CTRL] 593 move.b $r0,[R_SERIAL0_TR_CTRL]
599 594
600 ;; setup the serial port 1 at 115200 baud for debug purposes 595 ;; setup the serial port 1 at 115200 baud for debug purposes
601 596
602 moveq IO_STATE (R_SERIAL1_XOFF, tx_stop, enable) \ 597 moveq IO_STATE (R_SERIAL1_XOFF, tx_stop, enable) \
603 | IO_STATE (R_SERIAL1_XOFF, auto_xoff, disable) \ 598 | IO_STATE (R_SERIAL1_XOFF, auto_xoff, disable) \
604 | IO_FIELD (R_SERIAL1_XOFF, xoff_char, 0),$r0 599 | IO_FIELD (R_SERIAL1_XOFF, xoff_char, 0),$r0
605 move.d $r0,[R_SERIAL1_XOFF] 600 move.d $r0,[R_SERIAL1_XOFF]
606 601
607 ; 115.2kbaud for both transmit and receive 602 ; 115.2kbaud for both transmit and receive
608 move.b IO_STATE (R_SERIAL1_BAUD, tr_baud, c115k2Hz) \ 603 move.b IO_STATE (R_SERIAL1_BAUD, tr_baud, c115k2Hz) \
@@ -618,8 +613,8 @@ no_command_line:
618 | IO_STATE (R_SERIAL1_REC_CTRL, rec_par, even) \ 613 | IO_STATE (R_SERIAL1_REC_CTRL, rec_par, even) \
619 | IO_STATE (R_SERIAL1_REC_CTRL, rec_par_en, disable) \ 614 | IO_STATE (R_SERIAL1_REC_CTRL, rec_par_en, disable) \
620 | IO_STATE (R_SERIAL1_REC_CTRL, rec_bitnr, rec_8bit),$r0 615 | IO_STATE (R_SERIAL1_REC_CTRL, rec_bitnr, rec_8bit),$r0
621 move.b $r0,[R_SERIAL1_REC_CTRL] 616 move.b $r0,[R_SERIAL1_REC_CTRL]
622 617
623 ; Set up and enable the serial1 transmitter. 618 ; Set up and enable the serial1 transmitter.
624 move.b IO_FIELD (R_SERIAL1_TR_CTRL, txd, 0) \ 619 move.b IO_FIELD (R_SERIAL1_TR_CTRL, txd, 0) \
625 | IO_STATE (R_SERIAL1_TR_CTRL, tr_enable, enable) \ 620 | IO_STATE (R_SERIAL1_TR_CTRL, tr_enable, enable) \
@@ -666,14 +661,14 @@ no_command_line:
666 | IO_STATE (R_SERIAL2_TR_CTRL, tr_bitnr, tr_8bit),$r0 661 | IO_STATE (R_SERIAL2_TR_CTRL, tr_bitnr, tr_8bit),$r0
667 move.b $r0,[R_SERIAL2_TR_CTRL] 662 move.b $r0,[R_SERIAL2_TR_CTRL]
668#endif 663#endif
669 664
670#ifdef CONFIG_ETRAX_SERIAL_PORT3 665#ifdef CONFIG_ETRAX_SERIAL_PORT3
671 ;; setup the serial port 3 at 115200 baud for debug purposes 666 ;; setup the serial port 3 at 115200 baud for debug purposes
672 667
673 moveq IO_STATE (R_SERIAL3_XOFF, tx_stop, enable) \ 668 moveq IO_STATE (R_SERIAL3_XOFF, tx_stop, enable) \
674 | IO_STATE (R_SERIAL3_XOFF, auto_xoff, disable) \ 669 | IO_STATE (R_SERIAL3_XOFF, auto_xoff, disable) \
675 | IO_FIELD (R_SERIAL3_XOFF, xoff_char, 0),$r0 670 | IO_FIELD (R_SERIAL3_XOFF, xoff_char, 0),$r0
676 move.d $r0,[R_SERIAL3_XOFF] 671 move.d $r0,[R_SERIAL3_XOFF]
677 672
678 ; 115.2kbaud for both transmit and receive 673 ; 115.2kbaud for both transmit and receive
679 move.b IO_STATE (R_SERIAL3_BAUD, tr_baud, c115k2Hz) \ 674 move.b IO_STATE (R_SERIAL3_BAUD, tr_baud, c115k2Hz) \
@@ -689,8 +684,8 @@ no_command_line:
689 | IO_STATE (R_SERIAL3_REC_CTRL, rec_par, even) \ 684 | IO_STATE (R_SERIAL3_REC_CTRL, rec_par, even) \
690 | IO_STATE (R_SERIAL3_REC_CTRL, rec_par_en, disable) \ 685 | IO_STATE (R_SERIAL3_REC_CTRL, rec_par_en, disable) \
691 | IO_STATE (R_SERIAL3_REC_CTRL, rec_bitnr, rec_8bit),$r0 686 | IO_STATE (R_SERIAL3_REC_CTRL, rec_bitnr, rec_8bit),$r0
692 move.b $r0,[R_SERIAL3_REC_CTRL] 687 move.b $r0,[R_SERIAL3_REC_CTRL]
693 688
694 ; Set up and enable the serial3 transmitter. 689 ; Set up and enable the serial3 transmitter.
695 move.b IO_FIELD (R_SERIAL3_TR_CTRL, txd, 0) \ 690 move.b IO_FIELD (R_SERIAL3_TR_CTRL, txd, 0) \
696 | IO_STATE (R_SERIAL3_TR_CTRL, tr_enable, enable) \ 691 | IO_STATE (R_SERIAL3_TR_CTRL, tr_enable, enable) \
@@ -702,13 +697,11 @@ no_command_line:
702 | IO_STATE (R_SERIAL3_TR_CTRL, tr_bitnr, tr_8bit),$r0 697 | IO_STATE (R_SERIAL3_TR_CTRL, tr_bitnr, tr_8bit),$r0
703 move.b $r0,[R_SERIAL3_TR_CTRL] 698 move.b $r0,[R_SERIAL3_TR_CTRL]
704#endif 699#endif
705
706#endif /* CONFIG_SVINTO_SIM */
707 700
708 jump start_kernel ; jump into the C-function start_kernel in init/main.c 701 jump start_kernel ; jump into the C-function start_kernel in init/main.c
709 702
710 .data 703 .data
711etrax_irv: 704etrax_irv:
712 .dword 0 705 .dword 0
713romfs_start: 706romfs_start:
714 .dword 0 707 .dword 0
@@ -716,13 +709,13 @@ romfs_length:
716 .dword 0 709 .dword 0
717romfs_in_flash: 710romfs_in_flash:
718 .dword 0 711 .dword 0
719 712
720 ;; put some special pages at the beginning of the kernel aligned 713 ;; put some special pages at the beginning of the kernel aligned
721 ;; to page boundaries - the kernel cannot start until after this 714 ;; to page boundaries - the kernel cannot start until after this
722 715
723#ifdef CONFIG_CRIS_LOW_MAP 716#ifdef CONFIG_CRIS_LOW_MAP
724swapper_pg_dir = 0x60002000 717swapper_pg_dir = 0x60002000
725#else 718#else
726swapper_pg_dir = 0xc0002000 719swapper_pg_dir = 0xc0002000
727#endif 720#endif
728 721
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index ba0e5965d6e3..09cae80a834a 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Authors: Bjorn Wesen (bjornw@axis.com) 6 * Authors: Bjorn Wesen (bjornw@axis.com)
7 * 7 *
8 * This file contains the interrupt vectors and some 8 * This file contains the interrupt vectors and some
9 * helper functions 9 * helper functions
10 * 10 *
11 */ 11 */
@@ -182,19 +182,14 @@ void do_multiple_IRQ(struct pt_regs* regs)
182 setting the irq vector table. 182 setting the irq vector table.
183*/ 183*/
184 184
185void __init 185void __init init_IRQ(void)
186init_IRQ(void)
187{ 186{
188 int i; 187 int i;
189 188
190 /* clear all interrupt masks */ 189 /* clear all interrupt masks */
191
192#ifndef CONFIG_SVINTO_SIM
193 *R_IRQ_MASK0_CLR = 0xffffffff; 190 *R_IRQ_MASK0_CLR = 0xffffffff;
194 *R_IRQ_MASK1_CLR = 0xffffffff; 191 *R_IRQ_MASK1_CLR = 0xffffffff;
195 *R_IRQ_MASK2_CLR = 0xffffffff; 192 *R_IRQ_MASK2_CLR = 0xffffffff;
196#endif
197
198 *R_VECT_MASK_CLR = 0xffffffff; 193 *R_VECT_MASK_CLR = 0xffffffff;
199 194
200 for (i = 0; i < 256; i++) 195 for (i = 0; i < 256; i++)
@@ -211,25 +206,20 @@ init_IRQ(void)
211 executed by the associated break handler, rather than just a jump 206 executed by the associated break handler, rather than just a jump
212 address. therefore we need to setup a default breakpoint handler 207 address. therefore we need to setup a default breakpoint handler
213 for all breakpoints */ 208 for all breakpoints */
214
215 for (i = 0; i < 16; i++) 209 for (i = 0; i < 16; i++)
216 set_break_vector(i, do_sigtrap); 210 set_break_vector(i, do_sigtrap);
217
218 /* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */
219 211
212 /* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */
220 set_int_vector(15, multiple_interrupt); 213 set_int_vector(15, multiple_interrupt);
221
222 /* 0 and 1 which are special breakpoint/NMI traps */
223 214
215 /* 0 and 1 which are special breakpoint/NMI traps */
224 set_int_vector(0, hwbreakpoint); 216 set_int_vector(0, hwbreakpoint);
225 set_int_vector(1, IRQ1_interrupt); 217 set_int_vector(1, IRQ1_interrupt);
226 218
227 /* and irq 14 which is the mmu bus fault handler */ 219 /* and irq 14 which is the mmu bus fault handler */
228
229 set_int_vector(14, mmu_bus_fault); 220 set_int_vector(14, mmu_bus_fault);
230 221
231 /* setup the system-call trap, which is reached by BREAK 13 */ 222 /* setup the system-call trap, which is reached by BREAK 13 */
232
233 set_break_vector(13, system_call); 223 set_break_vector(13, system_call);
234 224
235 /* setup a breakpoint handler for debugging used for both user and 225 /* setup a breakpoint handler for debugging used for both user and
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index 753e9a03cf87..02b783457be0 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -56,14 +56,14 @@ void hard_reset_now (void)
56 * code to know about it than the watchdog handler in entry.S and 56 * code to know about it than the watchdog handler in entry.S and
57 * this code, implementing hard reset through the watchdog. 57 * this code, implementing hard reset through the watchdog.
58 */ 58 */
59#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 59#if defined(CONFIG_ETRAX_WATCHDOG)
60 extern int cause_of_death; 60 extern int cause_of_death;
61#endif 61#endif
62 62
63 printk("*** HARD RESET ***\n"); 63 printk("*** HARD RESET ***\n");
64 local_irq_disable(); 64 local_irq_disable();
65 65
66#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 66#if defined(CONFIG_ETRAX_WATCHDOG)
67 cause_of_death = 0xbedead; 67 cause_of_death = 0xbedead;
68#else 68#else
69 /* Since we dont plan to keep on resetting the watchdog, 69 /* Since we dont plan to keep on resetting the watchdog,
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index fce7c541d70d..b5eb5cd2f60b 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -14,7 +14,6 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <arch/svinto.h>
18#include <asm/types.h> 17#include <asm/types.h>
19#include <asm/signal.h> 18#include <asm/signal.h>
20#include <asm/io.h> 19#include <asm/io.h>
@@ -34,7 +33,7 @@ unsigned long get_ns_in_jiffie(void)
34 33
35 local_irq_save(flags); 34 local_irq_save(flags);
36 timer_count = *R_TIMER0_DATA; 35 timer_count = *R_TIMER0_DATA;
37 presc_count = *R_TIM_PRESC_STATUS; 36 presc_count = *R_TIM_PRESC_STATUS;
38 /* presc_count might be wrapped */ 37 /* presc_count might be wrapped */
39 t1 = *R_TIMER0_DATA; 38 t1 = *R_TIMER0_DATA;
40 39
@@ -50,7 +49,7 @@ unsigned long get_ns_in_jiffie(void)
50 presc_count = PRESCALE_VALUE - presc_count - PRESCALE_VALUE/2; 49 presc_count = PRESCALE_VALUE - presc_count - PRESCALE_VALUE/2;
51 } 50 }
52 51
53 ns = ( (TIMER0_DIV - timer_count) * ((1000000000/HZ)/TIMER0_DIV )) + 52 ns = ( (TIMER0_DIV - timer_count) * ((1000000000/HZ)/TIMER0_DIV )) +
54 ( (presc_count) * (1000000000/PRESCALE_FREQ)); 53 ( (presc_count) * (1000000000/PRESCALE_FREQ));
55 return ns; 54 return ns;
56} 55}
@@ -80,7 +79,7 @@ static u32 cris_v10_gettimeoffset(void)
80 * by the R_WATCHDOG register. The R_WATCHDOG register contains an enable bit 79 * by the R_WATCHDOG register. The R_WATCHDOG register contains an enable bit
81 * and a 3-bit key value. The effect of writing to the R_WATCHDOG register is 80 * and a 3-bit key value. The effect of writing to the R_WATCHDOG register is
82 * described in the table below: 81 * described in the table below:
83 * 82 *
84 * Watchdog Value written: 83 * Watchdog Value written:
85 * state: To enable: To key: Operation: 84 * state: To enable: To key: Operation:
86 * -------- ---------- ------- ---------- 85 * -------- ---------- ------- ----------
@@ -89,15 +88,15 @@ static u32 cris_v10_gettimeoffset(void)
89 * started 0 ~key Stop watchdog 88 * started 0 ~key Stop watchdog
90 * started 1 ~key Restart watchdog with key = ~key. 89 * started 1 ~key Restart watchdog with key = ~key.
91 * started X new_key_val Change key to new_key_val. 90 * started X new_key_val Change key to new_key_val.
92 * 91 *
93 * Note: '~' is the bitwise NOT operator. 92 * Note: '~' is the bitwise NOT operator.
94 * 93 *
95 */ 94 */
96 95
97/* right now, starting the watchdog is the same as resetting it */ 96/* right now, starting the watchdog is the same as resetting it */
98#define start_watchdog reset_watchdog 97#define start_watchdog reset_watchdog
99 98
100#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 99#ifdef CONFIG_ETRAX_WATCHDOG
101static int watchdog_key = 0; /* arbitrary number */ 100static int watchdog_key = 0; /* arbitrary number */
102#endif 101#endif
103 102
@@ -107,10 +106,9 @@ static int watchdog_key = 0; /* arbitrary number */
107 106
108#define WATCHDOG_MIN_FREE_PAGES 8 107#define WATCHDOG_MIN_FREE_PAGES 8
109 108
110void 109void reset_watchdog(void)
111reset_watchdog(void)
112{ 110{
113#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 111#if defined(CONFIG_ETRAX_WATCHDOG)
114 /* only keep watchdog happy as long as we have memory left! */ 112 /* only keep watchdog happy as long as we have memory left! */
115 if(nr_free_pages() > WATCHDOG_MIN_FREE_PAGES) { 113 if(nr_free_pages() > WATCHDOG_MIN_FREE_PAGES) {
116 /* reset the watchdog with the inverse of the old key */ 114 /* reset the watchdog with the inverse of the old key */
@@ -123,28 +121,23 @@ reset_watchdog(void)
123 121
124/* stop the watchdog - we still need the correct key */ 122/* stop the watchdog - we still need the correct key */
125 123
126void 124void stop_watchdog(void)
127stop_watchdog(void)
128{ 125{
129#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 126#ifdef CONFIG_ETRAX_WATCHDOG
130 watchdog_key ^= 0x7; /* invert key, which is 3 bits */ 127 watchdog_key ^= 0x7; /* invert key, which is 3 bits */
131 *R_WATCHDOG = IO_FIELD(R_WATCHDOG, key, watchdog_key) | 128 *R_WATCHDOG = IO_FIELD(R_WATCHDOG, key, watchdog_key) |
132 IO_STATE(R_WATCHDOG, enable, stop); 129 IO_STATE(R_WATCHDOG, enable, stop);
133#endif 130#endif
134} 131}
135 132
136 133
134extern void cris_do_profile(struct pt_regs *regs);
135
137/* 136/*
138 * timer_interrupt() needs to keep up the real-time clock, 137 * timer_interrupt() needs to keep up the real-time clock,
139 * as well as call the "xtime_update()" routine every clocktick 138 * as well as call the "xtime_update()" routine every clocktick
140 */ 139 */
141 140static inline irqreturn_t timer_interrupt(int irq, void *dev_id)
142//static unsigned short myjiff; /* used by our debug routine print_timestamp */
143
144extern void cris_do_profile(struct pt_regs *regs);
145
146static inline irqreturn_t
147timer_interrupt(int irq, void *dev_id)
148{ 141{
149 struct pt_regs *regs = get_irq_regs(); 142 struct pt_regs *regs = get_irq_regs();
150 /* acknowledge the timer irq */ 143 /* acknowledge the timer irq */
@@ -160,44 +153,39 @@ timer_interrupt(int irq, void *dev_id)
160 IO_STATE( R_TIMER_CTRL, tm0, run) | 153 IO_STATE( R_TIMER_CTRL, tm0, run) |
161 IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz); 154 IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
162#else 155#else
163 *R_TIMER_CTRL = r_timer_ctrl_shadow | 156 *R_TIMER_CTRL = r_timer_ctrl_shadow | IO_STATE(R_TIMER_CTRL, i0, clr);
164 IO_STATE(R_TIMER_CTRL, i0, clr);
165#endif 157#endif
166 158
167 /* reset watchdog otherwise it resets us! */ 159 /* reset watchdog otherwise it resets us! */
168 reset_watchdog(); 160 reset_watchdog();
169 161
170 /* Update statistics. */ 162 /* Update statistics. */
171 update_process_times(user_mode(regs)); 163 update_process_times(user_mode(regs));
172 164
173 /* call the real timer interrupt handler */ 165 /* call the real timer interrupt handler */
174
175 xtime_update(1); 166 xtime_update(1);
176 167
177 cris_do_profile(regs); /* Save profiling information */ 168 cris_do_profile(regs); /* Save profiling information */
178 return IRQ_HANDLED; 169 return IRQ_HANDLED;
179} 170}
180 171
181/* timer is IRQF_SHARED so drivers can add stuff to the timer irq chain 172/* timer is IRQF_SHARED so drivers can add stuff to the timer irq chain */
182 * it needs to be IRQF_DISABLED to make the jiffies update work properly
183 */
184 173
185static struct irqaction irq2 = { 174static struct irqaction irq2 = {
186 .handler = timer_interrupt, 175 .handler = timer_interrupt,
187 .flags = IRQF_SHARED | IRQF_DISABLED, 176 .flags = IRQF_SHARED,
188 .name = "timer", 177 .name = "timer",
189}; 178};
190 179
191void __init 180void __init time_init(void)
192time_init(void) 181{
193{
194 arch_gettimeoffset = cris_v10_gettimeoffset; 182 arch_gettimeoffset = cris_v10_gettimeoffset;
195 183
196 /* probe for the RTC and read it if it exists 184 /* probe for the RTC and read it if it exists
197 * Before the RTC can be probed the loops_per_usec variable needs 185 * Before the RTC can be probed the loops_per_usec variable needs
198 * to be initialized to make usleep work. A better value for 186 * to be initialized to make usleep work. A better value for
199 * loops_per_usec is calculated by the kernel later once the 187 * loops_per_usec is calculated by the kernel later once the
200 * clock has started. 188 * clock has started.
201 */ 189 */
202 loops_per_usec = 50; 190 loops_per_usec = 50;
203 191
@@ -208,7 +196,7 @@ time_init(void)
208 * Remember that linux/timex.h contains #defines that rely on the 196 * Remember that linux/timex.h contains #defines that rely on the
209 * timer settings below (hz and divide factor) !!! 197 * timer settings below (hz and divide factor) !!!
210 */ 198 */
211 199
212#ifdef USE_CASCADE_TIMERS 200#ifdef USE_CASCADE_TIMERS
213 *R_TIMER_CTRL = 201 *R_TIMER_CTRL =
214 IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) | 202 IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) |
@@ -219,8 +207,8 @@ time_init(void)
219 IO_STATE( R_TIMER_CTRL, i0, nop) | 207 IO_STATE( R_TIMER_CTRL, i0, nop) |
220 IO_STATE( R_TIMER_CTRL, tm0, stop_ld) | 208 IO_STATE( R_TIMER_CTRL, tm0, stop_ld) |
221 IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz); 209 IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
222 210
223 *R_TIMER_CTRL = r_timer_ctrl_shadow = 211 *R_TIMER_CTRL = r_timer_ctrl_shadow =
224 IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) | 212 IO_FIELD( R_TIMER_CTRL, timerdiv1, 0) |
225 IO_FIELD( R_TIMER_CTRL, timerdiv0, 0) | 213 IO_FIELD( R_TIMER_CTRL, timerdiv0, 0) |
226 IO_STATE( R_TIMER_CTRL, i1, nop) | 214 IO_STATE( R_TIMER_CTRL, i1, nop) |
@@ -230,18 +218,18 @@ time_init(void)
230 IO_STATE( R_TIMER_CTRL, tm0, run) | 218 IO_STATE( R_TIMER_CTRL, tm0, run) |
231 IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz); 219 IO_STATE( R_TIMER_CTRL, clksel0, c6250kHz);
232#else 220#else
233 *R_TIMER_CTRL = 221 *R_TIMER_CTRL =
234 IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) | 222 IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) |
235 IO_FIELD(R_TIMER_CTRL, timerdiv0, TIMER0_DIV) | 223 IO_FIELD(R_TIMER_CTRL, timerdiv0, TIMER0_DIV) |
236 IO_STATE(R_TIMER_CTRL, i1, nop) | 224 IO_STATE(R_TIMER_CTRL, i1, nop) |
237 IO_STATE(R_TIMER_CTRL, tm1, stop_ld) | 225 IO_STATE(R_TIMER_CTRL, tm1, stop_ld) |
238 IO_STATE(R_TIMER_CTRL, clksel1, c19k2Hz) | 226 IO_STATE(R_TIMER_CTRL, clksel1, c19k2Hz) |
239 IO_STATE(R_TIMER_CTRL, i0, nop) | 227 IO_STATE(R_TIMER_CTRL, i0, nop) |
240 IO_STATE(R_TIMER_CTRL, tm0, stop_ld) | 228 IO_STATE(R_TIMER_CTRL, tm0, stop_ld) |
241 IO_STATE(R_TIMER_CTRL, clksel0, flexible); 229 IO_STATE(R_TIMER_CTRL, clksel0, flexible);
242 230
243 *R_TIMER_CTRL = r_timer_ctrl_shadow = 231 *R_TIMER_CTRL = r_timer_ctrl_shadow =
244 IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) | 232 IO_FIELD(R_TIMER_CTRL, timerdiv1, 192) |
245 IO_FIELD(R_TIMER_CTRL, timerdiv0, TIMER0_DIV) | 233 IO_FIELD(R_TIMER_CTRL, timerdiv0, TIMER0_DIV) |
246 IO_STATE(R_TIMER_CTRL, i1, nop) | 234 IO_STATE(R_TIMER_CTRL, i1, nop) |
247 IO_STATE(R_TIMER_CTRL, tm1, run) | 235 IO_STATE(R_TIMER_CTRL, tm1, run) |
@@ -253,16 +241,14 @@ time_init(void)
253 *R_TIMER_PRESCALE = PRESCALE_VALUE; 241 *R_TIMER_PRESCALE = PRESCALE_VALUE;
254#endif 242#endif
255 243
256 *R_IRQ_MASK0_SET = 244 /* unmask the timer irq */
257 IO_STATE(R_IRQ_MASK0_SET, timer0, set); /* unmask the timer irq */ 245 *R_IRQ_MASK0_SET = IO_STATE(R_IRQ_MASK0_SET, timer0, set);
258 246
259 /* now actually register the timer irq handler that calls timer_interrupt() */ 247 /* now actually register the irq handler that calls timer_interrupt() */
260
261 setup_irq(2, &irq2); /* irq 2 is the timer0 irq in etrax */ 248 setup_irq(2, &irq2); /* irq 2 is the timer0 irq in etrax */
262 249
263 /* enable watchdog if we should use one */ 250 /* enable watchdog if we should use one */
264 251#if defined(CONFIG_ETRAX_WATCHDOG)
265#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
266 printk("Enabling watchdog...\n"); 252 printk("Enabling watchdog...\n");
267 start_watchdog(); 253 start_watchdog();
268 254
@@ -275,9 +261,7 @@ time_init(void)
275 driver or infrastructure support yet. */ 261 driver or infrastructure support yet. */
276 asm ("setf m"); 262 asm ("setf m");
277 263
278 *R_IRQ_MASK0_SET = 264 *R_IRQ_MASK0_SET = IO_STATE(R_IRQ_MASK0_SET, watchdog_nmi, set);
279 IO_STATE(R_IRQ_MASK0_SET, watchdog_nmi, set); 265 *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, nmi, set);
280 *R_VECT_MASK_SET =
281 IO_STATE(R_VECT_MASK_SET, nmi, set);
282#endif 266#endif
283} 267}
diff --git a/arch/cris/arch-v10/lib/dram_init.S b/arch/cris/arch-v10/lib/dram_init.S
index b9190ff7d0a4..e541d3d8f922 100644
--- a/arch/cris/arch-v10/lib/dram_init.S
+++ b/arch/cris/arch-v10/lib/dram_init.S
@@ -5,9 +5,7 @@
5 * Note: This file may not modify r9 because r9 is used to carry 5 * Note: This file may not modify r9 because r9 is used to carry
6 * information from the decompresser to the kernel 6 * information from the decompresser to the kernel
7 * 7 *
8 * Copyright (C) 2000, 2001 Axis Communications AB 8 * Copyright (C) 2000-2012 Axis Communications AB
9 *
10 * Authors: Mikael Starvik (starvik@axis.com)
11 * 9 *
12 */ 10 */
13 11
@@ -18,16 +16,15 @@
18 16
19 17
20 ;; WARNING! The registers r8 and r9 are used as parameters carrying 18 ;; WARNING! The registers r8 and r9 are used as parameters carrying
21 ;; information from the decompressor (if the kernel was compressed). 19 ;; information from the decompressor (if the kernel was compressed).
22 ;; They should not be used in the code below. 20 ;; They should not be used in the code below.
23 21
24#ifndef CONFIG_SVINTO_SIM
25 move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0 22 move.d CONFIG_ETRAX_DEF_R_WAITSTATES, $r0
26 move.d $r0, [R_WAITSTATES] 23 move.d $r0, [R_WAITSTATES]
27 24
28 move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0 25 move.d CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0
29 move.d $r0, [R_BUS_CONFIG] 26 move.d $r0, [R_BUS_CONFIG]
30 27
31#ifndef CONFIG_ETRAX_SDRAM 28#ifndef CONFIG_ETRAX_SDRAM
32 move.d CONFIG_ETRAX_DEF_R_DRAM_CONFIG, $r0 29 move.d CONFIG_ETRAX_DEF_R_DRAM_CONFIG, $r0
33 move.d $r0, [R_DRAM_CONFIG] 30 move.d $r0, [R_DRAM_CONFIG]
@@ -38,14 +35,14 @@
38 ;; Samsung SDRAMs seem to require to be initialized twice to work properly. 35 ;; Samsung SDRAMs seem to require to be initialized twice to work properly.
39 moveq 2, $r6 36 moveq 2, $r6
40_sdram_init: 37_sdram_init:
41 38
42 ; Refer to ETRAX 100LX Designers Reference for a description of SDRAM initialization 39 ; Refer to ETRAX 100LX Designers Reference for a description of SDRAM initialization
43 40
44 ; Bank configuration 41 ; Bank configuration
45 move.d CONFIG_ETRAX_DEF_R_SDRAM_CONFIG, $r0 42 move.d CONFIG_ETRAX_DEF_R_SDRAM_CONFIG, $r0
46 move.d $r0, [R_SDRAM_CONFIG] 43 move.d $r0, [R_SDRAM_CONFIG]
47 44
48 ; Calculate value of mrs_data 45 ; Calculate value of mrs_data
49 ; CAS latency = 2 && bus_width = 32 => 0x40 46 ; CAS latency = 2 && bus_width = 32 => 0x40
50 ; CAS latency = 3 && bus_width = 32 => 0x60 47 ; CAS latency = 3 && bus_width = 32 => 0x60
51 ; CAS latency = 2 && bus_width = 16 => 0x20 48 ; CAS latency = 2 && bus_width = 16 => 0x20
@@ -56,22 +53,22 @@ _sdram_init:
56 and.d 0x00ff0000, $r2 53 and.d 0x00ff0000, $r2
57 bne _set_timing 54 bne _set_timing
58 lsrq 16, $r2 55 lsrq 16, $r2
59 56
60 move.d 0x40, $r2 ; Assume 32 bits and CAS latency = 2 57 move.d 0x40, $r2 ; Assume 32 bits and CAS latency = 2
61 move.d CONFIG_ETRAX_DEF_R_SDRAM_TIMING, $r1 58 move.d CONFIG_ETRAX_DEF_R_SDRAM_TIMING, $r1
62 move.d $r1, $r3 59 move.d $r1, $r3
63 and.d 0x03, $r1 ; Get CAS latency 60 and.d 0x03, $r1 ; Get CAS latency
64 and.d 0x1000, $r3 ; 50 or 100 MHz? 61 and.d 0x1000, $r3 ; 50 or 100 MHz?
65 beq _speed_50 62 beq _speed_50
66 nop 63 nop
67_speed_100: 64_speed_100:
68 cmp.d 0x00, $r1 ; CAS latency = 2? 65 cmp.d 0x00, $r1 ; CAS latency = 2?
69 beq _bw_check 66 beq _bw_check
70 nop 67 nop
71 or.d 0x20, $r2 ; CAS latency = 3 68 or.d 0x20, $r2 ; CAS latency = 3
72 ba _bw_check 69 ba _bw_check
73 nop 70 nop
74_speed_50: 71_speed_50:
75 cmp.d 0x01, $r1 ; CAS latency = 2? 72 cmp.d 0x01, $r1 ; CAS latency = 2?
76 beq _bw_check 73 beq _bw_check
77 nop 74 nop
@@ -86,19 +83,19 @@ _bw_check:
86 ; Set timing parameters. Starts master clock 83 ; Set timing parameters. Starts master clock
87_set_timing: 84_set_timing:
88 move.d CONFIG_ETRAX_DEF_R_SDRAM_TIMING, $r1 85 move.d CONFIG_ETRAX_DEF_R_SDRAM_TIMING, $r1
89 and.d 0x8000f9ff, $r1 ; Make sure mrs data and command is 0 86 and.d 0x8000f9ff, $r1 ; Make sure mrs data and command is 0
90 or.d 0x80000000, $r1 ; Make sure sdram enable bit is set 87 or.d 0x80000000, $r1 ; Make sure sdram enable bit is set
91 move.d $r1, $r5 88 move.d $r1, $r5
92 or.d 0x0000c000, $r1 ; ref = disable 89 or.d 0x0000c000, $r1 ; ref = disable
93 lslq 16, $r2 ; mrs data starts at bit 16 90 lslq 16, $r2 ; mrs data starts at bit 16
94 or.d $r2, $r1 91 or.d $r2, $r1
95 move.d $r1, [R_SDRAM_TIMING] 92 move.d $r1, [R_SDRAM_TIMING]
96 93
97 ; Wait 200us 94 ; Wait 200us
98 move.d 10000, $r2 95 move.d 10000, $r2
991: bne 1b 961: bne 1b
100 subq 1, $r2 97 subq 1, $r2
101 98
102 ; Issue initialization command sequence 99 ; Issue initialization command sequence
103 move.d _sdram_commands_start, $r2 100 move.d _sdram_commands_start, $r2
104 and.d 0x000fffff, $r2 ; Make sure commands are read from flash 101 and.d 0x000fffff, $r2 ; Make sure commands are read from flash
@@ -144,7 +141,6 @@ _sdram_commands_start:
144 .byte 2 ; refresh 141 .byte 2 ; refresh
145 .byte 0 ; nop 142 .byte 0 ; nop
146 .byte 1 ; mrs 143 .byte 1 ; mrs
147 .byte 0 ; nop 144 .byte 0 ; nop
148_sdram_commands_end: 145_sdram_commands_end:
149#endif
150#endif 146#endif
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
index 1b6ad6247204..28dd77144e8f 100644
--- a/arch/cris/arch-v32/drivers/axisflashmap.c
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -24,8 +24,6 @@
24#include <linux/mtd/mtdram.h> 24#include <linux/mtd/mtdram.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26 26
27#include <linux/cramfs_fs.h>
28
29#include <asm/axisflashmap.h> 27#include <asm/axisflashmap.h>
30#include <asm/mmu.h> 28#include <asm/mmu.h>
31 29
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 0b86deedacb9..74f9fe80940c 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -978,7 +978,7 @@ static int __init gpio_init(void)
978 CRIS_LED_DISK_WRITE(0); 978 CRIS_LED_DISK_WRITE(0);
979 979
980 int res2 = request_irq(GIO_INTR_VECT, gpio_interrupt, 980 int res2 = request_irq(GIO_INTR_VECT, gpio_interrupt,
981 IRQF_SHARED | IRQF_DISABLED, "gpio", &alarmlist); 981 IRQF_SHARED, "gpio", &alarmlist);
982 if (res2) { 982 if (res2) {
983 printk(KERN_ERR "err: irq for gpio\n"); 983 printk(KERN_ERR "err: irq for gpio\n");
984 return res2; 984 return res2;
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index a2ac0917f1a6..9e54273af0ca 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -964,11 +964,11 @@ gpio_init(void)
964 * in some tests. 964 * in some tests.
965 */ 965 */
966 if (request_irq(TIMER0_INTR_VECT, gpio_poll_timer_interrupt, 966 if (request_irq(TIMER0_INTR_VECT, gpio_poll_timer_interrupt,
967 IRQF_SHARED | IRQF_DISABLED, "gpio poll", &alarmlist)) 967 IRQF_SHARED, "gpio poll", &alarmlist))
968 printk(KERN_ERR "timer0 irq for gpio\n"); 968 printk(KERN_ERR "timer0 irq for gpio\n");
969 969
970 if (request_irq(GIO_INTR_VECT, gpio_pa_interrupt, 970 if (request_irq(GIO_INTR_VECT, gpio_pa_interrupt,
971 IRQF_SHARED | IRQF_DISABLED, "gpio PA", &alarmlist)) 971 IRQF_SHARED, "gpio PA", &alarmlist))
972 printk(KERN_ERR "PA irq for gpio\n"); 972 printk(KERN_ERR "PA irq for gpio\n");
973 973
974#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 974#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index 219f704e3221..bbb806b68838 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/timer.h> 20#include <linux/timer.h>
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/wait.h>
22 23
23#include <asm/io.h> 24#include <asm/io.h>
24#include <dma.h> 25#include <dma.h>
@@ -1144,7 +1145,8 @@ static ssize_t sync_serial_read(struct file * file, char * buf,
1144 if (file->f_flags & O_NONBLOCK) 1145 if (file->f_flags & O_NONBLOCK)
1145 return -EAGAIN; 1146 return -EAGAIN;
1146 1147
1147 interruptible_sleep_on(&port->in_wait_q); 1148 wait_event_interruptible(port->in_wait_q,
1149 !(start == end && !port->full));
1148 if (signal_pending(current)) 1150 if (signal_pending(current))
1149 return -EINTR; 1151 return -EINTR;
1150 1152
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index faa644111feb..2f19ac6217aa 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -424,7 +424,7 @@ nmi_interrupt:
424 bpl 1f 424 bpl 1f
425 nop 425 nop
426 jsr handle_watchdog_bite ; In time.c. 426 jsr handle_watchdog_bite ; In time.c.
427 move.d $sp, $r10 ; Pointer to registers 427 move.d $sp, $r10 ; Pointer to registers
4281: btstq REG_BIT(intr_vect, r_nmi, ext), $r0 4281: btstq REG_BIT(intr_vect, r_nmi, ext), $r0
429 bpl 1f 429 bpl 1f
430 nop 430 nop
@@ -452,7 +452,7 @@ spurious_interrupt:
452 nop 452 nop
453 453
454 ;; This handles the case when multiple interrupts arrive at the same 454 ;; This handles the case when multiple interrupts arrive at the same
455 ;; time. Jump to the first set interrupt bit in a priotiry fashion. The 455 ;; time. Jump to the first set interrupt bit in a priority fashion. The
456 ;; hardware will call the unserved interrupts after the handler 456 ;; hardware will call the unserved interrupts after the handler
457 ;; finishes. 457 ;; finishes.
458 .type multiple_interrupt, @function 458 .type multiple_interrupt, @function
@@ -885,13 +885,29 @@ sys_call_table:
885 .long sys_preadv 885 .long sys_preadv
886 .long sys_pwritev 886 .long sys_pwritev
887 .long sys_setns /* 335 */ 887 .long sys_setns /* 335 */
888 888 .long sys_name_to_handle_at
889 /* 889 .long sys_open_by_handle_at
890 * NOTE!! This doesn't have to be exact - we just have 890 .long sys_rt_tgsigqueueinfo
891 * to make sure we have _enough_ of the "sys_ni_syscall" 891 .long sys_perf_event_open
892 * entries. Don't panic if you notice that this hasn't 892 .long sys_recvmmsg /* 340 */
893 * been shrunk every time we add a new system call. 893 .long sys_accept4
894 */ 894 .long sys_fanotify_init
895 .long sys_fanotify_mark
896 .long sys_prlimit64
897 .long sys_clock_adjtime /* 345 */
898 .long sys_syncfs
899 .long sys_sendmmsg
900 .long sys_process_vm_readv
901 .long sys_process_vm_writev
902 .long sys_kcmp /* 350 */
903 .long sys_finit_module
904
905 /*
906 * NOTE!! This doesn't have to be exact - we just have
907 * to make sure we have _enough_ of the "sys_ni_syscall"
908 * entries. Don't panic if you notice that this hasn't
909 * been shrunk every time we add a new system call.
910 */
895 911
896 .rept NR_syscalls - (.-sys_call_table) / 4 912 .rept NR_syscalls - (.-sys_call_table) / 4
897 .long sys_ni_syscall 913 .long sys_ni_syscall
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
index f6644535b17e..b130c2c5fdd8 100644
--- a/arch/cris/arch-v32/kernel/fasttimer.c
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -786,7 +786,7 @@ int fast_timer_init(void)
786 proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops); 786 proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
787#endif /* PROC_FS */ 787#endif /* PROC_FS */
788 if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, 788 if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt,
789 IRQF_SHARED | IRQF_DISABLED, 789 IRQF_SHARED,
790 "fast timer int", &fast_timer_list)) 790 "fast timer int", &fast_timer_list))
791 printk(KERN_ERR "err: fasttimer irq\n"); 791 printk(KERN_ERR "err: fasttimer irq\n");
792 fast_timer_is_init = 1; 792 fast_timer_is_init = 1;
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 5ebe6e841820..25437ae28128 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -331,11 +331,11 @@ extern void do_IRQ(int irq, struct pt_regs * regs);
331void 331void
332crisv32_do_IRQ(int irq, int block, struct pt_regs* regs) 332crisv32_do_IRQ(int irq, int block, struct pt_regs* regs)
333{ 333{
334 /* Interrupts that may not be moved to another CPU and 334 /* Interrupts that may not be moved to another CPU may
335 * are IRQF_DISABLED may skip blocking. This is currently 335 * skip blocking. This is currently only valid for the
336 * only valid for the timer IRQ and the IPI and is used 336 * timer IRQ and the IPI and is used for the timer
337 * for the timer interrupt to avoid watchdog starvation. 337 * interrupt to avoid watchdog starvation.
338 */ 338 */
339 if (!block) { 339 if (!block) {
340 do_IRQ(irq, regs); 340 do_IRQ(irq, regs);
341 return; 341 return;
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index fe8e6039db2a..0698582467ca 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -64,7 +64,7 @@ static irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id);
64static int send_ipi(int vector, int wait, cpumask_t cpu_mask); 64static int send_ipi(int vector, int wait, cpumask_t cpu_mask);
65static struct irqaction irq_ipi = { 65static struct irqaction irq_ipi = {
66 .handler = crisv32_ipi_interrupt, 66 .handler = crisv32_ipi_interrupt,
67 .flags = IRQF_DISABLED, 67 .flags = 0,
68 .name = "ipi", 68 .name = "ipi",
69}; 69};
70 70
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index 8c4b45efd7b6..ee66866538f8 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -216,12 +216,10 @@ static inline irqreturn_t timer_interrupt(int irq, void *dev_id)
216 return IRQ_HANDLED; 216 return IRQ_HANDLED;
217} 217}
218 218
219/* Timer is IRQF_SHARED so drivers can add stuff to the timer irq chain. 219/* Timer is IRQF_SHARED so drivers can add stuff to the timer irq chain. */
220 * It needs to be IRQF_DISABLED to make the jiffies update work properly.
221 */
222static struct irqaction irq_timer = { 220static struct irqaction irq_timer = {
223 .handler = timer_interrupt, 221 .handler = timer_interrupt,
224 .flags = IRQF_SHARED | IRQF_DISABLED, 222 .flags = IRQF_SHARED,
225 .name = "timer" 223 .name = "timer"
226}; 224};
227 225
diff --git a/arch/cris/arch-v32/mach-a3/arbiter.c b/arch/cris/arch-v32/mach-a3/arbiter.c
index 15f5c9de2639..ab5c421a4de8 100644
--- a/arch/cris/arch-v32/mach-a3/arbiter.c
+++ b/arch/cris/arch-v32/mach-a3/arbiter.c
@@ -256,11 +256,11 @@ static void crisv32_arbiter_init(void)
256 crisv32_arbiter_config(1, EXT_REGION, 0); 256 crisv32_arbiter_config(1, EXT_REGION, 0);
257 257
258 if (request_irq(MEMARB_FOO_INTR_VECT, crisv32_foo_arbiter_irq, 258 if (request_irq(MEMARB_FOO_INTR_VECT, crisv32_foo_arbiter_irq,
259 IRQF_DISABLED, "arbiter", NULL)) 259 0, "arbiter", NULL))
260 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n"); 260 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n");
261 261
262 if (request_irq(MEMARB_BAR_INTR_VECT, crisv32_bar_arbiter_irq, 262 if (request_irq(MEMARB_BAR_INTR_VECT, crisv32_bar_arbiter_irq,
263 IRQF_DISABLED, "arbiter", NULL)) 263 0, "arbiter", NULL))
264 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n"); 264 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n");
265 265
266#ifndef CONFIG_ETRAX_KGDB 266#ifndef CONFIG_ETRAX_KGDB
diff --git a/arch/cris/arch-v32/mach-fs/arbiter.c b/arch/cris/arch-v32/mach-fs/arbiter.c
index 3f8ebb5c1477..c97f4d8120f9 100644
--- a/arch/cris/arch-v32/mach-fs/arbiter.c
+++ b/arch/cris/arch-v32/mach-fs/arbiter.c
@@ -184,7 +184,7 @@ static void crisv32_arbiter_init(void)
184 crisv32_arbiter_config(EXT_REGION, 0); 184 crisv32_arbiter_config(EXT_REGION, 0);
185 crisv32_arbiter_config(INT_REGION, 0); 185 crisv32_arbiter_config(INT_REGION, 0);
186 186
187 if (request_irq(MEMARB_INTR_VECT, crisv32_arbiter_irq, IRQF_DISABLED, 187 if (request_irq(MEMARB_INTR_VECT, crisv32_arbiter_irq, 0,
188 "arbiter", NULL)) 188 "arbiter", NULL))
189 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n"); 189 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n");
190 190
diff --git a/arch/cris/boot/rescue/kimagerescue.S b/arch/cris/boot/rescue/kimagerescue.S
index 6f7b3e61260b..655b511fecf3 100644
--- a/arch/cris/boot/rescue/kimagerescue.S
+++ b/arch/cris/boot/rescue/kimagerescue.S
@@ -50,7 +50,6 @@
50 50
51 nop 51 nop
52 di 52 di
53#ifndef CONFIG_SVINTO_SIM
54 ;; setup port PA and PB default initial directions and data 53 ;; setup port PA and PB default initial directions and data
55 ;; (so we can flash LEDs, and so that DTR and others are set) 54 ;; (so we can flash LEDs, and so that DTR and others are set)
56 55
@@ -67,7 +66,6 @@
67 ;; We need to setup the bus registers before we start using the DRAM 66 ;; We need to setup the bus registers before we start using the DRAM
68#include "../../lib/dram_init.S" 67#include "../../lib/dram_init.S"
69 68
70#endif
71 ;; Setup the stack to a suitably high address. 69 ;; Setup the stack to a suitably high address.
72 ;; We assume 8 MB is the minimum DRAM in an eLinux 70 ;; We assume 8 MB is the minimum DRAM in an eLinux
73 ;; product and put the sp at the top for now. 71 ;; product and put the sp at the top for now.
diff --git a/arch/cris/include/arch-v10/arch/io.h b/arch/cris/include/arch-v10/arch/io.h
index f627ad0b8a3d..4a724172877f 100644
--- a/arch/cris/include/arch-v10/arch/io.h
+++ b/arch/cris/include/arch-v10/arch/io.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_ARCH_CRIS_IO_H 1#ifndef _ASM_ARCH_CRIS_IO_H
2#define _ASM_ARCH_CRIS_IO_H 2#define _ASM_ARCH_CRIS_IO_H
3 3
4#include <arch/svinto.h>
5
6/* Etrax shadow registers - which live in arch/cris/kernel/shadows.c */ 4/* Etrax shadow registers - which live in arch/cris/kernel/shadows.c */
7 5
8extern unsigned long gen_config_ii_shadow; 6extern unsigned long gen_config_ii_shadow;
@@ -34,7 +32,7 @@ extern volatile unsigned long *port_csp4_addr;
34 32
35/* The LED's on various Etrax-based products are set differently. */ 33/* The LED's on various Etrax-based products are set differently. */
36 34
37#if defined(CONFIG_ETRAX_NO_LEDS) || defined(CONFIG_SVINTO_SIM) 35#if defined(CONFIG_ETRAX_NO_LEDS)
38#undef CONFIG_ETRAX_PA_LEDS 36#undef CONFIG_ETRAX_PA_LEDS
39#undef CONFIG_ETRAX_PB_LEDS 37#undef CONFIG_ETRAX_PB_LEDS
40#undef CONFIG_ETRAX_CSP0_LEDS 38#undef CONFIG_ETRAX_CSP0_LEDS
@@ -171,29 +169,4 @@ extern volatile unsigned long *port_csp4_addr;
171#define SOFT_SHUTDOWN() 169#define SOFT_SHUTDOWN()
172#endif 170#endif
173 171
174/* Console I/O for simulated etrax100. Use #ifdef so erroneous
175 use will be evident. */
176#ifdef CONFIG_SVINTO_SIM
177 /* Let's use the ucsim interface since it lets us do write(2, ...) */
178#define SIMCOUT(s,len) \
179 asm ("moveq 4,$r9 \n\t" \
180 "moveq 2,$r10 \n\t" \
181 "move.d %0,$r11 \n\t" \
182 "move.d %1,$r12 \n\t" \
183 "push $irp \n\t" \
184 "move 0f,$irp \n\t" \
185 "jump -6809 \n" \
186 "0: \n\t" \
187 "pop $irp" \
188 : : "rm" (s), "rm" (len) : "r9","r10","r11","r12","memory")
189#define TRACE_ON() __extension__ \
190 ({ int _Foofoo; __asm__ volatile ("bmod [%0],%0" : "=r" (_Foofoo) : "0" \
191 (255)); _Foofoo; })
192
193#define TRACE_OFF() do { __asm__ volatile ("bmod [%0],%0" :: "r" (254)); } while (0)
194#define SIM_END() do { __asm__ volatile ("bmod [%0],%0" :: "r" (28)); } while (0)
195#define CRIS_CYCLES() __extension__ \
196 ({ unsigned long c; asm ("bmod [%1],%0" : "=r" (c) : "r" (27)); c;})
197#endif /* ! defined CONFIG_SVINTO_SIM */
198
199#endif 172#endif
diff --git a/arch/cris/include/arch-v10/arch/irq.h b/arch/cris/include/arch-v10/arch/irq.h
index ca2675ae08ed..6aecb835037d 100644
--- a/arch/cris/include/arch-v10/arch/irq.h
+++ b/arch/cris/include/arch-v10/arch/irq.h
@@ -141,9 +141,9 @@ __asm__ ( \
141 * handler is run and it prioritizes the timer interrupt. However if we had BLOCK'ed 141 * handler is run and it prioritizes the timer interrupt. However if we had BLOCK'ed
142 * it here, we would not get the multiple_irq at all. 142 * it here, we would not get the multiple_irq at all.
143 * 143 *
144 * The non-blocking here is based on the knowledge that the timer interrupt is 144 * The non-blocking here is based on the knowledge that the timer interrupt runs
145 * registered as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not 145 * with interrupts disabled, and therefore there will not be an sti() before the
146 * be an sti() before the timer irq handler is run to acknowledge the interrupt. 146 * timer irq handler is run to acknowledge the interrupt.
147 */ 147 */
148 148
149#define BUILD_TIMER_IRQ(nr,mask) \ 149#define BUILD_TIMER_IRQ(nr,mask) \
diff --git a/arch/cris/include/arch-v32/arch/irq.h b/arch/cris/include/arch-v32/arch/irq.h
index fe3cdd22bed4..0c1b4d3a34e7 100644
--- a/arch/cris/include/arch-v32/arch/irq.h
+++ b/arch/cris/include/arch-v32/arch/irq.h
@@ -102,9 +102,9 @@ __asm__ ( \
102 * multiple_irq handler is run and it prioritizes the timer interrupt. However 102 * multiple_irq handler is run and it prioritizes the timer interrupt. However
103 * if we had BLOCK'edit here, we would not get the multiple_irq at all. 103 * if we had BLOCK'edit here, we would not get the multiple_irq at all.
104 * 104 *
105 * The non-blocking here is based on the knowledge that the timer interrupt is 105 * The non-blocking here is based on the knowledge that the timer interrupt runs
106 * registered as a fast interrupt (IRQF_DISABLED) so that we _know_ there will not 106 * with interrupts disabled, and therefore there will not be an sti() before the
107 * be an sti() before the timer irq handler is run to acknowledge the interrupt. 107 * timer irq handler is run to acknowledge the interrupt.
108 */ 108 */
109#define BUILD_TIMER_IRQ(nr, mask) \ 109#define BUILD_TIMER_IRQ(nr, mask) \
110void IRQ_NAME(nr); \ 110void IRQ_NAME(nr); \
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 199b1a9dab89..f3fd8768f095 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -6,6 +6,7 @@ header-y += arch-v32/
6generic-y += barrier.h 6generic-y += barrier.h
7generic-y += clkdev.h 7generic-y += clkdev.h
8generic-y += exec.h 8generic-y += exec.h
9generic-y += hash.h
9generic-y += kvm_para.h 10generic-y += kvm_para.h
10generic-y += linkage.h 11generic-y += linkage.h
11generic-y += module.h 12generic-y += module.h
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h
index 4353cf239a13..e59dba12ce94 100644
--- a/arch/cris/include/asm/io.h
+++ b/arch/cris/include/asm/io.h
@@ -169,7 +169,11 @@ static inline void outsl(unsigned int port, const void *addr,
169} 169}
170 170
171#define inb_p(port) inb(port) 171#define inb_p(port) inb(port)
172#define inw_p(port) inw(port)
173#define inl_p(port) inl(port)
172#define outb_p(val, port) outb((val), (port)) 174#define outb_p(val, port) outb((val), (port))
175#define outw_p(val, port) outw((val), (port))
176#define outl_p(val, port) outl((val), (port))
173 177
174/* 178/*
175 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 179 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index 0ff3f6889842..5cc7d1991e48 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -4,7 +4,7 @@
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6 6
7#define NR_syscalls 336 7#define NR_syscalls 360
8 8
9#include <arch/unistd.h> 9#include <arch/unistd.h>
10 10
diff --git a/arch/cris/include/uapi/asm/socket.h b/arch/cris/include/uapi/asm/socket.h
index 13829aaaeec5..ed94e5ed0a23 100644
--- a/arch/cris/include/uapi/asm/socket.h
+++ b/arch/cris/include/uapi/asm/socket.h
@@ -80,6 +80,8 @@
80 80
81#define SO_MAX_PACING_RATE 47 81#define SO_MAX_PACING_RATE 47
82 82
83#define SO_BPF_EXTENSIONS 48
84
83#endif /* _ASM_SOCKET_H */ 85#endif /* _ASM_SOCKET_H */
84 86
85 87
diff --git a/arch/cris/include/uapi/asm/unistd.h b/arch/cris/include/uapi/asm/unistd.h
index 48842896f6c2..f3287face443 100644
--- a/arch/cris/include/uapi/asm/unistd.h
+++ b/arch/cris/include/uapi/asm/unistd.h
@@ -340,5 +340,21 @@
340#define __NR_preadv 333 340#define __NR_preadv 333
341#define __NR_pwritev 334 341#define __NR_pwritev 334
342#define __NR_setns 335 342#define __NR_setns 335
343#define __NR_name_to_handle_at 336
344#define __NR_open_by_handle_at 337
345#define __NR_rt_tgsigqueueinfo 338
346#define __NR_perf_event_open 339
347#define __NR_recvmmsg 340
348#define __NR_accept4 341
349#define __NR_fanotify_init 342
350#define __NR_fanotify_mark 343
351#define __NR_prlimit64 344
352#define __NR_clock_adjtime 345
353#define __NR_syncfs 346
354#define __NR_sendmmsg 347
355#define __NR_process_vm_readv 348
356#define __NR_process_vm_writev 349
357#define __NR_kcmp 350
358#define __NR_finit_module 351
343 359
344#endif /* _UAPI_ASM_CRIS_UNISTD_H_ */ 360#endif /* _UAPI_ASM_CRIS_UNISTD_H_ */
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index d36836dbbc07..dd0be5de55d5 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -40,9 +40,6 @@
40 40
41/* called by the assembler IRQ entry functions defined in irq.h 41/* called by the assembler IRQ entry functions defined in irq.h
42 * to dispatch the interrupts to registered handlers 42 * to dispatch the interrupts to registered handlers
43 * interrupts are disabled upon entry - depending on if the
44 * interrupt was registered with IRQF_DISABLED or not, interrupts
45 * are re-enabled or not.
46 */ 43 */
47 44
48asmlinkage void do_IRQ(int irq, struct pt_regs * regs) 45asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 4d1b1e9baef1..2a8fb730d1ca 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -74,13 +74,6 @@ KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media
74KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2 74KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
75KBUILD_AFLAGS += -mno-fdpic 75KBUILD_AFLAGS += -mno-fdpic
76 76
77# make sure the .S files get compiled with debug info
78# and disable optimisations that are unhelpful whilst debugging
79ifdef CONFIG_DEBUG_INFO
80#KBUILD_CFLAGS += -O1
81KBUILD_AFLAGS += -Wa,--gdwarf2
82endif
83
84head-y := arch/frv/kernel/head.o 77head-y := arch/frv/kernel/head.o
85 78
86core-y += arch/frv/kernel/ arch/frv/mm/ 79core-y += arch/frv/kernel/ arch/frv/mm/
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild
index 74742dc6a3da..bc42f14c9c2e 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/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 += preempt.h 5generic-y += preempt.h
6generic-y += hash.h
diff --git a/arch/frv/include/uapi/asm/socket.h b/arch/frv/include/uapi/asm/socket.h
index 5d4299762426..ca2c6e6f31c6 100644
--- a/arch/frv/include/uapi/asm/socket.h
+++ b/arch/frv/include/uapi/asm/socket.h
@@ -78,5 +78,7 @@
78 78
79#define SO_MAX_PACING_RATE 47 79#define SO_MAX_PACING_RATE 47
80 80
81#define SO_BPF_EXTENSIONS 48
82
81#endif /* _ASM_SOCKET_H */ 83#endif /* _ASM_SOCKET_H */
82 84
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index ada843c701ef..38ca45d3df1e 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -16,6 +16,7 @@ generic-y += fb.h
16generic-y += fcntl.h 16generic-y += fcntl.h
17generic-y += ftrace.h 17generic-y += ftrace.h
18generic-y += hardirq.h 18generic-y += hardirq.h
19generic-y += hash.h
19generic-y += hw_irq.h 20generic-y += hw_irq.h
20generic-y += ioctl.h 21generic-y += ioctl.h
21generic-y += ioctls.h 22generic-y += ioctls.h
diff --git a/arch/hexagon/include/asm/fixmap.h b/arch/hexagon/include/asm/fixmap.h
index b75b6bf4269c..1387f84b42b6 100644
--- a/arch/hexagon/include/asm/fixmap.h
+++ b/arch/hexagon/include/asm/fixmap.h
@@ -26,45 +26,7 @@
26 */ 26 */
27#include <asm/mem-layout.h> 27#include <asm/mem-layout.h>
28 28
29/* 29#include <asm-generic/fixmap.h>
30 * Full fixmap support involves set_fixmap() functions, but
31 * these may not be needed if all we're after is an area for
32 * highmem kernel mappings.
33 */
34#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
35#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
36
37extern void __this_fixmap_does_not_exist(void);
38
39/**
40 * fix_to_virt -- "index to address" translation.
41 *
42 * If anyone tries to use the idx directly without translation,
43 * we catch the bug with a NULL-deference kernel oops. Illegal
44 * ranges of incoming indices are caught too.
45 */
46static inline unsigned long fix_to_virt(const unsigned int idx)
47{
48 /*
49 * This branch gets completely eliminated after inlining,
50 * except when someone tries to use fixaddr indices in an
51 * illegal way. (such as mixing up address types or using
52 * out-of-range indices).
53 *
54 * If it doesn't get removed, the linker will complain
55 * loudly with a reasonably clear error message..
56 */
57 if (idx >= __end_of_fixed_addresses)
58 __this_fixmap_does_not_exist();
59
60 return __fix_to_virt(idx);
61}
62
63static inline unsigned long virt_to_fix(const unsigned long vaddr)
64{
65 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
66 return __virt_to_fix(vaddr);
67}
68 30
69#define kmap_get_fixmap_pte(vaddr) \ 31#define kmap_get_fixmap_pte(vaddr) \
70 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), \ 32 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), \
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index a8c3a11dc5ab..0c8e553e0b9f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -7,6 +7,7 @@ menu "Processor type and features"
7config IA64 7config IA64
8 bool 8 bool
9 select ARCH_MIGHT_HAVE_PC_PARPORT 9 select ARCH_MIGHT_HAVE_PC_PARPORT
10 select ARCH_MIGHT_HAVE_PC_SERIO
10 select PCI if (!IA64_HP_SIM) 11 select PCI if (!IA64_HP_SIM)
11 select ACPI if (!IA64_HP_SIM) 12 select ACPI if (!IA64_HP_SIM)
12 select PM if (!IA64_HP_SIM) 13 select PM if (!IA64_HP_SIM)
@@ -104,6 +105,7 @@ config HAVE_SETUP_PER_CPU_AREA
104config DMI 105config DMI
105 bool 106 bool
106 default y 107 default y
108 select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
107 109
108config EFI 110config EFI
109 bool 111 bool
diff --git a/arch/ia64/hp/common/aml_nfw.c b/arch/ia64/hp/common/aml_nfw.c
index 916ffe770bcf..84715fcbba08 100644
--- a/arch/ia64/hp/common/aml_nfw.c
+++ b/arch/ia64/hp/common/aml_nfw.c
@@ -23,8 +23,7 @@
23 */ 23 */
24 24
25#include <linux/module.h> 25#include <linux/module.h>
26#include <acpi/acpi_bus.h> 26#include <linux/acpi.h>
27#include <acpi/acpi_drivers.h>
28#include <asm/sal.h> 27#include <asm/sal.h>
29 28
30MODULE_AUTHOR("Bjorn Helgaas <bjorn.helgaas@hp.com>"); 29MODULE_AUTHOR("Bjorn Helgaas <bjorn.helgaas@hp.com>");
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 4c530a82fc46..8e858b593e4f 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -255,7 +255,7 @@ static u64 prefetch_spill_page;
255#endif 255#endif
256 256
257#ifdef CONFIG_PCI 257#ifdef CONFIG_PCI
258# define GET_IOC(dev) (((dev)->bus == &pci_bus_type) \ 258# define GET_IOC(dev) ((dev_is_pci(dev)) \
259 ? ((struct ioc *) PCI_CONTROLLER(to_pci_dev(dev))->iommu) : NULL) 259 ? ((struct ioc *) PCI_CONTROLLER(to_pci_dev(dev))->iommu) : NULL)
260#else 260#else
261# define GET_IOC(dev) NULL 261# define GET_IOC(dev) NULL
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index f93ee087e8fe..283a83154b5e 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -4,4 +4,5 @@ generic-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 += preempt.h
7generic-y += vtime.h \ No newline at end of file 7generic-y += vtime.h
8generic-y += hash.h
diff --git a/arch/ia64/include/asm/dmi.h b/arch/ia64/include/asm/dmi.h
index 185d3d18d0ec..f365a61f5c71 100644
--- a/arch/ia64/include/asm/dmi.h
+++ b/arch/ia64/include/asm/dmi.h
@@ -5,8 +5,10 @@
5#include <asm/io.h> 5#include <asm/io.h>
6 6
7/* Use normal IO mappings for DMI */ 7/* Use normal IO mappings for DMI */
8#define dmi_ioremap ioremap 8#define dmi_early_remap ioremap
9#define dmi_iounmap(x,l) iounmap(x) 9#define dmi_early_unmap(x, l) iounmap(x)
10#define dmi_alloc(l) kzalloc(l, GFP_ATOMIC) 10#define dmi_remap ioremap
11#define dmi_unmap iounmap
12#define dmi_alloc(l) kzalloc(l, GFP_ATOMIC)
11 13
12#endif 14#endif
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index 5a84b3a50741..efd1b927ccb7 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -71,6 +71,7 @@
71#include <linux/compiler.h> 71#include <linux/compiler.h>
72#include <linux/threads.h> 72#include <linux/threads.h>
73#include <linux/types.h> 73#include <linux/types.h>
74#include <linux/bitops.h>
74 75
75#include <asm/fpu.h> 76#include <asm/fpu.h>
76#include <asm/page.h> 77#include <asm/page.h>
diff --git a/arch/ia64/include/uapi/asm/socket.h b/arch/ia64/include/uapi/asm/socket.h
index c25302fb48d9..a1b49bac7951 100644
--- a/arch/ia64/include/uapi/asm/socket.h
+++ b/arch/ia64/include/uapi/asm/socket.h
@@ -87,4 +87,6 @@
87 87
88#define SO_MAX_PACING_RATE 47 88#define SO_MAX_PACING_RATE 47
89 89
90#define SO_BPF_EXTENSIONS 48
91
90#endif /* _ASM_IA64_SOCKET_H */ 92#endif /* _ASM_IA64_SOCKET_H */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index bfa19311e09c..07d209c9507f 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -60,7 +60,6 @@
60 60
61#define PREFIX "ACPI: " 61#define PREFIX "ACPI: "
62 62
63u32 acpi_rsdt_forced;
64unsigned int acpi_cpei_override; 63unsigned int acpi_cpei_override;
65unsigned int acpi_cpei_phys_cpuid; 64unsigned int acpi_cpei_phys_cpuid;
66 65
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 985bf80c622e..53f44bee9ebb 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -702,7 +702,7 @@ again:
702out: 702out:
703 srcu_read_unlock(&vcpu->kvm->srcu, idx); 703 srcu_read_unlock(&vcpu->kvm->srcu, idx);
704 if (r > 0) { 704 if (r > 0) {
705 kvm_resched(vcpu); 705 cond_resched();
706 idx = srcu_read_lock(&vcpu->kvm->srcu); 706 idx = srcu_read_lock(&vcpu->kvm->srcu);
707 goto again; 707 goto again;
708 } 708 }
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index da5237d636d6..52715a71aede 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -31,74 +31,6 @@
31static unsigned long max_gap; 31static unsigned long max_gap;
32#endif 32#endif
33 33
34/**
35 * show_mem - give short summary of memory stats
36 *
37 * Shows a simple page count of reserved and used pages in the system.
38 * For discontig machines, it does this on a per-pgdat basis.
39 */
40void show_mem(unsigned int filter)
41{
42 int i, total_reserved = 0;
43 int total_shared = 0, total_cached = 0;
44 unsigned long total_present = 0;
45 pg_data_t *pgdat;
46
47 printk(KERN_INFO "Mem-info:\n");
48 show_free_areas(filter);
49 printk(KERN_INFO "Node memory in pages:\n");
50 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
51 return;
52 for_each_online_pgdat(pgdat) {
53 unsigned long present;
54 unsigned long flags;
55 int shared = 0, cached = 0, reserved = 0;
56 int nid = pgdat->node_id;
57
58 if (skip_free_areas_node(filter, nid))
59 continue;
60 pgdat_resize_lock(pgdat, &flags);
61 present = pgdat->node_present_pages;
62 for(i = 0; i < pgdat->node_spanned_pages; i++) {
63 struct page *page;
64 if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
65 touch_nmi_watchdog();
66 if (pfn_valid(pgdat->node_start_pfn + i))
67 page = pfn_to_page(pgdat->node_start_pfn + i);
68 else {
69#ifdef CONFIG_VIRTUAL_MEM_MAP
70 if (max_gap < LARGE_GAP)
71 continue;
72#endif
73 i = vmemmap_find_next_valid_pfn(nid, i) - 1;
74 continue;
75 }
76 if (PageReserved(page))
77 reserved++;
78 else if (PageSwapCache(page))
79 cached++;
80 else if (page_count(page))
81 shared += page_count(page)-1;
82 }
83 pgdat_resize_unlock(pgdat, &flags);
84 total_present += present;
85 total_reserved += reserved;
86 total_cached += cached;
87 total_shared += shared;
88 printk(KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, "
89 "shrd: %10d, swpd: %10d\n", nid,
90 present, reserved, shared, cached);
91 }
92 printk(KERN_INFO "%ld pages of RAM\n", total_present);
93 printk(KERN_INFO "%d reserved pages\n", total_reserved);
94 printk(KERN_INFO "%d pages shared\n", total_shared);
95 printk(KERN_INFO "%d pages swap cached\n", total_cached);
96 printk(KERN_INFO "Total of %ld pages in page table cache\n",
97 quicklist_total_size());
98 printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
99}
100
101
102/* physical address where the bootmem map is located */ 34/* physical address where the bootmem map is located */
103unsigned long bootmap_start; 35unsigned long bootmap_start;
104 36
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 2de08f4d9930..878626805369 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -608,69 +608,6 @@ void *per_cpu_init(void)
608#endif /* CONFIG_SMP */ 608#endif /* CONFIG_SMP */
609 609
610/** 610/**
611 * show_mem - give short summary of memory stats
612 *
613 * Shows a simple page count of reserved and used pages in the system.
614 * For discontig machines, it does this on a per-pgdat basis.
615 */
616void show_mem(unsigned int filter)
617{
618 int i, total_reserved = 0;
619 int total_shared = 0, total_cached = 0;
620 unsigned long total_present = 0;
621 pg_data_t *pgdat;
622
623 printk(KERN_INFO "Mem-info:\n");
624 show_free_areas(filter);
625 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
626 return;
627 printk(KERN_INFO "Node memory in pages:\n");
628 for_each_online_pgdat(pgdat) {
629 unsigned long present;
630 unsigned long flags;
631 int shared = 0, cached = 0, reserved = 0;
632 int nid = pgdat->node_id;
633
634 if (skip_free_areas_node(filter, nid))
635 continue;
636 pgdat_resize_lock(pgdat, &flags);
637 present = pgdat->node_present_pages;
638 for(i = 0; i < pgdat->node_spanned_pages; i++) {
639 struct page *page;
640 if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
641 touch_nmi_watchdog();
642 if (pfn_valid(pgdat->node_start_pfn + i))
643 page = pfn_to_page(pgdat->node_start_pfn + i);
644 else {
645 i = vmemmap_find_next_valid_pfn(nid, i) - 1;
646 continue;
647 }
648 if (PageReserved(page))
649 reserved++;
650 else if (PageSwapCache(page))
651 cached++;
652 else if (page_count(page))
653 shared += page_count(page)-1;
654 }
655 pgdat_resize_unlock(pgdat, &flags);
656 total_present += present;
657 total_reserved += reserved;
658 total_cached += cached;
659 total_shared += shared;
660 printk(KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, "
661 "shrd: %10d, swpd: %10d\n", nid,
662 present, reserved, shared, cached);
663 }
664 printk(KERN_INFO "%ld pages of RAM\n", total_present);
665 printk(KERN_INFO "%d reserved pages\n", total_reserved);
666 printk(KERN_INFO "%d pages shared\n", total_shared);
667 printk(KERN_INFO "%d pages swap cached\n", total_cached);
668 printk(KERN_INFO "Total of %ld pages in page table cache\n",
669 quicklist_total_size());
670 printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
671}
672
673/**
674 * call_pernode_memory - use SRAT to call callback functions with node info 611 * call_pernode_memory - use SRAT to call callback functions with node info
675 * @start: physical start of range 612 * @start: physical start of range
676 * @len: length of range 613 * @len: length of range
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 88504abf5704..25c350264a41 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -684,3 +684,51 @@ per_linux32_init(void)
684} 684}
685 685
686__initcall(per_linux32_init); 686__initcall(per_linux32_init);
687
688/**
689 * show_mem - give short summary of memory stats
690 *
691 * Shows a simple page count of reserved and used pages in the system.
692 * For discontig machines, it does this on a per-pgdat basis.
693 */
694void show_mem(unsigned int filter)
695{
696 int total_reserved = 0;
697 unsigned long total_present = 0;
698 pg_data_t *pgdat;
699
700 printk(KERN_INFO "Mem-info:\n");
701 show_free_areas(filter);
702 printk(KERN_INFO "Node memory in pages:\n");
703 for_each_online_pgdat(pgdat) {
704 unsigned long present;
705 unsigned long flags;
706 int reserved = 0;
707 int nid = pgdat->node_id;
708 int zoneid;
709
710 if (skip_free_areas_node(filter, nid))
711 continue;
712 pgdat_resize_lock(pgdat, &flags);
713
714 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
715 struct zone *zone = &pgdat->node_zones[zoneid];
716 if (!populated_zone(zone))
717 continue;
718
719 reserved += zone->present_pages - zone->managed_pages;
720 }
721 present = pgdat->node_present_pages;
722
723 pgdat_resize_unlock(pgdat, &flags);
724 total_present += present;
725 total_reserved += reserved;
726 printk(KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, ",
727 nid, present, reserved);
728 }
729 printk(KERN_INFO "%ld pages of RAM\n", total_present);
730 printk(KERN_INFO "%d reserved pages\n", total_reserved);
731 printk(KERN_INFO "Total of %ld pages in page table cache\n",
732 quicklist_total_size());
733 printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
734}
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 3290d6e00c31..d0853e8e8623 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -34,7 +34,7 @@
34 */ 34 */
35static int sn_dma_supported(struct device *dev, u64 mask) 35static int sn_dma_supported(struct device *dev, u64 mask)
36{ 36{
37 BUG_ON(dev->bus != &pci_bus_type); 37 BUG_ON(!dev_is_pci(dev));
38 38
39 if (mask < 0x7fffffff) 39 if (mask < 0x7fffffff)
40 return 0; 40 return 0;
@@ -50,7 +50,7 @@ static int sn_dma_supported(struct device *dev, u64 mask)
50 */ 50 */
51int sn_dma_set_mask(struct device *dev, u64 dma_mask) 51int sn_dma_set_mask(struct device *dev, u64 dma_mask)
52{ 52{
53 BUG_ON(dev->bus != &pci_bus_type); 53 BUG_ON(!dev_is_pci(dev));
54 54
55 if (!sn_dma_supported(dev, dma_mask)) 55 if (!sn_dma_supported(dev, dma_mask))
56 return 0; 56 return 0;
@@ -85,7 +85,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size,
85 struct pci_dev *pdev = to_pci_dev(dev); 85 struct pci_dev *pdev = to_pci_dev(dev);
86 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 86 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
87 87
88 BUG_ON(dev->bus != &pci_bus_type); 88 BUG_ON(!dev_is_pci(dev));
89 89
90 /* 90 /*
91 * Allocate the memory. 91 * Allocate the memory.
@@ -143,7 +143,7 @@ static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr
143 struct pci_dev *pdev = to_pci_dev(dev); 143 struct pci_dev *pdev = to_pci_dev(dev);
144 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 144 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
145 145
146 BUG_ON(dev->bus != &pci_bus_type); 146 BUG_ON(!dev_is_pci(dev));
147 147
148 provider->dma_unmap(pdev, dma_handle, 0); 148 provider->dma_unmap(pdev, dma_handle, 0);
149 free_pages((unsigned long)cpu_addr, get_order(size)); 149 free_pages((unsigned long)cpu_addr, get_order(size));
@@ -187,7 +187,7 @@ static dma_addr_t sn_dma_map_page(struct device *dev, struct page *page,
187 187
188 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs); 188 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
189 189
190 BUG_ON(dev->bus != &pci_bus_type); 190 BUG_ON(!dev_is_pci(dev));
191 191
192 phys_addr = __pa(cpu_addr); 192 phys_addr = __pa(cpu_addr);
193 if (dmabarr) 193 if (dmabarr)
@@ -223,7 +223,7 @@ static void sn_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
223 struct pci_dev *pdev = to_pci_dev(dev); 223 struct pci_dev *pdev = to_pci_dev(dev);
224 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 224 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
225 225
226 BUG_ON(dev->bus != &pci_bus_type); 226 BUG_ON(!dev_is_pci(dev));
227 227
228 provider->dma_unmap(pdev, dma_addr, dir); 228 provider->dma_unmap(pdev, dma_addr, dir);
229} 229}
@@ -247,7 +247,7 @@ static void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
247 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 247 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
248 struct scatterlist *sg; 248 struct scatterlist *sg;
249 249
250 BUG_ON(dev->bus != &pci_bus_type); 250 BUG_ON(!dev_is_pci(dev));
251 251
252 for_each_sg(sgl, sg, nhwentries, i) { 252 for_each_sg(sgl, sg, nhwentries, i) {
253 provider->dma_unmap(pdev, sg->dma_address, dir); 253 provider->dma_unmap(pdev, sg->dma_address, dir);
@@ -284,7 +284,7 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,
284 284
285 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs); 285 dmabarr = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
286 286
287 BUG_ON(dev->bus != &pci_bus_type); 287 BUG_ON(!dev_is_pci(dev));
288 288
289 /* 289 /*
290 * Setup a DMA address for each entry in the scatterlist. 290 * Setup a DMA address for each entry in the scatterlist.
@@ -323,26 +323,26 @@ static int sn_dma_map_sg(struct device *dev, struct scatterlist *sgl,
323static void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 323static void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
324 size_t size, enum dma_data_direction dir) 324 size_t size, enum dma_data_direction dir)
325{ 325{
326 BUG_ON(dev->bus != &pci_bus_type); 326 BUG_ON(!dev_is_pci(dev));
327} 327}
328 328
329static void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, 329static void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
330 size_t size, 330 size_t size,
331 enum dma_data_direction dir) 331 enum dma_data_direction dir)
332{ 332{
333 BUG_ON(dev->bus != &pci_bus_type); 333 BUG_ON(!dev_is_pci(dev));
334} 334}
335 335
336static void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, 336static void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
337 int nelems, enum dma_data_direction dir) 337 int nelems, enum dma_data_direction dir)
338{ 338{
339 BUG_ON(dev->bus != &pci_bus_type); 339 BUG_ON(!dev_is_pci(dev));
340} 340}
341 341
342static void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, 342static void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
343 int nelems, enum dma_data_direction dir) 343 int nelems, enum dma_data_direction dir)
344{ 344{
345 BUG_ON(dev->bus != &pci_bus_type); 345 BUG_ON(!dev_is_pci(dev));
346} 346}
347 347
348static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 348static int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 09ef94a8a7c3..ca4504424dae 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -277,13 +277,13 @@ config SMP
277 bool "Symmetric multi-processing support" 277 bool "Symmetric multi-processing support"
278 ---help--- 278 ---help---
279 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
280 a system with only one CPU, like most personal computers, say N. If 280 a system with only one CPU, say N. If you have a system with more
281 you have a system with more than one CPU, say Y. 281 than one CPU, say Y.
282 282
283 If you say N here, the kernel will run on single and multiprocessor 283 If you say N here, the kernel will run on uni- and multiprocessor
284 machines, but will use only one CPU of a multiprocessor machine. If 284 machines, but will use only one CPU of a multiprocessor machine. If
285 you say Y here, the kernel will run on many, but not all, 285 you say Y here, the kernel will run on many, but not all,
286 singleprocessor machines. On a singleprocessor machine, the kernel 286 uniprocessor machines. On a uniprocessor machine, the kernel
287 will run faster if you say N here. 287 will run faster if you say N here.
288 288
289 People using multiprocessor machines who say Y here should also say 289 People using multiprocessor machines who say Y here should also say
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index 2b58c5f0bc38..932435ac4e5c 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -4,3 +4,4 @@ generic-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 6generic-y += preempt.h
7generic-y += hash.h
diff --git a/arch/m32r/include/uapi/asm/socket.h b/arch/m32r/include/uapi/asm/socket.h
index 52966650114f..6c9a24b3aefa 100644
--- a/arch/m32r/include/uapi/asm/socket.h
+++ b/arch/m32r/include/uapi/asm/socket.h
@@ -78,4 +78,6 @@
78 78
79#define SO_MAX_PACING_RATE 47 79#define SO_MAX_PACING_RATE 47
80 80
81#define SO_BPF_EXTENSIONS 48
82
81#endif /* _ASM_M32R_SOCKET_H */ 83#endif /* _ASM_M32R_SOCKET_H */
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index 0721858fbd1e..2d75ae246167 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -62,17 +62,18 @@ struct nfhd_device {
62static void nfhd_make_request(struct request_queue *queue, struct bio *bio) 62static void nfhd_make_request(struct request_queue *queue, struct bio *bio)
63{ 63{
64 struct nfhd_device *dev = queue->queuedata; 64 struct nfhd_device *dev = queue->queuedata;
65 struct bio_vec *bvec; 65 struct bio_vec bvec;
66 int i, dir, len, shift; 66 struct bvec_iter iter;
67 sector_t sec = bio->bi_sector; 67 int dir, len, shift;
68 sector_t sec = bio->bi_iter.bi_sector;
68 69
69 dir = bio_data_dir(bio); 70 dir = bio_data_dir(bio);
70 shift = dev->bshift; 71 shift = dev->bshift;
71 bio_for_each_segment(bvec, bio, i) { 72 bio_for_each_segment(bvec, bio, iter) {
72 len = bvec->bv_len; 73 len = bvec.bv_len;
73 len >>= 9; 74 len >>= 9;
74 nfhd_read_write(dev->id, 0, dir, sec >> shift, len >> shift, 75 nfhd_read_write(dev->id, 0, dir, sec >> shift, len >> shift,
75 bvec_to_phys(bvec)); 76 bvec_to_phys(&bvec));
76 sec += len; 77 sec += len;
77 } 78 }
78 bio_endio(bio, 0); 79 bio_endio(bio, 0);
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index a5d27f272a59..7cc8c364924d 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -32,3 +32,4 @@ generic-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 34generic-y += preempt.h
35generic-y += hash.h
diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild
index 84d0c1d6b9b3..b716d807c2ec 100644
--- a/arch/metag/include/asm/Kbuild
+++ b/arch/metag/include/asm/Kbuild
@@ -53,3 +53,4 @@ generic-y += user.h
53generic-y += vga.h 53generic-y += vga.h
54generic-y += xor.h 54generic-y += xor.h
55generic-y += preempt.h 55generic-y += preempt.h
56generic-y += hash.h
diff --git a/arch/metag/include/asm/fixmap.h b/arch/metag/include/asm/fixmap.h
index 33312751c92b..af621b041739 100644
--- a/arch/metag/include/asm/fixmap.h
+++ b/arch/metag/include/asm/fixmap.h
@@ -51,37 +51,7 @@ enum fixed_addresses {
51#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 51#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
52#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) 52#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK)
53 53
54#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) 54#include <asm-generic/fixmap.h>
55#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
56
57extern void __this_fixmap_does_not_exist(void);
58/*
59 * 'index to address' translation. If anyone tries to use the idx
60 * directly without tranlation, we catch the bug with a NULL-deference
61 * kernel oops. Illegal ranges of incoming indices are caught too.
62 */
63static inline unsigned long fix_to_virt(const unsigned int idx)
64{
65 /*
66 * this branch gets completely eliminated after inlining,
67 * except when someone tries to use fixaddr indices in an
68 * illegal way. (such as mixing up address types or using
69 * out-of-range indices).
70 *
71 * If it doesn't get removed, the linker will complain
72 * loudly with a reasonably clear error message..
73 */
74 if (idx >= __end_of_fixed_addresses)
75 __this_fixmap_does_not_exist();
76
77 return __fix_to_virt(idx);
78}
79
80static inline unsigned long virt_to_fix(const unsigned long vaddr)
81{
82 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
83 return __virt_to_fix(vaddr);
84}
85 55
86#define kmap_get_fixmap_pte(vaddr) \ 56#define kmap_get_fixmap_pte(vaddr) \
87 pte_offset_kernel( \ 57 pte_offset_kernel( \
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index 3cd6288f65c2..11fa51c89617 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -204,7 +204,8 @@ static void __init do_init_bootmem(void)
204 start_pfn = memblock_region_memory_base_pfn(reg); 204 start_pfn = memblock_region_memory_base_pfn(reg);
205 end_pfn = memblock_region_memory_end_pfn(reg); 205 end_pfn = memblock_region_memory_end_pfn(reg);
206 memblock_set_node(PFN_PHYS(start_pfn), 206 memblock_set_node(PFN_PHYS(start_pfn),
207 PFN_PHYS(end_pfn - start_pfn), 0); 207 PFN_PHYS(end_pfn - start_pfn),
208 &memblock.memory, 0);
208 } 209 }
209 210
210 /* All of system RAM sits in node 0 for the non-NUMA case */ 211 /* All of system RAM sits in node 0 for the non-NUMA case */
diff --git a/arch/metag/mm/numa.c b/arch/metag/mm/numa.c
index b172aa45fcf8..67b46c295072 100644
--- a/arch/metag/mm/numa.c
+++ b/arch/metag/mm/numa.c
@@ -42,7 +42,8 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
42 memblock_add(start, end - start); 42 memblock_add(start, end - start);
43 43
44 memblock_set_node(PFN_PHYS(start_pfn), 44 memblock_set_node(PFN_PHYS(start_pfn),
45 PFN_PHYS(end_pfn - start_pfn), nid); 45 PFN_PHYS(end_pfn - start_pfn),
46 &memblock.memory, nid);
46 47
47 /* Node-local pgdat */ 48 /* Node-local pgdat */
48 pgdat_paddr = memblock_alloc_base(sizeof(struct pglist_data), 49 pgdat_paddr = memblock_alloc_base(sizeof(struct pglist_data),
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index e23cccde9c27..79b9bcdfe498 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -26,10 +26,13 @@ config MICROBLAZE
26 select GENERIC_CPU_DEVICES 26 select GENERIC_CPU_DEVICES
27 select GENERIC_ATOMIC64 27 select GENERIC_ATOMIC64
28 select GENERIC_CLOCKEVENTS 28 select GENERIC_CLOCKEVENTS
29 select COMMON_CLK
30 select GENERIC_SCHED_CLOCK
29 select GENERIC_IDLE_POLL_SETUP 31 select GENERIC_IDLE_POLL_SETUP
30 select MODULES_USE_ELF_RELA 32 select MODULES_USE_ELF_RELA
31 select CLONE_BACKWARDS3 33 select CLONE_BACKWARDS3
32 select CLKSRC_OF 34 select CLKSRC_OF
35 select BUILDTIME_EXTABLE_SORT
33 36
34config SWAP 37config SWAP
35 def_bool n 38 def_bool n
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 40350a3c24e9..a69eaf2ab130 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -1,3 +1,5 @@
1KBUILD_DEFCONFIG := mmu_defconfig
2
1ifeq ($(CONFIG_MMU),y) 3ifeq ($(CONFIG_MMU),y)
2UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" 4UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
3else 5else
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index a82426589fff..2b98bc73642a 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -2,6 +2,7 @@
2generic-y += barrier.h 2generic-y += barrier.h
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += hash.h
5generic-y += trace_clock.h 6generic-y += trace_clock.h
6generic-y += syscalls.h 7generic-y += syscalls.h
7generic-y += preempt.h 8generic-y += preempt.h
diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h
index 7d6831ac8a46..3337417fcdca 100644
--- a/arch/microblaze/include/asm/cpuinfo.h
+++ b/arch/microblaze/include/asm/cpuinfo.h
@@ -91,15 +91,18 @@ extern struct cpuinfo cpuinfo;
91 91
92/* fwd declarations of the various CPUinfo populators */ 92/* fwd declarations of the various CPUinfo populators */
93void setup_cpuinfo(void); 93void setup_cpuinfo(void);
94void setup_cpuinfo_clk(void);
94 95
95void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu); 96void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu);
96void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu); 97void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu);
97 98
98static inline unsigned int fcpu(struct device_node *cpu, char *n) 99static inline unsigned int fcpu(struct device_node *cpu, char *n)
99{ 100{
100 const __be32 *val; 101 u32 val = 0;
101 return (val = of_get_property(cpu, n, NULL)) ? 102
102 be32_to_cpup(val) : 0; 103 of_property_read_u32(cpu, n, &val);
104
105 return val;
103} 106}
104 107
105#endif /* _ASM_MICROBLAZE_CPUINFO_H */ 108#endif /* _ASM_MICROBLAZE_CPUINFO_H */
diff --git a/arch/microblaze/include/asm/fixmap.h b/arch/microblaze/include/asm/fixmap.h
index f2b312e10b10..06c0e2b1883f 100644
--- a/arch/microblaze/include/asm/fixmap.h
+++ b/arch/microblaze/include/asm/fixmap.h
@@ -58,52 +58,12 @@ enum fixed_addresses {
58extern void __set_fixmap(enum fixed_addresses idx, 58extern void __set_fixmap(enum fixed_addresses idx,
59 phys_addr_t phys, pgprot_t flags); 59 phys_addr_t phys, pgprot_t flags);
60 60
61#define set_fixmap(idx, phys) \
62 __set_fixmap(idx, phys, PAGE_KERNEL)
63/*
64 * Some hardware wants to get fixmapped without caching.
65 */
66#define set_fixmap_nocache(idx, phys) \
67 __set_fixmap(idx, phys, PAGE_KERNEL_CI)
68
69#define clear_fixmap(idx) \
70 __set_fixmap(idx, 0, __pgprot(0))
71
72#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 61#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
73#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) 62#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
74 63
75#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) 64#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_CI
76#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
77
78extern void __this_fixmap_does_not_exist(void);
79
80/*
81 * 'index to address' translation. If anyone tries to use the idx
82 * directly without tranlation, we catch the bug with a NULL-deference
83 * kernel oops. Illegal ranges of incoming indices are caught too.
84 */
85static __always_inline unsigned long fix_to_virt(const unsigned int idx)
86{
87 /*
88 * this branch gets completely eliminated after inlining,
89 * except when someone tries to use fixaddr indices in an
90 * illegal way. (such as mixing up address types or using
91 * out-of-range indices).
92 *
93 * If it doesn't get removed, the linker will complain
94 * loudly with a reasonably clear error message..
95 */
96 if (idx >= __end_of_fixed_addresses)
97 __this_fixmap_does_not_exist();
98
99 return __fix_to_virt(idx);
100}
101 65
102static inline unsigned long virt_to_fix(const unsigned long vaddr) 66#include <asm-generic/fixmap.h>
103{
104 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
105 return __virt_to_fix(vaddr);
106}
107 67
108#endif /* !__ASSEMBLY__ */ 68#endif /* !__ASSEMBLY__ */
109#endif 69#endif
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 2565cb94f32f..a2cea7206077 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -342,4 +342,12 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
342#define iowrite32_rep(p, src, count) \ 342#define iowrite32_rep(p, src, count) \
343 outsl((unsigned long) (p), (src), (count)) 343 outsl((unsigned long) (p), (src), (count))
344 344
345#define readb_relaxed readb
346#define readw_relaxed readw
347#define readl_relaxed readl
348
349#define writeb_relaxed writeb
350#define writew_relaxed writew
351#define writel_relaxed writel
352
345#endif /* _ASM_MICROBLAZE_IO_H */ 353#endif /* _ASM_MICROBLAZE_IO_H */
diff --git a/arch/microblaze/include/asm/sections.h b/arch/microblaze/include/asm/sections.h
index c07ed5d2a820..1b281d3ea734 100644
--- a/arch/microblaze/include/asm/sections.h
+++ b/arch/microblaze/include/asm/sections.h
@@ -16,7 +16,6 @@
16# ifndef __ASSEMBLY__ 16# ifndef __ASSEMBLY__
17extern char _ssbss[], _esbss[]; 17extern char _ssbss[], _esbss[];
18extern unsigned long __ivt_start[], __ivt_end[]; 18extern unsigned long __ivt_start[], __ivt_end[];
19extern char _etext[], _stext[];
20 19
21extern u32 _fdt_start[], _fdt_end[]; 20extern u32 _fdt_start[], _fdt_end[];
22 21
diff --git a/arch/microblaze/include/uapi/asm/Kbuild b/arch/microblaze/include/uapi/asm/Kbuild
index 6d7d7f4aaae8..1aac99f87df1 100644
--- a/arch/microblaze/include/uapi/asm/Kbuild
+++ b/arch/microblaze/include/uapi/asm/Kbuild
@@ -1,6 +1,8 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += types.h
5
4header-y += auxvec.h 6header-y += auxvec.h
5header-y += bitsperlong.h 7header-y += bitsperlong.h
6header-y += byteorder.h 8header-y += byteorder.h
@@ -31,5 +33,4 @@ header-y += statfs.h
31header-y += swab.h 33header-y += swab.h
32header-y += termbits.h 34header-y += termbits.h
33header-y += termios.h 35header-y += termios.h
34header-y += types.h
35header-y += unistd.h 36header-y += unistd.h
diff --git a/arch/microblaze/include/uapi/asm/types.h b/arch/microblaze/include/uapi/asm/types.h
deleted file mode 100644
index b9e79bc580dd..000000000000
--- a/arch/microblaze/include/uapi/asm/types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/types.h>
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
index ee4689415410..93c26cf50de5 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
@@ -112,7 +112,4 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
112 CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK); 112 CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK);
113 113
114 CI(fpga_family_code, TARGET_FAMILY); 114 CI(fpga_family_code, TARGET_FAMILY);
115
116 /* take timebase-frequency from DTS */
117 ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");
118} 115}
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
index 592bb2e838c4..4854285b26e7 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-static.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
@@ -113,8 +113,6 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
113 ci->num_rd_brk = fcpu(cpu, "xlnx,number-of-rd-addr-brk"); 113 ci->num_rd_brk = fcpu(cpu, "xlnx,number-of-rd-addr-brk");
114 ci->num_wr_brk = fcpu(cpu, "xlnx,number-of-wr-addr-brk"); 114 ci->num_wr_brk = fcpu(cpu, "xlnx,number-of-wr-addr-brk");
115 115
116 ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");
117
118 ci->pvr_user1 = fcpu(cpu, "xlnx,pvr-user1"); 116 ci->pvr_user1 = fcpu(cpu, "xlnx,pvr-user1");
119 ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2"); 117 ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2");
120 118
diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c
index c9203b1007aa..234acad79b9e 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo.c
@@ -8,6 +8,7 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/clk.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <asm/cpuinfo.h> 13#include <asm/cpuinfo.h>
13#include <asm/pvr.h> 14#include <asm/pvr.h>
@@ -39,6 +40,7 @@ const struct cpu_ver_key cpu_ver_lookup[] = {
39 {"8.30.a", 0x17}, 40 {"8.30.a", 0x17},
40 {"8.40.a", 0x18}, 41 {"8.40.a", 0x18},
41 {"8.40.b", 0x19}, 42 {"8.40.b", 0x19},
43 {"8.50.a", 0x1a},
42 {"9.0", 0x1b}, 44 {"9.0", 0x1b},
43 {"9.1", 0x1d}, 45 {"9.1", 0x1d},
44 {NULL, 0}, 46 {NULL, 0},
@@ -68,11 +70,10 @@ const struct family_string_key family_string_lookup[] = {
68}; 70};
69 71
70struct cpuinfo cpuinfo; 72struct cpuinfo cpuinfo;
73static struct device_node *cpu;
71 74
72void __init setup_cpuinfo(void) 75void __init setup_cpuinfo(void)
73{ 76{
74 struct device_node *cpu = NULL;
75
76 cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu"); 77 cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu");
77 if (!cpu) 78 if (!cpu)
78 pr_err("You don't have cpu!!!\n"); 79 pr_err("You don't have cpu!!!\n");
@@ -102,3 +103,22 @@ void __init setup_cpuinfo(void)
102 pr_warn("%s: Stream instructions enabled" 103 pr_warn("%s: Stream instructions enabled"
103 " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__); 104 " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__);
104} 105}
106
107void __init setup_cpuinfo_clk(void)
108{
109 struct clk *clk;
110
111 clk = of_clk_get(cpu, 0);
112 if (IS_ERR(clk)) {
113 pr_err("ERROR: CPU CCF input clock not found\n");
114 /* take timebase-frequency from DTS */
115 cpuinfo.cpu_clock_freq = fcpu(cpu, "timebase-frequency");
116 } else {
117 cpuinfo.cpu_clock_freq = clk_get_rate(clk);
118 }
119
120 if (!cpuinfo.cpu_clock_freq) {
121 pr_err("ERROR: CPU clock frequency not setup\n");
122 BUG();
123 }
124}
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index 817b7eec95b6..b7fb0438458c 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -64,6 +64,10 @@ real_start:
64#endif 64#endif
65 65
66 mts rmsr, r0 66 mts rmsr, r0
67/* Disable stack protection from bootloader */
68 mts rslr, r0
69 addi r8, r0, 0xFFFFFFF
70 mts rshr, r8
67/* 71/*
68 * According to Xilinx, msrclr instruction behaves like 'mfs rX,rpc' 72 * According to Xilinx, msrclr instruction behaves like 'mfs rX,rpc'
69 * if the msrclr instruction is not enabled. We use this to detect 73 * if the msrclr instruction is not enabled. We use this to detect
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index fc6b89f4dd31..0b11a4469deb 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -147,15 +147,14 @@
147 or r3, r0, NUM_TO_REG (regnum); 147 or r3, r0, NUM_TO_REG (regnum);
148 148
149 /* Shift right instruction depending on available configuration */ 149 /* Shift right instruction depending on available configuration */
150 #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0 150 #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL == 0
151 #define BSRLI(rD, rA, imm) \
152 bsrli rD, rA, imm
153 #else
154 #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA)
155 /* Only the used shift constants defined here - add more if needed */ 151 /* Only the used shift constants defined here - add more if needed */
156 #define BSRLI2(rD, rA) \ 152 #define BSRLI2(rD, rA) \
157 srl rD, rA; /* << 1 */ \ 153 srl rD, rA; /* << 1 */ \
158 srl rD, rD; /* << 2 */ 154 srl rD, rD; /* << 2 */
155 #define BSRLI4(rD, rA) \
156 BSRLI2(rD, rA); \
157 BSRLI2(rD, rD)
159 #define BSRLI10(rD, rA) \ 158 #define BSRLI10(rD, rA) \
160 srl rD, rA; /* << 1 */ \ 159 srl rD, rA; /* << 1 */ \
161 srl rD, rD; /* << 2 */ \ 160 srl rD, rD; /* << 2 */ \
@@ -170,7 +169,33 @@
170 #define BSRLI20(rD, rA) \ 169 #define BSRLI20(rD, rA) \
171 BSRLI10(rD, rA); \ 170 BSRLI10(rD, rA); \
172 BSRLI10(rD, rD) 171 BSRLI10(rD, rD)
172
173 .macro bsrli, rD, rA, IMM
174 .if (\IMM) == 2
175 BSRLI2(\rD, \rA)
176 .elseif (\IMM) == 10
177 BSRLI10(\rD, \rA)
178 .elseif (\IMM) == 12
179 BSRLI2(\rD, \rA)
180 BSRLI10(\rD, \rD)
181 .elseif (\IMM) == 14
182 BSRLI4(\rD, \rA)
183 BSRLI10(\rD, \rD)
184 .elseif (\IMM) == 20
185 BSRLI20(\rD, \rA)
186 .elseif (\IMM) == 24
187 BSRLI4(\rD, \rA)
188 BSRLI20(\rD, \rD)
189 .elseif (\IMM) == 28
190 BSRLI4(\rD, \rA)
191 BSRLI4(\rD, \rD)
192 BSRLI20(\rD, \rD)
193 .else
194 .error "BSRLI shift macros \IMM"
195 .endif
196 .endm
173 #endif 197 #endif
198
174#endif /* CONFIG_MMU */ 199#endif /* CONFIG_MMU */
175 200
176.extern other_exception_handler /* Defined in exception.c */ 201.extern other_exception_handler /* Defined in exception.c */
@@ -604,7 +629,7 @@ ex_handler_done:
604 ex4: 629 ex4:
605 tophys(r4,r4) 630 tophys(r4,r4)
606 /* Create L1 (pgdir/pmd) address */ 631 /* Create L1 (pgdir/pmd) address */
607 BSRLI(r5,r3, PGDIR_SHIFT - 2) 632 bsrli r5, r3, PGDIR_SHIFT - 2
608 andi r5, r5, PAGE_SIZE - 4 633 andi r5, r5, PAGE_SIZE - 4
609/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 634/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
610 or r4, r4, r5 635 or r4, r4, r5
@@ -613,7 +638,7 @@ ex_handler_done:
613 beqi r5, ex2 /* Bail if no table */ 638 beqi r5, ex2 /* Bail if no table */
614 639
615 tophys(r5,r5) 640 tophys(r5,r5)
616 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ 641 bsrli r6, r3, PTE_SHIFT /* Compute PTE address */
617 andi r6, r6, PAGE_SIZE - 4 642 andi r6, r6, PAGE_SIZE - 4
618 or r5, r5, r6 643 or r5, r5, r6
619 lwi r4, r5, 0 /* Get Linux PTE */ 644 lwi r4, r5, 0 /* Get Linux PTE */
@@ -705,7 +730,7 @@ ex_handler_done:
705 ex6: 730 ex6:
706 tophys(r4,r4) 731 tophys(r4,r4)
707 /* Create L1 (pgdir/pmd) address */ 732 /* Create L1 (pgdir/pmd) address */
708 BSRLI(r5,r3, PGDIR_SHIFT - 2) 733 bsrli r5, r3, PGDIR_SHIFT - 2
709 andi r5, r5, PAGE_SIZE - 4 734 andi r5, r5, PAGE_SIZE - 4
710/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 735/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
711 or r4, r4, r5 736 or r4, r4, r5
@@ -714,7 +739,7 @@ ex_handler_done:
714 beqi r5, ex7 /* Bail if no table */ 739 beqi r5, ex7 /* Bail if no table */
715 740
716 tophys(r5,r5) 741 tophys(r5,r5)
717 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ 742 bsrli r6, r3, PTE_SHIFT /* Compute PTE address */
718 andi r6, r6, PAGE_SIZE - 4 743 andi r6, r6, PAGE_SIZE - 4
719 or r5, r5, r6 744 or r5, r5, r6
720 lwi r4, r5, 0 /* Get Linux PTE */ 745 lwi r4, r5, 0 /* Get Linux PTE */
@@ -776,7 +801,7 @@ ex_handler_done:
776 ex9: 801 ex9:
777 tophys(r4,r4) 802 tophys(r4,r4)
778 /* Create L1 (pgdir/pmd) address */ 803 /* Create L1 (pgdir/pmd) address */
779 BSRLI(r5,r3, PGDIR_SHIFT - 2) 804 bsrli r5, r3, PGDIR_SHIFT - 2
780 andi r5, r5, PAGE_SIZE - 4 805 andi r5, r5, PAGE_SIZE - 4
781/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 806/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
782 or r4, r4, r5 807 or r4, r4, r5
@@ -785,7 +810,7 @@ ex_handler_done:
785 beqi r5, ex10 /* Bail if no table */ 810 beqi r5, ex10 /* Bail if no table */
786 811
787 tophys(r5,r5) 812 tophys(r5,r5)
788 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */ 813 bsrli r6, r3, PTE_SHIFT /* Compute PTE address */
789 andi r6, r6, PAGE_SIZE - 4 814 andi r6, r6, PAGE_SIZE - 4
790 or r5, r5, r6 815 or r5, r5, r6
791 lwi r4, r5, 0 /* Get Linux PTE */ 816 lwi r4, r5, 0 /* Get Linux PTE */
@@ -922,7 +947,7 @@ ex_handler_done:
922.ent _unaligned_data_exception 947.ent _unaligned_data_exception
923_unaligned_data_exception: 948_unaligned_data_exception:
924 andi r8, r3, 0x3E0; /* Mask and extract the register operand */ 949 andi r8, r3, 0x3E0; /* Mask and extract the register operand */
925 BSRLI(r8,r8,2); /* r8 >> 2 = register operand * 8 */ 950 bsrli r8, r8, 2; /* r8 >> 2 = register operand * 8 */
926 andi r6, r3, 0x400; /* Extract ESR[S] */ 951 andi r6, r3, 0x400; /* Extract ESR[S] */
927 bneid r6, ex_sw_vm; 952 bneid r6, ex_sw_vm;
928 andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */ 953 andi r6, r3, 0x800; /* Extract ESR[W] - delay slot */
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 8de8ebc309f1..67cc4b282cc1 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/clk-provider.h>
12#include <linux/clocksource.h> 13#include <linux/clocksource.h>
13#include <linux/string.h> 14#include <linux/string.h>
14#include <linux/seq_file.h> 15#include <linux/seq_file.h>
@@ -136,7 +137,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
136 lockdep_init(); 137 lockdep_init();
137 138
138/* initialize device tree for usage in early_printk */ 139/* initialize device tree for usage in early_printk */
139 early_init_devtree((void *)_fdt_start); 140 early_init_devtree(_fdt_start);
140 141
141#ifdef CONFIG_EARLY_PRINTK 142#ifdef CONFIG_EARLY_PRINTK
142 setup_early_printk(NULL); 143 setup_early_printk(NULL);
@@ -152,8 +153,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
152 if (fdt) 153 if (fdt)
153 pr_info("FDT at 0x%08x\n", fdt); 154 pr_info("FDT at 0x%08x\n", fdt);
154 else 155 else
155 pr_info("Compiled-in FDT at 0x%08x\n", 156 pr_info("Compiled-in FDT at %p\n", _fdt_start);
156 (unsigned int)_fdt_start);
157 157
158#ifdef CONFIG_MTD_UCLINUX 158#ifdef CONFIG_MTD_UCLINUX
159 pr_info("Found romfs @ 0x%08x (0x%08x)\n", 159 pr_info("Found romfs @ 0x%08x (0x%08x)\n",
@@ -175,7 +175,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
175#else 175#else
176 if (!msr) { 176 if (!msr) {
177 pr_info("!!!Your kernel not setup MSR instruction but "); 177 pr_info("!!!Your kernel not setup MSR instruction but ");
178 pr_cont"CPU have it %x\n", msr); 178 pr_cont("CPU have it %x\n", msr);
179 } 179 }
180#endif 180#endif
181 181
@@ -196,6 +196,8 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
196 196
197void __init time_init(void) 197void __init time_init(void)
198{ 198{
199 of_clk_init(NULL);
200 setup_cpuinfo_clk();
199 clocksource_of_init(); 201 clocksource_of_init();
200} 202}
201 203
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 3e39b1082fdf..fb0c61443f19 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -12,12 +12,12 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/sched_clock.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
16#include <linux/clockchips.h> 17#include <linux/clockchips.h>
17#include <linux/of_address.h> 18#include <linux/of_address.h>
18#include <linux/of_irq.h> 19#include <linux/of_irq.h>
19#include <asm/cpuinfo.h> 20#include <asm/cpuinfo.h>
20#include <linux/cnt32_to_63.h>
21 21
22static void __iomem *timer_baseaddr; 22static void __iomem *timer_baseaddr;
23 23
@@ -167,10 +167,15 @@ static __init void xilinx_clockevent_init(void)
167 clockevents_register_device(&clockevent_xilinx_timer); 167 clockevents_register_device(&clockevent_xilinx_timer);
168} 168}
169 169
170static u64 xilinx_clock_read(void)
171{
172 return in_be32(timer_baseaddr + TCR1);
173}
174
170static cycle_t xilinx_read(struct clocksource *cs) 175static cycle_t xilinx_read(struct clocksource *cs)
171{ 176{
172 /* reading actual value of timer 1 */ 177 /* reading actual value of timer 1 */
173 return (cycle_t) (in_be32(timer_baseaddr + TCR1)); 178 return (cycle_t)xilinx_clock_read();
174} 179}
175 180
176static struct timecounter xilinx_tc = { 181static struct timecounter xilinx_tc = {
@@ -222,17 +227,17 @@ static int __init xilinx_clocksource_init(void)
222 return 0; 227 return 0;
223} 228}
224 229
225/*
226 * We have to protect accesses before timer initialization
227 * and return 0 for sched_clock function below.
228 */
229static int timer_initialized;
230
231static void __init xilinx_timer_init(struct device_node *timer) 230static void __init xilinx_timer_init(struct device_node *timer)
232{ 231{
232 struct clk *clk;
233 static int initialized;
233 u32 irq; 234 u32 irq;
234 u32 timer_num = 1; 235 u32 timer_num = 1;
235 int ret; 236
237 if (initialized)
238 return;
239
240 initialized = 1;
236 241
237 timer_baseaddr = of_iomap(timer, 0); 242 timer_baseaddr = of_iomap(timer, 0);
238 if (!timer_baseaddr) { 243 if (!timer_baseaddr) {
@@ -250,10 +255,20 @@ static void __init xilinx_timer_init(struct device_node *timer)
250 255
251 pr_info("%s: irq=%d\n", timer->full_name, irq); 256 pr_info("%s: irq=%d\n", timer->full_name, irq);
252 257
253 /* If there is clock-frequency property than use it */ 258 clk = of_clk_get(timer, 0);
254 ret = of_property_read_u32(timer, "clock-frequency", &timer_clock_freq); 259 if (IS_ERR(clk)) {
255 if (ret < 0) 260 pr_err("ERROR: timer CCF input clock not found\n");
261 /* If there is clock-frequency property than use it */
262 of_property_read_u32(timer, "clock-frequency",
263 &timer_clock_freq);
264 } else {
265 timer_clock_freq = clk_get_rate(clk);
266 }
267
268 if (!timer_clock_freq) {
269 pr_err("ERROR: Using CPU clock frequency\n");
256 timer_clock_freq = cpuinfo.cpu_clock_freq; 270 timer_clock_freq = cpuinfo.cpu_clock_freq;
271 }
257 272
258 freq_div_hz = timer_clock_freq / HZ; 273 freq_div_hz = timer_clock_freq / HZ;
259 274
@@ -263,18 +278,8 @@ static void __init xilinx_timer_init(struct device_node *timer)
263#endif 278#endif
264 xilinx_clocksource_init(); 279 xilinx_clocksource_init();
265 xilinx_clockevent_init(); 280 xilinx_clockevent_init();
266 timer_initialized = 1;
267}
268 281
269unsigned long long notrace sched_clock(void) 282 sched_clock_register(xilinx_clock_read, 32, timer_clock_freq);
270{
271 if (timer_initialized) {
272 struct clocksource *cs = &clocksource_microblaze;
273
274 cycle_t cyc = cnt32_to_63(cs->read(NULL)) & LLONG_MAX;
275 return clocksource_cyc2ns(cyc, cs->mult, cs->shift);
276 }
277 return 0;
278} 283}
279 284
280CLOCKSOURCE_OF_DECLARE(xilinx_timer, "xlnx,xps-timer-1.00.a", 285CLOCKSOURCE_OF_DECLARE(xilinx_timer, "xlnx,xps-timer-1.00.a",
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
index 936d01a689d7..be9488d69734 100644
--- a/arch/microblaze/kernel/vmlinux.lds.S
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -51,6 +51,7 @@ SECTIONS {
51 . = ALIGN(16); 51 . = ALIGN(16);
52 RODATA 52 RODATA
53 EXCEPTION_TABLE(16) 53 EXCEPTION_TABLE(16)
54 NOTES
54 55
55 /* 56 /*
56 * sdata2 section can go anywhere, but must be word aligned 57 * sdata2 section can go anywhere, but must be word aligned
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 74c7bcc1e82d..89077d346714 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -192,7 +192,8 @@ void __init setup_memory(void)
192 start_pfn = memblock_region_memory_base_pfn(reg); 192 start_pfn = memblock_region_memory_base_pfn(reg);
193 end_pfn = memblock_region_memory_end_pfn(reg); 193 end_pfn = memblock_region_memory_end_pfn(reg);
194 memblock_set_node(start_pfn << PAGE_SHIFT, 194 memblock_set_node(start_pfn << PAGE_SHIFT,
195 (end_pfn - start_pfn) << PAGE_SHIFT, 0); 195 (end_pfn - start_pfn) << PAGE_SHIFT,
196 &memblock.memory, 0);
196 } 197 }
197 198
198 /* free bootmem is whole main memory */ 199 /* free bootmem is whole main memory */
diff --git a/arch/microblaze/platform/generic/system.dts b/arch/microblaze/platform/generic/system.dts
index 3f85df2b73b3..b620da23febb 100644
--- a/arch/microblaze/platform/generic/system.dts
+++ b/arch/microblaze/platform/generic/system.dts
@@ -222,7 +222,6 @@
222 ranges ; 222 ranges ;
223 ethernet@81c00000 { 223 ethernet@81c00000 {
224 compatible = "xlnx,xps-ll-temac-1.01.b", "xlnx,xps-ll-temac-1.00.a"; 224 compatible = "xlnx,xps-ll-temac-1.01.b", "xlnx,xps-ll-temac-1.00.a";
225 device_type = "network";
226 interrupt-parent = <&xps_intc_0>; 225 interrupt-parent = <&xps_intc_0>;
227 interrupts = < 5 2 >; 226 interrupts = < 5 2 >;
228 llink-connected = <&PIM3>; 227 llink-connected = <&PIM3>;
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index c93d92beb3d6..dcae3a7035db 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2,6 +2,7 @@ config MIPS
2 bool 2 bool
3 default y 3 default y
4 select ARCH_MIGHT_HAVE_PC_PARPORT 4 select ARCH_MIGHT_HAVE_PC_PARPORT
5 select ARCH_MIGHT_HAVE_PC_SERIO
5 select HAVE_CONTEXT_TRACKING 6 select HAVE_CONTEXT_TRACKING
6 select HAVE_GENERIC_DMA_COHERENT 7 select HAVE_GENERIC_DMA_COHERENT
7 select HAVE_IDE 8 select HAVE_IDE
@@ -115,7 +116,6 @@ config BCM47XX
115 select CEVT_R4K 116 select CEVT_R4K
116 select CSRC_R4K 117 select CSRC_R4K
117 select DMA_NONCOHERENT 118 select DMA_NONCOHERENT
118 select FW_CFE
119 select HW_HAS_PCI 119 select HW_HAS_PCI
120 select IRQ_CPU 120 select IRQ_CPU
121 select SYS_HAS_CPU_MIPS32_R1 121 select SYS_HAS_CPU_MIPS32_R1
@@ -123,6 +123,7 @@ config BCM47XX
123 select SYS_SUPPORTS_32BIT_KERNEL 123 select SYS_SUPPORTS_32BIT_KERNEL
124 select SYS_SUPPORTS_LITTLE_ENDIAN 124 select SYS_SUPPORTS_LITTLE_ENDIAN
125 select SYS_HAS_EARLY_PRINTK 125 select SYS_HAS_EARLY_PRINTK
126 select EARLY_PRINTK_8250 if EARLY_PRINTK
126 help 127 help
127 Support for BCM47XX based boards 128 Support for BCM47XX based boards
128 129
@@ -133,14 +134,13 @@ config BCM63XX
133 select CSRC_R4K 134 select CSRC_R4K
134 select DMA_NONCOHERENT 135 select DMA_NONCOHERENT
135 select IRQ_CPU 136 select IRQ_CPU
136 select SYS_HAS_CPU_MIPS32_R1
137 select SYS_HAS_CPU_BMIPS4350 if !BCM63XX_CPU_6338 && !BCM63XX_CPU_6345 && !BCM63XX_CPU_6348
138 select SYS_SUPPORTS_32BIT_KERNEL 137 select SYS_SUPPORTS_32BIT_KERNEL
139 select SYS_SUPPORTS_BIG_ENDIAN 138 select SYS_SUPPORTS_BIG_ENDIAN
140 select SYS_HAS_EARLY_PRINTK 139 select SYS_HAS_EARLY_PRINTK
141 select SWAP_IO_SPACE 140 select SWAP_IO_SPACE
142 select ARCH_REQUIRE_GPIOLIB 141 select ARCH_REQUIRE_GPIOLIB
143 select HAVE_CLK 142 select HAVE_CLK
143 select MIPS_L1_CACHE_SHIFT_4
144 help 144 help
145 Support for BCM63XX based boards 145 Support for BCM63XX based boards
146 146
@@ -185,6 +185,7 @@ config MACH_DECSTATION
185 select SYS_SUPPORTS_128HZ 185 select SYS_SUPPORTS_128HZ
186 select SYS_SUPPORTS_256HZ 186 select SYS_SUPPORTS_256HZ
187 select SYS_SUPPORTS_1024HZ 187 select SYS_SUPPORTS_1024HZ
188 select MIPS_L1_CACHE_SHIFT_4
188 help 189 help
189 This enables support for DEC's MIPS based workstations. For details 190 This enables support for DEC's MIPS based workstations. For details
190 see the Linux/MIPS FAQ on <http://www.linux-mips.org/> and the 191 see the Linux/MIPS FAQ on <http://www.linux-mips.org/> and the
@@ -304,7 +305,7 @@ config MIPS_MALTA
304 select CEVT_R4K 305 select CEVT_R4K
305 select CSRC_R4K 306 select CSRC_R4K
306 select CSRC_GIC 307 select CSRC_GIC
307 select DMA_NONCOHERENT 308 select DMA_MAYBE_COHERENT
308 select GENERIC_ISA_DMA 309 select GENERIC_ISA_DMA
309 select HAVE_PCSPKR_PLATFORM 310 select HAVE_PCSPKR_PLATFORM
310 select IRQ_CPU 311 select IRQ_CPU
@@ -323,7 +324,6 @@ config MIPS_MALTA
323 select SYS_HAS_CPU_MIPS64_R2 324 select SYS_HAS_CPU_MIPS64_R2
324 select SYS_HAS_CPU_NEVADA 325 select SYS_HAS_CPU_NEVADA
325 select SYS_HAS_CPU_RM7000 326 select SYS_HAS_CPU_RM7000
326 select SYS_HAS_EARLY_PRINTK
327 select SYS_SUPPORTS_32BIT_KERNEL 327 select SYS_SUPPORTS_32BIT_KERNEL
328 select SYS_SUPPORTS_64BIT_KERNEL 328 select SYS_SUPPORTS_64BIT_KERNEL
329 select SYS_SUPPORTS_BIG_ENDIAN 329 select SYS_SUPPORTS_BIG_ENDIAN
@@ -348,6 +348,7 @@ config MIPS_SEAD3
348 select DMA_NONCOHERENT 348 select DMA_NONCOHERENT
349 select IRQ_CPU 349 select IRQ_CPU
350 select IRQ_GIC 350 select IRQ_GIC
351 select LIBFDT
351 select MIPS_MSC 352 select MIPS_MSC
352 select SYS_HAS_CPU_MIPS32_R1 353 select SYS_HAS_CPU_MIPS32_R1
353 select SYS_HAS_CPU_MIPS32_R2 354 select SYS_HAS_CPU_MIPS32_R2
@@ -470,6 +471,7 @@ config SGI_IP22
470 select SYS_SUPPORTS_32BIT_KERNEL 471 select SYS_SUPPORTS_32BIT_KERNEL
471 select SYS_SUPPORTS_64BIT_KERNEL 472 select SYS_SUPPORTS_64BIT_KERNEL
472 select SYS_SUPPORTS_BIG_ENDIAN 473 select SYS_SUPPORTS_BIG_ENDIAN
474 select MIPS_L1_CACHE_SHIFT_7
473 help 475 help
474 This are the SGI Indy, Challenge S and Indigo2, as well as certain 476 This are the SGI Indy, Challenge S and Indigo2, as well as certain
475 OEM variants like the Tandem CMN B006S. To compile a Linux kernel 477 OEM variants like the Tandem CMN B006S. To compile a Linux kernel
@@ -490,6 +492,7 @@ config SGI_IP27
490 select SYS_SUPPORTS_BIG_ENDIAN 492 select SYS_SUPPORTS_BIG_ENDIAN
491 select SYS_SUPPORTS_NUMA 493 select SYS_SUPPORTS_NUMA
492 select SYS_SUPPORTS_SMP 494 select SYS_SUPPORTS_SMP
495 select MIPS_L1_CACHE_SHIFT_7
493 help 496 help
494 This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics 497 This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics
495 workstations. To compile a Linux kernel that runs on these, say Y 498 workstations. To compile a Linux kernel that runs on these, say Y
@@ -696,6 +699,7 @@ config MIKROTIK_RB532
696 select SWAP_IO_SPACE 699 select SWAP_IO_SPACE
697 select BOOT_RAW 700 select BOOT_RAW
698 select ARCH_REQUIRE_GPIOLIB 701 select ARCH_REQUIRE_GPIOLIB
702 select MIPS_L1_CACHE_SHIFT_4
699 help 703 help
700 Support the Mikrotik(tm) RouterBoard 532 series, 704 Support the Mikrotik(tm) RouterBoard 532 series,
701 based on the IDT RC32434 SoC. 705 based on the IDT RC32434 SoC.
@@ -778,6 +782,7 @@ config NLM_XLP_BOARD
778 select CEVT_R4K 782 select CEVT_R4K
779 select CSRC_R4K 783 select CSRC_R4K
780 select IRQ_CPU 784 select IRQ_CPU
785 select ARCH_SUPPORTS_MSI
781 select ZONE_DMA32 if 64BIT 786 select ZONE_DMA32 if 64BIT
782 select SYNC_R4K 787 select SYNC_R4K
783 select SYS_HAS_EARLY_PRINTK 788 select SYS_HAS_EARLY_PRINTK
@@ -896,6 +901,10 @@ config FW_CFE
896config ARCH_DMA_ADDR_T_64BIT 901config ARCH_DMA_ADDR_T_64BIT
897 def_bool (HIGHMEM && 64BIT_PHYS_ADDR) || 64BIT 902 def_bool (HIGHMEM && 64BIT_PHYS_ADDR) || 64BIT
898 903
904config DMA_MAYBE_COHERENT
905 select DMA_NONCOHERENT
906 bool
907
899config DMA_COHERENT 908config DMA_COHERENT
900 bool 909 bool
901 910
@@ -1090,11 +1099,24 @@ config FW_SNIPROM
1090config BOOT_ELF32 1099config BOOT_ELF32
1091 bool 1100 bool
1092 1101
1102config MIPS_L1_CACHE_SHIFT_4
1103 bool
1104
1105config MIPS_L1_CACHE_SHIFT_5
1106 bool
1107
1108config MIPS_L1_CACHE_SHIFT_6
1109 bool
1110
1111config MIPS_L1_CACHE_SHIFT_7
1112 bool
1113
1093config MIPS_L1_CACHE_SHIFT 1114config MIPS_L1_CACHE_SHIFT
1094 int 1115 int
1095 default "4" if MACH_DECSTATION || MIKROTIK_RB532 || PMC_MSP4200_EVAL || SOC_RT288X 1116 default "4" if MIPS_L1_CACHE_SHIFT_4
1096 default "6" if MIPS_CPU_SCACHE 1117 default "5" if MIPS_L1_CACHE_SHIFT_5
1097 default "7" if SGI_IP22 || SGI_IP27 || SGI_IP28 || SNI_RM || CPU_CAVIUM_OCTEON 1118 default "6" if MIPS_L1_CACHE_SHIFT_6
1119 default "7" if MIPS_L1_CACHE_SHIFT_7
1098 default "5" 1120 default "5"
1099 1121
1100config HAVE_STD_PC_SERIAL_PORT 1122config HAVE_STD_PC_SERIAL_PORT
@@ -1374,47 +1396,31 @@ config CPU_CAVIUM_OCTEON
1374 select LIBFDT 1396 select LIBFDT
1375 select USE_OF 1397 select USE_OF
1376 select USB_EHCI_BIG_ENDIAN_MMIO 1398 select USB_EHCI_BIG_ENDIAN_MMIO
1399 select SYS_HAS_DMA_OPS
1400 select MIPS_L1_CACHE_SHIFT_7
1377 help 1401 help
1378 The Cavium Octeon processor is a highly integrated chip containing 1402 The Cavium Octeon processor is a highly integrated chip containing
1379 many ethernet hardware widgets for networking tasks. The processor 1403 many ethernet hardware widgets for networking tasks. The processor
1380 can have up to 16 Mips64v2 cores and 8 integrated gigabit ethernets. 1404 can have up to 16 Mips64v2 cores and 8 integrated gigabit ethernets.
1381 Full details can be found at http://www.caviumnetworks.com. 1405 Full details can be found at http://www.caviumnetworks.com.
1382 1406
1383config CPU_BMIPS3300 1407config CPU_BMIPS
1384 bool "BMIPS3300" 1408 bool "Broadcom BMIPS"
1385 depends on SYS_HAS_CPU_BMIPS3300 1409 depends on SYS_HAS_CPU_BMIPS
1386 select CPU_BMIPS 1410 select CPU_MIPS32
1387 help 1411 select CPU_BMIPS32_3300 if SYS_HAS_CPU_BMIPS32_3300
1388 Broadcom BMIPS3300 processors. 1412 select CPU_BMIPS4350 if SYS_HAS_CPU_BMIPS4350
1389 1413 select CPU_BMIPS4380 if SYS_HAS_CPU_BMIPS4380
1390config CPU_BMIPS4350 1414 select CPU_BMIPS5000 if SYS_HAS_CPU_BMIPS5000
1391 bool "BMIPS4350" 1415 select CPU_SUPPORTS_32BIT_KERNEL
1392 depends on SYS_HAS_CPU_BMIPS4350 1416 select DMA_NONCOHERENT
1393 select CPU_BMIPS 1417 select IRQ_CPU
1394 select SYS_SUPPORTS_SMP 1418 select SWAP_IO_SPACE
1395 select SYS_SUPPORTS_HOTPLUG_CPU 1419 select WEAK_ORDERING
1396 help
1397 Broadcom BMIPS4350 ("VIPER") processors.
1398
1399config CPU_BMIPS4380
1400 bool "BMIPS4380"
1401 depends on SYS_HAS_CPU_BMIPS4380
1402 select CPU_BMIPS
1403 select SYS_SUPPORTS_SMP
1404 select SYS_SUPPORTS_HOTPLUG_CPU
1405 help
1406 Broadcom BMIPS4380 processors.
1407
1408config CPU_BMIPS5000
1409 bool "BMIPS5000"
1410 depends on SYS_HAS_CPU_BMIPS5000
1411 select CPU_BMIPS
1412 select CPU_SUPPORTS_HIGHMEM 1420 select CPU_SUPPORTS_HIGHMEM
1413 select MIPS_CPU_SCACHE 1421 select CPU_HAS_PREFETCH
1414 select SYS_SUPPORTS_SMP
1415 select SYS_SUPPORTS_HOTPLUG_CPU
1416 help 1422 help
1417 Broadcom BMIPS5000 processors. 1423 Support for BMIPS32/3300/4350/4380 and BMIPS5000 processors.
1418 1424
1419config CPU_XLR 1425config CPU_XLR
1420 bool "Netlogic XLR SoC" 1426 bool "Netlogic XLR SoC"
@@ -1497,14 +1503,25 @@ config CPU_LOONGSON1
1497 select CPU_SUPPORTS_32BIT_KERNEL 1503 select CPU_SUPPORTS_32BIT_KERNEL
1498 select CPU_SUPPORTS_HIGHMEM 1504 select CPU_SUPPORTS_HIGHMEM
1499 1505
1500config CPU_BMIPS 1506config CPU_BMIPS32_3300
1507 select SMP_UP if SMP
1501 bool 1508 bool
1502 select CPU_MIPS32 1509
1503 select CPU_SUPPORTS_32BIT_KERNEL 1510config CPU_BMIPS4350
1504 select DMA_NONCOHERENT 1511 bool
1505 select IRQ_CPU 1512 select SYS_SUPPORTS_SMP
1506 select SWAP_IO_SPACE 1513 select SYS_SUPPORTS_HOTPLUG_CPU
1507 select WEAK_ORDERING 1514
1515config CPU_BMIPS4380
1516 bool
1517 select SYS_SUPPORTS_SMP
1518 select SYS_SUPPORTS_HOTPLUG_CPU
1519
1520config CPU_BMIPS5000
1521 bool
1522 select MIPS_CPU_SCACHE
1523 select SYS_SUPPORTS_SMP
1524 select SYS_SUPPORTS_HOTPLUG_CPU
1508 1525
1509config SYS_HAS_CPU_LOONGSON2E 1526config SYS_HAS_CPU_LOONGSON2E
1510 bool 1527 bool
@@ -1578,17 +1595,24 @@ config SYS_HAS_CPU_SB1
1578config SYS_HAS_CPU_CAVIUM_OCTEON 1595config SYS_HAS_CPU_CAVIUM_OCTEON
1579 bool 1596 bool
1580 1597
1581config SYS_HAS_CPU_BMIPS3300 1598config SYS_HAS_CPU_BMIPS
1599 bool
1600
1601config SYS_HAS_CPU_BMIPS32_3300
1582 bool 1602 bool
1603 select SYS_HAS_CPU_BMIPS
1583 1604
1584config SYS_HAS_CPU_BMIPS4350 1605config SYS_HAS_CPU_BMIPS4350
1585 bool 1606 bool
1607 select SYS_HAS_CPU_BMIPS
1586 1608
1587config SYS_HAS_CPU_BMIPS4380 1609config SYS_HAS_CPU_BMIPS4380
1588 bool 1610 bool
1611 select SYS_HAS_CPU_BMIPS
1589 1612
1590config SYS_HAS_CPU_BMIPS5000 1613config SYS_HAS_CPU_BMIPS5000
1591 bool 1614 bool
1615 select SYS_HAS_CPU_BMIPS
1592 1616
1593config SYS_HAS_CPU_XLR 1617config SYS_HAS_CPU_XLR
1594 bool 1618 bool
@@ -1796,6 +1820,7 @@ config IP22_CPU_SCACHE
1796config MIPS_CPU_SCACHE 1820config MIPS_CPU_SCACHE
1797 bool 1821 bool
1798 select BOARD_SCACHE 1822 select BOARD_SCACHE
1823 select MIPS_L1_CACHE_SHIFT_6
1799 1824
1800config R5000_CPU_SCACHE 1825config R5000_CPU_SCACHE
1801 bool 1826 bool
@@ -1832,59 +1857,48 @@ choice
1832 prompt "MIPS MT options" 1857 prompt "MIPS MT options"
1833 1858
1834config MIPS_MT_DISABLED 1859config MIPS_MT_DISABLED
1835 bool "Disable multithreading support." 1860 bool "Disable multithreading support"
1836 help 1861 help
1837 Use this option if your workload can't take advantage of 1862 Use this option if your platform does not support the MT ASE
1838 MIPS hardware multithreading support. On systems that don't have 1863 which is hardware multithreading support. On systems without
1839 the option of an MT-enabled processor this option will be the only 1864 an MT-enabled processor, this will be the only option that is
1840 option in this menu. 1865 available in this menu.
1841 1866
1842config MIPS_MT_SMP 1867config MIPS_MT_SMP
1843 bool "Use 1 TC on each available VPE for SMP" 1868 bool "Use 1 TC on each available VPE for SMP"
1844 depends on SYS_SUPPORTS_MULTITHREADING 1869 depends on SYS_SUPPORTS_MULTITHREADING
1845 select CPU_MIPSR2_IRQ_VI 1870 select CPU_MIPSR2_IRQ_VI
1846 select CPU_MIPSR2_IRQ_EI 1871 select CPU_MIPSR2_IRQ_EI
1872 select SYNC_R4K
1847 select MIPS_MT 1873 select MIPS_MT
1848 select SMP 1874 select SMP
1849 select SYS_SUPPORTS_SCHED_SMT if SMP
1850 select SYS_SUPPORTS_SMP
1851 select SMP_UP 1875 select SMP_UP
1876 select SYS_SUPPORTS_SMP
1877 select SYS_SUPPORTS_SCHED_SMT
1852 select MIPS_PERF_SHARED_TC_COUNTERS 1878 select MIPS_PERF_SHARED_TC_COUNTERS
1853 help 1879 help
1854 This is a kernel model which is known a VSMP but lately has been 1880 This is a kernel model which is known as SMVP. This is supported
1855 marketesed into SMVP. 1881 on cores with the MT ASE and uses the available VPEs to implement
1856 Virtual SMP uses the processor's VPEs to implement virtual 1882 virtual processors which supports SMP. This is equivalent to the
1857 processors. In currently available configuration of the 34K processor 1883 Intel Hyperthreading feature. For further information go to
1858 this allows for a dual processor. Both processors will share the same 1884 <http://www.imgtec.com/mips/mips-multithreading.asp>.
1859 primary caches; each will obtain the half of the TLB for it's own
1860 exclusive use. For a layman this model can be described as similar to
1861 what Intel calls Hyperthreading.
1862
1863 For further information see http://www.linux-mips.org/wiki/34K#VSMP
1864 1885
1865config MIPS_MT_SMTC 1886config MIPS_MT_SMTC
1866 bool "SMTC: Use all TCs on all VPEs for SMP" 1887 bool "Use all TCs on all VPEs for SMP (DEPRECATED)"
1867 depends on CPU_MIPS32_R2 1888 depends on CPU_MIPS32_R2
1868 #depends on CPU_MIPS64_R2 # once there is hardware ...
1869 depends on SYS_SUPPORTS_MULTITHREADING 1889 depends on SYS_SUPPORTS_MULTITHREADING
1870 select CPU_MIPSR2_IRQ_VI 1890 select CPU_MIPSR2_IRQ_VI
1871 select CPU_MIPSR2_IRQ_EI 1891 select CPU_MIPSR2_IRQ_EI
1872 select MIPS_MT 1892 select MIPS_MT
1873 select NR_CPUS_DEFAULT_8
1874 select SMP 1893 select SMP
1875 select SYS_SUPPORTS_SMP
1876 select SMP_UP 1894 select SMP_UP
1895 select SYS_SUPPORTS_SMP
1896 select NR_CPUS_DEFAULT_8
1877 help 1897 help
1878 This is a kernel model which is known a SMTC or lately has been 1898 This is a kernel model which is known as SMTC. This is
1879 marketesed into SMVP. 1899 supported on cores with the MT ASE and presents all TCs
1880 is presenting the available TC's of the core as processors to Linux. 1900 available on all VPEs to support SMP. For further
1881 On currently available 34K processors this means a Linux system will 1901 information see <http://www.linux-mips.org/wiki/34K#SMTC>.
1882 see up to 5 processors. The implementation of the SMTC kernel differs
1883 significantly from VSMP and cannot efficiently coexist in the same
1884 kernel binary so the choice between VSMP and SMTC is a compile time
1885 decision.
1886
1887 For further information see http://www.linux-mips.org/wiki/34K#SMTC
1888 1902
1889endchoice 1903endchoice
1890 1904
@@ -1921,6 +1935,16 @@ config MIPS_VPE_LOADER
1921 Includes a loader for loading an elf relocatable object 1935 Includes a loader for loading an elf relocatable object
1922 onto another VPE and running it. 1936 onto another VPE and running it.
1923 1937
1938config MIPS_VPE_LOADER_CMP
1939 bool
1940 default "y"
1941 depends on MIPS_VPE_LOADER && MIPS_CMP
1942
1943config MIPS_VPE_LOADER_MT
1944 bool
1945 default "y"
1946 depends on MIPS_VPE_LOADER && !MIPS_CMP
1947
1924config MIPS_MT_SMTC_IM_BACKSTOP 1948config MIPS_MT_SMTC_IM_BACKSTOP
1925 bool "Use per-TC register bits as backstop for inhibited IM bits" 1949 bool "Use per-TC register bits as backstop for inhibited IM bits"
1926 depends on MIPS_MT_SMTC 1950 depends on MIPS_MT_SMTC
@@ -1954,24 +1978,29 @@ config MIPS_VPE_LOADER_TOM
1954 you to ensure the amount you put in the option and the space your 1978 you to ensure the amount you put in the option and the space your
1955 program requires is less or equal to the amount physically present. 1979 program requires is less or equal to the amount physically present.
1956 1980
1957# this should possibly be in drivers/char, but it is rather cpu related. Hmmm
1958config MIPS_VPE_APSP_API 1981config MIPS_VPE_APSP_API
1959 bool "Enable support for AP/SP API (RTLX)" 1982 bool "Enable support for AP/SP API (RTLX)"
1960 depends on MIPS_VPE_LOADER 1983 depends on MIPS_VPE_LOADER
1961 help 1984 help
1962 1985
1986config MIPS_VPE_APSP_API_CMP
1987 bool
1988 default "y"
1989 depends on MIPS_VPE_APSP_API && MIPS_CMP
1990
1991config MIPS_VPE_APSP_API_MT
1992 bool
1993 default "y"
1994 depends on MIPS_VPE_APSP_API && !MIPS_CMP
1995
1963config MIPS_CMP 1996config MIPS_CMP
1964 bool "MIPS CMP framework support" 1997 bool "MIPS CMP support"
1965 depends on SYS_SUPPORTS_MIPS_CMP 1998 depends on SYS_SUPPORTS_MIPS_CMP && MIPS_MT_SMP
1966 select SMP
1967 select SYNC_R4K 1999 select SYNC_R4K
1968 select SYS_SUPPORTS_SMP
1969 select SYS_SUPPORTS_SCHED_SMT if SMP
1970 select WEAK_ORDERING 2000 select WEAK_ORDERING
1971 default n 2001 default n
1972 help 2002 help
1973 This is a placeholder option for the GCMP work. It will need to 2003 Enable Coherency Manager processor (CMP) support.
1974 be handled differently...
1975 2004
1976config SB1_PASS_1_WORKAROUNDS 2005config SB1_PASS_1_WORKAROUNDS
1977 bool 2006 bool
@@ -2129,13 +2158,13 @@ config SMP
2129 depends on SYS_SUPPORTS_SMP 2158 depends on SYS_SUPPORTS_SMP
2130 help 2159 help
2131 This enables support for systems with more than one CPU. If you have 2160 This enables support for systems with more than one CPU. If you have
2132 a system with only one CPU, like most personal computers, say N. If 2161 a system with only one CPU, say N. If you have a system with more
2133 you have a system with more than one CPU, say Y. 2162 than one CPU, say Y.
2134 2163
2135 If you say N here, the kernel will run on single and multiprocessor 2164 If you say N here, the kernel will run on uni- and multiprocessor
2136 machines, but will use only one CPU of a multiprocessor machine. If 2165 machines, but will use only one CPU of a multiprocessor machine. If
2137 you say Y here, the kernel will run on many, but not all, 2166 you say Y here, the kernel will run on many, but not all,
2138 singleprocessor machines. On a singleprocessor machine, the kernel 2167 uniprocessor machines. On a uniprocessor machine, the kernel
2139 will run faster if you say N here. 2168 will run faster if you say N here.
2140 2169
2141 People using multiprocessor machines who say Y here should also say 2170 People using multiprocessor machines who say Y here should also say
@@ -2323,6 +2352,23 @@ config SECCOMP
2323 2352
2324 If unsure, say Y. Only embedded should say N here. 2353 If unsure, say Y. Only embedded should say N here.
2325 2354
2355config MIPS_O32_FP64_SUPPORT
2356 bool "Support for O32 binaries using 64-bit FP"
2357 depends on 32BIT || MIPS32_O32
2358 default y
2359 help
2360 When this is enabled, the kernel will support use of 64-bit floating
2361 point registers with binaries using the O32 ABI along with the
2362 EF_MIPS_FP64 ELF header flag (typically built with -mfp64). On
2363 32-bit MIPS systems this support is at the cost of increasing the
2364 size and complexity of the compiled FPU emulator. Thus if you are
2365 running a MIPS32 system and know that none of your userland binaries
2366 will require 64-bit floating point, you may wish to reduce the size
2367 of your kernel & potentially improve FP emulation performance by
2368 saying N here.
2369
2370 If unsure, say Y.
2371
2326config USE_OF 2372config USE_OF
2327 bool 2373 bool
2328 select OF 2374 select OF
@@ -2430,7 +2476,7 @@ source "drivers/pcmcia/Kconfig"
2430source "drivers/pci/hotplug/Kconfig" 2476source "drivers/pci/hotplug/Kconfig"
2431 2477
2432config RAPIDIO 2478config RAPIDIO
2433 bool "RapidIO support" 2479 tristate "RapidIO support"
2434 depends on PCI 2480 depends on PCI
2435 default n 2481 default n
2436 help 2482 help
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index efe50787cd89..9b8556de9993 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -114,7 +114,7 @@ cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*e
114cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) 114cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
115 115
116cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) 116cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips)
117cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips -mno-jals) 117cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips)
118 118
119cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ 119cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
120 -fno-omit-frame-pointer 120 -fno-omit-frame-pointer
diff --git a/arch/mips/alchemy/common/power.c b/arch/mips/alchemy/common/power.c
index 0c7fce2a3c12..bdb28dee8fdd 100644
--- a/arch/mips/alchemy/common/power.c
+++ b/arch/mips/alchemy/common/power.c
@@ -29,7 +29,6 @@
29 * 675 Mass Ave, Cambridge, MA 02139, USA. 29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */ 30 */
31 31
32#include <linux/init.h>
33#include <linux/pm.h> 32#include <linux/pm.h>
34#include <linux/sysctl.h> 33#include <linux/sysctl.h>
35#include <linux/jiffies.h> 34#include <linux/jiffies.h>
diff --git a/arch/mips/ar7/time.c b/arch/mips/ar7/time.c
index 22c93213b233..1dc6c3b37f91 100644
--- a/arch/mips/ar7/time.c
+++ b/arch/mips/ar7/time.c
@@ -18,7 +18,6 @@
18 * Setting up the clock on the MIPS boards. 18 * Setting up the clock on the MIPS boards.
19 */ 19 */
20 20
21#include <linux/init.h>
22#include <linux/time.h> 21#include <linux/time.h>
23#include <linux/err.h> 22#include <linux/err.h>
24#include <linux/clk.h> 23#include <linux/clk.h>
diff --git a/arch/mips/ath79/common.h b/arch/mips/ath79/common.h
index 648d2dafbc56..a3120714f0b7 100644
--- a/arch/mips/ath79/common.h
+++ b/arch/mips/ath79/common.h
@@ -15,7 +15,6 @@
15#define __ATH79_COMMON_H 15#define __ATH79_COMMON_H
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/init.h>
19 18
20#define ATH79_MEM_SIZE_MIN (2 * 1024 * 1024) 19#define ATH79_MEM_SIZE_MIN (2 * 1024 * 1024)
21#define ATH79_MEM_SIZE_MAX (128 * 1024 * 1024) 20#define ATH79_MEM_SIZE_MAX (128 * 1024 * 1024)
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
index 2b8b118398c4..09cb6f7aa3db 100644
--- a/arch/mips/bcm47xx/Kconfig
+++ b/arch/mips/bcm47xx/Kconfig
@@ -2,6 +2,7 @@ if BCM47XX
2 2
3config BCM47XX_SSB 3config BCM47XX_SSB
4 bool "SSB Support for Broadcom BCM47XX" 4 bool "SSB Support for Broadcom BCM47XX"
5 select SYS_HAS_CPU_BMIPS32_3300
5 select SSB 6 select SSB
6 select SSB_DRIVER_MIPS 7 select SSB_DRIVER_MIPS
7 select SSB_DRIVER_EXTIF 8 select SSB_DRIVER_EXTIF
@@ -11,6 +12,7 @@ config BCM47XX_SSB
11 select SSB_PCICORE_HOSTMODE if PCI 12 select SSB_PCICORE_HOSTMODE if PCI
12 select SSB_DRIVER_GPIO 13 select SSB_DRIVER_GPIO
13 select GPIOLIB 14 select GPIOLIB
15 select LEDS_GPIO_REGISTER
14 default y 16 default y
15 help 17 help
16 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support. 18 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -20,6 +22,7 @@ config BCM47XX_SSB
20config BCM47XX_BCMA 22config BCM47XX_BCMA
21 bool "BCMA Support for Broadcom BCM47XX" 23 bool "BCMA Support for Broadcom BCM47XX"
22 select SYS_HAS_CPU_MIPS32_R2 24 select SYS_HAS_CPU_MIPS32_R2
25 select CPU_MIPSR2_IRQ_VI
23 select BCMA 26 select BCMA
24 select BCMA_HOST_SOC 27 select BCMA_HOST_SOC
25 select BCMA_DRIVER_MIPS 28 select BCMA_DRIVER_MIPS
@@ -27,6 +30,7 @@ config BCM47XX_BCMA
27 select BCMA_DRIVER_PCI_HOSTMODE if PCI 30 select BCMA_DRIVER_PCI_HOSTMODE if PCI
28 select BCMA_DRIVER_GPIO 31 select BCMA_DRIVER_GPIO
29 select GPIOLIB 32 select GPIOLIB
33 select LEDS_GPIO_REGISTER
30 default y 34 default y
31 help 35 help
32 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus. 36 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile
index c52daf9b05c6..4688b6a6211b 100644
--- a/arch/mips/bcm47xx/Makefile
+++ b/arch/mips/bcm47xx/Makefile
@@ -4,5 +4,4 @@
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-y += board.o buttons.o leds.o
8obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
diff --git a/arch/mips/bcm47xx/bcm47xx_private.h b/arch/mips/bcm47xx/bcm47xx_private.h
new file mode 100644
index 000000000000..5c94acebf76a
--- /dev/null
+++ b/arch/mips/bcm47xx/bcm47xx_private.h
@@ -0,0 +1,12 @@
1#ifndef LINUX_BCM47XX_PRIVATE_H_
2#define LINUX_BCM47XX_PRIVATE_H_
3
4#include <linux/kernel.h>
5
6/* buttons.c */
7int __init bcm47xx_buttons_register(void);
8
9/* leds.c */
10void __init bcm47xx_leds_register(void);
11
12#endif
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
index f3f6bfe68a2a..6d612e2b949b 100644
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -36,26 +36,32 @@ static const
36struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = { 36struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = {
37 {{BCM47XX_BOARD_DLINK_DIR130, "D-Link DIR-130"}, "DIR-130"}, 37 {{BCM47XX_BOARD_DLINK_DIR130, "D-Link DIR-130"}, "DIR-130"},
38 {{BCM47XX_BOARD_DLINK_DIR330, "D-Link DIR-330"}, "DIR-330"}, 38 {{BCM47XX_BOARD_DLINK_DIR330, "D-Link DIR-330"}, "DIR-330"},
39 { {0}, 0}, 39 { {0}, NULL},
40}; 40};
41 41
42/* model_no */ 42/* model_no */
43static const 43static const
44struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = { 44struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = {
45 {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"}, 45 {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"},
46 { {0}, 0}, 46 { {0}, NULL},
47}; 47};
48 48
49/* machine_name */ 49/* machine_name */
50static const 50static const
51struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = { 51struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = {
52 {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"}, 52 {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"},
53 { {0}, 0}, 53 { {0}, NULL},
54}; 54};
55 55
56/* hardware_version */ 56/* hardware_version */
57static const 57static const
58struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = { 58struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
59 {{BCM47XX_BOARD_ASUS_RTN10U, "Asus RT-N10U"}, "RTN10U"},
60 {{BCM47XX_BOARD_ASUS_RTN12, "Asus RT-N12"}, "RT-N12"},
61 {{BCM47XX_BOARD_ASUS_RTN12B1, "Asus RT-N12B1"}, "RTN12B1"},
62 {{BCM47XX_BOARD_ASUS_RTN12C1, "Asus RT-N12C1"}, "RTN12C1"},
63 {{BCM47XX_BOARD_ASUS_RTN12D1, "Asus RT-N12D1"}, "RTN12D1"},
64 {{BCM47XX_BOARD_ASUS_RTN12HP, "Asus RT-N12HP"}, "RTN12HP"},
59 {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-"}, 65 {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-"},
60 {{BCM47XX_BOARD_ASUS_WL320GE, "Asus WL320GE"}, "WL320G-"}, 66 {{BCM47XX_BOARD_ASUS_WL320GE, "Asus WL320GE"}, "WL320G-"},
61 {{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-"}, 67 {{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-"},
@@ -66,7 +72,7 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initcons
66 {{BCM47XX_BOARD_ASUS_WL520GC, "Asus WL520GC"}, "WL520GC-"}, 72 {{BCM47XX_BOARD_ASUS_WL520GC, "Asus WL520GC"}, "WL520GC-"},
67 {{BCM47XX_BOARD_ASUS_WL520GU, "Asus WL520GU"}, "WL520GU-"}, 73 {{BCM47XX_BOARD_ASUS_WL520GU, "Asus WL520GU"}, "WL520GU-"},
68 {{BCM47XX_BOARD_BELKIN_F7D4301, "Belkin F7D4301"}, "F7D4301"}, 74 {{BCM47XX_BOARD_BELKIN_F7D4301, "Belkin F7D4301"}, "F7D4301"},
69 { {0}, 0}, 75 { {0}, NULL},
70}; 76};
71 77
72/* productid */ 78/* productid */
@@ -75,19 +81,13 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_productid[] __initconst = {
75 {{BCM47XX_BOARD_ASUS_RTAC66U, "Asus RT-AC66U"}, "RT-AC66U"}, 81 {{BCM47XX_BOARD_ASUS_RTAC66U, "Asus RT-AC66U"}, "RT-AC66U"},
76 {{BCM47XX_BOARD_ASUS_RTN10, "Asus RT-N10"}, "RT-N10"}, 82 {{BCM47XX_BOARD_ASUS_RTN10, "Asus RT-N10"}, "RT-N10"},
77 {{BCM47XX_BOARD_ASUS_RTN10D, "Asus RT-N10D"}, "RT-N10D"}, 83 {{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"}, 84 {{BCM47XX_BOARD_ASUS_RTN15U, "Asus RT-N15U"}, "RT-N15U"},
85 {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16"}, 85 {{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16"},
86 {{BCM47XX_BOARD_ASUS_RTN53, "Asus RT-N53"}, "RT-N53"}, 86 {{BCM47XX_BOARD_ASUS_RTN53, "Asus RT-N53"}, "RT-N53"},
87 {{BCM47XX_BOARD_ASUS_RTN66U, "Asus RT-N66U"}, "RT-N66U"}, 87 {{BCM47XX_BOARD_ASUS_RTN66U, "Asus RT-N66U"}, "RT-N66U"},
88 {{BCM47XX_BOARD_ASUS_WL300G, "Asus WL300G"}, "WL300g"}, 88 {{BCM47XX_BOARD_ASUS_WL300G, "Asus WL300G"}, "WL300g"},
89 {{BCM47XX_BOARD_ASUS_WLHDD, "Asus WLHDD"}, "WLHDD"}, 89 {{BCM47XX_BOARD_ASUS_WLHDD, "Asus WLHDD"}, "WLHDD"},
90 { {0}, 0}, 90 { {0}, NULL},
91}; 91};
92 92
93/* ModelId */ 93/* ModelId */
@@ -97,7 +97,7 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_ModelId[] __initconst = {
97 {{BCM47XX_BOARD_MOTOROLA_WE800G, "Motorola WE800G"}, "WE800G"}, 97 {{BCM47XX_BOARD_MOTOROLA_WE800G, "Motorola WE800G"}, "WE800G"},
98 {{BCM47XX_BOARD_MOTOROLA_WR850GP, "Motorola WR850GP"}, "WR850GP"}, 98 {{BCM47XX_BOARD_MOTOROLA_WR850GP, "Motorola WR850GP"}, "WR850GP"},
99 {{BCM47XX_BOARD_MOTOROLA_WR850GV2V3, "Motorola WR850G"}, "WR850G"}, 99 {{BCM47XX_BOARD_MOTOROLA_WR850GV2V3, "Motorola WR850G"}, "WR850G"},
100 { {0}, 0}, 100 { {0}, NULL},
101}; 101};
102 102
103/* melco_id or buf1falo_id */ 103/* melco_id or buf1falo_id */
@@ -112,7 +112,7 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_melco_id[] __initconst = {
112 {{BCM47XX_BOARD_BUFFALO_WZR_G300N, "Buffalo WZR-G300N"}, "31120"}, 112 {{BCM47XX_BOARD_BUFFALO_WZR_G300N, "Buffalo WZR-G300N"}, "31120"},
113 {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54, "Buffalo WZR-RS-G54"}, "30083"}, 113 {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54, "Buffalo WZR-RS-G54"}, "30083"},
114 {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP, "Buffalo WZR-RS-G54HP"}, "30103"}, 114 {{BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP, "Buffalo WZR-RS-G54HP"}, "30103"},
115 { {0}, 0}, 115 { {0}, NULL},
116}; 116};
117 117
118/* boot_hw_model, boot_hw_ver */ 118/* boot_hw_model, boot_hw_ver */
@@ -143,7 +143,7 @@ struct bcm47xx_board_type_list2 bcm47xx_board_list_boot_hw[] __initconst = {
143 {{BCM47XX_BOARD_LINKSYS_WRT54G3GV2, "Linksys WRT54G3GV2-VF"}, "WRT54G3GV2-VF", "1.0"}, 143 {{BCM47XX_BOARD_LINKSYS_WRT54G3GV2, "Linksys WRT54G3GV2-VF"}, "WRT54G3GV2-VF", "1.0"},
144 {{BCM47XX_BOARD_LINKSYS_WRT610NV1, "Linksys WRT610N V1"}, "WRT610N", "1.0"}, 144 {{BCM47XX_BOARD_LINKSYS_WRT610NV1, "Linksys WRT610N V1"}, "WRT610N", "1.0"},
145 {{BCM47XX_BOARD_LINKSYS_WRT610NV2, "Linksys WRT610N V2"}, "WRT610N", "2.0"}, 145 {{BCM47XX_BOARD_LINKSYS_WRT610NV2, "Linksys WRT610N V2"}, "WRT610N", "2.0"},
146 { {0}, 0}, 146 { {0}, NULL},
147}; 147};
148 148
149/* board_id */ 149/* board_id */
@@ -165,7 +165,7 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
165 {{BCM47XX_BOARD_NETGEAR_WNR3500V2, "Netgear WNR3500 V2"}, "U12H127T00_NETGEAR"}, 165 {{BCM47XX_BOARD_NETGEAR_WNR3500V2, "Netgear WNR3500 V2"}, "U12H127T00_NETGEAR"},
166 {{BCM47XX_BOARD_NETGEAR_WNR3500V2VC, "Netgear WNR3500 V2vc"}, "U12H127T70_NETGEAR"}, 166 {{BCM47XX_BOARD_NETGEAR_WNR3500V2VC, "Netgear WNR3500 V2vc"}, "U12H127T70_NETGEAR"},
167 {{BCM47XX_BOARD_NETGEAR_WNR834BV2, "Netgear WNR834B V2"}, "U12H081T00_NETGEAR"}, 167 {{BCM47XX_BOARD_NETGEAR_WNR834BV2, "Netgear WNR834B V2"}, "U12H081T00_NETGEAR"},
168 { {0}, 0}, 168 { {0}, NULL},
169}; 169};
170 170
171/* boardtype, boardnum, boardrev */ 171/* boardtype, boardnum, boardrev */
@@ -174,7 +174,9 @@ struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] __initconst = {
174 {{BCM47XX_BOARD_HUAWEI_E970, "Huawei E970"}, "0x048e", "0x5347", "0x11"}, 174 {{BCM47XX_BOARD_HUAWEI_E970, "Huawei E970"}, "0x048e", "0x5347", "0x11"},
175 {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"}, 175 {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"},
176 {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"}, 176 {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"},
177 { {0}, 0}, 177 {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "0x04CF", "3500", "02"},
178 {{BCM47XX_BOARD_LINKSYS_WRT54GSV1, "Linksys WRT54GS V1"}, "0x0101", "42", "0x10"},
179 { {0}, NULL},
178}; 180};
179 181
180static const 182static const
diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c
new file mode 100644
index 000000000000..872c62e93e0e
--- /dev/null
+++ b/arch/mips/bcm47xx/buttons.c
@@ -0,0 +1,531 @@
1#include "bcm47xx_private.h"
2
3#include <linux/input.h>
4#include <linux/gpio_keys.h>
5#include <linux/interrupt.h>
6#include <bcm47xx_board.h>
7#include <bcm47xx.h>
8
9/**************************************************
10 * Database
11 **************************************************/
12
13#define BCM47XX_GPIO_KEY(_gpio, _code) \
14 { \
15 .code = _code, \
16 .gpio = _gpio, \
17 .active_low = 1, \
18 }
19
20/* Asus */
21
22static const struct gpio_keys_button
23bcm47xx_buttons_asus_rtn12[] __initconst = {
24 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
25 BCM47XX_GPIO_KEY(1, KEY_RESTART),
26 BCM47XX_GPIO_KEY(4, BTN_0), /* Router mode */
27 BCM47XX_GPIO_KEY(5, BTN_1), /* Repeater mode */
28 BCM47XX_GPIO_KEY(6, BTN_2), /* AP mode */
29};
30
31static const struct gpio_keys_button
32bcm47xx_buttons_asus_rtn16[] __initconst = {
33 BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
34 BCM47XX_GPIO_KEY(8, KEY_RESTART),
35};
36
37static const struct gpio_keys_button
38bcm47xx_buttons_asus_rtn66u[] __initconst = {
39 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
40 BCM47XX_GPIO_KEY(9, KEY_RESTART),
41};
42
43static const struct gpio_keys_button
44bcm47xx_buttons_asus_wl300g[] __initconst = {
45 BCM47XX_GPIO_KEY(6, KEY_RESTART),
46};
47
48static const struct gpio_keys_button
49bcm47xx_buttons_asus_wl320ge[] __initconst = {
50 BCM47XX_GPIO_KEY(6, KEY_RESTART),
51};
52
53static const struct gpio_keys_button
54bcm47xx_buttons_asus_wl330ge[] __initconst = {
55 BCM47XX_GPIO_KEY(2, KEY_RESTART),
56};
57
58static const struct gpio_keys_button
59bcm47xx_buttons_asus_wl500gd[] __initconst = {
60 BCM47XX_GPIO_KEY(6, KEY_RESTART),
61};
62
63static const struct gpio_keys_button
64bcm47xx_buttons_asus_wl500gpv1[] __initconst = {
65 BCM47XX_GPIO_KEY(0, KEY_RESTART),
66 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
67};
68
69static const struct gpio_keys_button
70bcm47xx_buttons_asus_wl500gpv2[] __initconst = {
71 BCM47XX_GPIO_KEY(2, KEY_RESTART),
72 BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
73};
74
75static const struct gpio_keys_button
76bcm47xx_buttons_asus_wl500w[] __initconst = {
77 BCM47XX_GPIO_KEY(6, KEY_RESTART),
78 BCM47XX_GPIO_KEY(7, KEY_WPS_BUTTON),
79};
80
81static const struct gpio_keys_button
82bcm47xx_buttons_asus_wl520gc[] __initconst = {
83 BCM47XX_GPIO_KEY(2, KEY_RESTART),
84 BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
85};
86
87static const struct gpio_keys_button
88bcm47xx_buttons_asus_wl520gu[] __initconst = {
89 BCM47XX_GPIO_KEY(2, KEY_RESTART),
90 BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
91};
92
93static const struct gpio_keys_button
94bcm47xx_buttons_asus_wl700ge[] __initconst = {
95 BCM47XX_GPIO_KEY(0, KEY_POWER), /* Hard disk power switch */
96 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), /* EZSetup */
97 BCM47XX_GPIO_KEY(6, KEY_COPY), /* Copy data from USB to internal disk */
98 BCM47XX_GPIO_KEY(7, KEY_RESTART), /* Hard reset */
99};
100
101static const struct gpio_keys_button
102bcm47xx_buttons_asus_wlhdd[] __initconst = {
103 BCM47XX_GPIO_KEY(6, KEY_RESTART),
104};
105
106/* Huawei */
107
108static const struct gpio_keys_button
109bcm47xx_buttons_huawei_e970[] __initconst = {
110 BCM47XX_GPIO_KEY(6, KEY_RESTART),
111};
112
113/* Belkin */
114
115static const struct gpio_keys_button
116bcm47xx_buttons_belkin_f7d4301[] __initconst = {
117 BCM47XX_GPIO_KEY(6, KEY_RESTART),
118 BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
119};
120
121/* Buffalo */
122
123static const struct gpio_keys_button
124bcm47xx_buttons_buffalo_whr2_a54g54[] __initconst = {
125 BCM47XX_GPIO_KEY(4, KEY_RESTART),
126};
127
128static const struct gpio_keys_button
129bcm47xx_buttons_buffalo_whr_g125[] __initconst = {
130 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
131 BCM47XX_GPIO_KEY(4, KEY_RESTART),
132 BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */
133};
134
135static const struct gpio_keys_button
136bcm47xx_buttons_buffalo_whr_g54s[] __initconst = {
137 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
138 BCM47XX_GPIO_KEY(4, KEY_RESTART),
139 BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */
140};
141
142static const struct gpio_keys_button
143bcm47xx_buttons_buffalo_whr_hp_g54[] __initconst = {
144 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
145 BCM47XX_GPIO_KEY(4, KEY_RESTART),
146 BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */
147};
148
149static const struct gpio_keys_button
150bcm47xx_buttons_buffalo_wzr_g300n[] __initconst = {
151 BCM47XX_GPIO_KEY(4, KEY_RESTART),
152};
153
154static const struct gpio_keys_button
155bcm47xx_buttons_buffalo_wzr_rs_g54[] __initconst = {
156 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
157 BCM47XX_GPIO_KEY(4, KEY_RESTART),
158};
159
160static const struct gpio_keys_button
161bcm47xx_buttons_buffalo_wzr_rs_g54hp[] __initconst = {
162 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
163 BCM47XX_GPIO_KEY(4, KEY_RESTART),
164};
165
166/* Dell */
167
168static const struct gpio_keys_button
169bcm47xx_buttons_dell_tm2300[] __initconst = {
170 BCM47XX_GPIO_KEY(0, KEY_RESTART),
171};
172
173/* D-Link */
174
175static const struct gpio_keys_button
176bcm47xx_buttons_dlink_dir130[] __initconst = {
177 BCM47XX_GPIO_KEY(3, KEY_RESTART),
178 BCM47XX_GPIO_KEY(7, KEY_UNKNOWN),
179};
180
181static const struct gpio_keys_button
182bcm47xx_buttons_dlink_dir330[] __initconst = {
183 BCM47XX_GPIO_KEY(3, KEY_RESTART),
184 BCM47XX_GPIO_KEY(7, KEY_UNKNOWN),
185};
186
187/* Linksys */
188
189static const struct gpio_keys_button
190bcm47xx_buttons_linksys_e1000v1[] __initconst = {
191 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
192 BCM47XX_GPIO_KEY(6, KEY_RESTART),
193};
194
195static const struct gpio_keys_button
196bcm47xx_buttons_linksys_e1000v21[] __initconst = {
197 BCM47XX_GPIO_KEY(9, KEY_WPS_BUTTON),
198 BCM47XX_GPIO_KEY(10, KEY_RESTART),
199};
200
201static const struct gpio_keys_button
202bcm47xx_buttons_linksys_e2000v1[] __initconst = {
203 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
204 BCM47XX_GPIO_KEY(8, KEY_RESTART),
205};
206
207static const struct gpio_keys_button
208bcm47xx_buttons_linksys_e3000v1[] __initconst = {
209 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
210 BCM47XX_GPIO_KEY(6, KEY_RESTART),
211};
212
213static const struct gpio_keys_button
214bcm47xx_buttons_linksys_e3200v1[] __initconst = {
215 BCM47XX_GPIO_KEY(5, KEY_RESTART),
216 BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
217};
218
219static const struct gpio_keys_button
220bcm47xx_buttons_linksys_e4200v1[] __initconst = {
221 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
222 BCM47XX_GPIO_KEY(6, KEY_RESTART),
223};
224
225static const struct gpio_keys_button
226bcm47xx_buttons_linksys_wrt150nv1[] __initconst = {
227 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
228 BCM47XX_GPIO_KEY(6, KEY_RESTART),
229};
230
231static const struct gpio_keys_button
232bcm47xx_buttons_linksys_wrt150nv11[] __initconst = {
233 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
234 BCM47XX_GPIO_KEY(6, KEY_RESTART),
235};
236
237static const struct gpio_keys_button
238bcm47xx_buttons_linksys_wrt160nv1[] __initconst = {
239 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
240 BCM47XX_GPIO_KEY(6, KEY_RESTART),
241};
242
243static const struct gpio_keys_button
244bcm47xx_buttons_linksys_wrt160nv3[] __initconst = {
245 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
246 BCM47XX_GPIO_KEY(6, KEY_RESTART),
247};
248
249static const struct gpio_keys_button
250bcm47xx_buttons_linksys_wrt300nv11[] __initconst = {
251 BCM47XX_GPIO_KEY(4, KEY_UNKNOWN),
252 BCM47XX_GPIO_KEY(6, KEY_RESTART),
253};
254
255static const struct gpio_keys_button
256bcm47xx_buttons_linksys_wrt310nv1[] __initconst = {
257 BCM47XX_GPIO_KEY(6, KEY_RESTART),
258 BCM47XX_GPIO_KEY(8, KEY_UNKNOWN),
259};
260
261static const struct gpio_keys_button
262bcm47xx_buttons_linksys_wrt610nv1[] __initconst = {
263 BCM47XX_GPIO_KEY(6, KEY_RESTART),
264 BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
265};
266
267static const struct gpio_keys_button
268bcm47xx_buttons_linksys_wrt610nv2[] __initconst = {
269 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
270 BCM47XX_GPIO_KEY(6, KEY_RESTART),
271};
272
273/* Motorola */
274
275static const struct gpio_keys_button
276bcm47xx_buttons_motorola_we800g[] __initconst = {
277 BCM47XX_GPIO_KEY(0, KEY_RESTART),
278};
279
280static const struct gpio_keys_button
281bcm47xx_buttons_motorola_wr850gp[] __initconst = {
282 BCM47XX_GPIO_KEY(5, KEY_RESTART),
283};
284
285static const struct gpio_keys_button
286bcm47xx_buttons_motorola_wr850gv2v3[] __initconst = {
287 BCM47XX_GPIO_KEY(5, KEY_RESTART),
288};
289
290/* Netgear */
291
292static const struct gpio_keys_button
293bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
294 BCM47XX_GPIO_KEY(4, KEY_RESTART),
295 BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
296 BCM47XX_GPIO_KEY(8, KEY_RFKILL),
297};
298
299static const struct gpio_keys_button
300bcm47xx_buttons_netgear_wndr3700v3[] __initconst = {
301 BCM47XX_GPIO_KEY(2, KEY_RFKILL),
302 BCM47XX_GPIO_KEY(3, KEY_RESTART),
303 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
304};
305
306static const struct gpio_keys_button
307bcm47xx_buttons_netgear_wndr4500v1[] __initconst = {
308 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
309 BCM47XX_GPIO_KEY(5, KEY_RFKILL),
310 BCM47XX_GPIO_KEY(6, KEY_RESTART),
311};
312
313static const struct gpio_keys_button
314bcm47xx_buttons_netgear_wnr834bv2[] __initconst = {
315 BCM47XX_GPIO_KEY(6, KEY_RESTART),
316};
317
318/* SimpleTech */
319
320static const struct gpio_keys_button
321bcm47xx_buttons_simpletech_simpleshare[] __initconst = {
322 BCM47XX_GPIO_KEY(0, KEY_RESTART),
323};
324
325/**************************************************
326 * Init
327 **************************************************/
328
329static struct gpio_keys_platform_data bcm47xx_button_pdata;
330
331static struct platform_device bcm47xx_buttons_gpio_keys = {
332 .name = "gpio-keys",
333 .dev = {
334 .platform_data = &bcm47xx_button_pdata,
335 }
336};
337
338/* Copy data from __initconst */
339static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons,
340 size_t nbuttons)
341{
342 size_t size = nbuttons * sizeof(*buttons);
343
344 bcm47xx_button_pdata.buttons = kmalloc(size, GFP_KERNEL);
345 if (!bcm47xx_button_pdata.buttons)
346 return -ENOMEM;
347 memcpy(bcm47xx_button_pdata.buttons, buttons, size);
348 bcm47xx_button_pdata.nbuttons = nbuttons;
349
350 return 0;
351}
352
353#define bcm47xx_copy_bdata(dev_buttons) \
354 bcm47xx_buttons_copy(dev_buttons, ARRAY_SIZE(dev_buttons));
355
356int __init bcm47xx_buttons_register(void)
357{
358 enum bcm47xx_board board = bcm47xx_board_get();
359 int err;
360
361 switch (board) {
362 case BCM47XX_BOARD_ASUS_RTN12:
363 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
364 break;
365 case BCM47XX_BOARD_ASUS_RTN16:
366 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn16);
367 break;
368 case BCM47XX_BOARD_ASUS_RTN66U:
369 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn66u);
370 break;
371 case BCM47XX_BOARD_ASUS_WL300G:
372 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl300g);
373 break;
374 case BCM47XX_BOARD_ASUS_WL320GE:
375 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl320ge);
376 break;
377 case BCM47XX_BOARD_ASUS_WL330GE:
378 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
379 break;
380 case BCM47XX_BOARD_ASUS_WL500GD:
381 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
382 break;
383 case BCM47XX_BOARD_ASUS_WL500GPV1:
384 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv1);
385 break;
386 case BCM47XX_BOARD_ASUS_WL500GPV2:
387 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv2);
388 break;
389 case BCM47XX_BOARD_ASUS_WL500W:
390 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500w);
391 break;
392 case BCM47XX_BOARD_ASUS_WL520GC:
393 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gc);
394 break;
395 case BCM47XX_BOARD_ASUS_WL520GU:
396 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gu);
397 break;
398 case BCM47XX_BOARD_ASUS_WL700GE:
399 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl700ge);
400 break;
401 case BCM47XX_BOARD_ASUS_WLHDD:
402 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wlhdd);
403 break;
404
405 case BCM47XX_BOARD_BELKIN_F7D4301:
406 err = bcm47xx_copy_bdata(bcm47xx_buttons_belkin_f7d4301);
407 break;
408
409 case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
410 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr2_a54g54);
411 break;
412 case BCM47XX_BOARD_BUFFALO_WHR_G125:
413 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g125);
414 break;
415 case BCM47XX_BOARD_BUFFALO_WHR_G54S:
416 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g54s);
417 break;
418 case BCM47XX_BOARD_BUFFALO_WHR_HP_G54:
419 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_hp_g54);
420 break;
421 case BCM47XX_BOARD_BUFFALO_WZR_G300N:
422 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_g300n);
423 break;
424 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54:
425 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54);
426 break;
427 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP:
428 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp);
429 break;
430
431 case BCM47XX_BOARD_DELL_TM2300:
432 err = bcm47xx_copy_bdata(bcm47xx_buttons_dell_tm2300);
433 break;
434
435 case BCM47XX_BOARD_DLINK_DIR130:
436 err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130);
437 break;
438 case BCM47XX_BOARD_DLINK_DIR330:
439 err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330);
440 break;
441
442 case BCM47XX_BOARD_HUAWEI_E970:
443 err = bcm47xx_copy_bdata(bcm47xx_buttons_huawei_e970);
444 break;
445
446 case BCM47XX_BOARD_LINKSYS_E1000V1:
447 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v1);
448 break;
449 case BCM47XX_BOARD_LINKSYS_E1000V21:
450 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v21);
451 break;
452 case BCM47XX_BOARD_LINKSYS_E2000V1:
453 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2000v1);
454 break;
455 case BCM47XX_BOARD_LINKSYS_E3000V1:
456 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3000v1);
457 break;
458 case BCM47XX_BOARD_LINKSYS_E3200V1:
459 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3200v1);
460 break;
461 case BCM47XX_BOARD_LINKSYS_E4200V1:
462 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e4200v1);
463 break;
464 case BCM47XX_BOARD_LINKSYS_WRT150NV1:
465 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv1);
466 break;
467 case BCM47XX_BOARD_LINKSYS_WRT150NV11:
468 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv11);
469 break;
470 case BCM47XX_BOARD_LINKSYS_WRT160NV1:
471 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv1);
472 break;
473 case BCM47XX_BOARD_LINKSYS_WRT160NV3:
474 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3);
475 break;
476 case BCM47XX_BOARD_LINKSYS_WRT300NV11:
477 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11);
478 break;
479 case BCM47XX_BOARD_LINKSYS_WRT310NV1:
480 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
481 break;
482 case BCM47XX_BOARD_LINKSYS_WRT610NV1:
483 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1);
484 break;
485 case BCM47XX_BOARD_LINKSYS_WRT610NV2:
486 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv2);
487 break;
488
489 case BCM47XX_BOARD_MOTOROLA_WE800G:
490 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
491 break;
492 case BCM47XX_BOARD_MOTOROLA_WR850GP:
493 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gp);
494 break;
495 case BCM47XX_BOARD_MOTOROLA_WR850GV2V3:
496 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
497 break;
498
499 case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
500 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
501 break;
502 case BCM47XX_BOARD_NETGEAR_WNDR3700V3:
503 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3);
504 break;
505 case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
506 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
507 break;
508 case BCM47XX_BOARD_NETGEAR_WNR834BV2:
509 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2);
510 break;
511
512 case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
513 err = bcm47xx_copy_bdata(bcm47xx_buttons_simpletech_simpleshare);
514 break;
515
516 default:
517 pr_debug("No buttons configuration found for this device\n");
518 return -ENOTSUPP;
519 }
520
521 if (err)
522 return -ENOMEM;
523
524 err = platform_device_register(&bcm47xx_buttons_gpio_keys);
525 if (err) {
526 pr_err("Failed to register platform device: %d\n", err);
527 return err;
528 }
529
530 return 0;
531}
diff --git a/arch/mips/bcm47xx/irq.c b/arch/mips/bcm47xx/irq.c
index 8cf3833b2d29..e0585b76ec19 100644
--- a/arch/mips/bcm47xx/irq.c
+++ b/arch/mips/bcm47xx/irq.c
@@ -25,10 +25,11 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <asm/setup.h>
28#include <asm/irq_cpu.h> 29#include <asm/irq_cpu.h>
29#include <bcm47xx.h> 30#include <bcm47xx.h>
30 31
31void plat_irq_dispatch(void) 32asmlinkage void plat_irq_dispatch(void)
32{ 33{
33 u32 cause; 34 u32 cause;
34 35
@@ -50,6 +51,18 @@ void plat_irq_dispatch(void)
50 do_IRQ(6); 51 do_IRQ(6);
51} 52}
52 53
54#define DEFINE_HWx_IRQDISPATCH(x) \
55 static void bcm47xx_hw ## x ## _irqdispatch(void) \
56 { \
57 do_IRQ(x); \
58 }
59DEFINE_HWx_IRQDISPATCH(2)
60DEFINE_HWx_IRQDISPATCH(3)
61DEFINE_HWx_IRQDISPATCH(4)
62DEFINE_HWx_IRQDISPATCH(5)
63DEFINE_HWx_IRQDISPATCH(6)
64DEFINE_HWx_IRQDISPATCH(7)
65
53void __init arch_init_irq(void) 66void __init arch_init_irq(void)
54{ 67{
55#ifdef CONFIG_BCM47XX_BCMA 68#ifdef CONFIG_BCM47XX_BCMA
@@ -64,4 +77,14 @@ void __init arch_init_irq(void)
64 } 77 }
65#endif 78#endif
66 mips_cpu_irq_init(); 79 mips_cpu_irq_init();
80
81 if (cpu_has_vint) {
82 pr_info("Setting up vectored interrupts\n");
83 set_vi_handler(2, bcm47xx_hw2_irqdispatch);
84 set_vi_handler(3, bcm47xx_hw3_irqdispatch);
85 set_vi_handler(4, bcm47xx_hw4_irqdispatch);
86 set_vi_handler(5, bcm47xx_hw5_irqdispatch);
87 set_vi_handler(6, bcm47xx_hw6_irqdispatch);
88 set_vi_handler(7, bcm47xx_hw7_irqdispatch);
89 }
67} 90}
diff --git a/arch/mips/bcm47xx/leds.c b/arch/mips/bcm47xx/leds.c
new file mode 100644
index 000000000000..647d15527066
--- /dev/null
+++ b/arch/mips/bcm47xx/leds.c
@@ -0,0 +1,542 @@
1#include "bcm47xx_private.h"
2
3#include <linux/leds.h>
4#include <bcm47xx_board.h>
5
6/**************************************************
7 * Database
8 **************************************************/
9
10#define BCM47XX_GPIO_LED(_gpio, _color, _function, _active_low, \
11 _default_state) \
12 { \
13 .name = "bcm47xx:" _color ":" _function, \
14 .gpio = _gpio, \
15 .active_low = _active_low, \
16 .default_state = _default_state, \
17 }
18
19#define BCM47XX_GPIO_LED_TRIGGER(_gpio, _color, _function, _active_low, \
20 _default_trigger) \
21 { \
22 .name = "bcm47xx:" _color ":" _function, \
23 .gpio = _gpio, \
24 .active_low = _active_low, \
25 .default_state = LEDS_GPIO_DEFSTATE_OFF, \
26 .default_trigger = _default_trigger, \
27 }
28
29/* Asus */
30
31static const struct gpio_led
32bcm47xx_leds_asus_rtn12[] __initconst = {
33 BCM47XX_GPIO_LED(2, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
34 BCM47XX_GPIO_LED(7, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
35};
36
37static const struct gpio_led
38bcm47xx_leds_asus_rtn16[] __initconst = {
39 BCM47XX_GPIO_LED(1, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
40 BCM47XX_GPIO_LED(7, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
41};
42
43static const struct gpio_led
44bcm47xx_leds_asus_rtn66u[] __initconst = {
45 BCM47XX_GPIO_LED(12, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
46 BCM47XX_GPIO_LED(15, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
47};
48
49static const struct gpio_led
50bcm47xx_leds_asus_wl300g[] __initconst = {
51 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
52};
53
54static const struct gpio_led
55bcm47xx_leds_asus_wl320ge[] __initconst = {
56 BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
57 BCM47XX_GPIO_LED(2, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
58 BCM47XX_GPIO_LED(11, "unk", "link", 1, LEDS_GPIO_DEFSTATE_OFF),
59};
60
61static const struct gpio_led
62bcm47xx_leds_asus_wl330ge[] __initconst = {
63 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
64};
65
66static const struct gpio_led
67bcm47xx_leds_asus_wl500gd[] __initconst = {
68 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
69};
70
71static const struct gpio_led
72bcm47xx_leds_asus_wl500gpv1[] __initconst = {
73 BCM47XX_GPIO_LED(1, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
74};
75
76static const struct gpio_led
77bcm47xx_leds_asus_wl500gpv2[] __initconst = {
78 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
79 BCM47XX_GPIO_LED(1, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
80};
81
82static const struct gpio_led
83bcm47xx_leds_asus_wl500w[] __initconst = {
84 BCM47XX_GPIO_LED(5, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
85};
86
87static const struct gpio_led
88bcm47xx_leds_asus_wl520gc[] __initconst = {
89 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
90 BCM47XX_GPIO_LED(1, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
91};
92
93static const struct gpio_led
94bcm47xx_leds_asus_wl520gu[] __initconst = {
95 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
96 BCM47XX_GPIO_LED(1, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
97};
98
99static const struct gpio_led
100bcm47xx_leds_asus_wl700ge[] __initconst = {
101 BCM47XX_GPIO_LED(1, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), /* Labeled "READY" (there is no "power" LED). Originally ON, flashing on USB activity. */
102};
103
104static const struct gpio_led
105bcm47xx_leds_asus_wlhdd[] __initconst = {
106 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
107 BCM47XX_GPIO_LED(2, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
108};
109
110/* Belkin */
111
112static const struct gpio_led
113bcm47xx_leds_belkin_f7d4301[] __initconst = {
114 BCM47XX_GPIO_LED(10, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON),
115 BCM47XX_GPIO_LED(11, "amber", "power", 1, LEDS_GPIO_DEFSTATE_OFF),
116 BCM47XX_GPIO_LED(12, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
117 BCM47XX_GPIO_LED(13, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
118 BCM47XX_GPIO_LED(14, "unk", "usb0", 1, LEDS_GPIO_DEFSTATE_OFF),
119 BCM47XX_GPIO_LED(15, "unk", "usb1", 1, LEDS_GPIO_DEFSTATE_OFF),
120};
121
122/* Buffalo */
123
124static const struct gpio_led
125bcm47xx_leds_buffalo_whr2_a54g54[] __initconst = {
126 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
127};
128
129static const struct gpio_led
130bcm47xx_leds_buffalo_whr_g125[] __initconst = {
131 BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
132 BCM47XX_GPIO_LED(2, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
133 BCM47XX_GPIO_LED(3, "unk", "internal", 1, LEDS_GPIO_DEFSTATE_OFF),
134 BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
135 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
136};
137
138static const struct gpio_led
139bcm47xx_leds_buffalo_whr_g54s[] __initconst = {
140 BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
141 BCM47XX_GPIO_LED(2, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
142 BCM47XX_GPIO_LED(3, "unk", "internal", 1, LEDS_GPIO_DEFSTATE_OFF),
143 BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
144 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
145};
146
147static const struct gpio_led
148bcm47xx_leds_buffalo_whr_hp_g54[] __initconst = {
149 BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
150 BCM47XX_GPIO_LED(2, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
151 BCM47XX_GPIO_LED(3, "unk", "internal", 1, LEDS_GPIO_DEFSTATE_OFF),
152 BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
153 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
154};
155
156static const struct gpio_led
157bcm47xx_leds_buffalo_wzr_g300n[] __initconst = {
158 BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
159 BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
160 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
161};
162
163static const struct gpio_led
164bcm47xx_leds_buffalo_wzr_rs_g54[] __initconst = {
165 BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
166 BCM47XX_GPIO_LED(1, "unk", "vpn", 1, LEDS_GPIO_DEFSTATE_OFF),
167 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
168};
169
170static const struct gpio_led
171bcm47xx_leds_buffalo_wzr_rs_g54hp[] __initconst = {
172 BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
173 BCM47XX_GPIO_LED(1, "unk", "vpn", 1, LEDS_GPIO_DEFSTATE_OFF),
174 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
175};
176
177/* Dell */
178
179static const struct gpio_led
180bcm47xx_leds_dell_tm2300[] __initconst = {
181 BCM47XX_GPIO_LED(6, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
182 BCM47XX_GPIO_LED(7, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
183};
184
185/* D-Link */
186
187static const struct gpio_led
188bcm47xx_leds_dlink_dir130[] __initconst = {
189 BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */
190 BCM47XX_GPIO_LED(6, "blue", "unk", 1, LEDS_GPIO_DEFSTATE_OFF),
191};
192
193static const struct gpio_led
194bcm47xx_leds_dlink_dir330[] __initconst = {
195 BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */
196 BCM47XX_GPIO_LED(4, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
197 BCM47XX_GPIO_LED(6, "blue", "unk", 1, LEDS_GPIO_DEFSTATE_OFF),
198};
199
200/* Huawei */
201
202static const struct gpio_led
203bcm47xx_leds_huawei_e970[] __initconst = {
204 BCM47XX_GPIO_LED(0, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
205};
206
207/* Linksys */
208
209static const struct gpio_led
210bcm47xx_leds_linksys_e1000v1[] __initconst = {
211 BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
212 BCM47XX_GPIO_LED(1, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON),
213 BCM47XX_GPIO_LED(2, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
214 BCM47XX_GPIO_LED(4, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
215};
216
217static const struct gpio_led
218bcm47xx_leds_linksys_e1000v21[] __initconst = {
219 BCM47XX_GPIO_LED(5, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
220 BCM47XX_GPIO_LED(6, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
221 BCM47XX_GPIO_LED(7, "amber", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
222 BCM47XX_GPIO_LED(8, "blue", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
223};
224
225static const struct gpio_led
226bcm47xx_leds_linksys_e2000v1[] __initconst = {
227 BCM47XX_GPIO_LED(1, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
228 BCM47XX_GPIO_LED(2, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON),
229 BCM47XX_GPIO_LED(3, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
230 BCM47XX_GPIO_LED(4, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
231};
232
233static const struct gpio_led
234bcm47xx_leds_linksys_e3000v1[] __initconst = {
235 BCM47XX_GPIO_LED(0, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
236 BCM47XX_GPIO_LED(1, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
237 BCM47XX_GPIO_LED(3, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
238 BCM47XX_GPIO_LED(5, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
239 BCM47XX_GPIO_LED(7, "unk", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
240};
241
242static const struct gpio_led
243bcm47xx_leds_linksys_e3200v1[] __initconst = {
244 BCM47XX_GPIO_LED(3, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON),
245};
246
247static const struct gpio_led
248bcm47xx_leds_linksys_e4200v1[] __initconst = {
249 BCM47XX_GPIO_LED(5, "white", "power", 1, LEDS_GPIO_DEFSTATE_ON),
250};
251
252static const struct gpio_led
253bcm47xx_leds_linksys_wrt150nv1[] __initconst = {
254 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
255 BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
256 BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
257};
258
259static const struct gpio_led
260bcm47xx_leds_linksys_wrt150nv11[] __initconst = {
261 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
262 BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
263 BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
264};
265
266static const struct gpio_led
267bcm47xx_leds_linksys_wrt160nv1[] __initconst = {
268 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
269 BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
270 BCM47XX_GPIO_LED(5, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
271};
272
273static const struct gpio_led
274bcm47xx_leds_linksys_wrt160nv3[] __initconst = {
275 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
276 BCM47XX_GPIO_LED(2, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
277 BCM47XX_GPIO_LED(4, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
278};
279
280static const struct gpio_led
281bcm47xx_leds_linksys_wrt300nv11[] __initconst = {
282 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
283 BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
284 BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
285};
286
287static const struct gpio_led
288bcm47xx_leds_linksys_wrt310nv1[] __initconst = {
289 BCM47XX_GPIO_LED(1, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON),
290 BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
291 BCM47XX_GPIO_LED(9, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
292};
293
294static const struct gpio_led
295bcm47xx_leds_linksys_wrt610nv1[] __initconst = {
296 BCM47XX_GPIO_LED(0, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
297 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
298 BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
299 BCM47XX_GPIO_LED(9, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
300};
301
302static const struct gpio_led
303bcm47xx_leds_linksys_wrt610nv2[] __initconst = {
304 BCM47XX_GPIO_LED(0, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
305 BCM47XX_GPIO_LED(1, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
306 BCM47XX_GPIO_LED(3, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
307 BCM47XX_GPIO_LED(5, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
308 BCM47XX_GPIO_LED(7, "unk", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
309};
310
311/* Motorola */
312
313static const struct gpio_led
314bcm47xx_leds_motorola_we800g[] __initconst = {
315 BCM47XX_GPIO_LED(1, "amber", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
316 BCM47XX_GPIO_LED(2, "unk", "unk", 1, LEDS_GPIO_DEFSTATE_OFF), /* There are only 3 LEDs: Power, Wireless and Device (ethernet) */
317 BCM47XX_GPIO_LED(4, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
318};
319
320static const struct gpio_led
321bcm47xx_leds_motorola_wr850gp[] __initconst = {
322 BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
323 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
324 BCM47XX_GPIO_LED(6, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
325 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
326};
327
328static const struct gpio_led
329bcm47xx_leds_motorola_wr850gv2v3[] __initconst = {
330 BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
331 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
332 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
333};
334
335/* Netgear */
336
337static const struct gpio_led
338bcm47xx_leds_netgear_wndr3400v1[] __initconst = {
339 BCM47XX_GPIO_LED(2, "green", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
340 BCM47XX_GPIO_LED(3, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
341 BCM47XX_GPIO_LED(7, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
342};
343
344static const struct gpio_led
345bcm47xx_leds_netgear_wndr4500v1[] __initconst = {
346 BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
347 BCM47XX_GPIO_LED(2, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON),
348 BCM47XX_GPIO_LED(3, "amber", "power", 1, LEDS_GPIO_DEFSTATE_OFF),
349 BCM47XX_GPIO_LED(8, "green", "usb1", 1, LEDS_GPIO_DEFSTATE_OFF),
350 BCM47XX_GPIO_LED(9, "green", "2ghz", 1, LEDS_GPIO_DEFSTATE_OFF),
351 BCM47XX_GPIO_LED(11, "blue", "5ghz", 1, LEDS_GPIO_DEFSTATE_OFF),
352 BCM47XX_GPIO_LED(14, "green", "usb2", 1, LEDS_GPIO_DEFSTATE_OFF),
353};
354
355static const struct gpio_led
356bcm47xx_leds_netgear_wnr834bv2[] __initconst = {
357 BCM47XX_GPIO_LED(2, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
358 BCM47XX_GPIO_LED(3, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
359 BCM47XX_GPIO_LED(7, "unk", "connected", 0, LEDS_GPIO_DEFSTATE_OFF),
360};
361
362/* SimpleTech */
363
364static const struct gpio_led
365bcm47xx_leds_simpletech_simpleshare[] __initconst = {
366 BCM47XX_GPIO_LED(1, "unk", "status", 1, LEDS_GPIO_DEFSTATE_OFF), /* "Ready" LED */
367};
368
369/**************************************************
370 * Init
371 **************************************************/
372
373static struct gpio_led_platform_data bcm47xx_leds_pdata;
374
375#define bcm47xx_set_pdata(dev_leds) do { \
376 bcm47xx_leds_pdata.leds = dev_leds; \
377 bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \
378} while (0)
379
380void __init bcm47xx_leds_register(void)
381{
382 enum bcm47xx_board board = bcm47xx_board_get();
383
384 switch (board) {
385 case BCM47XX_BOARD_ASUS_RTN12:
386 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12);
387 break;
388 case BCM47XX_BOARD_ASUS_RTN16:
389 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn16);
390 break;
391 case BCM47XX_BOARD_ASUS_RTN66U:
392 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn66u);
393 break;
394 case BCM47XX_BOARD_ASUS_WL300G:
395 bcm47xx_set_pdata(bcm47xx_leds_asus_wl300g);
396 break;
397 case BCM47XX_BOARD_ASUS_WL320GE:
398 bcm47xx_set_pdata(bcm47xx_leds_asus_wl320ge);
399 break;
400 case BCM47XX_BOARD_ASUS_WL330GE:
401 bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge);
402 break;
403 case BCM47XX_BOARD_ASUS_WL500GD:
404 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd);
405 break;
406 case BCM47XX_BOARD_ASUS_WL500GPV1:
407 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gpv1);
408 break;
409 case BCM47XX_BOARD_ASUS_WL500GPV2:
410 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gpv2);
411 break;
412 case BCM47XX_BOARD_ASUS_WL500W:
413 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500w);
414 break;
415 case BCM47XX_BOARD_ASUS_WL520GC:
416 bcm47xx_set_pdata(bcm47xx_leds_asus_wl520gc);
417 break;
418 case BCM47XX_BOARD_ASUS_WL520GU:
419 bcm47xx_set_pdata(bcm47xx_leds_asus_wl520gu);
420 break;
421 case BCM47XX_BOARD_ASUS_WL700GE:
422 bcm47xx_set_pdata(bcm47xx_leds_asus_wl700ge);
423 break;
424 case BCM47XX_BOARD_ASUS_WLHDD:
425 bcm47xx_set_pdata(bcm47xx_leds_asus_wlhdd);
426 break;
427
428 case BCM47XX_BOARD_BELKIN_F7D4301:
429 bcm47xx_set_pdata(bcm47xx_leds_belkin_f7d4301);
430 break;
431
432 case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
433 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr2_a54g54);
434 break;
435 case BCM47XX_BOARD_BUFFALO_WHR_G125:
436 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_g125);
437 break;
438 case BCM47XX_BOARD_BUFFALO_WHR_G54S:
439 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_g54s);
440 break;
441 case BCM47XX_BOARD_BUFFALO_WHR_HP_G54:
442 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_hp_g54);
443 break;
444 case BCM47XX_BOARD_BUFFALO_WZR_G300N:
445 bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_g300n);
446 break;
447 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54:
448 bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_rs_g54);
449 break;
450 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP:
451 bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_rs_g54hp);
452 break;
453
454 case BCM47XX_BOARD_DELL_TM2300:
455 bcm47xx_set_pdata(bcm47xx_leds_dell_tm2300);
456 break;
457
458 case BCM47XX_BOARD_DLINK_DIR130:
459 bcm47xx_set_pdata(bcm47xx_leds_dlink_dir130);
460 break;
461 case BCM47XX_BOARD_DLINK_DIR330:
462 bcm47xx_set_pdata(bcm47xx_leds_dlink_dir330);
463 break;
464
465 case BCM47XX_BOARD_HUAWEI_E970:
466 bcm47xx_set_pdata(bcm47xx_leds_huawei_e970);
467 break;
468
469 case BCM47XX_BOARD_LINKSYS_E1000V1:
470 bcm47xx_set_pdata(bcm47xx_leds_linksys_e1000v1);
471 break;
472 case BCM47XX_BOARD_LINKSYS_E1000V21:
473 bcm47xx_set_pdata(bcm47xx_leds_linksys_e1000v21);
474 break;
475 case BCM47XX_BOARD_LINKSYS_E2000V1:
476 bcm47xx_set_pdata(bcm47xx_leds_linksys_e2000v1);
477 break;
478 case BCM47XX_BOARD_LINKSYS_E3000V1:
479 bcm47xx_set_pdata(bcm47xx_leds_linksys_e3000v1);
480 break;
481 case BCM47XX_BOARD_LINKSYS_E3200V1:
482 bcm47xx_set_pdata(bcm47xx_leds_linksys_e3200v1);
483 break;
484 case BCM47XX_BOARD_LINKSYS_E4200V1:
485 bcm47xx_set_pdata(bcm47xx_leds_linksys_e4200v1);
486 break;
487 case BCM47XX_BOARD_LINKSYS_WRT150NV1:
488 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt150nv1);
489 break;
490 case BCM47XX_BOARD_LINKSYS_WRT150NV11:
491 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt150nv11);
492 break;
493 case BCM47XX_BOARD_LINKSYS_WRT160NV1:
494 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt160nv1);
495 break;
496 case BCM47XX_BOARD_LINKSYS_WRT160NV3:
497 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt160nv3);
498 break;
499 case BCM47XX_BOARD_LINKSYS_WRT300NV11:
500 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt300nv11);
501 break;
502 case BCM47XX_BOARD_LINKSYS_WRT310NV1:
503 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1);
504 break;
505 case BCM47XX_BOARD_LINKSYS_WRT610NV1:
506 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv1);
507 break;
508 case BCM47XX_BOARD_LINKSYS_WRT610NV2:
509 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv2);
510 break;
511
512 case BCM47XX_BOARD_MOTOROLA_WE800G:
513 bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g);
514 break;
515 case BCM47XX_BOARD_MOTOROLA_WR850GP:
516 bcm47xx_set_pdata(bcm47xx_leds_motorola_wr850gp);
517 break;
518 case BCM47XX_BOARD_MOTOROLA_WR850GV2V3:
519 bcm47xx_set_pdata(bcm47xx_leds_motorola_wr850gv2v3);
520 break;
521
522 case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
523 bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr3400v1);
524 break;
525 case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
526 bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1);
527 break;
528 case BCM47XX_BOARD_NETGEAR_WNR834BV2:
529 bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr834bv2);
530 break;
531
532 case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
533 bcm47xx_set_pdata(bcm47xx_leds_simpletech_simpleshare);
534 break;
535
536 default:
537 pr_debug("No LEDs configuration found for this device\n");
538 return;
539 }
540
541 gpio_led_register_device(-1, &bcm47xx_leds_pdata);
542}
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index b4c585b1c62e..6decb27cf48b 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -11,7 +11,6 @@
11 * option) any later version. 11 * option) any later version.
12 */ 12 */
13 13
14#include <linux/init.h>
15#include <linux/types.h> 14#include <linux/types.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/ssb/ssb.h> 16#include <linux/ssb/ssb.h>
@@ -22,11 +21,11 @@
22#include <asm/mach-bcm47xx/bcm47xx.h> 21#include <asm/mach-bcm47xx/bcm47xx.h>
23 22
24static char nvram_buf[NVRAM_SPACE]; 23static char nvram_buf[NVRAM_SPACE];
24static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
25 25
26static u32 find_nvram_size(u32 end) 26static u32 find_nvram_size(u32 end)
27{ 27{
28 struct nvram_header *header; 28 struct nvram_header *header;
29 u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
30 int i; 29 int i;
31 30
32 for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) { 31 for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index 5cba318bc1cd..0af808dfd1ca 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -28,126 +28,27 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <linux/ssb/ssb_driver_chipcommon.h>
32#include <linux/ssb/ssb_regs.h>
31#include <linux/smp.h> 33#include <linux/smp.h>
32#include <asm/bootinfo.h> 34#include <asm/bootinfo.h>
33#include <asm/fw/cfe/cfe_api.h>
34#include <asm/fw/cfe/cfe_error.h>
35#include <bcm47xx.h> 35#include <bcm47xx.h>
36#include <bcm47xx_board.h> 36#include <bcm47xx_board.h>
37 37
38static int cfe_cons_handle;
39 38
40static u16 get_chip_id(void) 39static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
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 40
55const char *get_system_type(void) 41const char *get_system_type(void)
56{ 42{
57 static char buf[50]; 43 return bcm47xx_system_type;
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;
66}
67
68void prom_putchar(char c)
69{
70 while (cfe_write(cfe_cons_handle, &c, 1) == 0)
71 ;
72} 44}
73 45
74static __init void prom_init_cfe(void) 46__init void bcm47xx_set_system_type(u16 chip_id)
75{ 47{
76 uint32_t cfe_ept; 48 snprintf(bcm47xx_system_type, sizeof(bcm47xx_system_type),
77 uint32_t cfe_handle; 49 (chip_id > 0x9999) ? "Broadcom BCM%d" :
78 uint32_t cfe_eptseal; 50 "Broadcom BCM%04X",
79 int argc = fw_arg0; 51 chip_id);
80 char **envp = (char **) fw_arg2;
81 int *prom_vec = (int *) fw_arg3;
82
83 /*
84 * Check if a loader was used; if NOT, the 4 arguments are
85 * what CFE gives us (handle, 0, EPT and EPTSEAL)
86 */
87 if (argc < 0) {
88 cfe_handle = (uint32_t)argc;
89 cfe_ept = (uint32_t)envp;
90 cfe_eptseal = (uint32_t)prom_vec;
91 } else {
92 if ((int)prom_vec < 0) {
93 /*
94 * Old loader; all it gives us is the handle,
95 * so use the "known" entrypoint and assume
96 * the seal.
97 */
98 cfe_handle = (uint32_t)prom_vec;
99 cfe_ept = 0xBFC00500;
100 cfe_eptseal = CFE_EPTSEAL;
101 } else {
102 /*
103 * Newer loaders bundle the handle/ept/eptseal
104 * Note: prom_vec is in the loader's useg
105 * which is still alive in the TLB.
106 */
107 cfe_handle = prom_vec[0];
108 cfe_ept = prom_vec[2];
109 cfe_eptseal = prom_vec[3];
110 }
111 }
112
113 if (cfe_eptseal != CFE_EPTSEAL) {
114 /* too early for panic to do any good */
115 printk(KERN_ERR "CFE's entrypoint seal doesn't match.");
116 while (1) ;
117 }
118
119 cfe_init(cfe_handle, cfe_ept);
120}
121
122static __init void prom_init_console(void)
123{
124 /* Initialize CFE console */
125 cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
126}
127
128static __init void prom_init_cmdline(void)
129{
130 static char buf[COMMAND_LINE_SIZE] __initdata;
131
132 /* Get the kernel command line from CFE */
133 if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) {
134 buf[COMMAND_LINE_SIZE - 1] = 0;
135 strcpy(arcs_cmdline, buf);
136 }
137
138 /* Force a console handover by adding a console= argument if needed,
139 * as CFE is not available anymore later in the boot process. */
140 if ((strstr(arcs_cmdline, "console=")) == NULL) {
141 /* Try to read the default serial port used by CFE */
142 if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0)
143 || (strncmp("uart", buf, 4)))
144 /* Default to uart0 */
145 strcpy(buf, "uart0");
146
147 /* Compute the new command line */
148 snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200",
149 arcs_cmdline, buf[4]);
150 }
151} 52}
152 53
153static __init void prom_init_mem(void) 54static __init void prom_init_mem(void)
@@ -195,12 +96,16 @@ static __init void prom_init_mem(void)
195 add_memory_region(0, mem, BOOT_MEM_RAM); 96 add_memory_region(0, mem, BOOT_MEM_RAM);
196} 97}
197 98
99/*
100 * This is the first serial on the chip common core, it is at this position
101 * for sb (ssb) and ai (bcma) bus.
102 */
103#define BCM47XX_SERIAL_ADDR (SSB_ENUM_BASE + SSB_CHIPCO_UART0_DATA)
104
198void __init prom_init(void) 105void __init prom_init(void)
199{ 106{
200 prom_init_cfe();
201 prom_init_console();
202 prom_init_cmdline();
203 prom_init_mem(); 107 prom_init_mem();
108 setup_8250_early_printk_port(CKSEG1ADDR(BCM47XX_SERIAL_ADDR), 0, 0);
204} 109}
205 110
206void __init prom_free_prom_memory(void) 111void __init prom_free_prom_memory(void)
diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
index b8ef965705cf..2f5bbd68e9a0 100644
--- a/arch/mips/bcm47xx/serial.c
+++ b/arch/mips/bcm47xx/serial.c
@@ -31,7 +31,8 @@ static int __init uart8250_init_ssb(void)
31 31
32 memset(&uart8250_data, 0, sizeof(uart8250_data)); 32 memset(&uart8250_data, 0, sizeof(uart8250_data));
33 33
34 for (i = 0; i < mcore->nr_serial_ports; i++) { 34 for (i = 0; i < mcore->nr_serial_ports &&
35 i < ARRAY_SIZE(uart8250_data) - 1; i++) {
35 struct plat_serial8250_port *p = &(uart8250_data[i]); 36 struct plat_serial8250_port *p = &(uart8250_data[i]);
36 struct ssb_serial_port *ssb_port = &(mcore->serial_ports[i]); 37 struct ssb_serial_port *ssb_port = &(mcore->serial_ports[i]);
37 38
@@ -55,7 +56,8 @@ static int __init uart8250_init_bcma(void)
55 56
56 memset(&uart8250_data, 0, sizeof(uart8250_data)); 57 memset(&uart8250_data, 0, sizeof(uart8250_data));
57 58
58 for (i = 0; i < cc->nr_serial_ports; i++) { 59 for (i = 0; i < cc->nr_serial_ports &&
60 i < ARRAY_SIZE(uart8250_data) - 1; i++) {
59 struct plat_serial8250_port *p = &(uart8250_data[i]); 61 struct plat_serial8250_port *p = &(uart8250_data[i]);
60 struct bcma_serial_port *bcma_port; 62 struct bcma_serial_port *bcma_port;
61 bcma_port = &(cc->serial_ports[i]); 63 bcma_port = &(cc->serial_ports[i]);
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 1f30571968e7..025be218ea15 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -26,12 +26,19 @@
26 * 675 Mass Ave, Cambridge, MA 02139, USA. 26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */ 27 */
28 28
29#include "bcm47xx_private.h"
30
29#include <linux/export.h> 31#include <linux/export.h>
30#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/ethtool.h>
34#include <linux/phy.h>
35#include <linux/phy_fixed.h>
31#include <linux/ssb/ssb.h> 36#include <linux/ssb/ssb.h>
32#include <linux/ssb/ssb_embedded.h> 37#include <linux/ssb/ssb_embedded.h>
33#include <linux/bcma/bcma_soc.h> 38#include <linux/bcma/bcma_soc.h>
34#include <asm/bootinfo.h> 39#include <asm/bootinfo.h>
40#include <asm/idle.h>
41#include <asm/prom.h>
35#include <asm/reboot.h> 42#include <asm/reboot.h>
36#include <asm/time.h> 43#include <asm/time.h>
37#include <bcm47xx.h> 44#include <bcm47xx.h>
@@ -210,12 +217,14 @@ void __init plat_mem_setup(void)
210#ifdef CONFIG_BCM47XX_BCMA 217#ifdef CONFIG_BCM47XX_BCMA
211 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA; 218 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
212 bcm47xx_register_bcma(); 219 bcm47xx_register_bcma();
220 bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id);
213#endif 221#endif
214 } else { 222 } else {
215 printk(KERN_INFO "bcm47xx: using ssb bus\n"); 223 printk(KERN_INFO "bcm47xx: using ssb bus\n");
216#ifdef CONFIG_BCM47XX_SSB 224#ifdef CONFIG_BCM47XX_SSB
217 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB; 225 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
218 bcm47xx_register_ssb(); 226 bcm47xx_register_ssb();
227 bcm47xx_set_system_type(bcm47xx_bus.ssb.chip_id);
219#endif 228#endif
220 } 229 }
221 230
@@ -223,7 +232,39 @@ void __init plat_mem_setup(void)
223 _machine_halt = bcm47xx_machine_halt; 232 _machine_halt = bcm47xx_machine_halt;
224 pm_power_off = bcm47xx_machine_halt; 233 pm_power_off = bcm47xx_machine_halt;
225 bcm47xx_board_detect(); 234 bcm47xx_board_detect();
235 mips_set_machine_name(bcm47xx_board_get_name());
236}
237
238static int __init bcm47xx_cpu_fixes(void)
239{
240 switch (bcm47xx_bus_type) {
241#ifdef CONFIG_BCM47XX_SSB
242 case BCM47XX_BUS_TYPE_SSB:
243 /* Nothing to do */
244 break;
245#endif
246#ifdef CONFIG_BCM47XX_BCMA
247 case BCM47XX_BUS_TYPE_BCMA:
248 /* The BCM4706 has a problem with the CPU wait instruction.
249 * When r4k_wait or r4k_wait_irqoff is used will just hang and
250 * not return from a msleep(). Removing the cpu_wait
251 * functionality is a workaround for this problem. The BCM4716
252 * does not have this problem.
253 */
254 if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706)
255 cpu_wait = NULL;
256 break;
257#endif
258 }
259 return 0;
226} 260}
261arch_initcall(bcm47xx_cpu_fixes);
262
263static struct fixed_phy_status bcm47xx_fixed_phy_status __initdata = {
264 .link = 1,
265 .speed = SPEED_100,
266 .duplex = DUPLEX_FULL,
267};
227 268
228static int __init bcm47xx_register_bus_complete(void) 269static int __init bcm47xx_register_bus_complete(void)
229{ 270{
@@ -239,6 +280,10 @@ static int __init bcm47xx_register_bus_complete(void)
239 break; 280 break;
240#endif 281#endif
241 } 282 }
283 bcm47xx_buttons_register();
284 bcm47xx_leds_register();
285
286 fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status);
242 return 0; 287 return 0;
243} 288}
244device_initcall(bcm47xx_register_bus_complete); 289device_initcall(bcm47xx_register_bus_complete);
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index ad03c931b905..a8b5408dd349 100644
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -135,7 +135,7 @@ static void nvram_read_leddc(const char *prefix, const char *name,
135} 135}
136 136
137static void nvram_read_macaddr(const char *prefix, const char *name, 137static void nvram_read_macaddr(const char *prefix, const char *name,
138 u8 (*val)[6], bool fallback) 138 u8 val[6], bool fallback)
139{ 139{
140 char buf[100]; 140 char buf[100];
141 int err; 141 int err;
@@ -144,11 +144,11 @@ static void nvram_read_macaddr(const char *prefix, const char *name,
144 if (err < 0) 144 if (err < 0)
145 return; 145 return;
146 146
147 bcm47xx_nvram_parse_macaddr(buf, *val); 147 bcm47xx_nvram_parse_macaddr(buf, val);
148} 148}
149 149
150static void nvram_read_alpha2(const char *prefix, const char *name, 150static void nvram_read_alpha2(const char *prefix, const char *name,
151 char (*val)[2], bool fallback) 151 char val[2], bool fallback)
152{ 152{
153 char buf[10]; 153 char buf[10];
154 int err; 154 int err;
@@ -162,7 +162,7 @@ static void nvram_read_alpha2(const char *prefix, const char *name,
162 pr_warn("alpha2 is too long %s\n", buf); 162 pr_warn("alpha2 is too long %s\n", buf);
163 return; 163 return;
164 } 164 }
165 memcpy(val, buf, sizeof(val)); 165 memcpy(val, buf, 2);
166} 166}
167 167
168static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, 168static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
@@ -180,7 +180,7 @@ static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
180 fallback); 180 fallback);
181 nvram_read_s8(prefix, NULL, "ag1", &sprom->antenna_gain.a1, 0, 181 nvram_read_s8(prefix, NULL, "ag1", &sprom->antenna_gain.a1, 0,
182 fallback); 182 fallback);
183 nvram_read_alpha2(prefix, "ccode", &sprom->alpha2, fallback); 183 nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback);
184} 184}
185 185
186static void bcm47xx_fill_sprom_r12389(struct ssb_sprom *sprom, 186static void bcm47xx_fill_sprom_r12389(struct ssb_sprom *sprom,
@@ -633,20 +633,20 @@ static void bcm47xx_fill_sprom_path_r45(struct ssb_sprom *sprom,
633static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, 633static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
634 const char *prefix, bool fallback) 634 const char *prefix, bool fallback)
635{ 635{
636 nvram_read_macaddr(prefix, "et0macaddr", &sprom->et0mac, fallback); 636 nvram_read_macaddr(prefix, "et0macaddr", sprom->et0mac, fallback);
637 nvram_read_u8(prefix, NULL, "et0mdcport", &sprom->et0mdcport, 0, 637 nvram_read_u8(prefix, NULL, "et0mdcport", &sprom->et0mdcport, 0,
638 fallback); 638 fallback);
639 nvram_read_u8(prefix, NULL, "et0phyaddr", &sprom->et0phyaddr, 0, 639 nvram_read_u8(prefix, NULL, "et0phyaddr", &sprom->et0phyaddr, 0,
640 fallback); 640 fallback);
641 641
642 nvram_read_macaddr(prefix, "et1macaddr", &sprom->et1mac, fallback); 642 nvram_read_macaddr(prefix, "et1macaddr", sprom->et1mac, fallback);
643 nvram_read_u8(prefix, NULL, "et1mdcport", &sprom->et1mdcport, 0, 643 nvram_read_u8(prefix, NULL, "et1mdcport", &sprom->et1mdcport, 0,
644 fallback); 644 fallback);
645 nvram_read_u8(prefix, NULL, "et1phyaddr", &sprom->et1phyaddr, 0, 645 nvram_read_u8(prefix, NULL, "et1phyaddr", &sprom->et1phyaddr, 0,
646 fallback); 646 fallback);
647 647
648 nvram_read_macaddr(prefix, "macaddr", &sprom->il0mac, fallback); 648 nvram_read_macaddr(prefix, "macaddr", sprom->il0mac, fallback);
649 nvram_read_macaddr(prefix, "il0macaddr", &sprom->il0mac, fallback); 649 nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback);
650} 650}
651 651
652static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix, 652static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix,
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
deleted file mode 100644
index c63a4c287b5c..000000000000
--- a/arch/mips/bcm47xx/wgt634u.c
+++ /dev/null
@@ -1,174 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
7 */
8
9#include <linux/platform_device.h>
10#include <linux/module.h>
11#include <linux/leds.h>
12#include <linux/mtd/physmap.h>
13#include <linux/ssb/ssb.h>
14#include <linux/ssb/ssb_embedded.h>
15#include <linux/interrupt.h>
16#include <linux/reboot.h>
17#include <linux/gpio.h>
18#include <asm/mach-bcm47xx/bcm47xx.h>
19
20/* GPIO definitions for the WGT634U */
21#define WGT634U_GPIO_LED 3
22#define WGT634U_GPIO_RESET 2
23#define WGT634U_GPIO_TP1 7
24#define WGT634U_GPIO_TP2 6
25#define WGT634U_GPIO_TP3 5
26#define WGT634U_GPIO_TP4 4
27#define WGT634U_GPIO_TP5 1
28
29static struct gpio_led wgt634u_leds[] = {
30 {
31 .name = "power",
32 .gpio = WGT634U_GPIO_LED,
33 .active_low = 1,
34 .default_trigger = "heartbeat",
35 },
36};
37
38static struct gpio_led_platform_data wgt634u_led_data = {
39 .num_leds = ARRAY_SIZE(wgt634u_leds),
40 .leds = wgt634u_leds,
41};
42
43static struct platform_device wgt634u_gpio_leds = {
44 .name = "leds-gpio",
45 .id = -1,
46 .dev = {
47 .platform_data = &wgt634u_led_data,
48 }
49};
50
51
52/* 8MiB flash. The struct mtd_partition matches original Netgear WGT634U
53 firmware. */
54static struct mtd_partition wgt634u_partitions[] = {
55 {
56 .name = "cfe",
57 .offset = 0,
58 .size = 0x60000, /* 384k */
59 .mask_flags = MTD_WRITEABLE /* force read-only */
60 },
61 {
62 .name = "config",
63 .offset = 0x60000,
64 .size = 0x20000 /* 128k */
65 },
66 {
67 .name = "linux",
68 .offset = 0x80000,
69 .size = 0x140000 /* 1280k */
70 },
71 {
72 .name = "jffs",
73 .offset = 0x1c0000,
74 .size = 0x620000 /* 6272k */
75 },
76 {
77 .name = "nvram",
78 .offset = 0x7e0000,
79 .size = 0x20000 /* 128k */
80 },
81};
82
83static struct physmap_flash_data wgt634u_flash_data = {
84 .parts = wgt634u_partitions,
85 .nr_parts = ARRAY_SIZE(wgt634u_partitions)
86};
87
88static struct resource wgt634u_flash_resource = {
89 .flags = IORESOURCE_MEM,
90};
91
92static struct platform_device wgt634u_flash = {
93 .name = "physmap-flash",
94 .id = 0,
95 .dev = { .platform_data = &wgt634u_flash_data, },
96 .resource = &wgt634u_flash_resource,
97 .num_resources = 1,
98};
99
100/* Platform devices */
101static struct platform_device *wgt634u_devices[] __initdata = {
102 &wgt634u_flash,
103 &wgt634u_gpio_leds,
104};
105
106static irqreturn_t gpio_interrupt(int irq, void *ignored)
107{
108 int state;
109
110 /* Interrupts are shared, check if the current one is
111 a GPIO interrupt. */
112 if (!ssb_chipco_irq_status(&bcm47xx_bus.ssb.chipco,
113 SSB_CHIPCO_IRQ_GPIO))
114 return IRQ_NONE;
115
116 state = gpio_get_value(WGT634U_GPIO_RESET);
117
118 /* Interrupt are level triggered, revert the interrupt polarity
119 to clear the interrupt. */
120 ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << WGT634U_GPIO_RESET,
121 state ? 1 << WGT634U_GPIO_RESET : 0);
122
123 if (!state) {
124 printk(KERN_INFO "Reset button pressed");
125 ctrl_alt_del();
126 }
127
128 return IRQ_HANDLED;
129}
130
131static int __init wgt634u_init(void)
132{
133 /* There is no easy way to detect that we are running on a WGT634U
134 * machine. Use the MAC address as an heuristic. Netgear Inc. has
135 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
136 */
137 u8 *et0mac;
138
139 if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
140 return -ENODEV;
141
142 et0mac = bcm47xx_bus.ssb.sprom.et0mac;
143
144 if (et0mac[0] == 0x00 &&
145 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
146 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
147 struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;
148
149 printk(KERN_INFO "WGT634U machine detected.\n");
150
151 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
152 gpio_interrupt, IRQF_SHARED,
153 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
154 gpio_direction_input(WGT634U_GPIO_RESET);
155 ssb_gpio_intmask(&bcm47xx_bus.ssb,
156 1 << WGT634U_GPIO_RESET,
157 1 << WGT634U_GPIO_RESET);
158 ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
159 SSB_CHIPCO_IRQ_GPIO,
160 SSB_CHIPCO_IRQ_GPIO);
161 }
162
163 wgt634u_flash_data.width = mcore->pflash.buswidth;
164 wgt634u_flash_resource.start = mcore->pflash.window;
165 wgt634u_flash_resource.end = mcore->pflash.window
166 + mcore->pflash.window_size
167 - 1;
168 return platform_add_devices(wgt634u_devices,
169 ARRAY_SIZE(wgt634u_devices));
170 } else
171 return -ENODEV;
172}
173
174module_init(wgt634u_init);
diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index b78306ce56c7..a057fdf111c6 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -3,33 +3,41 @@ menu "CPU support"
3 3
4config BCM63XX_CPU_3368 4config BCM63XX_CPU_3368
5 bool "support 3368 CPU" 5 bool "support 3368 CPU"
6 select SYS_HAS_CPU_BMIPS4350
6 select HW_HAS_PCI 7 select HW_HAS_PCI
7 8
8config BCM63XX_CPU_6328 9config BCM63XX_CPU_6328
9 bool "support 6328 CPU" 10 bool "support 6328 CPU"
11 select SYS_HAS_CPU_BMIPS4350
10 select HW_HAS_PCI 12 select HW_HAS_PCI
11 13
12config BCM63XX_CPU_6338 14config BCM63XX_CPU_6338
13 bool "support 6338 CPU" 15 bool "support 6338 CPU"
16 select SYS_HAS_CPU_BMIPS32_3300
14 select HW_HAS_PCI 17 select HW_HAS_PCI
15 18
16config BCM63XX_CPU_6345 19config BCM63XX_CPU_6345
17 bool "support 6345 CPU" 20 bool "support 6345 CPU"
21 select SYS_HAS_CPU_BMIPS32_3300
18 22
19config BCM63XX_CPU_6348 23config BCM63XX_CPU_6348
20 bool "support 6348 CPU" 24 bool "support 6348 CPU"
25 select SYS_HAS_CPU_BMIPS32_3300
21 select HW_HAS_PCI 26 select HW_HAS_PCI
22 27
23config BCM63XX_CPU_6358 28config BCM63XX_CPU_6358
24 bool "support 6358 CPU" 29 bool "support 6358 CPU"
30 select SYS_HAS_CPU_BMIPS4350
25 select HW_HAS_PCI 31 select HW_HAS_PCI
26 32
27config BCM63XX_CPU_6362 33config BCM63XX_CPU_6362
28 bool "support 6362 CPU" 34 bool "support 6362 CPU"
35 select SYS_HAS_CPU_BMIPS4350
29 select HW_HAS_PCI 36 select HW_HAS_PCI
30 37
31config BCM63XX_CPU_6368 38config BCM63XX_CPU_6368
32 bool "support 6368 CPU" 39 bool "support 6368 CPU"
40 select SYS_HAS_CPU_BMIPS4350
33 select HW_HAS_PCI 41 select HW_HAS_PCI
34endmenu 42endmenu
35 43
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index ac2807397c1c..9019f54aee69 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,7 +1,7 @@
1obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ 1obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
2 setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ 2 setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
3 dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \ 3 dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \
4 dev-usb-usbd.o 4 dev-wdt.o dev-usb-usbd.o
5obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 5obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
6 6
7obj-y += boards/ 7obj-y += boards/
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 5b974eb125fc..33727e7f0c79 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -23,6 +23,7 @@
23#include <bcm63xx_dev_enet.h> 23#include <bcm63xx_dev_enet.h>
24#include <bcm63xx_dev_dsp.h> 24#include <bcm63xx_dev_dsp.h>
25#include <bcm63xx_dev_flash.h> 25#include <bcm63xx_dev_flash.h>
26#include <bcm63xx_dev_hsspi.h>
26#include <bcm63xx_dev_pcmcia.h> 27#include <bcm63xx_dev_pcmcia.h>
27#include <bcm63xx_dev_spi.h> 28#include <bcm63xx_dev_spi.h>
28#include <bcm63xx_dev_usb_usbd.h> 29#include <bcm63xx_dev_usb_usbd.h>
@@ -915,6 +916,8 @@ int __init board_register_devices(void)
915 916
916 bcm63xx_spi_register(); 917 bcm63xx_spi_register();
917 918
919 bcm63xx_hsspi_register();
920
918 bcm63xx_flash_register(); 921 bcm63xx_flash_register();
919 922
920 bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); 923 bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 43da4ae04cc2..637565284732 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -226,6 +226,28 @@ static struct clk clk_spi = {
226}; 226};
227 227
228/* 228/*
229 * HSSPI clock
230 */
231static void hsspi_set(struct clk *clk, int enable)
232{
233 u32 mask;
234
235 if (BCMCPU_IS_6328())
236 mask = CKCTL_6328_HSSPI_EN;
237 else if (BCMCPU_IS_6362())
238 mask = CKCTL_6362_HSSPI_EN;
239 else
240 return;
241
242 bcm_hwclock_set(mask, enable);
243}
244
245static struct clk clk_hsspi = {
246 .set = hsspi_set,
247};
248
249
250/*
229 * XTM clock 251 * XTM clock
230 */ 252 */
231static void xtm_set(struct clk *clk, int enable) 253static void xtm_set(struct clk *clk, int enable)
@@ -346,6 +368,8 @@ struct clk *clk_get(struct device *dev, const char *id)
346 return &clk_usbd; 368 return &clk_usbd;
347 if (!strcmp(id, "spi")) 369 if (!strcmp(id, "spi"))
348 return &clk_spi; 370 return &clk_spi;
371 if (!strcmp(id, "hsspi"))
372 return &clk_hsspi;
349 if (!strcmp(id, "xtm")) 373 if (!strcmp(id, "xtm"))
350 return &clk_xtm; 374 return &clk_xtm;
351 if (!strcmp(id, "periph")) 375 if (!strcmp(id, "periph"))
@@ -366,3 +390,21 @@ void clk_put(struct clk *clk)
366} 390}
367 391
368EXPORT_SYMBOL(clk_put); 392EXPORT_SYMBOL(clk_put);
393
394#define HSSPI_PLL_HZ_6328 133333333
395#define HSSPI_PLL_HZ_6362 400000000
396
397static int __init bcm63xx_clk_init(void)
398{
399 switch (bcm63xx_get_cpu_id()) {
400 case BCM6328_CPU_ID:
401 clk_hsspi.rate = HSSPI_PLL_HZ_6328;
402 break;
403 case BCM6362_CPU_ID:
404 clk_hsspi.rate = HSSPI_PLL_HZ_6362;
405 break;
406 }
407
408 return 0;
409}
410arch_initcall(bcm63xx_clk_init);
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index b713cd64b087..1b1b8a89959b 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -123,7 +123,9 @@ unsigned int bcm63xx_get_memory_size(void)
123 123
124static unsigned int detect_cpu_clock(void) 124static unsigned int detect_cpu_clock(void)
125{ 125{
126 switch (bcm63xx_get_cpu_id()) { 126 u16 cpu_id = bcm63xx_get_cpu_id();
127
128 switch (cpu_id) {
127 case BCM3368_CPU_ID: 129 case BCM3368_CPU_ID:
128 return 300000000; 130 return 300000000;
129 131
@@ -249,7 +251,7 @@ static unsigned int detect_cpu_clock(void)
249 } 251 }
250 252
251 default: 253 default:
252 BUG(); 254 panic("Failed to detect clock for CPU with id=%04X\n", cpu_id);
253 } 255 }
254} 256}
255 257
diff --git a/arch/mips/bcm63xx/dev-hsspi.c b/arch/mips/bcm63xx/dev-hsspi.c
new file mode 100644
index 000000000000..696abc48e3c8
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-hsspi.c
@@ -0,0 +1,47 @@
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) 2012 Jonas Gorski <jonas.gorski@gmail.com>
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/platform_device.h>
12
13#include <bcm63xx_cpu.h>
14#include <bcm63xx_dev_hsspi.h>
15#include <bcm63xx_regs.h>
16
17static struct resource spi_resources[] = {
18 {
19 .start = -1, /* filled at runtime */
20 .end = -1, /* filled at runtime */
21 .flags = IORESOURCE_MEM,
22 },
23 {
24 .start = -1, /* filled at runtime */
25 .flags = IORESOURCE_IRQ,
26 },
27};
28
29static struct platform_device bcm63xx_hsspi_device = {
30 .name = "bcm63xx-hsspi",
31 .id = 0,
32 .num_resources = ARRAY_SIZE(spi_resources),
33 .resource = spi_resources,
34};
35
36int __init bcm63xx_hsspi_register(void)
37{
38 if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362())
39 return -ENODEV;
40
41 spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
42 spi_resources[0].end = spi_resources[0].start;
43 spi_resources[0].end += RSET_HSSPI_SIZE - 1;
44 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI);
45
46 return platform_device_register(&bcm63xx_hsspi_device);
47}
diff --git a/arch/mips/bcm63xx/early_printk.c b/arch/mips/bcm63xx/early_printk.c
index aa8f7f9cc7a4..6092226a6d76 100644
--- a/arch/mips/bcm63xx/early_printk.c
+++ b/arch/mips/bcm63xx/early_printk.c
@@ -6,9 +6,8 @@
6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> 6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
7 */ 7 */
8 8
9#include <linux/init.h>
10#include <bcm63xx_io.h> 9#include <bcm63xx_io.h>
11#include <bcm63xx_regs.h> 10#include <linux/serial_bcm63xx.h>
12 11
13static void wait_xfered(void) 12static void wait_xfered(void)
14{ 13{
diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
index 8ac4e095e68e..e1f27d653f60 100644
--- a/arch/mips/bcm63xx/prom.c
+++ b/arch/mips/bcm63xx/prom.c
@@ -59,14 +59,12 @@ void __init prom_init(void)
59 /* do low level board init */ 59 /* do low level board init */
60 board_prom_init(); 60 board_prom_init();
61 61
62 if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) { 62 /* set up SMP */
63 /* set up SMP */ 63 if (!register_bmips_smp_ops()) {
64 register_smp_ops(&bmips_smp_ops);
65
66 /* 64 /*
67 * BCM6328 might not have its second CPU enabled, while BCM6358 65 * BCM6328 might not have its second CPU enabled, while BCM3368
68 * needs special handling for its shared TLB, so disable SMP 66 * and BCM6358 need special handling for their shared TLB, so
69 * for now. 67 * disable SMP for now.
70 */ 68 */
71 if (BCMCPU_IS_6328()) { 69 if (BCMCPU_IS_6328()) {
72 reg = bcm_readl(BCM_6328_OTP_BASE + 70 reg = bcm_readl(BCM_6328_OTP_BASE +
@@ -74,7 +72,7 @@ void __init prom_init(void)
74 72
75 if (reg & OTP_6328_REG3_TP1_DISABLED) 73 if (reg & OTP_6328_REG3_TP1_DISABLED)
76 bmips_smp_enabled = 0; 74 bmips_smp_enabled = 0;
77 } else if (BCMCPU_IS_6358()) { 75 } else if (BCMCPU_IS_3368() || BCMCPU_IS_6358()) {
78 bmips_smp_enabled = 0; 76 bmips_smp_enabled = 0;
79 } 77 }
80 78
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index ca0c343c9ea5..61af6b6ab13d 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -27,10 +27,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
27 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ 27 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
28 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) 28 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
29 29
30targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o 30targets := head.o decompress.o string.o dbg.o uart-16550.o uart-alchemy.o
31 31
32# decompressor objects (linked with vmlinuz) 32# decompressor objects (linked with vmlinuz)
33vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o 33vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/dbg.o
34 34
35ifdef CONFIG_DEBUG_ZBOOT 35ifdef CONFIG_DEBUG_ZBOOT
36vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o 36vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
diff --git a/arch/mips/boot/compressed/dbg.c b/arch/mips/boot/compressed/dbg.c
index 134a6162e394..06c6a5bd175d 100644
--- a/arch/mips/boot/compressed/dbg.c
+++ b/arch/mips/boot/compressed/dbg.c
@@ -6,7 +6,6 @@
6 * need to implement your own putc(). 6 * need to implement your own putc().
7 */ 7 */
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <linux/init.h>
10#include <linux/types.h> 9#include <linux/types.h>
11 10
12void __weak putc(char c) 11void __weak putc(char c)
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index a8c6fd6a4406..c00c4ddf4514 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -43,33 +43,11 @@ 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#if defined(CONFIG_KERNEL_GZIP) || defined(CONFIG_KERNEL_XZ) || \
47 defined(CONFIG_KERNEL_LZ4)
48void *memcpy(void *dest, const void *src, size_t n)
49{
50 int i;
51 const char *s = src;
52 char *d = dest;
53
54 for (i = 0; i < n; i++)
55 d[i] = s[i];
56 return dest;
57}
58#endif
59#ifdef CONFIG_KERNEL_GZIP 46#ifdef CONFIG_KERNEL_GZIP
60#include "../../../../lib/decompress_inflate.c" 47#include "../../../../lib/decompress_inflate.c"
61#endif 48#endif
62 49
63#ifdef CONFIG_KERNEL_BZIP2 50#ifdef CONFIG_KERNEL_BZIP2
64void *memset(void *s, int c, size_t n)
65{
66 int i;
67 char *ss = s;
68
69 for (i = 0; i < n; i++)
70 ss[i] = c;
71 return s;
72}
73#include "../../../../lib/decompress_bunzip2.c" 51#include "../../../../lib/decompress_bunzip2.c"
74#endif 52#endif
75 53
diff --git a/arch/mips/boot/compressed/string.c b/arch/mips/boot/compressed/string.c
new file mode 100644
index 000000000000..9de9885acd0d
--- /dev/null
+++ b/arch/mips/boot/compressed/string.c
@@ -0,0 +1,28 @@
1/*
2 * arch/mips/boot/compressed/string.c
3 *
4 * Very small subset of simple string routines
5 */
6
7#include <linux/types.h>
8
9void *memcpy(void *dest, const void *src, size_t n)
10{
11 int i;
12 const char *s = src;
13 char *d = dest;
14
15 for (i = 0; i < n; i++)
16 d[i] = s[i];
17 return dest;
18}
19
20void *memset(void *s, int c, size_t n)
21{
22 int i;
23 char *ss = s;
24
25 for (i = 0; i < n; i++)
26 ss[i] = c;
27 return s;
28}
diff --git a/arch/mips/boot/compressed/uart-16550.c b/arch/mips/boot/compressed/uart-16550.c
index c01d343ce6ad..237494b7a21a 100644
--- a/arch/mips/boot/compressed/uart-16550.c
+++ b/arch/mips/boot/compressed/uart-16550.c
@@ -4,7 +4,6 @@
4 4
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/serial_reg.h> 6#include <linux/serial_reg.h>
7#include <linux/init.h>
8 7
9#include <asm/addrspace.h> 8#include <asm/addrspace.h>
10 9
@@ -19,8 +18,8 @@
19#endif 18#endif
20 19
21#ifdef CONFIG_MACH_JZ4740 20#ifdef CONFIG_MACH_JZ4740
22#define UART0_BASE 0xB0030000 21#include <asm/mach-jz4740/base.h>
23#define PORT(offset) (UART0_BASE + (4 * offset)) 22#define PORT(offset) (CKSEG1ADDR(JZ4740_UART0_BASE_ADDR) + (4 * offset))
24#endif 23#endif
25 24
26#ifdef CONFIG_CPU_XLR 25#ifdef CONFIG_CPU_XLR
diff --git a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
index 132bccc66a93..8241fc6aa17d 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
@@ -47,6 +47,7 @@
47 * state. It points to a bootmem named block. 47 * state. It points to a bootmem named block.
48 */ 48 */
49__cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr; 49__cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
50EXPORT_SYMBOL_GPL(__cvmx_cmd_queue_state_ptr);
50 51
51/** 52/**
52 * Initialize the Global queue state pointer. 53 * Initialize the Global queue state pointer.
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
index 0a1283ce47f5..b764df64be40 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
@@ -722,3 +722,30 @@ int __cvmx_helper_board_hardware_enable(int interface)
722 } 722 }
723 return 0; 723 return 0;
724} 724}
725
726/**
727 * Get the clock type used for the USB block based on board type.
728 * Used by the USB code for auto configuration of clock type.
729 *
730 * Return USB clock type enumeration
731 */
732enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void)
733{
734 switch (cvmx_sysinfo_get()->board_type) {
735 case CVMX_BOARD_TYPE_BBGW_REF:
736 case CVMX_BOARD_TYPE_LANAI2_A:
737 case CVMX_BOARD_TYPE_LANAI2_U:
738 case CVMX_BOARD_TYPE_LANAI2_G:
739 case CVMX_BOARD_TYPE_NIC10E_66:
740 case CVMX_BOARD_TYPE_UBNT_E100:
741 return USB_CLOCK_TYPE_CRYSTAL_12;
742 case CVMX_BOARD_TYPE_NIC10E:
743 return USB_CLOCK_TYPE_REF_12;
744 default:
745 break;
746 }
747 /* Most boards except NIC10e use a 12MHz crystal */
748 if (OCTEON_IS_MODEL(OCTEON_FAM_2))
749 return USB_CLOCK_TYPE_CRYSTAL_12;
750 return USB_CLOCK_TYPE_REF_48;
751}
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-util.c b/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
index 65d2bc9a0bde..453d7f66459a 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
@@ -251,6 +251,7 @@ int cvmx_helper_setup_red(int pass_thresh, int drop_thresh)
251 251
252 return 0; 252 return 0;
253} 253}
254EXPORT_SYMBOL_GPL(cvmx_helper_setup_red);
254 255
255/** 256/**
256 * Setup the common GMX settings that determine the number of 257 * Setup the common GMX settings that determine the number of
@@ -384,6 +385,7 @@ int cvmx_helper_get_ipd_port(int interface, int port)
384 } 385 }
385 return -1; 386 return -1;
386} 387}
388EXPORT_SYMBOL_GPL(cvmx_helper_get_ipd_port);
387 389
388/** 390/**
389 * Returns the interface number for an IPD/PKO port number. 391 * Returns the interface number for an IPD/PKO port number.
@@ -408,6 +410,7 @@ int cvmx_helper_get_interface_num(int ipd_port)
408 410
409 return -1; 411 return -1;
410} 412}
413EXPORT_SYMBOL_GPL(cvmx_helper_get_interface_num);
411 414
412/** 415/**
413 * Returns the interface index number for an IPD/PKO port 416 * Returns the interface index number for an IPD/PKO port
@@ -431,3 +434,4 @@ int cvmx_helper_get_interface_index_num(int ipd_port)
431 434
432 return -1; 435 return -1;
433} 436}
437EXPORT_SYMBOL_GPL(cvmx_helper_get_interface_index_num);
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
index d63d20dfbfb0..8553ad5c72b6 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
@@ -67,7 +67,7 @@ void (*cvmx_override_pko_queue_priority) (int pko_port,
67void (*cvmx_override_ipd_port_setup) (int ipd_port); 67void (*cvmx_override_ipd_port_setup) (int ipd_port);
68 68
69/* Port count per interface */ 69/* Port count per interface */
70static int interface_port_count[4] = { 0, 0, 0, 0 }; 70static int interface_port_count[5];
71 71
72/* Port last configured link info index by IPD/PKO port */ 72/* Port last configured link info index by IPD/PKO port */
73static cvmx_helper_link_info_t 73static cvmx_helper_link_info_t
@@ -88,6 +88,7 @@ int cvmx_helper_get_number_of_interfaces(void)
88 else 88 else
89 return 3; 89 return 3;
90} 90}
91EXPORT_SYMBOL_GPL(cvmx_helper_get_number_of_interfaces);
91 92
92/** 93/**
93 * Return the number of ports on an interface. Depending on the 94 * Return the number of ports on an interface. Depending on the
@@ -102,6 +103,7 @@ int cvmx_helper_ports_on_interface(int interface)
102{ 103{
103 return interface_port_count[interface]; 104 return interface_port_count[interface];
104} 105}
106EXPORT_SYMBOL_GPL(cvmx_helper_ports_on_interface);
105 107
106/** 108/**
107 * Get the operating mode of an interface. Depending on the Octeon 109 * Get the operating mode of an interface. Depending on the Octeon
@@ -179,6 +181,7 @@ cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int interface)
179 return CVMX_HELPER_INTERFACE_MODE_RGMII; 181 return CVMX_HELPER_INTERFACE_MODE_RGMII;
180 } 182 }
181} 183}
184EXPORT_SYMBOL_GPL(cvmx_helper_interface_get_mode);
182 185
183/** 186/**
184 * Configure the IPD/PIP tagging and QoS options for a specific 187 * Configure the IPD/PIP tagging and QoS options for a specific
@@ -825,6 +828,7 @@ int cvmx_helper_ipd_and_packet_input_enable(void)
825 __cvmx_helper_errata_fix_ipd_ptr_alignment(); 828 __cvmx_helper_errata_fix_ipd_ptr_alignment();
826 return 0; 829 return 0;
827} 830}
831EXPORT_SYMBOL_GPL(cvmx_helper_ipd_and_packet_input_enable);
828 832
829/** 833/**
830 * Initialize the PIP, IPD, and PKO hardware to support 834 * Initialize the PIP, IPD, and PKO hardware to support
@@ -903,6 +907,7 @@ int cvmx_helper_initialize_packet_io_global(void)
903#endif 907#endif
904 return result; 908 return result;
905} 909}
910EXPORT_SYMBOL_GPL(cvmx_helper_initialize_packet_io_global);
906 911
907/** 912/**
908 * Does core local initialization for packet io 913 * Does core local initialization for packet io
@@ -947,6 +952,7 @@ cvmx_helper_link_info_t cvmx_helper_link_autoconf(int ipd_port)
947 */ 952 */
948 return port_link_info[ipd_port]; 953 return port_link_info[ipd_port];
949} 954}
955EXPORT_SYMBOL_GPL(cvmx_helper_link_autoconf);
950 956
951/** 957/**
952 * Return the link state of an IPD/PKO port as returned by 958 * Return the link state of an IPD/PKO port as returned by
@@ -1005,6 +1011,7 @@ cvmx_helper_link_info_t cvmx_helper_link_get(int ipd_port)
1005 } 1011 }
1006 return result; 1012 return result;
1007} 1013}
1014EXPORT_SYMBOL_GPL(cvmx_helper_link_get);
1008 1015
1009/** 1016/**
1010 * Configure an IPD/PKO port for the specified link state. This 1017 * Configure an IPD/PKO port for the specified link state. This
@@ -1060,6 +1067,7 @@ int cvmx_helper_link_set(int ipd_port, cvmx_helper_link_info_t link_info)
1060 port_link_info[ipd_port].u64 = link_info.u64; 1067 port_link_info[ipd_port].u64 = link_info.u64;
1061 return result; 1068 return result;
1062} 1069}
1070EXPORT_SYMBOL_GPL(cvmx_helper_link_set);
1063 1071
1064/** 1072/**
1065 * Configure a port for internal and/or external loopback. Internal loopback 1073 * Configure a port for internal and/or external loopback. Internal loopback
diff --git a/arch/mips/cavium-octeon/executive/cvmx-pko.c b/arch/mips/cavium-octeon/executive/cvmx-pko.c
index f2c877541597..008b881cdf64 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-pko.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-pko.c
@@ -140,7 +140,7 @@ void cvmx_pko_disable(void)
140 pko_reg_flags.s.ena_pko = 0; 140 pko_reg_flags.s.ena_pko = 0;
141 cvmx_write_csr(CVMX_PKO_REG_FLAGS, pko_reg_flags.u64); 141 cvmx_write_csr(CVMX_PKO_REG_FLAGS, pko_reg_flags.u64);
142} 142}
143 143EXPORT_SYMBOL_GPL(cvmx_pko_disable);
144 144
145/** 145/**
146 * Reset the packet output. 146 * Reset the packet output.
@@ -182,6 +182,7 @@ void cvmx_pko_shutdown(void)
182 } 182 }
183 __cvmx_pko_reset(); 183 __cvmx_pko_reset();
184} 184}
185EXPORT_SYMBOL_GPL(cvmx_pko_shutdown);
185 186
186/** 187/**
187 * Configure a output port and the associated queues for use. 188 * Configure a output port and the associated queues for use.
diff --git a/arch/mips/cavium-octeon/executive/cvmx-spi.c b/arch/mips/cavium-octeon/executive/cvmx-spi.c
index ef5198d13a0e..459e3b1eb61f 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-spi.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-spi.c
@@ -177,6 +177,7 @@ int cvmx_spi_restart_interface(int interface, cvmx_spi_mode_t mode, int timeout)
177 177
178 return res; 178 return res;
179} 179}
180EXPORT_SYMBOL_GPL(cvmx_spi_restart_interface);
180 181
181/** 182/**
182 * Callback to perform SPI4 reset 183 * Callback to perform SPI4 reset
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 1830874ff1e2..6df0f4d8f197 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -171,6 +171,7 @@ device_initcall(octeon_ohci_device_init);
171static struct of_device_id __initdata octeon_ids[] = { 171static struct of_device_id __initdata octeon_ids[] = {
172 { .compatible = "simple-bus", }, 172 { .compatible = "simple-bus", },
173 { .compatible = "cavium,octeon-6335-uctl", }, 173 { .compatible = "cavium,octeon-6335-uctl", },
174 { .compatible = "cavium,octeon-5750-usbn", },
174 { .compatible = "cavium,octeon-3860-bootbus", }, 175 { .compatible = "cavium,octeon-3860-bootbus", },
175 { .compatible = "cavium,mdio-mux", }, 176 { .compatible = "cavium,mdio-mux", },
176 { .compatible = "gpio-leds", }, 177 { .compatible = "gpio-leds", },
@@ -336,14 +337,14 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac)
336 int p; 337 int p;
337 int count = 0; 338 int count = 0;
338 339
339 if (cvmx_helper_interface_enumerate(idx) == 0)
340 count = cvmx_helper_ports_on_interface(idx);
341
342 snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx); 340 snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx);
343 iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer); 341 iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer);
344 if (iface < 0) 342 if (iface < 0)
345 return; 343 return;
346 344
345 if (cvmx_helper_interface_enumerate(idx) == 0)
346 count = cvmx_helper_ports_on_interface(idx);
347
347 for (p = 0; p < 16; p++) 348 for (p = 0; p < 16; p++)
348 octeon_fdt_pip_port(iface, idx, p, count - 1, pmac); 349 octeon_fdt_pip_port(iface, idx, p, count - 1, pmac);
349} 350}
@@ -682,6 +683,37 @@ end_led:
682 } 683 }
683 } 684 }
684 685
686 /* DWC2 USB */
687 alias_prop = fdt_getprop(initial_boot_params, aliases,
688 "usbn", NULL);
689 if (alias_prop) {
690 int usbn = fdt_path_offset(initial_boot_params, alias_prop);
691
692 if (usbn >= 0 && (current_cpu_type() == CPU_CAVIUM_OCTEON2 ||
693 !octeon_has_feature(OCTEON_FEATURE_USB))) {
694 pr_debug("Deleting usbn\n");
695 fdt_nop_node(initial_boot_params, usbn);
696 fdt_nop_property(initial_boot_params, aliases, "usbn");
697 } else {
698 __be32 new_f[1];
699 enum cvmx_helper_board_usb_clock_types c;
700 c = __cvmx_helper_board_usb_get_clock_type();
701 switch (c) {
702 case USB_CLOCK_TYPE_REF_48:
703 new_f[0] = cpu_to_be32(48000000);
704 fdt_setprop_inplace(initial_boot_params, usbn,
705 "refclk-frequency", new_f, sizeof(new_f));
706 /* Fall through ...*/
707 case USB_CLOCK_TYPE_REF_12:
708 /* Missing "refclk-type" defaults to external. */
709 fdt_nop_property(initial_boot_params, usbn, "refclk-type");
710 break;
711 default:
712 break;
713 }
714 }
715 }
716
685 return 0; 717 return 0;
686} 718}
687 719
diff --git a/arch/mips/cavium-octeon/octeon_3xxx.dts b/arch/mips/cavium-octeon/octeon_3xxx.dts
index 88cb42d4cc49..fa33115bde33 100644
--- a/arch/mips/cavium-octeon/octeon_3xxx.dts
+++ b/arch/mips/cavium-octeon/octeon_3xxx.dts
@@ -550,6 +550,24 @@
550 big-endian-regs; 550 big-endian-regs;
551 }; 551 };
552 }; 552 };
553
554 usbn: usbn@1180068000000 {
555 compatible = "cavium,octeon-5750-usbn";
556 reg = <0x11800 0x68000000 0x0 0x1000>;
557 ranges; /* Direct mapping */
558 #address-cells = <2>;
559 #size-cells = <2>;
560 /* 12MHz, 24MHz and 48MHz allowed */
561 refclk-frequency = <12000000>;
562 /* Either "crystal" or "external" */
563 refclk-type = "crystal";
564
565 usbc@16f0010000000 {
566 compatible = "cavium,octeon-5750-usbc";
567 reg = <0x16f00 0x10000000 0x0 0x80000>;
568 interrupts = <0 56>;
569 };
570 };
553 }; 571 };
554 572
555 aliases { 573 aliases {
@@ -566,6 +584,7 @@
566 flash0 = &flash0; 584 flash0 = &flash0;
567 cf0 = &cf0; 585 cf0 = &cf0;
568 uctl = &uctl; 586 uctl = &uctl;
587 usbn = &usbn;
569 led0 = &led0; 588 led0 = &led0;
570 }; 589 };
571 }; 590 };
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 24a2167db778..67a078ffc464 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -6,7 +6,6 @@
6 * Copyright (C) 2004-2008, 2009, 2010 Cavium Networks 6 * Copyright (C) 2004-2008, 2009, 2010 Cavium Networks
7 */ 7 */
8#include <linux/cpu.h> 8#include <linux/cpu.h>
9#include <linux/init.h>
10#include <linux/delay.h> 9#include <linux/delay.h>
11#include <linux/smp.h> 10#include <linux/smp.h>
12#include <linux/interrupt.h> 11#include <linux/interrupt.h>
diff --git a/arch/mips/configs/ar7_defconfig b/arch/mips/configs/ar7_defconfig
index 80e012fa409c..320772caf054 100644
--- a/arch/mips/configs/ar7_defconfig
+++ b/arch/mips/configs/ar7_defconfig
@@ -86,7 +86,6 @@ CONFIG_MAC80211_RC_DEFAULT_PID=y
86CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 86CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
87# CONFIG_FIRMWARE_IN_KERNEL is not set 87# CONFIG_FIRMWARE_IN_KERNEL is not set
88CONFIG_MTD=y 88CONFIG_MTD=y
89CONFIG_MTD_PARTITIONS=y
90CONFIG_MTD_CHAR=y 89CONFIG_MTD_CHAR=y
91CONFIG_MTD_BLOCK=y 90CONFIG_MTD_BLOCK=y
92CONFIG_MTD_CFI=y 91CONFIG_MTD_CFI=y
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 4ca8e5c99225..0db4eb319e0a 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -1,623 +1,86 @@
1CONFIG_BCM47XX=y 1CONFIG_BCM47XX=y
2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_KEXEC=y
5# CONFIG_SECCOMP is not set
6CONFIG_EXPERIMENTAL=y
7# CONFIG_LOCALVERSION_AUTO is not set
8CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
9CONFIG_POSIX_MQUEUE=y 3CONFIG_HIGH_RES_TIMERS=y
10CONFIG_BSD_PROCESS_ACCT=y 4CONFIG_UIDGID_STRICT_TYPE_CHECKS=y
11CONFIG_BSD_PROCESS_ACCT_V3=y
12CONFIG_TASKSTATS=y
13CONFIG_TASK_DELAY_ACCT=y
14CONFIG_TASK_XACCT=y
15CONFIG_TASK_IO_ACCOUNTING=y
16CONFIG_AUDIT=y
17CONFIG_TINY_RCU=y
18CONFIG_CGROUPS=y
19CONFIG_CGROUP_CPUACCT=y
20CONFIG_RELAY=y
21CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
22CONFIG_RD_LZMA=y 6CONFIG_CC_OPTIMIZE_FOR_SIZE=y
23CONFIG_EXPERT=y 7CONFIG_EMBEDDED=y
24CONFIG_SLAB=y 8CONFIG_SLAB=y
25CONFIG_MODULES=y 9CONFIG_MODULES=y
26CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
27CONFIG_MODULE_FORCE_UNLOAD=y 11CONFIG_PARTITION_ADVANCED=y
28CONFIG_MODVERSIONS=y
29# CONFIG_BLK_DEV_BSG is not set
30CONFIG_PCI=y 12CONFIG_PCI=y
31CONFIG_BINFMT_MISC=m 13# CONFIG_SUSPEND is not set
32CONFIG_NET=y 14CONFIG_NET=y
33CONFIG_PACKET=y 15CONFIG_PACKET=y
34CONFIG_UNIX=y 16CONFIG_UNIX=y
35CONFIG_XFRM_USER=m
36CONFIG_NET_KEY=m
37CONFIG_INET=y 17CONFIG_INET=y
38CONFIG_IP_MULTICAST=y 18CONFIG_IP_MULTICAST=y
39CONFIG_IP_ADVANCED_ROUTER=y 19CONFIG_IP_ADVANCED_ROUTER=y
40CONFIG_IP_MULTIPLE_TABLES=y 20CONFIG_IP_MULTIPLE_TABLES=y
41CONFIG_IP_ROUTE_MULTIPATH=y 21CONFIG_IP_ROUTE_MULTIPATH=y
42CONFIG_IP_ROUTE_VERBOSE=y
43CONFIG_NET_IPIP=m
44CONFIG_NET_IPGRE=m
45CONFIG_NET_IPGRE_BROADCAST=y
46CONFIG_IP_MROUTE=y 22CONFIG_IP_MROUTE=y
47CONFIG_IP_PIMSM_V1=y 23CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
48CONFIG_IP_PIMSM_V2=y
49CONFIG_SYN_COOKIES=y 24CONFIG_SYN_COOKIES=y
50CONFIG_INET_AH=m
51CONFIG_INET_ESP=m
52CONFIG_INET_IPCOMP=m
53CONFIG_INET_XFRM_MODE_TRANSPORT=m
54CONFIG_INET_XFRM_MODE_TUNNEL=m
55CONFIG_INET_XFRM_MODE_BEET=m
56CONFIG_INET_DIAG=m
57CONFIG_TCP_CONG_ADVANCED=y 25CONFIG_TCP_CONG_ADVANCED=y
58CONFIG_TCP_CONG_BIC=y
59CONFIG_TCP_CONG_CUBIC=m
60CONFIG_TCP_CONG_HSTCP=m
61CONFIG_TCP_CONG_HYBLA=m
62CONFIG_TCP_CONG_SCALABLE=m
63CONFIG_TCP_CONG_LP=m
64CONFIG_TCP_CONG_VENO=m
65CONFIG_TCP_CONG_YEAH=m
66CONFIG_TCP_CONG_ILLINOIS=m
67CONFIG_IPV6_PRIVACY=y 26CONFIG_IPV6_PRIVACY=y
68CONFIG_INET6_AH=m
69CONFIG_INET6_ESP=m
70CONFIG_INET6_IPCOMP=m
71CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
72CONFIG_IPV6_TUNNEL=m
73CONFIG_IPV6_MULTIPLE_TABLES=y 27CONFIG_IPV6_MULTIPLE_TABLES=y
74CONFIG_IPV6_SUBTREES=y 28CONFIG_IPV6_SUBTREES=y
75CONFIG_NETWORK_SECMARK=y 29CONFIG_IPV6_MROUTE=y
76CONFIG_NETFILTER=y 30CONFIG_NETFILTER=y
77CONFIG_NETFILTER_NETLINK_QUEUE=m 31CONFIG_VLAN_8021Q=y
78CONFIG_NF_CONNTRACK=m
79CONFIG_NF_CONNTRACK_SECMARK=y
80CONFIG_NF_CONNTRACK_EVENTS=y
81CONFIG_NF_CT_PROTO_UDPLITE=m
82CONFIG_NF_CONNTRACK_AMANDA=m
83CONFIG_NF_CONNTRACK_FTP=m
84CONFIG_NF_CONNTRACK_H323=m
85CONFIG_NF_CONNTRACK_IRC=m
86CONFIG_NF_CONNTRACK_NETBIOS_NS=m
87CONFIG_NF_CONNTRACK_PPTP=m
88CONFIG_NF_CONNTRACK_SANE=m
89CONFIG_NF_CONNTRACK_SIP=m
90CONFIG_NF_CONNTRACK_TFTP=m
91CONFIG_NF_CT_NETLINK=m
92CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
93CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
94CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
95CONFIG_NETFILTER_XT_TARGET_DSCP=m
96CONFIG_NETFILTER_XT_TARGET_MARK=m
97CONFIG_NETFILTER_XT_TARGET_NFLOG=m
98CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
99CONFIG_NETFILTER_XT_TARGET_TRACE=m
100CONFIG_NETFILTER_XT_TARGET_SECMARK=m
101CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
102CONFIG_NETFILTER_XT_MATCH_COMMENT=m
103CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
104CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
105CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
106CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
107CONFIG_NETFILTER_XT_MATCH_DSCP=m
108CONFIG_NETFILTER_XT_MATCH_ESP=m
109CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
110CONFIG_NETFILTER_XT_MATCH_HELPER=m
111CONFIG_NETFILTER_XT_MATCH_LENGTH=m
112CONFIG_NETFILTER_XT_MATCH_LIMIT=m
113CONFIG_NETFILTER_XT_MATCH_MAC=m
114CONFIG_NETFILTER_XT_MATCH_MARK=m
115CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
116CONFIG_NETFILTER_XT_MATCH_POLICY=m
117CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
118CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
119CONFIG_NETFILTER_XT_MATCH_QUOTA=m
120CONFIG_NETFILTER_XT_MATCH_REALM=m
121CONFIG_NETFILTER_XT_MATCH_STATE=m
122CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
123CONFIG_NETFILTER_XT_MATCH_STRING=m
124CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
125CONFIG_NETFILTER_XT_MATCH_TIME=m
126CONFIG_NETFILTER_XT_MATCH_U32=m
127CONFIG_IP_VS=m
128CONFIG_IP_VS_PROTO_TCP=y
129CONFIG_IP_VS_PROTO_UDP=y
130CONFIG_IP_VS_PROTO_ESP=y
131CONFIG_IP_VS_PROTO_AH=y
132CONFIG_IP_VS_RR=m
133CONFIG_IP_VS_WRR=m
134CONFIG_IP_VS_LC=m
135CONFIG_IP_VS_WLC=m
136CONFIG_IP_VS_LBLC=m
137CONFIG_IP_VS_LBLCR=m
138CONFIG_IP_VS_DH=m
139CONFIG_IP_VS_SH=m
140CONFIG_IP_VS_SED=m
141CONFIG_IP_VS_NQ=m
142CONFIG_IP_VS_FTP=m
143CONFIG_NF_CONNTRACK_IPV4=m
144CONFIG_IP_NF_QUEUE=m
145CONFIG_IP_NF_IPTABLES=m
146CONFIG_IP_NF_MATCH_ADDRTYPE=m
147CONFIG_IP_NF_MATCH_AH=m
148CONFIG_IP_NF_MATCH_ECN=m
149CONFIG_IP_NF_MATCH_TTL=m
150CONFIG_IP_NF_FILTER=m
151CONFIG_IP_NF_TARGET_REJECT=m
152CONFIG_IP_NF_TARGET_LOG=m
153CONFIG_IP_NF_TARGET_ULOG=m
154CONFIG_NF_NAT=m
155CONFIG_IP_NF_TARGET_MASQUERADE=m
156CONFIG_IP_NF_TARGET_NETMAP=m
157CONFIG_IP_NF_TARGET_REDIRECT=m
158CONFIG_NF_NAT_SNMP_BASIC=m
159CONFIG_IP_NF_MANGLE=m
160CONFIG_IP_NF_TARGET_CLUSTERIP=m
161CONFIG_IP_NF_TARGET_ECN=m
162CONFIG_IP_NF_TARGET_TTL=m
163CONFIG_IP_NF_RAW=m
164CONFIG_IP_NF_ARPTABLES=m
165CONFIG_IP_NF_ARPFILTER=m
166CONFIG_IP_NF_ARP_MANGLE=m
167CONFIG_NF_CONNTRACK_IPV6=m
168CONFIG_IP6_NF_QUEUE=m
169CONFIG_IP6_NF_IPTABLES=m
170CONFIG_IP6_NF_MATCH_AH=m
171CONFIG_IP6_NF_MATCH_EUI64=m
172CONFIG_IP6_NF_MATCH_FRAG=m
173CONFIG_IP6_NF_MATCH_OPTS=m
174CONFIG_IP6_NF_MATCH_HL=m
175CONFIG_IP6_NF_MATCH_IPV6HEADER=m
176CONFIG_IP6_NF_MATCH_MH=m
177CONFIG_IP6_NF_MATCH_RT=m
178CONFIG_IP6_NF_TARGET_HL=m
179CONFIG_IP6_NF_TARGET_LOG=m
180CONFIG_IP6_NF_FILTER=m
181CONFIG_IP6_NF_TARGET_REJECT=m
182CONFIG_IP6_NF_MANGLE=m
183CONFIG_IP6_NF_RAW=m
184CONFIG_BRIDGE_NF_EBTABLES=m
185CONFIG_BRIDGE_EBT_BROUTE=m
186CONFIG_BRIDGE_EBT_T_FILTER=m
187CONFIG_BRIDGE_EBT_T_NAT=m
188CONFIG_BRIDGE_EBT_802_3=m
189CONFIG_BRIDGE_EBT_AMONG=m
190CONFIG_BRIDGE_EBT_ARP=m
191CONFIG_BRIDGE_EBT_IP=m
192CONFIG_BRIDGE_EBT_LIMIT=m
193CONFIG_BRIDGE_EBT_MARK=m
194CONFIG_BRIDGE_EBT_PKTTYPE=m
195CONFIG_BRIDGE_EBT_STP=m
196CONFIG_BRIDGE_EBT_VLAN=m
197CONFIG_BRIDGE_EBT_ARPREPLY=m
198CONFIG_BRIDGE_EBT_DNAT=m
199CONFIG_BRIDGE_EBT_MARK_T=m
200CONFIG_BRIDGE_EBT_REDIRECT=m
201CONFIG_BRIDGE_EBT_SNAT=m
202CONFIG_BRIDGE_EBT_LOG=m
203CONFIG_BRIDGE_EBT_ULOG=m
204CONFIG_IP_DCCP=m
205CONFIG_TIPC=m
206CONFIG_TIPC_ADVANCED=y
207CONFIG_ATM=m
208CONFIG_ATM_CLIP=m
209CONFIG_ATM_LANE=m
210CONFIG_ATM_MPOA=m
211CONFIG_ATM_BR2684=m
212CONFIG_BRIDGE=m
213CONFIG_VLAN_8021Q=m
214CONFIG_NET_SCHED=y 32CONFIG_NET_SCHED=y
215CONFIG_NET_SCH_CBQ=m 33CONFIG_NET_SCH_FQ_CODEL=y
216CONFIG_NET_SCH_HTB=m 34CONFIG_HAMRADIO=y
217CONFIG_NET_SCH_HFSC=m 35CONFIG_CFG80211=y
218CONFIG_NET_SCH_ATM=m 36CONFIG_MAC80211=y
219CONFIG_NET_SCH_PRIO=m
220CONFIG_NET_SCH_RED=m
221CONFIG_NET_SCH_SFQ=m
222CONFIG_NET_SCH_TEQL=m
223CONFIG_NET_SCH_TBF=m
224CONFIG_NET_SCH_GRED=m
225CONFIG_NET_SCH_DSMARK=m
226CONFIG_NET_SCH_NETEM=m
227CONFIG_NET_SCH_INGRESS=m
228CONFIG_NET_CLS_BASIC=m
229CONFIG_NET_CLS_TCINDEX=m
230CONFIG_NET_CLS_ROUTE4=m
231CONFIG_NET_CLS_FW=m
232CONFIG_NET_CLS_U32=m
233CONFIG_CLS_U32_PERF=y
234CONFIG_CLS_U32_MARK=y
235CONFIG_NET_CLS_RSVP=m
236CONFIG_NET_CLS_RSVP6=m
237CONFIG_NET_EMATCH=y
238CONFIG_NET_EMATCH_CMP=m
239CONFIG_NET_EMATCH_NBYTE=m
240CONFIG_NET_EMATCH_U32=m
241CONFIG_NET_EMATCH_META=m
242CONFIG_NET_EMATCH_TEXT=m
243CONFIG_NET_CLS_ACT=y
244CONFIG_NET_ACT_POLICE=m
245CONFIG_NET_ACT_GACT=m
246CONFIG_GACT_PROB=y
247CONFIG_NET_ACT_MIRRED=m
248CONFIG_NET_ACT_IPT=m
249CONFIG_NET_ACT_NAT=m
250CONFIG_NET_ACT_PEDIT=m
251CONFIG_NET_ACT_SIMP=m
252CONFIG_NET_CLS_IND=y
253CONFIG_NET_PKTGEN=m
254CONFIG_BT=m
255CONFIG_BT_HCIUART=m
256CONFIG_BT_HCIUART_H4=y
257CONFIG_BT_HCIUART_BCSP=y
258CONFIG_BT_HCIUART_LL=y
259CONFIG_BT_HCIBCM203X=m
260CONFIG_BT_HCIBPA10X=m
261CONFIG_BT_HCIBFUSB=m
262CONFIG_BT_HCIVHCI=m
263CONFIG_CFG80211=m
264CONFIG_MAC80211=m
265CONFIG_MAC80211_RC_PID=y
266CONFIG_MAC80211_RC_DEFAULT_PID=y
267CONFIG_MAC80211_MESH=y
268CONFIG_RFKILL=m
269CONFIG_RFKILL_INPUT=y
270CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
271CONFIG_FW_LOADER=m
272CONFIG_CONNECTOR=m
273CONFIG_MTD=y 37CONFIG_MTD=y
274CONFIG_MTD_CONCAT=y 38CONFIG_MTD_BCM47XX_PARTS=y
275CONFIG_MTD_PARTITIONS=y
276CONFIG_MTD_CHAR=y
277CONFIG_MTD_BLOCK=y 39CONFIG_MTD_BLOCK=y
278CONFIG_MTD_CFI=y 40CONFIG_MTD_CFI=y
279CONFIG_MTD_CFI_INTELEXT=y 41CONFIG_MTD_CFI_INTELEXT=y
280CONFIG_MTD_CFI_AMDSTD=y 42CONFIG_MTD_CFI_AMDSTD=y
281CONFIG_MTD_CFI_STAA=y 43CONFIG_MTD_COMPLEX_MAPPINGS=y
282CONFIG_MTD_RAM=y
283CONFIG_MTD_ROM=y
284CONFIG_MTD_ABSENT=y
285CONFIG_MTD_PHYSMAP=y 44CONFIG_MTD_PHYSMAP=y
286CONFIG_BLK_DEV_LOOP=m 45CONFIG_MTD_BCM47XXSFLASH=y
287CONFIG_BLK_DEV_CRYPTOLOOP=m 46CONFIG_MTD_NAND=y
288CONFIG_BLK_DEV_NBD=m 47CONFIG_MTD_NAND_BCM47XXNFLASH=y
289CONFIG_BLK_DEV_RAM=y
290CONFIG_BLK_DEV_RAM_SIZE=16384
291CONFIG_ATA_OVER_ETH=m
292CONFIG_RAID_ATTRS=m
293CONFIG_SCSI=y
294CONFIG_SCSI_TGT=m
295CONFIG_BLK_DEV_SD=y
296CONFIG_CHR_DEV_ST=m
297CONFIG_CHR_DEV_OSST=m
298CONFIG_BLK_DEV_SR=m
299CONFIG_BLK_DEV_SR_VENDOR=y
300CONFIG_CHR_DEV_SG=m
301CONFIG_CHR_DEV_SCH=m
302CONFIG_SCSI_MULTI_LUN=y
303CONFIG_SCSI_CONSTANTS=y
304CONFIG_SCSI_LOGGING=y
305CONFIG_SCSI_SCAN_ASYNC=y
306CONFIG_ISCSI_TCP=m
307CONFIG_NETDEVICES=y 48CONFIG_NETDEVICES=y
308CONFIG_DUMMY=m
309CONFIG_EQUALIZER=m
310CONFIG_TUN=m
311CONFIG_VETH=m
312CONFIG_PHYLIB=m
313CONFIG_MARVELL_PHY=m
314CONFIG_DAVICOM_PHY=m
315CONFIG_QSEMI_PHY=m
316CONFIG_LXT_PHY=m
317CONFIG_CICADA_PHY=m
318CONFIG_VITESSE_PHY=m
319CONFIG_SMSC_PHY=m
320CONFIG_BROADCOM_PHY=m
321CONFIG_ICPLUS_PHY=m
322CONFIG_MDIO_BITBANG=m
323CONFIG_NET_ETHERNET=y
324CONFIG_NET_PCI=y
325CONFIG_B44=y 49CONFIG_B44=y
326# CONFIG_NETDEV_1000 is not set 50CONFIG_TIGON3=y
327# CONFIG_NETDEV_10000 is not set 51CONFIG_BGMAC=y
328CONFIG_ATH_COMMON=m 52CONFIG_ATH_CARDS=y
329CONFIG_ATH5K=m 53CONFIG_ATH5K=y
330CONFIG_B43=m 54CONFIG_B43=y
331CONFIG_B43LEGACY=m 55CONFIG_B43LEGACY=y
332CONFIG_ZD1211RW=m 56CONFIG_BRCMSMAC=y
333CONFIG_USB_CATC=m 57CONFIG_ISDN=y
334CONFIG_USB_KAWETH=m
335CONFIG_USB_PEGASUS=m
336CONFIG_USB_RTL8150=m
337CONFIG_USB_USBNET=m
338CONFIG_USB_NET_DM9601=m
339CONFIG_USB_NET_GL620A=m
340CONFIG_USB_NET_PLUSB=m
341CONFIG_USB_NET_MCS7830=m
342CONFIG_USB_NET_RNDIS_HOST=m
343CONFIG_USB_ALI_M5632=y
344CONFIG_USB_AN2720=y
345CONFIG_USB_EPSON2888=y
346CONFIG_USB_KC2190=y
347CONFIG_USB_SIERRA_NET=m
348CONFIG_ATM_DUMMY=m
349CONFIG_ATM_TCP=m
350CONFIG_PPP=m
351CONFIG_PPP_ASYNC=m
352CONFIG_PPP_DEFLATE=m
353CONFIG_PPP_BSDCOMP=m
354CONFIG_PPP_MPPE=m
355CONFIG_PPPOE=m
356CONFIG_PPPOATM=m
357CONFIG_SLIP=m
358CONFIG_INPUT_EVDEV=m
359# CONFIG_INPUT_KEYBOARD is not set
360# CONFIG_INPUT_MOUSE is not set
361# CONFIG_SERIO is not set
362# CONFIG_VT is not set
363CONFIG_SERIAL_8250=y 58CONFIG_SERIAL_8250=y
59# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
364CONFIG_SERIAL_8250_CONSOLE=y 60CONFIG_SERIAL_8250_CONSOLE=y
365# CONFIG_SERIAL_8250_PCI is not set 61# CONFIG_SERIAL_8250_PCI is not set
366CONFIG_SERIAL_8250_NR_UARTS=2 62CONFIG_SERIAL_8250_NR_UARTS=2
367CONFIG_SERIAL_8250_RUNTIME_UARTS=2 63CONFIG_SERIAL_8250_RUNTIME_UARTS=2
368# CONFIG_LEGACY_PTYS is not set 64CONFIG_SERIAL_8250_EXTENDED=y
369# CONFIG_HW_RANDOM is not set 65CONFIG_SERIAL_8250_SHARE_IRQ=y
370CONFIG_W1=m 66CONFIG_HW_RANDOM=y
371CONFIG_W1_MASTER_MATROX=m 67CONFIG_GPIO_SYSFS=y
372CONFIG_W1_MASTER_DS2490=m
373CONFIG_W1_SLAVE_THERM=m
374CONFIG_W1_SLAVE_SMEM=m
375CONFIG_W1_SLAVE_DS2433=m
376CONFIG_W1_SLAVE_DS2760=m
377# CONFIG_HWMON is not set
378CONFIG_THERMAL=y
379CONFIG_WATCHDOG=y 68CONFIG_WATCHDOG=y
380CONFIG_WATCHDOG_NOWAYOUT=y
381CONFIG_BCM47XX_WDT=y 69CONFIG_BCM47XX_WDT=y
70CONFIG_SSB_DEBUG=y
382CONFIG_SSB_DRIVER_GIGE=y 71CONFIG_SSB_DRIVER_GIGE=y
383CONFIG_DISPLAY_SUPPORT=m 72CONFIG_BCMA_DRIVER_GMAC_CMN=y
384CONFIG_SOUND=m
385CONFIG_SND=m
386CONFIG_SND_SEQUENCER=m
387CONFIG_SND_SEQ_DUMMY=m
388CONFIG_SND_MIXER_OSS=m
389CONFIG_SND_PCM_OSS=m
390CONFIG_SND_SEQUENCER_OSS=y
391CONFIG_SND_DUMMY=m
392CONFIG_SND_VIRMIDI=m
393CONFIG_SND_USB_AUDIO=m
394CONFIG_HID=m
395CONFIG_USB_HID=m
396CONFIG_USB_HIDDEV=y
397CONFIG_USB=y 73CONFIG_USB=y
398CONFIG_USB_DEVICEFS=y 74CONFIG_USB_HCD_BCMA=y
399# CONFIG_USB_DEVICE_CLASS is not set 75CONFIG_USB_HCD_SSB=y
400CONFIG_USB_EHCI_HCD=y
401CONFIG_USB_EHCI_ROOT_HUB_TT=y
402CONFIG_USB_OHCI_HCD=y
403CONFIG_USB_U132_HCD=m
404CONFIG_USB_R8A66597_HCD=m
405CONFIG_USB_ACM=m
406CONFIG_USB_PRINTER=m
407CONFIG_USB_STORAGE=y
408CONFIG_USB_STORAGE_DATAFAB=y
409CONFIG_USB_STORAGE_FREECOM=y
410CONFIG_USB_STORAGE_USBAT=y
411CONFIG_USB_STORAGE_SDDR09=y
412CONFIG_USB_STORAGE_SDDR55=y
413CONFIG_USB_STORAGE_JUMPSHOT=y
414CONFIG_USB_STORAGE_ALAUDA=y
415CONFIG_USB_STORAGE_ONETOUCH=y
416CONFIG_USB_STORAGE_KARMA=y
417CONFIG_USB_MDC800=m
418CONFIG_USB_MICROTEK=m
419CONFIG_USB_SERIAL=m
420CONFIG_USB_SERIAL_GENERIC=y
421CONFIG_USB_SERIAL_AIRCABLE=m
422CONFIG_USB_SERIAL_ARK3116=m
423CONFIG_USB_SERIAL_BELKIN=m
424CONFIG_USB_SERIAL_CH341=m
425CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
426CONFIG_USB_SERIAL_CYPRESS_M8=m
427CONFIG_USB_SERIAL_EMPEG=m
428CONFIG_USB_SERIAL_FTDI_SIO=m
429CONFIG_USB_SERIAL_FUNSOFT=m
430CONFIG_USB_SERIAL_VISOR=m
431CONFIG_USB_SERIAL_IPAQ=m
432CONFIG_USB_SERIAL_IR=m
433CONFIG_USB_SERIAL_GARMIN=m
434CONFIG_USB_SERIAL_IPW=m
435CONFIG_USB_SERIAL_KEYSPAN_PDA=m
436CONFIG_USB_SERIAL_KLSI=m
437CONFIG_USB_SERIAL_KOBIL_SCT=m
438CONFIG_USB_SERIAL_MCT_U232=m
439CONFIG_USB_SERIAL_MOS7720=m
440CONFIG_USB_SERIAL_MOS7840=m
441CONFIG_USB_SERIAL_NAVMAN=m
442CONFIG_USB_SERIAL_PL2303=m
443CONFIG_USB_SERIAL_OTI6858=m
444CONFIG_USB_SERIAL_HP4X=m
445CONFIG_USB_SERIAL_SAFE=m
446CONFIG_USB_SERIAL_SIERRAWIRELESS=m
447CONFIG_USB_SERIAL_CYBERJACK=m
448CONFIG_USB_SERIAL_XIRCOM=m
449CONFIG_USB_SERIAL_OPTION=m
450CONFIG_USB_SERIAL_OMNINET=m
451CONFIG_USB_SERIAL_DEBUG=m
452CONFIG_USB_ADUTUX=m
453CONFIG_USB_RIO500=m
454CONFIG_USB_LEGOTOWER=m
455CONFIG_USB_LCD=m
456CONFIG_USB_LED=m
457CONFIG_USB_CYPRESS_CY7C63=m
458CONFIG_USB_CYTHERM=m
459CONFIG_USB_IDMOUSE=m
460CONFIG_USB_FTDI_ELAN=m
461CONFIG_USB_SISUSBVGA=m
462CONFIG_USB_LD=m
463CONFIG_USB_TRANCEVIBRATOR=m
464CONFIG_USB_IOWARRIOR=m
465CONFIG_USB_TEST=m
466CONFIG_USB_ATM=m
467CONFIG_USB_SPEEDTOUCH=m
468CONFIG_USB_CXACRU=m
469CONFIG_USB_UEAGLEATM=m
470CONFIG_USB_XUSBATM=m
471CONFIG_USB_GADGET=m
472CONFIG_USB_GADGET_NET2280=y
473CONFIG_USB_ZERO=m
474CONFIG_USB_ETH=m
475CONFIG_USB_GADGETFS=m
476CONFIG_USB_MASS_STORAGE=m
477CONFIG_USB_G_SERIAL=m
478CONFIG_USB_MIDI_GADGET=m
479CONFIG_LEDS_CLASS=y
480CONFIG_LEDS_GPIO=y
481CONFIG_LEDS_TRIGGER_TIMER=y 76CONFIG_LEDS_TRIGGER_TIMER=y
482CONFIG_LEDS_TRIGGER_HEARTBEAT=y
483CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 77CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
484CONFIG_EXT2_FS=y 78CONFIG_PRINTK_TIME=y
485CONFIG_EXT2_FS_XATTR=y 79CONFIG_DEBUG_INFO=y
486CONFIG_EXT2_FS_POSIX_ACL=y 80CONFIG_DEBUG_INFO_REDUCED=y
487CONFIG_EXT2_FS_SECURITY=y 81CONFIG_STRIP_ASM_SYMS=y
488CONFIG_EXT3_FS=y
489# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
490CONFIG_EXT3_FS_POSIX_ACL=y
491CONFIG_EXT3_FS_SECURITY=y
492CONFIG_REISERFS_FS=m
493CONFIG_REISERFS_FS_XATTR=y
494CONFIG_REISERFS_FS_POSIX_ACL=y
495CONFIG_REISERFS_FS_SECURITY=y
496CONFIG_JFS_FS=m
497CONFIG_JFS_POSIX_ACL=y
498CONFIG_JFS_SECURITY=y
499CONFIG_XFS_FS=m
500CONFIG_XFS_QUOTA=y
501CONFIG_XFS_POSIX_ACL=y
502CONFIG_XFS_RT=y
503CONFIG_GFS2_FS=m
504CONFIG_QUOTA=y
505CONFIG_QUOTA_NETLINK_INTERFACE=y
506CONFIG_QFMT_V1=m
507CONFIG_QFMT_V2=m
508CONFIG_AUTOFS_FS=m
509CONFIG_AUTOFS4_FS=m
510CONFIG_FUSE_FS=m
511CONFIG_ISO9660_FS=m
512CONFIG_JOLIET=y
513CONFIG_ZISOFS=y
514CONFIG_UDF_FS=m
515CONFIG_MSDOS_FS=m
516CONFIG_VFAT_FS=m
517CONFIG_NTFS_FS=m
518CONFIG_NTFS_RW=y
519CONFIG_PROC_KCORE=y
520CONFIG_TMPFS=y
521CONFIG_TMPFS_POSIX_ACL=y
522CONFIG_ADFS_FS=m
523CONFIG_AFFS_FS=m
524CONFIG_HFS_FS=m
525CONFIG_HFSPLUS_FS=m
526CONFIG_BEFS_FS=m
527CONFIG_BFS_FS=m
528CONFIG_EFS_FS=m
529CONFIG_JFFS2_FS=m
530CONFIG_JFFS2_FS_XATTR=y
531CONFIG_CRAMFS=m
532CONFIG_VXFS_FS=m
533CONFIG_MINIX_FS=m
534CONFIG_HPFS_FS=m
535CONFIG_QNX4FS_FS=m
536CONFIG_ROMFS_FS=m
537CONFIG_SYSV_FS=m
538CONFIG_UFS_FS=m
539CONFIG_NFS_FS=m
540CONFIG_NFS_V3=y
541CONFIG_NFS_V3_ACL=y
542CONFIG_NFS_V4=y
543CONFIG_NFSD=m
544CONFIG_NFSD_V3_ACL=y
545CONFIG_NFSD_V4=y
546CONFIG_RPCSEC_GSS_SPKM3=m
547CONFIG_CIFS=m
548CONFIG_CIFS_XATTR=y
549CONFIG_CIFS_POSIX=y
550CONFIG_NCP_FS=m
551CONFIG_NCPFS_NFS_NS=y
552CONFIG_NCPFS_OS2_NS=y
553CONFIG_NCPFS_NLS=y
554CONFIG_NCPFS_EXTRAS=y
555CONFIG_CODA_FS=m
556CONFIG_PARTITION_ADVANCED=y
557CONFIG_KARMA_PARTITION=y
558CONFIG_NLS_CODEPAGE_437=m
559CONFIG_NLS_CODEPAGE_737=m
560CONFIG_NLS_CODEPAGE_775=m
561CONFIG_NLS_CODEPAGE_850=m
562CONFIG_NLS_CODEPAGE_852=m
563CONFIG_NLS_CODEPAGE_855=m
564CONFIG_NLS_CODEPAGE_857=m
565CONFIG_NLS_CODEPAGE_860=m
566CONFIG_NLS_CODEPAGE_861=m
567CONFIG_NLS_CODEPAGE_862=m
568CONFIG_NLS_CODEPAGE_863=m
569CONFIG_NLS_CODEPAGE_864=m
570CONFIG_NLS_CODEPAGE_865=m
571CONFIG_NLS_CODEPAGE_866=m
572CONFIG_NLS_CODEPAGE_869=m
573CONFIG_NLS_CODEPAGE_936=m
574CONFIG_NLS_CODEPAGE_950=m
575CONFIG_NLS_CODEPAGE_932=m
576CONFIG_NLS_CODEPAGE_949=m
577CONFIG_NLS_CODEPAGE_874=m
578CONFIG_NLS_ISO8859_8=m
579CONFIG_NLS_CODEPAGE_1250=m
580CONFIG_NLS_CODEPAGE_1251=m
581CONFIG_NLS_ASCII=m
582CONFIG_NLS_ISO8859_1=m
583CONFIG_NLS_ISO8859_2=m
584CONFIG_NLS_ISO8859_3=m
585CONFIG_NLS_ISO8859_4=m
586CONFIG_NLS_ISO8859_5=m
587CONFIG_NLS_ISO8859_6=m
588CONFIG_NLS_ISO8859_7=m
589CONFIG_NLS_ISO8859_9=m
590CONFIG_NLS_ISO8859_13=m
591CONFIG_NLS_ISO8859_14=m
592CONFIG_NLS_ISO8859_15=m
593CONFIG_NLS_KOI8_R=m
594CONFIG_NLS_KOI8_U=m
595CONFIG_DLM=m
596CONFIG_DLM_DEBUG=y
597CONFIG_DEBUG_FS=y 82CONFIG_DEBUG_FS=y
598CONFIG_CRYPTO_NULL=m 83CONFIG_MAGIC_SYSRQ=y
599CONFIG_CRYPTO_TEST=m 84CONFIG_CMDLINE_BOOL=y
600CONFIG_CRYPTO_LRW=m 85CONFIG_CMDLINE="console=ttyS0,115200"
601CONFIG_CRYPTO_PCBC=m 86CONFIG_CRC32_SARWATE=y
602CONFIG_CRYPTO_XTS=m
603CONFIG_CRYPTO_HMAC=y
604CONFIG_CRYPTO_XCBC=m
605CONFIG_CRYPTO_MD4=m
606CONFIG_CRYPTO_MD5=y
607CONFIG_CRYPTO_MICHAEL_MIC=m
608CONFIG_CRYPTO_SHA256=m
609CONFIG_CRYPTO_SHA512=m
610CONFIG_CRYPTO_TGR192=m
611CONFIG_CRYPTO_WP512=m
612CONFIG_CRYPTO_ANUBIS=m
613CONFIG_CRYPTO_BLOWFISH=m
614CONFIG_CRYPTO_CAMELLIA=m
615CONFIG_CRYPTO_CAST6=m
616CONFIG_CRYPTO_FCRYPT=m
617CONFIG_CRYPTO_KHAZAD=m
618CONFIG_CRYPTO_SEED=m
619CONFIG_CRYPTO_SERPENT=m
620CONFIG_CRYPTO_TEA=m
621CONFIG_CRYPTO_TWOFISH=m
622CONFIG_CRC16=m
623CONFIG_CRC7=m
diff --git a/arch/mips/configs/bcm63xx_defconfig b/arch/mips/configs/bcm63xx_defconfig
index 919005139f5a..3fec26410f34 100644
--- a/arch/mips/configs/bcm63xx_defconfig
+++ b/arch/mips/configs/bcm63xx_defconfig
@@ -44,7 +44,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
44# CONFIG_STANDALONE is not set 44# CONFIG_STANDALONE is not set
45# CONFIG_PREVENT_FIRMWARE_BUILD is not set 45# CONFIG_PREVENT_FIRMWARE_BUILD is not set
46CONFIG_MTD=y 46CONFIG_MTD=y
47CONFIG_MTD_PARTITIONS=y
48CONFIG_MTD_CFI=y 47CONFIG_MTD_CFI=y
49CONFIG_MTD_CFI_INTELEXT=y 48CONFIG_MTD_CFI_INTELEXT=y
50CONFIG_MTD_CFI_AMDSTD=y 49CONFIG_MTD_CFI_AMDSTD=y
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 5419adb219a8..23b66934e18d 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -19,7 +19,6 @@ CONFIG_INET=y
19# CONFIG_IPV6 is not set 19# CONFIG_IPV6 is not set
20CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 20CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
21CONFIG_MTD=y 21CONFIG_MTD=y
22CONFIG_MTD_PARTITIONS=y
23CONFIG_MTD_CHAR=y 22CONFIG_MTD_CHAR=y
24CONFIG_MTD_BLKDEVS=y 23CONFIG_MTD_BLKDEVS=y
25CONFIG_MTD_JEDECPROBE=y 24CONFIG_MTD_JEDECPROBE=y
diff --git a/arch/mips/configs/gpr_defconfig b/arch/mips/configs/gpr_defconfig
index fb64589015fc..8f219dac9598 100644
--- a/arch/mips/configs/gpr_defconfig
+++ b/arch/mips/configs/gpr_defconfig
@@ -165,7 +165,6 @@ CONFIG_YAM=m
165CONFIG_CFG80211=y 165CONFIG_CFG80211=y
166CONFIG_MAC80211=y 166CONFIG_MAC80211=y
167CONFIG_MTD=y 167CONFIG_MTD=y
168CONFIG_MTD_PARTITIONS=y
169CONFIG_MTD_CHAR=y 168CONFIG_MTD_CHAR=y
170CONFIG_MTD_BLOCK=y 169CONFIG_MTD_BLOCK=y
171CONFIG_MTD_CFI=y 170CONFIG_MTD_CFI=y
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index db5705e18b36..9bc08f275120 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -22,7 +22,6 @@ CONFIG_IP_PNP_BOOTP=y
22# CONFIG_INET_DIAG is not set 22# CONFIG_INET_DIAG is not set
23# CONFIG_IPV6 is not set 23# CONFIG_IPV6 is not set
24CONFIG_MTD=y 24CONFIG_MTD=y
25CONFIG_MTD_PARTITIONS=y
26CONFIG_MTD_CMDLINE_PARTS=y 25CONFIG_MTD_CMDLINE_PARTS=y
27CONFIG_MTD_CHAR=y 26CONFIG_MTD_CHAR=y
28CONFIG_MTD_CFI=y 27CONFIG_MTD_CFI=y
diff --git a/arch/mips/configs/lasat_defconfig b/arch/mips/configs/lasat_defconfig
index d9f3db29ab95..0179c7fa014f 100644
--- a/arch/mips/configs/lasat_defconfig
+++ b/arch/mips/configs/lasat_defconfig
@@ -31,7 +31,6 @@ CONFIG_INET=y
31# CONFIG_INET_DIAG is not set 31# CONFIG_INET_DIAG is not set
32# CONFIG_IPV6 is not set 32# CONFIG_IPV6 is not set
33CONFIG_MTD=y 33CONFIG_MTD=y
34CONFIG_MTD_PARTITIONS=y
35CONFIG_MTD_CHAR=y 34CONFIG_MTD_CHAR=y
36CONFIG_MTD_BLOCK=y 35CONFIG_MTD_BLOCK=y
37CONFIG_MTD_CFI=y 36CONFIG_MTD_CFI=y
diff --git a/arch/mips/configs/maltasmvp_defconfig b/arch/mips/configs/maltasmvp_defconfig
index 8a666021b870..d75931850392 100644
--- a/arch/mips/configs/maltasmvp_defconfig
+++ b/arch/mips/configs/maltasmvp_defconfig
@@ -4,7 +4,7 @@ CONFIG_CPU_MIPS32_R2=y
4CONFIG_MIPS_MT_SMP=y 4CONFIG_MIPS_MT_SMP=y
5CONFIG_SCHED_SMT=y 5CONFIG_SCHED_SMT=y
6CONFIG_MIPS_CMP=y 6CONFIG_MIPS_CMP=y
7CONFIG_NR_CPUS=8 7CONFIG_NR_CPUS=2
8CONFIG_HZ_100=y 8CONFIG_HZ_100=y
9CONFIG_LOCALVERSION="cmp" 9CONFIG_LOCALVERSION="cmp"
10CONFIG_SYSVIPC=y 10CONFIG_SYSVIPC=y
@@ -58,7 +58,6 @@ CONFIG_ATALK=m
58CONFIG_DEV_APPLETALK=m 58CONFIG_DEV_APPLETALK=m
59CONFIG_IPDDP=m 59CONFIG_IPDDP=m
60CONFIG_IPDDP_ENCAP=y 60CONFIG_IPDDP_ENCAP=y
61CONFIG_IPDDP_DECAP=y
62CONFIG_NET_SCHED=y 61CONFIG_NET_SCHED=y
63CONFIG_NET_SCH_CBQ=m 62CONFIG_NET_SCH_CBQ=m
64CONFIG_NET_SCH_HTB=m 63CONFIG_NET_SCH_HTB=m
diff --git a/arch/mips/configs/markeins_defconfig b/arch/mips/configs/markeins_defconfig
index 636f82b89fd3..4c2c0c4b9bb1 100644
--- a/arch/mips/configs/markeins_defconfig
+++ b/arch/mips/configs/markeins_defconfig
@@ -124,7 +124,6 @@ CONFIG_IP6_NF_MANGLE=m
124CONFIG_IP6_NF_RAW=m 124CONFIG_IP6_NF_RAW=m
125CONFIG_FW_LOADER=m 125CONFIG_FW_LOADER=m
126CONFIG_MTD=y 126CONFIG_MTD=y
127CONFIG_MTD_PARTITIONS=y
128CONFIG_MTD_CMDLINE_PARTS=y 127CONFIG_MTD_CMDLINE_PARTS=y
129CONFIG_MTD_CHAR=y 128CONFIG_MTD_CHAR=y
130CONFIG_MTD_BLOCK=y 129CONFIG_MTD_BLOCK=y
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index 9fa8f16068d8..593946afc483 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -246,7 +246,6 @@ CONFIG_BT_HCIBTUART=m
246CONFIG_BT_HCIVHCI=m 246CONFIG_BT_HCIVHCI=m
247CONFIG_CONNECTOR=m 247CONFIG_CONNECTOR=m
248CONFIG_MTD=y 248CONFIG_MTD=y
249CONFIG_MTD_PARTITIONS=y
250CONFIG_MTD_CHAR=y 249CONFIG_MTD_CHAR=y
251CONFIG_MTD_BLOCK=y 250CONFIG_MTD_BLOCK=y
252CONFIG_MTD_CFI=y 251CONFIG_MTD_CFI=y
diff --git a/arch/mips/configs/pnx8335_stb225_defconfig b/arch/mips/configs/pnx8335_stb225_defconfig
index f2925769dfa3..c887066ecc2a 100644
--- a/arch/mips/configs/pnx8335_stb225_defconfig
+++ b/arch/mips/configs/pnx8335_stb225_defconfig
@@ -31,7 +31,6 @@ CONFIG_INET_AH=y
31# CONFIG_IPV6 is not set 31# CONFIG_IPV6 is not set
32CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 32CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
33CONFIG_MTD=y 33CONFIG_MTD=y
34CONFIG_MTD_PARTITIONS=y
35CONFIG_MTD_CMDLINE_PARTS=y 34CONFIG_MTD_CMDLINE_PARTS=y
36CONFIG_MTD_CHAR=y 35CONFIG_MTD_CHAR=y
37CONFIG_MTD_BLOCK=y 36CONFIG_MTD_BLOCK=y
diff --git a/arch/mips/configs/qi_lb60_defconfig b/arch/mips/configs/qi_lb60_defconfig
new file mode 100644
index 000000000000..2b965470c35b
--- /dev/null
+++ b/arch/mips/configs/qi_lb60_defconfig
@@ -0,0 +1,188 @@
1CONFIG_MACH_JZ4740=y
2# CONFIG_COMPACTION is not set
3# CONFIG_CROSS_MEMORY_ATTACH is not set
4CONFIG_HZ_100=y
5CONFIG_PREEMPT=y
6# CONFIG_SECCOMP is not set
7# CONFIG_LOCALVERSION_AUTO is not set
8CONFIG_SYSVIPC=y
9CONFIG_LOG_BUF_SHIFT=14
10CONFIG_SYSCTL_SYSCALL=y
11CONFIG_KALLSYMS_ALL=y
12CONFIG_EMBEDDED=y
13# CONFIG_VM_EVENT_COUNTERS is not set
14# CONFIG_COMPAT_BRK is not set
15CONFIG_SLAB=y
16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y
18# CONFIG_BLK_DEV_BSG is not set
19CONFIG_PARTITION_ADVANCED=y
20# CONFIG_EFI_PARTITION is not set
21# CONFIG_IOSCHED_CFQ is not set
22# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
23CONFIG_NET=y
24CONFIG_PACKET=y
25CONFIG_UNIX=y
26CONFIG_INET=y
27CONFIG_IP_MULTICAST=y
28CONFIG_IP_ADVANCED_ROUTER=y
29CONFIG_IP_MULTIPLE_TABLES=y
30CONFIG_IP_ROUTE_MULTIPATH=y
31CONFIG_IP_ROUTE_VERBOSE=y
32CONFIG_IP_MROUTE=y
33CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
34# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
35# CONFIG_INET_XFRM_MODE_TUNNEL is not set
36# CONFIG_INET_XFRM_MODE_BEET is not set
37# CONFIG_INET_LRO is not set
38# CONFIG_INET_DIAG is not set
39CONFIG_TCP_CONG_ADVANCED=y
40# CONFIG_TCP_CONG_BIC is not set
41# CONFIG_TCP_CONG_CUBIC is not set
42CONFIG_TCP_CONG_WESTWOOD=y
43# CONFIG_TCP_CONG_HTCP is not set
44# CONFIG_IPV6 is not set
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46# CONFIG_FIRMWARE_IN_KERNEL is not set
47CONFIG_MTD=y
48CONFIG_MTD_BLOCK=y
49CONFIG_MTD_NAND=y
50CONFIG_MTD_NAND_JZ4740=y
51CONFIG_MTD_UBI=y
52CONFIG_NETDEVICES=y
53# CONFIG_WLAN is not set
54# CONFIG_INPUT_MOUSEDEV is not set
55CONFIG_INPUT_EVDEV=y
56# CONFIG_KEYBOARD_ATKBD is not set
57CONFIG_KEYBOARD_GPIO=y
58CONFIG_KEYBOARD_MATRIX=y
59# CONFIG_INPUT_MOUSE is not set
60CONFIG_INPUT_MISC=y
61# CONFIG_SERIO is not set
62CONFIG_LEGACY_PTY_COUNT=2
63# CONFIG_DEVKMEM is not set
64CONFIG_SERIAL_8250=y
65CONFIG_SERIAL_8250_CONSOLE=y
66# CONFIG_SERIAL_8250_DMA is not set
67CONFIG_SERIAL_8250_NR_UARTS=2
68CONFIG_SERIAL_8250_RUNTIME_UARTS=2
69# CONFIG_HW_RANDOM is not set
70CONFIG_SPI=y
71CONFIG_SPI_GPIO=y
72CONFIG_POWER_SUPPLY=y
73CONFIG_BATTERY_JZ4740=y
74CONFIG_CHARGER_GPIO=y
75# CONFIG_HWMON is not set
76CONFIG_MFD_JZ4740_ADC=y
77CONFIG_REGULATOR=y
78CONFIG_REGULATOR_FIXED_VOLTAGE=y
79CONFIG_FB=y
80CONFIG_FB_JZ4740=y
81CONFIG_BACKLIGHT_LCD_SUPPORT=y
82CONFIG_LCD_CLASS_DEVICE=y
83# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
84# CONFIG_VGA_CONSOLE is not set
85CONFIG_FRAMEBUFFER_CONSOLE=y
86CONFIG_LOGO=y
87# CONFIG_LOGO_LINUX_MONO is not set
88# CONFIG_LOGO_LINUX_VGA16 is not set
89# CONFIG_LOGO_LINUX_CLUT224 is not set
90CONFIG_SOUND=y
91CONFIG_SND=y
92# CONFIG_SND_SUPPORT_OLD_API is not set
93# CONFIG_SND_VERBOSE_PROCFS is not set
94# CONFIG_SND_DRIVERS is not set
95# CONFIG_SND_SPI is not set
96# CONFIG_SND_MIPS is not set
97CONFIG_SND_SOC=y
98CONFIG_SND_JZ4740_SOC=y
99CONFIG_SND_JZ4740_SOC_QI_LB60=y
100CONFIG_USB=y
101CONFIG_USB_OTG_BLACKLIST_HUB=y
102CONFIG_USB_MUSB_HDRC=y
103CONFIG_USB_MUSB_GADGET=y
104CONFIG_USB_MUSB_JZ4740=y
105CONFIG_NOP_USB_XCEIV=y
106CONFIG_USB_GADGET=y
107CONFIG_USB_GADGET_DEBUG=y
108CONFIG_USB_ETH=y
109# CONFIG_USB_ETH_RNDIS is not set
110CONFIG_MMC=y
111CONFIG_MMC_UNSAFE_RESUME=y
112# CONFIG_MMC_BLOCK_BOUNCE is not set
113CONFIG_MMC_JZ4740=y
114CONFIG_RTC_CLASS=y
115CONFIG_RTC_DRV_JZ4740=y
116CONFIG_DMADEVICES=y
117CONFIG_DMA_JZ4740=y
118CONFIG_PWM=y
119CONFIG_PWM_JZ4740=y
120CONFIG_EXT2_FS=y
121CONFIG_EXT3_FS=y
122# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
123# CONFIG_EXT3_FS_XATTR is not set
124# CONFIG_DNOTIFY is not set
125CONFIG_VFAT_FS=y
126CONFIG_PROC_KCORE=y
127# CONFIG_PROC_PAGE_MONITOR is not set
128CONFIG_TMPFS=y
129CONFIG_JFFS2_FS=y
130CONFIG_JFFS2_SUMMARY=y
131CONFIG_JFFS2_COMPRESSION_OPTIONS=y
132# CONFIG_JFFS2_ZLIB is not set
133CONFIG_UBIFS_FS=y
134CONFIG_UBIFS_FS_ADVANCED_COMPR=y
135# CONFIG_NETWORK_FILESYSTEMS is not set
136CONFIG_NLS_CODEPAGE_437=y
137CONFIG_NLS_CODEPAGE_737=y
138CONFIG_NLS_CODEPAGE_775=y
139CONFIG_NLS_CODEPAGE_850=y
140CONFIG_NLS_CODEPAGE_852=y
141CONFIG_NLS_CODEPAGE_855=y
142CONFIG_NLS_CODEPAGE_857=y
143CONFIG_NLS_CODEPAGE_860=y
144CONFIG_NLS_CODEPAGE_861=y
145CONFIG_NLS_CODEPAGE_862=y
146CONFIG_NLS_CODEPAGE_863=y
147CONFIG_NLS_CODEPAGE_864=y
148CONFIG_NLS_CODEPAGE_865=y
149CONFIG_NLS_CODEPAGE_866=y
150CONFIG_NLS_CODEPAGE_869=y
151CONFIG_NLS_CODEPAGE_936=y
152CONFIG_NLS_CODEPAGE_950=y
153CONFIG_NLS_CODEPAGE_932=y
154CONFIG_NLS_CODEPAGE_949=y
155CONFIG_NLS_CODEPAGE_874=y
156CONFIG_NLS_ISO8859_8=y
157CONFIG_NLS_CODEPAGE_1250=y
158CONFIG_NLS_CODEPAGE_1251=y
159CONFIG_NLS_ASCII=y
160CONFIG_NLS_ISO8859_1=y
161CONFIG_NLS_ISO8859_2=y
162CONFIG_NLS_ISO8859_3=y
163CONFIG_NLS_ISO8859_4=y
164CONFIG_NLS_ISO8859_5=y
165CONFIG_NLS_ISO8859_6=y
166CONFIG_NLS_ISO8859_7=y
167CONFIG_NLS_ISO8859_9=y
168CONFIG_NLS_ISO8859_13=y
169CONFIG_NLS_ISO8859_14=y
170CONFIG_NLS_ISO8859_15=y
171CONFIG_NLS_KOI8_R=y
172CONFIG_NLS_KOI8_U=y
173CONFIG_NLS_UTF8=y
174CONFIG_PRINTK_TIME=y
175CONFIG_DEBUG_INFO=y
176CONFIG_STRIP_ASM_SYMS=y
177CONFIG_READABLE_ASM=y
178CONFIG_DEBUG_KMEMLEAK=y
179CONFIG_DEBUG_MEMORY_INIT=y
180CONFIG_DEBUG_STACKOVERFLOW=y
181CONFIG_PANIC_ON_OOPS=y
182# CONFIG_FTRACE is not set
183CONFIG_KGDB=y
184CONFIG_RUNTIME_DEBUG=y
185CONFIG_CRYPTO_ZLIB=y
186# CONFIG_CRYPTO_ANSI_CPRNG is not set
187CONFIG_FONTS=y
188CONFIG_FONT_SUN8x16=y
diff --git a/arch/mips/configs/rb532_defconfig b/arch/mips/configs/rb532_defconfig
index b85b121397c8..5d9d708e12e5 100644
--- a/arch/mips/configs/rb532_defconfig
+++ b/arch/mips/configs/rb532_defconfig
@@ -114,7 +114,6 @@ CONFIG_NET_CLS_IND=y
114CONFIG_HAMRADIO=y 114CONFIG_HAMRADIO=y
115CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 115CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
116CONFIG_MTD=y 116CONFIG_MTD=y
117CONFIG_MTD_PARTITIONS=y
118CONFIG_MTD_CHAR=y 117CONFIG_MTD_CHAR=y
119CONFIG_MTD_BLOCK=y 118CONFIG_MTD_BLOCK=y
120CONFIG_MTD_BLOCK2MTD=y 119CONFIG_MTD_BLOCK2MTD=y
diff --git a/arch/mips/configs/rbtx49xx_defconfig b/arch/mips/configs/rbtx49xx_defconfig
index 9cba856277ff..f8bf9b4c1343 100644
--- a/arch/mips/configs/rbtx49xx_defconfig
+++ b/arch/mips/configs/rbtx49xx_defconfig
@@ -35,7 +35,6 @@ CONFIG_IP_PNP=y
35# CONFIG_IPV6 is not set 35# CONFIG_IPV6 is not set
36# CONFIG_WIRELESS is not set 36# CONFIG_WIRELESS is not set
37CONFIG_MTD=y 37CONFIG_MTD=y
38CONFIG_MTD_PARTITIONS=y
39CONFIG_MTD_CMDLINE_PARTS=y 38CONFIG_MTD_CMDLINE_PARTS=y
40CONFIG_MTD_CHAR=y 39CONFIG_MTD_CHAR=y
41CONFIG_MTD_BLOCK=m 40CONFIG_MTD_BLOCK=m
diff --git a/arch/mips/fw/arc/file.c b/arch/mips/fw/arc/file.c
index a8b08032348f..49fd3ff13fe5 100644
--- a/arch/mips/fw/arc/file.c
+++ b/arch/mips/fw/arc/file.c
@@ -8,7 +8,6 @@
8 * Copyright (C) 1994, 1995, 1996, 1999 Ralf Baechle 8 * Copyright (C) 1994, 1995, 1996, 1999 Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc. 9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 */ 10 */
11#include <linux/init.h>
12 11
13#include <asm/fw/arc/types.h> 12#include <asm/fw/arc/types.h>
14#include <asm/sgialib.h> 13#include <asm/sgialib.h>
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 1acbb8b77a71..2d7f65052c1f 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -14,3 +14,4 @@ generic-y += trace_clock.h
14generic-y += preempt.h 14generic-y += preempt.h
15generic-y += ucontext.h 15generic-y += ucontext.h
16generic-y += xor.h 16generic-y += xor.h
17generic-y += hash.h
diff --git a/arch/mips/include/asm/amon.h b/arch/mips/include/asm/amon.h
index c3dc1a68dd8d..3cc03c64a9c7 100644
--- a/arch/mips/include/asm/amon.h
+++ b/arch/mips/include/asm/amon.h
@@ -1,7 +1,12 @@
1/* 1/*
2 * Amon support 2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Imagination Technologies Ltd.
7 *
8 * Arbitrary Monitor Support (AMON)
3 */ 9 */
4 10int amon_cpu_avail(int cpu);
5int amon_cpu_avail(int); 11int amon_cpu_start(int cpu, unsigned long pc, unsigned long sp,
6void amon_cpu_start(int, unsigned long, unsigned long, 12 unsigned long gp, unsigned long a0);
7 unsigned long, unsigned long);
diff --git a/arch/mips/include/asm/asmmacro-32.h b/arch/mips/include/asm/asmmacro-32.h
index 2413afe21b33..70e1f176f123 100644
--- a/arch/mips/include/asm/asmmacro-32.h
+++ b/arch/mips/include/asm/asmmacro-32.h
@@ -12,27 +12,6 @@
12#include <asm/fpregdef.h> 12#include <asm/fpregdef.h>
13#include <asm/mipsregs.h> 13#include <asm/mipsregs.h>
14 14
15 .macro fpu_save_double thread status tmp1=t0
16 cfc1 \tmp1, fcr31
17 sdc1 $f0, THREAD_FPR0(\thread)
18 sdc1 $f2, THREAD_FPR2(\thread)
19 sdc1 $f4, THREAD_FPR4(\thread)
20 sdc1 $f6, THREAD_FPR6(\thread)
21 sdc1 $f8, THREAD_FPR8(\thread)
22 sdc1 $f10, THREAD_FPR10(\thread)
23 sdc1 $f12, THREAD_FPR12(\thread)
24 sdc1 $f14, THREAD_FPR14(\thread)
25 sdc1 $f16, THREAD_FPR16(\thread)
26 sdc1 $f18, THREAD_FPR18(\thread)
27 sdc1 $f20, THREAD_FPR20(\thread)
28 sdc1 $f22, THREAD_FPR22(\thread)
29 sdc1 $f24, THREAD_FPR24(\thread)
30 sdc1 $f26, THREAD_FPR26(\thread)
31 sdc1 $f28, THREAD_FPR28(\thread)
32 sdc1 $f30, THREAD_FPR30(\thread)
33 sw \tmp1, THREAD_FCR31(\thread)
34 .endm
35
36 .macro fpu_save_single thread tmp=t0 15 .macro fpu_save_single thread tmp=t0
37 cfc1 \tmp, fcr31 16 cfc1 \tmp, fcr31
38 swc1 $f0, THREAD_FPR0(\thread) 17 swc1 $f0, THREAD_FPR0(\thread)
@@ -70,27 +49,6 @@
70 sw \tmp, THREAD_FCR31(\thread) 49 sw \tmp, THREAD_FCR31(\thread)
71 .endm 50 .endm
72 51
73 .macro fpu_restore_double thread status tmp=t0
74 lw \tmp, THREAD_FCR31(\thread)
75 ldc1 $f0, THREAD_FPR0(\thread)
76 ldc1 $f2, THREAD_FPR2(\thread)
77 ldc1 $f4, THREAD_FPR4(\thread)
78 ldc1 $f6, THREAD_FPR6(\thread)
79 ldc1 $f8, THREAD_FPR8(\thread)
80 ldc1 $f10, THREAD_FPR10(\thread)
81 ldc1 $f12, THREAD_FPR12(\thread)
82 ldc1 $f14, THREAD_FPR14(\thread)
83 ldc1 $f16, THREAD_FPR16(\thread)
84 ldc1 $f18, THREAD_FPR18(\thread)
85 ldc1 $f20, THREAD_FPR20(\thread)
86 ldc1 $f22, THREAD_FPR22(\thread)
87 ldc1 $f24, THREAD_FPR24(\thread)
88 ldc1 $f26, THREAD_FPR26(\thread)
89 ldc1 $f28, THREAD_FPR28(\thread)
90 ldc1 $f30, THREAD_FPR30(\thread)
91 ctc1 \tmp, fcr31
92 .endm
93
94 .macro fpu_restore_single thread tmp=t0 52 .macro fpu_restore_single thread tmp=t0
95 lw \tmp, THREAD_FCR31(\thread) 53 lw \tmp, THREAD_FCR31(\thread)
96 lwc1 $f0, THREAD_FPR0(\thread) 54 lwc1 $f0, THREAD_FPR0(\thread)
diff --git a/arch/mips/include/asm/asmmacro-64.h b/arch/mips/include/asm/asmmacro-64.h
index 08a527dfe4a3..38ea609465b1 100644
--- a/arch/mips/include/asm/asmmacro-64.h
+++ b/arch/mips/include/asm/asmmacro-64.h
@@ -13,102 +13,6 @@
13#include <asm/fpregdef.h> 13#include <asm/fpregdef.h>
14#include <asm/mipsregs.h> 14#include <asm/mipsregs.h>
15 15
16 .macro fpu_save_16even thread tmp=t0
17 cfc1 \tmp, fcr31
18 sdc1 $f0, THREAD_FPR0(\thread)
19 sdc1 $f2, THREAD_FPR2(\thread)
20 sdc1 $f4, THREAD_FPR4(\thread)
21 sdc1 $f6, THREAD_FPR6(\thread)
22 sdc1 $f8, THREAD_FPR8(\thread)
23 sdc1 $f10, THREAD_FPR10(\thread)
24 sdc1 $f12, THREAD_FPR12(\thread)
25 sdc1 $f14, THREAD_FPR14(\thread)
26 sdc1 $f16, THREAD_FPR16(\thread)
27 sdc1 $f18, THREAD_FPR18(\thread)
28 sdc1 $f20, THREAD_FPR20(\thread)
29 sdc1 $f22, THREAD_FPR22(\thread)
30 sdc1 $f24, THREAD_FPR24(\thread)
31 sdc1 $f26, THREAD_FPR26(\thread)
32 sdc1 $f28, THREAD_FPR28(\thread)
33 sdc1 $f30, THREAD_FPR30(\thread)
34 sw \tmp, THREAD_FCR31(\thread)
35 .endm
36
37 .macro fpu_save_16odd thread
38 sdc1 $f1, THREAD_FPR1(\thread)
39 sdc1 $f3, THREAD_FPR3(\thread)
40 sdc1 $f5, THREAD_FPR5(\thread)
41 sdc1 $f7, THREAD_FPR7(\thread)
42 sdc1 $f9, THREAD_FPR9(\thread)
43 sdc1 $f11, THREAD_FPR11(\thread)
44 sdc1 $f13, THREAD_FPR13(\thread)
45 sdc1 $f15, THREAD_FPR15(\thread)
46 sdc1 $f17, THREAD_FPR17(\thread)
47 sdc1 $f19, THREAD_FPR19(\thread)
48 sdc1 $f21, THREAD_FPR21(\thread)
49 sdc1 $f23, THREAD_FPR23(\thread)
50 sdc1 $f25, THREAD_FPR25(\thread)
51 sdc1 $f27, THREAD_FPR27(\thread)
52 sdc1 $f29, THREAD_FPR29(\thread)
53 sdc1 $f31, THREAD_FPR31(\thread)
54 .endm
55
56 .macro fpu_save_double thread status tmp
57 sll \tmp, \status, 5
58 bgez \tmp, 2f
59 fpu_save_16odd \thread
602:
61 fpu_save_16even \thread \tmp
62 .endm
63
64 .macro fpu_restore_16even thread tmp=t0
65 lw \tmp, THREAD_FCR31(\thread)
66 ldc1 $f0, THREAD_FPR0(\thread)
67 ldc1 $f2, THREAD_FPR2(\thread)
68 ldc1 $f4, THREAD_FPR4(\thread)
69 ldc1 $f6, THREAD_FPR6(\thread)
70 ldc1 $f8, THREAD_FPR8(\thread)
71 ldc1 $f10, THREAD_FPR10(\thread)
72 ldc1 $f12, THREAD_FPR12(\thread)
73 ldc1 $f14, THREAD_FPR14(\thread)
74 ldc1 $f16, THREAD_FPR16(\thread)
75 ldc1 $f18, THREAD_FPR18(\thread)
76 ldc1 $f20, THREAD_FPR20(\thread)
77 ldc1 $f22, THREAD_FPR22(\thread)
78 ldc1 $f24, THREAD_FPR24(\thread)
79 ldc1 $f26, THREAD_FPR26(\thread)
80 ldc1 $f28, THREAD_FPR28(\thread)
81 ldc1 $f30, THREAD_FPR30(\thread)
82 ctc1 \tmp, fcr31
83 .endm
84
85 .macro fpu_restore_16odd thread
86 ldc1 $f1, THREAD_FPR1(\thread)
87 ldc1 $f3, THREAD_FPR3(\thread)
88 ldc1 $f5, THREAD_FPR5(\thread)
89 ldc1 $f7, THREAD_FPR7(\thread)
90 ldc1 $f9, THREAD_FPR9(\thread)
91 ldc1 $f11, THREAD_FPR11(\thread)
92 ldc1 $f13, THREAD_FPR13(\thread)
93 ldc1 $f15, THREAD_FPR15(\thread)
94 ldc1 $f17, THREAD_FPR17(\thread)
95 ldc1 $f19, THREAD_FPR19(\thread)
96 ldc1 $f21, THREAD_FPR21(\thread)
97 ldc1 $f23, THREAD_FPR23(\thread)
98 ldc1 $f25, THREAD_FPR25(\thread)
99 ldc1 $f27, THREAD_FPR27(\thread)
100 ldc1 $f29, THREAD_FPR29(\thread)
101 ldc1 $f31, THREAD_FPR31(\thread)
102 .endm
103
104 .macro fpu_restore_double thread status tmp
105 sll \tmp, \status, 5
106 bgez \tmp, 1f # 16 register mode?
107
108 fpu_restore_16odd \thread
1091: fpu_restore_16even \thread \tmp
110 .endm
111
112 .macro cpu_save_nonscratch thread 16 .macro cpu_save_nonscratch thread
113 LONG_S s0, THREAD_REG16(\thread) 17 LONG_S s0, THREAD_REG16(\thread)
114 LONG_S s1, THREAD_REG17(\thread) 18 LONG_S s1, THREAD_REG17(\thread)
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index 6c8342ae74db..3220c93ea981 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -62,6 +62,113 @@
62 .endm 62 .endm
63#endif /* CONFIG_MIPS_MT_SMTC */ 63#endif /* CONFIG_MIPS_MT_SMTC */
64 64
65 .macro fpu_save_16even thread tmp=t0
66 cfc1 \tmp, fcr31
67 sdc1 $f0, THREAD_FPR0(\thread)
68 sdc1 $f2, THREAD_FPR2(\thread)
69 sdc1 $f4, THREAD_FPR4(\thread)
70 sdc1 $f6, THREAD_FPR6(\thread)
71 sdc1 $f8, THREAD_FPR8(\thread)
72 sdc1 $f10, THREAD_FPR10(\thread)
73 sdc1 $f12, THREAD_FPR12(\thread)
74 sdc1 $f14, THREAD_FPR14(\thread)
75 sdc1 $f16, THREAD_FPR16(\thread)
76 sdc1 $f18, THREAD_FPR18(\thread)
77 sdc1 $f20, THREAD_FPR20(\thread)
78 sdc1 $f22, THREAD_FPR22(\thread)
79 sdc1 $f24, THREAD_FPR24(\thread)
80 sdc1 $f26, THREAD_FPR26(\thread)
81 sdc1 $f28, THREAD_FPR28(\thread)
82 sdc1 $f30, THREAD_FPR30(\thread)
83 sw \tmp, THREAD_FCR31(\thread)
84 .endm
85
86 .macro fpu_save_16odd thread
87 .set push
88 .set mips64r2
89 sdc1 $f1, THREAD_FPR1(\thread)
90 sdc1 $f3, THREAD_FPR3(\thread)
91 sdc1 $f5, THREAD_FPR5(\thread)
92 sdc1 $f7, THREAD_FPR7(\thread)
93 sdc1 $f9, THREAD_FPR9(\thread)
94 sdc1 $f11, THREAD_FPR11(\thread)
95 sdc1 $f13, THREAD_FPR13(\thread)
96 sdc1 $f15, THREAD_FPR15(\thread)
97 sdc1 $f17, THREAD_FPR17(\thread)
98 sdc1 $f19, THREAD_FPR19(\thread)
99 sdc1 $f21, THREAD_FPR21(\thread)
100 sdc1 $f23, THREAD_FPR23(\thread)
101 sdc1 $f25, THREAD_FPR25(\thread)
102 sdc1 $f27, THREAD_FPR27(\thread)
103 sdc1 $f29, THREAD_FPR29(\thread)
104 sdc1 $f31, THREAD_FPR31(\thread)
105 .set pop
106 .endm
107
108 .macro fpu_save_double thread status tmp
109#if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2)
110 sll \tmp, \status, 5
111 bgez \tmp, 10f
112 fpu_save_16odd \thread
11310:
114#endif
115 fpu_save_16even \thread \tmp
116 .endm
117
118 .macro fpu_restore_16even thread tmp=t0
119 lw \tmp, THREAD_FCR31(\thread)
120 ldc1 $f0, THREAD_FPR0(\thread)
121 ldc1 $f2, THREAD_FPR2(\thread)
122 ldc1 $f4, THREAD_FPR4(\thread)
123 ldc1 $f6, THREAD_FPR6(\thread)
124 ldc1 $f8, THREAD_FPR8(\thread)
125 ldc1 $f10, THREAD_FPR10(\thread)
126 ldc1 $f12, THREAD_FPR12(\thread)
127 ldc1 $f14, THREAD_FPR14(\thread)
128 ldc1 $f16, THREAD_FPR16(\thread)
129 ldc1 $f18, THREAD_FPR18(\thread)
130 ldc1 $f20, THREAD_FPR20(\thread)
131 ldc1 $f22, THREAD_FPR22(\thread)
132 ldc1 $f24, THREAD_FPR24(\thread)
133 ldc1 $f26, THREAD_FPR26(\thread)
134 ldc1 $f28, THREAD_FPR28(\thread)
135 ldc1 $f30, THREAD_FPR30(\thread)
136 ctc1 \tmp, fcr31
137 .endm
138
139 .macro fpu_restore_16odd thread
140 .set push
141 .set mips64r2
142 ldc1 $f1, THREAD_FPR1(\thread)
143 ldc1 $f3, THREAD_FPR3(\thread)
144 ldc1 $f5, THREAD_FPR5(\thread)
145 ldc1 $f7, THREAD_FPR7(\thread)
146 ldc1 $f9, THREAD_FPR9(\thread)
147 ldc1 $f11, THREAD_FPR11(\thread)
148 ldc1 $f13, THREAD_FPR13(\thread)
149 ldc1 $f15, THREAD_FPR15(\thread)
150 ldc1 $f17, THREAD_FPR17(\thread)
151 ldc1 $f19, THREAD_FPR19(\thread)
152 ldc1 $f21, THREAD_FPR21(\thread)
153 ldc1 $f23, THREAD_FPR23(\thread)
154 ldc1 $f25, THREAD_FPR25(\thread)
155 ldc1 $f27, THREAD_FPR27(\thread)
156 ldc1 $f29, THREAD_FPR29(\thread)
157 ldc1 $f31, THREAD_FPR31(\thread)
158 .set pop
159 .endm
160
161 .macro fpu_restore_double thread status tmp
162#if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2)
163 sll \tmp, \status, 5
164 bgez \tmp, 10f # 16 register mode?
165
166 fpu_restore_16odd \thread
16710:
168#endif
169 fpu_restore_16even \thread \tmp
170 .endm
171
65/* 172/*
66 * Temporary until all gas have MT ASE support 173 * Temporary until all gas have MT ASE support
67 */ 174 */
diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
index 27bd060d716e..cbaccebf5065 100644
--- a/arch/mips/include/asm/bmips.h
+++ b/arch/mips/include/asm/bmips.h
@@ -46,8 +46,35 @@
46 46
47#include <linux/cpumask.h> 47#include <linux/cpumask.h>
48#include <asm/r4kcache.h> 48#include <asm/r4kcache.h>
49#include <asm/smp-ops.h>
50
51extern struct plat_smp_ops bmips43xx_smp_ops;
52extern struct plat_smp_ops bmips5000_smp_ops;
53
54static inline int register_bmips_smp_ops(void)
55{
56#if IS_ENABLED(CONFIG_CPU_BMIPS) && IS_ENABLED(CONFIG_SMP)
57 switch (current_cpu_type()) {
58 case CPU_BMIPS32:
59 case CPU_BMIPS3300:
60 return register_up_smp_ops();
61 case CPU_BMIPS4350:
62 case CPU_BMIPS4380:
63 register_smp_ops(&bmips43xx_smp_ops);
64 break;
65 case CPU_BMIPS5000:
66 register_smp_ops(&bmips5000_smp_ops);
67 break;
68 default:
69 return -ENODEV;
70 }
71
72 return 0;
73#else
74 return -ENODEV;
75#endif
76}
49 77
50extern struct plat_smp_ops bmips_smp_ops;
51extern char bmips_reset_nmi_vec; 78extern char bmips_reset_nmi_vec;
52extern char bmips_reset_nmi_vec_end; 79extern char bmips_reset_nmi_vec_end;
53extern char bmips_smp_movevec; 80extern char bmips_smp_movevec;
diff --git a/arch/mips/include/asm/clkdev.h b/arch/mips/include/asm/clkdev.h
index 262475414e5f..1b3ad7b09dc1 100644
--- a/arch/mips/include/asm/clkdev.h
+++ b/arch/mips/include/asm/clkdev.h
@@ -14,8 +14,10 @@
14 14
15#include <linux/slab.h> 15#include <linux/slab.h>
16 16
17#ifndef CONFIG_COMMON_CLK
17#define __clk_get(clk) ({ 1; }) 18#define __clk_get(clk) ({ 1; })
18#define __clk_put(clk) do { } while (0) 19#define __clk_put(clk) do { } while (0)
20#endif
19 21
20static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) 22static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
21{ 23{
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index d445d060e346..6e70b03b6aab 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -20,6 +20,13 @@
20#ifndef cpu_has_tlb 20#ifndef cpu_has_tlb
21#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB) 21#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB)
22#endif 22#endif
23#ifndef cpu_has_tlbinv
24#define cpu_has_tlbinv (cpu_data[0].options & MIPS_CPU_TLBINV)
25#endif
26#ifndef cpu_has_segments
27#define cpu_has_segments (cpu_data[0].options & MIPS_CPU_SEGMENTS)
28#endif
29
23 30
24/* 31/*
25 * For the moment we don't consider R6000 and R8000 so we can assume that 32 * For the moment we don't consider R6000 and R8000 so we can assume that
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
index 21c8e29c8f91..8f7adf0ac1e3 100644
--- a/arch/mips/include/asm/cpu-info.h
+++ b/arch/mips/include/asm/cpu-info.h
@@ -52,6 +52,9 @@ struct cpuinfo_mips {
52 unsigned int cputype; 52 unsigned int cputype;
53 int isa_level; 53 int isa_level;
54 int tlbsize; 54 int tlbsize;
55 int tlbsizevtlb;
56 int tlbsizeftlbsets;
57 int tlbsizeftlbways;
55 struct cache_desc icache; /* Primary I-cache */ 58 struct cache_desc icache; /* Primary I-cache */
56 struct cache_desc dcache; /* Primary D or combined I/D cache */ 59 struct cache_desc dcache; /* Primary D or combined I/D cache */
57 struct cache_desc scache; /* Secondary cache */ 60 struct cache_desc scache; /* Secondary cache */
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h
index 4a402cc60c03..02f591bd95ca 100644
--- a/arch/mips/include/asm/cpu-type.h
+++ b/arch/mips/include/asm/cpu-type.h
@@ -27,10 +27,7 @@ static inline int __pure __get_cpu_type(const int cpu_type)
27#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1 27#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1
28 case CPU_4KC: 28 case CPU_4KC:
29 case CPU_ALCHEMY: 29 case CPU_ALCHEMY:
30 case CPU_BMIPS3300:
31 case CPU_BMIPS4350:
32 case CPU_PR4450: 30 case CPU_PR4450:
33 case CPU_BMIPS32:
34 case CPU_JZRISC: 31 case CPU_JZRISC:
35#endif 32#endif
36 33
@@ -47,6 +44,8 @@ static inline int __pure __get_cpu_type(const int cpu_type)
47 case CPU_74K: 44 case CPU_74K:
48 case CPU_M14KC: 45 case CPU_M14KC:
49 case CPU_M14KEC: 46 case CPU_M14KEC:
47 case CPU_INTERAPTIV:
48 case CPU_PROAPTIV:
50#endif 49#endif
51 50
52#ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1 51#ifdef CONFIG_SYS_HAS_CPU_MIPS64_R1
@@ -163,6 +162,16 @@ static inline int __pure __get_cpu_type(const int cpu_type)
163 case CPU_CAVIUM_OCTEON2: 162 case CPU_CAVIUM_OCTEON2:
164#endif 163#endif
165 164
165#if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \
166 defined (CONFIG_SYS_HAS_CPU_MIPS32_R1)
167 case CPU_BMIPS32:
168 case CPU_BMIPS3300:
169#endif
170
171#ifdef CONFIG_SYS_HAS_CPU_BMIPS4350
172 case CPU_BMIPS4350:
173#endif
174
166#ifdef CONFIG_SYS_HAS_CPU_BMIPS4380 175#ifdef CONFIG_SYS_HAS_CPU_BMIPS4380
167 case CPU_BMIPS4380: 176 case CPU_BMIPS4380:
168#endif 177#endif
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index d2035e16502a..76411df3d971 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -111,6 +111,10 @@
111#define PRID_IMP_1074K 0x9a00 111#define PRID_IMP_1074K 0x9a00
112#define PRID_IMP_M14KC 0x9c00 112#define PRID_IMP_M14KC 0x9c00
113#define PRID_IMP_M14KEC 0x9e00 113#define PRID_IMP_M14KEC 0x9e00
114#define PRID_IMP_INTERAPTIV_UP 0xa000
115#define PRID_IMP_INTERAPTIV_MP 0xa100
116#define PRID_IMP_PROAPTIV_UP 0xa200
117#define PRID_IMP_PROAPTIV_MP 0xa300
114 118
115/* 119/*
116 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE 120 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
@@ -194,6 +198,7 @@
194#define PRID_IMP_NETLOGIC_XLP8XX 0x1000 198#define PRID_IMP_NETLOGIC_XLP8XX 0x1000
195#define PRID_IMP_NETLOGIC_XLP3XX 0x1100 199#define PRID_IMP_NETLOGIC_XLP3XX 0x1100
196#define PRID_IMP_NETLOGIC_XLP2XX 0x1200 200#define PRID_IMP_NETLOGIC_XLP2XX 0x1200
201#define PRID_IMP_NETLOGIC_XLP9XX 0x1500
197 202
198/* 203/*
199 * Particular Revision values for bits 7:0 of the PRId register. 204 * Particular Revision values for bits 7:0 of the PRId register.
@@ -249,6 +254,8 @@
249 254
250#define FPIR_IMP_NONE 0x0000 255#define FPIR_IMP_NONE 0x0000
251 256
257#if !defined(__ASSEMBLY__)
258
252enum cpu_type_enum { 259enum cpu_type_enum {
253 CPU_UNKNOWN, 260 CPU_UNKNOWN,
254 261
@@ -289,7 +296,7 @@ enum cpu_type_enum {
289 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, 296 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
290 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350, 297 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350,
291 CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_LOONGSON1, CPU_M14KC, 298 CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_LOONGSON1, CPU_M14KC,
292 CPU_M14KEC, 299 CPU_M14KEC, CPU_INTERAPTIV, CPU_PROAPTIV,
293 300
294 /* 301 /*
295 * MIPS64 class processors 302 * MIPS64 class processors
@@ -301,6 +308,7 @@ enum cpu_type_enum {
301 CPU_LAST 308 CPU_LAST
302}; 309};
303 310
311#endif /* !__ASSEMBLY */
304 312
305/* 313/*
306 * ISA Level encodings 314 * ISA Level encodings
@@ -348,6 +356,8 @@ enum cpu_type_enum {
348#define MIPS_CPU_PCI 0x00400000 /* CPU has Perf Ctr Int indicator */ 356#define MIPS_CPU_PCI 0x00400000 /* CPU has Perf Ctr Int indicator */
349#define MIPS_CPU_RIXI 0x00800000 /* CPU has TLB Read/eXec Inhibit */ 357#define MIPS_CPU_RIXI 0x00800000 /* CPU has TLB Read/eXec Inhibit */
350#define MIPS_CPU_MICROMIPS 0x01000000 /* CPU has microMIPS capability */ 358#define MIPS_CPU_MICROMIPS 0x01000000 /* CPU has microMIPS capability */
359#define MIPS_CPU_TLBINV 0x02000000 /* CPU supports TLBINV/F */
360#define MIPS_CPU_SEGMENTS 0x04000000 /* CPU supports Segmentation Control registers */
351 361
352/* 362/*
353 * CPU ASE encodings 363 * CPU ASE encodings
diff --git a/arch/mips/include/asm/dma-coherence.h b/arch/mips/include/asm/dma-coherence.h
index 242cbb3ca582..bc5e85d579e6 100644
--- a/arch/mips/include/asm/dma-coherence.h
+++ b/arch/mips/include/asm/dma-coherence.h
@@ -9,7 +9,16 @@
9#ifndef __ASM_DMA_COHERENCE_H 9#ifndef __ASM_DMA_COHERENCE_H
10#define __ASM_DMA_COHERENCE_H 10#define __ASM_DMA_COHERENCE_H
11 11
12#ifdef CONFIG_DMA_MAYBE_COHERENT
12extern int coherentio; 13extern int coherentio;
13extern int hw_coherentio; 14extern int hw_coherentio;
15#else
16#ifdef CONFIG_DMA_COHERENT
17#define coherentio 1
18#else
19#define coherentio 0
20#endif
21#define hw_coherentio 0
22#endif /* CONFIG_DMA_MAYBE_COHERENT */
14 23
15#endif 24#endif
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index a66359ef4ece..d4144056e928 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -36,6 +36,7 @@
36#define EF_MIPS_ABI2 0x00000020 36#define EF_MIPS_ABI2 0x00000020
37#define EF_MIPS_OPTIONS_FIRST 0x00000080 37#define EF_MIPS_OPTIONS_FIRST 0x00000080
38#define EF_MIPS_32BITMODE 0x00000100 38#define EF_MIPS_32BITMODE 0x00000100
39#define EF_MIPS_FP64 0x00000200
39#define EF_MIPS_ABI 0x0000f000 40#define EF_MIPS_ABI 0x0000f000
40#define EF_MIPS_ARCH 0xf0000000 41#define EF_MIPS_ARCH 0xf0000000
41 42
@@ -176,6 +177,18 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
176#ifdef CONFIG_32BIT 177#ifdef CONFIG_32BIT
177 178
178/* 179/*
180 * In order to be sure that we don't attempt to execute an O32 binary which
181 * requires 64 bit FP (FR=1) on a system which does not support it we refuse
182 * to execute any binary which has bits specified by the following macro set
183 * in its ELF header flags.
184 */
185#ifdef CONFIG_MIPS_O32_FP64_SUPPORT
186# define __MIPS_O32_FP64_MUST_BE_ZERO 0
187#else
188# define __MIPS_O32_FP64_MUST_BE_ZERO EF_MIPS_FP64
189#endif
190
191/*
179 * This is used to ensure we don't load something for the wrong architecture. 192 * This is used to ensure we don't load something for the wrong architecture.
180 */ 193 */
181#define elf_check_arch(hdr) \ 194#define elf_check_arch(hdr) \
@@ -192,6 +205,8 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
192 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \ 205 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
193 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \ 206 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
194 __res = 0; \ 207 __res = 0; \
208 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
209 __res = 0; \
195 \ 210 \
196 __res; \ 211 __res; \
197}) 212})
@@ -249,6 +264,11 @@ extern struct mips_abi mips_abi_n32;
249 264
250#define SET_PERSONALITY(ex) \ 265#define SET_PERSONALITY(ex) \
251do { \ 266do { \
267 if ((ex).e_flags & EF_MIPS_FP64) \
268 clear_thread_flag(TIF_32BIT_FPREGS); \
269 else \
270 set_thread_flag(TIF_32BIT_FPREGS); \
271 \
252 if (personality(current->personality) != PER_LINUX) \ 272 if (personality(current->personality) != PER_LINUX) \
253 set_personality(PER_LINUX); \ 273 set_personality(PER_LINUX); \
254 \ 274 \
@@ -271,14 +291,18 @@ do { \
271#endif 291#endif
272 292
273#ifdef CONFIG_MIPS32_O32 293#ifdef CONFIG_MIPS32_O32
274#define __SET_PERSONALITY32_O32() \ 294#define __SET_PERSONALITY32_O32(ex) \
275 do { \ 295 do { \
276 set_thread_flag(TIF_32BIT_REGS); \ 296 set_thread_flag(TIF_32BIT_REGS); \
277 set_thread_flag(TIF_32BIT_ADDR); \ 297 set_thread_flag(TIF_32BIT_ADDR); \
298 \
299 if (!((ex).e_flags & EF_MIPS_FP64)) \
300 set_thread_flag(TIF_32BIT_FPREGS); \
301 \
278 current->thread.abi = &mips_abi_32; \ 302 current->thread.abi = &mips_abi_32; \
279 } while (0) 303 } while (0)
280#else 304#else
281#define __SET_PERSONALITY32_O32() \ 305#define __SET_PERSONALITY32_O32(ex) \
282 do { } while (0) 306 do { } while (0)
283#endif 307#endif
284 308
@@ -289,7 +313,7 @@ do { \
289 ((ex).e_flags & EF_MIPS_ABI) == 0) \ 313 ((ex).e_flags & EF_MIPS_ABI) == 0) \
290 __SET_PERSONALITY32_N32(); \ 314 __SET_PERSONALITY32_N32(); \
291 else \ 315 else \
292 __SET_PERSONALITY32_O32(); \ 316 __SET_PERSONALITY32_O32(ex); \
293} while (0) 317} while (0)
294#else 318#else
295#define __SET_PERSONALITY32(ex) do { } while (0) 319#define __SET_PERSONALITY32(ex) do { } while (0)
@@ -300,6 +324,7 @@ do { \
300 unsigned int p; \ 324 unsigned int p; \
301 \ 325 \
302 clear_thread_flag(TIF_32BIT_REGS); \ 326 clear_thread_flag(TIF_32BIT_REGS); \
327 clear_thread_flag(TIF_32BIT_FPREGS); \
303 clear_thread_flag(TIF_32BIT_ADDR); \ 328 clear_thread_flag(TIF_32BIT_ADDR); \
304 \ 329 \
305 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ 330 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h
index dfaaf493e9d4..8c012af2f451 100644
--- a/arch/mips/include/asm/fixmap.h
+++ b/arch/mips/include/asm/fixmap.h
@@ -71,38 +71,7 @@ enum fixed_addresses {
71#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 71#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
72#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 72#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
73 73
74#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) 74#include <asm-generic/fixmap.h>
75#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
76
77extern void __this_fixmap_does_not_exist(void);
78
79/*
80 * 'index to address' translation. If anyone tries to use the idx
81 * directly without tranlation, we catch the bug with a NULL-deference
82 * kernel oops. Illegal ranges of incoming indices are caught too.
83 */
84static inline unsigned long fix_to_virt(const unsigned int idx)
85{
86 /*
87 * this branch gets completely eliminated after inlining,
88 * except when someone tries to use fixaddr indices in an
89 * illegal way. (such as mixing up address types or using
90 * out-of-range indices).
91 *
92 * If it doesn't get removed, the linker will complain
93 * loudly with a reasonably clear error message..
94 */
95 if (idx >= __end_of_fixed_addresses)
96 __this_fixmap_does_not_exist();
97
98 return __fix_to_virt(idx);
99}
100
101static inline unsigned long virt_to_fix(const unsigned long vaddr)
102{
103 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
104 return __virt_to_fix(vaddr);
105}
106 75
107#define kmap_get_fixmap_pte(vaddr) \ 76#define kmap_get_fixmap_pte(vaddr) \
108 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr)) 77 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr))
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index d088e5db4903..cfe092fc720d 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -33,11 +33,48 @@ extern void _init_fpu(void);
33extern void _save_fp(struct task_struct *); 33extern void _save_fp(struct task_struct *);
34extern void _restore_fp(struct task_struct *); 34extern void _restore_fp(struct task_struct *);
35 35
36#define __enable_fpu() \ 36/*
37do { \ 37 * This enum specifies a mode in which we want the FPU to operate, for cores
38 set_c0_status(ST0_CU1); \ 38 * which implement the Status.FR bit. Note that FPU_32BIT & FPU_64BIT
39 enable_fpu_hazard(); \ 39 * purposefully have the values 0 & 1 respectively, so that an integer value
40} while (0) 40 * of Status.FR can be trivially casted to the corresponding enum fpu_mode.
41 */
42enum fpu_mode {
43 FPU_32BIT = 0, /* FR = 0 */
44 FPU_64BIT, /* FR = 1 */
45 FPU_AS_IS,
46};
47
48static inline int __enable_fpu(enum fpu_mode mode)
49{
50 int fr;
51
52 switch (mode) {
53 case FPU_AS_IS:
54 /* just enable the FPU in its current mode */
55 set_c0_status(ST0_CU1);
56 enable_fpu_hazard();
57 return 0;
58
59 case FPU_64BIT:
60#if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_MIPS64))
61 /* we only have a 32-bit FPU */
62 return SIGFPE;
63#endif
64 /* fall through */
65 case FPU_32BIT:
66 /* set CU1 & change FR appropriately */
67 fr = (int)mode;
68 change_c0_status(ST0_CU1 | ST0_FR, ST0_CU1 | (fr ? ST0_FR : 0));
69 enable_fpu_hazard();
70
71 /* check FR has the desired value */
72 return (!!(read_c0_status() & ST0_FR) == !!fr) ? 0 : SIGFPE;
73
74 default:
75 BUG();
76 }
77}
41 78
42#define __disable_fpu() \ 79#define __disable_fpu() \
43do { \ 80do { \
@@ -45,19 +82,6 @@ do { \
45 disable_fpu_hazard(); \ 82 disable_fpu_hazard(); \
46} while (0) 83} while (0)
47 84
48#define enable_fpu() \
49do { \
50 if (cpu_has_fpu) \
51 __enable_fpu(); \
52} while (0)
53
54#define disable_fpu() \
55do { \
56 if (cpu_has_fpu) \
57 __disable_fpu(); \
58} while (0)
59
60
61#define clear_fpu_owner() clear_thread_flag(TIF_USEDFPU) 85#define clear_fpu_owner() clear_thread_flag(TIF_USEDFPU)
62 86
63static inline int __is_fpu_owner(void) 87static inline int __is_fpu_owner(void)
@@ -70,27 +94,46 @@ static inline int is_fpu_owner(void)
70 return cpu_has_fpu && __is_fpu_owner(); 94 return cpu_has_fpu && __is_fpu_owner();
71} 95}
72 96
73static inline void __own_fpu(void) 97static inline int __own_fpu(void)
74{ 98{
75 __enable_fpu(); 99 enum fpu_mode mode;
100 int ret;
101
102 mode = !test_thread_flag(TIF_32BIT_FPREGS);
103 ret = __enable_fpu(mode);
104 if (ret)
105 return ret;
106
76 KSTK_STATUS(current) |= ST0_CU1; 107 KSTK_STATUS(current) |= ST0_CU1;
108 if (mode == FPU_64BIT)
109 KSTK_STATUS(current) |= ST0_FR;
110 else /* mode == FPU_32BIT */
111 KSTK_STATUS(current) &= ~ST0_FR;
112
77 set_thread_flag(TIF_USEDFPU); 113 set_thread_flag(TIF_USEDFPU);
114 return 0;
78} 115}
79 116
80static inline void own_fpu_inatomic(int restore) 117static inline int own_fpu_inatomic(int restore)
81{ 118{
119 int ret = 0;
120
82 if (cpu_has_fpu && !__is_fpu_owner()) { 121 if (cpu_has_fpu && !__is_fpu_owner()) {
83 __own_fpu(); 122 ret = __own_fpu();
84 if (restore) 123 if (restore && !ret)
85 _restore_fp(current); 124 _restore_fp(current);
86 } 125 }
126 return ret;
87} 127}
88 128
89static inline void own_fpu(int restore) 129static inline int own_fpu(int restore)
90{ 130{
131 int ret;
132
91 preempt_disable(); 133 preempt_disable();
92 own_fpu_inatomic(restore); 134 ret = own_fpu_inatomic(restore);
93 preempt_enable(); 135 preempt_enable();
136 return ret;
94} 137}
95 138
96static inline void lose_fpu(int save) 139static inline void lose_fpu(int save)
@@ -106,16 +149,21 @@ static inline void lose_fpu(int save)
106 preempt_enable(); 149 preempt_enable();
107} 150}
108 151
109static inline void init_fpu(void) 152static inline int init_fpu(void)
110{ 153{
154 int ret = 0;
155
111 preempt_disable(); 156 preempt_disable();
112 if (cpu_has_fpu) { 157 if (cpu_has_fpu) {
113 __own_fpu(); 158 ret = __own_fpu();
114 _init_fpu(); 159 if (!ret)
160 _init_fpu();
115 } else { 161 } else {
116 fpu_emulator_init_fpu(); 162 fpu_emulator_init_fpu();
117 } 163 }
164
118 preempt_enable(); 165 preempt_enable();
166 return ret;
119} 167}
120 168
121static inline void save_fp(struct task_struct *tsk) 169static inline void save_fp(struct task_struct *tsk)
diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h
index b0dd0c84df70..572e63ec2a38 100644
--- a/arch/mips/include/asm/highmem.h
+++ b/arch/mips/include/asm/highmem.h
@@ -19,7 +19,6 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#include <linux/init.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
24#include <linux/uaccess.h> 23#include <linux/uaccess.h>
25#include <asm/kmap_types.h> 24#include <asm/kmap_types.h>
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index 32966969f2f9..a995fce87791 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -391,9 +391,6 @@ struct kvm_vcpu_arch {
391 uint32_t guest_kernel_asid[NR_CPUS]; 391 uint32_t guest_kernel_asid[NR_CPUS];
392 struct mm_struct guest_kernel_mm, guest_user_mm; 392 struct mm_struct guest_kernel_mm, guest_user_mm;
393 393
394 struct kvm_mips_tlb shadow_tlb[NR_CPUS][KVM_MIPS_GUEST_TLB_SIZE];
395
396
397 struct hrtimer comparecount_timer; 394 struct hrtimer comparecount_timer;
398 395
399 int last_sched_cpu; 396 int last_sched_cpu;
@@ -529,7 +526,6 @@ extern enum emulation_result kvm_mips_handle_tlbmod(unsigned long cause,
529 526
530extern void kvm_mips_dump_host_tlbs(void); 527extern void kvm_mips_dump_host_tlbs(void);
531extern void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu); 528extern void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu);
532extern void kvm_mips_dump_shadow_tlbs(struct kvm_vcpu *vcpu);
533extern void kvm_mips_flush_host_tlb(int skip_kseg0); 529extern void kvm_mips_flush_host_tlb(int skip_kseg0);
534extern int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long entryhi); 530extern int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long entryhi);
535extern int kvm_mips_host_tlb_inv_index(struct kvm_vcpu *vcpu, int index); 531extern int kvm_mips_host_tlb_inv_index(struct kvm_vcpu *vcpu, int index);
@@ -541,10 +537,7 @@ extern unsigned long kvm_mips_translate_guest_kseg0_to_hpa(struct kvm_vcpu *vcpu
541 unsigned long gva); 537 unsigned long gva);
542extern void kvm_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu, 538extern void kvm_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu,
543 struct kvm_vcpu *vcpu); 539 struct kvm_vcpu *vcpu);
544extern void kvm_shadow_tlb_put(struct kvm_vcpu *vcpu);
545extern void kvm_shadow_tlb_load(struct kvm_vcpu *vcpu);
546extern void kvm_local_flush_tlb_all(void); 540extern void kvm_local_flush_tlb_all(void);
547extern void kvm_mips_init_shadow_tlb(struct kvm_vcpu *vcpu);
548extern void kvm_mips_alloc_new_mmu_context(struct kvm_vcpu *vcpu); 541extern void kvm_mips_alloc_new_mmu_context(struct kvm_vcpu *vcpu);
549extern void kvm_mips_vcpu_load(struct kvm_vcpu *vcpu, int cpu); 542extern void kvm_mips_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
550extern void kvm_mips_vcpu_put(struct kvm_vcpu *vcpu); 543extern void kvm_mips_vcpu_put(struct kvm_vcpu *vcpu);
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
index b86a1253a5bf..cd41e93bc1d8 100644
--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
@@ -16,7 +16,6 @@
16#define __ASM_MACH_AR71XX_REGS_H 16#define __ASM_MACH_AR71XX_REGS_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/init.h>
20#include <linux/io.h> 19#include <linux/io.h>
21#include <linux/bitops.h> 20#include <linux/bitops.h>
22 21
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
index cc7563ba1cbf..7527c1d33d02 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -56,4 +56,6 @@ void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
56 const char *prefix); 56 const char *prefix);
57#endif 57#endif
58 58
59void bcm47xx_set_system_type(u16 chip_id);
60
59#endif /* __ASM_BCM47XX_H */ 61#endif /* __ASM_BCM47XX_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
index 00867dd05a69..40005fb39618 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -66,6 +66,7 @@ enum bcm47xx_board {
66 BCM47XX_BOARD_LINKSYS_WRT310NV1, 66 BCM47XX_BOARD_LINKSYS_WRT310NV1,
67 BCM47XX_BOARD_LINKSYS_WRT310NV2, 67 BCM47XX_BOARD_LINKSYS_WRT310NV2,
68 BCM47XX_BOARD_LINKSYS_WRT54G3GV2, 68 BCM47XX_BOARD_LINKSYS_WRT54G3GV2,
69 BCM47XX_BOARD_LINKSYS_WRT54GSV1,
69 BCM47XX_BOARD_LINKSYS_WRT610NV1, 70 BCM47XX_BOARD_LINKSYS_WRT610NV1,
70 BCM47XX_BOARD_LINKSYS_WRT610NV2, 71 BCM47XX_BOARD_LINKSYS_WRT610NV2,
71 BCM47XX_BOARD_LINKSYS_WRTSL54GS, 72 BCM47XX_BOARD_LINKSYS_WRTSL54GS,
diff --git a/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
new file mode 100644
index 000000000000..b7992cd4aaf9
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
@@ -0,0 +1,82 @@
1#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
2#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
3
4#define cpu_has_tlb 1
5#define cpu_has_4kex 1
6#define cpu_has_3k_cache 0
7#define cpu_has_4k_cache 1
8#define cpu_has_tx39_cache 0
9#define cpu_has_fpu 0
10#define cpu_has_32fpr 0
11#define cpu_has_counter 1
12#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
13#define cpu_has_watch 1
14#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
15#define cpu_has_watch 0
16#endif
17#define cpu_has_divec 1
18#define cpu_has_vce 0
19#define cpu_has_cache_cdex_p 0
20#define cpu_has_cache_cdex_s 0
21#define cpu_has_prefetch 1
22#define cpu_has_mcheck 1
23#define cpu_has_ejtag 1
24#define cpu_has_llsc 1
25
26/* cpu_has_mips16 */
27#define cpu_has_mdmx 0
28#define cpu_has_mips3d 0
29#define cpu_has_rixi 0
30#define cpu_has_mmips 0
31#define cpu_has_smartmips 0
32#define cpu_has_vtag_icache 0
33/* cpu_has_dc_aliases */
34#define cpu_has_ic_fills_f_dc 0
35#define cpu_has_pindexed_dcache 0
36#define cpu_icache_snoops_remote_store 0
37
38#define cpu_has_mips_2 1
39#define cpu_has_mips_3 0
40#define cpu_has_mips32r1 1
41#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
42#define cpu_has_mips32r2 1
43#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
44#define cpu_has_mips32r2 0
45#endif
46#define cpu_has_mips64r1 0
47#define cpu_has_mips64r2 0
48
49#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
50#define cpu_has_dsp 1
51#define cpu_has_dsp2 1
52#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
53#define cpu_has_dsp 0
54#define cpu_has_dsp2 0
55#endif
56#define cpu_has_mipsmt 0
57/* cpu_has_userlocal */
58
59#define cpu_has_nofpuex 0
60#define cpu_has_64bits 0
61#define cpu_has_64bit_zero_reg 0
62#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
63#define cpu_has_vint 1
64#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
65#define cpu_has_vint 0
66#endif
67#define cpu_has_veic 0
68#define cpu_has_inclusive_pcaches 0
69
70#if defined(CONFIG_BCM47XX_BCMA) && !defined(CONFIG_BCM47XX_SSB)
71#define cpu_dcache_line_size() 32
72#define cpu_icache_line_size() 32
73#define cpu_has_perf_cntr_intr_bit 1
74#elif defined(CONFIG_BCM47XX_SSB) && !defined(CONFIG_BCM47XX_BCMA)
75#define cpu_dcache_line_size() 16
76#define cpu_icache_line_size() 16
77#define cpu_has_perf_cntr_intr_bit 0
78#endif
79#define cpu_scache_line_size() 0
80#define cpu_has_vz 0
81
82#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
index 19f9134bfe2f..3112f08f0c72 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -145,6 +145,7 @@ enum bcm63xx_regs_set {
145 RSET_UART1, 145 RSET_UART1,
146 RSET_GPIO, 146 RSET_GPIO,
147 RSET_SPI, 147 RSET_SPI,
148 RSET_HSSPI,
148 RSET_UDC0, 149 RSET_UDC0,
149 RSET_OHCI0, 150 RSET_OHCI0,
150 RSET_OHCI_PRIV, 151 RSET_OHCI_PRIV,
@@ -193,6 +194,7 @@ enum bcm63xx_regs_set {
193#define RSET_ENETDMAS_SIZE(chans) (16 * (chans)) 194#define RSET_ENETDMAS_SIZE(chans) (16 * (chans))
194#define RSET_ENETSW_SIZE 65536 195#define RSET_ENETSW_SIZE 65536
195#define RSET_UART_SIZE 24 196#define RSET_UART_SIZE 24
197#define RSET_HSSPI_SIZE 1536
196#define RSET_UDC_SIZE 256 198#define RSET_UDC_SIZE 256
197#define RSET_OHCI_SIZE 256 199#define RSET_OHCI_SIZE 256
198#define RSET_EHCI_SIZE 256 200#define RSET_EHCI_SIZE 256
@@ -265,6 +267,7 @@ enum bcm63xx_regs_set {
265#define BCM_6328_UART1_BASE (0xb0000120) 267#define BCM_6328_UART1_BASE (0xb0000120)
266#define BCM_6328_GPIO_BASE (0xb0000080) 268#define BCM_6328_GPIO_BASE (0xb0000080)
267#define BCM_6328_SPI_BASE (0xdeadbeef) 269#define BCM_6328_SPI_BASE (0xdeadbeef)
270#define BCM_6328_HSSPI_BASE (0xb0001000)
268#define BCM_6328_UDC0_BASE (0xdeadbeef) 271#define BCM_6328_UDC0_BASE (0xdeadbeef)
269#define BCM_6328_USBDMA_BASE (0xb000c000) 272#define BCM_6328_USBDMA_BASE (0xb000c000)
270#define BCM_6328_OHCI0_BASE (0xb0002600) 273#define BCM_6328_OHCI0_BASE (0xb0002600)
@@ -313,6 +316,7 @@ enum bcm63xx_regs_set {
313#define BCM_6338_UART1_BASE (0xdeadbeef) 316#define BCM_6338_UART1_BASE (0xdeadbeef)
314#define BCM_6338_GPIO_BASE (0xfffe0400) 317#define BCM_6338_GPIO_BASE (0xfffe0400)
315#define BCM_6338_SPI_BASE (0xfffe0c00) 318#define BCM_6338_SPI_BASE (0xfffe0c00)
319#define BCM_6338_HSSPI_BASE (0xdeadbeef)
316#define BCM_6338_UDC0_BASE (0xdeadbeef) 320#define BCM_6338_UDC0_BASE (0xdeadbeef)
317#define BCM_6338_USBDMA_BASE (0xfffe2400) 321#define BCM_6338_USBDMA_BASE (0xfffe2400)
318#define BCM_6338_OHCI0_BASE (0xdeadbeef) 322#define BCM_6338_OHCI0_BASE (0xdeadbeef)
@@ -360,6 +364,7 @@ enum bcm63xx_regs_set {
360#define BCM_6345_UART1_BASE (0xdeadbeef) 364#define BCM_6345_UART1_BASE (0xdeadbeef)
361#define BCM_6345_GPIO_BASE (0xfffe0400) 365#define BCM_6345_GPIO_BASE (0xfffe0400)
362#define BCM_6345_SPI_BASE (0xdeadbeef) 366#define BCM_6345_SPI_BASE (0xdeadbeef)
367#define BCM_6345_HSSPI_BASE (0xdeadbeef)
363#define BCM_6345_UDC0_BASE (0xdeadbeef) 368#define BCM_6345_UDC0_BASE (0xdeadbeef)
364#define BCM_6345_USBDMA_BASE (0xfffe2800) 369#define BCM_6345_USBDMA_BASE (0xfffe2800)
365#define BCM_6345_ENET0_BASE (0xfffe1800) 370#define BCM_6345_ENET0_BASE (0xfffe1800)
@@ -406,6 +411,7 @@ enum bcm63xx_regs_set {
406#define BCM_6348_UART1_BASE (0xdeadbeef) 411#define BCM_6348_UART1_BASE (0xdeadbeef)
407#define BCM_6348_GPIO_BASE (0xfffe0400) 412#define BCM_6348_GPIO_BASE (0xfffe0400)
408#define BCM_6348_SPI_BASE (0xfffe0c00) 413#define BCM_6348_SPI_BASE (0xfffe0c00)
414#define BCM_6348_HSSPI_BASE (0xdeadbeef)
409#define BCM_6348_UDC0_BASE (0xfffe1000) 415#define BCM_6348_UDC0_BASE (0xfffe1000)
410#define BCM_6348_USBDMA_BASE (0xdeadbeef) 416#define BCM_6348_USBDMA_BASE (0xdeadbeef)
411#define BCM_6348_OHCI0_BASE (0xfffe1b00) 417#define BCM_6348_OHCI0_BASE (0xfffe1b00)
@@ -451,6 +457,7 @@ enum bcm63xx_regs_set {
451#define BCM_6358_UART1_BASE (0xfffe0120) 457#define BCM_6358_UART1_BASE (0xfffe0120)
452#define BCM_6358_GPIO_BASE (0xfffe0080) 458#define BCM_6358_GPIO_BASE (0xfffe0080)
453#define BCM_6358_SPI_BASE (0xfffe0800) 459#define BCM_6358_SPI_BASE (0xfffe0800)
460#define BCM_6358_HSSPI_BASE (0xdeadbeef)
454#define BCM_6358_UDC0_BASE (0xfffe0800) 461#define BCM_6358_UDC0_BASE (0xfffe0800)
455#define BCM_6358_USBDMA_BASE (0xdeadbeef) 462#define BCM_6358_USBDMA_BASE (0xdeadbeef)
456#define BCM_6358_OHCI0_BASE (0xfffe1400) 463#define BCM_6358_OHCI0_BASE (0xfffe1400)
@@ -553,6 +560,7 @@ enum bcm63xx_regs_set {
553#define BCM_6368_UART1_BASE (0xb0000120) 560#define BCM_6368_UART1_BASE (0xb0000120)
554#define BCM_6368_GPIO_BASE (0xb0000080) 561#define BCM_6368_GPIO_BASE (0xb0000080)
555#define BCM_6368_SPI_BASE (0xb0000800) 562#define BCM_6368_SPI_BASE (0xb0000800)
563#define BCM_6368_HSSPI_BASE (0xdeadbeef)
556#define BCM_6368_UDC0_BASE (0xdeadbeef) 564#define BCM_6368_UDC0_BASE (0xdeadbeef)
557#define BCM_6368_USBDMA_BASE (0xb0004800) 565#define BCM_6368_USBDMA_BASE (0xb0004800)
558#define BCM_6368_OHCI0_BASE (0xb0001600) 566#define BCM_6368_OHCI0_BASE (0xb0001600)
@@ -604,6 +612,7 @@ extern const unsigned long *bcm63xx_regs_base;
604 __GEN_RSET_BASE(__cpu, UART1) \ 612 __GEN_RSET_BASE(__cpu, UART1) \
605 __GEN_RSET_BASE(__cpu, GPIO) \ 613 __GEN_RSET_BASE(__cpu, GPIO) \
606 __GEN_RSET_BASE(__cpu, SPI) \ 614 __GEN_RSET_BASE(__cpu, SPI) \
615 __GEN_RSET_BASE(__cpu, HSSPI) \
607 __GEN_RSET_BASE(__cpu, UDC0) \ 616 __GEN_RSET_BASE(__cpu, UDC0) \
608 __GEN_RSET_BASE(__cpu, OHCI0) \ 617 __GEN_RSET_BASE(__cpu, OHCI0) \
609 __GEN_RSET_BASE(__cpu, OHCI_PRIV) \ 618 __GEN_RSET_BASE(__cpu, OHCI_PRIV) \
@@ -647,6 +656,7 @@ extern const unsigned long *bcm63xx_regs_base;
647 [RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \ 656 [RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \
648 [RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \ 657 [RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \
649 [RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \ 658 [RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \
659 [RSET_HSSPI] = BCM_## __cpu ##_HSSPI_BASE, \
650 [RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \ 660 [RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \
651 [RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \ 661 [RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \
652 [RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \ 662 [RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \
@@ -727,6 +737,7 @@ enum bcm63xx_irq {
727 IRQ_ENET0, 737 IRQ_ENET0,
728 IRQ_ENET1, 738 IRQ_ENET1,
729 IRQ_ENET_PHY, 739 IRQ_ENET_PHY,
740 IRQ_HSSPI,
730 IRQ_OHCI0, 741 IRQ_OHCI0,
731 IRQ_EHCI0, 742 IRQ_EHCI0,
732 IRQ_USBD, 743 IRQ_USBD,
@@ -815,6 +826,7 @@ enum bcm63xx_irq {
815#define BCM_6328_ENET0_IRQ 0 826#define BCM_6328_ENET0_IRQ 0
816#define BCM_6328_ENET1_IRQ 0 827#define BCM_6328_ENET1_IRQ 0
817#define BCM_6328_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) 828#define BCM_6328_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
829#define BCM_6328_HSSPI_IRQ (IRQ_INTERNAL_BASE + 29)
818#define BCM_6328_OHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 9) 830#define BCM_6328_OHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 9)
819#define BCM_6328_EHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 10) 831#define BCM_6328_EHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 10)
820#define BCM_6328_USBD_IRQ (IRQ_INTERNAL_BASE + 4) 832#define BCM_6328_USBD_IRQ (IRQ_INTERNAL_BASE + 4)
@@ -860,6 +872,7 @@ enum bcm63xx_irq {
860#define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8) 872#define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
861#define BCM_6338_ENET1_IRQ 0 873#define BCM_6338_ENET1_IRQ 0
862#define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9) 874#define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
875#define BCM_6338_HSSPI_IRQ 0
863#define BCM_6338_OHCI0_IRQ 0 876#define BCM_6338_OHCI0_IRQ 0
864#define BCM_6338_EHCI0_IRQ 0 877#define BCM_6338_EHCI0_IRQ 0
865#define BCM_6338_USBD_IRQ 0 878#define BCM_6338_USBD_IRQ 0
@@ -898,6 +911,7 @@ enum bcm63xx_irq {
898#define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8) 911#define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
899#define BCM_6345_ENET1_IRQ 0 912#define BCM_6345_ENET1_IRQ 0
900#define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) 913#define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
914#define BCM_6345_HSSPI_IRQ 0
901#define BCM_6345_OHCI0_IRQ 0 915#define BCM_6345_OHCI0_IRQ 0
902#define BCM_6345_EHCI0_IRQ 0 916#define BCM_6345_EHCI0_IRQ 0
903#define BCM_6345_USBD_IRQ 0 917#define BCM_6345_USBD_IRQ 0
@@ -936,6 +950,7 @@ enum bcm63xx_irq {
936#define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8) 950#define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
937#define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7) 951#define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)
938#define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9) 952#define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
953#define BCM_6348_HSSPI_IRQ 0
939#define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12) 954#define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)
940#define BCM_6348_EHCI0_IRQ 0 955#define BCM_6348_EHCI0_IRQ 0
941#define BCM_6348_USBD_IRQ 0 956#define BCM_6348_USBD_IRQ 0
@@ -974,6 +989,7 @@ enum bcm63xx_irq {
974#define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8) 989#define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
975#define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6) 990#define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
976#define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9) 991#define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
992#define BCM_6358_HSSPI_IRQ 0
977#define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5) 993#define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
978#define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10) 994#define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)
979#define BCM_6358_USBD_IRQ 0 995#define BCM_6358_USBD_IRQ 0
@@ -1086,6 +1102,7 @@ enum bcm63xx_irq {
1086#define BCM_6368_ENET0_IRQ 0 1102#define BCM_6368_ENET0_IRQ 0
1087#define BCM_6368_ENET1_IRQ 0 1103#define BCM_6368_ENET1_IRQ 0
1088#define BCM_6368_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 15) 1104#define BCM_6368_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 15)
1105#define BCM_6368_HSSPI_IRQ 0
1089#define BCM_6368_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5) 1106#define BCM_6368_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)
1090#define BCM_6368_EHCI0_IRQ (IRQ_INTERNAL_BASE + 7) 1107#define BCM_6368_EHCI0_IRQ (IRQ_INTERNAL_BASE + 7)
1091#define BCM_6368_USBD_IRQ (IRQ_INTERNAL_BASE + 8) 1108#define BCM_6368_USBD_IRQ (IRQ_INTERNAL_BASE + 8)
@@ -1133,6 +1150,7 @@ extern const int *bcm63xx_irqs;
1133 [IRQ_ENET0] = BCM_## __cpu ##_ENET0_IRQ, \ 1150 [IRQ_ENET0] = BCM_## __cpu ##_ENET0_IRQ, \
1134 [IRQ_ENET1] = BCM_## __cpu ##_ENET1_IRQ, \ 1151 [IRQ_ENET1] = BCM_## __cpu ##_ENET1_IRQ, \
1135 [IRQ_ENET_PHY] = BCM_## __cpu ##_ENET_PHY_IRQ, \ 1152 [IRQ_ENET_PHY] = BCM_## __cpu ##_ENET_PHY_IRQ, \
1153 [IRQ_HSSPI] = BCM_## __cpu ##_HSSPI_IRQ, \
1136 [IRQ_OHCI0] = BCM_## __cpu ##_OHCI0_IRQ, \ 1154 [IRQ_OHCI0] = BCM_## __cpu ##_OHCI0_IRQ, \
1137 [IRQ_EHCI0] = BCM_## __cpu ##_EHCI0_IRQ, \ 1155 [IRQ_EHCI0] = BCM_## __cpu ##_EHCI0_IRQ, \
1138 [IRQ_USBD] = BCM_## __cpu ##_USBD_IRQ, \ 1156 [IRQ_USBD] = BCM_## __cpu ##_USBD_IRQ, \
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
new file mode 100644
index 000000000000..1b1acafb3d79
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
@@ -0,0 +1,8 @@
1#ifndef BCM63XX_DEV_HSSPI_H
2#define BCM63XX_DEV_HSSPI_H
3
4#include <linux/types.h>
5
6int bcm63xx_hsspi_register(void);
7
8#endif /* BCM63XX_DEV_HSSPI_H */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index 9875db31d883..ab427f8814e6 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -463,126 +463,6 @@
463#define WDT_SOFTRESET_REG 0xc 463#define WDT_SOFTRESET_REG 0xc
464 464
465/************************************************************************* 465/*************************************************************************
466 * _REG relative to RSET_UARTx
467 *************************************************************************/
468
469/* UART Control Register */
470#define UART_CTL_REG 0x0
471#define UART_CTL_RXTMOUTCNT_SHIFT 0
472#define UART_CTL_RXTMOUTCNT_MASK (0x1f << UART_CTL_RXTMOUTCNT_SHIFT)
473#define UART_CTL_RSTTXDN_SHIFT 5
474#define UART_CTL_RSTTXDN_MASK (1 << UART_CTL_RSTTXDN_SHIFT)
475#define UART_CTL_RSTRXFIFO_SHIFT 6
476#define UART_CTL_RSTRXFIFO_MASK (1 << UART_CTL_RSTRXFIFO_SHIFT)
477#define UART_CTL_RSTTXFIFO_SHIFT 7
478#define UART_CTL_RSTTXFIFO_MASK (1 << UART_CTL_RSTTXFIFO_SHIFT)
479#define UART_CTL_STOPBITS_SHIFT 8
480#define UART_CTL_STOPBITS_MASK (0xf << UART_CTL_STOPBITS_SHIFT)
481#define UART_CTL_STOPBITS_1 (0x7 << UART_CTL_STOPBITS_SHIFT)
482#define UART_CTL_STOPBITS_2 (0xf << UART_CTL_STOPBITS_SHIFT)
483#define UART_CTL_BITSPERSYM_SHIFT 12
484#define UART_CTL_BITSPERSYM_MASK (0x3 << UART_CTL_BITSPERSYM_SHIFT)
485#define UART_CTL_XMITBRK_SHIFT 14
486#define UART_CTL_XMITBRK_MASK (1 << UART_CTL_XMITBRK_SHIFT)
487#define UART_CTL_RSVD_SHIFT 15
488#define UART_CTL_RSVD_MASK (1 << UART_CTL_RSVD_SHIFT)
489#define UART_CTL_RXPAREVEN_SHIFT 16
490#define UART_CTL_RXPAREVEN_MASK (1 << UART_CTL_RXPAREVEN_SHIFT)
491#define UART_CTL_RXPAREN_SHIFT 17
492#define UART_CTL_RXPAREN_MASK (1 << UART_CTL_RXPAREN_SHIFT)
493#define UART_CTL_TXPAREVEN_SHIFT 18
494#define UART_CTL_TXPAREVEN_MASK (1 << UART_CTL_TXPAREVEN_SHIFT)
495#define UART_CTL_TXPAREN_SHIFT 18
496#define UART_CTL_TXPAREN_MASK (1 << UART_CTL_TXPAREN_SHIFT)
497#define UART_CTL_LOOPBACK_SHIFT 20
498#define UART_CTL_LOOPBACK_MASK (1 << UART_CTL_LOOPBACK_SHIFT)
499#define UART_CTL_RXEN_SHIFT 21
500#define UART_CTL_RXEN_MASK (1 << UART_CTL_RXEN_SHIFT)
501#define UART_CTL_TXEN_SHIFT 22
502#define UART_CTL_TXEN_MASK (1 << UART_CTL_TXEN_SHIFT)
503#define UART_CTL_BRGEN_SHIFT 23
504#define UART_CTL_BRGEN_MASK (1 << UART_CTL_BRGEN_SHIFT)
505
506/* UART Baudword register */
507#define UART_BAUD_REG 0x4
508
509/* UART Misc Control register */
510#define UART_MCTL_REG 0x8
511#define UART_MCTL_DTR_SHIFT 0
512#define UART_MCTL_DTR_MASK (1 << UART_MCTL_DTR_SHIFT)
513#define UART_MCTL_RTS_SHIFT 1
514#define UART_MCTL_RTS_MASK (1 << UART_MCTL_RTS_SHIFT)
515#define UART_MCTL_RXFIFOTHRESH_SHIFT 8
516#define UART_MCTL_RXFIFOTHRESH_MASK (0xf << UART_MCTL_RXFIFOTHRESH_SHIFT)
517#define UART_MCTL_TXFIFOTHRESH_SHIFT 12
518#define UART_MCTL_TXFIFOTHRESH_MASK (0xf << UART_MCTL_TXFIFOTHRESH_SHIFT)
519#define UART_MCTL_RXFIFOFILL_SHIFT 16
520#define UART_MCTL_RXFIFOFILL_MASK (0x1f << UART_MCTL_RXFIFOFILL_SHIFT)
521#define UART_MCTL_TXFIFOFILL_SHIFT 24
522#define UART_MCTL_TXFIFOFILL_MASK (0x1f << UART_MCTL_TXFIFOFILL_SHIFT)
523
524/* UART External Input Configuration register */
525#define UART_EXTINP_REG 0xc
526#define UART_EXTINP_RI_SHIFT 0
527#define UART_EXTINP_RI_MASK (1 << UART_EXTINP_RI_SHIFT)
528#define UART_EXTINP_CTS_SHIFT 1
529#define UART_EXTINP_CTS_MASK (1 << UART_EXTINP_CTS_SHIFT)
530#define UART_EXTINP_DCD_SHIFT 2
531#define UART_EXTINP_DCD_MASK (1 << UART_EXTINP_DCD_SHIFT)
532#define UART_EXTINP_DSR_SHIFT 3
533#define UART_EXTINP_DSR_MASK (1 << UART_EXTINP_DSR_SHIFT)
534#define UART_EXTINP_IRSTAT(x) (1 << (x + 4))
535#define UART_EXTINP_IRMASK(x) (1 << (x + 8))
536#define UART_EXTINP_IR_RI 0
537#define UART_EXTINP_IR_CTS 1
538#define UART_EXTINP_IR_DCD 2
539#define UART_EXTINP_IR_DSR 3
540#define UART_EXTINP_RI_NOSENSE_SHIFT 16
541#define UART_EXTINP_RI_NOSENSE_MASK (1 << UART_EXTINP_RI_NOSENSE_SHIFT)
542#define UART_EXTINP_CTS_NOSENSE_SHIFT 17
543#define UART_EXTINP_CTS_NOSENSE_MASK (1 << UART_EXTINP_CTS_NOSENSE_SHIFT)
544#define UART_EXTINP_DCD_NOSENSE_SHIFT 18
545#define UART_EXTINP_DCD_NOSENSE_MASK (1 << UART_EXTINP_DCD_NOSENSE_SHIFT)
546#define UART_EXTINP_DSR_NOSENSE_SHIFT 19
547#define UART_EXTINP_DSR_NOSENSE_MASK (1 << UART_EXTINP_DSR_NOSENSE_SHIFT)
548
549/* UART Interrupt register */
550#define UART_IR_REG 0x10
551#define UART_IR_MASK(x) (1 << (x + 16))
552#define UART_IR_STAT(x) (1 << (x))
553#define UART_IR_EXTIP 0
554#define UART_IR_TXUNDER 1
555#define UART_IR_TXOVER 2
556#define UART_IR_TXTRESH 3
557#define UART_IR_TXRDLATCH 4
558#define UART_IR_TXEMPTY 5
559#define UART_IR_RXUNDER 6
560#define UART_IR_RXOVER 7
561#define UART_IR_RXTIMEOUT 8
562#define UART_IR_RXFULL 9
563#define UART_IR_RXTHRESH 10
564#define UART_IR_RXNOTEMPTY 11
565#define UART_IR_RXFRAMEERR 12
566#define UART_IR_RXPARERR 13
567#define UART_IR_RXBRK 14
568#define UART_IR_TXDONE 15
569
570/* UART Fifo register */
571#define UART_FIFO_REG 0x14
572#define UART_FIFO_VALID_SHIFT 0
573#define UART_FIFO_VALID_MASK 0xff
574#define UART_FIFO_FRAMEERR_SHIFT 8
575#define UART_FIFO_FRAMEERR_MASK (1 << UART_FIFO_FRAMEERR_SHIFT)
576#define UART_FIFO_PARERR_SHIFT 9
577#define UART_FIFO_PARERR_MASK (1 << UART_FIFO_PARERR_SHIFT)
578#define UART_FIFO_BRKDET_SHIFT 10
579#define UART_FIFO_BRKDET_MASK (1 << UART_FIFO_BRKDET_SHIFT)
580#define UART_FIFO_ANYERR_MASK (UART_FIFO_FRAMEERR_MASK | \
581 UART_FIFO_PARERR_MASK | \
582 UART_FIFO_BRKDET_MASK)
583
584
585/*************************************************************************
586 * _REG relative to RSET_GPIO 466 * _REG relative to RSET_GPIO
587 *************************************************************************/ 467 *************************************************************************/
588 468
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index a9e8f6b62b0b..7629c35986f7 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -49,11 +49,7 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
49 49
50static inline int plat_device_is_coherent(struct device *dev) 50static inline int plat_device_is_coherent(struct device *dev)
51{ 51{
52#ifdef CONFIG_DMA_COHERENT
53 return 1;
54#else
55 return coherentio; 52 return coherentio;
56#endif
57} 53}
58 54
59#ifdef CONFIG_SWIOTLB 55#ifdef CONFIG_SWIOTLB
diff --git a/arch/mips/include/asm/mach-generic/floppy.h b/arch/mips/include/asm/mach-generic/floppy.h
index 5b5cd689a2f7..e2561d99a3fe 100644
--- a/arch/mips/include/asm/mach-generic/floppy.h
+++ b/arch/mips/include/asm/mach-generic/floppy.h
@@ -9,7 +9,6 @@
9#define __ASM_MACH_GENERIC_FLOPPY_H 9#define __ASM_MACH_GENERIC_FLOPPY_H
10 10
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/ioport.h> 12#include <linux/ioport.h>
14#include <linux/sched.h> 13#include <linux/sched.h>
15#include <linux/linkage.h> 14#include <linux/linkage.h>
diff --git a/arch/mips/include/asm/mach-generic/ide.h b/arch/mips/include/asm/mach-generic/ide.h
index affa66f5c2da..4ae5fbcb15a5 100644
--- a/arch/mips/include/asm/mach-generic/ide.h
+++ b/arch/mips/include/asm/mach-generic/ide.h
@@ -23,7 +23,7 @@
23static inline void __ide_flush_prologue(void) 23static inline void __ide_flush_prologue(void)
24{ 24{
25#ifdef CONFIG_SMP 25#ifdef CONFIG_SMP
26 if (cpu_has_dc_aliases) 26 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
27 preempt_disable(); 27 preempt_disable();
28#endif 28#endif
29} 29}
@@ -31,14 +31,14 @@ static inline void __ide_flush_prologue(void)
31static inline void __ide_flush_epilogue(void) 31static inline void __ide_flush_epilogue(void)
32{ 32{
33#ifdef CONFIG_SMP 33#ifdef CONFIG_SMP
34 if (cpu_has_dc_aliases) 34 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
35 preempt_enable(); 35 preempt_enable();
36#endif 36#endif
37} 37}
38 38
39static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size) 39static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size)
40{ 40{
41 if (cpu_has_dc_aliases) { 41 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) {
42 unsigned long end = addr + size; 42 unsigned long end = addr + size;
43 43
44 while (addr < end) { 44 while (addr < end) {
diff --git a/arch/mips/include/asm/mach-jazz/floppy.h b/arch/mips/include/asm/mach-jazz/floppy.h
index 62aa1e287fba..4b86c88a03b7 100644
--- a/arch/mips/include/asm/mach-jazz/floppy.h
+++ b/arch/mips/include/asm/mach-jazz/floppy.h
@@ -9,7 +9,6 @@
9#define __ASM_MACH_JAZZ_FLOPPY_H 9#define __ASM_MACH_JAZZ_FLOPPY_H
10 10
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/linkage.h> 12#include <linux/linkage.h>
14#include <linux/types.h> 13#include <linux/types.h>
15#include <linux/mm.h> 14#include <linux/mm.h>
diff --git a/arch/mips/include/asm/mach-jz4740/platform.h b/arch/mips/include/asm/mach-jz4740/platform.h
index 05988c2d6565..069b43a9da6f 100644
--- a/arch/mips/include/asm/mach-jz4740/platform.h
+++ b/arch/mips/include/asm/mach-jz4740/platform.h
@@ -21,6 +21,7 @@
21 21
22extern struct platform_device jz4740_usb_ohci_device; 22extern struct platform_device jz4740_usb_ohci_device;
23extern struct platform_device jz4740_udc_device; 23extern struct platform_device jz4740_udc_device;
24extern struct platform_device jz4740_udc_xceiv_device;
24extern struct platform_device jz4740_mmc_device; 25extern struct platform_device jz4740_mmc_device;
25extern struct platform_device jz4740_rtc_device; 26extern struct platform_device jz4740_rtc_device;
26extern struct platform_device jz4740_i2c_device; 27extern struct platform_device jz4740_i2c_device;
diff --git a/arch/mips/include/asm/mach-netlogic/irq.h b/arch/mips/include/asm/mach-netlogic/irq.h
index 868ed8a2ed5c..c0dbd530cca6 100644
--- a/arch/mips/include/asm/mach-netlogic/irq.h
+++ b/arch/mips/include/asm/mach-netlogic/irq.h
@@ -9,7 +9,8 @@
9#define __ASM_NETLOGIC_IRQ_H 9#define __ASM_NETLOGIC_IRQ_H
10 10
11#include <asm/mach-netlogic/multi-node.h> 11#include <asm/mach-netlogic/multi-node.h>
12#define NR_IRQS (64 * NLM_NR_NODES) 12#define NLM_IRQS_PER_NODE 1024
13#define NR_IRQS (NLM_IRQS_PER_NODE * NLM_NR_NODES)
13 14
14#define MIPS_CPU_IRQ_BASE 0 15#define MIPS_CPU_IRQ_BASE 0
15 16
diff --git a/arch/mips/include/asm/mach-netlogic/multi-node.h b/arch/mips/include/asm/mach-netlogic/multi-node.h
index d62fc773f4d7..9ed8dacdc37c 100644
--- a/arch/mips/include/asm/mach-netlogic/multi-node.h
+++ b/arch/mips/include/asm/mach-netlogic/multi-node.h
@@ -47,8 +47,37 @@
47#endif 47#endif
48#endif 48#endif
49 49
50#define NLM_CORES_PER_NODE 8
51#define NLM_THREADS_PER_CORE 4 50#define NLM_THREADS_PER_CORE 4
52#define NLM_CPUS_PER_NODE (NLM_CORES_PER_NODE * NLM_THREADS_PER_CORE) 51#ifdef CONFIG_CPU_XLR
52#define nlm_cores_per_node() 8
53#else
54extern unsigned int xlp_cores_per_node;
55#define nlm_cores_per_node() xlp_cores_per_node
56#endif
57
58#define nlm_threads_per_node() (nlm_cores_per_node() * NLM_THREADS_PER_CORE)
59#define nlm_cpuid_to_node(c) ((c) / nlm_threads_per_node())
60
61struct nlm_soc_info {
62 unsigned long coremask; /* cores enabled on the soc */
63 unsigned long ebase; /* not used now */
64 uint64_t irqmask; /* EIMR for the node */
65 uint64_t sysbase; /* only for XLP - sys block base */
66 uint64_t picbase; /* PIC block base */
67 spinlock_t piclock; /* lock for PIC access */
68 cpumask_t cpumask; /* logical cpu mask for node */
69 unsigned int socbus;
70};
71
72extern struct nlm_soc_info nlm_nodes[NLM_NR_NODES];
73#define nlm_get_node(i) (&nlm_nodes[i])
74#define nlm_node_present(n) ((n) >= 0 && (n) < NLM_NR_NODES && \
75 nlm_get_node(n)->coremask != 0)
76#ifdef CONFIG_CPU_XLR
77#define nlm_current_node() (&nlm_nodes[0])
78#else
79#define nlm_current_node() (&nlm_nodes[nlm_nodeid()])
80#endif
81void nlm_node_init(int node);
53 82
54#endif 83#endif
diff --git a/arch/mips/include/asm/mach-netlogic/topology.h b/arch/mips/include/asm/mach-netlogic/topology.h
new file mode 100644
index 000000000000..0da99fa11c38
--- /dev/null
+++ b/arch/mips/include/asm/mach-netlogic/topology.h
@@ -0,0 +1,20 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Broadcom Corporation
7 */
8#ifndef _ASM_MACH_NETLOGIC_TOPOLOGY_H
9#define _ASM_MACH_NETLOGIC_TOPOLOGY_H
10
11#include <asm/mach-netlogic/multi-node.h>
12
13#define topology_physical_package_id(cpu) cpu_to_node(cpu)
14#define topology_core_id(cpu) (cpu_logical_map(cpu) / NLM_THREADS_PER_CORE)
15#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
16#define topology_core_cpumask(cpu) cpumask_of_node(cpu_to_node(cpu))
17
18#include <asm-generic/topology.h>
19
20#endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/mips-boards/piix4.h b/arch/mips/include/asm/mips-boards/piix4.h
index e33227998713..836e2ede24de 100644
--- a/arch/mips/include/asm/mips-boards/piix4.h
+++ b/arch/mips/include/asm/mips-boards/piix4.h
@@ -26,6 +26,10 @@
26#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_DISABLE (1 << 7) 26#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_DISABLE (1 << 7)
27#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MASK 0xf 27#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MASK 0xf
28#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX 16 28#define PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX 16
29/* SERIRQ Control */
30#define PIIX4_FUNC0_SERIRQC 0x64
31#define PIIX4_FUNC0_SERIRQC_EN (1 << 7)
32#define PIIX4_FUNC0_SERIRQC_CONT (1 << 6)
29/* Top Of Memory */ 33/* Top Of Memory */
30#define PIIX4_FUNC0_TOM 0x69 34#define PIIX4_FUNC0_TOM 0x69
31#define PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK 0xf0 35#define PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK 0xf0
@@ -34,6 +38,9 @@
34#define PIIX4_FUNC0_DLC_USBPR_EN (1 << 2) 38#define PIIX4_FUNC0_DLC_USBPR_EN (1 << 2)
35#define PIIX4_FUNC0_DLC_PASSIVE_RELEASE_EN (1 << 1) 39#define PIIX4_FUNC0_DLC_PASSIVE_RELEASE_EN (1 << 1)
36#define PIIX4_FUNC0_DLC_DELAYED_TRANSACTION_EN (1 << 0) 40#define PIIX4_FUNC0_DLC_DELAYED_TRANSACTION_EN (1 << 0)
41/* General Configuration */
42#define PIIX4_FUNC0_GENCFG 0xb0
43#define PIIX4_FUNC0_GENCFG_SERIRQ (1 << 16)
37 44
38/* IDE Timing */ 45/* IDE Timing */
39#define PIIX4_FUNC1_IDETIM_PRIMARY_LO 0x40 46#define PIIX4_FUNC1_IDETIM_PRIMARY_LO 0x40
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index e0331414c7d6..bbc3dd4294bc 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -14,6 +14,7 @@
14#define _ASM_MIPSREGS_H 14#define _ASM_MIPSREGS_H
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/types.h>
17#include <asm/hazards.h> 18#include <asm/hazards.h>
18#include <asm/war.h> 19#include <asm/war.h>
19 20
@@ -573,7 +574,9 @@
573#define MIPS_CONF1_IA (_ULCAST_(7) << 16) 574#define MIPS_CONF1_IA (_ULCAST_(7) << 16)
574#define MIPS_CONF1_IL (_ULCAST_(7) << 19) 575#define MIPS_CONF1_IL (_ULCAST_(7) << 19)
575#define MIPS_CONF1_IS (_ULCAST_(7) << 22) 576#define MIPS_CONF1_IS (_ULCAST_(7) << 22)
576#define MIPS_CONF1_TLBS (_ULCAST_(63)<< 25) 577#define MIPS_CONF1_TLBS_SHIFT (25)
578#define MIPS_CONF1_TLBS_SIZE (6)
579#define MIPS_CONF1_TLBS (_ULCAST_(63) << MIPS_CONF1_TLBS_SHIFT)
577 580
578#define MIPS_CONF2_SA (_ULCAST_(15)<< 0) 581#define MIPS_CONF2_SA (_ULCAST_(15)<< 0)
579#define MIPS_CONF2_SL (_ULCAST_(15)<< 4) 582#define MIPS_CONF2_SL (_ULCAST_(15)<< 4)
@@ -587,21 +590,53 @@
587#define MIPS_CONF3_TL (_ULCAST_(1) << 0) 590#define MIPS_CONF3_TL (_ULCAST_(1) << 0)
588#define MIPS_CONF3_SM (_ULCAST_(1) << 1) 591#define MIPS_CONF3_SM (_ULCAST_(1) << 1)
589#define MIPS_CONF3_MT (_ULCAST_(1) << 2) 592#define MIPS_CONF3_MT (_ULCAST_(1) << 2)
593#define MIPS_CONF3_CDMM (_ULCAST_(1) << 3)
590#define MIPS_CONF3_SP (_ULCAST_(1) << 4) 594#define MIPS_CONF3_SP (_ULCAST_(1) << 4)
591#define MIPS_CONF3_VINT (_ULCAST_(1) << 5) 595#define MIPS_CONF3_VINT (_ULCAST_(1) << 5)
592#define MIPS_CONF3_VEIC (_ULCAST_(1) << 6) 596#define MIPS_CONF3_VEIC (_ULCAST_(1) << 6)
593#define MIPS_CONF3_LPA (_ULCAST_(1) << 7) 597#define MIPS_CONF3_LPA (_ULCAST_(1) << 7)
598#define MIPS_CONF3_ITL (_ULCAST_(1) << 8)
599#define MIPS_CONF3_CTXTC (_ULCAST_(1) << 9)
594#define MIPS_CONF3_DSP (_ULCAST_(1) << 10) 600#define MIPS_CONF3_DSP (_ULCAST_(1) << 10)
595#define MIPS_CONF3_DSP2P (_ULCAST_(1) << 11) 601#define MIPS_CONF3_DSP2P (_ULCAST_(1) << 11)
596#define MIPS_CONF3_RXI (_ULCAST_(1) << 12) 602#define MIPS_CONF3_RXI (_ULCAST_(1) << 12)
597#define MIPS_CONF3_ULRI (_ULCAST_(1) << 13) 603#define MIPS_CONF3_ULRI (_ULCAST_(1) << 13)
598#define MIPS_CONF3_ISA (_ULCAST_(3) << 14) 604#define MIPS_CONF3_ISA (_ULCAST_(3) << 14)
599#define MIPS_CONF3_ISA_OE (_ULCAST_(1) << 16) 605#define MIPS_CONF3_ISA_OE (_ULCAST_(1) << 16)
606#define MIPS_CONF3_MCU (_ULCAST_(1) << 17)
607#define MIPS_CONF3_MMAR (_ULCAST_(7) << 18)
608#define MIPS_CONF3_IPLW (_ULCAST_(3) << 21)
600#define MIPS_CONF3_VZ (_ULCAST_(1) << 23) 609#define MIPS_CONF3_VZ (_ULCAST_(1) << 23)
601 610#define MIPS_CONF3_PW (_ULCAST_(1) << 24)
611#define MIPS_CONF3_SC (_ULCAST_(1) << 25)
612#define MIPS_CONF3_BI (_ULCAST_(1) << 26)
613#define MIPS_CONF3_BP (_ULCAST_(1) << 27)
614#define MIPS_CONF3_MSA (_ULCAST_(1) << 28)
615#define MIPS_CONF3_CMGCR (_ULCAST_(1) << 29)
616#define MIPS_CONF3_BPG (_ULCAST_(1) << 30)
617
618#define MIPS_CONF4_MMUSIZEEXT_SHIFT (0)
602#define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0) 619#define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0)
620#define MIPS_CONF4_FTLBSETS_SHIFT (0)
621#define MIPS_CONF4_FTLBSETS_SHIFT (0)
622#define MIPS_CONF4_FTLBSETS (_ULCAST_(15) << MIPS_CONF4_FTLBSETS_SHIFT)
623#define MIPS_CONF4_FTLBWAYS_SHIFT (4)
624#define MIPS_CONF4_FTLBWAYS (_ULCAST_(15) << MIPS_CONF4_FTLBWAYS_SHIFT)
625#define MIPS_CONF4_FTLBPAGESIZE_SHIFT (8)
626/* bits 10:8 in FTLB-only configurations */
627#define MIPS_CONF4_FTLBPAGESIZE (_ULCAST_(7) << MIPS_CONF4_FTLBPAGESIZE_SHIFT)
628/* bits 12:8 in VTLB-FTLB only configurations */
629#define MIPS_CONF4_VFTLBPAGESIZE (_ULCAST_(31) << MIPS_CONF4_FTLBPAGESIZE_SHIFT)
603#define MIPS_CONF4_MMUEXTDEF (_ULCAST_(3) << 14) 630#define MIPS_CONF4_MMUEXTDEF (_ULCAST_(3) << 14)
604#define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14) 631#define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14)
632#define MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT (_ULCAST_(2) << 14)
633#define MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT (_ULCAST_(3) << 14)
634#define MIPS_CONF4_KSCREXIST (_ULCAST_(255) << 16)
635#define MIPS_CONF4_VTLBSIZEEXT_SHIFT (24)
636#define MIPS_CONF4_VTLBSIZEEXT (_ULCAST_(15) << MIPS_CONF4_VTLBSIZEEXT_SHIFT)
637#define MIPS_CONF4_AE (_ULCAST_(1) << 28)
638#define MIPS_CONF4_IE (_ULCAST_(3) << 29)
639#define MIPS_CONF4_TLBINV (_ULCAST_(2) << 29)
605 640
606#define MIPS_CONF5_NF (_ULCAST_(1) << 0) 641#define MIPS_CONF5_NF (_ULCAST_(1) << 0)
607#define MIPS_CONF5_UFR (_ULCAST_(1) << 2) 642#define MIPS_CONF5_UFR (_ULCAST_(1) << 2)
@@ -611,11 +646,15 @@
611#define MIPS_CONF5_K (_ULCAST_(1) << 30) 646#define MIPS_CONF5_K (_ULCAST_(1) << 30)
612 647
613#define MIPS_CONF6_SYND (_ULCAST_(1) << 13) 648#define MIPS_CONF6_SYND (_ULCAST_(1) << 13)
649/* proAptiv FTLB on/off bit */
650#define MIPS_CONF6_FTLBEN (_ULCAST_(1) << 15)
614 651
615#define MIPS_CONF7_WII (_ULCAST_(1) << 31) 652#define MIPS_CONF7_WII (_ULCAST_(1) << 31)
616 653
617#define MIPS_CONF7_RPS (_ULCAST_(1) << 2) 654#define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
618 655
656/* EntryHI bit definition */
657#define MIPS_ENTRYHI_EHINV (_ULCAST_(1) << 10)
619 658
620/* 659/*
621 * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register. 660 * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
@@ -628,6 +667,26 @@
628#define MIPS_FPIR_L (_ULCAST_(1) << 21) 667#define MIPS_FPIR_L (_ULCAST_(1) << 21)
629#define MIPS_FPIR_F64 (_ULCAST_(1) << 22) 668#define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
630 669
670/*
671 * Bits in the MIPS32 Memory Segmentation registers.
672 */
673#define MIPS_SEGCFG_PA_SHIFT 9
674#define MIPS_SEGCFG_PA (_ULCAST_(127) << MIPS_SEGCFG_PA_SHIFT)
675#define MIPS_SEGCFG_AM_SHIFT 4
676#define MIPS_SEGCFG_AM (_ULCAST_(7) << MIPS_SEGCFG_AM_SHIFT)
677#define MIPS_SEGCFG_EU_SHIFT 3
678#define MIPS_SEGCFG_EU (_ULCAST_(1) << MIPS_SEGCFG_EU_SHIFT)
679#define MIPS_SEGCFG_C_SHIFT 0
680#define MIPS_SEGCFG_C (_ULCAST_(7) << MIPS_SEGCFG_C_SHIFT)
681
682#define MIPS_SEGCFG_UUSK _ULCAST_(7)
683#define MIPS_SEGCFG_USK _ULCAST_(5)
684#define MIPS_SEGCFG_MUSUK _ULCAST_(4)
685#define MIPS_SEGCFG_MUSK _ULCAST_(3)
686#define MIPS_SEGCFG_MSK _ULCAST_(2)
687#define MIPS_SEGCFG_MK _ULCAST_(1)
688#define MIPS_SEGCFG_UK _ULCAST_(0)
689
631#ifndef __ASSEMBLY__ 690#ifndef __ASSEMBLY__
632 691
633/* 692/*
@@ -649,6 +708,19 @@ static inline int mm_insn_16bit(u16 insn)
649} 708}
650 709
651/* 710/*
711 * TLB Invalidate Flush
712 */
713static inline void tlbinvf(void)
714{
715 __asm__ __volatile__(
716 ".set push\n\t"
717 ".set noreorder\n\t"
718 ".word 0x42000004\n\t" /* tlbinvf */
719 ".set pop");
720}
721
722
723/*
652 * Functions to access the R10000 performance counters. These are basically 724 * Functions to access the R10000 performance counters. These are basically
653 * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit 725 * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
654 * performance counter number encoded into bits 1 ... 5 of the instruction. 726 * performance counter number encoded into bits 1 ... 5 of the instruction.
@@ -1102,6 +1174,15 @@ do { \
1102#define read_c0_ebase() __read_32bit_c0_register($15, 1) 1174#define read_c0_ebase() __read_32bit_c0_register($15, 1)
1103#define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val) 1175#define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val)
1104 1176
1177/* MIPSR3 */
1178#define read_c0_segctl0() __read_32bit_c0_register($5, 2)
1179#define write_c0_segctl0(val) __write_32bit_c0_register($5, 2, val)
1180
1181#define read_c0_segctl1() __read_32bit_c0_register($5, 3)
1182#define write_c0_segctl1(val) __write_32bit_c0_register($5, 3, val)
1183
1184#define read_c0_segctl2() __read_32bit_c0_register($5, 4)
1185#define write_c0_segctl2(val) __write_32bit_c0_register($5, 4, val)
1105 1186
1106/* Cavium OCTEON (cnMIPS) */ 1187/* Cavium OCTEON (cnMIPS) */
1107#define read_c0_cvmcount() __read_ulong_c0_register($9, 6) 1188#define read_c0_cvmcount() __read_ulong_c0_register($9, 6)
diff --git a/arch/mips/include/asm/netlogic/common.h b/arch/mips/include/asm/netlogic/common.h
index bb68c3398c80..c281f03eb312 100644
--- a/arch/mips/include/asm/netlogic/common.h
+++ b/arch/mips/include/asm/netlogic/common.h
@@ -84,7 +84,6 @@ nlm_set_nmi_handler(void *handler)
84 */ 84 */
85void nlm_init_boot_cpu(void); 85void nlm_init_boot_cpu(void);
86unsigned int nlm_get_cpu_frequency(void); 86unsigned int nlm_get_cpu_frequency(void);
87void nlm_node_init(int node);
88extern struct plat_smp_ops nlm_smp_ops; 87extern struct plat_smp_ops nlm_smp_ops;
89extern char nlm_reset_entry[], nlm_reset_entry_end[]; 88extern char nlm_reset_entry[], nlm_reset_entry_end[];
90 89
@@ -94,26 +93,16 @@ extern struct dma_map_ops nlm_swiotlb_dma_ops;
94extern unsigned int nlm_threads_per_core; 93extern unsigned int nlm_threads_per_core;
95extern cpumask_t nlm_cpumask; 94extern cpumask_t nlm_cpumask;
96 95
97struct nlm_soc_info {
98 unsigned long coremask; /* cores enabled on the soc */
99 unsigned long ebase;
100 uint64_t irqmask;
101 uint64_t sysbase; /* only for XLP */
102 uint64_t picbase;
103 spinlock_t piclock;
104};
105
106#define nlm_get_node(i) (&nlm_nodes[i])
107#ifdef CONFIG_CPU_XLR
108#define nlm_current_node() (&nlm_nodes[0])
109#else
110#define nlm_current_node() (&nlm_nodes[nlm_nodeid()])
111#endif
112
113struct irq_data; 96struct irq_data;
114uint64_t nlm_pci_irqmask(int node); 97uint64_t nlm_pci_irqmask(int node);
98void nlm_setup_pic_irq(int node, int picirq, int irq, int irt);
115void nlm_set_pic_extra_ack(int node, int irq, void (*xack)(struct irq_data *)); 99void nlm_set_pic_extra_ack(int node, int irq, void (*xack)(struct irq_data *));
116 100
101#ifdef CONFIG_PCI_MSI
102void nlm_dispatch_msi(int node, int lirq);
103void nlm_dispatch_msix(int node, int msixirq);
104#endif
105
117/* 106/*
118 * The NR_IRQs is divided between nodes, each of them has a separate irq space 107 * The NR_IRQs is divided between nodes, each of them has a separate irq space
119 */ 108 */
@@ -122,7 +111,6 @@ static inline int nlm_irq_to_xirq(int node, int irq)
122 return node * NR_IRQS / NLM_NR_NODES + irq; 111 return node * NR_IRQS / NLM_NR_NODES + irq;
123} 112}
124 113
125extern struct nlm_soc_info nlm_nodes[NLM_NR_NODES];
126extern int nlm_cpu_ready[]; 114extern int nlm_cpu_ready[];
127#endif 115#endif
128#endif /* _NETLOGIC_COMMON_H_ */ 116#endif /* _NETLOGIC_COMMON_H_ */
diff --git a/arch/mips/include/asm/netlogic/mips-extns.h b/arch/mips/include/asm/netlogic/mips-extns.h
index f299d31d7c1a..de9aada6f4c1 100644
--- a/arch/mips/include/asm/netlogic/mips-extns.h
+++ b/arch/mips/include/asm/netlogic/mips-extns.h
@@ -146,7 +146,12 @@ static inline int hard_smp_processor_id(void)
146 146
147static inline int nlm_nodeid(void) 147static inline int nlm_nodeid(void)
148{ 148{
149 return (__read_32bit_c0_register($15, 1) >> 5) & 0x3; 149 uint32_t prid = read_c0_prid();
150
151 if ((prid & 0xff00) == PRID_IMP_NETLOGIC_XLP9XX)
152 return (__read_32bit_c0_register($15, 1) >> 7) & 0x7;
153 else
154 return (__read_32bit_c0_register($15, 1) >> 5) & 0x3;
150} 155}
151 156
152static inline unsigned int nlm_core_id(void) 157static inline unsigned int nlm_core_id(void)
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/bridge.h b/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
index 4e8eacb9588a..3067f983495d 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
@@ -69,44 +69,9 @@
69#define BRIDGE_FLASH_LIMIT3 0x13 69#define BRIDGE_FLASH_LIMIT3 0x13
70 70
71#define BRIDGE_DRAM_BAR(i) (0x14 + (i)) 71#define BRIDGE_DRAM_BAR(i) (0x14 + (i))
72#define BRIDGE_DRAM_BAR0 0x14
73#define BRIDGE_DRAM_BAR1 0x15
74#define BRIDGE_DRAM_BAR2 0x16
75#define BRIDGE_DRAM_BAR3 0x17
76#define BRIDGE_DRAM_BAR4 0x18
77#define BRIDGE_DRAM_BAR5 0x19
78#define BRIDGE_DRAM_BAR6 0x1a
79#define BRIDGE_DRAM_BAR7 0x1b
80
81#define BRIDGE_DRAM_LIMIT(i) (0x1c + (i)) 72#define BRIDGE_DRAM_LIMIT(i) (0x1c + (i))
82#define BRIDGE_DRAM_LIMIT0 0x1c
83#define BRIDGE_DRAM_LIMIT1 0x1d
84#define BRIDGE_DRAM_LIMIT2 0x1e
85#define BRIDGE_DRAM_LIMIT3 0x1f
86#define BRIDGE_DRAM_LIMIT4 0x20
87#define BRIDGE_DRAM_LIMIT5 0x21
88#define BRIDGE_DRAM_LIMIT6 0x22
89#define BRIDGE_DRAM_LIMIT7 0x23
90
91#define BRIDGE_DRAM_NODE_TRANSLN(i) (0x24 + (i)) 73#define BRIDGE_DRAM_NODE_TRANSLN(i) (0x24 + (i))
92#define BRIDGE_DRAM_NODE_TRANSLN0 0x24
93#define BRIDGE_DRAM_NODE_TRANSLN1 0x25
94#define BRIDGE_DRAM_NODE_TRANSLN2 0x26
95#define BRIDGE_DRAM_NODE_TRANSLN3 0x27
96#define BRIDGE_DRAM_NODE_TRANSLN4 0x28
97#define BRIDGE_DRAM_NODE_TRANSLN5 0x29
98#define BRIDGE_DRAM_NODE_TRANSLN6 0x2a
99#define BRIDGE_DRAM_NODE_TRANSLN7 0x2b
100
101#define BRIDGE_DRAM_CHNL_TRANSLN(i) (0x2c + (i)) 74#define BRIDGE_DRAM_CHNL_TRANSLN(i) (0x2c + (i))
102#define BRIDGE_DRAM_CHNL_TRANSLN0 0x2c
103#define BRIDGE_DRAM_CHNL_TRANSLN1 0x2d
104#define BRIDGE_DRAM_CHNL_TRANSLN2 0x2e
105#define BRIDGE_DRAM_CHNL_TRANSLN3 0x2f
106#define BRIDGE_DRAM_CHNL_TRANSLN4 0x30
107#define BRIDGE_DRAM_CHNL_TRANSLN5 0x31
108#define BRIDGE_DRAM_CHNL_TRANSLN6 0x32
109#define BRIDGE_DRAM_CHNL_TRANSLN7 0x33
110 75
111#define BRIDGE_PCIEMEM_BASE0 0x34 76#define BRIDGE_PCIEMEM_BASE0 0x34
112#define BRIDGE_PCIEMEM_BASE1 0x35 77#define BRIDGE_PCIEMEM_BASE1 0x35
@@ -178,12 +143,42 @@
178#define BRIDGE_GIO_WEIGHT 0x2cb 143#define BRIDGE_GIO_WEIGHT 0x2cb
179#define BRIDGE_FLASH_WEIGHT 0x2cc 144#define BRIDGE_FLASH_WEIGHT 0x2cc
180 145
146/* FIXME verify */
147#define BRIDGE_9XX_FLASH_BAR(i) (0x11 + (i))
148#define BRIDGE_9XX_FLASH_BAR_LIMIT(i) (0x15 + (i))
149
150#define BRIDGE_9XX_DRAM_BAR(i) (0x19 + (i))
151#define BRIDGE_9XX_DRAM_LIMIT(i) (0x29 + (i))
152#define BRIDGE_9XX_DRAM_NODE_TRANSLN(i) (0x39 + (i))
153#define BRIDGE_9XX_DRAM_CHNL_TRANSLN(i) (0x49 + (i))
154
155#define BRIDGE_9XX_ADDRESS_ERROR0 0x9d
156#define BRIDGE_9XX_ADDRESS_ERROR1 0x9e
157#define BRIDGE_9XX_ADDRESS_ERROR2 0x9f
158
159#define BRIDGE_9XX_PCIEMEM_BASE0 0x59
160#define BRIDGE_9XX_PCIEMEM_BASE1 0x5a
161#define BRIDGE_9XX_PCIEMEM_BASE2 0x5b
162#define BRIDGE_9XX_PCIEMEM_BASE3 0x5c
163#define BRIDGE_9XX_PCIEMEM_LIMIT0 0x5d
164#define BRIDGE_9XX_PCIEMEM_LIMIT1 0x5e
165#define BRIDGE_9XX_PCIEMEM_LIMIT2 0x5f
166#define BRIDGE_9XX_PCIEMEM_LIMIT3 0x60
167#define BRIDGE_9XX_PCIEIO_BASE0 0x61
168#define BRIDGE_9XX_PCIEIO_BASE1 0x62
169#define BRIDGE_9XX_PCIEIO_BASE2 0x63
170#define BRIDGE_9XX_PCIEIO_BASE3 0x64
171#define BRIDGE_9XX_PCIEIO_LIMIT0 0x65
172#define BRIDGE_9XX_PCIEIO_LIMIT1 0x66
173#define BRIDGE_9XX_PCIEIO_LIMIT2 0x67
174#define BRIDGE_9XX_PCIEIO_LIMIT3 0x68
175
181#ifndef __ASSEMBLY__ 176#ifndef __ASSEMBLY__
182 177
183#define nlm_read_bridge_reg(b, r) nlm_read_reg(b, r) 178#define nlm_read_bridge_reg(b, r) nlm_read_reg(b, r)
184#define nlm_write_bridge_reg(b, r, v) nlm_write_reg(b, r, v) 179#define nlm_write_bridge_reg(b, r, v) nlm_write_reg(b, r, v)
185#define nlm_get_bridge_pcibase(node) \ 180#define nlm_get_bridge_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
186 nlm_pcicfg_base(XLP_IO_BRIDGE_OFFSET(node)) 181 XLP9XX_IO_BRIDGE_OFFSET(node) : XLP_IO_BRIDGE_OFFSET(node))
187#define nlm_get_bridge_regbase(node) \ 182#define nlm_get_bridge_regbase(node) \
188 (nlm_get_bridge_pcibase(node) + XLP_IO_PCI_HDRSZ) 183 (nlm_get_bridge_pcibase(node) + XLP_IO_PCI_HDRSZ)
189 184
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
index 55eee77adaca..1f23dfaa7167 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
@@ -48,8 +48,10 @@
48#define XLP_IO_SIZE (64 << 20) /* ECFG space size */ 48#define XLP_IO_SIZE (64 << 20) /* ECFG space size */
49#define XLP_IO_PCI_HDRSZ 0x100 49#define XLP_IO_PCI_HDRSZ 0x100
50#define XLP_IO_DEV(node, dev) ((dev) + (node) * 8) 50#define XLP_IO_DEV(node, dev) ((dev) + (node) * 8)
51#define XLP_HDR_OFFSET(node, bus, dev, fn) (((bus) << 20) | \ 51#define XLP_IO_PCI_OFFSET(b, d, f) (((b) << 20) | ((d) << 15) | ((f) << 12))
52 ((XLP_IO_DEV(node, dev)) << 15) | ((fn) << 12)) 52
53#define XLP_HDR_OFFSET(node, bus, dev, fn) \
54 XLP_IO_PCI_OFFSET(bus, XLP_IO_DEV(node, dev), fn)
53 55
54#define XLP_IO_BRIDGE_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 0) 56#define XLP_IO_BRIDGE_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 0)
55/* coherent inter chip */ 57/* coherent inter chip */
@@ -109,6 +111,36 @@
109#define XLP_IO_MMC_OFFSET(node, slot) \ 111#define XLP_IO_MMC_OFFSET(node, slot) \
110 ((XLP_IO_SD_OFFSET(node))+(slot*0x100)+XLP_IO_PCI_HDRSZ) 112 ((XLP_IO_SD_OFFSET(node))+(slot*0x100)+XLP_IO_PCI_HDRSZ)
111 113
114/* Things have changed drastically in XLP 9XX */
115#define XLP9XX_HDR_OFFSET(n, d, f) \
116 XLP_IO_PCI_OFFSET(xlp9xx_get_socbus(n), d, f)
117
118#define XLP9XX_IO_BRIDGE_OFFSET(node) XLP_IO_PCI_OFFSET(0, 0, node)
119#define XLP9XX_IO_PIC_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 0)
120#define XLP9XX_IO_UART_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 2)
121#define XLP9XX_IO_SYS_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 0)
122#define XLP9XX_IO_FUSE_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 1)
123#define XLP9XX_IO_JTAG_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 4)
124
125#define XLP9XX_IO_PCIE_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 1, i)
126#define XLP9XX_IO_PCIE0_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 0)
127#define XLP9XX_IO_PCIE2_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 2)
128#define XLP9XX_IO_PCIE3_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 3)
129
130/* XLP9xx USB block */
131#define XLP9XX_IO_USB_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 4, i)
132#define XLP9XX_IO_USB_XHCI0_OFFSET(node) XLP9XX_HDR_OFFSET(node, 4, 1)
133#define XLP9XX_IO_USB_XHCI1_OFFSET(node) XLP9XX_HDR_OFFSET(node, 4, 2)
134
135/* XLP9XX on-chip SATA controller */
136#define XLP9XX_IO_SATA_OFFSET(node) XLP9XX_HDR_OFFSET(node, 3, 2)
137
138#define XLP9XX_IO_NOR_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 0)
139#define XLP9XX_IO_NAND_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 1)
140#define XLP9XX_IO_SPI_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 2)
141/* SD flash */
142#define XLP9XX_IO_MMCSD_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 3)
143
112/* PCI config header register id's */ 144/* PCI config header register id's */
113#define XLP_PCI_CFGREG0 0x00 145#define XLP_PCI_CFGREG0 0x00
114#define XLP_PCI_CFGREG1 0x01 146#define XLP_PCI_CFGREG1 0x01
@@ -156,11 +188,23 @@
156#define PCI_DEVICE_ID_NLM_MMC 0x1018 188#define PCI_DEVICE_ID_NLM_MMC 0x1018
157#define PCI_DEVICE_ID_NLM_XHCI 0x101d 189#define PCI_DEVICE_ID_NLM_XHCI 0x101d
158 190
191#define PCI_DEVICE_ID_XLP9XX_SATA 0x901A
192#define PCI_DEVICE_ID_XLP9XX_XHCI 0x901D
193
159#ifndef __ASSEMBLY__ 194#ifndef __ASSEMBLY__
160 195
161#define nlm_read_pci_reg(b, r) nlm_read_reg(b, r) 196#define nlm_read_pci_reg(b, r) nlm_read_reg(b, r)
162#define nlm_write_pci_reg(b, r, v) nlm_write_reg(b, r, v) 197#define nlm_write_pci_reg(b, r, v) nlm_write_reg(b, r, v)
163 198
199static inline int xlp9xx_get_socbus(int node)
200{
201 uint64_t socbridge;
202
203 if (node == 0)
204 return 1;
205 socbridge = nlm_pcicfg_base(XLP9XX_IO_BRIDGE_OFFSET(node));
206 return (nlm_read_pci_reg(socbridge, 0x6) >> 8) & 0xff;
207}
164#endif /* !__ASSEMBLY */ 208#endif /* !__ASSEMBLY */
165 209
166#endif /* __NLM_HAL_IOMAP_H__ */ 210#endif /* __NLM_HAL_IOMAP_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
index b559cb9f56ea..d4deb87ad069 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
@@ -52,25 +52,48 @@
52#define PCIE_BYTE_SWAP_MEM_LIM 0x248 52#define PCIE_BYTE_SWAP_MEM_LIM 0x248
53#define PCIE_BYTE_SWAP_IO_BASE 0x249 53#define PCIE_BYTE_SWAP_IO_BASE 0x249
54#define PCIE_BYTE_SWAP_IO_LIM 0x24A 54#define PCIE_BYTE_SWAP_IO_LIM 0x24A
55
56#define PCIE_BRIDGE_MSIX_ADDR_BASE 0x24F
57#define PCIE_BRIDGE_MSIX_ADDR_LIMIT 0x250
55#define PCIE_MSI_STATUS 0x25A 58#define PCIE_MSI_STATUS 0x25A
56#define PCIE_MSI_EN 0x25B 59#define PCIE_MSI_EN 0x25B
60#define PCIE_MSIX_STATUS 0x25D
61#define PCIE_INT_STATUS0 0x25F
62#define PCIE_INT_STATUS1 0x260
57#define PCIE_INT_EN0 0x261 63#define PCIE_INT_EN0 0x261
64#define PCIE_INT_EN1 0x262
58 65
59/* PCIE_MSI_EN */ 66/* XLP9XX has basic changes */
60#define PCIE_MSI_VECTOR_INT_EN 0xFFFFFFFF 67#define PCIE_9XX_BYTE_SWAP_MEM_BASE 0x25c
68#define PCIE_9XX_BYTE_SWAP_MEM_LIM 0x25d
69#define PCIE_9XX_BYTE_SWAP_IO_BASE 0x25e
70#define PCIE_9XX_BYTE_SWAP_IO_LIM 0x25f
61 71
62/* PCIE_INT_EN0 */ 72/* other */
63#define PCIE_MSI_INT_EN (1 << 9) 73#define PCIE_NLINKS 4
64 74
75/* MSI addresses */
76#define MSI_ADDR_BASE 0xfffee00000ULL
77#define MSI_ADDR_SZ 0x10000
78#define MSI_LINK_ADDR(n, l) (MSI_ADDR_BASE + \
79 (PCIE_NLINKS * (n) + (l)) * MSI_ADDR_SZ)
80#define MSIX_ADDR_BASE 0xfffef00000ULL
81#define MSIX_LINK_ADDR(n, l) (MSIX_ADDR_BASE + \
82 (PCIE_NLINKS * (n) + (l)) * MSI_ADDR_SZ)
65#ifndef __ASSEMBLY__ 83#ifndef __ASSEMBLY__
66 84
67#define nlm_read_pcie_reg(b, r) nlm_read_reg(b, r) 85#define nlm_read_pcie_reg(b, r) nlm_read_reg(b, r)
68#define nlm_write_pcie_reg(b, r, v) nlm_write_reg(b, r, v) 86#define nlm_write_pcie_reg(b, r, v) nlm_write_reg(b, r, v)
69#define nlm_get_pcie_base(node, inst) \ 87#define nlm_get_pcie_base(node, inst) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
70 nlm_pcicfg_base(XLP_IO_PCIE_OFFSET(node, inst)) 88 XLP9XX_IO_PCIE_OFFSET(node, inst) : XLP_IO_PCIE_OFFSET(node, inst))
71#define nlm_get_pcie_regbase(node, inst) \ 89
72 (nlm_get_pcie_base(node, inst) + XLP_IO_PCI_HDRSZ) 90#ifdef CONFIG_PCI_MSI
91void xlp_init_node_msi_irqs(int node, int link);
92#else
93static inline void xlp_init_node_msi_irqs(int node, int link) {}
94#endif
95
96struct pci_dev *xlp_get_pcie_link(const struct pci_dev *dev);
73 97
74int xlp_pcie_link_irt(int link);
75#endif 98#endif
76#endif /* __NLM_HAL_PCIBUS_H__ */ 99#endif /* __NLM_HAL_PCIBUS_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pic.h b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
index 105389b79f09..f10bf3bba58f 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/pic.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
@@ -150,12 +150,19 @@
150#define PIC_IRT0 0x74 150#define PIC_IRT0 0x74
151#define PIC_IRT(i) (PIC_IRT0 + ((i) * 2)) 151#define PIC_IRT(i) (PIC_IRT0 + ((i) * 2))
152 152
153#define TIMER_CYCLES_MAXVAL 0xffffffffffffffffULL 153#define PIC_9XX_PENDING_0 0x6
154#define PIC_9XX_PENDING_1 0x8
155#define PIC_9XX_PENDING_2 0xa
156#define PIC_9XX_PENDING_3 0xc
157
158#define PIC_9XX_IRT0 0x1c0
159#define PIC_9XX_IRT(i) (PIC_9XX_IRT0 + ((i) * 2))
154 160
155/* 161/*
156 * IRT Map 162 * IRT Map
157 */ 163 */
158#define PIC_NUM_IRTS 160 164#define PIC_NUM_IRTS 160
165#define PIC_9XX_NUM_IRTS 256
159 166
160#define PIC_IRT_WD_0_INDEX 0 167#define PIC_IRT_WD_0_INDEX 0
161#define PIC_IRT_WD_1_INDEX 1 168#define PIC_IRT_WD_1_INDEX 1
@@ -193,14 +200,9 @@
193#define PIC_IRT_PCIE_LINK_INDEX(num) ((num) + PIC_IRT_PCIE_LINK_0_INDEX) 200#define PIC_IRT_PCIE_LINK_INDEX(num) ((num) + PIC_IRT_PCIE_LINK_0_INDEX)
194 201
195#define PIC_CLOCK_TIMER 7 202#define PIC_CLOCK_TIMER 7
196#define PIC_IRQ_BASE 8
197 203
198#if !defined(LOCORE) && !defined(__ASSEMBLY__) 204#if !defined(LOCORE) && !defined(__ASSEMBLY__)
199 205
200#define PIC_IRT_FIRST_IRQ (PIC_IRQ_BASE)
201#define PIC_IRT_LAST_IRQ 63
202#define PIC_IRQ_IS_IRT(irq) ((irq) >= PIC_IRT_FIRST_IRQ)
203
204/* 206/*
205 * Misc 207 * Misc
206 */ 208 */
@@ -210,30 +212,26 @@
210 212
211#define nlm_read_pic_reg(b, r) nlm_read_reg64(b, r) 213#define nlm_read_pic_reg(b, r) nlm_read_reg64(b, r)
212#define nlm_write_pic_reg(b, r, v) nlm_write_reg64(b, r, v) 214#define nlm_write_pic_reg(b, r, v) nlm_write_reg64(b, r, v)
213#define nlm_get_pic_pcibase(node) nlm_pcicfg_base(XLP_IO_PIC_OFFSET(node)) 215#define nlm_get_pic_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
216 XLP9XX_IO_PIC_OFFSET(node) : XLP_IO_PIC_OFFSET(node))
214#define nlm_get_pic_regbase(node) (nlm_get_pic_pcibase(node) + XLP_IO_PCI_HDRSZ) 217#define nlm_get_pic_regbase(node) (nlm_get_pic_pcibase(node) + XLP_IO_PCI_HDRSZ)
215 218
216/* We use PIC on node 0 as a timer */ 219/* We use PIC on node 0 as a timer */
217#define pic_timer_freq() nlm_get_pic_frequency(0) 220#define pic_timer_freq() nlm_get_pic_frequency(0)
218 221
219/* IRT and h/w interrupt routines */ 222/* IRT and h/w interrupt routines */
220static inline int
221nlm_pic_read_irt(uint64_t base, int irt_index)
222{
223 return nlm_read_pic_reg(base, PIC_IRT(irt_index));
224}
225
226static inline void 223static inline void
227nlm_set_irt_to_cpu(uint64_t base, int irt, int cpu) 224nlm_9xx_pic_write_irt(uint64_t base, int irt_num, int en, int nmi,
225 int sch, int vec, int dt, int db, int cpu)
228{ 226{
229 uint64_t val; 227 uint64_t val;
230 228
231 val = nlm_read_pic_reg(base, PIC_IRT(irt)); 229 val = (((uint64_t)en & 0x1) << 22) | ((nmi & 0x1) << 23) |
232 /* clear cpuset and mask */ 230 ((0 /*mc*/) << 20) | ((vec & 0x3f) << 24) |
233 val &= ~((0x7ull << 16) | 0xffff); 231 ((dt & 0x1) << 21) | (0 /*ptr*/ << 16) |
234 /* set DB, cpuset and cpumask */ 232 (cpu & 0x3ff);
235 val |= (1 << 19) | ((cpu >> 4) << 16) | (1 << (cpu & 0xf)); 233
236 nlm_write_pic_reg(base, PIC_IRT(irt), val); 234 nlm_write_pic_reg(base, PIC_9XX_IRT(irt_num), val);
237} 235}
238 236
239static inline void 237static inline void
@@ -254,9 +252,13 @@ static inline void
254nlm_pic_write_irt_direct(uint64_t base, int irt_num, int en, int nmi, 252nlm_pic_write_irt_direct(uint64_t base, int irt_num, int en, int nmi,
255 int sch, int vec, int cpu) 253 int sch, int vec, int cpu)
256{ 254{
257 nlm_pic_write_irt(base, irt_num, en, nmi, sch, vec, 1, 255 if (cpu_is_xlp9xx())
258 (cpu >> 4), /* thread group */ 256 nlm_9xx_pic_write_irt(base, irt_num, en, nmi, sch, vec,
259 1 << (cpu & 0xf)); /* thread mask */ 257 1, 0, cpu);
258 else
259 nlm_pic_write_irt(base, irt_num, en, nmi, sch, vec, 1,
260 (cpu >> 4), /* thread group */
261 1 << (cpu & 0xf)); /* thread mask */
260} 262}
261 263
262static inline uint64_t 264static inline uint64_t
@@ -298,8 +300,13 @@ nlm_pic_enable_irt(uint64_t base, int irt)
298{ 300{
299 uint64_t reg; 301 uint64_t reg;
300 302
301 reg = nlm_read_pic_reg(base, PIC_IRT(irt)); 303 if (cpu_is_xlp9xx()) {
302 nlm_write_pic_reg(base, PIC_IRT(irt), reg | (1u << 31)); 304 reg = nlm_read_pic_reg(base, PIC_9XX_IRT(irt));
305 nlm_write_pic_reg(base, PIC_9XX_IRT(irt), reg | (1 << 22));
306 } else {
307 reg = nlm_read_pic_reg(base, PIC_IRT(irt));
308 nlm_write_pic_reg(base, PIC_IRT(irt), reg | (1u << 31));
309 }
303} 310}
304 311
305static inline void 312static inline void
@@ -307,8 +314,15 @@ nlm_pic_disable_irt(uint64_t base, int irt)
307{ 314{
308 uint64_t reg; 315 uint64_t reg;
309 316
310 reg = nlm_read_pic_reg(base, PIC_IRT(irt)); 317 if (cpu_is_xlp9xx()) {
311 nlm_write_pic_reg(base, PIC_IRT(irt), reg & ~((uint64_t)1 << 31)); 318 reg = nlm_read_pic_reg(base, PIC_9XX_IRT(irt));
319 reg &= ~((uint64_t)1 << 22);
320 nlm_write_pic_reg(base, PIC_9XX_IRT(irt), reg);
321 } else {
322 reg = nlm_read_pic_reg(base, PIC_IRT(irt));
323 reg &= ~((uint64_t)1 << 31);
324 nlm_write_pic_reg(base, PIC_IRT(irt), reg);
325 }
312} 326}
313 327
314static inline void 328static inline void
@@ -316,8 +330,13 @@ nlm_pic_send_ipi(uint64_t base, int hwt, int irq, int nmi)
316{ 330{
317 uint64_t ipi; 331 uint64_t ipi;
318 332
319 ipi = ((uint64_t)nmi << 31) | (irq << 20); 333 if (cpu_is_xlp9xx())
320 ipi |= ((hwt >> 4) << 16) | (1 << (hwt & 0xf)); /* cpuset and mask */ 334 ipi = (nmi << 23) | (irq << 24) |
335 (0/*mcm*/ << 20) | (0/*ptr*/ << 16) | hwt;
336 else
337 ipi = ((uint64_t)nmi << 31) | (irq << 20) |
338 ((hwt >> 4) << 16) | (1 << (hwt & 0xf));
339
321 nlm_write_pic_reg(base, PIC_IPI_CTL, ipi); 340 nlm_write_pic_reg(base, PIC_IPI_CTL, ipi);
322} 341}
323 342
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/sys.h b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
index fcf2833c16ca..d9b107ffca93 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/sys.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
@@ -147,13 +147,29 @@
147#define SYS_SYS_PLL_MEM_REQ 0x2a3 147#define SYS_SYS_PLL_MEM_REQ 0x2a3
148#define SYS_PLL_MEM_STAT 0x2a4 148#define SYS_PLL_MEM_STAT 0x2a4
149 149
150/* Registers changed on 9XX */
151#define SYS_9XX_POWER_ON_RESET_CFG 0x00
152#define SYS_9XX_CHIP_RESET 0x01
153#define SYS_9XX_CPU_RESET 0x02
154#define SYS_9XX_CPU_NONCOHERENT_MODE 0x03
155
156/* XLP 9XX fuse block registers */
157#define FUSE_9XX_DEVCFG6 0xc6
158
150#ifndef __ASSEMBLY__ 159#ifndef __ASSEMBLY__
151 160
152#define nlm_read_sys_reg(b, r) nlm_read_reg(b, r) 161#define nlm_read_sys_reg(b, r) nlm_read_reg(b, r)
153#define nlm_write_sys_reg(b, r, v) nlm_write_reg(b, r, v) 162#define nlm_write_sys_reg(b, r, v) nlm_write_reg(b, r, v)
154#define nlm_get_sys_pcibase(node) nlm_pcicfg_base(XLP_IO_SYS_OFFSET(node)) 163#define nlm_get_sys_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
164 XLP9XX_IO_SYS_OFFSET(node) : XLP_IO_SYS_OFFSET(node))
155#define nlm_get_sys_regbase(node) (nlm_get_sys_pcibase(node) + XLP_IO_PCI_HDRSZ) 165#define nlm_get_sys_regbase(node) (nlm_get_sys_pcibase(node) + XLP_IO_PCI_HDRSZ)
156 166
167/* XLP9XX fuse block */
168#define nlm_get_fuse_pcibase(node) \
169 nlm_pcicfg_base(XLP9XX_IO_FUSE_OFFSET(node))
170#define nlm_get_fuse_regbase(node) \
171 (nlm_get_fuse_pcibase(node) + XLP_IO_PCI_HDRSZ)
172
157unsigned int nlm_get_pic_frequency(int node); 173unsigned int nlm_get_pic_frequency(int node);
158#endif 174#endif
159#endif 175#endif
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/uart.h b/arch/mips/include/asm/netlogic/xlp-hal/uart.h
index 86d16e1e6072..a6c54424dd95 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/uart.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/uart.h
@@ -94,7 +94,8 @@
94#define nlm_read_uart_reg(b, r) nlm_read_reg(b, r) 94#define nlm_read_uart_reg(b, r) nlm_read_reg(b, r)
95#define nlm_write_uart_reg(b, r, v) nlm_write_reg(b, r, v) 95#define nlm_write_uart_reg(b, r, v) nlm_write_reg(b, r, v)
96#define nlm_get_uart_pcibase(node, inst) \ 96#define nlm_get_uart_pcibase(node, inst) \
97 nlm_pcicfg_base(XLP_IO_UART_OFFSET(node, inst)) 97 nlm_pcicfg_base(cpu_is_xlp9xx() ? XLP9XX_IO_UART_OFFSET(node) : \
98 XLP_IO_UART_OFFSET(node, inst))
98#define nlm_get_uart_regbase(node, inst) \ 99#define nlm_get_uart_regbase(node, inst) \
99 (nlm_get_uart_pcibase(node, inst) + XLP_IO_PCI_HDRSZ) 100 (nlm_get_uart_pcibase(node, inst) + XLP_IO_PCI_HDRSZ)
100 101
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 470f2095b346..2b0c9599ebe5 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -37,10 +37,9 @@
37 37
38#define PIC_UART_0_IRQ 17 38#define PIC_UART_0_IRQ 17
39#define PIC_UART_1_IRQ 18 39#define PIC_UART_1_IRQ 18
40#define PIC_PCIE_LINK_0_IRQ 19 40
41#define PIC_PCIE_LINK_1_IRQ 20 41#define PIC_PCIE_LINK_LEGACY_IRQ_BASE 19
42#define PIC_PCIE_LINK_2_IRQ 21 42#define PIC_PCIE_LINK_LEGACY_IRQ(i) (19 + (i))
43#define PIC_PCIE_LINK_3_IRQ 22
44 43
45#define PIC_EHCI_0_IRQ 23 44#define PIC_EHCI_0_IRQ 23
46#define PIC_EHCI_1_IRQ 24 45#define PIC_EHCI_1_IRQ 24
@@ -51,6 +50,8 @@
51#define PIC_2XX_XHCI_0_IRQ 23 50#define PIC_2XX_XHCI_0_IRQ 23
52#define PIC_2XX_XHCI_1_IRQ 24 51#define PIC_2XX_XHCI_1_IRQ 24
53#define PIC_2XX_XHCI_2_IRQ 25 52#define PIC_2XX_XHCI_2_IRQ 25
53#define PIC_9XX_XHCI_0_IRQ 23
54#define PIC_9XX_XHCI_1_IRQ 24
54 55
55#define PIC_MMC_IRQ 29 56#define PIC_MMC_IRQ 29
56#define PIC_I2C_0_IRQ 30 57#define PIC_I2C_0_IRQ 30
@@ -58,6 +59,23 @@
58#define PIC_I2C_2_IRQ 32 59#define PIC_I2C_2_IRQ 32
59#define PIC_I2C_3_IRQ 33 60#define PIC_I2C_3_IRQ 33
60 61
62#define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */
63#define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i))
64
65/* MSI-X with second link-level dispatch */
66#define PIC_PCIE_MSIX_IRQ_BASE 48 /* 48 - 51 MSI-X IRQ */
67#define PIC_PCIE_MSIX_IRQ(i) (48 + (i))
68
69#define NLM_MSIX_VEC_BASE 96 /* 96 - 127 - MSIX mapped */
70#define NLM_MSI_VEC_BASE 128 /* 128 -255 - MSI mapped */
71
72#define NLM_PIC_INDIRECT_VEC_BASE 512
73#define NLM_GPIO_VEC_BASE 768
74
75#define PIC_IRQ_BASE 8
76#define PIC_IRT_FIRST_IRQ PIC_IRQ_BASE
77#define PIC_IRT_LAST_IRQ 63
78
61#ifndef __ASSEMBLY__ 79#ifndef __ASSEMBLY__
62 80
63/* SMP support functions */ 81/* SMP support functions */
@@ -68,6 +86,9 @@ void xlp_mmu_init(void);
68void nlm_hal_init(void); 86void nlm_hal_init(void);
69int xlp_get_dram_map(int n, uint64_t *dram_map); 87int xlp_get_dram_map(int n, uint64_t *dram_map);
70 88
89struct pci_dev;
90int xlp_socdev_to_node(const struct pci_dev *dev);
91
71/* Device tree related */ 92/* Device tree related */
72void xlp_early_init_devtree(void); 93void xlp_early_init_devtree(void);
73void *xlp_dt_init(void *fdtp); 94void *xlp_dt_init(void *fdtp);
@@ -76,8 +97,15 @@ static inline int cpu_is_xlpii(void)
76{ 97{
77 int chip = read_c0_prid() & 0xff00; 98 int chip = read_c0_prid() & 0xff00;
78 99
79 return chip == PRID_IMP_NETLOGIC_XLP2XX; 100 return chip == PRID_IMP_NETLOGIC_XLP2XX ||
101 chip == PRID_IMP_NETLOGIC_XLP9XX;
80} 102}
81 103
104static inline int cpu_is_xlp9xx(void)
105{
106 int chip = read_c0_prid() & 0xff00;
107
108 return chip == PRID_IMP_NETLOGIC_XLP9XX;
109}
82#endif /* !__ASSEMBLY__ */ 110#endif /* !__ASSEMBLY__ */
83#endif /* _ASM_NLM_XLP_H */ 111#endif /* _ASM_NLM_XLP_H */
diff --git a/arch/mips/include/asm/netlogic/xlr/xlr.h b/arch/mips/include/asm/netlogic/xlr/xlr.h
index c1667e0c272a..ceb991ca8436 100644
--- a/arch/mips/include/asm/netlogic/xlr/xlr.h
+++ b/arch/mips/include/asm/netlogic/xlr/xlr.h
@@ -35,11 +35,6 @@
35#ifndef _ASM_NLM_XLR_H 35#ifndef _ASM_NLM_XLR_H
36#define _ASM_NLM_XLR_H 36#define _ASM_NLM_XLR_H
37 37
38/* Platform UART functions */
39struct uart_port;
40unsigned int nlm_xlr_uart_in(struct uart_port *, int);
41void nlm_xlr_uart_out(struct uart_port *, int, int);
42
43/* SMP helpers */ 38/* SMP helpers */
44void xlr_wakeup_secondary_cpus(void); 39void xlr_wakeup_secondary_cpus(void);
45 40
diff --git a/arch/mips/include/asm/octeon/cvmx-helper-board.h b/arch/mips/include/asm/octeon/cvmx-helper-board.h
index 41785dd0ddd0..893320375aef 100644
--- a/arch/mips/include/asm/octeon/cvmx-helper-board.h
+++ b/arch/mips/include/asm/octeon/cvmx-helper-board.h
@@ -36,6 +36,13 @@
36 36
37#include <asm/octeon/cvmx-helper.h> 37#include <asm/octeon/cvmx-helper.h>
38 38
39enum cvmx_helper_board_usb_clock_types {
40 USB_CLOCK_TYPE_REF_12,
41 USB_CLOCK_TYPE_REF_24,
42 USB_CLOCK_TYPE_REF_48,
43 USB_CLOCK_TYPE_CRYSTAL_12,
44};
45
39typedef enum { 46typedef enum {
40 set_phy_link_flags_autoneg = 0x1, 47 set_phy_link_flags_autoneg = 0x1,
41 set_phy_link_flags_flow_control_dont_touch = 0x0 << 1, 48 set_phy_link_flags_flow_control_dont_touch = 0x0 << 1,
@@ -154,4 +161,6 @@ extern int __cvmx_helper_board_interface_probe(int interface,
154 */ 161 */
155extern int __cvmx_helper_board_hardware_enable(int interface); 162extern int __cvmx_helper_board_hardware_enable(int interface);
156 163
164enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void);
165
157#endif /* __CVMX_HELPER_BOARD_H__ */ 166#endif /* __CVMX_HELPER_BOARD_H__ */
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index f6be4741f7e8..5e08bcc74897 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -11,6 +11,8 @@
11 11
12#include <spaces.h> 12#include <spaces.h>
13#include <linux/const.h> 13#include <linux/const.h>
14#include <linux/kernel.h>
15#include <asm/mipsregs.h>
14 16
15/* 17/*
16 * PAGE_SHIFT determines the page size 18 * PAGE_SHIFT determines the page size
@@ -33,6 +35,29 @@
33#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 35#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
34#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 36#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
35 37
38/*
39 * This is used for calculating the real page sizes
40 * for FTLB or VTLB + FTLB confugrations.
41 */
42static inline unsigned int page_size_ftlb(unsigned int mmuextdef)
43{
44 switch (mmuextdef) {
45 case MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT:
46 if (PAGE_SIZE == (1 << 30))
47 return 5;
48 if (PAGE_SIZE == (1llu << 32))
49 return 6;
50 if (PAGE_SIZE > (256 << 10))
51 return 7; /* reserved */
52 /* fall through */
53 case MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT:
54 return (PAGE_SHIFT - 10) / 2;
55 default:
56 panic("Invalid FTLB configuration with Conf4_mmuextdef=%d value\n",
57 mmuextdef >> 14);
58 }
59}
60
36#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT 61#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
37#define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) 62#define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3)
38#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 63#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
diff --git a/arch/mips/include/asm/rtlx.h b/arch/mips/include/asm/rtlx.h
index 90985b61dbd9..c1020654876e 100644
--- a/arch/mips/include/asm/rtlx.h
+++ b/arch/mips/include/asm/rtlx.h
@@ -1,13 +1,18 @@
1/* 1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 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.
3 * 5 *
6 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
4 */ 8 */
5
6#ifndef __ASM_RTLX_H_ 9#ifndef __ASM_RTLX_H_
7#define __ASM_RTLX_H_ 10#define __ASM_RTLX_H_
8 11
9#include <irq.h> 12#include <irq.h>
10 13
14#define RTLX_MODULE_NAME "rtlx"
15
11#define LX_NODE_BASE 10 16#define LX_NODE_BASE 10
12 17
13#define MIPS_CPU_RTLX_IRQ 0 18#define MIPS_CPU_RTLX_IRQ 0
@@ -15,18 +20,31 @@
15#define RTLX_VERSION 2 20#define RTLX_VERSION 2
16#define RTLX_xID 0x12345600 21#define RTLX_xID 0x12345600
17#define RTLX_ID (RTLX_xID | RTLX_VERSION) 22#define RTLX_ID (RTLX_xID | RTLX_VERSION)
23#define RTLX_BUFFER_SIZE 2048
18#define RTLX_CHANNELS 8 24#define RTLX_CHANNELS 8
19 25
20#define RTLX_CHANNEL_STDIO 0 26#define RTLX_CHANNEL_STDIO 0
21#define RTLX_CHANNEL_DBG 1 27#define RTLX_CHANNEL_DBG 1
22#define RTLX_CHANNEL_SYSIO 2 28#define RTLX_CHANNEL_SYSIO 2
23 29
24extern int rtlx_open(int index, int can_sleep); 30void rtlx_starting(int vpe);
25extern int rtlx_release(int index); 31void rtlx_stopping(int vpe);
26extern ssize_t rtlx_read(int index, void __user *buff, size_t count); 32
27extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count); 33int rtlx_open(int index, int can_sleep);
28extern unsigned int rtlx_read_poll(int index, int can_sleep); 34int rtlx_release(int index);
29extern unsigned int rtlx_write_poll(int index); 35ssize_t rtlx_read(int index, void __user *buff, size_t count);
36ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
37unsigned int rtlx_read_poll(int index, int can_sleep);
38unsigned int rtlx_write_poll(int index);
39
40int __init rtlx_module_init(void);
41void __exit rtlx_module_exit(void);
42
43void _interrupt_sp(void);
44
45extern struct vpe_notifications rtlx_notify;
46extern const struct file_operations rtlx_fops;
47extern void (*aprp_hook)(void);
30 48
31enum rtlx_state { 49enum rtlx_state {
32 RTLX_STATE_UNUSED = 0, 50 RTLX_STATE_UNUSED = 0,
@@ -35,10 +53,15 @@ enum rtlx_state {
35 RTLX_STATE_OPENED 53 RTLX_STATE_OPENED
36}; 54};
37 55
38#define RTLX_BUFFER_SIZE 2048 56extern struct chan_waitqueues {
57 wait_queue_head_t rt_queue;
58 wait_queue_head_t lx_queue;
59 atomic_t in_open;
60 struct mutex mutex;
61} channel_wqs[RTLX_CHANNELS];
39 62
40/* each channel supports read and write. 63/* each channel supports read and write.
41 linux (vpe0) reads lx_buffer and writes rt_buffer 64 linux (vpe0) reads lx_buffer and writes rt_buffer
42 SP (vpe1) reads rt_buffer and writes lx_buffer 65 SP (vpe1) reads rt_buffer and writes lx_buffer
43*/ 66*/
44struct rtlx_channel { 67struct rtlx_channel {
@@ -55,11 +78,11 @@ struct rtlx_channel {
55 char *lx_buffer; 78 char *lx_buffer;
56}; 79};
57 80
58struct rtlx_info { 81extern struct rtlx_info {
59 unsigned long id; 82 unsigned long id;
60 enum rtlx_state state; 83 enum rtlx_state state;
84 int ap_int_pending; /* Status of 0 or 1 for CONFIG_MIPS_CMP only */
61 85
62 struct rtlx_channel channel[RTLX_CHANNELS]; 86 struct rtlx_channel channel[RTLX_CHANNELS];
63}; 87} *rtlx;
64
65#endif /* __ASM_RTLX_H_ */ 88#endif /* __ASM_RTLX_H_ */
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
index eb0af15ac656..278d45a09728 100644
--- a/arch/mips/include/asm/switch_to.h
+++ b/arch/mips/include/asm/switch_to.h
@@ -19,11 +19,19 @@
19 19
20struct task_struct; 20struct task_struct;
21 21
22/* 22/**
23 * switch_to(n) should switch tasks to task nr n, first 23 * resume - resume execution of a task
24 * checking that n isn't the current task, in which case it does nothing. 24 * @prev: The task previously executed.
25 * @next: The task to begin executing.
26 * @next_ti: task_thread_info(next).
27 * @usedfpu: Non-zero if prev's FP context should be saved.
28 *
29 * This function is used whilst scheduling to save the context of prev & load
30 * the context of next. Returns prev.
25 */ 31 */
26extern asmlinkage void *resume(void *last, void *next, void *next_ti, u32 __usedfpu); 32extern asmlinkage struct task_struct *resume(struct task_struct *prev,
33 struct task_struct *next, struct thread_info *next_ti,
34 u32 usedfpu);
27 35
28extern unsigned int ll_bit; 36extern unsigned int ll_bit;
29extern struct task_struct *ll_task; 37extern struct task_struct *ll_task;
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index 81c89132c59d..33e8dbfc1b63 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -29,7 +29,7 @@ static inline long syscall_get_nr(struct task_struct *task,
29static inline unsigned long mips_get_syscall_arg(unsigned long *arg, 29static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
30 struct task_struct *task, struct pt_regs *regs, unsigned int n) 30 struct task_struct *task, struct pt_regs *regs, unsigned int n)
31{ 31{
32 unsigned long usp = regs->regs[29]; 32 unsigned long usp __maybe_unused = regs->regs[29];
33 33
34 switch (n) { 34 switch (n) {
35 case 0: case 1: case 2: case 3: 35 case 0: case 1: case 2: case 3:
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 4f58ef6d0eed..24846f9053fe 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -110,11 +110,12 @@ static inline struct thread_info *current_thread_info(void)
110#define TIF_NOHZ 19 /* in adaptive nohz mode */ 110#define TIF_NOHZ 19 /* in adaptive nohz mode */
111#define TIF_FIXADE 20 /* Fix address errors in software */ 111#define TIF_FIXADE 20 /* Fix address errors in software */
112#define TIF_LOGADE 21 /* Log address errors to syslog */ 112#define TIF_LOGADE 21 /* Log address errors to syslog */
113#define TIF_32BIT_REGS 22 /* also implies 16/32 fprs */ 113#define TIF_32BIT_REGS 22 /* 32-bit general purpose registers */
114#define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */ 114#define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */
115#define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */ 115#define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */
116#define TIF_LOAD_WATCH 25 /* If set, load watch registers */ 116#define TIF_LOAD_WATCH 25 /* If set, load watch registers */
117#define TIF_SYSCALL_TRACEPOINT 26 /* syscall tracepoint instrumentation */ 117#define TIF_SYSCALL_TRACEPOINT 26 /* syscall tracepoint instrumentation */
118#define TIF_32BIT_FPREGS 27 /* 32-bit floating point registers */
118#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 119#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
119 120
120#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 121#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -131,6 +132,7 @@ static inline struct thread_info *current_thread_info(void)
131#define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR) 132#define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR)
132#define _TIF_FPUBOUND (1<<TIF_FPUBOUND) 133#define _TIF_FPUBOUND (1<<TIF_FPUBOUND)
133#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH) 134#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH)
135#define _TIF_32BIT_FPREGS (1<<TIF_32BIT_FPREGS)
134#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 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 | \
diff --git a/arch/mips/include/asm/tlb.h b/arch/mips/include/asm/tlb.h
index c67842bc8ef3..4a2349302b55 100644
--- a/arch/mips/include/asm/tlb.h
+++ b/arch/mips/include/asm/tlb.h
@@ -18,6 +18,10 @@
18 */ 18 */
19#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) 19#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
20 20
21#define UNIQUE_ENTRYHI(idx) \
22 ((CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) | \
23 (cpu_has_tlbinv ? MIPS_ENTRYHI_EHINV : 0))
24
21#include <asm-generic/tlb.h> 25#include <asm-generic/tlb.h>
22 26
23#endif /* __ASM_TLB_H */ 27#endif /* __ASM_TLB_H */
diff --git a/arch/mips/include/asm/vpe.h b/arch/mips/include/asm/vpe.h
index c6e1b961537d..7849f3978fea 100644
--- a/arch/mips/include/asm/vpe.h
+++ b/arch/mips/include/asm/vpe.h
@@ -1,24 +1,95 @@
1/* 1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 2 * This file is subject to the terms and conditions of the GNU General Public
3 * 3 * License. See the file "COPYING" in the main directory of this archive
4 * This program is free software; you can distribute it and/or modify it 4 * for more details.
5 * 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 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
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 * 5 *
6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
17 */ 8 */
18
19#ifndef _ASM_VPE_H 9#ifndef _ASM_VPE_H
20#define _ASM_VPE_H 10#define _ASM_VPE_H
21 11
12#include <linux/init.h>
13#include <linux/list.h>
14#include <linux/smp.h>
15#include <linux/spinlock.h>
16
17#define VPE_MODULE_NAME "vpe"
18#define VPE_MODULE_MINOR 1
19
20/* grab the likely amount of memory we will need. */
21#ifdef CONFIG_MIPS_VPE_LOADER_TOM
22#define P_SIZE (2 * 1024 * 1024)
23#else
24/* add an overhead to the max kmalloc size for non-striped symbols/etc */
25#define P_SIZE (256 * 1024)
26#endif
27
28#define MAX_VPES 16
29#define VPE_PATH_MAX 256
30
31static inline int aprp_cpu_index(void)
32{
33#ifdef CONFIG_MIPS_CMP
34 return setup_max_cpus;
35#else
36 extern int tclimit;
37 return tclimit;
38#endif
39}
40
41enum vpe_state {
42 VPE_STATE_UNUSED = 0,
43 VPE_STATE_INUSE,
44 VPE_STATE_RUNNING
45};
46
47enum tc_state {
48 TC_STATE_UNUSED = 0,
49 TC_STATE_INUSE,
50 TC_STATE_RUNNING,
51 TC_STATE_DYNAMIC
52};
53
54struct vpe {
55 enum vpe_state state;
56
57 /* (device) minor associated with this vpe */
58 int minor;
59
60 /* elfloader stuff */
61 void *load_addr;
62 unsigned long len;
63 char *pbuffer;
64 unsigned long plen;
65 char cwd[VPE_PATH_MAX];
66
67 unsigned long __start;
68
69 /* tc's associated with this vpe */
70 struct list_head tc;
71
72 /* The list of vpe's */
73 struct list_head list;
74
75 /* shared symbol address */
76 void *shared_ptr;
77
78 /* the list of who wants to know when something major happens */
79 struct list_head notify;
80
81 unsigned int ntcs;
82};
83
84struct tc {
85 enum tc_state state;
86 int index;
87
88 struct vpe *pvpe; /* parent VPE */
89 struct list_head tc; /* The list of TC's with this VPE */
90 struct list_head list; /* The global list of tc's */
91};
92
22struct vpe_notifications { 93struct vpe_notifications {
23 void (*start)(int vpe); 94 void (*start)(int vpe);
24 void (*stop)(int vpe); 95 void (*stop)(int vpe);
@@ -26,12 +97,34 @@ struct vpe_notifications {
26 struct list_head list; 97 struct list_head list;
27}; 98};
28 99
100struct vpe_control {
101 spinlock_t vpe_list_lock;
102 struct list_head vpe_list; /* Virtual processing elements */
103 spinlock_t tc_list_lock;
104 struct list_head tc_list; /* Thread contexts */
105};
106
107extern unsigned long physical_memsize;
108extern struct vpe_control vpecontrol;
109extern const struct file_operations vpe_fops;
110
111int vpe_notify(int index, struct vpe_notifications *notify);
112
113void *vpe_get_shared(int index);
114char *vpe_getcwd(int index);
115
116struct vpe *get_vpe(int minor);
117struct tc *get_tc(int index);
118struct vpe *alloc_vpe(int minor);
119struct tc *alloc_tc(int index);
120void release_vpe(struct vpe *v);
29 121
30extern int vpe_notify(int index, struct vpe_notifications *notify); 122void *alloc_progmem(unsigned long len);
123void release_progmem(void *ptr);
31 124
32extern void *vpe_get_shared(int index); 125int __weak vpe_run(struct vpe *v);
33extern int vpe_getuid(int index); 126void cleanup_tc(struct tc *tc);
34extern int vpe_getgid(int index);
35extern char *vpe_getcwd(int index);
36 127
128int __init vpe_module_init(void);
129void __exit vpe_module_exit(void);
37#endif /* _ASM_VPE_H */ 130#endif /* _ASM_VPE_H */
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
index e5a676e3d3c0..b39ba25b41cc 100644
--- a/arch/mips/include/uapi/asm/inst.h
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -98,8 +98,9 @@ enum rt_op {
98 */ 98 */
99enum cop_op { 99enum cop_op {
100 mfc_op = 0x00, dmfc_op = 0x01, 100 mfc_op = 0x00, dmfc_op = 0x01,
101 cfc_op = 0x02, mtc_op = 0x04, 101 cfc_op = 0x02, mfhc_op = 0x03,
102 dmtc_op = 0x05, ctc_op = 0x06, 102 mtc_op = 0x04, dmtc_op = 0x05,
103 ctc_op = 0x06, mthc_op = 0x07,
103 bc_op = 0x08, cop_op = 0x10, 104 bc_op = 0x08, cop_op = 0x10,
104 copm_op = 0x18 105 copm_op = 0x18
105}; 106};
@@ -397,8 +398,10 @@ enum mm_32f_73_minor_op {
397 mm_movt1_op = 0xa5, 398 mm_movt1_op = 0xa5,
398 mm_ftruncw_op = 0xac, 399 mm_ftruncw_op = 0xac,
399 mm_fneg1_op = 0xad, 400 mm_fneg1_op = 0xad,
401 mm_mfhc1_op = 0xc0,
400 mm_froundl_op = 0xcc, 402 mm_froundl_op = 0xcc,
401 mm_fcvtd1_op = 0xcd, 403 mm_fcvtd1_op = 0xcd,
404 mm_mthc1_op = 0xe0,
402 mm_froundw_op = 0xec, 405 mm_froundw_op = 0xec,
403 mm_fcvts1_op = 0xed, 406 mm_fcvts1_op = 0xed,
404}; 407};
diff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h
index 0df9787cd84d..a14baa218c76 100644
--- a/arch/mips/include/uapi/asm/socket.h
+++ b/arch/mips/include/uapi/asm/socket.h
@@ -96,4 +96,6 @@
96 96
97#define SO_MAX_PACING_RATE 47 97#define SO_MAX_PACING_RATE 47
98 98
99#define SO_BPF_EXTENSIONS 48
100
99#endif /* _UAPI_ASM_SOCKET_H */ 101#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c
index 8a5ec0eedeb0..c01900e5d078 100644
--- a/arch/mips/jz4740/board-qi_lb60.c
+++ b/arch/mips/jz4740/board-qi_lb60.c
@@ -427,6 +427,7 @@ static struct platform_device qi_lb60_audio_device = {
427 427
428static struct platform_device *jz_platform_devices[] __initdata = { 428static struct platform_device *jz_platform_devices[] __initdata = {
429 &jz4740_udc_device, 429 &jz4740_udc_device,
430 &jz4740_udc_xceiv_device,
430 &jz4740_mmc_device, 431 &jz4740_mmc_device,
431 &jz4740_nand_device, 432 &jz4740_nand_device,
432 &qi_lb60_keypad, 433 &qi_lb60_keypad,
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c
index df65677f3d0b..a447101cf9f1 100644
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -14,13 +14,14 @@
14 */ 14 */
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/init.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/platform_device.h> 18#include <linux/platform_device.h>
20#include <linux/resource.h> 19#include <linux/resource.h>
21 20
22#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
23 22
23#include <linux/usb/musb.h>
24
24#include <asm/mach-jz4740/platform.h> 25#include <asm/mach-jz4740/platform.h>
25#include <asm/mach-jz4740/base.h> 26#include <asm/mach-jz4740/base.h>
26#include <asm/mach-jz4740/irq.h> 27#include <asm/mach-jz4740/irq.h>
@@ -56,29 +57,35 @@ struct platform_device jz4740_usb_ohci_device = {
56 .resource = jz4740_usb_ohci_resources, 57 .resource = jz4740_usb_ohci_resources,
57}; 58};
58 59
59/* UDC (USB gadget controller) */ 60/* USB Device Controller */
60static struct resource jz4740_usb_gdt_resources[] = { 61struct platform_device jz4740_udc_xceiv_device = {
61 { 62 .name = "usb_phy_gen_xceiv",
62 .start = JZ4740_UDC_BASE_ADDR, 63 .id = 0,
63 .end = JZ4740_UDC_BASE_ADDR + 0x1000 - 1, 64};
64 .flags = IORESOURCE_MEM, 65
66static struct resource jz4740_udc_resources[] = {
67 [0] = {
68 .start = JZ4740_UDC_BASE_ADDR,
69 .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
70 .flags = IORESOURCE_MEM,
65 }, 71 },
66 { 72 [1] = {
67 .start = JZ4740_IRQ_UDC, 73 .start = JZ4740_IRQ_UDC,
68 .end = JZ4740_IRQ_UDC, 74 .end = JZ4740_IRQ_UDC,
69 .flags = IORESOURCE_IRQ, 75 .flags = IORESOURCE_IRQ,
76 .name = "mc",
70 }, 77 },
71}; 78};
72 79
73struct platform_device jz4740_udc_device = { 80struct platform_device jz4740_udc_device = {
74 .name = "jz-udc", 81 .name = "musb-jz4740",
75 .id = -1, 82 .id = -1,
76 .dev = { 83 .dev = {
77 .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask, 84 .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask,
78 .coherent_dma_mask = DMA_BIT_MASK(32), 85 .coherent_dma_mask = DMA_BIT_MASK(32),
79 }, 86 },
80 .num_resources = ARRAY_SIZE(jz4740_usb_gdt_resources), 87 .num_resources = ARRAY_SIZE(jz4740_udc_resources),
81 .resource = jz4740_usb_gdt_resources, 88 .resource = jz4740_udc_resources,
82}; 89};
83 90
84/* MMC/SD controller */ 91/* MMC/SD controller */
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 1c1b71752c84..26c6175e1379 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o
30obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o 30obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
31obj-$(CONFIG_SYNC_R4K) += sync-r4k.o 31obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
32 32
33obj-$(CONFIG_DEBUG_FS) += segment.o
33obj-$(CONFIG_STACKTRACE) += stacktrace.o 34obj-$(CONFIG_STACKTRACE) += stacktrace.o
34obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 35obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
35obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o 36obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o
@@ -55,7 +56,11 @@ obj-$(CONFIG_MIPS_CMP) += smp-cmp.o
55obj-$(CONFIG_CPU_MIPSR2) += spram.o 56obj-$(CONFIG_CPU_MIPSR2) += spram.o
56 57
57obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o 58obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o
59obj-$(CONFIG_MIPS_VPE_LOADER_CMP) += vpe-cmp.o
60obj-$(CONFIG_MIPS_VPE_LOADER_MT) += vpe-mt.o
58obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o 61obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o
62obj-$(CONFIG_MIPS_VPE_APSP_API_CMP) += rtlx-cmp.o
63obj-$(CONFIG_MIPS_VPE_APSP_API_MT) += rtlx-mt.o
59 64
60obj-$(CONFIG_I8259) += i8259.o 65obj-$(CONFIG_I8259) += i8259.o
61obj-$(CONFIG_IRQ_CPU) += irq_cpu.o 66obj-$(CONFIG_IRQ_CPU) += irq_cpu.o
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index 202e581e6096..7faf5f2bee25 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -28,6 +28,18 @@ typedef double elf_fpreg_t;
28typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 28typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
29 29
30/* 30/*
31 * In order to be sure that we don't attempt to execute an O32 binary which
32 * requires 64 bit FP (FR=1) on a system which does not support it we refuse
33 * to execute any binary which has bits specified by the following macro set
34 * in its ELF header flags.
35 */
36#ifdef CONFIG_MIPS_O32_FP64_SUPPORT
37# define __MIPS_O32_FP64_MUST_BE_ZERO 0
38#else
39# define __MIPS_O32_FP64_MUST_BE_ZERO EF_MIPS_FP64
40#endif
41
42/*
31 * This is used to ensure we don't load something for the wrong architecture. 43 * This is used to ensure we don't load something for the wrong architecture.
32 */ 44 */
33#define elf_check_arch(hdr) \ 45#define elf_check_arch(hdr) \
@@ -44,6 +56,8 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
44 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \ 56 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
45 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \ 57 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
46 __res = 0; \ 58 __res = 0; \
59 if (__h->e_flags & __MIPS_O32_FP64_MUST_BE_ZERO) \
60 __res = 0; \
47 \ 61 \
48 __res; \ 62 __res; \
49}) 63})
diff --git a/arch/mips/kernel/bmips_vec.S b/arch/mips/kernel/bmips_vec.S
index bd79c4f9bff4..a5bf73d22fcc 100644
--- a/arch/mips/kernel/bmips_vec.S
+++ b/arch/mips/kernel/bmips_vec.S
@@ -8,11 +8,11 @@
8 * Reset/NMI/re-entry vectors for BMIPS processors 8 * Reset/NMI/re-entry vectors for BMIPS processors
9 */ 9 */
10 10
11#include <linux/init.h>
12 11
13#include <asm/asm.h> 12#include <asm/asm.h>
14#include <asm/asmmacro.h> 13#include <asm/asmmacro.h>
15#include <asm/cacheops.h> 14#include <asm/cacheops.h>
15#include <asm/cpu.h>
16#include <asm/regdef.h> 16#include <asm/regdef.h>
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/stackframe.h> 18#include <asm/stackframe.h>
@@ -91,12 +91,18 @@ NESTED(bmips_reset_nmi_vec, PT_SIZE, sp)
91 beqz k0, bmips_smp_entry 91 beqz k0, bmips_smp_entry
92 92
93#if defined(CONFIG_CPU_BMIPS5000) 93#if defined(CONFIG_CPU_BMIPS5000)
94 mfc0 k0, CP0_PRID
95 li k1, PRID_IMP_BMIPS5000
96 andi k0, 0xff00
97 bne k0, k1, 1f
98
94 /* if we're not on core 0, this must be the SMP boot signal */ 99 /* if we're not on core 0, this must be the SMP boot signal */
95 li k1, (3 << 25) 100 li k1, (3 << 25)
96 mfc0 k0, $22 101 mfc0 k0, $22
97 and k0, k1 102 and k0, k1
98 bnez k0, bmips_smp_entry 103 bnez k0, bmips_smp_entry
99#endif 1041:
105#endif /* CONFIG_CPU_BMIPS5000 */
100#endif /* CONFIG_SMP */ 106#endif /* CONFIG_SMP */
101 107
102 /* nope, it's just a regular NMI */ 108 /* nope, it's just a regular NMI */
@@ -139,7 +145,12 @@ bmips_smp_entry:
139 xori k0, 0x04 145 xori k0, 0x04
140 mtc0 k0, CP0_CONFIG 146 mtc0 k0, CP0_CONFIG
141 147
148 mfc0 k0, CP0_PRID
149 andi k0, 0xff00
142#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 150#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
151 li k1, PRID_IMP_BMIPS43XX
152 bne k0, k1, 2f
153
143 /* initialize CPU1's local I-cache */ 154 /* initialize CPU1's local I-cache */
144 li k0, 0x80000000 155 li k0, 0x80000000
145 li k1, 0x80010000 156 li k1, 0x80010000
@@ -150,14 +161,21 @@ bmips_smp_entry:
1501: cache Index_Store_Tag_I, 0(k0) 1611: cache Index_Store_Tag_I, 0(k0)
151 addiu k0, 16 162 addiu k0, 16
152 bne k0, k1, 1b 163 bne k0, k1, 1b
153#elif defined(CONFIG_CPU_BMIPS5000) 164
165 b 3f
1662:
167#endif /* CONFIG_CPU_BMIPS4350 || CONFIG_CPU_BMIPS4380 */
168#if defined(CONFIG_CPU_BMIPS5000)
154 /* set exception vector base */ 169 /* set exception vector base */
170 li k1, PRID_IMP_BMIPS5000
171 bne k0, k1, 3f
172
155 la k0, ebase 173 la k0, ebase
156 lw k0, 0(k0) 174 lw k0, 0(k0)
157 mtc0 k0, $15, 1 175 mtc0 k0, $15, 1
158 BARRIER 176 BARRIER
159#endif 177#endif /* CONFIG_CPU_BMIPS5000 */
160 1783:
161 /* jump back to kseg0 in case we need to remap the kseg1 area */ 179 /* jump back to kseg0 in case we need to remap the kseg1 area */
162 la k0, 1f 180 la k0, 1f
163 jr k0 181 jr k0
@@ -221,8 +239,18 @@ END(bmips_smp_int_vec)
221LEAF(bmips_enable_xks01) 239LEAF(bmips_enable_xks01)
222 240
223#if defined(CONFIG_XKS01) 241#if defined(CONFIG_XKS01)
224 242 mfc0 t0, CP0_PRID
243 andi t2, t0, 0xff00
225#if defined(CONFIG_CPU_BMIPS4380) 244#if defined(CONFIG_CPU_BMIPS4380)
245 li t1, PRID_IMP_BMIPS43XX
246 bne t2, t1, 1f
247
248 andi t0, 0xff
249 addiu t1, t0, -PRID_REV_BMIPS4380_HI
250 bgtz t1, 2f
251 addiu t0, -PRID_REV_BMIPS4380_LO
252 bltz t0, 2f
253
226 mfc0 t0, $22, 3 254 mfc0 t0, $22, 3
227 li t1, 0x1ff0 255 li t1, 0x1ff0
228 li t2, (1 << 12) | (1 << 9) 256 li t2, (1 << 12) | (1 << 9)
@@ -231,7 +259,13 @@ LEAF(bmips_enable_xks01)
231 or t0, t2 259 or t0, t2
232 mtc0 t0, $22, 3 260 mtc0 t0, $22, 3
233 BARRIER 261 BARRIER
234#elif defined(CONFIG_CPU_BMIPS5000) 262 b 2f
2631:
264#endif /* CONFIG_CPU_BMIPS4380 */
265#if defined(CONFIG_CPU_BMIPS5000)
266 li t1, PRID_IMP_BMIPS5000
267 bne t2, t1, 2f
268
235 mfc0 t0, $22, 5 269 mfc0 t0, $22, 5
236 li t1, 0x01ff 270 li t1, 0x01ff
237 li t2, (1 << 8) | (1 << 5) 271 li t2, (1 << 8) | (1 << 5)
@@ -240,12 +274,8 @@ LEAF(bmips_enable_xks01)
240 or t0, t2 274 or t0, t2
241 mtc0 t0, $22, 5 275 mtc0 t0, $22, 5
242 BARRIER 276 BARRIER
243#else 277#endif /* CONFIG_CPU_BMIPS5000 */
244 2782:
245#error Missing XKS01 setup
246
247#endif
248
249#endif /* defined(CONFIG_XKS01) */ 279#endif /* defined(CONFIG_XKS01) */
250 280
251 jr ra 281 jr ra
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index c814287bdf5d..530f832de02c 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -112,7 +112,7 @@ static inline unsigned long cpu_get_fpu_id(void)
112 unsigned long tmp, fpu_id; 112 unsigned long tmp, fpu_id;
113 113
114 tmp = read_c0_status(); 114 tmp = read_c0_status();
115 __enable_fpu(); 115 __enable_fpu(FPU_AS_IS);
116 fpu_id = read_32bit_cp1_register(CP1_REVISION); 116 fpu_id = read_32bit_cp1_register(CP1_REVISION);
117 write_c0_status(tmp); 117 write_c0_status(tmp);
118 return fpu_id; 118 return fpu_id;
@@ -163,6 +163,25 @@ static void set_isa(struct cpuinfo_mips *c, unsigned int isa)
163static char unknown_isa[] = KERN_ERR \ 163static char unknown_isa[] = KERN_ERR \
164 "Unsupported ISA type, c0.config0: %d."; 164 "Unsupported ISA type, c0.config0: %d.";
165 165
166static void set_ftlb_enable(struct cpuinfo_mips *c, int enable)
167{
168 unsigned int config6;
169 /*
170 * Config6 is implementation dependent and it's currently only
171 * used by proAptiv
172 */
173 if (c->cputype == CPU_PROAPTIV) {
174 config6 = read_c0_config6();
175 if (enable)
176 /* Enable FTLB */
177 write_c0_config6(config6 | MIPS_CONF6_FTLBEN);
178 else
179 /* Disable FTLB */
180 write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN);
181 back_to_back_c0_hazard();
182 }
183}
184
166static inline unsigned int decode_config0(struct cpuinfo_mips *c) 185static inline unsigned int decode_config0(struct cpuinfo_mips *c)
167{ 186{
168 unsigned int config0; 187 unsigned int config0;
@@ -170,8 +189,13 @@ static inline unsigned int decode_config0(struct cpuinfo_mips *c)
170 189
171 config0 = read_c0_config(); 190 config0 = read_c0_config();
172 191
173 if (((config0 & MIPS_CONF_MT) >> 7) == 1) 192 /*
193 * Look for Standard TLB or Dual VTLB and FTLB
194 */
195 if ((((config0 & MIPS_CONF_MT) >> 7) == 1) ||
196 (((config0 & MIPS_CONF_MT) >> 7) == 4))
174 c->options |= MIPS_CPU_TLB; 197 c->options |= MIPS_CPU_TLB;
198
175 isa = (config0 & MIPS_CONF_AT) >> 13; 199 isa = (config0 & MIPS_CONF_AT) >> 13;
176 switch (isa) { 200 switch (isa) {
177 case 0: 201 case 0:
@@ -226,8 +250,11 @@ static inline unsigned int decode_config1(struct cpuinfo_mips *c)
226 c->options |= MIPS_CPU_FPU; 250 c->options |= MIPS_CPU_FPU;
227 c->options |= MIPS_CPU_32FPR; 251 c->options |= MIPS_CPU_32FPR;
228 } 252 }
229 if (cpu_has_tlb) 253 if (cpu_has_tlb) {
230 c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1; 254 c->tlbsize = ((config1 & MIPS_CONF1_TLBS) >> 25) + 1;
255 c->tlbsizevtlb = c->tlbsize;
256 c->tlbsizeftlbsets = 0;
257 }
231 258
232 return config1 & MIPS_CONF_M; 259 return config1 & MIPS_CONF_M;
233} 260}
@@ -272,6 +299,8 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
272 c->options |= MIPS_CPU_MICROMIPS; 299 c->options |= MIPS_CPU_MICROMIPS;
273 if (config3 & MIPS_CONF3_VZ) 300 if (config3 & MIPS_CONF3_VZ)
274 c->ases |= MIPS_ASE_VZ; 301 c->ases |= MIPS_ASE_VZ;
302 if (config3 & MIPS_CONF3_SC)
303 c->options |= MIPS_CPU_SEGMENTS;
275 304
276 return config3 & MIPS_CONF_M; 305 return config3 & MIPS_CONF_M;
277} 306}
@@ -279,12 +308,51 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
279static inline unsigned int decode_config4(struct cpuinfo_mips *c) 308static inline unsigned int decode_config4(struct cpuinfo_mips *c)
280{ 309{
281 unsigned int config4; 310 unsigned int config4;
311 unsigned int newcf4;
312 unsigned int mmuextdef;
313 unsigned int ftlb_page = MIPS_CONF4_FTLBPAGESIZE;
282 314
283 config4 = read_c0_config4(); 315 config4 = read_c0_config4();
284 316
285 if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT 317 if (cpu_has_tlb) {
286 && cpu_has_tlb) 318 if (((config4 & MIPS_CONF4_IE) >> 29) == 2)
287 c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40; 319 c->options |= MIPS_CPU_TLBINV;
320 mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF;
321 switch (mmuextdef) {
322 case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT:
323 c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
324 c->tlbsizevtlb = c->tlbsize;
325 break;
326 case MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT:
327 c->tlbsizevtlb +=
328 ((config4 & MIPS_CONF4_VTLBSIZEEXT) >>
329 MIPS_CONF4_VTLBSIZEEXT_SHIFT) * 0x40;
330 c->tlbsize = c->tlbsizevtlb;
331 ftlb_page = MIPS_CONF4_VFTLBPAGESIZE;
332 /* fall through */
333 case MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT:
334 newcf4 = (config4 & ~ftlb_page) |
335 (page_size_ftlb(mmuextdef) <<
336 MIPS_CONF4_FTLBPAGESIZE_SHIFT);
337 write_c0_config4(newcf4);
338 back_to_back_c0_hazard();
339 config4 = read_c0_config4();
340 if (config4 != newcf4) {
341 pr_err("PAGE_SIZE 0x%lx is not supported by FTLB (config4=0x%x)\n",
342 PAGE_SIZE, config4);
343 /* Switch FTLB off */
344 set_ftlb_enable(c, 0);
345 break;
346 }
347 c->tlbsizeftlbsets = 1 <<
348 ((config4 & MIPS_CONF4_FTLBSETS) >>
349 MIPS_CONF4_FTLBSETS_SHIFT);
350 c->tlbsizeftlbways = ((config4 & MIPS_CONF4_FTLBWAYS) >>
351 MIPS_CONF4_FTLBWAYS_SHIFT) + 2;
352 c->tlbsize += c->tlbsizeftlbways * c->tlbsizeftlbsets;
353 break;
354 }
355 }
288 356
289 c->kscratch_mask = (config4 >> 16) & 0xff; 357 c->kscratch_mask = (config4 >> 16) & 0xff;
290 358
@@ -312,6 +380,9 @@ static void decode_configs(struct cpuinfo_mips *c)
312 380
313 c->scache.flags = MIPS_CACHE_NOT_PRESENT; 381 c->scache.flags = MIPS_CACHE_NOT_PRESENT;
314 382
383 /* Enable FTLB if present */
384 set_ftlb_enable(c, 1);
385
315 ok = decode_config0(c); /* Read Config registers. */ 386 ok = decode_config0(c); /* Read Config registers. */
316 BUG_ON(!ok); /* Arch spec violation! */ 387 BUG_ON(!ok); /* Arch spec violation! */
317 if (ok) 388 if (ok)
@@ -675,7 +746,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
675 746
676static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) 747static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
677{ 748{
678 decode_configs(c);
679 switch (c->processor_id & PRID_IMP_MASK) { 749 switch (c->processor_id & PRID_IMP_MASK) {
680 case PRID_IMP_4KC: 750 case PRID_IMP_4KC:
681 c->cputype = CPU_4KC; 751 c->cputype = CPU_4KC;
@@ -739,8 +809,26 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
739 c->cputype = CPU_74K; 809 c->cputype = CPU_74K;
740 __cpu_name[cpu] = "MIPS 1074Kc"; 810 __cpu_name[cpu] = "MIPS 1074Kc";
741 break; 811 break;
812 case PRID_IMP_INTERAPTIV_UP:
813 c->cputype = CPU_INTERAPTIV;
814 __cpu_name[cpu] = "MIPS interAptiv";
815 break;
816 case PRID_IMP_INTERAPTIV_MP:
817 c->cputype = CPU_INTERAPTIV;
818 __cpu_name[cpu] = "MIPS interAptiv (multi)";
819 break;
820 case PRID_IMP_PROAPTIV_UP:
821 c->cputype = CPU_PROAPTIV;
822 __cpu_name[cpu] = "MIPS proAptiv";
823 break;
824 case PRID_IMP_PROAPTIV_MP:
825 c->cputype = CPU_PROAPTIV;
826 __cpu_name[cpu] = "MIPS proAptiv (multi)";
827 break;
742 } 828 }
743 829
830 decode_configs(c);
831
744 spram_config(); 832 spram_config();
745} 833}
746 834
@@ -943,6 +1031,7 @@ static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
943 1031
944 switch (c->processor_id & PRID_IMP_MASK) { 1032 switch (c->processor_id & PRID_IMP_MASK) {
945 case PRID_IMP_NETLOGIC_XLP2XX: 1033 case PRID_IMP_NETLOGIC_XLP2XX:
1034 case PRID_IMP_NETLOGIC_XLP9XX:
946 c->cputype = CPU_XLP; 1035 c->cputype = CPU_XLP;
947 __cpu_name[cpu] = "Broadcom XLPII"; 1036 __cpu_name[cpu] = "Broadcom XLPII";
948 break; 1037 break;
diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c
index 93aa302948d7..d21264681e97 100644
--- a/arch/mips/kernel/crash.c
+++ b/arch/mips/kernel/crash.c
@@ -5,7 +5,6 @@
5#include <linux/bootmem.h> 5#include <linux/bootmem.h>
6#include <linux/crash_dump.h> 6#include <linux/crash_dump.h>
7#include <linux/delay.h> 7#include <linux/delay.h>
8#include <linux/init.h>
9#include <linux/irq.h> 8#include <linux/irq.h>
10#include <linux/types.h> 9#include <linux/types.h>
11#include <linux/sched.h> 10#include <linux/sched.h>
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 47d7583cd67f..d84f6a509502 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -476,6 +476,7 @@ NESTED(nmi_handler, PT_SIZE, sp)
476 BUILD_HANDLER ov ov sti silent /* #12 */ 476 BUILD_HANDLER ov ov sti silent /* #12 */
477 BUILD_HANDLER tr tr sti silent /* #13 */ 477 BUILD_HANDLER tr tr sti silent /* #13 */
478 BUILD_HANDLER fpe fpe fpe silent /* #15 */ 478 BUILD_HANDLER fpe fpe fpe silent /* #15 */
479 BUILD_HANDLER ftlb ftlb none silent /* #16 */
479 BUILD_HANDLER mdmx mdmx sti silent /* #22 */ 480 BUILD_HANDLER mdmx mdmx sti silent /* #22 */
480#ifdef CONFIG_HARDWARE_WATCHPOINTS 481#ifdef CONFIG_HARDWARE_WATCHPOINTS
481 /* 482 /*
diff --git a/arch/mips/kernel/idle.c b/arch/mips/kernel/idle.c
index f7991d95bff9..3553243bf9d6 100644
--- a/arch/mips/kernel/idle.c
+++ b/arch/mips/kernel/idle.c
@@ -184,6 +184,8 @@ void __init check_wait(void)
184 case CPU_24K: 184 case CPU_24K:
185 case CPU_34K: 185 case CPU_34K:
186 case CPU_1004K: 186 case CPU_1004K:
187 case CPU_INTERAPTIV:
188 case CPU_PROAPTIV:
187 cpu_wait = r4k_wait; 189 cpu_wait = r4k_wait;
188 if (read_c0_config7() & MIPS_CONF7_WII) 190 if (read_c0_config7() & MIPS_CONF7_WII)
189 cpu_wait = r4k_wait_irqoff; 191 cpu_wait = r4k_wait_irqoff;
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 8c58d8a84bf3..00d20974b3e7 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -65,26 +65,25 @@ static int show_cpuinfo(struct seq_file *m, void *v)
65 cpu_data[n].watch_reg_masks[i]); 65 cpu_data[n].watch_reg_masks[i]);
66 seq_printf(m, "]\n"); 66 seq_printf(m, "]\n");
67 } 67 }
68 if (cpu_has_mips_r) { 68
69 seq_printf(m, "isa\t\t\t: mips1"); 69 seq_printf(m, "isa\t\t\t: mips1");
70 if (cpu_has_mips_2) 70 if (cpu_has_mips_2)
71 seq_printf(m, "%s", " mips2"); 71 seq_printf(m, "%s", " mips2");
72 if (cpu_has_mips_3) 72 if (cpu_has_mips_3)
73 seq_printf(m, "%s", " mips3"); 73 seq_printf(m, "%s", " mips3");
74 if (cpu_has_mips_4) 74 if (cpu_has_mips_4)
75 seq_printf(m, "%s", " mips4"); 75 seq_printf(m, "%s", " mips4");
76 if (cpu_has_mips_5) 76 if (cpu_has_mips_5)
77 seq_printf(m, "%s", " mips5"); 77 seq_printf(m, "%s", " mips5");
78 if (cpu_has_mips32r1) 78 if (cpu_has_mips32r1)
79 seq_printf(m, "%s", " mips32r1"); 79 seq_printf(m, "%s", " mips32r1");
80 if (cpu_has_mips32r2) 80 if (cpu_has_mips32r2)
81 seq_printf(m, "%s", " mips32r2"); 81 seq_printf(m, "%s", " mips32r2");
82 if (cpu_has_mips64r1) 82 if (cpu_has_mips64r1)
83 seq_printf(m, "%s", " mips64r1"); 83 seq_printf(m, "%s", " mips64r1");
84 if (cpu_has_mips64r2) 84 if (cpu_has_mips64r2)
85 seq_printf(m, "%s", " mips64r2"); 85 seq_printf(m, "%s", " mips64r2");
86 seq_printf(m, "\n"); 86 seq_printf(m, "\n");
87 }
88 87
89 seq_printf(m, "ASEs implemented\t:"); 88 seq_printf(m, "ASEs implemented\t:");
90 if (cpu_has_mips16) seq_printf(m, "%s", " mips16"); 89 if (cpu_has_mips16) seq_printf(m, "%s", " mips16");
@@ -107,7 +106,14 @@ static int show_cpuinfo(struct seq_file *m, void *v)
107 seq_printf(m, "kscratch registers\t: %d\n", 106 seq_printf(m, "kscratch registers\t: %d\n",
108 hweight8(cpu_data[n].kscratch_mask)); 107 hweight8(cpu_data[n].kscratch_mask));
109 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core); 108 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core);
110 109#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
110 if (cpu_has_mipsmt) {
111 seq_printf(m, "VPE\t\t\t: %d\n", cpu_data[n].vpe_id);
112#if defined(CONFIG_MIPS_MT_SMTC)
113 seq_printf(m, "TC\t\t\t: %d\n", cpu_data[n].tc_id);
114#endif
115 }
116#endif
111 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", 117 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
112 cpu_has_vce ? "%u" : "not available"); 118 cpu_has_vce ? "%u" : "not available");
113 seq_printf(m, fmt, 'D', vced_count); 119 seq_printf(m, fmt, 'D', vced_count);
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index ddc76103e78c..6ae540e133b2 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -60,15 +60,11 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
60 60
61 /* New thread loses kernel privileges. */ 61 /* New thread loses kernel privileges. */
62 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|ST0_FR|KU_MASK); 62 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|ST0_FR|KU_MASK);
63#ifdef CONFIG_64BIT
64 status |= test_thread_flag(TIF_32BIT_REGS) ? 0 : ST0_FR;
65#endif
66 status |= KU_USER; 63 status |= KU_USER;
67 regs->cp0_status = status; 64 regs->cp0_status = status;
68 clear_used_math(); 65 clear_used_math();
69 clear_fpu_owner(); 66 clear_fpu_owner();
70 if (cpu_has_dsp) 67 init_dsp();
71 __init_dsp();
72 regs->cp0_epc = pc; 68 regs->cp0_epc = pc;
73 regs->regs[29] = sp; 69 regs->regs[29] = sp;
74} 70}
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index b52e1d2b33e0..7da9b76db4d9 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -137,13 +137,13 @@ int ptrace_getfpregs(struct task_struct *child, __u32 __user *data)
137 if (cpu_has_mipsmt) { 137 if (cpu_has_mipsmt) {
138 unsigned int vpflags = dvpe(); 138 unsigned int vpflags = dvpe();
139 flags = read_c0_status(); 139 flags = read_c0_status();
140 __enable_fpu(); 140 __enable_fpu(FPU_AS_IS);
141 __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp)); 141 __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
142 write_c0_status(flags); 142 write_c0_status(flags);
143 evpe(vpflags); 143 evpe(vpflags);
144 } else { 144 } else {
145 flags = read_c0_status(); 145 flags = read_c0_status();
146 __enable_fpu(); 146 __enable_fpu(FPU_AS_IS);
147 __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp)); 147 __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
148 write_c0_status(flags); 148 write_c0_status(flags);
149 } 149 }
@@ -408,6 +408,7 @@ long arch_ptrace(struct task_struct *child, long request,
408 /* Read the word at location addr in the USER area. */ 408 /* Read the word at location addr in the USER area. */
409 case PTRACE_PEEKUSR: { 409 case PTRACE_PEEKUSR: {
410 struct pt_regs *regs; 410 struct pt_regs *regs;
411 fpureg_t *fregs;
411 unsigned long tmp = 0; 412 unsigned long tmp = 0;
412 413
413 regs = task_pt_regs(child); 414 regs = task_pt_regs(child);
@@ -418,26 +419,28 @@ long arch_ptrace(struct task_struct *child, long request,
418 tmp = regs->regs[addr]; 419 tmp = regs->regs[addr];
419 break; 420 break;
420 case FPR_BASE ... FPR_BASE + 31: 421 case FPR_BASE ... FPR_BASE + 31:
421 if (tsk_used_math(child)) { 422 if (!tsk_used_math(child)) {
422 fpureg_t *fregs = get_fpu_regs(child); 423 /* FP not yet used */
424 tmp = -1;
425 break;
426 }
427 fregs = get_fpu_regs(child);
423 428
424#ifdef CONFIG_32BIT 429#ifdef CONFIG_32BIT
430 if (test_thread_flag(TIF_32BIT_FPREGS)) {
425 /* 431 /*
426 * The odd registers are actually the high 432 * The odd registers are actually the high
427 * order bits of the values stored in the even 433 * order bits of the values stored in the even
428 * registers - unless we're using r2k_switch.S. 434 * registers - unless we're using r2k_switch.S.
429 */ 435 */
430 if (addr & 1) 436 if (addr & 1)
431 tmp = (unsigned long) (fregs[((addr & ~1) - 32)] >> 32); 437 tmp = fregs[(addr & ~1) - 32] >> 32;
432 else 438 else
433 tmp = (unsigned long) (fregs[(addr - 32)] & 0xffffffff); 439 tmp = fregs[addr - 32];
434#endif 440 break;
435#ifdef CONFIG_64BIT
436 tmp = fregs[addr - FPR_BASE];
437#endif
438 } else {
439 tmp = -1; /* FP not yet used */
440 } 441 }
442#endif
443 tmp = fregs[addr - FPR_BASE];
441 break; 444 break;
442 case PC: 445 case PC:
443 tmp = regs->cp0_epc; 446 tmp = regs->cp0_epc;
@@ -483,13 +486,13 @@ long arch_ptrace(struct task_struct *child, long request,
483 if (cpu_has_mipsmt) { 486 if (cpu_has_mipsmt) {
484 unsigned int vpflags = dvpe(); 487 unsigned int vpflags = dvpe();
485 flags = read_c0_status(); 488 flags = read_c0_status();
486 __enable_fpu(); 489 __enable_fpu(FPU_AS_IS);
487 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 490 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
488 write_c0_status(flags); 491 write_c0_status(flags);
489 evpe(vpflags); 492 evpe(vpflags);
490 } else { 493 } else {
491 flags = read_c0_status(); 494 flags = read_c0_status();
492 __enable_fpu(); 495 __enable_fpu(FPU_AS_IS);
493 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 496 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
494 write_c0_status(flags); 497 write_c0_status(flags);
495 } 498 }
@@ -554,22 +557,25 @@ long arch_ptrace(struct task_struct *child, long request,
554 child->thread.fpu.fcr31 = 0; 557 child->thread.fpu.fcr31 = 0;
555 } 558 }
556#ifdef CONFIG_32BIT 559#ifdef CONFIG_32BIT
557 /* 560 if (test_thread_flag(TIF_32BIT_FPREGS)) {
558 * The odd registers are actually the high order bits 561 /*
559 * of the values stored in the even registers - unless 562 * The odd registers are actually the high
560 * we're using r2k_switch.S. 563 * order bits of the values stored in the even
561 */ 564 * registers - unless we're using r2k_switch.S.
562 if (addr & 1) { 565 */
563 fregs[(addr & ~1) - FPR_BASE] &= 0xffffffff; 566 if (addr & 1) {
564 fregs[(addr & ~1) - FPR_BASE] |= ((unsigned long long) data) << 32; 567 fregs[(addr & ~1) - FPR_BASE] &=
565 } else { 568 0xffffffff;
566 fregs[addr - FPR_BASE] &= ~0xffffffffLL; 569 fregs[(addr & ~1) - FPR_BASE] |=
567 fregs[addr - FPR_BASE] |= data; 570 ((u64)data) << 32;
571 } else {
572 fregs[addr - FPR_BASE] &= ~0xffffffffLL;
573 fregs[addr - FPR_BASE] |= data;
574 }
575 break;
568 } 576 }
569#endif 577#endif
570#ifdef CONFIG_64BIT
571 fregs[addr - FPR_BASE] = data; 578 fregs[addr - FPR_BASE] = data;
572#endif
573 break; 579 break;
574 } 580 }
575 case PC: 581 case PC:
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 9486055ba660..b8aa2dd5b00b 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -80,6 +80,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
80 /* Read the word at location addr in the USER area. */ 80 /* Read the word at location addr in the USER area. */
81 case PTRACE_PEEKUSR: { 81 case PTRACE_PEEKUSR: {
82 struct pt_regs *regs; 82 struct pt_regs *regs;
83 fpureg_t *fregs;
83 unsigned int tmp; 84 unsigned int tmp;
84 85
85 regs = task_pt_regs(child); 86 regs = task_pt_regs(child);
@@ -90,21 +91,25 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
90 tmp = regs->regs[addr]; 91 tmp = regs->regs[addr];
91 break; 92 break;
92 case FPR_BASE ... FPR_BASE + 31: 93 case FPR_BASE ... FPR_BASE + 31:
93 if (tsk_used_math(child)) { 94 if (!tsk_used_math(child)) {
94 fpureg_t *fregs = get_fpu_regs(child); 95 /* FP not yet used */
95 96 tmp = -1;
97 break;
98 }
99 fregs = get_fpu_regs(child);
100 if (test_thread_flag(TIF_32BIT_FPREGS)) {
96 /* 101 /*
97 * The odd registers are actually the high 102 * The odd registers are actually the high
98 * order bits of the values stored in the even 103 * order bits of the values stored in the even
99 * registers - unless we're using r2k_switch.S. 104 * registers - unless we're using r2k_switch.S.
100 */ 105 */
101 if (addr & 1) 106 if (addr & 1)
102 tmp = (unsigned long) (fregs[((addr & ~1) - 32)] >> 32); 107 tmp = fregs[(addr & ~1) - 32] >> 32;
103 else 108 else
104 tmp = (unsigned long) (fregs[(addr - 32)] & 0xffffffff); 109 tmp = fregs[addr - 32];
105 } else { 110 break;
106 tmp = -1; /* FP not yet used */
107 } 111 }
112 tmp = fregs[addr - FPR_BASE];
108 break; 113 break;
109 case PC: 114 case PC:
110 tmp = regs->cp0_epc; 115 tmp = regs->cp0_epc;
@@ -147,13 +152,13 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
147 if (cpu_has_mipsmt) { 152 if (cpu_has_mipsmt) {
148 unsigned int vpflags = dvpe(); 153 unsigned int vpflags = dvpe();
149 flags = read_c0_status(); 154 flags = read_c0_status();
150 __enable_fpu(); 155 __enable_fpu(FPU_AS_IS);
151 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 156 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
152 write_c0_status(flags); 157 write_c0_status(flags);
153 evpe(vpflags); 158 evpe(vpflags);
154 } else { 159 } else {
155 flags = read_c0_status(); 160 flags = read_c0_status();
156 __enable_fpu(); 161 __enable_fpu(FPU_AS_IS);
157 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 162 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
158 write_c0_status(flags); 163 write_c0_status(flags);
159 } 164 }
@@ -236,20 +241,24 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
236 sizeof(child->thread.fpu)); 241 sizeof(child->thread.fpu));
237 child->thread.fpu.fcr31 = 0; 242 child->thread.fpu.fcr31 = 0;
238 } 243 }
239 /* 244 if (test_thread_flag(TIF_32BIT_FPREGS)) {
240 * The odd registers are actually the high order bits 245 /*
241 * of the values stored in the even registers - unless 246 * The odd registers are actually the high
242 * we're using r2k_switch.S. 247 * order bits of the values stored in the even
243 */ 248 * registers - unless we're using r2k_switch.S.
244 if (addr & 1) { 249 */
245 fregs[(addr & ~1) - FPR_BASE] &= 0xffffffff; 250 if (addr & 1) {
246 fregs[(addr & ~1) - FPR_BASE] |= ((unsigned long long) data) << 32; 251 fregs[(addr & ~1) - FPR_BASE] &=
247 } else { 252 0xffffffff;
248 fregs[addr - FPR_BASE] &= ~0xffffffffLL; 253 fregs[(addr & ~1) - FPR_BASE] |=
249 /* Must cast, lest sign extension fill upper 254 ((u64)data) << 32;
250 bits! */ 255 } else {
251 fregs[addr - FPR_BASE] |= (unsigned int)data; 256 fregs[addr - FPR_BASE] &= ~0xffffffffLL;
257 fregs[addr - FPR_BASE] |= data;
258 }
259 break;
252 } 260 }
261 fregs[addr - FPR_BASE] = data;
253 break; 262 break;
254 } 263 }
255 case PC: 264 case PC:
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 55ffe149dae9..253b2fb52026 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -35,7 +35,15 @@
35LEAF(_save_fp_context) 35LEAF(_save_fp_context)
36 cfc1 t1, fcr31 36 cfc1 t1, fcr31
37 37
38#ifdef CONFIG_64BIT 38#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2)
39 .set push
40#ifdef CONFIG_MIPS32_R2
41 .set mips64r2
42 mfc0 t0, CP0_STATUS
43 sll t0, t0, 5
44 bgez t0, 1f # skip storing odd if FR=0
45 nop
46#endif
39 /* Store the 16 odd double precision registers */ 47 /* Store the 16 odd double precision registers */
40 EX sdc1 $f1, SC_FPREGS+8(a0) 48 EX sdc1 $f1, SC_FPREGS+8(a0)
41 EX sdc1 $f3, SC_FPREGS+24(a0) 49 EX sdc1 $f3, SC_FPREGS+24(a0)
@@ -53,6 +61,7 @@ LEAF(_save_fp_context)
53 EX sdc1 $f27, SC_FPREGS+216(a0) 61 EX sdc1 $f27, SC_FPREGS+216(a0)
54 EX sdc1 $f29, SC_FPREGS+232(a0) 62 EX sdc1 $f29, SC_FPREGS+232(a0)
55 EX sdc1 $f31, SC_FPREGS+248(a0) 63 EX sdc1 $f31, SC_FPREGS+248(a0)
641: .set pop
56#endif 65#endif
57 66
58 /* Store the 16 even double precision registers */ 67 /* Store the 16 even double precision registers */
@@ -82,7 +91,31 @@ LEAF(_save_fp_context)
82LEAF(_save_fp_context32) 91LEAF(_save_fp_context32)
83 cfc1 t1, fcr31 92 cfc1 t1, fcr31
84 93
85 EX sdc1 $f0, SC32_FPREGS+0(a0) 94 mfc0 t0, CP0_STATUS
95 sll t0, t0, 5
96 bgez t0, 1f # skip storing odd if FR=0
97 nop
98
99 /* Store the 16 odd double precision registers */
100 EX sdc1 $f1, SC32_FPREGS+8(a0)
101 EX sdc1 $f3, SC32_FPREGS+24(a0)
102 EX sdc1 $f5, SC32_FPREGS+40(a0)
103 EX sdc1 $f7, SC32_FPREGS+56(a0)
104 EX sdc1 $f9, SC32_FPREGS+72(a0)
105 EX sdc1 $f11, SC32_FPREGS+88(a0)
106 EX sdc1 $f13, SC32_FPREGS+104(a0)
107 EX sdc1 $f15, SC32_FPREGS+120(a0)
108 EX sdc1 $f17, SC32_FPREGS+136(a0)
109 EX sdc1 $f19, SC32_FPREGS+152(a0)
110 EX sdc1 $f21, SC32_FPREGS+168(a0)
111 EX sdc1 $f23, SC32_FPREGS+184(a0)
112 EX sdc1 $f25, SC32_FPREGS+200(a0)
113 EX sdc1 $f27, SC32_FPREGS+216(a0)
114 EX sdc1 $f29, SC32_FPREGS+232(a0)
115 EX sdc1 $f31, SC32_FPREGS+248(a0)
116
117 /* Store the 16 even double precision registers */
1181: EX sdc1 $f0, SC32_FPREGS+0(a0)
86 EX sdc1 $f2, SC32_FPREGS+16(a0) 119 EX sdc1 $f2, SC32_FPREGS+16(a0)
87 EX sdc1 $f4, SC32_FPREGS+32(a0) 120 EX sdc1 $f4, SC32_FPREGS+32(a0)
88 EX sdc1 $f6, SC32_FPREGS+48(a0) 121 EX sdc1 $f6, SC32_FPREGS+48(a0)
@@ -114,7 +147,16 @@ LEAF(_save_fp_context32)
114 */ 147 */
115LEAF(_restore_fp_context) 148LEAF(_restore_fp_context)
116 EX lw t0, SC_FPC_CSR(a0) 149 EX lw t0, SC_FPC_CSR(a0)
117#ifdef CONFIG_64BIT 150
151#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2)
152 .set push
153#ifdef CONFIG_MIPS32_R2
154 .set mips64r2
155 mfc0 t0, CP0_STATUS
156 sll t0, t0, 5
157 bgez t0, 1f # skip loading odd if FR=0
158 nop
159#endif
118 EX ldc1 $f1, SC_FPREGS+8(a0) 160 EX ldc1 $f1, SC_FPREGS+8(a0)
119 EX ldc1 $f3, SC_FPREGS+24(a0) 161 EX ldc1 $f3, SC_FPREGS+24(a0)
120 EX ldc1 $f5, SC_FPREGS+40(a0) 162 EX ldc1 $f5, SC_FPREGS+40(a0)
@@ -131,6 +173,7 @@ LEAF(_restore_fp_context)
131 EX ldc1 $f27, SC_FPREGS+216(a0) 173 EX ldc1 $f27, SC_FPREGS+216(a0)
132 EX ldc1 $f29, SC_FPREGS+232(a0) 174 EX ldc1 $f29, SC_FPREGS+232(a0)
133 EX ldc1 $f31, SC_FPREGS+248(a0) 175 EX ldc1 $f31, SC_FPREGS+248(a0)
1761: .set pop
134#endif 177#endif
135 EX ldc1 $f0, SC_FPREGS+0(a0) 178 EX ldc1 $f0, SC_FPREGS+0(a0)
136 EX ldc1 $f2, SC_FPREGS+16(a0) 179 EX ldc1 $f2, SC_FPREGS+16(a0)
@@ -157,7 +200,30 @@ LEAF(_restore_fp_context)
157LEAF(_restore_fp_context32) 200LEAF(_restore_fp_context32)
158 /* Restore an o32 sigcontext. */ 201 /* Restore an o32 sigcontext. */
159 EX lw t0, SC32_FPC_CSR(a0) 202 EX lw t0, SC32_FPC_CSR(a0)
160 EX ldc1 $f0, SC32_FPREGS+0(a0) 203
204 mfc0 t0, CP0_STATUS
205 sll t0, t0, 5
206 bgez t0, 1f # skip loading odd if FR=0
207 nop
208
209 EX ldc1 $f1, SC32_FPREGS+8(a0)
210 EX ldc1 $f3, SC32_FPREGS+24(a0)
211 EX ldc1 $f5, SC32_FPREGS+40(a0)
212 EX ldc1 $f7, SC32_FPREGS+56(a0)
213 EX ldc1 $f9, SC32_FPREGS+72(a0)
214 EX ldc1 $f11, SC32_FPREGS+88(a0)
215 EX ldc1 $f13, SC32_FPREGS+104(a0)
216 EX ldc1 $f15, SC32_FPREGS+120(a0)
217 EX ldc1 $f17, SC32_FPREGS+136(a0)
218 EX ldc1 $f19, SC32_FPREGS+152(a0)
219 EX ldc1 $f21, SC32_FPREGS+168(a0)
220 EX ldc1 $f23, SC32_FPREGS+184(a0)
221 EX ldc1 $f25, SC32_FPREGS+200(a0)
222 EX ldc1 $f27, SC32_FPREGS+216(a0)
223 EX ldc1 $f29, SC32_FPREGS+232(a0)
224 EX ldc1 $f31, SC32_FPREGS+248(a0)
225
2261: EX ldc1 $f0, SC32_FPREGS+0(a0)
161 EX ldc1 $f2, SC32_FPREGS+16(a0) 227 EX ldc1 $f2, SC32_FPREGS+16(a0)
162 EX ldc1 $f4, SC32_FPREGS+32(a0) 228 EX ldc1 $f4, SC32_FPREGS+32(a0)
163 EX ldc1 $f6, SC32_FPREGS+48(a0) 229 EX ldc1 $f6, SC32_FPREGS+48(a0)
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 078de5eaca8f..cc78dd9a17c7 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -123,7 +123,7 @@
123 * Save a thread's fp context. 123 * Save a thread's fp context.
124 */ 124 */
125LEAF(_save_fp) 125LEAF(_save_fp)
126#ifdef CONFIG_64BIT 126#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
127 mfc0 t0, CP0_STATUS 127 mfc0 t0, CP0_STATUS
128#endif 128#endif
129 fpu_save_double a0 t0 t1 # clobbers t1 129 fpu_save_double a0 t0 t1 # clobbers t1
@@ -134,7 +134,7 @@ LEAF(_save_fp)
134 * Restore a thread's fp context. 134 * Restore a thread's fp context.
135 */ 135 */
136LEAF(_restore_fp) 136LEAF(_restore_fp)
137#ifdef CONFIG_64BIT 137#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
138 mfc0 t0, CP0_STATUS 138 mfc0 t0, CP0_STATUS
139#endif 139#endif
140 fpu_restore_double a0 t0 t1 # clobbers t1 140 fpu_restore_double a0 t0 t1 # clobbers t1
@@ -228,6 +228,47 @@ LEAF(_init_fpu)
228 mtc1 t1, $f29 228 mtc1 t1, $f29
229 mtc1 t1, $f30 229 mtc1 t1, $f30
230 mtc1 t1, $f31 230 mtc1 t1, $f31
231
232#ifdef CONFIG_CPU_MIPS32_R2
233 .set push
234 .set mips64r2
235 sll t0, t0, 5 # is Status.FR set?
236 bgez t0, 1f # no: skip setting upper 32b
237
238 mthc1 t1, $f0
239 mthc1 t1, $f1
240 mthc1 t1, $f2
241 mthc1 t1, $f3
242 mthc1 t1, $f4
243 mthc1 t1, $f5
244 mthc1 t1, $f6
245 mthc1 t1, $f7
246 mthc1 t1, $f8
247 mthc1 t1, $f9
248 mthc1 t1, $f10
249 mthc1 t1, $f11
250 mthc1 t1, $f12
251 mthc1 t1, $f13
252 mthc1 t1, $f14
253 mthc1 t1, $f15
254 mthc1 t1, $f16
255 mthc1 t1, $f17
256 mthc1 t1, $f18
257 mthc1 t1, $f19
258 mthc1 t1, $f20
259 mthc1 t1, $f21
260 mthc1 t1, $f22
261 mthc1 t1, $f23
262 mthc1 t1, $f24
263 mthc1 t1, $f25
264 mthc1 t1, $f26
265 mthc1 t1, $f27
266 mthc1 t1, $f28
267 mthc1 t1, $f29
268 mthc1 t1, $f30
269 mthc1 t1, $f31
2701: .set pop
271#endif /* CONFIG_CPU_MIPS32_R2 */
231#else 272#else
232 .set mips3 273 .set mips3
233 dmtc1 t1, $f0 274 dmtc1 t1, $f0
diff --git a/arch/mips/kernel/rtlx-cmp.c b/arch/mips/kernel/rtlx-cmp.c
new file mode 100644
index 000000000000..56dc69635153
--- /dev/null
+++ b/arch/mips/kernel/rtlx-cmp.c
@@ -0,0 +1,116 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
8 */
9#include <linux/device.h>
10#include <linux/fs.h>
11#include <linux/err.h>
12#include <linux/wait.h>
13#include <linux/sched.h>
14#include <linux/smp.h>
15
16#include <asm/mips_mt.h>
17#include <asm/vpe.h>
18#include <asm/rtlx.h>
19
20static int major;
21
22static void rtlx_interrupt(void)
23{
24 int i;
25 struct rtlx_info *info;
26 struct rtlx_info **p = vpe_get_shared(aprp_cpu_index());
27
28 if (p == NULL || *p == NULL)
29 return;
30
31 info = *p;
32
33 if (info->ap_int_pending == 1 && smp_processor_id() == 0) {
34 for (i = 0; i < RTLX_CHANNELS; i++) {
35 wake_up(&channel_wqs[i].lx_queue);
36 wake_up(&channel_wqs[i].rt_queue);
37 }
38 info->ap_int_pending = 0;
39 }
40}
41
42void _interrupt_sp(void)
43{
44 smp_send_reschedule(aprp_cpu_index());
45}
46
47int __init rtlx_module_init(void)
48{
49 struct device *dev;
50 int i, err;
51
52 if (!cpu_has_mipsmt) {
53 pr_warn("VPE loader: not a MIPS MT capable processor\n");
54 return -ENODEV;
55 }
56
57 if (num_possible_cpus() - aprp_cpu_index() < 1) {
58 pr_warn("No TCs reserved for AP/SP, not initializing RTLX.\n"
59 "Pass maxcpus=<n> argument as kernel argument\n");
60
61 return -ENODEV;
62 }
63
64 major = register_chrdev(0, RTLX_MODULE_NAME, &rtlx_fops);
65 if (major < 0) {
66 pr_err("rtlx_module_init: unable to register device\n");
67 return major;
68 }
69
70 /* initialise the wait queues */
71 for (i = 0; i < RTLX_CHANNELS; i++) {
72 init_waitqueue_head(&channel_wqs[i].rt_queue);
73 init_waitqueue_head(&channel_wqs[i].lx_queue);
74 atomic_set(&channel_wqs[i].in_open, 0);
75 mutex_init(&channel_wqs[i].mutex);
76
77 dev = device_create(mt_class, NULL, MKDEV(major, i), NULL,
78 "%s%d", RTLX_MODULE_NAME, i);
79 if (IS_ERR(dev)) {
80 err = PTR_ERR(dev);
81 goto out_chrdev;
82 }
83 }
84
85 /* set up notifiers */
86 rtlx_notify.start = rtlx_starting;
87 rtlx_notify.stop = rtlx_stopping;
88 vpe_notify(aprp_cpu_index(), &rtlx_notify);
89
90 if (cpu_has_vint) {
91 aprp_hook = rtlx_interrupt;
92 } else {
93 pr_err("APRP RTLX init on non-vectored-interrupt processor\n");
94 err = -ENODEV;
95 goto out_class;
96 }
97
98 return 0;
99
100out_class:
101 for (i = 0; i < RTLX_CHANNELS; i++)
102 device_destroy(mt_class, MKDEV(major, i));
103out_chrdev:
104 unregister_chrdev(major, RTLX_MODULE_NAME);
105
106 return err;
107}
108
109void __exit rtlx_module_exit(void)
110{
111 int i;
112
113 for (i = 0; i < RTLX_CHANNELS; i++)
114 device_destroy(mt_class, MKDEV(major, i));
115 unregister_chrdev(major, RTLX_MODULE_NAME);
116}
diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c
new file mode 100644
index 000000000000..91d61ba422b4
--- /dev/null
+++ b/arch/mips/kernel/rtlx-mt.c
@@ -0,0 +1,148 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
8 */
9#include <linux/device.h>
10#include <linux/fs.h>
11#include <linux/err.h>
12#include <linux/wait.h>
13#include <linux/sched.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16
17#include <asm/mips_mt.h>
18#include <asm/vpe.h>
19#include <asm/rtlx.h>
20
21static int major;
22
23static void rtlx_dispatch(void)
24{
25 if (read_c0_cause() & read_c0_status() & C_SW0)
26 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ);
27}
28
29/*
30 * Interrupt handler may be called before rtlx_init has otherwise had
31 * a chance to run.
32 */
33static irqreturn_t rtlx_interrupt(int irq, void *dev_id)
34{
35 unsigned int vpeflags;
36 unsigned long flags;
37 int i;
38
39 /* Ought not to be strictly necessary for SMTC builds */
40 local_irq_save(flags);
41 vpeflags = dvpe();
42 set_c0_status(0x100 << MIPS_CPU_RTLX_IRQ);
43 irq_enable_hazard();
44 evpe(vpeflags);
45 local_irq_restore(flags);
46
47 for (i = 0; i < RTLX_CHANNELS; i++) {
48 wake_up(&channel_wqs[i].lx_queue);
49 wake_up(&channel_wqs[i].rt_queue);
50 }
51
52 return IRQ_HANDLED;
53}
54
55static struct irqaction rtlx_irq = {
56 .handler = rtlx_interrupt,
57 .name = "RTLX",
58};
59
60static int rtlx_irq_num = MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ;
61
62void _interrupt_sp(void)
63{
64 unsigned long flags;
65
66 local_irq_save(flags);
67 dvpe();
68 settc(1);
69 write_vpe_c0_cause(read_vpe_c0_cause() | C_SW0);
70 evpe(EVPE_ENABLE);
71 local_irq_restore(flags);
72}
73
74int __init rtlx_module_init(void)
75{
76 struct device *dev;
77 int i, err;
78
79 if (!cpu_has_mipsmt) {
80 pr_warn("VPE loader: not a MIPS MT capable processor\n");
81 return -ENODEV;
82 }
83
84 if (aprp_cpu_index() == 0) {
85 pr_warn("No TCs reserved for AP/SP, not initializing RTLX.\n"
86 "Pass maxtcs=<n> argument as kernel argument\n");
87
88 return -ENODEV;
89 }
90
91 major = register_chrdev(0, RTLX_MODULE_NAME, &rtlx_fops);
92 if (major < 0) {
93 pr_err("rtlx_module_init: unable to register device\n");
94 return major;
95 }
96
97 /* initialise the wait queues */
98 for (i = 0; i < RTLX_CHANNELS; i++) {
99 init_waitqueue_head(&channel_wqs[i].rt_queue);
100 init_waitqueue_head(&channel_wqs[i].lx_queue);
101 atomic_set(&channel_wqs[i].in_open, 0);
102 mutex_init(&channel_wqs[i].mutex);
103
104 dev = device_create(mt_class, NULL, MKDEV(major, i), NULL,
105 "%s%d", RTLX_MODULE_NAME, i);
106 if (IS_ERR(dev)) {
107 err = PTR_ERR(dev);
108 goto out_chrdev;
109 }
110 }
111
112 /* set up notifiers */
113 rtlx_notify.start = rtlx_starting;
114 rtlx_notify.stop = rtlx_stopping;
115 vpe_notify(aprp_cpu_index(), &rtlx_notify);
116
117 if (cpu_has_vint) {
118 aprp_hook = rtlx_dispatch;
119 } else {
120 pr_err("APRP RTLX init on non-vectored-interrupt processor\n");
121 err = -ENODEV;
122 goto out_class;
123 }
124
125 rtlx_irq.dev_id = rtlx;
126 err = setup_irq(rtlx_irq_num, &rtlx_irq);
127 if (err)
128 goto out_class;
129
130 return 0;
131
132out_class:
133 for (i = 0; i < RTLX_CHANNELS; i++)
134 device_destroy(mt_class, MKDEV(major, i));
135out_chrdev:
136 unregister_chrdev(major, RTLX_MODULE_NAME);
137
138 return err;
139}
140
141void __exit rtlx_module_exit(void)
142{
143 int i;
144
145 for (i = 0; i < RTLX_CHANNELS; i++)
146 device_destroy(mt_class, MKDEV(major, i));
147 unregister_chrdev(major, RTLX_MODULE_NAME);
148}
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 2c12ea1668d1..31b1b763cb29 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -1,114 +1,51 @@
1/* 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 *
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 6 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org) 7 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org)
4 * 8 * Copyright (C) 2013 Imagination Technologies Ltd.
5 * 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 * 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
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 */ 9 */
19
20#include <linux/device.h>
21#include <linux/kernel.h> 10#include <linux/kernel.h>
22#include <linux/fs.h> 11#include <linux/fs.h>
23#include <linux/init.h>
24#include <asm/uaccess.h>
25#include <linux/list.h>
26#include <linux/vmalloc.h>
27#include <linux/elf.h>
28#include <linux/seq_file.h>
29#include <linux/syscalls.h> 12#include <linux/syscalls.h>
30#include <linux/moduleloader.h> 13#include <linux/moduleloader.h>
31#include <linux/interrupt.h> 14#include <linux/atomic.h>
32#include <linux/poll.h>
33#include <linux/sched.h>
34#include <linux/wait.h>
35#include <asm/mipsmtregs.h> 15#include <asm/mipsmtregs.h>
36#include <asm/mips_mt.h> 16#include <asm/mips_mt.h>
37#include <asm/cacheflush.h>
38#include <linux/atomic.h>
39#include <asm/cpu.h>
40#include <asm/processor.h> 17#include <asm/processor.h>
41#include <asm/vpe.h>
42#include <asm/rtlx.h> 18#include <asm/rtlx.h>
43#include <asm/setup.h> 19#include <asm/setup.h>
20#include <asm/vpe.h>
44 21
45static struct rtlx_info *rtlx;
46static int major;
47static char module_name[] = "rtlx";
48
49static struct chan_waitqueues {
50 wait_queue_head_t rt_queue;
51 wait_queue_head_t lx_queue;
52 atomic_t in_open;
53 struct mutex mutex;
54} channel_wqs[RTLX_CHANNELS];
55
56static struct vpe_notifications notify;
57static int sp_stopping; 22static int sp_stopping;
58 23struct rtlx_info *rtlx;
59extern void *vpe_get_shared(int index); 24struct chan_waitqueues channel_wqs[RTLX_CHANNELS];
60 25struct vpe_notifications rtlx_notify;
61static void rtlx_dispatch(void) 26void (*aprp_hook)(void) = NULL;
62{ 27EXPORT_SYMBOL(aprp_hook);
63 do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ);
64}
65
66
67/* Interrupt handler may be called before rtlx_init has otherwise had
68 a chance to run.
69*/
70static irqreturn_t rtlx_interrupt(int irq, void *dev_id)
71{
72 unsigned int vpeflags;
73 unsigned long flags;
74 int i;
75
76 /* Ought not to be strictly necessary for SMTC builds */
77 local_irq_save(flags);
78 vpeflags = dvpe();
79 set_c0_status(0x100 << MIPS_CPU_RTLX_IRQ);
80 irq_enable_hazard();
81 evpe(vpeflags);
82 local_irq_restore(flags);
83
84 for (i = 0; i < RTLX_CHANNELS; i++) {
85 wake_up(&channel_wqs[i].lx_queue);
86 wake_up(&channel_wqs[i].rt_queue);
87 }
88
89 return IRQ_HANDLED;
90}
91 28
92static void __used dump_rtlx(void) 29static void __used dump_rtlx(void)
93{ 30{
94 int i; 31 int i;
95 32
96 printk("id 0x%lx state %d\n", rtlx->id, rtlx->state); 33 pr_info("id 0x%lx state %d\n", rtlx->id, rtlx->state);
97 34
98 for (i = 0; i < RTLX_CHANNELS; i++) { 35 for (i = 0; i < RTLX_CHANNELS; i++) {
99 struct rtlx_channel *chan = &rtlx->channel[i]; 36 struct rtlx_channel *chan = &rtlx->channel[i];
100 37
101 printk(" rt_state %d lx_state %d buffer_size %d\n", 38 pr_info(" rt_state %d lx_state %d buffer_size %d\n",
102 chan->rt_state, chan->lx_state, chan->buffer_size); 39 chan->rt_state, chan->lx_state, chan->buffer_size);
103 40
104 printk(" rt_read %d rt_write %d\n", 41 pr_info(" rt_read %d rt_write %d\n",
105 chan->rt_read, chan->rt_write); 42 chan->rt_read, chan->rt_write);
106 43
107 printk(" lx_read %d lx_write %d\n", 44 pr_info(" lx_read %d lx_write %d\n",
108 chan->lx_read, chan->lx_write); 45 chan->lx_read, chan->lx_write);
109 46
110 printk(" rt_buffer <%s>\n", chan->rt_buffer); 47 pr_info(" rt_buffer <%s>\n", chan->rt_buffer);
111 printk(" lx_buffer <%s>\n", chan->lx_buffer); 48 pr_info(" lx_buffer <%s>\n", chan->lx_buffer);
112 } 49 }
113} 50}
114 51
@@ -116,8 +53,7 @@ static void __used dump_rtlx(void)
116static int rtlx_init(struct rtlx_info *rtlxi) 53static int rtlx_init(struct rtlx_info *rtlxi)
117{ 54{
118 if (rtlxi->id != RTLX_ID) { 55 if (rtlxi->id != RTLX_ID) {
119 printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n", 56 pr_err("no valid RTLX id at 0x%p 0x%lx\n", rtlxi, rtlxi->id);
120 rtlxi, rtlxi->id);
121 return -ENOEXEC; 57 return -ENOEXEC;
122 } 58 }
123 59
@@ -127,20 +63,20 @@ static int rtlx_init(struct rtlx_info *rtlxi)
127} 63}
128 64
129/* notifications */ 65/* notifications */
130static void starting(int vpe) 66void rtlx_starting(int vpe)
131{ 67{
132 int i; 68 int i;
133 sp_stopping = 0; 69 sp_stopping = 0;
134 70
135 /* force a reload of rtlx */ 71 /* force a reload of rtlx */
136 rtlx=NULL; 72 rtlx = NULL;
137 73
138 /* wake up any sleeping rtlx_open's */ 74 /* wake up any sleeping rtlx_open's */
139 for (i = 0; i < RTLX_CHANNELS; i++) 75 for (i = 0; i < RTLX_CHANNELS; i++)
140 wake_up_interruptible(&channel_wqs[i].lx_queue); 76 wake_up_interruptible(&channel_wqs[i].lx_queue);
141} 77}
142 78
143static void stopping(int vpe) 79void rtlx_stopping(int vpe)
144{ 80{
145 int i; 81 int i;
146 82
@@ -158,31 +94,30 @@ int rtlx_open(int index, int can_sleep)
158 int ret = 0; 94 int ret = 0;
159 95
160 if (index >= RTLX_CHANNELS) { 96 if (index >= RTLX_CHANNELS) {
161 printk(KERN_DEBUG "rtlx_open index out of range\n"); 97 pr_debug(KERN_DEBUG "rtlx_open index out of range\n");
162 return -ENOSYS; 98 return -ENOSYS;
163 } 99 }
164 100
165 if (atomic_inc_return(&channel_wqs[index].in_open) > 1) { 101 if (atomic_inc_return(&channel_wqs[index].in_open) > 1) {
166 printk(KERN_DEBUG "rtlx_open channel %d already opened\n", 102 pr_debug(KERN_DEBUG "rtlx_open channel %d already opened\n", index);
167 index);
168 ret = -EBUSY; 103 ret = -EBUSY;
169 goto out_fail; 104 goto out_fail;
170 } 105 }
171 106
172 if (rtlx == NULL) { 107 if (rtlx == NULL) {
173 if( (p = vpe_get_shared(tclimit)) == NULL) { 108 p = vpe_get_shared(aprp_cpu_index());
174 if (can_sleep) { 109 if (p == NULL) {
175 ret = __wait_event_interruptible( 110 if (can_sleep) {
111 ret = __wait_event_interruptible(
176 channel_wqs[index].lx_queue, 112 channel_wqs[index].lx_queue,
177 (p = vpe_get_shared(tclimit))); 113 (p = vpe_get_shared(aprp_cpu_index())));
178 if (ret) 114 if (ret)
115 goto out_fail;
116 } else {
117 pr_debug("No SP program loaded, and device opened with O_NONBLOCK\n");
118 ret = -ENOSYS;
179 goto out_fail; 119 goto out_fail;
180 } else { 120 }
181 printk(KERN_DEBUG "No SP program loaded, and device "
182 "opened with O_NONBLOCK\n");
183 ret = -ENOSYS;
184 goto out_fail;
185 }
186 } 121 }
187 122
188 smp_rmb(); 123 smp_rmb();
@@ -204,24 +139,24 @@ int rtlx_open(int index, int can_sleep)
204 ret = -ERESTARTSYS; 139 ret = -ERESTARTSYS;
205 goto out_fail; 140 goto out_fail;
206 } 141 }
207 finish_wait(&channel_wqs[index].lx_queue, &wait); 142 finish_wait(&channel_wqs[index].lx_queue,
143 &wait);
208 } else { 144 } else {
209 pr_err(" *vpe_get_shared is NULL. " 145 pr_err(" *vpe_get_shared is NULL. Has an SP program been loaded?\n");
210 "Has an SP program been loaded?\n");
211 ret = -ENOSYS; 146 ret = -ENOSYS;
212 goto out_fail; 147 goto out_fail;
213 } 148 }
214 } 149 }
215 150
216 if ((unsigned int)*p < KSEG0) { 151 if ((unsigned int)*p < KSEG0) {
217 printk(KERN_WARNING "vpe_get_shared returned an " 152 pr_warn("vpe_get_shared returned an invalid pointer maybe an error code %d\n",
218 "invalid pointer maybe an error code %d\n", 153 (int)*p);
219 (int)*p);
220 ret = -ENOSYS; 154 ret = -ENOSYS;
221 goto out_fail; 155 goto out_fail;
222 } 156 }
223 157
224 if ((ret = rtlx_init(*p)) < 0) 158 ret = rtlx_init(*p);
159 if (ret < 0)
225 goto out_ret; 160 goto out_ret;
226 } 161 }
227 162
@@ -352,7 +287,7 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
352 size_t fl; 287 size_t fl;
353 288
354 if (rtlx == NULL) 289 if (rtlx == NULL)
355 return(-ENOSYS); 290 return -ENOSYS;
356 291
357 rt = &rtlx->channel[index]; 292 rt = &rtlx->channel[index];
358 293
@@ -361,8 +296,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
361 rt_read = rt->rt_read; 296 rt_read = rt->rt_read;
362 297
363 /* total number of bytes to copy */ 298 /* total number of bytes to copy */
364 count = min(count, (size_t)write_spacefree(rt_read, rt->rt_write, 299 count = min_t(size_t, count, write_spacefree(rt_read, rt->rt_write,
365 rt->buffer_size)); 300 rt->buffer_size));
366 301
367 /* first bit from write pointer to the end of the buffer, or count */ 302 /* first bit from write pointer to the end of the buffer, or count */
368 fl = min(count, (size_t) rt->buffer_size - rt->rt_write); 303 fl = min(count, (size_t) rt->buffer_size - rt->rt_write);
@@ -372,9 +307,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
372 goto out; 307 goto out;
373 308
374 /* if there's any left copy to the beginning of the buffer */ 309 /* if there's any left copy to the beginning of the buffer */
375 if (count - fl) { 310 if (count - fl)
376 failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl); 311 failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl);
377 }
378 312
379out: 313out:
380 count -= failed; 314 count -= failed;
@@ -384,6 +318,8 @@ out:
384 smp_wmb(); 318 smp_wmb();
385 mutex_unlock(&channel_wqs[index].mutex); 319 mutex_unlock(&channel_wqs[index].mutex);
386 320
321 _interrupt_sp();
322
387 return count; 323 return count;
388} 324}
389 325
@@ -398,7 +334,7 @@ static int file_release(struct inode *inode, struct file *filp)
398 return rtlx_release(iminor(inode)); 334 return rtlx_release(iminor(inode));
399} 335}
400 336
401static unsigned int file_poll(struct file *file, poll_table * wait) 337static unsigned int file_poll(struct file *file, poll_table *wait)
402{ 338{
403 int minor = iminor(file_inode(file)); 339 int minor = iminor(file_inode(file));
404 unsigned int mask = 0; 340 unsigned int mask = 0;
@@ -420,21 +356,20 @@ static unsigned int file_poll(struct file *file, poll_table * wait)
420 return mask; 356 return mask;
421} 357}
422 358
423static ssize_t file_read(struct file *file, char __user * buffer, size_t count, 359static ssize_t file_read(struct file *file, char __user *buffer, size_t count,
424 loff_t * ppos) 360 loff_t *ppos)
425{ 361{
426 int minor = iminor(file_inode(file)); 362 int minor = iminor(file_inode(file));
427 363
428 /* data available? */ 364 /* data available? */
429 if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) { 365 if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1))
430 return 0; // -EAGAIN makes cat whinge 366 return 0; /* -EAGAIN makes 'cat' whine */
431 }
432 367
433 return rtlx_read(minor, buffer, count); 368 return rtlx_read(minor, buffer, count);
434} 369}
435 370
436static ssize_t file_write(struct file *file, const char __user * buffer, 371static ssize_t file_write(struct file *file, const char __user *buffer,
437 size_t count, loff_t * ppos) 372 size_t count, loff_t *ppos)
438{ 373{
439 int minor = iminor(file_inode(file)); 374 int minor = iminor(file_inode(file));
440 375
@@ -454,100 +389,16 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
454 return rtlx_write(minor, buffer, count); 389 return rtlx_write(minor, buffer, count);
455} 390}
456 391
457static const struct file_operations rtlx_fops = { 392const struct file_operations rtlx_fops = {
458 .owner = THIS_MODULE, 393 .owner = THIS_MODULE,
459 .open = file_open, 394 .open = file_open,
460 .release = file_release, 395 .release = file_release,
461 .write = file_write, 396 .write = file_write,
462 .read = file_read, 397 .read = file_read,
463 .poll = file_poll, 398 .poll = file_poll,
464 .llseek = noop_llseek, 399 .llseek = noop_llseek,
465}; 400};
466 401
467static struct irqaction rtlx_irq = {
468 .handler = rtlx_interrupt,
469 .name = "RTLX",
470};
471
472static int rtlx_irq_num = MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ;
473
474static char register_chrdev_failed[] __initdata =
475 KERN_ERR "rtlx_module_init: unable to register device\n";
476
477static int __init rtlx_module_init(void)
478{
479 struct device *dev;
480 int i, err;
481
482 if (!cpu_has_mipsmt) {
483 printk("VPE loader: not a MIPS MT capable processor\n");
484 return -ENODEV;
485 }
486
487 if (tclimit == 0) {
488 printk(KERN_WARNING "No TCs reserved for AP/SP, not "
489 "initializing RTLX.\nPass maxtcs=<n> argument as kernel "
490 "argument\n");
491
492 return -ENODEV;
493 }
494
495 major = register_chrdev(0, module_name, &rtlx_fops);
496 if (major < 0) {
497 printk(register_chrdev_failed);
498 return major;
499 }
500
501 /* initialise the wait queues */
502 for (i = 0; i < RTLX_CHANNELS; i++) {
503 init_waitqueue_head(&channel_wqs[i].rt_queue);
504 init_waitqueue_head(&channel_wqs[i].lx_queue);
505 atomic_set(&channel_wqs[i].in_open, 0);
506 mutex_init(&channel_wqs[i].mutex);
507
508 dev = device_create(mt_class, NULL, MKDEV(major, i), NULL,
509 "%s%d", module_name, i);
510 if (IS_ERR(dev)) {
511 err = PTR_ERR(dev);
512 goto out_chrdev;
513 }
514 }
515
516 /* set up notifiers */
517 notify.start = starting;
518 notify.stop = stopping;
519 vpe_notify(tclimit, &notify);
520
521 if (cpu_has_vint)
522 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
523 else {
524 pr_err("APRP RTLX init on non-vectored-interrupt processor\n");
525 err = -ENODEV;
526 goto out_chrdev;
527 }
528
529 rtlx_irq.dev_id = rtlx;
530 setup_irq(rtlx_irq_num, &rtlx_irq);
531
532 return 0;
533
534out_chrdev:
535 for (i = 0; i < RTLX_CHANNELS; i++)
536 device_destroy(mt_class, MKDEV(major, i));
537
538 return err;
539}
540
541static void __exit rtlx_module_exit(void)
542{
543 int i;
544
545 for (i = 0; i < RTLX_CHANNELS; i++)
546 device_destroy(mt_class, MKDEV(major, i));
547
548 unregister_chrdev(major, module_name);
549}
550
551module_init(rtlx_module_init); 402module_init(rtlx_module_init);
552module_exit(rtlx_module_exit); 403module_exit(rtlx_module_exit);
553 404
diff --git a/arch/mips/kernel/segment.c b/arch/mips/kernel/segment.c
new file mode 100644
index 000000000000..076ead2a9859
--- /dev/null
+++ b/arch/mips/kernel/segment.c
@@ -0,0 +1,110 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Imagination Technologies Ltd.
7 */
8
9#include <linux/kernel.h>
10#include <linux/debugfs.h>
11#include <linux/seq_file.h>
12#include <asm/cpu.h>
13#include <asm/mipsregs.h>
14
15static void build_segment_config(char *str, unsigned int cfg)
16{
17 unsigned int am;
18 static const char * const am_str[] = {
19 "UK", "MK", "MSK", "MUSK", "MUSUK", "USK",
20 "RSRVD", "UUSK"};
21
22 /* Segment access mode. */
23 am = (cfg & MIPS_SEGCFG_AM) >> MIPS_SEGCFG_AM_SHIFT;
24 str += sprintf(str, "%-5s", am_str[am]);
25
26 /*
27 * Access modes MK, MSK and MUSK are mapped segments. Therefore
28 * there is no direct physical address mapping.
29 */
30 if ((am == 0) || (am > 3)) {
31 str += sprintf(str, " %03lx",
32 ((cfg & MIPS_SEGCFG_PA) >> MIPS_SEGCFG_PA_SHIFT));
33 str += sprintf(str, " %01ld",
34 ((cfg & MIPS_SEGCFG_C) >> MIPS_SEGCFG_C_SHIFT));
35 } else {
36 str += sprintf(str, " UND");
37 str += sprintf(str, " U");
38 }
39
40 /* Exception configuration. */
41 str += sprintf(str, " %01ld\n",
42 ((cfg & MIPS_SEGCFG_EU) >> MIPS_SEGCFG_EU_SHIFT));
43}
44
45static int show_segments(struct seq_file *m, void *v)
46{
47 unsigned int segcfg;
48 char str[42];
49
50 seq_puts(m, "Segment Virtual Size Access Mode Physical Caching EU\n");
51 seq_puts(m, "------- ------- ---- ----------- -------- ------- --\n");
52
53 segcfg = read_c0_segctl0();
54 build_segment_config(str, segcfg);
55 seq_printf(m, " 0 e0000000 512M %s", str);
56
57 segcfg >>= 16;
58 build_segment_config(str, segcfg);
59 seq_printf(m, " 1 c0000000 512M %s", str);
60
61 segcfg = read_c0_segctl1();
62 build_segment_config(str, segcfg);
63 seq_printf(m, " 2 a0000000 512M %s", str);
64
65 segcfg >>= 16;
66 build_segment_config(str, segcfg);
67 seq_printf(m, " 3 80000000 512M %s", str);
68
69 segcfg = read_c0_segctl2();
70 build_segment_config(str, segcfg);
71 seq_printf(m, " 4 40000000 1G %s", str);
72
73 segcfg >>= 16;
74 build_segment_config(str, segcfg);
75 seq_printf(m, " 5 00000000 1G %s\n", str);
76
77 return 0;
78}
79
80static int segments_open(struct inode *inode, struct file *file)
81{
82 return single_open(file, show_segments, NULL);
83}
84
85static const struct file_operations segments_fops = {
86 .open = segments_open,
87 .read = seq_read,
88 .llseek = seq_lseek,
89 .release = single_release,
90};
91
92static int __init segments_info(void)
93{
94 extern struct dentry *mips_debugfs_dir;
95 struct dentry *segments;
96
97 if (cpu_has_segments) {
98 if (!mips_debugfs_dir)
99 return -ENODEV;
100
101 segments = debugfs_create_file("segments", S_IRUGO,
102 mips_debugfs_dir, NULL,
103 &segments_fops);
104 if (!segments)
105 return -ENOMEM;
106 }
107 return 0;
108}
109
110device_initcall(segments_info);
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 2f285abc76d5..5199563c4403 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -71,8 +71,9 @@ static int protected_save_fp_context(struct sigcontext __user *sc)
71 int err; 71 int err;
72 while (1) { 72 while (1) {
73 lock_fpu_owner(); 73 lock_fpu_owner();
74 own_fpu_inatomic(1); 74 err = own_fpu_inatomic(1);
75 err = save_fp_context(sc); /* this might fail */ 75 if (!err)
76 err = save_fp_context(sc); /* this might fail */
76 unlock_fpu_owner(); 77 unlock_fpu_owner();
77 if (likely(!err)) 78 if (likely(!err))
78 break; 79 break;
@@ -91,8 +92,9 @@ static int protected_restore_fp_context(struct sigcontext __user *sc)
91 int err, tmp __maybe_unused; 92 int err, tmp __maybe_unused;
92 while (1) { 93 while (1) {
93 lock_fpu_owner(); 94 lock_fpu_owner();
94 own_fpu_inatomic(0); 95 err = own_fpu_inatomic(0);
95 err = restore_fp_context(sc); /* this might fail */ 96 if (!err)
97 err = restore_fp_context(sc); /* this might fail */
96 unlock_fpu_owner(); 98 unlock_fpu_owner();
97 if (likely(!err)) 99 if (likely(!err))
98 break; 100 break;
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 1905a419aa46..3d60f7750fa8 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -85,8 +85,9 @@ static int protected_save_fp_context32(struct sigcontext32 __user *sc)
85 int err; 85 int err;
86 while (1) { 86 while (1) {
87 lock_fpu_owner(); 87 lock_fpu_owner();
88 own_fpu_inatomic(1); 88 err = own_fpu_inatomic(1);
89 err = save_fp_context32(sc); /* this might fail */ 89 if (!err)
90 err = save_fp_context32(sc); /* this might fail */
90 unlock_fpu_owner(); 91 unlock_fpu_owner();
91 if (likely(!err)) 92 if (likely(!err))
92 break; 93 break;
@@ -105,8 +106,9 @@ static int protected_restore_fp_context32(struct sigcontext32 __user *sc)
105 int err, tmp __maybe_unused; 106 int err, tmp __maybe_unused;
106 while (1) { 107 while (1) {
107 lock_fpu_owner(); 108 lock_fpu_owner();
108 own_fpu_inatomic(0); 109 err = own_fpu_inatomic(0);
109 err = restore_fp_context32(sc); /* this might fail */ 110 if (!err)
111 err = restore_fp_context32(sc); /* this might fail */
110 unlock_fpu_owner(); 112 unlock_fpu_owner();
111 if (likely(!err)) 113 if (likely(!err))
112 break; 114 break;
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 2362665ba496..ea4c2dc31692 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -49,8 +49,10 @@ cpumask_t bmips_booted_mask;
49unsigned long bmips_smp_boot_sp; 49unsigned long bmips_smp_boot_sp;
50unsigned long bmips_smp_boot_gp; 50unsigned long bmips_smp_boot_gp;
51 51
52static void bmips_send_ipi_single(int cpu, unsigned int action); 52static void bmips43xx_send_ipi_single(int cpu, unsigned int action);
53static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id); 53static void bmips5000_send_ipi_single(int cpu, unsigned int action);
54static irqreturn_t bmips43xx_ipi_interrupt(int irq, void *dev_id);
55static irqreturn_t bmips5000_ipi_interrupt(int irq, void *dev_id);
54 56
55/* SW interrupts 0,1 are used for interprocessor signaling */ 57/* SW interrupts 0,1 are used for interprocessor signaling */
56#define IPI0_IRQ (MIPS_CPU_IRQ_BASE + 0) 58#define IPI0_IRQ (MIPS_CPU_IRQ_BASE + 0)
@@ -64,49 +66,58 @@ static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id);
64static void __init bmips_smp_setup(void) 66static void __init bmips_smp_setup(void)
65{ 67{
66 int i, cpu = 1, boot_cpu = 0; 68 int i, cpu = 1, boot_cpu = 0;
67
68#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
69 int cpu_hw_intr; 69 int cpu_hw_intr;
70 70
71 /* arbitration priority */ 71 switch (current_cpu_type()) {
72 clear_c0_brcm_cmt_ctrl(0x30); 72 case CPU_BMIPS4350:
73 73 case CPU_BMIPS4380:
74 /* NBK and weak order flags */ 74 /* arbitration priority */
75 set_c0_brcm_config_0(0x30000); 75 clear_c0_brcm_cmt_ctrl(0x30);
76 76
77 /* Find out if we are running on TP0 or TP1 */ 77 /* NBK and weak order flags */
78 boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31)); 78 set_c0_brcm_config_0(0x30000);
79 79
80 /* 80 /* Find out if we are running on TP0 or TP1 */
81 * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread 81 boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31));
82 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output 82
83 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output 83 /*
84 */ 84 * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other
85 if (boot_cpu == 0) 85 * thread
86 cpu_hw_intr = 0x02; 86 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output
87 else 87 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output
88 cpu_hw_intr = 0x1d; 88 */
89 89 if (boot_cpu == 0)
90 change_c0_brcm_cmt_intr(0xf8018000, (cpu_hw_intr << 27) | (0x03 << 15)); 90 cpu_hw_intr = 0x02;
91 91 else
92 /* single core, 2 threads (2 pipelines) */ 92 cpu_hw_intr = 0x1d;
93 max_cpus = 2; 93
94#elif defined(CONFIG_CPU_BMIPS5000) 94 change_c0_brcm_cmt_intr(0xf8018000,
95 /* enable raceless SW interrupts */ 95 (cpu_hw_intr << 27) | (0x03 << 15));
96 set_c0_brcm_config(0x03 << 22); 96
97 97 /* single core, 2 threads (2 pipelines) */
98 /* route HW interrupt 0 to CPU0, HW interrupt 1 to CPU1 */ 98 max_cpus = 2;
99 change_c0_brcm_mode(0x1f << 27, 0x02 << 27); 99
100 100 break;
101 /* N cores, 2 threads per core */ 101 case CPU_BMIPS5000:
102 max_cpus = (((read_c0_brcm_config() >> 6) & 0x03) + 1) << 1; 102 /* enable raceless SW interrupts */
103 set_c0_brcm_config(0x03 << 22);
104
105 /* route HW interrupt 0 to CPU0, HW interrupt 1 to CPU1 */
106 change_c0_brcm_mode(0x1f << 27, 0x02 << 27);
107
108 /* N cores, 2 threads per core */
109 max_cpus = (((read_c0_brcm_config() >> 6) & 0x03) + 1) << 1;
110
111 /* clear any pending SW interrupts */
112 for (i = 0; i < max_cpus; i++) {
113 write_c0_brcm_action(ACTION_CLR_IPI(i, 0));
114 write_c0_brcm_action(ACTION_CLR_IPI(i, 1));
115 }
103 116
104 /* clear any pending SW interrupts */ 117 break;
105 for (i = 0; i < max_cpus; i++) { 118 default:
106 write_c0_brcm_action(ACTION_CLR_IPI(i, 0)); 119 max_cpus = 1;
107 write_c0_brcm_action(ACTION_CLR_IPI(i, 1));
108 } 120 }
109#endif
110 121
111 if (!bmips_smp_enabled) 122 if (!bmips_smp_enabled)
112 max_cpus = 1; 123 max_cpus = 1;
@@ -134,6 +145,20 @@ static void __init bmips_smp_setup(void)
134 */ 145 */
135static void bmips_prepare_cpus(unsigned int max_cpus) 146static void bmips_prepare_cpus(unsigned int max_cpus)
136{ 147{
148 irqreturn_t (*bmips_ipi_interrupt)(int irq, void *dev_id);
149
150 switch (current_cpu_type()) {
151 case CPU_BMIPS4350:
152 case CPU_BMIPS4380:
153 bmips_ipi_interrupt = bmips43xx_ipi_interrupt;
154 break;
155 case CPU_BMIPS5000:
156 bmips_ipi_interrupt = bmips5000_ipi_interrupt;
157 break;
158 default:
159 return;
160 }
161
137 if (request_irq(IPI0_IRQ, bmips_ipi_interrupt, IRQF_PERCPU, 162 if (request_irq(IPI0_IRQ, bmips_ipi_interrupt, IRQF_PERCPU,
138 "smp_ipi0", NULL)) 163 "smp_ipi0", NULL))
139 panic("Can't request IPI0 interrupt"); 164 panic("Can't request IPI0 interrupt");
@@ -168,26 +193,39 @@ static void bmips_boot_secondary(int cpu, struct task_struct *idle)
168 193
169 pr_info("SMP: Booting CPU%d...\n", cpu); 194 pr_info("SMP: Booting CPU%d...\n", cpu);
170 195
171 if (cpumask_test_cpu(cpu, &bmips_booted_mask)) 196 if (cpumask_test_cpu(cpu, &bmips_booted_mask)) {
172 bmips_send_ipi_single(cpu, 0); 197 switch (current_cpu_type()) {
198 case CPU_BMIPS4350:
199 case CPU_BMIPS4380:
200 bmips43xx_send_ipi_single(cpu, 0);
201 break;
202 case CPU_BMIPS5000:
203 bmips5000_send_ipi_single(cpu, 0);
204 break;
205 }
206 }
173 else { 207 else {
174#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 208 switch (current_cpu_type()) {
175 /* Reset slave TP1 if booting from TP0 */ 209 case CPU_BMIPS4350:
176 if (cpu_logical_map(cpu) == 1) 210 case CPU_BMIPS4380:
177 set_c0_brcm_cmt_ctrl(0x01); 211 /* Reset slave TP1 if booting from TP0 */
178#elif defined(CONFIG_CPU_BMIPS5000) 212 if (cpu_logical_map(cpu) == 1)
179 if (cpu & 0x01) 213 set_c0_brcm_cmt_ctrl(0x01);
180 write_c0_brcm_action(ACTION_BOOT_THREAD(cpu)); 214 break;
181 else { 215 case CPU_BMIPS5000:
182 /* 216 if (cpu & 0x01)
183 * core N thread 0 was already booted; just 217 write_c0_brcm_action(ACTION_BOOT_THREAD(cpu));
184 * pulse the NMI line 218 else {
185 */ 219 /*
186 bmips_write_zscm_reg(0x210, 0xc0000000); 220 * core N thread 0 was already booted; just
187 udelay(10); 221 * pulse the NMI line
188 bmips_write_zscm_reg(0x210, 0x00); 222 */
223 bmips_write_zscm_reg(0x210, 0xc0000000);
224 udelay(10);
225 bmips_write_zscm_reg(0x210, 0x00);
226 }
227 break;
189 } 228 }
190#endif
191 cpumask_set_cpu(cpu, &bmips_booted_mask); 229 cpumask_set_cpu(cpu, &bmips_booted_mask);
192 } 230 }
193} 231}
@@ -199,26 +237,32 @@ static void bmips_init_secondary(void)
199{ 237{
200 /* move NMI vector to kseg0, in case XKS01 is enabled */ 238 /* move NMI vector to kseg0, in case XKS01 is enabled */
201 239
202#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 240 void __iomem *cbr;
203 void __iomem *cbr = BMIPS_GET_CBR();
204 unsigned long old_vec; 241 unsigned long old_vec;
205 unsigned long relo_vector; 242 unsigned long relo_vector;
206 int boot_cpu; 243 int boot_cpu;
207 244
208 boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31)); 245 switch (current_cpu_type()) {
209 relo_vector = boot_cpu ? BMIPS_RELO_VECTOR_CONTROL_0 : 246 case CPU_BMIPS4350:
210 BMIPS_RELO_VECTOR_CONTROL_1; 247 case CPU_BMIPS4380:
248 cbr = BMIPS_GET_CBR();
211 249
212 old_vec = __raw_readl(cbr + relo_vector); 250 boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31));
213 __raw_writel(old_vec & ~0x20000000, cbr + relo_vector); 251 relo_vector = boot_cpu ? BMIPS_RELO_VECTOR_CONTROL_0 :
252 BMIPS_RELO_VECTOR_CONTROL_1;
214 253
215 clear_c0_cause(smp_processor_id() ? C_SW1 : C_SW0); 254 old_vec = __raw_readl(cbr + relo_vector);
216#elif defined(CONFIG_CPU_BMIPS5000) 255 __raw_writel(old_vec & ~0x20000000, cbr + relo_vector);
217 write_c0_brcm_bootvec(read_c0_brcm_bootvec() &
218 (smp_processor_id() & 0x01 ? ~0x20000000 : ~0x2000));
219 256
220 write_c0_brcm_action(ACTION_CLR_IPI(smp_processor_id(), 0)); 257 clear_c0_cause(smp_processor_id() ? C_SW1 : C_SW0);
221#endif 258 break;
259 case CPU_BMIPS5000:
260 write_c0_brcm_bootvec(read_c0_brcm_bootvec() &
261 (smp_processor_id() & 0x01 ? ~0x20000000 : ~0x2000));
262
263 write_c0_brcm_action(ACTION_CLR_IPI(smp_processor_id(), 0));
264 break;
265 }
222} 266}
223 267
224/* 268/*
@@ -243,8 +287,6 @@ static void bmips_cpus_done(void)
243{ 287{
244} 288}
245 289
246#if defined(CONFIG_CPU_BMIPS5000)
247
248/* 290/*
249 * BMIPS5000 raceless IPIs 291 * BMIPS5000 raceless IPIs
250 * 292 *
@@ -253,12 +295,12 @@ static void bmips_cpus_done(void)
253 * IPI1 is used for SMP_CALL_FUNCTION 295 * IPI1 is used for SMP_CALL_FUNCTION
254 */ 296 */
255 297
256static void bmips_send_ipi_single(int cpu, unsigned int action) 298static void bmips5000_send_ipi_single(int cpu, unsigned int action)
257{ 299{
258 write_c0_brcm_action(ACTION_SET_IPI(cpu, action == SMP_CALL_FUNCTION)); 300 write_c0_brcm_action(ACTION_SET_IPI(cpu, action == SMP_CALL_FUNCTION));
259} 301}
260 302
261static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id) 303static irqreturn_t bmips5000_ipi_interrupt(int irq, void *dev_id)
262{ 304{
263 int action = irq - IPI0_IRQ; 305 int action = irq - IPI0_IRQ;
264 306
@@ -272,7 +314,14 @@ static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id)
272 return IRQ_HANDLED; 314 return IRQ_HANDLED;
273} 315}
274 316
275#else 317static void bmips5000_send_ipi_mask(const struct cpumask *mask,
318 unsigned int action)
319{
320 unsigned int i;
321
322 for_each_cpu(i, mask)
323 bmips5000_send_ipi_single(i, action);
324}
276 325
277/* 326/*
278 * BMIPS43xx racey IPIs 327 * BMIPS43xx racey IPIs
@@ -287,7 +336,7 @@ static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id)
287static DEFINE_SPINLOCK(ipi_lock); 336static DEFINE_SPINLOCK(ipi_lock);
288static DEFINE_PER_CPU(int, ipi_action_mask); 337static DEFINE_PER_CPU(int, ipi_action_mask);
289 338
290static void bmips_send_ipi_single(int cpu, unsigned int action) 339static void bmips43xx_send_ipi_single(int cpu, unsigned int action)
291{ 340{
292 unsigned long flags; 341 unsigned long flags;
293 342
@@ -298,7 +347,7 @@ static void bmips_send_ipi_single(int cpu, unsigned int action)
298 spin_unlock_irqrestore(&ipi_lock, flags); 347 spin_unlock_irqrestore(&ipi_lock, flags);
299} 348}
300 349
301static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id) 350static irqreturn_t bmips43xx_ipi_interrupt(int irq, void *dev_id)
302{ 351{
303 unsigned long flags; 352 unsigned long flags;
304 int action, cpu = irq - IPI0_IRQ; 353 int action, cpu = irq - IPI0_IRQ;
@@ -317,15 +366,13 @@ static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id)
317 return IRQ_HANDLED; 366 return IRQ_HANDLED;
318} 367}
319 368
320#endif /* BMIPS type */ 369static void bmips43xx_send_ipi_mask(const struct cpumask *mask,
321
322static void bmips_send_ipi_mask(const struct cpumask *mask,
323 unsigned int action) 370 unsigned int action)
324{ 371{
325 unsigned int i; 372 unsigned int i;
326 373
327 for_each_cpu(i, mask) 374 for_each_cpu(i, mask)
328 bmips_send_ipi_single(i, action); 375 bmips43xx_send_ipi_single(i, action);
329} 376}
330 377
331#ifdef CONFIG_HOTPLUG_CPU 378#ifdef CONFIG_HOTPLUG_CPU
@@ -381,15 +428,30 @@ void __ref play_dead(void)
381 428
382#endif /* CONFIG_HOTPLUG_CPU */ 429#endif /* CONFIG_HOTPLUG_CPU */
383 430
384struct plat_smp_ops bmips_smp_ops = { 431struct plat_smp_ops bmips43xx_smp_ops = {
432 .smp_setup = bmips_smp_setup,
433 .prepare_cpus = bmips_prepare_cpus,
434 .boot_secondary = bmips_boot_secondary,
435 .smp_finish = bmips_smp_finish,
436 .init_secondary = bmips_init_secondary,
437 .cpus_done = bmips_cpus_done,
438 .send_ipi_single = bmips43xx_send_ipi_single,
439 .send_ipi_mask = bmips43xx_send_ipi_mask,
440#ifdef CONFIG_HOTPLUG_CPU
441 .cpu_disable = bmips_cpu_disable,
442 .cpu_die = bmips_cpu_die,
443#endif
444};
445
446struct plat_smp_ops bmips5000_smp_ops = {
385 .smp_setup = bmips_smp_setup, 447 .smp_setup = bmips_smp_setup,
386 .prepare_cpus = bmips_prepare_cpus, 448 .prepare_cpus = bmips_prepare_cpus,
387 .boot_secondary = bmips_boot_secondary, 449 .boot_secondary = bmips_boot_secondary,
388 .smp_finish = bmips_smp_finish, 450 .smp_finish = bmips_smp_finish,
389 .init_secondary = bmips_init_secondary, 451 .init_secondary = bmips_init_secondary,
390 .cpus_done = bmips_cpus_done, 452 .cpus_done = bmips_cpus_done,
391 .send_ipi_single = bmips_send_ipi_single, 453 .send_ipi_single = bmips5000_send_ipi_single,
392 .send_ipi_mask = bmips_send_ipi_mask, 454 .send_ipi_mask = bmips5000_send_ipi_mask,
393#ifdef CONFIG_HOTPLUG_CPU 455#ifdef CONFIG_HOTPLUG_CPU
394 .cpu_disable = bmips_cpu_disable, 456 .cpu_disable = bmips_cpu_disable,
395 .cpu_die = bmips_cpu_die, 457 .cpu_die = bmips_cpu_die,
@@ -427,43 +489,47 @@ void bmips_ebase_setup(void)
427 489
428 BUG_ON(ebase != CKSEG0); 490 BUG_ON(ebase != CKSEG0);
429 491
430#if defined(CONFIG_CPU_BMIPS4350) 492 switch (current_cpu_type()) {
431 /* 493 case CPU_BMIPS4350:
432 * BMIPS4350 cannot relocate the normal vectors, but it 494 /*
433 * can relocate the BEV=1 vectors. So CPU1 starts up at 495 * BMIPS4350 cannot relocate the normal vectors, but it
434 * the relocated BEV=1, IV=0 general exception vector @ 496 * can relocate the BEV=1 vectors. So CPU1 starts up at
435 * 0xa000_0380. 497 * the relocated BEV=1, IV=0 general exception vector @
436 * 498 * 0xa000_0380.
437 * set_uncached_handler() is used here because: 499 *
438 * - CPU1 will run this from uncached space 500 * set_uncached_handler() is used here because:
439 * - None of the cacheflush functions are set up yet 501 * - CPU1 will run this from uncached space
440 */ 502 * - None of the cacheflush functions are set up yet
441 set_uncached_handler(BMIPS_WARM_RESTART_VEC - CKSEG0, 503 */
442 &bmips_smp_int_vec, 0x80); 504 set_uncached_handler(BMIPS_WARM_RESTART_VEC - CKSEG0,
443 __sync(); 505 &bmips_smp_int_vec, 0x80);
444 return; 506 __sync();
445#elif defined(CONFIG_CPU_BMIPS4380) 507 return;
446 /* 508 case CPU_BMIPS4380:
447 * 0x8000_0000: reset/NMI (initially in kseg1) 509 /*
448 * 0x8000_0400: normal vectors 510 * 0x8000_0000: reset/NMI (initially in kseg1)
449 */ 511 * 0x8000_0400: normal vectors
450 new_ebase = 0x80000400; 512 */
451 cbr = BMIPS_GET_CBR(); 513 new_ebase = 0x80000400;
452 __raw_writel(0x80080800, cbr + BMIPS_RELO_VECTOR_CONTROL_0); 514 cbr = BMIPS_GET_CBR();
453 __raw_writel(0xa0080800, cbr + BMIPS_RELO_VECTOR_CONTROL_1); 515 __raw_writel(0x80080800, cbr + BMIPS_RELO_VECTOR_CONTROL_0);
454#elif defined(CONFIG_CPU_BMIPS5000) 516 __raw_writel(0xa0080800, cbr + BMIPS_RELO_VECTOR_CONTROL_1);
455 /* 517 break;
456 * 0x8000_0000: reset/NMI (initially in kseg1) 518 case CPU_BMIPS5000:
457 * 0x8000_1000: normal vectors 519 /*
458 */ 520 * 0x8000_0000: reset/NMI (initially in kseg1)
459 new_ebase = 0x80001000; 521 * 0x8000_1000: normal vectors
460 write_c0_brcm_bootvec(0xa0088008); 522 */
461 write_c0_ebase(new_ebase); 523 new_ebase = 0x80001000;
462 if (max_cpus > 2) 524 write_c0_brcm_bootvec(0xa0088008);
463 bmips_write_zscm_reg(0xa0, 0xa008a008); 525 write_c0_ebase(new_ebase);
464#else 526 if (max_cpus > 2)
465 return; 527 bmips_write_zscm_reg(0xa0, 0xa008a008);
466#endif 528 break;
529 default:
530 return;
531 }
532
467 board_nmi_handler_setup = &bmips_nmi_handler_setup; 533 board_nmi_handler_setup = &bmips_nmi_handler_setup;
468 ebase = new_ebase; 534 ebase = new_ebase;
469} 535}
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c
index 5969f1e9b62a..1b925d8a610c 100644
--- a/arch/mips/kernel/smp-cmp.c
+++ b/arch/mips/kernel/smp-cmp.c
@@ -199,11 +199,14 @@ void __init cmp_prepare_cpus(unsigned int max_cpus)
199 pr_debug("SMPCMP: CPU%d: %s max_cpus=%d\n", 199 pr_debug("SMPCMP: CPU%d: %s max_cpus=%d\n",
200 smp_processor_id(), __func__, max_cpus); 200 smp_processor_id(), __func__, max_cpus);
201 201
202#ifdef CONFIG_MIPS_MT
202 /* 203 /*
203 * FIXME: some of these options are per-system, some per-core and 204 * FIXME: some of these options are per-system, some per-core and
204 * some per-cpu 205 * some per-cpu
205 */ 206 */
206 mips_mt_set_cpuoptions(); 207 mips_mt_set_cpuoptions();
208#endif
209
207} 210}
208 211
209struct plat_smp_ops cmp_smp_ops = { 212struct plat_smp_ops cmp_smp_ops = {
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 57a3f7a2b370..0fb8cefc9114 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -71,6 +71,7 @@ static unsigned int __init smvp_vpe_init(unsigned int tc, unsigned int mvpconf0,
71 71
72 /* Record this as available CPU */ 72 /* Record this as available CPU */
73 set_cpu_possible(tc, true); 73 set_cpu_possible(tc, true);
74 set_cpu_present(tc, true);
74 __cpu_number_map[tc] = ++ncpu; 75 __cpu_number_map[tc] = ++ncpu;
75 __cpu_logical_map[ncpu] = tc; 76 __cpu_logical_map[ncpu] = tc;
76 } 77 }
@@ -112,12 +113,39 @@ static void __init smvp_tc_init(unsigned int tc, unsigned int mvpconf0)
112 write_tc_c0_tchalt(TCHALT_H); 113 write_tc_c0_tchalt(TCHALT_H);
113} 114}
114 115
116#ifdef CONFIG_IRQ_GIC
117static void mp_send_ipi_single(int cpu, unsigned int action)
118{
119 unsigned long flags;
120
121 local_irq_save(flags);
122
123 switch (action) {
124 case SMP_CALL_FUNCTION:
125 gic_send_ipi(plat_ipi_call_int_xlate(cpu));
126 break;
127
128 case SMP_RESCHEDULE_YOURSELF:
129 gic_send_ipi(plat_ipi_resched_int_xlate(cpu));
130 break;
131 }
132
133 local_irq_restore(flags);
134}
135#endif
136
115static void vsmp_send_ipi_single(int cpu, unsigned int action) 137static void vsmp_send_ipi_single(int cpu, unsigned int action)
116{ 138{
117 int i; 139 int i;
118 unsigned long flags; 140 unsigned long flags;
119 int vpflags; 141 int vpflags;
120 142
143#ifdef CONFIG_IRQ_GIC
144 if (gic_present) {
145 mp_send_ipi_single(cpu, action);
146 return;
147 }
148#endif
121 local_irq_save(flags); 149 local_irq_save(flags);
122 150
123 vpflags = dvpe(); /* can't access the other CPU's registers whilst MVPE enabled */ 151 vpflags = dvpe(); /* can't access the other CPU's registers whilst MVPE enabled */
diff --git a/arch/mips/kernel/spram.c b/arch/mips/kernel/spram.c
index 93f86817f20a..b242e2c10ea0 100644
--- a/arch/mips/kernel/spram.c
+++ b/arch/mips/kernel/spram.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Copyright (C) 2007, 2008 MIPS Technologies, Inc. 9 * Copyright (C) 2007, 2008 MIPS Technologies, Inc.
10 */ 10 */
11#include <linux/init.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/ptrace.h> 12#include <linux/ptrace.h>
14#include <linux/stddef.h> 13#include <linux/stddef.h>
@@ -206,6 +205,8 @@ void spram_config(void)
206 case CPU_34K: 205 case CPU_34K:
207 case CPU_74K: 206 case CPU_74K:
208 case CPU_1004K: 207 case CPU_1004K:
208 case CPU_INTERAPTIV:
209 case CPU_PROAPTIV:
209 config0 = read_c0_config(); 210 config0 = read_c0_config();
210 /* FIXME: addresses are Malta specific */ 211 /* FIXME: addresses are Malta specific */
211 if (config0 & (1<<24)) { 212 if (config0 & (1<<24)) {
diff --git a/arch/mips/kernel/sync-r4k.c b/arch/mips/kernel/sync-r4k.c
index 84536bf4a154..c24ad5f4b324 100644
--- a/arch/mips/kernel/sync-r4k.c
+++ b/arch/mips/kernel/sync-r4k.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/irqflags.h> 14#include <linux/irqflags.h>
16#include <linux/cpumask.h> 15#include <linux/cpumask.h>
17 16
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index f9c8746be8d6..e0b499694d18 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -78,6 +78,7 @@ extern asmlinkage void handle_cpu(void);
78extern asmlinkage void handle_ov(void); 78extern asmlinkage void handle_ov(void);
79extern asmlinkage void handle_tr(void); 79extern asmlinkage void handle_tr(void);
80extern asmlinkage void handle_fpe(void); 80extern asmlinkage void handle_fpe(void);
81extern asmlinkage void handle_ftlb(void);
81extern asmlinkage void handle_mdmx(void); 82extern asmlinkage void handle_mdmx(void);
82extern asmlinkage void handle_watch(void); 83extern asmlinkage void handle_watch(void);
83extern asmlinkage void handle_mt(void); 84extern asmlinkage void handle_mt(void);
@@ -1080,7 +1081,7 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1080 unsigned long old_epc, old31; 1081 unsigned long old_epc, old31;
1081 unsigned int opcode; 1082 unsigned int opcode;
1082 unsigned int cpid; 1083 unsigned int cpid;
1083 int status; 1084 int status, err;
1084 unsigned long __maybe_unused flags; 1085 unsigned long __maybe_unused flags;
1085 1086
1086 prev_state = exception_enter(); 1087 prev_state = exception_enter();
@@ -1153,19 +1154,19 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1153 1154
1154 case 1: 1155 case 1:
1155 if (used_math()) /* Using the FPU again. */ 1156 if (used_math()) /* Using the FPU again. */
1156 own_fpu(1); 1157 err = own_fpu(1);
1157 else { /* First time FPU user. */ 1158 else { /* First time FPU user. */
1158 init_fpu(); 1159 err = init_fpu();
1159 set_used_math(); 1160 set_used_math();
1160 } 1161 }
1161 1162
1162 if (!raw_cpu_has_fpu) { 1163 if (!raw_cpu_has_fpu || err) {
1163 int sig; 1164 int sig;
1164 void __user *fault_addr = NULL; 1165 void __user *fault_addr = NULL;
1165 sig = fpu_emulator_cop1Handler(regs, 1166 sig = fpu_emulator_cop1Handler(regs,
1166 &current->thread.fpu, 1167 &current->thread.fpu,
1167 0, &fault_addr); 1168 0, &fault_addr);
1168 if (!process_fpemu_return(sig, fault_addr)) 1169 if (!process_fpemu_return(sig, fault_addr) && !err)
1169 mt_ase_fp_affinity(); 1170 mt_ase_fp_affinity();
1170 } 1171 }
1171 1172
@@ -1336,6 +1337,8 @@ static inline void parity_protection_init(void)
1336 case CPU_34K: 1337 case CPU_34K:
1337 case CPU_74K: 1338 case CPU_74K:
1338 case CPU_1004K: 1339 case CPU_1004K:
1340 case CPU_INTERAPTIV:
1341 case CPU_PROAPTIV:
1339 { 1342 {
1340#define ERRCTL_PE 0x80000000 1343#define ERRCTL_PE 0x80000000
1341#define ERRCTL_L2P 0x00800000 1344#define ERRCTL_L2P 0x00800000
@@ -1425,14 +1428,27 @@ asmlinkage void cache_parity_error(void)
1425 printk("Decoded c0_cacheerr: %s cache fault in %s reference.\n", 1428 printk("Decoded c0_cacheerr: %s cache fault in %s reference.\n",
1426 reg_val & (1<<30) ? "secondary" : "primary", 1429 reg_val & (1<<30) ? "secondary" : "primary",
1427 reg_val & (1<<31) ? "data" : "insn"); 1430 reg_val & (1<<31) ? "data" : "insn");
1428 printk("Error bits: %s%s%s%s%s%s%s\n", 1431 if (cpu_has_mips_r2 &&
1429 reg_val & (1<<29) ? "ED " : "", 1432 ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) {
1430 reg_val & (1<<28) ? "ET " : "", 1433 pr_err("Error bits: %s%s%s%s%s%s%s%s\n",
1431 reg_val & (1<<26) ? "EE " : "", 1434 reg_val & (1<<29) ? "ED " : "",
1432 reg_val & (1<<25) ? "EB " : "", 1435 reg_val & (1<<28) ? "ET " : "",
1433 reg_val & (1<<24) ? "EI " : "", 1436 reg_val & (1<<27) ? "ES " : "",
1434 reg_val & (1<<23) ? "E1 " : "", 1437 reg_val & (1<<26) ? "EE " : "",
1435 reg_val & (1<<22) ? "E0 " : ""); 1438 reg_val & (1<<25) ? "EB " : "",
1439 reg_val & (1<<24) ? "EI " : "",
1440 reg_val & (1<<23) ? "E1 " : "",
1441 reg_val & (1<<22) ? "E0 " : "");
1442 } else {
1443 pr_err("Error bits: %s%s%s%s%s%s%s\n",
1444 reg_val & (1<<29) ? "ED " : "",
1445 reg_val & (1<<28) ? "ET " : "",
1446 reg_val & (1<<26) ? "EE " : "",
1447 reg_val & (1<<25) ? "EB " : "",
1448 reg_val & (1<<24) ? "EI " : "",
1449 reg_val & (1<<23) ? "E1 " : "",
1450 reg_val & (1<<22) ? "E0 " : "");
1451 }
1436 printk("IDX: 0x%08x\n", reg_val & ((1<<22)-1)); 1452 printk("IDX: 0x%08x\n", reg_val & ((1<<22)-1));
1437 1453
1438#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) 1454#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
@@ -1446,6 +1462,34 @@ asmlinkage void cache_parity_error(void)
1446 panic("Can't handle the cache error!"); 1462 panic("Can't handle the cache error!");
1447} 1463}
1448 1464
1465asmlinkage void do_ftlb(void)
1466{
1467 const int field = 2 * sizeof(unsigned long);
1468 unsigned int reg_val;
1469
1470 /* For the moment, report the problem and hang. */
1471 if (cpu_has_mips_r2 &&
1472 ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) {
1473 pr_err("FTLB error exception, cp0_ecc=0x%08x:\n",
1474 read_c0_ecc());
1475 pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());
1476 reg_val = read_c0_cacheerr();
1477 pr_err("c0_cacheerr == %08x\n", reg_val);
1478
1479 if ((reg_val & 0xc0000000) == 0xc0000000) {
1480 pr_err("Decoded c0_cacheerr: FTLB parity error\n");
1481 } else {
1482 pr_err("Decoded c0_cacheerr: %s cache fault in %s reference.\n",
1483 reg_val & (1<<30) ? "secondary" : "primary",
1484 reg_val & (1<<31) ? "data" : "insn");
1485 }
1486 } else {
1487 pr_err("FTLB error exception\n");
1488 }
1489 /* Just print the cacheerr bits for now */
1490 cache_parity_error();
1491}
1492
1449/* 1493/*
1450 * SDBBP EJTAG debug exception handler. 1494 * SDBBP EJTAG debug exception handler.
1451 * We skip the instruction and return to the next instruction. 1495 * We skip the instruction and return to the next instruction.
@@ -1995,6 +2039,7 @@ void __init trap_init(void)
1995 if (cpu_has_fpu && !cpu_has_nofpuex) 2039 if (cpu_has_fpu && !cpu_has_nofpuex)
1996 set_except_vector(15, handle_fpe); 2040 set_except_vector(15, handle_fpe);
1997 2041
2042 set_except_vector(16, handle_ftlb);
1998 set_except_vector(22, handle_mdmx); 2043 set_except_vector(22, handle_mdmx);
1999 2044
2000 if (cpu_has_mcheck) 2045 if (cpu_has_mcheck)
diff --git a/arch/mips/kernel/vpe-cmp.c b/arch/mips/kernel/vpe-cmp.c
new file mode 100644
index 000000000000..9268ebc0f61e
--- /dev/null
+++ b/arch/mips/kernel/vpe-cmp.c
@@ -0,0 +1,180 @@
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) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
8 */
9#include <linux/kernel.h>
10#include <linux/device.h>
11#include <linux/fs.h>
12#include <linux/slab.h>
13#include <linux/export.h>
14
15#include <asm/vpe.h>
16
17static int major;
18
19void cleanup_tc(struct tc *tc)
20{
21
22}
23
24static ssize_t store_kill(struct device *dev, struct device_attribute *attr,
25 const char *buf, size_t len)
26{
27 struct vpe *vpe = get_vpe(aprp_cpu_index());
28 struct vpe_notifications *notifier;
29
30 list_for_each_entry(notifier, &vpe->notify, list)
31 notifier->stop(aprp_cpu_index());
32
33 release_progmem(vpe->load_addr);
34 vpe->state = VPE_STATE_UNUSED;
35
36 return len;
37}
38static DEVICE_ATTR(kill, S_IWUSR, NULL, store_kill);
39
40static ssize_t ntcs_show(struct device *cd, struct device_attribute *attr,
41 char *buf)
42{
43 struct vpe *vpe = get_vpe(aprp_cpu_index());
44
45 return sprintf(buf, "%d\n", vpe->ntcs);
46}
47
48static ssize_t ntcs_store(struct device *dev, struct device_attribute *attr,
49 const char *buf, size_t len)
50{
51 struct vpe *vpe = get_vpe(aprp_cpu_index());
52 unsigned long new;
53 int ret;
54
55 ret = kstrtoul(buf, 0, &new);
56 if (ret < 0)
57 return ret;
58
59 /* APRP can only reserve one TC in a VPE and no more. */
60 if (new != 1)
61 return -EINVAL;
62
63 vpe->ntcs = new;
64
65 return len;
66}
67static DEVICE_ATTR_RW(ntcs);
68
69static struct attribute *vpe_attrs[] = {
70 &dev_attr_kill.attr,
71 &dev_attr_ntcs.attr,
72 NULL,
73};
74ATTRIBUTE_GROUPS(vpe);
75
76static void vpe_device_release(struct device *cd)
77{
78 kfree(cd);
79}
80
81static struct class vpe_class = {
82 .name = "vpe",
83 .owner = THIS_MODULE,
84 .dev_release = vpe_device_release,
85 .dev_groups = vpe_groups,
86};
87
88static struct device vpe_device;
89
90int __init vpe_module_init(void)
91{
92 struct vpe *v = NULL;
93 struct tc *t;
94 int err;
95
96 if (!cpu_has_mipsmt) {
97 pr_warn("VPE loader: not a MIPS MT capable processor\n");
98 return -ENODEV;
99 }
100
101 if (num_possible_cpus() - aprp_cpu_index() < 1) {
102 pr_warn("No VPEs reserved for AP/SP, not initialize VPE loader\n"
103 "Pass maxcpus=<n> argument as kernel argument\n");
104 return -ENODEV;
105 }
106
107 major = register_chrdev(0, VPE_MODULE_NAME, &vpe_fops);
108 if (major < 0) {
109 pr_warn("VPE loader: unable to register character device\n");
110 return major;
111 }
112
113 err = class_register(&vpe_class);
114 if (err) {
115 pr_err("vpe_class registration failed\n");
116 goto out_chrdev;
117 }
118
119 device_initialize(&vpe_device);
120 vpe_device.class = &vpe_class,
121 vpe_device.parent = NULL,
122 dev_set_name(&vpe_device, "vpe_sp");
123 vpe_device.devt = MKDEV(major, VPE_MODULE_MINOR);
124 err = device_add(&vpe_device);
125 if (err) {
126 pr_err("Adding vpe_device failed\n");
127 goto out_class;
128 }
129
130 t = alloc_tc(aprp_cpu_index());
131 if (!t) {
132 pr_warn("VPE: unable to allocate TC\n");
133 err = -ENOMEM;
134 goto out_dev;
135 }
136
137 /* VPE */
138 v = alloc_vpe(aprp_cpu_index());
139 if (v == NULL) {
140 pr_warn("VPE: unable to allocate VPE\n");
141 kfree(t);
142 err = -ENOMEM;
143 goto out_dev;
144 }
145
146 v->ntcs = 1;
147
148 /* add the tc to the list of this vpe's tc's. */
149 list_add(&t->tc, &v->tc);
150
151 /* TC */
152 t->pvpe = v; /* set the parent vpe */
153
154 return 0;
155
156out_dev:
157 device_del(&vpe_device);
158
159out_class:
160 class_unregister(&vpe_class);
161
162out_chrdev:
163 unregister_chrdev(major, VPE_MODULE_NAME);
164
165 return err;
166}
167
168void __exit vpe_module_exit(void)
169{
170 struct vpe *v, *n;
171
172 device_del(&vpe_device);
173 class_unregister(&vpe_class);
174 unregister_chrdev(major, VPE_MODULE_NAME);
175
176 /* No locking needed here */
177 list_for_each_entry_safe(v, n, &vpecontrol.vpe_list, list)
178 if (v->state != VPE_STATE_UNUSED)
179 release_vpe(v);
180}
diff --git a/arch/mips/kernel/vpe-mt.c b/arch/mips/kernel/vpe-mt.c
new file mode 100644
index 000000000000..949ae0e17018
--- /dev/null
+++ b/arch/mips/kernel/vpe-mt.c
@@ -0,0 +1,523 @@
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) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
8 */
9#include <linux/kernel.h>
10#include <linux/device.h>
11#include <linux/fs.h>
12#include <linux/slab.h>
13#include <linux/export.h>
14
15#include <asm/mipsregs.h>
16#include <asm/mipsmtregs.h>
17#include <asm/mips_mt.h>
18#include <asm/vpe.h>
19
20static int major;
21
22/* The number of TCs and VPEs physically available on the core */
23static int hw_tcs, hw_vpes;
24
25/* We are prepared so configure and start the VPE... */
26int vpe_run(struct vpe *v)
27{
28 unsigned long flags, val, dmt_flag;
29 struct vpe_notifications *notifier;
30 unsigned int vpeflags;
31 struct tc *t;
32
33 /* check we are the Master VPE */
34 local_irq_save(flags);
35 val = read_c0_vpeconf0();
36 if (!(val & VPECONF0_MVP)) {
37 pr_warn("VPE loader: only Master VPE's are able to config MT\n");
38 local_irq_restore(flags);
39
40 return -1;
41 }
42
43 dmt_flag = dmt();
44 vpeflags = dvpe();
45
46 if (list_empty(&v->tc)) {
47 evpe(vpeflags);
48 emt(dmt_flag);
49 local_irq_restore(flags);
50
51 pr_warn("VPE loader: No TC's associated with VPE %d\n",
52 v->minor);
53
54 return -ENOEXEC;
55 }
56
57 t = list_first_entry(&v->tc, struct tc, tc);
58
59 /* Put MVPE's into 'configuration state' */
60 set_c0_mvpcontrol(MVPCONTROL_VPC);
61
62 settc(t->index);
63
64 /* should check it is halted, and not activated */
65 if ((read_tc_c0_tcstatus() & TCSTATUS_A) ||
66 !(read_tc_c0_tchalt() & TCHALT_H)) {
67 evpe(vpeflags);
68 emt(dmt_flag);
69 local_irq_restore(flags);
70
71 pr_warn("VPE loader: TC %d is already active!\n",
72 t->index);
73
74 return -ENOEXEC;
75 }
76
77 /*
78 * Write the address we want it to start running from in the TCPC
79 * register.
80 */
81 write_tc_c0_tcrestart((unsigned long)v->__start);
82 write_tc_c0_tccontext((unsigned long)0);
83
84 /*
85 * Mark the TC as activated, not interrupt exempt and not dynamically
86 * allocatable
87 */
88 val = read_tc_c0_tcstatus();
89 val = (val & ~(TCSTATUS_DA | TCSTATUS_IXMT)) | TCSTATUS_A;
90 write_tc_c0_tcstatus(val);
91
92 write_tc_c0_tchalt(read_tc_c0_tchalt() & ~TCHALT_H);
93
94 /*
95 * The sde-kit passes 'memsize' to __start in $a3, so set something
96 * here... Or set $a3 to zero and define DFLT_STACK_SIZE and
97 * DFLT_HEAP_SIZE when you compile your program
98 */
99 mttgpr(6, v->ntcs);
100 mttgpr(7, physical_memsize);
101
102 /* set up VPE1 */
103 /*
104 * bind the TC to VPE 1 as late as possible so we only have the final
105 * VPE registers to set up, and so an EJTAG probe can trigger on it
106 */
107 write_tc_c0_tcbind((read_tc_c0_tcbind() & ~TCBIND_CURVPE) | 1);
108
109 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~(VPECONF0_VPA));
110
111 back_to_back_c0_hazard();
112
113 /* Set up the XTC bit in vpeconf0 to point at our tc */
114 write_vpe_c0_vpeconf0((read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC))
115 | (t->index << VPECONF0_XTC_SHIFT));
116
117 back_to_back_c0_hazard();
118
119 /* enable this VPE */
120 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA);
121
122 /* clear out any left overs from a previous program */
123 write_vpe_c0_status(0);
124 write_vpe_c0_cause(0);
125
126 /* take system out of configuration state */
127 clear_c0_mvpcontrol(MVPCONTROL_VPC);
128
129 /*
130 * SMTC/SMVP kernels manage VPE enable independently,
131 * but uniprocessor kernels need to turn it on, even
132 * if that wasn't the pre-dvpe() state.
133 */
134#ifdef CONFIG_SMP
135 evpe(vpeflags);
136#else
137 evpe(EVPE_ENABLE);
138#endif
139 emt(dmt_flag);
140 local_irq_restore(flags);
141
142 list_for_each_entry(notifier, &v->notify, list)
143 notifier->start(VPE_MODULE_MINOR);
144
145 return 0;
146}
147
148void cleanup_tc(struct tc *tc)
149{
150 unsigned long flags;
151 unsigned int mtflags, vpflags;
152 int tmp;
153
154 local_irq_save(flags);
155 mtflags = dmt();
156 vpflags = dvpe();
157 /* Put MVPE's into 'configuration state' */
158 set_c0_mvpcontrol(MVPCONTROL_VPC);
159
160 settc(tc->index);
161 tmp = read_tc_c0_tcstatus();
162
163 /* mark not allocated and not dynamically allocatable */
164 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
165 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
166 write_tc_c0_tcstatus(tmp);
167
168 write_tc_c0_tchalt(TCHALT_H);
169 mips_ihb();
170
171 clear_c0_mvpcontrol(MVPCONTROL_VPC);
172 evpe(vpflags);
173 emt(mtflags);
174 local_irq_restore(flags);
175}
176
177/* module wrapper entry points */
178/* give me a vpe */
179void *vpe_alloc(void)
180{
181 int i;
182 struct vpe *v;
183
184 /* find a vpe */
185 for (i = 1; i < MAX_VPES; i++) {
186 v = get_vpe(i);
187 if (v != NULL) {
188 v->state = VPE_STATE_INUSE;
189 return v;
190 }
191 }
192 return NULL;
193}
194EXPORT_SYMBOL(vpe_alloc);
195
196/* start running from here */
197int vpe_start(void *vpe, unsigned long start)
198{
199 struct vpe *v = vpe;
200
201 v->__start = start;
202 return vpe_run(v);
203}
204EXPORT_SYMBOL(vpe_start);
205
206/* halt it for now */
207int vpe_stop(void *vpe)
208{
209 struct vpe *v = vpe;
210 struct tc *t;
211 unsigned int evpe_flags;
212
213 evpe_flags = dvpe();
214
215 t = list_entry(v->tc.next, struct tc, tc);
216 if (t != NULL) {
217 settc(t->index);
218 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA);
219 }
220
221 evpe(evpe_flags);
222
223 return 0;
224}
225EXPORT_SYMBOL(vpe_stop);
226
227/* I've done with it thank you */
228int vpe_free(void *vpe)
229{
230 struct vpe *v = vpe;
231 struct tc *t;
232 unsigned int evpe_flags;
233
234 t = list_entry(v->tc.next, struct tc, tc);
235 if (t == NULL)
236 return -ENOEXEC;
237
238 evpe_flags = dvpe();
239
240 /* Put MVPE's into 'configuration state' */
241 set_c0_mvpcontrol(MVPCONTROL_VPC);
242
243 settc(t->index);
244 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA);
245
246 /* halt the TC */
247 write_tc_c0_tchalt(TCHALT_H);
248 mips_ihb();
249
250 /* mark the TC unallocated */
251 write_tc_c0_tcstatus(read_tc_c0_tcstatus() & ~TCSTATUS_A);
252
253 v->state = VPE_STATE_UNUSED;
254
255 clear_c0_mvpcontrol(MVPCONTROL_VPC);
256 evpe(evpe_flags);
257
258 return 0;
259}
260EXPORT_SYMBOL(vpe_free);
261
262static ssize_t store_kill(struct device *dev, struct device_attribute *attr,
263 const char *buf, size_t len)
264{
265 struct vpe *vpe = get_vpe(aprp_cpu_index());
266 struct vpe_notifications *notifier;
267
268 list_for_each_entry(notifier, &vpe->notify, list)
269 notifier->stop(aprp_cpu_index());
270
271 release_progmem(vpe->load_addr);
272 cleanup_tc(get_tc(aprp_cpu_index()));
273 vpe_stop(vpe);
274 vpe_free(vpe);
275
276 return len;
277}
278static DEVICE_ATTR(kill, S_IWUSR, NULL, store_kill);
279
280static ssize_t ntcs_show(struct device *cd, struct device_attribute *attr,
281 char *buf)
282{
283 struct vpe *vpe = get_vpe(aprp_cpu_index());
284
285 return sprintf(buf, "%d\n", vpe->ntcs);
286}
287
288static ssize_t ntcs_store(struct device *dev, struct device_attribute *attr,
289 const char *buf, size_t len)
290{
291 struct vpe *vpe = get_vpe(aprp_cpu_index());
292 unsigned long new;
293 int ret;
294
295 ret = kstrtoul(buf, 0, &new);
296 if (ret < 0)
297 return ret;
298
299 if (new == 0 || new > (hw_tcs - aprp_cpu_index()))
300 return -EINVAL;
301
302 vpe->ntcs = new;
303
304 return len;
305}
306static DEVICE_ATTR_RW(ntcs);
307
308static struct attribute *vpe_attrs[] = {
309 &dev_attr_kill.attr,
310 &dev_attr_ntcs.attr,
311 NULL,
312};
313ATTRIBUTE_GROUPS(vpe);
314
315static void vpe_device_release(struct device *cd)
316{
317 kfree(cd);
318}
319
320static struct class vpe_class = {
321 .name = "vpe",
322 .owner = THIS_MODULE,
323 .dev_release = vpe_device_release,
324 .dev_groups = vpe_groups,
325};
326
327static struct device vpe_device;
328
329int __init vpe_module_init(void)
330{
331 unsigned int mtflags, vpflags;
332 unsigned long flags, val;
333 struct vpe *v = NULL;
334 struct tc *t;
335 int tc, err;
336
337 if (!cpu_has_mipsmt) {
338 pr_warn("VPE loader: not a MIPS MT capable processor\n");
339 return -ENODEV;
340 }
341
342 if (vpelimit == 0) {
343 pr_warn("No VPEs reserved for AP/SP, not initialize VPE loader\n"
344 "Pass maxvpes=<n> argument as kernel argument\n");
345
346 return -ENODEV;
347 }
348
349 if (aprp_cpu_index() == 0) {
350 pr_warn("No TCs reserved for AP/SP, not initialize VPE loader\n"
351 "Pass maxtcs=<n> argument as kernel argument\n");
352
353 return -ENODEV;
354 }
355
356 major = register_chrdev(0, VPE_MODULE_NAME, &vpe_fops);
357 if (major < 0) {
358 pr_warn("VPE loader: unable to register character device\n");
359 return major;
360 }
361
362 err = class_register(&vpe_class);
363 if (err) {
364 pr_err("vpe_class registration failed\n");
365 goto out_chrdev;
366 }
367
368 device_initialize(&vpe_device);
369 vpe_device.class = &vpe_class,
370 vpe_device.parent = NULL,
371 dev_set_name(&vpe_device, "vpe1");
372 vpe_device.devt = MKDEV(major, VPE_MODULE_MINOR);
373 err = device_add(&vpe_device);
374 if (err) {
375 pr_err("Adding vpe_device failed\n");
376 goto out_class;
377 }
378
379 local_irq_save(flags);
380 mtflags = dmt();
381 vpflags = dvpe();
382
383 /* Put MVPE's into 'configuration state' */
384 set_c0_mvpcontrol(MVPCONTROL_VPC);
385
386 val = read_c0_mvpconf0();
387 hw_tcs = (val & MVPCONF0_PTC) + 1;
388 hw_vpes = ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
389
390 for (tc = aprp_cpu_index(); tc < hw_tcs; tc++) {
391 /*
392 * Must re-enable multithreading temporarily or in case we
393 * reschedule send IPIs or similar we might hang.
394 */
395 clear_c0_mvpcontrol(MVPCONTROL_VPC);
396 evpe(vpflags);
397 emt(mtflags);
398 local_irq_restore(flags);
399 t = alloc_tc(tc);
400 if (!t) {
401 err = -ENOMEM;
402 goto out_dev;
403 }
404
405 local_irq_save(flags);
406 mtflags = dmt();
407 vpflags = dvpe();
408 set_c0_mvpcontrol(MVPCONTROL_VPC);
409
410 /* VPE's */
411 if (tc < hw_tcs) {
412 settc(tc);
413
414 v = alloc_vpe(tc);
415 if (v == NULL) {
416 pr_warn("VPE: unable to allocate VPE\n");
417 goto out_reenable;
418 }
419
420 v->ntcs = hw_tcs - aprp_cpu_index();
421
422 /* add the tc to the list of this vpe's tc's. */
423 list_add(&t->tc, &v->tc);
424
425 /* deactivate all but vpe0 */
426 if (tc >= aprp_cpu_index()) {
427 unsigned long tmp = read_vpe_c0_vpeconf0();
428
429 tmp &= ~VPECONF0_VPA;
430
431 /* master VPE */
432 tmp |= VPECONF0_MVP;
433 write_vpe_c0_vpeconf0(tmp);
434 }
435
436 /* disable multi-threading with TC's */
437 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() &
438 ~VPECONTROL_TE);
439
440 if (tc >= vpelimit) {
441 /*
442 * Set config to be the same as vpe0,
443 * particularly kseg0 coherency alg
444 */
445 write_vpe_c0_config(read_c0_config());
446 }
447 }
448
449 /* TC's */
450 t->pvpe = v; /* set the parent vpe */
451
452 if (tc >= aprp_cpu_index()) {
453 unsigned long tmp;
454
455 settc(tc);
456
457 /* Any TC that is bound to VPE0 gets left as is - in
458 * case we are running SMTC on VPE0. A TC that is bound
459 * to any other VPE gets bound to VPE0, ideally I'd like
460 * to make it homeless but it doesn't appear to let me
461 * bind a TC to a non-existent VPE. Which is perfectly
462 * reasonable.
463 *
464 * The (un)bound state is visible to an EJTAG probe so
465 * may notify GDB...
466 */
467 tmp = read_tc_c0_tcbind();
468 if (tmp & TCBIND_CURVPE) {
469 /* tc is bound >vpe0 */
470 write_tc_c0_tcbind(tmp & ~TCBIND_CURVPE);
471
472 t->pvpe = get_vpe(0); /* set the parent vpe */
473 }
474
475 /* halt the TC */
476 write_tc_c0_tchalt(TCHALT_H);
477 mips_ihb();
478
479 tmp = read_tc_c0_tcstatus();
480
481 /* mark not activated and not dynamically allocatable */
482 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
483 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
484 write_tc_c0_tcstatus(tmp);
485 }
486 }
487
488out_reenable:
489 /* release config state */
490 clear_c0_mvpcontrol(MVPCONTROL_VPC);
491
492 evpe(vpflags);
493 emt(mtflags);
494 local_irq_restore(flags);
495
496 return 0;
497
498out_dev:
499 device_del(&vpe_device);
500
501out_class:
502 class_unregister(&vpe_class);
503
504out_chrdev:
505 unregister_chrdev(major, VPE_MODULE_NAME);
506
507 return err;
508}
509
510void __exit vpe_module_exit(void)
511{
512 struct vpe *v, *n;
513
514 device_del(&vpe_device);
515 class_unregister(&vpe_class);
516 unregister_chrdev(major, VPE_MODULE_NAME);
517
518 /* No locking needed here */
519 list_for_each_entry_safe(v, n, &vpecontrol.vpe_list, list) {
520 if (v->state != VPE_STATE_UNUSED)
521 release_vpe(v);
522 }
523}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 59b2b3cd7885..11da314565cc 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1,37 +1,22 @@
1/* 1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 2 * This file is subject to the terms and conditions of the GNU General Public
3 * 3 * License. See the file "COPYING" in the main directory of this archive
4 * This program is free software; you can distribute it and/or modify it 4 * for more details.
5 * 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 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
11 * for more details.
12 * 5 *
13 * You should have received a copy of the GNU General Public License along 6 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
14 * with this program; if not, write to the Free Software Foundation, Inc., 7 * Copyright (C) 2013 Imagination Technologies Ltd.
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 */
17
18/*
19 * VPE support module
20 *
21 * Provides support for loading a MIPS SP program on VPE1.
22 * The SP environment is rather simple, no tlb's. It needs to be relocatable
23 * (or partially linked). You should initialise your stack in the startup
24 * code. This loader looks for the symbol __start and sets up
25 * execution to resume from there. The MIPS SDE kit contains suitable examples.
26 * 8 *
27 * To load and run, simply cat a SP 'program file' to /dev/vpe1. 9 * VPE spport module for loading a MIPS SP program into VPE1. The SP
28 * i.e cat spapp >/dev/vpe1. 10 * environment is rather simple since there are no TLBs. It needs
11 * to be relocatable (or partiall linked). Initialize your stack in
12 * the startup-code. The loader looks for the symbol __start and sets
13 * up the execution to resume from there. To load and run, simply do
14 * a cat SP 'binary' to the /dev/vpe1 device.
29 */ 15 */
30#include <linux/kernel.h> 16#include <linux/kernel.h>
31#include <linux/device.h> 17#include <linux/device.h>
32#include <linux/fs.h> 18#include <linux/fs.h>
33#include <linux/init.h> 19#include <linux/init.h>
34#include <asm/uaccess.h>
35#include <linux/slab.h> 20#include <linux/slab.h>
36#include <linux/list.h> 21#include <linux/list.h>
37#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
@@ -46,13 +31,10 @@
46#include <asm/mipsmtregs.h> 31#include <asm/mipsmtregs.h>
47#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
48#include <linux/atomic.h> 33#include <linux/atomic.h>
49#include <asm/cpu.h>
50#include <asm/mips_mt.h> 34#include <asm/mips_mt.h>
51#include <asm/processor.h> 35#include <asm/processor.h>
52#include <asm/vpe.h> 36#include <asm/vpe.h>
53 37
54typedef void *vpe_handle;
55
56#ifndef ARCH_SHF_SMALL 38#ifndef ARCH_SHF_SMALL
57#define ARCH_SHF_SMALL 0 39#define ARCH_SHF_SMALL 0
58#endif 40#endif
@@ -60,96 +42,15 @@ typedef void *vpe_handle;
60/* If this is set, the section belongs in the init part of the module */ 42/* If this is set, the section belongs in the init part of the module */
61#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) 43#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
62 44
63/* 45struct vpe_control vpecontrol = {
64 * The number of TCs and VPEs physically available on the core
65 */
66static int hw_tcs, hw_vpes;
67static char module_name[] = "vpe";
68static int major;
69static const int minor = 1; /* fixed for now */
70
71/* grab the likely amount of memory we will need. */
72#ifdef CONFIG_MIPS_VPE_LOADER_TOM
73#define P_SIZE (2 * 1024 * 1024)
74#else
75/* add an overhead to the max kmalloc size for non-striped symbols/etc */
76#define P_SIZE (256 * 1024)
77#endif
78
79extern unsigned long physical_memsize;
80
81#define MAX_VPES 16
82#define VPE_PATH_MAX 256
83
84enum vpe_state {
85 VPE_STATE_UNUSED = 0,
86 VPE_STATE_INUSE,
87 VPE_STATE_RUNNING
88};
89
90enum tc_state {
91 TC_STATE_UNUSED = 0,
92 TC_STATE_INUSE,
93 TC_STATE_RUNNING,
94 TC_STATE_DYNAMIC
95};
96
97struct vpe {
98 enum vpe_state state;
99
100 /* (device) minor associated with this vpe */
101 int minor;
102
103 /* elfloader stuff */
104 void *load_addr;
105 unsigned long len;
106 char *pbuffer;
107 unsigned long plen;
108 unsigned int uid, gid;
109 char cwd[VPE_PATH_MAX];
110
111 unsigned long __start;
112
113 /* tc's associated with this vpe */
114 struct list_head tc;
115
116 /* The list of vpe's */
117 struct list_head list;
118
119 /* shared symbol address */
120 void *shared_ptr;
121
122 /* the list of who wants to know when something major happens */
123 struct list_head notify;
124
125 unsigned int ntcs;
126};
127
128struct tc {
129 enum tc_state state;
130 int index;
131
132 struct vpe *pvpe; /* parent VPE */
133 struct list_head tc; /* The list of TC's with this VPE */
134 struct list_head list; /* The global list of tc's */
135};
136
137struct {
138 spinlock_t vpe_list_lock;
139 struct list_head vpe_list; /* Virtual processing elements */
140 spinlock_t tc_list_lock;
141 struct list_head tc_list; /* Thread contexts */
142} vpecontrol = {
143 .vpe_list_lock = __SPIN_LOCK_UNLOCKED(vpe_list_lock), 46 .vpe_list_lock = __SPIN_LOCK_UNLOCKED(vpe_list_lock),
144 .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list), 47 .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list),
145 .tc_list_lock = __SPIN_LOCK_UNLOCKED(tc_list_lock), 48 .tc_list_lock = __SPIN_LOCK_UNLOCKED(tc_list_lock),
146 .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list) 49 .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list)
147}; 50};
148 51
149static void release_progmem(void *ptr);
150
151/* get the vpe associated with this minor */ 52/* get the vpe associated with this minor */
152static struct vpe *get_vpe(int minor) 53struct vpe *get_vpe(int minor)
153{ 54{
154 struct vpe *res, *v; 55 struct vpe *res, *v;
155 56
@@ -159,7 +60,7 @@ static struct vpe *get_vpe(int minor)
159 res = NULL; 60 res = NULL;
160 spin_lock(&vpecontrol.vpe_list_lock); 61 spin_lock(&vpecontrol.vpe_list_lock);
161 list_for_each_entry(v, &vpecontrol.vpe_list, list) { 62 list_for_each_entry(v, &vpecontrol.vpe_list, list) {
162 if (v->minor == minor) { 63 if (v->minor == VPE_MODULE_MINOR) {
163 res = v; 64 res = v;
164 break; 65 break;
165 } 66 }
@@ -170,7 +71,7 @@ static struct vpe *get_vpe(int minor)
170} 71}
171 72
172/* get the vpe associated with this minor */ 73/* get the vpe associated with this minor */
173static struct tc *get_tc(int index) 74struct tc *get_tc(int index)
174{ 75{
175 struct tc *res, *t; 76 struct tc *res, *t;
176 77
@@ -188,12 +89,13 @@ static struct tc *get_tc(int index)
188} 89}
189 90
190/* allocate a vpe and associate it with this minor (or index) */ 91/* allocate a vpe and associate it with this minor (or index) */
191static struct vpe *alloc_vpe(int minor) 92struct vpe *alloc_vpe(int minor)
192{ 93{
193 struct vpe *v; 94 struct vpe *v;
194 95
195 if ((v = kzalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL) 96 v = kzalloc(sizeof(struct vpe), GFP_KERNEL);
196 return NULL; 97 if (v == NULL)
98 goto out;
197 99
198 INIT_LIST_HEAD(&v->tc); 100 INIT_LIST_HEAD(&v->tc);
199 spin_lock(&vpecontrol.vpe_list_lock); 101 spin_lock(&vpecontrol.vpe_list_lock);
@@ -201,17 +103,19 @@ static struct vpe *alloc_vpe(int minor)
201 spin_unlock(&vpecontrol.vpe_list_lock); 103 spin_unlock(&vpecontrol.vpe_list_lock);
202 104
203 INIT_LIST_HEAD(&v->notify); 105 INIT_LIST_HEAD(&v->notify);
204 v->minor = minor; 106 v->minor = VPE_MODULE_MINOR;
205 107
108out:
206 return v; 109 return v;
207} 110}
208 111
209/* allocate a tc. At startup only tc0 is running, all other can be halted. */ 112/* allocate a tc. At startup only tc0 is running, all other can be halted. */
210static struct tc *alloc_tc(int index) 113struct tc *alloc_tc(int index)
211{ 114{
212 struct tc *tc; 115 struct tc *tc;
213 116
214 if ((tc = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) 117 tc = kzalloc(sizeof(struct tc), GFP_KERNEL);
118 if (tc == NULL)
215 goto out; 119 goto out;
216 120
217 INIT_LIST_HEAD(&tc->tc); 121 INIT_LIST_HEAD(&tc->tc);
@@ -226,7 +130,7 @@ out:
226} 130}
227 131
228/* clean up and free everything */ 132/* clean up and free everything */
229static void release_vpe(struct vpe *v) 133void release_vpe(struct vpe *v)
230{ 134{
231 list_del(&v->list); 135 list_del(&v->list);
232 if (v->load_addr) 136 if (v->load_addr)
@@ -234,28 +138,8 @@ static void release_vpe(struct vpe *v)
234 kfree(v); 138 kfree(v);
235} 139}
236 140
237static void __maybe_unused dump_mtregs(void) 141/* Find some VPE program space */
238{ 142void *alloc_progmem(unsigned long len)
239 unsigned long val;
240
241 val = read_c0_config3();
242 printk("config3 0x%lx MT %ld\n", val,
243 (val & CONFIG3_MT) >> CONFIG3_MT_SHIFT);
244
245 val = read_c0_mvpcontrol();
246 printk("MVPControl 0x%lx, STLB %ld VPC %ld EVP %ld\n", val,
247 (val & MVPCONTROL_STLB) >> MVPCONTROL_STLB_SHIFT,
248 (val & MVPCONTROL_VPC) >> MVPCONTROL_VPC_SHIFT,
249 (val & MVPCONTROL_EVP));
250
251 val = read_c0_mvpconf0();
252 printk("mvpconf0 0x%lx, PVPE %ld PTC %ld M %ld\n", val,
253 (val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT,
254 val & MVPCONF0_PTC, (val & MVPCONF0_M) >> MVPCONF0_M_SHIFT);
255}
256
257/* Find some VPE program space */
258static void *alloc_progmem(unsigned long len)
259{ 143{
260 void *addr; 144 void *addr;
261 145
@@ -274,7 +158,7 @@ static void *alloc_progmem(unsigned long len)
274 return addr; 158 return addr;
275} 159}
276 160
277static void release_progmem(void *ptr) 161void release_progmem(void *ptr)
278{ 162{
279#ifndef CONFIG_MIPS_VPE_LOADER_TOM 163#ifndef CONFIG_MIPS_VPE_LOADER_TOM
280 kfree(ptr); 164 kfree(ptr);
@@ -282,7 +166,7 @@ static void release_progmem(void *ptr)
282} 166}
283 167
284/* Update size with this section: return offset. */ 168/* Update size with this section: return offset. */
285static long get_offset(unsigned long *size, Elf_Shdr * sechdr) 169static long get_offset(unsigned long *size, Elf_Shdr *sechdr)
286{ 170{
287 long ret; 171 long ret;
288 172
@@ -295,8 +179,8 @@ static long get_offset(unsigned long *size, Elf_Shdr * sechdr)
295 might -- code, read-only data, read-write data, small data. Tally 179 might -- code, read-only data, read-write data, small data. Tally
296 sizes, and place the offsets into sh_entsize fields: high bit means it 180 sizes, and place the offsets into sh_entsize fields: high bit means it
297 belongs in init. */ 181 belongs in init. */
298static void layout_sections(struct module *mod, const Elf_Ehdr * hdr, 182static void layout_sections(struct module *mod, const Elf_Ehdr *hdr,
299 Elf_Shdr * sechdrs, const char *secstrings) 183 Elf_Shdr *sechdrs, const char *secstrings)
300{ 184{
301 static unsigned long const masks[][2] = { 185 static unsigned long const masks[][2] = {
302 /* NOTE: all executable code must be the first section 186 /* NOTE: all executable code must be the first section
@@ -316,7 +200,6 @@ static void layout_sections(struct module *mod, const Elf_Ehdr * hdr,
316 for (i = 0; i < hdr->e_shnum; ++i) { 200 for (i = 0; i < hdr->e_shnum; ++i) {
317 Elf_Shdr *s = &sechdrs[i]; 201 Elf_Shdr *s = &sechdrs[i];
318 202
319 // || strncmp(secstrings + s->sh_name, ".init", 5) == 0)
320 if ((s->sh_flags & masks[m][0]) != masks[m][0] 203 if ((s->sh_flags & masks[m][0]) != masks[m][0]
321 || (s->sh_flags & masks[m][1]) 204 || (s->sh_flags & masks[m][1])
322 || s->sh_entsize != ~0UL) 205 || s->sh_entsize != ~0UL)
@@ -331,7 +214,6 @@ static void layout_sections(struct module *mod, const Elf_Ehdr * hdr,
331 } 214 }
332} 215}
333 216
334
335/* from module-elf32.c, but subverted a little */ 217/* from module-elf32.c, but subverted a little */
336 218
337struct mips_hi16 { 219struct mips_hi16 {
@@ -354,20 +236,18 @@ static int apply_r_mips_gprel16(struct module *me, uint32_t *location,
354{ 236{
355 int rel; 237 int rel;
356 238
357 if( !(*location & 0xffff) ) { 239 if (!(*location & 0xffff)) {
358 rel = (int)v - gp_addr; 240 rel = (int)v - gp_addr;
359 } 241 } else {
360 else {
361 /* .sbss + gp(relative) + offset */ 242 /* .sbss + gp(relative) + offset */
362 /* kludge! */ 243 /* kludge! */
363 rel = (int)(short)((int)v + gp_offs + 244 rel = (int)(short)((int)v + gp_offs +
364 (int)(short)(*location & 0xffff) - gp_addr); 245 (int)(short)(*location & 0xffff) - gp_addr);
365 } 246 }
366 247
367 if( (rel > 32768) || (rel < -32768) ) { 248 if ((rel > 32768) || (rel < -32768)) {
368 printk(KERN_DEBUG "VPE loader: apply_r_mips_gprel16: " 249 pr_debug("VPE loader: apply_r_mips_gprel16: relative address 0x%x out of range of gp register\n",
369 "relative address 0x%x out of range of gp register\n", 250 rel);
370 rel);
371 return -ENOEXEC; 251 return -ENOEXEC;
372 } 252 }
373 253
@@ -381,12 +261,12 @@ static int apply_r_mips_pc16(struct module *me, uint32_t *location,
381{ 261{
382 int rel; 262 int rel;
383 rel = (((unsigned int)v - (unsigned int)location)); 263 rel = (((unsigned int)v - (unsigned int)location));
384 rel >>= 2; // because the offset is in _instructions_ not bytes. 264 rel >>= 2; /* because the offset is in _instructions_ not bytes. */
385 rel -= 1; // and one instruction less due to the branch delay slot. 265 rel -= 1; /* and one instruction less due to the branch delay slot. */
386 266
387 if( (rel > 32768) || (rel < -32768) ) { 267 if ((rel > 32768) || (rel < -32768)) {
388 printk(KERN_DEBUG "VPE loader: " 268 pr_debug("VPE loader: apply_r_mips_pc16: relative address out of range 0x%x\n",
389 "apply_r_mips_pc16: relative address out of range 0x%x\n", rel); 269 rel);
390 return -ENOEXEC; 270 return -ENOEXEC;
391 } 271 }
392 272
@@ -407,8 +287,7 @@ static int apply_r_mips_26(struct module *me, uint32_t *location,
407 Elf32_Addr v) 287 Elf32_Addr v)
408{ 288{
409 if (v % 4) { 289 if (v % 4) {
410 printk(KERN_DEBUG "VPE loader: apply_r_mips_26 " 290 pr_debug("VPE loader: apply_r_mips_26: unaligned relocation\n");
411 " unaligned relocation\n");
412 return -ENOEXEC; 291 return -ENOEXEC;
413 } 292 }
414 293
@@ -439,7 +318,7 @@ static int apply_r_mips_hi16(struct module *me, uint32_t *location,
439 * the carry we need to add. Save the information, and let LO16 do the 318 * the carry we need to add. Save the information, and let LO16 do the
440 * actual relocation. 319 * actual relocation.
441 */ 320 */
442 n = kmalloc(sizeof *n, GFP_KERNEL); 321 n = kmalloc(sizeof(*n), GFP_KERNEL);
443 if (!n) 322 if (!n)
444 return -ENOMEM; 323 return -ENOMEM;
445 324
@@ -471,9 +350,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
471 * The value for the HI16 had best be the same. 350 * The value for the HI16 had best be the same.
472 */ 351 */
473 if (v != l->value) { 352 if (v != l->value) {
474 printk(KERN_DEBUG "VPE loader: " 353 pr_debug("VPE loader: apply_r_mips_lo16/hi16: inconsistent value information\n");
475 "apply_r_mips_lo16/hi16: \t"
476 "inconsistent value information\n");
477 goto out_free; 354 goto out_free;
478 } 355 }
479 356
@@ -569,20 +446,19 @@ static int apply_relocations(Elf32_Shdr *sechdrs,
569 + ELF32_R_SYM(r_info); 446 + ELF32_R_SYM(r_info);
570 447
571 if (!sym->st_value) { 448 if (!sym->st_value) {
572 printk(KERN_DEBUG "%s: undefined weak symbol %s\n", 449 pr_debug("%s: undefined weak symbol %s\n",
573 me->name, strtab + sym->st_name); 450 me->name, strtab + sym->st_name);
574 /* just print the warning, dont barf */ 451 /* just print the warning, dont barf */
575 } 452 }
576 453
577 v = sym->st_value; 454 v = sym->st_value;
578 455
579 res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v); 456 res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v);
580 if( res ) { 457 if (res) {
581 char *r = rstrs[ELF32_R_TYPE(r_info)]; 458 char *r = rstrs[ELF32_R_TYPE(r_info)];
582 printk(KERN_WARNING "VPE loader: .text+0x%x " 459 pr_warn("VPE loader: .text+0x%x relocation type %s for symbol \"%s\" failed\n",
583 "relocation type %s for symbol \"%s\" failed\n", 460 rel[i].r_offset, r ? r : "UNKNOWN",
584 rel[i].r_offset, r ? r : "UNKNOWN", 461 strtab + sym->st_name);
585 strtab + sym->st_name);
586 return res; 462 return res;
587 } 463 }
588 } 464 }
@@ -597,10 +473,8 @@ static inline void save_gp_address(unsigned int secbase, unsigned int rel)
597} 473}
598/* end module-elf32.c */ 474/* end module-elf32.c */
599 475
600
601
602/* Change all symbols so that sh_value encodes the pointer directly. */ 476/* Change all symbols so that sh_value encodes the pointer directly. */
603static void simplify_symbols(Elf_Shdr * sechdrs, 477static void simplify_symbols(Elf_Shdr *sechdrs,
604 unsigned int symindex, 478 unsigned int symindex,
605 const char *strtab, 479 const char *strtab,
606 const char *secstrings, 480 const char *secstrings,
@@ -641,18 +515,16 @@ static void simplify_symbols(Elf_Shdr * sechdrs,
641 break; 515 break;
642 516
643 case SHN_MIPS_SCOMMON: 517 case SHN_MIPS_SCOMMON:
644 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON " 518 pr_debug("simplify_symbols: ignoring SHN_MIPS_SCOMMON symbol <%s> st_shndx %d\n",
645 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name, 519 strtab + sym[i].st_name, sym[i].st_shndx);
646 sym[i].st_shndx); 520 /* .sbss section */
647 // .sbss section
648 break; 521 break;
649 522
650 default: 523 default:
651 secbase = sechdrs[sym[i].st_shndx].sh_addr; 524 secbase = sechdrs[sym[i].st_shndx].sh_addr;
652 525
653 if (strncmp(strtab + sym[i].st_name, "_gp", 3) == 0) { 526 if (strncmp(strtab + sym[i].st_name, "_gp", 3) == 0)
654 save_gp_address(secbase, sym[i].st_value); 527 save_gp_address(secbase, sym[i].st_value);
655 }
656 528
657 sym[i].st_value += secbase; 529 sym[i].st_value += secbase;
658 break; 530 break;
@@ -661,142 +533,21 @@ static void simplify_symbols(Elf_Shdr * sechdrs,
661} 533}
662 534
663#ifdef DEBUG_ELFLOADER 535#ifdef DEBUG_ELFLOADER
664static void dump_elfsymbols(Elf_Shdr * sechdrs, unsigned int symindex, 536static void dump_elfsymbols(Elf_Shdr *sechdrs, unsigned int symindex,
665 const char *strtab, struct module *mod) 537 const char *strtab, struct module *mod)
666{ 538{
667 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; 539 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr;
668 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); 540 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
669 541
670 printk(KERN_DEBUG "dump_elfsymbols: n %d\n", n); 542 pr_debug("dump_elfsymbols: n %d\n", n);
671 for (i = 1; i < n; i++) { 543 for (i = 1; i < n; i++) {
672 printk(KERN_DEBUG " i %d name <%s> 0x%x\n", i, 544 pr_debug(" i %d name <%s> 0x%x\n", i, strtab + sym[i].st_name,
673 strtab + sym[i].st_name, sym[i].st_value); 545 sym[i].st_value);
674 } 546 }
675} 547}
676#endif 548#endif
677 549
678/* We are prepared so configure and start the VPE... */ 550static int find_vpe_symbols(struct vpe *v, Elf_Shdr *sechdrs,
679static int vpe_run(struct vpe * v)
680{
681 unsigned long flags, val, dmt_flag;
682 struct vpe_notifications *n;
683 unsigned int vpeflags;
684 struct tc *t;
685
686 /* check we are the Master VPE */
687 local_irq_save(flags);
688 val = read_c0_vpeconf0();
689 if (!(val & VPECONF0_MVP)) {
690 printk(KERN_WARNING
691 "VPE loader: only Master VPE's are allowed to configure MT\n");
692 local_irq_restore(flags);
693
694 return -1;
695 }
696
697 dmt_flag = dmt();
698 vpeflags = dvpe();
699
700 if (list_empty(&v->tc)) {
701 evpe(vpeflags);
702 emt(dmt_flag);
703 local_irq_restore(flags);
704
705 printk(KERN_WARNING
706 "VPE loader: No TC's associated with VPE %d\n",
707 v->minor);
708
709 return -ENOEXEC;
710 }
711
712 t = list_first_entry(&v->tc, struct tc, tc);
713
714 /* Put MVPE's into 'configuration state' */
715 set_c0_mvpcontrol(MVPCONTROL_VPC);
716
717 settc(t->index);
718
719 /* should check it is halted, and not activated */
720 if ((read_tc_c0_tcstatus() & TCSTATUS_A) || !(read_tc_c0_tchalt() & TCHALT_H)) {
721 evpe(vpeflags);
722 emt(dmt_flag);
723 local_irq_restore(flags);
724
725 printk(KERN_WARNING "VPE loader: TC %d is already active!\n",
726 t->index);
727
728 return -ENOEXEC;
729 }
730
731 /* Write the address we want it to start running from in the TCPC register. */
732 write_tc_c0_tcrestart((unsigned long)v->__start);
733 write_tc_c0_tccontext((unsigned long)0);
734
735 /*
736 * Mark the TC as activated, not interrupt exempt and not dynamically
737 * allocatable
738 */
739 val = read_tc_c0_tcstatus();
740 val = (val & ~(TCSTATUS_DA | TCSTATUS_IXMT)) | TCSTATUS_A;
741 write_tc_c0_tcstatus(val);
742
743 write_tc_c0_tchalt(read_tc_c0_tchalt() & ~TCHALT_H);
744
745 /*
746 * The sde-kit passes 'memsize' to __start in $a3, so set something
747 * here... Or set $a3 to zero and define DFLT_STACK_SIZE and
748 * DFLT_HEAP_SIZE when you compile your program
749 */
750 mttgpr(6, v->ntcs);
751 mttgpr(7, physical_memsize);
752
753 /* set up VPE1 */
754 /*
755 * bind the TC to VPE 1 as late as possible so we only have the final
756 * VPE registers to set up, and so an EJTAG probe can trigger on it
757 */
758 write_tc_c0_tcbind((read_tc_c0_tcbind() & ~TCBIND_CURVPE) | 1);
759
760 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~(VPECONF0_VPA));
761
762 back_to_back_c0_hazard();
763
764 /* Set up the XTC bit in vpeconf0 to point at our tc */
765 write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC))
766 | (t->index << VPECONF0_XTC_SHIFT));
767
768 back_to_back_c0_hazard();
769
770 /* enable this VPE */
771 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA);
772
773 /* clear out any left overs from a previous program */
774 write_vpe_c0_status(0);
775 write_vpe_c0_cause(0);
776
777 /* take system out of configuration state */
778 clear_c0_mvpcontrol(MVPCONTROL_VPC);
779
780 /*
781 * SMTC/SMVP kernels manage VPE enable independently,
782 * but uniprocessor kernels need to turn it on, even
783 * if that wasn't the pre-dvpe() state.
784 */
785#ifdef CONFIG_SMP
786 evpe(vpeflags);
787#else
788 evpe(EVPE_ENABLE);
789#endif
790 emt(dmt_flag);
791 local_irq_restore(flags);
792
793 list_for_each_entry(n, &v->notify, list)
794 n->start(minor);
795
796 return 0;
797}
798
799static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
800 unsigned int symindex, const char *strtab, 551 unsigned int symindex, const char *strtab,
801 struct module *mod) 552 struct module *mod)
802{ 553{
@@ -804,16 +555,14 @@ static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
804 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); 555 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
805 556
806 for (i = 1; i < n; i++) { 557 for (i = 1; i < n; i++) {
807 if (strcmp(strtab + sym[i].st_name, "__start") == 0) { 558 if (strcmp(strtab + sym[i].st_name, "__start") == 0)
808 v->__start = sym[i].st_value; 559 v->__start = sym[i].st_value;
809 }
810 560
811 if (strcmp(strtab + sym[i].st_name, "vpe_shared") == 0) { 561 if (strcmp(strtab + sym[i].st_name, "vpe_shared") == 0)
812 v->shared_ptr = (void *)sym[i].st_value; 562 v->shared_ptr = (void *)sym[i].st_value;
813 }
814 } 563 }
815 564
816 if ( (v->__start == 0) || (v->shared_ptr == NULL)) 565 if ((v->__start == 0) || (v->shared_ptr == NULL))
817 return -1; 566 return -1;
818 567
819 return 0; 568 return 0;
@@ -824,14 +573,14 @@ static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs,
824 * contents of the program (p)buffer performing relocatations/etc, free's it 573 * contents of the program (p)buffer performing relocatations/etc, free's it
825 * when finished. 574 * when finished.
826 */ 575 */
827static int vpe_elfload(struct vpe * v) 576static int vpe_elfload(struct vpe *v)
828{ 577{
829 Elf_Ehdr *hdr; 578 Elf_Ehdr *hdr;
830 Elf_Shdr *sechdrs; 579 Elf_Shdr *sechdrs;
831 long err = 0; 580 long err = 0;
832 char *secstrings, *strtab = NULL; 581 char *secstrings, *strtab = NULL;
833 unsigned int len, i, symindex = 0, strindex = 0, relocate = 0; 582 unsigned int len, i, symindex = 0, strindex = 0, relocate = 0;
834 struct module mod; // so we can re-use the relocations code 583 struct module mod; /* so we can re-use the relocations code */
835 584
836 memset(&mod, 0, sizeof(struct module)); 585 memset(&mod, 0, sizeof(struct module));
837 strcpy(mod.name, "VPE loader"); 586 strcpy(mod.name, "VPE loader");
@@ -845,8 +594,7 @@ static int vpe_elfload(struct vpe * v)
845 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC) 594 || (hdr->e_type != ET_REL && hdr->e_type != ET_EXEC)
846 || !elf_check_arch(hdr) 595 || !elf_check_arch(hdr)
847 || hdr->e_shentsize != sizeof(*sechdrs)) { 596 || hdr->e_shentsize != sizeof(*sechdrs)) {
848 printk(KERN_WARNING 597 pr_warn("VPE loader: program wrong arch or weird elf version\n");
849 "VPE loader: program wrong arch or weird elf version\n");
850 598
851 return -ENOEXEC; 599 return -ENOEXEC;
852 } 600 }
@@ -855,8 +603,7 @@ static int vpe_elfload(struct vpe * v)
855 relocate = 1; 603 relocate = 1;
856 604
857 if (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr)) { 605 if (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr)) {
858 printk(KERN_ERR "VPE loader: program length %u truncated\n", 606 pr_err("VPE loader: program length %u truncated\n", len);
859 len);
860 607
861 return -ENOEXEC; 608 return -ENOEXEC;
862 } 609 }
@@ -871,22 +618,24 @@ static int vpe_elfload(struct vpe * v)
871 618
872 if (relocate) { 619 if (relocate) {
873 for (i = 1; i < hdr->e_shnum; i++) { 620 for (i = 1; i < hdr->e_shnum; i++) {
874 if (sechdrs[i].sh_type != SHT_NOBITS 621 if ((sechdrs[i].sh_type != SHT_NOBITS) &&
875 && len < sechdrs[i].sh_offset + sechdrs[i].sh_size) { 622 (len < sechdrs[i].sh_offset + sechdrs[i].sh_size)) {
876 printk(KERN_ERR "VPE program length %u truncated\n", 623 pr_err("VPE program length %u truncated\n",
877 len); 624 len);
878 return -ENOEXEC; 625 return -ENOEXEC;
879 } 626 }
880 627
881 /* Mark all sections sh_addr with their address in the 628 /* Mark all sections sh_addr with their address in the
882 temporary image. */ 629 temporary image. */
883 sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; 630 sechdrs[i].sh_addr = (size_t) hdr +
631 sechdrs[i].sh_offset;
884 632
885 /* Internal symbols and strings. */ 633 /* Internal symbols and strings. */
886 if (sechdrs[i].sh_type == SHT_SYMTAB) { 634 if (sechdrs[i].sh_type == SHT_SYMTAB) {
887 symindex = i; 635 symindex = i;
888 strindex = sechdrs[i].sh_link; 636 strindex = sechdrs[i].sh_link;
889 strtab = (char *)hdr + sechdrs[strindex].sh_offset; 637 strtab = (char *)hdr +
638 sechdrs[strindex].sh_offset;
890 } 639 }
891 } 640 }
892 layout_sections(&mod, hdr, sechdrs, secstrings); 641 layout_sections(&mod, hdr, sechdrs, secstrings);
@@ -913,8 +662,9 @@ static int vpe_elfload(struct vpe * v)
913 /* Update sh_addr to point to copy in image. */ 662 /* Update sh_addr to point to copy in image. */
914 sechdrs[i].sh_addr = (unsigned long)dest; 663 sechdrs[i].sh_addr = (unsigned long)dest;
915 664
916 printk(KERN_DEBUG " section sh_name %s sh_addr 0x%x\n", 665 pr_debug(" section sh_name %s sh_addr 0x%x\n",
917 secstrings + sechdrs[i].sh_name, sechdrs[i].sh_addr); 666 secstrings + sechdrs[i].sh_name,
667 sechdrs[i].sh_addr);
918 } 668 }
919 669
920 /* Fix up syms, so that st_value is a pointer to location. */ 670 /* Fix up syms, so that st_value is a pointer to location. */
@@ -935,17 +685,18 @@ static int vpe_elfload(struct vpe * v)
935 continue; 685 continue;
936 686
937 if (sechdrs[i].sh_type == SHT_REL) 687 if (sechdrs[i].sh_type == SHT_REL)
938 err = apply_relocations(sechdrs, strtab, symindex, i, 688 err = apply_relocations(sechdrs, strtab,
939 &mod); 689 symindex, i, &mod);
940 else if (sechdrs[i].sh_type == SHT_RELA) 690 else if (sechdrs[i].sh_type == SHT_RELA)
941 err = apply_relocate_add(sechdrs, strtab, symindex, i, 691 err = apply_relocate_add(sechdrs, strtab,
942 &mod); 692 symindex, i, &mod);
943 if (err < 0) 693 if (err < 0)
944 return err; 694 return err;
945 695
946 } 696 }
947 } else { 697 } else {
948 struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); 698 struct elf_phdr *phdr = (struct elf_phdr *)
699 ((char *)hdr + hdr->e_phoff);
949 700
950 for (i = 0; i < hdr->e_phnum; i++) { 701 for (i = 0; i < hdr->e_phnum; i++) {
951 if (phdr->p_type == PT_LOAD) { 702 if (phdr->p_type == PT_LOAD) {
@@ -963,11 +714,15 @@ static int vpe_elfload(struct vpe * v)
963 if (sechdrs[i].sh_type == SHT_SYMTAB) { 714 if (sechdrs[i].sh_type == SHT_SYMTAB) {
964 symindex = i; 715 symindex = i;
965 strindex = sechdrs[i].sh_link; 716 strindex = sechdrs[i].sh_link;
966 strtab = (char *)hdr + sechdrs[strindex].sh_offset; 717 strtab = (char *)hdr +
718 sechdrs[strindex].sh_offset;
967 719
968 /* mark the symtab's address for when we try to find the 720 /*
969 magic symbols */ 721 * mark symtab's address for when we try
970 sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; 722 * to find the magic symbols
723 */
724 sechdrs[i].sh_addr = (size_t) hdr +
725 sechdrs[i].sh_offset;
971 } 726 }
972 } 727 }
973 } 728 }
@@ -978,53 +733,19 @@ static int vpe_elfload(struct vpe * v)
978 733
979 if ((find_vpe_symbols(v, sechdrs, symindex, strtab, &mod)) < 0) { 734 if ((find_vpe_symbols(v, sechdrs, symindex, strtab, &mod)) < 0) {
980 if (v->__start == 0) { 735 if (v->__start == 0) {
981 printk(KERN_WARNING "VPE loader: program does not contain " 736 pr_warn("VPE loader: program does not contain a __start symbol\n");
982 "a __start symbol\n");
983 return -ENOEXEC; 737 return -ENOEXEC;
984 } 738 }
985 739
986 if (v->shared_ptr == NULL) 740 if (v->shared_ptr == NULL)
987 printk(KERN_WARNING "VPE loader: " 741 pr_warn("VPE loader: program does not contain vpe_shared symbol.\n"
988 "program does not contain vpe_shared symbol.\n" 742 " Unable to use AMVP (AP/SP) facilities.\n");
989 " Unable to use AMVP (AP/SP) facilities.\n");
990 } 743 }
991 744
992 printk(" elf loaded\n"); 745 pr_info(" elf loaded\n");
993 return 0; 746 return 0;
994} 747}
995 748
996static void cleanup_tc(struct tc *tc)
997{
998 unsigned long flags;
999 unsigned int mtflags, vpflags;
1000 int tmp;
1001
1002 local_irq_save(flags);
1003 mtflags = dmt();
1004 vpflags = dvpe();
1005 /* Put MVPE's into 'configuration state' */
1006 set_c0_mvpcontrol(MVPCONTROL_VPC);
1007
1008 settc(tc->index);
1009 tmp = read_tc_c0_tcstatus();
1010
1011 /* mark not allocated and not dynamically allocatable */
1012 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
1013 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
1014 write_tc_c0_tcstatus(tmp);
1015
1016 write_tc_c0_tchalt(TCHALT_H);
1017 mips_ihb();
1018
1019 /* bind it to anything other than VPE1 */
1020// write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE
1021
1022 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1023 evpe(vpflags);
1024 emt(mtflags);
1025 local_irq_restore(flags);
1026}
1027
1028static int getcwd(char *buff, int size) 749static int getcwd(char *buff, int size)
1029{ 750{
1030 mm_segment_t old_fs; 751 mm_segment_t old_fs;
@@ -1044,52 +765,49 @@ static int getcwd(char *buff, int size)
1044static int vpe_open(struct inode *inode, struct file *filp) 765static int vpe_open(struct inode *inode, struct file *filp)
1045{ 766{
1046 enum vpe_state state; 767 enum vpe_state state;
1047 struct vpe_notifications *not; 768 struct vpe_notifications *notifier;
1048 struct vpe *v; 769 struct vpe *v;
1049 int ret; 770 int ret;
1050 771
1051 if (minor != iminor(inode)) { 772 if (VPE_MODULE_MINOR != iminor(inode)) {
1052 /* assume only 1 device at the moment. */ 773 /* assume only 1 device at the moment. */
1053 pr_warning("VPE loader: only vpe1 is supported\n"); 774 pr_warn("VPE loader: only vpe1 is supported\n");
1054 775
1055 return -ENODEV; 776 return -ENODEV;
1056 } 777 }
1057 778
1058 if ((v = get_vpe(tclimit)) == NULL) { 779 v = get_vpe(aprp_cpu_index());
1059 pr_warning("VPE loader: unable to get vpe\n"); 780 if (v == NULL) {
781 pr_warn("VPE loader: unable to get vpe\n");
1060 782
1061 return -ENODEV; 783 return -ENODEV;
1062 } 784 }
1063 785
1064 state = xchg(&v->state, VPE_STATE_INUSE); 786 state = xchg(&v->state, VPE_STATE_INUSE);
1065 if (state != VPE_STATE_UNUSED) { 787 if (state != VPE_STATE_UNUSED) {
1066 printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n"); 788 pr_debug("VPE loader: tc in use dumping regs\n");
1067 789
1068 list_for_each_entry(not, &v->notify, list) { 790 list_for_each_entry(notifier, &v->notify, list)
1069 not->stop(tclimit); 791 notifier->stop(aprp_cpu_index());
1070 }
1071 792
1072 release_progmem(v->load_addr); 793 release_progmem(v->load_addr);
1073 cleanup_tc(get_tc(tclimit)); 794 cleanup_tc(get_tc(aprp_cpu_index()));
1074 } 795 }
1075 796
1076 /* this of-course trashes what was there before... */ 797 /* this of-course trashes what was there before... */
1077 v->pbuffer = vmalloc(P_SIZE); 798 v->pbuffer = vmalloc(P_SIZE);
1078 if (!v->pbuffer) { 799 if (!v->pbuffer) {
1079 pr_warning("VPE loader: unable to allocate memory\n"); 800 pr_warn("VPE loader: unable to allocate memory\n");
1080 return -ENOMEM; 801 return -ENOMEM;
1081 } 802 }
1082 v->plen = P_SIZE; 803 v->plen = P_SIZE;
1083 v->load_addr = NULL; 804 v->load_addr = NULL;
1084 v->len = 0; 805 v->len = 0;
1085 806
1086 v->uid = filp->f_cred->fsuid;
1087 v->gid = filp->f_cred->fsgid;
1088
1089 v->cwd[0] = 0; 807 v->cwd[0] = 0;
1090 ret = getcwd(v->cwd, VPE_PATH_MAX); 808 ret = getcwd(v->cwd, VPE_PATH_MAX);
1091 if (ret < 0) 809 if (ret < 0)
1092 printk(KERN_WARNING "VPE loader: open, getcwd returned %d\n", ret); 810 pr_warn("VPE loader: open, getcwd returned %d\n", ret);
1093 811
1094 v->shared_ptr = NULL; 812 v->shared_ptr = NULL;
1095 v->__start = 0; 813 v->__start = 0;
@@ -1103,20 +821,20 @@ static int vpe_release(struct inode *inode, struct file *filp)
1103 Elf_Ehdr *hdr; 821 Elf_Ehdr *hdr;
1104 int ret = 0; 822 int ret = 0;
1105 823
1106 v = get_vpe(tclimit); 824 v = get_vpe(aprp_cpu_index());
1107 if (v == NULL) 825 if (v == NULL)
1108 return -ENODEV; 826 return -ENODEV;
1109 827
1110 hdr = (Elf_Ehdr *) v->pbuffer; 828 hdr = (Elf_Ehdr *) v->pbuffer;
1111 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) { 829 if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) {
1112 if (vpe_elfload(v) >= 0) { 830 if ((vpe_elfload(v) >= 0) && vpe_run) {
1113 vpe_run(v); 831 vpe_run(v);
1114 } else { 832 } else {
1115 printk(KERN_WARNING "VPE loader: ELF load failed.\n"); 833 pr_warn("VPE loader: ELF load failed.\n");
1116 ret = -ENOEXEC; 834 ret = -ENOEXEC;
1117 } 835 }
1118 } else { 836 } else {
1119 printk(KERN_WARNING "VPE loader: only elf files are supported\n"); 837 pr_warn("VPE loader: only elf files are supported\n");
1120 ret = -ENOEXEC; 838 ret = -ENOEXEC;
1121 } 839 }
1122 840
@@ -1134,22 +852,22 @@ static int vpe_release(struct inode *inode, struct file *filp)
1134 return ret; 852 return ret;
1135} 853}
1136 854
1137static ssize_t vpe_write(struct file *file, const char __user * buffer, 855static ssize_t vpe_write(struct file *file, const char __user *buffer,
1138 size_t count, loff_t * ppos) 856 size_t count, loff_t *ppos)
1139{ 857{
1140 size_t ret = count; 858 size_t ret = count;
1141 struct vpe *v; 859 struct vpe *v;
1142 860
1143 if (iminor(file_inode(file)) != minor) 861 if (iminor(file_inode(file)) != VPE_MODULE_MINOR)
1144 return -ENODEV; 862 return -ENODEV;
1145 863
1146 v = get_vpe(tclimit); 864 v = get_vpe(aprp_cpu_index());
865
1147 if (v == NULL) 866 if (v == NULL)
1148 return -ENODEV; 867 return -ENODEV;
1149 868
1150 if ((count + v->len) > v->plen) { 869 if ((count + v->len) > v->plen) {
1151 printk(KERN_WARNING 870 pr_warn("VPE loader: elf size too big. Perhaps strip uneeded symbols\n");
1152 "VPE loader: elf size too big. Perhaps strip uneeded symbols\n");
1153 return -ENOMEM; 871 return -ENOMEM;
1154 } 872 }
1155 873
@@ -1161,7 +879,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer,
1161 return ret; 879 return ret;
1162} 880}
1163 881
1164static const struct file_operations vpe_fops = { 882const struct file_operations vpe_fops = {
1165 .owner = THIS_MODULE, 883 .owner = THIS_MODULE,
1166 .open = vpe_open, 884 .open = vpe_open,
1167 .release = vpe_release, 885 .release = vpe_release,
@@ -1169,420 +887,40 @@ static const struct file_operations vpe_fops = {
1169 .llseek = noop_llseek, 887 .llseek = noop_llseek,
1170}; 888};
1171 889
1172/* module wrapper entry points */
1173/* give me a vpe */
1174vpe_handle vpe_alloc(void)
1175{
1176 int i;
1177 struct vpe *v;
1178
1179 /* find a vpe */
1180 for (i = 1; i < MAX_VPES; i++) {
1181 if ((v = get_vpe(i)) != NULL) {
1182 v->state = VPE_STATE_INUSE;
1183 return v;
1184 }
1185 }
1186 return NULL;
1187}
1188
1189EXPORT_SYMBOL(vpe_alloc);
1190
1191/* start running from here */
1192int vpe_start(vpe_handle vpe, unsigned long start)
1193{
1194 struct vpe *v = vpe;
1195
1196 v->__start = start;
1197 return vpe_run(v);
1198}
1199
1200EXPORT_SYMBOL(vpe_start);
1201
1202/* halt it for now */
1203int vpe_stop(vpe_handle vpe)
1204{
1205 struct vpe *v = vpe;
1206 struct tc *t;
1207 unsigned int evpe_flags;
1208
1209 evpe_flags = dvpe();
1210
1211 if ((t = list_entry(v->tc.next, struct tc, tc)) != NULL) {
1212
1213 settc(t->index);
1214 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA);
1215 }
1216
1217 evpe(evpe_flags);
1218
1219 return 0;
1220}
1221
1222EXPORT_SYMBOL(vpe_stop);
1223
1224/* I've done with it thank you */
1225int vpe_free(vpe_handle vpe)
1226{
1227 struct vpe *v = vpe;
1228 struct tc *t;
1229 unsigned int evpe_flags;
1230
1231 if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) {
1232 return -ENOEXEC;
1233 }
1234
1235 evpe_flags = dvpe();
1236
1237 /* Put MVPE's into 'configuration state' */
1238 set_c0_mvpcontrol(MVPCONTROL_VPC);
1239
1240 settc(t->index);
1241 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA);
1242
1243 /* halt the TC */
1244 write_tc_c0_tchalt(TCHALT_H);
1245 mips_ihb();
1246
1247 /* mark the TC unallocated */
1248 write_tc_c0_tcstatus(read_tc_c0_tcstatus() & ~TCSTATUS_A);
1249
1250 v->state = VPE_STATE_UNUSED;
1251
1252 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1253 evpe(evpe_flags);
1254
1255 return 0;
1256}
1257
1258EXPORT_SYMBOL(vpe_free);
1259
1260void *vpe_get_shared(int index) 890void *vpe_get_shared(int index)
1261{ 891{
1262 struct vpe *v; 892 struct vpe *v = get_vpe(index);
1263 893
1264 if ((v = get_vpe(index)) == NULL) 894 if (v == NULL)
1265 return NULL; 895 return NULL;
1266 896
1267 return v->shared_ptr; 897 return v->shared_ptr;
1268} 898}
1269
1270EXPORT_SYMBOL(vpe_get_shared); 899EXPORT_SYMBOL(vpe_get_shared);
1271 900
1272int vpe_getuid(int index)
1273{
1274 struct vpe *v;
1275
1276 if ((v = get_vpe(index)) == NULL)
1277 return -1;
1278
1279 return v->uid;
1280}
1281
1282EXPORT_SYMBOL(vpe_getuid);
1283
1284int vpe_getgid(int index)
1285{
1286 struct vpe *v;
1287
1288 if ((v = get_vpe(index)) == NULL)
1289 return -1;
1290
1291 return v->gid;
1292}
1293
1294EXPORT_SYMBOL(vpe_getgid);
1295
1296int vpe_notify(int index, struct vpe_notifications *notify) 901int vpe_notify(int index, struct vpe_notifications *notify)
1297{ 902{
1298 struct vpe *v; 903 struct vpe *v = get_vpe(index);
1299 904
1300 if ((v = get_vpe(index)) == NULL) 905 if (v == NULL)
1301 return -1; 906 return -1;
1302 907
1303 list_add(&notify->list, &v->notify); 908 list_add(&notify->list, &v->notify);
1304 return 0; 909 return 0;
1305} 910}
1306
1307EXPORT_SYMBOL(vpe_notify); 911EXPORT_SYMBOL(vpe_notify);
1308 912
1309char *vpe_getcwd(int index) 913char *vpe_getcwd(int index)
1310{ 914{
1311 struct vpe *v; 915 struct vpe *v = get_vpe(index);
1312 916
1313 if ((v = get_vpe(index)) == NULL) 917 if (v == NULL)
1314 return NULL; 918 return NULL;
1315 919
1316 return v->cwd; 920 return v->cwd;
1317} 921}
1318
1319EXPORT_SYMBOL(vpe_getcwd); 922EXPORT_SYMBOL(vpe_getcwd);
1320 923
1321static ssize_t store_kill(struct device *dev, struct device_attribute *attr,
1322 const char *buf, size_t len)
1323{
1324 struct vpe *vpe = get_vpe(tclimit);
1325 struct vpe_notifications *not;
1326
1327 list_for_each_entry(not, &vpe->notify, list) {
1328 not->stop(tclimit);
1329 }
1330
1331 release_progmem(vpe->load_addr);
1332 cleanup_tc(get_tc(tclimit));
1333 vpe_stop(vpe);
1334 vpe_free(vpe);
1335
1336 return len;
1337}
1338static DEVICE_ATTR(kill, S_IWUSR, NULL, store_kill);
1339
1340static ssize_t ntcs_show(struct device *cd, struct device_attribute *attr,
1341 char *buf)
1342{
1343 struct vpe *vpe = get_vpe(tclimit);
1344
1345 return sprintf(buf, "%d\n", vpe->ntcs);
1346}
1347
1348static ssize_t ntcs_store(struct device *dev, struct device_attribute *attr,
1349 const char *buf, size_t len)
1350{
1351 struct vpe *vpe = get_vpe(tclimit);
1352 unsigned long new;
1353 char *endp;
1354
1355 new = simple_strtoul(buf, &endp, 0);
1356 if (endp == buf)
1357 goto out_einval;
1358
1359 if (new == 0 || new > (hw_tcs - tclimit))
1360 goto out_einval;
1361
1362 vpe->ntcs = new;
1363
1364 return len;
1365
1366out_einval:
1367 return -EINVAL;
1368}
1369static DEVICE_ATTR_RW(ntcs);
1370
1371static struct attribute *vpe_attrs[] = {
1372 &dev_attr_kill.attr,
1373 &dev_attr_ntcs.attr,
1374 NULL,
1375};
1376ATTRIBUTE_GROUPS(vpe);
1377
1378static void vpe_device_release(struct device *cd)
1379{
1380 kfree(cd);
1381}
1382
1383struct class vpe_class = {
1384 .name = "vpe",
1385 .owner = THIS_MODULE,
1386 .dev_release = vpe_device_release,
1387 .dev_groups = vpe_groups,
1388};
1389
1390struct device vpe_device;
1391
1392static int __init vpe_module_init(void)
1393{
1394 unsigned int mtflags, vpflags;
1395 unsigned long flags, val;
1396 struct vpe *v = NULL;
1397 struct tc *t;
1398 int tc, err;
1399
1400 if (!cpu_has_mipsmt) {
1401 printk("VPE loader: not a MIPS MT capable processor\n");
1402 return -ENODEV;
1403 }
1404
1405 if (vpelimit == 0) {
1406 printk(KERN_WARNING "No VPEs reserved for AP/SP, not "
1407 "initializing VPE loader.\nPass maxvpes=<n> argument as "
1408 "kernel argument\n");
1409
1410 return -ENODEV;
1411 }
1412
1413 if (tclimit == 0) {
1414 printk(KERN_WARNING "No TCs reserved for AP/SP, not "
1415 "initializing VPE loader.\nPass maxtcs=<n> argument as "
1416 "kernel argument\n");
1417
1418 return -ENODEV;
1419 }
1420
1421 major = register_chrdev(0, module_name, &vpe_fops);
1422 if (major < 0) {
1423 printk("VPE loader: unable to register character device\n");
1424 return major;
1425 }
1426
1427 err = class_register(&vpe_class);
1428 if (err) {
1429 printk(KERN_ERR "vpe_class registration failed\n");
1430 goto out_chrdev;
1431 }
1432
1433 device_initialize(&vpe_device);
1434 vpe_device.class = &vpe_class,
1435 vpe_device.parent = NULL,
1436 dev_set_name(&vpe_device, "vpe1");
1437 vpe_device.devt = MKDEV(major, minor);
1438 err = device_add(&vpe_device);
1439 if (err) {
1440 printk(KERN_ERR "Adding vpe_device failed\n");
1441 goto out_class;
1442 }
1443
1444 local_irq_save(flags);
1445 mtflags = dmt();
1446 vpflags = dvpe();
1447
1448 /* Put MVPE's into 'configuration state' */
1449 set_c0_mvpcontrol(MVPCONTROL_VPC);
1450
1451 /* dump_mtregs(); */
1452
1453 val = read_c0_mvpconf0();
1454 hw_tcs = (val & MVPCONF0_PTC) + 1;
1455 hw_vpes = ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
1456
1457 for (tc = tclimit; tc < hw_tcs; tc++) {
1458 /*
1459 * Must re-enable multithreading temporarily or in case we
1460 * reschedule send IPIs or similar we might hang.
1461 */
1462 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1463 evpe(vpflags);
1464 emt(mtflags);
1465 local_irq_restore(flags);
1466 t = alloc_tc(tc);
1467 if (!t) {
1468 err = -ENOMEM;
1469 goto out;
1470 }
1471
1472 local_irq_save(flags);
1473 mtflags = dmt();
1474 vpflags = dvpe();
1475 set_c0_mvpcontrol(MVPCONTROL_VPC);
1476
1477 /* VPE's */
1478 if (tc < hw_tcs) {
1479 settc(tc);
1480
1481 if ((v = alloc_vpe(tc)) == NULL) {
1482 printk(KERN_WARNING "VPE: unable to allocate VPE\n");
1483
1484 goto out_reenable;
1485 }
1486
1487 v->ntcs = hw_tcs - tclimit;
1488
1489 /* add the tc to the list of this vpe's tc's. */
1490 list_add(&t->tc, &v->tc);
1491
1492 /* deactivate all but vpe0 */
1493 if (tc >= tclimit) {
1494 unsigned long tmp = read_vpe_c0_vpeconf0();
1495
1496 tmp &= ~VPECONF0_VPA;
1497
1498 /* master VPE */
1499 tmp |= VPECONF0_MVP;
1500 write_vpe_c0_vpeconf0(tmp);
1501 }
1502
1503 /* disable multi-threading with TC's */
1504 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() & ~VPECONTROL_TE);
1505
1506 if (tc >= vpelimit) {
1507 /*
1508 * Set config to be the same as vpe0,
1509 * particularly kseg0 coherency alg
1510 */
1511 write_vpe_c0_config(read_c0_config());
1512 }
1513 }
1514
1515 /* TC's */
1516 t->pvpe = v; /* set the parent vpe */
1517
1518 if (tc >= tclimit) {
1519 unsigned long tmp;
1520
1521 settc(tc);
1522
1523 /* Any TC that is bound to VPE0 gets left as is - in case
1524 we are running SMTC on VPE0. A TC that is bound to any
1525 other VPE gets bound to VPE0, ideally I'd like to make
1526 it homeless but it doesn't appear to let me bind a TC
1527 to a non-existent VPE. Which is perfectly reasonable.
1528
1529 The (un)bound state is visible to an EJTAG probe so may
1530 notify GDB...
1531 */
1532
1533 if (((tmp = read_tc_c0_tcbind()) & TCBIND_CURVPE)) {
1534 /* tc is bound >vpe0 */
1535 write_tc_c0_tcbind(tmp & ~TCBIND_CURVPE);
1536
1537 t->pvpe = get_vpe(0); /* set the parent vpe */
1538 }
1539
1540 /* halt the TC */
1541 write_tc_c0_tchalt(TCHALT_H);
1542 mips_ihb();
1543
1544 tmp = read_tc_c0_tcstatus();
1545
1546 /* mark not activated and not dynamically allocatable */
1547 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
1548 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
1549 write_tc_c0_tcstatus(tmp);
1550 }
1551 }
1552
1553out_reenable:
1554 /* release config state */
1555 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1556
1557 evpe(vpflags);
1558 emt(mtflags);
1559 local_irq_restore(flags);
1560
1561 return 0;
1562
1563out_class:
1564 class_unregister(&vpe_class);
1565out_chrdev:
1566 unregister_chrdev(major, module_name);
1567
1568out:
1569 return err;
1570}
1571
1572static void __exit vpe_module_exit(void)
1573{
1574 struct vpe *v, *n;
1575
1576 device_del(&vpe_device);
1577 unregister_chrdev(major, module_name);
1578
1579 /* No locking needed here */
1580 list_for_each_entry_safe(v, n, &vpecontrol.vpe_list, list) {
1581 if (v->state != VPE_STATE_UNUSED)
1582 release_vpe(v);
1583 }
1584}
1585
1586module_init(vpe_module_init); 924module_init(vpe_module_init);
1587module_exit(vpe_module_exit); 925module_exit(vpe_module_exit);
1588MODULE_DESCRIPTION("MIPS VPE Loader"); 926MODULE_DESCRIPTION("MIPS VPE Loader");
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 73b34827826c..da5186fbd77a 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -1001,7 +1001,6 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1001 hrtimer_init(&vcpu->arch.comparecount_timer, CLOCK_MONOTONIC, 1001 hrtimer_init(&vcpu->arch.comparecount_timer, CLOCK_MONOTONIC,
1002 HRTIMER_MODE_REL); 1002 HRTIMER_MODE_REL);
1003 vcpu->arch.comparecount_timer.function = kvm_mips_comparecount_wakeup; 1003 vcpu->arch.comparecount_timer.function = kvm_mips_comparecount_wakeup;
1004 kvm_mips_init_shadow_tlb(vcpu);
1005 return 0; 1004 return 0;
1006} 1005}
1007 1006
diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm/kvm_tlb.c
index c777dd36d4a8..50ab9c4d4a5d 100644
--- a/arch/mips/kvm/kvm_tlb.c
+++ b/arch/mips/kvm/kvm_tlb.c
@@ -10,7 +10,6 @@
10* Authors: Sanjay Lal <sanjayl@kymasys.com> 10* Authors: Sanjay Lal <sanjayl@kymasys.com>
11*/ 11*/
12 12
13#include <linux/init.h>
14#include <linux/sched.h> 13#include <linux/sched.h>
15#include <linux/smp.h> 14#include <linux/smp.h>
16#include <linux/mm.h> 15#include <linux/mm.h>
@@ -25,6 +24,7 @@
25#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
26#include <asm/pgtable.h> 25#include <asm/pgtable.h>
27#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/tlb.h>
28 28
29#undef CONFIG_MIPS_MT 29#undef CONFIG_MIPS_MT
30#include <asm/r4kcache.h> 30#include <asm/r4kcache.h>
@@ -35,9 +35,6 @@
35 35
36#define PRIx64 "llx" 36#define PRIx64 "llx"
37 37
38/* Use VZ EntryHi.EHINV to invalidate TLB entries */
39#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
40
41atomic_t kvm_mips_instance; 38atomic_t kvm_mips_instance;
42EXPORT_SYMBOL(kvm_mips_instance); 39EXPORT_SYMBOL(kvm_mips_instance);
43 40
@@ -147,30 +144,6 @@ void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu)
147 } 144 }
148} 145}
149 146
150void kvm_mips_dump_shadow_tlbs(struct kvm_vcpu *vcpu)
151{
152 int i;
153 volatile struct kvm_mips_tlb tlb;
154
155 printk("Shadow TLBs:\n");
156 for (i = 0; i < KVM_MIPS_GUEST_TLB_SIZE; i++) {
157 tlb = vcpu->arch.shadow_tlb[smp_processor_id()][i];
158 printk("TLB%c%3d Hi 0x%08lx ",
159 (tlb.tlb_lo0 | tlb.tlb_lo1) & MIPS3_PG_V ? ' ' : '*',
160 i, tlb.tlb_hi);
161 printk("Lo0=0x%09" PRIx64 " %c%c attr %lx ",
162 (uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo0),
163 (tlb.tlb_lo0 & MIPS3_PG_D) ? 'D' : ' ',
164 (tlb.tlb_lo0 & MIPS3_PG_G) ? 'G' : ' ',
165 (tlb.tlb_lo0 >> 3) & 7);
166 printk("Lo1=0x%09" PRIx64 " %c%c attr %lx sz=%lx\n",
167 (uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo1),
168 (tlb.tlb_lo1 & MIPS3_PG_D) ? 'D' : ' ',
169 (tlb.tlb_lo1 & MIPS3_PG_G) ? 'G' : ' ',
170 (tlb.tlb_lo1 >> 3) & 7, tlb.tlb_mask);
171 }
172}
173
174static int kvm_mips_map_page(struct kvm *kvm, gfn_t gfn) 147static int kvm_mips_map_page(struct kvm *kvm, gfn_t gfn)
175{ 148{
176 int srcu_idx, err = 0; 149 int srcu_idx, err = 0;
@@ -657,70 +630,6 @@ kvm_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu,
657 cpu_context(cpu, mm) = asid_cache(cpu) = asid; 630 cpu_context(cpu, mm) = asid_cache(cpu) = asid;
658} 631}
659 632
660void kvm_shadow_tlb_put(struct kvm_vcpu *vcpu)
661{
662 unsigned long flags;
663 unsigned long old_entryhi;
664 unsigned long old_pagemask;
665 int entry = 0;
666 int cpu = smp_processor_id();
667
668 local_irq_save(flags);
669
670 old_entryhi = read_c0_entryhi();
671 old_pagemask = read_c0_pagemask();
672
673 for (entry = 0; entry < current_cpu_data.tlbsize; entry++) {
674 write_c0_index(entry);
675 mtc0_tlbw_hazard();
676 tlb_read();
677 tlbw_use_hazard();
678
679 vcpu->arch.shadow_tlb[cpu][entry].tlb_hi = read_c0_entryhi();
680 vcpu->arch.shadow_tlb[cpu][entry].tlb_lo0 = read_c0_entrylo0();
681 vcpu->arch.shadow_tlb[cpu][entry].tlb_lo1 = read_c0_entrylo1();
682 vcpu->arch.shadow_tlb[cpu][entry].tlb_mask = read_c0_pagemask();
683 }
684
685 write_c0_entryhi(old_entryhi);
686 write_c0_pagemask(old_pagemask);
687 mtc0_tlbw_hazard();
688
689 local_irq_restore(flags);
690
691}
692
693void kvm_shadow_tlb_load(struct kvm_vcpu *vcpu)
694{
695 unsigned long flags;
696 unsigned long old_ctx;
697 int entry;
698 int cpu = smp_processor_id();
699
700 local_irq_save(flags);
701
702 old_ctx = read_c0_entryhi();
703
704 for (entry = 0; entry < current_cpu_data.tlbsize; entry++) {
705 write_c0_entryhi(vcpu->arch.shadow_tlb[cpu][entry].tlb_hi);
706 mtc0_tlbw_hazard();
707 write_c0_entrylo0(vcpu->arch.shadow_tlb[cpu][entry].tlb_lo0);
708 write_c0_entrylo1(vcpu->arch.shadow_tlb[cpu][entry].tlb_lo1);
709
710 write_c0_index(entry);
711 mtc0_tlbw_hazard();
712
713 tlb_write_indexed();
714 tlbw_use_hazard();
715 }
716
717 tlbw_use_hazard();
718 write_c0_entryhi(old_ctx);
719 mtc0_tlbw_hazard();
720 local_irq_restore(flags);
721}
722
723
724void kvm_local_flush_tlb_all(void) 633void kvm_local_flush_tlb_all(void)
725{ 634{
726 unsigned long flags; 635 unsigned long flags;
@@ -749,30 +658,6 @@ void kvm_local_flush_tlb_all(void)
749 local_irq_restore(flags); 658 local_irq_restore(flags);
750} 659}
751 660
752void kvm_mips_init_shadow_tlb(struct kvm_vcpu *vcpu)
753{
754 int cpu, entry;
755
756 for_each_possible_cpu(cpu) {
757 for (entry = 0; entry < current_cpu_data.tlbsize; entry++) {
758 vcpu->arch.shadow_tlb[cpu][entry].tlb_hi =
759 UNIQUE_ENTRYHI(entry);
760 vcpu->arch.shadow_tlb[cpu][entry].tlb_lo0 = 0x0;
761 vcpu->arch.shadow_tlb[cpu][entry].tlb_lo1 = 0x0;
762 vcpu->arch.shadow_tlb[cpu][entry].tlb_mask =
763 read_c0_pagemask();
764#ifdef DEBUG
765 kvm_debug
766 ("shadow_tlb[%d][%d]: tlb_hi: %#lx, lo0: %#lx, lo1: %#lx\n",
767 cpu, entry,
768 vcpu->arch.shadow_tlb[cpu][entry].tlb_hi,
769 vcpu->arch.shadow_tlb[cpu][entry].tlb_lo0,
770 vcpu->arch.shadow_tlb[cpu][entry].tlb_lo1);
771#endif
772 }
773 }
774}
775
776/* Restore ASID once we are scheduled back after preemption */ 661/* Restore ASID once we are scheduled back after preemption */
777void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 662void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
778{ 663{
@@ -810,14 +695,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
810 vcpu->arch.last_sched_cpu, cpu, vcpu->vcpu_id); 695 vcpu->arch.last_sched_cpu, cpu, vcpu->vcpu_id);
811 } 696 }
812 697
813 /* Only reload shadow host TLB if new ASIDs haven't been allocated */
814#if 0
815 if ((atomic_read(&kvm_mips_instance) > 1) && !newasid) {
816 kvm_mips_flush_host_tlb(0);
817 kvm_shadow_tlb_load(vcpu);
818 }
819#endif
820
821 if (!newasid) { 698 if (!newasid) {
822 /* If we preempted while the guest was executing, then reload the pre-empted ASID */ 699 /* If we preempted while the guest was executing, then reload the pre-empted ASID */
823 if (current->flags & PF_VCPU) { 700 if (current->flags & PF_VCPU) {
@@ -863,12 +740,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
863 vcpu->arch.preempt_entryhi = read_c0_entryhi(); 740 vcpu->arch.preempt_entryhi = read_c0_entryhi();
864 vcpu->arch.last_sched_cpu = cpu; 741 vcpu->arch.last_sched_cpu = cpu;
865 742
866#if 0
867 if ((atomic_read(&kvm_mips_instance) > 1)) {
868 kvm_shadow_tlb_put(vcpu);
869 }
870#endif
871
872 if (((cpu_context(cpu, current->mm) ^ asid_cache(cpu)) & 743 if (((cpu_context(cpu, current->mm) ^ asid_cache(cpu)) &
873 ASID_VERSION_MASK)) { 744 ASID_VERSION_MASK)) {
874 kvm_debug("%s: Dropping MMU Context: %#lx\n", __func__, 745 kvm_debug("%s: Dropping MMU Context: %#lx\n", __func__,
@@ -930,10 +801,8 @@ uint32_t kvm_get_inst(uint32_t *opc, struct kvm_vcpu *vcpu)
930} 801}
931 802
932EXPORT_SYMBOL(kvm_local_flush_tlb_all); 803EXPORT_SYMBOL(kvm_local_flush_tlb_all);
933EXPORT_SYMBOL(kvm_shadow_tlb_put);
934EXPORT_SYMBOL(kvm_mips_handle_mapped_seg_tlb_fault); 804EXPORT_SYMBOL(kvm_mips_handle_mapped_seg_tlb_fault);
935EXPORT_SYMBOL(kvm_mips_handle_commpage_tlb_fault); 805EXPORT_SYMBOL(kvm_mips_handle_commpage_tlb_fault);
936EXPORT_SYMBOL(kvm_mips_init_shadow_tlb);
937EXPORT_SYMBOL(kvm_mips_dump_host_tlbs); 806EXPORT_SYMBOL(kvm_mips_dump_host_tlbs);
938EXPORT_SYMBOL(kvm_mips_handle_kseg0_tlb_fault); 807EXPORT_SYMBOL(kvm_mips_handle_kseg0_tlb_fault);
939EXPORT_SYMBOL(kvm_mips_host_tlb_lookup); 808EXPORT_SYMBOL(kvm_mips_host_tlb_lookup);
@@ -941,8 +810,6 @@ EXPORT_SYMBOL(kvm_mips_flush_host_tlb);
941EXPORT_SYMBOL(kvm_mips_guest_tlb_lookup); 810EXPORT_SYMBOL(kvm_mips_guest_tlb_lookup);
942EXPORT_SYMBOL(kvm_mips_host_tlb_inv); 811EXPORT_SYMBOL(kvm_mips_host_tlb_inv);
943EXPORT_SYMBOL(kvm_mips_translate_guest_kseg0_to_hpa); 812EXPORT_SYMBOL(kvm_mips_translate_guest_kseg0_to_hpa);
944EXPORT_SYMBOL(kvm_shadow_tlb_load);
945EXPORT_SYMBOL(kvm_mips_dump_shadow_tlbs);
946EXPORT_SYMBOL(kvm_mips_dump_guest_tlbs); 813EXPORT_SYMBOL(kvm_mips_dump_guest_tlbs);
947EXPORT_SYMBOL(kvm_get_inst); 814EXPORT_SYMBOL(kvm_get_inst);
948EXPORT_SYMBOL(kvm_arch_vcpu_load); 815EXPORT_SYMBOL(kvm_arch_vcpu_load);
diff --git a/arch/mips/lantiq/xway/clk.c b/arch/mips/lantiq/xway/clk.c
index 1ab576dc9bd1..8750dc0a1bf6 100644
--- a/arch/mips/lantiq/xway/clk.c
+++ b/arch/mips/lantiq/xway/clk.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/export.h> 10#include <linux/export.h>
11#include <linux/init.h>
12#include <linux/clk.h> 11#include <linux/clk.h>
13 12
14#include <asm/time.h> 13#include <asm/time.h>
diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
index 08f7ebd9c774..78a91fa41944 100644
--- a/arch/mips/lantiq/xway/dma.c
+++ b/arch/mips/lantiq/xway/dma.c
@@ -220,10 +220,6 @@ ltq_dma_init(struct platform_device *pdev)
220 int i; 220 int i;
221 221
222 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 222 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
223 if (!res)
224 panic("Failed to get dma resource");
225
226 /* remap dma register range */
227 ltq_dma_membase = devm_ioremap_resource(&pdev->dev, res); 223 ltq_dma_membase = devm_ioremap_resource(&pdev->dev, res);
228 if (IS_ERR(ltq_dma_membase)) 224 if (IS_ERR(ltq_dma_membase))
229 panic("Failed to remap dma resource"); 225 panic("Failed to remap dma resource");
diff --git a/arch/mips/lasat/at93c.c b/arch/mips/lasat/at93c.c
index 793e234719a6..942f32b91d12 100644
--- a/arch/mips/lasat/at93c.c
+++ b/arch/mips/lasat/at93c.c
@@ -8,7 +8,6 @@
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <asm/lasat/lasat.h> 9#include <asm/lasat/lasat.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/init.h>
12 11
13#include "at93c.h" 12#include "at93c.h"
14 13
diff --git a/arch/mips/lasat/picvue.c b/arch/mips/lasat/picvue.c
index 7eb334892693..d613b97cd513 100644
--- a/arch/mips/lasat/picvue.c
+++ b/arch/mips/lasat/picvue.c
@@ -9,7 +9,6 @@
9#include <asm/bootinfo.h> 9#include <asm/bootinfo.h>
10#include <asm/lasat/lasat.h> 10#include <asm/lasat/lasat.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/init.h>
13#include <linux/errno.h> 12#include <linux/errno.h>
14#include <linux/string.h> 13#include <linux/string.h>
15 14
diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c
index d8522f8e842a..09d5deea747f 100644
--- a/arch/mips/lib/uncached.c
+++ b/arch/mips/lib/uncached.c
@@ -8,7 +8,6 @@
8 * Author: Maciej W. Rozycki <macro@mips.com> 8 * Author: Maciej W. Rozycki <macro@mips.com>
9 */ 9 */
10 10
11#include <linux/init.h>
12 11
13#include <asm/addrspace.h> 12#include <asm/addrspace.h>
14#include <asm/bug.h> 13#include <asm/bug.h>
diff --git a/arch/mips/loongson/lemote-2f/clock.c b/arch/mips/loongson/lemote-2f/clock.c
index 4dc2f5fa3f67..aed32b88576c 100644
--- a/arch/mips/loongson/lemote-2f/clock.c
+++ b/arch/mips/loongson/lemote-2f/clock.c
@@ -10,7 +10,6 @@
10#include <linux/cpufreq.h> 10#include <linux/cpufreq.h>
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/export.h> 12#include <linux/export.h>
13#include <linux/init.h>
14#include <linux/list.h> 13#include <linux/list.h>
15#include <linux/mutex.h> 14#include <linux/mutex.h>
16#include <linux/spinlock.h> 15#include <linux/spinlock.h>
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index efe008846ed0..506925b2c3f3 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -417,14 +417,20 @@ static int microMIPS32_to_MIPS32(union mips_instruction *insn_ptr)
417 case mm_mtc1_op: 417 case mm_mtc1_op:
418 case mm_cfc1_op: 418 case mm_cfc1_op:
419 case mm_ctc1_op: 419 case mm_ctc1_op:
420 case mm_mfhc1_op:
421 case mm_mthc1_op:
420 if (insn.mm_fp1_format.op == mm_mfc1_op) 422 if (insn.mm_fp1_format.op == mm_mfc1_op)
421 op = mfc_op; 423 op = mfc_op;
422 else if (insn.mm_fp1_format.op == mm_mtc1_op) 424 else if (insn.mm_fp1_format.op == mm_mtc1_op)
423 op = mtc_op; 425 op = mtc_op;
424 else if (insn.mm_fp1_format.op == mm_cfc1_op) 426 else if (insn.mm_fp1_format.op == mm_cfc1_op)
425 op = cfc_op; 427 op = cfc_op;
426 else 428 else if (insn.mm_fp1_format.op == mm_ctc1_op)
427 op = ctc_op; 429 op = ctc_op;
430 else if (insn.mm_fp1_format.op == mm_mfhc1_op)
431 op = mfhc_op;
432 else
433 op = mthc_op;
428 mips32_insn.fp1_format.opcode = cop1_op; 434 mips32_insn.fp1_format.opcode = cop1_op;
429 mips32_insn.fp1_format.op = op; 435 mips32_insn.fp1_format.op = op;
430 mips32_insn.fp1_format.rt = 436 mips32_insn.fp1_format.rt =
@@ -853,20 +859,20 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
853 * In the Linux kernel, we support selection of FPR format on the 859 * In the Linux kernel, we support selection of FPR format on the
854 * basis of the Status.FR bit. If an FPU is not present, the FR bit 860 * basis of the Status.FR bit. If an FPU is not present, the FR bit
855 * is hardwired to zero, which would imply a 32-bit FPU even for 861 * is hardwired to zero, which would imply a 32-bit FPU even for
856 * 64-bit CPUs so we rather look at TIF_32BIT_REGS. 862 * 64-bit CPUs so we rather look at TIF_32BIT_FPREGS.
857 * FPU emu is slow and bulky and optimizing this function offers fairly 863 * FPU emu is slow and bulky and optimizing this function offers fairly
858 * sizeable benefits so we try to be clever and make this function return 864 * sizeable benefits so we try to be clever and make this function return
859 * a constant whenever possible, that is on 64-bit kernels without O32 865 * a constant whenever possible, that is on 64-bit kernels without O32
860 * compatibility enabled and on 32-bit kernels. 866 * compatibility enabled and on 32-bit without 64-bit FPU support.
861 */ 867 */
862static inline int cop1_64bit(struct pt_regs *xcp) 868static inline int cop1_64bit(struct pt_regs *xcp)
863{ 869{
864#if defined(CONFIG_64BIT) && !defined(CONFIG_MIPS32_O32) 870#if defined(CONFIG_64BIT) && !defined(CONFIG_MIPS32_O32)
865 return 1; 871 return 1;
866#elif defined(CONFIG_64BIT) && defined(CONFIG_MIPS32_O32) 872#elif defined(CONFIG_32BIT) && !defined(CONFIG_MIPS_O32_FP64_SUPPORT)
867 return !test_thread_flag(TIF_32BIT_REGS);
868#else
869 return 0; 873 return 0;
874#else
875 return !test_thread_flag(TIF_32BIT_FPREGS);
870#endif 876#endif
871} 877}
872 878
@@ -878,6 +884,10 @@ static inline int cop1_64bit(struct pt_regs *xcp)
878 ctx->fpr[x & ~1] >> 32 << 32 | (u32)(si) : \ 884 ctx->fpr[x & ~1] >> 32 << 32 | (u32)(si) : \
879 ctx->fpr[x & ~1] << 32 >> 32 | (u64)(si) << 32) 885 ctx->fpr[x & ~1] << 32 >> 32 | (u64)(si) << 32)
880 886
887#define SIFROMHREG(si, x) ((si) = (int)(ctx->fpr[x] >> 32))
888#define SITOHREG(si, x) (ctx->fpr[x] = \
889 ctx->fpr[x] << 32 >> 32 | (u64)(si) << 32)
890
881#define DIFROMREG(di, x) ((di) = ctx->fpr[x & ~(cop1_64bit(xcp) == 0)]) 891#define DIFROMREG(di, x) ((di) = ctx->fpr[x & ~(cop1_64bit(xcp) == 0)])
882#define DITOREG(di, x) (ctx->fpr[x & ~(cop1_64bit(xcp) == 0)] = (di)) 892#define DITOREG(di, x) (ctx->fpr[x & ~(cop1_64bit(xcp) == 0)] = (di))
883 893
@@ -1055,6 +1065,25 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
1055 break; 1065 break;
1056#endif 1066#endif
1057 1067
1068 case mfhc_op:
1069 if (!cpu_has_mips_r2)
1070 goto sigill;
1071
1072 /* copregister rd -> gpr[rt] */
1073 if (MIPSInst_RT(ir) != 0) {
1074 SIFROMHREG(xcp->regs[MIPSInst_RT(ir)],
1075 MIPSInst_RD(ir));
1076 }
1077 break;
1078
1079 case mthc_op:
1080 if (!cpu_has_mips_r2)
1081 goto sigill;
1082
1083 /* copregister rd <- gpr[rt] */
1084 SITOHREG(xcp->regs[MIPSInst_RT(ir)], MIPSInst_RD(ir));
1085 break;
1086
1058 case mfc_op: 1087 case mfc_op:
1059 /* copregister rd -> gpr[rt] */ 1088 /* copregister rd -> gpr[rt] */
1060 if (MIPSInst_RT(ir) != 0) { 1089 if (MIPSInst_RT(ir) != 0) {
@@ -1263,6 +1292,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
1263#endif 1292#endif
1264 1293
1265 default: 1294 default:
1295sigill:
1266 return SIGILL; 1296 return SIGILL;
1267 } 1297 }
1268 1298
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c
index 1c586575fe17..3aeae07ed5b8 100644
--- a/arch/mips/math-emu/kernel_linkage.c
+++ b/arch/mips/math-emu/kernel_linkage.c
@@ -89,8 +89,9 @@ int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
89{ 89{
90 int i; 90 int i;
91 int err = 0; 91 int err = 0;
92 int inc = test_thread_flag(TIF_32BIT_FPREGS) ? 2 : 1;
92 93
93 for (i = 0; i < 32; i+=2) { 94 for (i = 0; i < 32; i += inc) {
94 err |= 95 err |=
95 __put_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]); 96 __put_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]);
96 } 97 }
@@ -103,8 +104,9 @@ int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
103{ 104{
104 int i; 105 int i;
105 int err = 0; 106 int err = 0;
107 int inc = test_thread_flag(TIF_32BIT_FPREGS) ? 2 : 1;
106 108
107 for (i = 0; i < 32; i+=2) { 109 for (i = 0; i < 32; i += inc) {
108 err |= 110 err |=
109 __get_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]); 111 __get_user(current->thread.fpu.fpr[i], &sc->sc_fpregs[i]);
110 } 112 }
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index c8efdb5b6ee0..f41a5c5b0865 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -6,7 +6,6 @@
6 * Copyright (C) 2005-2007 Cavium Networks 6 * Copyright (C) 2005-2007 Cavium Networks
7 */ 7 */
8#include <linux/export.h> 8#include <linux/export.h>
9#include <linux/init.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/sched.h> 10#include <linux/sched.h>
12#include <linux/smp.h> 11#include <linux/smp.h>
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index 2fcde0c8ea02..135ec313c1f6 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -9,7 +9,6 @@
9 * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov 9 * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
10 * Copyright (C) 2001, 2004, 2007 Maciej W. Rozycki 10 * Copyright (C) 2001, 2004, 2007 Maciej W. Rozycki
11 */ 11 */
12#include <linux/init.h>
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/sched.h> 13#include <linux/sched.h>
15#include <linux/smp.h> 14#include <linux/smp.h>
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 49e572d879e1..c14259edd53f 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1020,10 +1020,14 @@ static void probe_pcache(void)
1020 */ 1020 */
1021 config1 = read_c0_config1(); 1021 config1 = read_c0_config1();
1022 1022
1023 if ((lsize = ((config1 >> 19) & 7))) 1023 lsize = (config1 >> 19) & 7;
1024 c->icache.linesz = 2 << lsize; 1024
1025 else 1025 /* IL == 7 is reserved */
1026 c->icache.linesz = lsize; 1026 if (lsize == 7)
1027 panic("Invalid icache line size");
1028
1029 c->icache.linesz = lsize ? 2 << lsize : 0;
1030
1027 c->icache.sets = 32 << (((config1 >> 22) + 1) & 7); 1031 c->icache.sets = 32 << (((config1 >> 22) + 1) & 7);
1028 c->icache.ways = 1 + ((config1 >> 16) & 7); 1032 c->icache.ways = 1 + ((config1 >> 16) & 7);
1029 1033
@@ -1040,10 +1044,14 @@ static void probe_pcache(void)
1040 */ 1044 */
1041 c->dcache.flags = 0; 1045 c->dcache.flags = 0;
1042 1046
1043 if ((lsize = ((config1 >> 10) & 7))) 1047 lsize = (config1 >> 10) & 7;
1044 c->dcache.linesz = 2 << lsize; 1048
1045 else 1049 /* DL == 7 is reserved */
1046 c->dcache.linesz= lsize; 1050 if (lsize == 7)
1051 panic("Invalid dcache line size");
1052
1053 c->dcache.linesz = lsize ? 2 << lsize : 0;
1054
1047 c->dcache.sets = 32 << (((config1 >> 13) + 1) & 7); 1055 c->dcache.sets = 32 << (((config1 >> 13) + 1) & 7);
1048 c->dcache.ways = 1 + ((config1 >> 7) & 7); 1056 c->dcache.ways = 1 + ((config1 >> 7) & 7);
1049 1057
@@ -1105,6 +1113,8 @@ static void probe_pcache(void)
1105 case CPU_34K: 1113 case CPU_34K:
1106 case CPU_74K: 1114 case CPU_74K:
1107 case CPU_1004K: 1115 case CPU_1004K:
1116 case CPU_INTERAPTIV:
1117 case CPU_PROAPTIV:
1108 if (current_cpu_type() == CPU_74K) 1118 if (current_cpu_type() == CPU_74K)
1109 alias_74k_erratum(c); 1119 alias_74k_erratum(c);
1110 if ((read_c0_config7() & (1 << 16))) { 1120 if ((read_c0_config7() & (1 << 16))) {
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 15f813c303b4..fde7e56d13fe 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -8,7 +8,6 @@
8 */ 8 */
9#include <linux/fs.h> 9#include <linux/fs.h>
10#include <linux/fcntl.h> 10#include <linux/fcntl.h>
11#include <linux/init.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/linkage.h> 12#include <linux/linkage.h>
14#include <linux/module.h> 13#include <linux/module.h>
diff --git a/arch/mips/mm/cex-sb1.S b/arch/mips/mm/cex-sb1.S
index 191cf6e0c725..5d5f29681a21 100644
--- a/arch/mips/mm/cex-sb1.S
+++ b/arch/mips/mm/cex-sb1.S
@@ -15,7 +15,6 @@
15 * along with this program; if not, write to the Free Software 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. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/init.h>
19 18
20#include <asm/asm.h> 19#include <asm/asm.h>
21#include <asm/regdef.h> 20#include <asm/regdef.h>
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 2e9418562258..44b6dff5aba2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -23,6 +23,7 @@
23 23
24#include <dma-coherence.h> 24#include <dma-coherence.h>
25 25
26#ifdef CONFIG_DMA_MAYBE_COHERENT
26int coherentio = 0; /* User defined DMA coherency from command line. */ 27int coherentio = 0; /* User defined DMA coherency from command line. */
27EXPORT_SYMBOL_GPL(coherentio); 28EXPORT_SYMBOL_GPL(coherentio);
28int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */ 29int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */
@@ -42,6 +43,7 @@ static int __init setnocoherentio(char *str)
42 return 0; 43 return 0;
43} 44}
44early_param("nocoherentio", setnocoherentio); 45early_param("nocoherentio", setnocoherentio);
46#endif
45 47
46static inline struct page *dma_addr_to_page(struct device *dev, 48static inline struct page *dma_addr_to_page(struct device *dev,
47 dma_addr_t dma_addr) 49 dma_addr_t dma_addr)
diff --git a/arch/mips/mm/hugetlbpage.c b/arch/mips/mm/hugetlbpage.c
index 01fda4419ed0..77e0ae036e7c 100644
--- a/arch/mips/mm/hugetlbpage.c
+++ b/arch/mips/mm/hugetlbpage.c
@@ -11,7 +11,6 @@
11 * Copyright (C) 2008, 2009 Cavium Networks, Inc. 11 * Copyright (C) 2008, 2009 Cavium Networks, Inc.
12 */ 12 */
13 13
14#include <linux/init.h>
15#include <linux/fs.h> 14#include <linux/fs.h>
16#include <linux/mm.h> 15#include <linux/mm.h>
17#include <linux/hugetlb.h> 16#include <linux/hugetlb.h>
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 12156176c7ca..6b59617760c1 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -171,8 +171,6 @@ void *kmap_coherent(struct page *page, unsigned long addr)
171 return (void*) vaddr; 171 return (void*) vaddr;
172} 172}
173 173
174#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
175
176void kunmap_coherent(void) 174void kunmap_coherent(void)
177{ 175{
178#ifndef CONFIG_MIPS_MT_SMTC 176#ifndef CONFIG_MIPS_MT_SMTC
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index cbd81d17793a..58033c44690d 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -8,7 +8,6 @@
8 * Copyright (C) 2008 Thiemo Seufer 8 * Copyright (C) 2008 Thiemo Seufer
9 * Copyright (C) 2012 MIPS Technologies, Inc. 9 * Copyright (C) 2012 MIPS Technologies, Inc.
10 */ 10 */
11#include <linux/init.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/sched.h> 12#include <linux/sched.h>
14#include <linux/smp.h> 13#include <linux/smp.h>
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index 08d05aee8788..7a56aee5fce7 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -76,6 +76,8 @@ static inline int mips_sc_is_activated(struct cpuinfo_mips *c)
76 case CPU_34K: 76 case CPU_34K:
77 case CPU_74K: 77 case CPU_74K:
78 case CPU_1004K: 78 case CPU_1004K:
79 case CPU_INTERAPTIV:
80 case CPU_PROAPTIV:
79 case CPU_BMIPS5000: 81 case CPU_BMIPS5000:
80 if (config2 & (1 << 12)) 82 if (config2 & (1 << 12))
81 return 0; 83 return 0;
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
index aaffbba33706..9ac1efcfbcc7 100644
--- a/arch/mips/mm/sc-rm7k.c
+++ b/arch/mips/mm/sc-rm7k.c
@@ -6,7 +6,6 @@
6 6
7#undef DEBUG 7#undef DEBUG
8 8
9#include <linux/init.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/mm.h> 10#include <linux/mm.h>
12#include <linux/bitops.h> 11#include <linux/bitops.h>
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c
index 9aca10994cd2..d657493ef561 100644
--- a/arch/mips/mm/tlb-r3k.c
+++ b/arch/mips/mm/tlb-r3k.c
@@ -10,7 +10,6 @@
10 * Copyright (C) 2002 Ralf Baechle 10 * Copyright (C) 2002 Ralf Baechle
11 * Copyright (C) 2002 Maciej W. Rozycki 11 * Copyright (C) 2002 Maciej W. Rozycki
12 */ 12 */
13#include <linux/init.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/sched.h> 14#include <linux/sched.h>
16#include <linux/smp.h> 15#include <linux/smp.h>
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index da3b0b9c9eae..ae4ca2450707 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -20,16 +20,11 @@
20#include <asm/bootinfo.h> 20#include <asm/bootinfo.h>
21#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/tlb.h>
23#include <asm/tlbmisc.h> 24#include <asm/tlbmisc.h>
24 25
25extern void build_tlb_refill_handler(void); 26extern void build_tlb_refill_handler(void);
26 27
27/*
28 * Make sure all entries differ. If they're not different
29 * MIPS32 will take revenge ...
30 */
31#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
32
33/* Atomicity and interruptability */ 28/* Atomicity and interruptability */
34#ifdef CONFIG_MIPS_MT_SMTC 29#ifdef CONFIG_MIPS_MT_SMTC
35 30
@@ -77,7 +72,7 @@ void local_flush_tlb_all(void)
77{ 72{
78 unsigned long flags; 73 unsigned long flags;
79 unsigned long old_ctx; 74 unsigned long old_ctx;
80 int entry; 75 int entry, ftlbhighset;
81 76
82 ENTER_CRITICAL(flags); 77 ENTER_CRITICAL(flags);
83 /* Save old context and create impossible VPN2 value */ 78 /* Save old context and create impossible VPN2 value */
@@ -88,13 +83,30 @@ void local_flush_tlb_all(void)
88 entry = read_c0_wired(); 83 entry = read_c0_wired();
89 84
90 /* Blast 'em all away. */ 85 /* Blast 'em all away. */
91 while (entry < current_cpu_data.tlbsize) { 86 if (cpu_has_tlbinv) {
92 /* Make sure all entries differ. */ 87 if (current_cpu_data.tlbsizevtlb) {
93 write_c0_entryhi(UNIQUE_ENTRYHI(entry)); 88 write_c0_index(0);
94 write_c0_index(entry); 89 mtc0_tlbw_hazard();
95 mtc0_tlbw_hazard(); 90 tlbinvf(); /* invalidate VTLB */
96 tlb_write_indexed(); 91 }
97 entry++; 92 ftlbhighset = current_cpu_data.tlbsizevtlb +
93 current_cpu_data.tlbsizeftlbsets;
94 for (entry = current_cpu_data.tlbsizevtlb;
95 entry < ftlbhighset;
96 entry++) {
97 write_c0_index(entry);
98 mtc0_tlbw_hazard();
99 tlbinvf(); /* invalidate one FTLB set */
100 }
101 } else {
102 while (entry < current_cpu_data.tlbsize) {
103 /* Make sure all entries differ. */
104 write_c0_entryhi(UNIQUE_ENTRYHI(entry));
105 write_c0_index(entry);
106 mtc0_tlbw_hazard();
107 tlb_write_indexed();
108 entry++;
109 }
98 } 110 }
99 tlbw_use_hazard(); 111 tlbw_use_hazard();
100 write_c0_entryhi(old_ctx); 112 write_c0_entryhi(old_ctx);
@@ -133,7 +145,9 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
133 start = round_down(start, PAGE_SIZE << 1); 145 start = round_down(start, PAGE_SIZE << 1);
134 end = round_up(end, PAGE_SIZE << 1); 146 end = round_up(end, PAGE_SIZE << 1);
135 size = (end - start) >> (PAGE_SHIFT + 1); 147 size = (end - start) >> (PAGE_SHIFT + 1);
136 if (size <= current_cpu_data.tlbsize/2) { 148 if (size <= (current_cpu_data.tlbsizeftlbsets ?
149 current_cpu_data.tlbsize / 8 :
150 current_cpu_data.tlbsize / 2)) {
137 int oldpid = read_c0_entryhi(); 151 int oldpid = read_c0_entryhi();
138 int newpid = cpu_asid(cpu, mm); 152 int newpid = cpu_asid(cpu, mm);
139 153
@@ -172,7 +186,9 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
172 ENTER_CRITICAL(flags); 186 ENTER_CRITICAL(flags);
173 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 187 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
174 size = (size + 1) >> 1; 188 size = (size + 1) >> 1;
175 if (size <= current_cpu_data.tlbsize / 2) { 189 if (size <= (current_cpu_data.tlbsizeftlbsets ?
190 current_cpu_data.tlbsize / 8 :
191 current_cpu_data.tlbsize / 2)) {
176 int pid = read_c0_entryhi(); 192 int pid = read_c0_entryhi();
177 193
178 start &= (PAGE_MASK << 1); 194 start &= (PAGE_MASK << 1);
diff --git a/arch/mips/mm/tlb-r8k.c b/arch/mips/mm/tlb-r8k.c
index 6a99733a4440..138a2ec7cc6b 100644
--- a/arch/mips/mm/tlb-r8k.c
+++ b/arch/mips/mm/tlb-r8k.c
@@ -8,7 +8,6 @@
8 * Carsten Langgaard, carstenl@mips.com 8 * Carsten Langgaard, carstenl@mips.com
9 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved. 9 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
10 */ 10 */
11#include <linux/init.h>
12#include <linux/sched.h> 11#include <linux/sched.h>
13#include <linux/smp.h> 12#include <linux/smp.h>
14#include <linux/mm.h> 13#include <linux/mm.h>
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 183f2b583e4d..b234b1b5ccad 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -26,7 +26,6 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/smp.h> 27#include <linux/smp.h>
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/init.h>
30#include <linux/cache.h> 29#include <linux/cache.h>
31 30
32#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
@@ -510,6 +509,7 @@ static void build_tlb_write_entry(u32 **p, struct uasm_label **l,
510 switch (current_cpu_type()) { 509 switch (current_cpu_type()) {
511 case CPU_M14KC: 510 case CPU_M14KC:
512 case CPU_74K: 511 case CPU_74K:
512 case CPU_PROAPTIV:
513 break; 513 break;
514 514
515 default: 515 default:
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c
index 060000fa653c..b8d580ca02e5 100644
--- a/arch/mips/mm/uasm-micromips.c
+++ b/arch/mips/mm/uasm-micromips.c
@@ -15,7 +15,6 @@
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/init.h>
19 18
20#include <asm/inst.h> 19#include <asm/inst.h>
21#include <asm/elf.h> 20#include <asm/elf.h>
diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c
index 0c724589854e..3abd609518c9 100644
--- a/arch/mips/mm/uasm-mips.c
+++ b/arch/mips/mm/uasm-mips.c
@@ -15,7 +15,6 @@
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/init.h>
19 18
20#include <asm/inst.h> 19#include <asm/inst.h>
21#include <asm/elf.h> 20#include <asm/elf.h>
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index 72fdedbf76db..eae0ba3876d9 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -9,7 +9,5 @@ obj-y := malta-amon.o malta-display.o malta-init.o \
9 malta-int.o malta-memory.o malta-platform.o \ 9 malta-int.o malta-memory.o malta-platform.o \
10 malta-reset.o malta-setup.o malta-time.o 10 malta-reset.o malta-setup.o malta-time.o
11 11
12obj-$(CONFIG_EARLY_PRINTK) += malta-console.o
13
14# FIXME FIXME FIXME 12# FIXME FIXME FIXME
15obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o 13obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o
diff --git a/arch/mips/mti-malta/malta-amon.c b/arch/mips/mti-malta/malta-amon.c
index 1e4784458016..592ac0427426 100644
--- a/arch/mips/mti-malta/malta-amon.c
+++ b/arch/mips/mti-malta/malta-amon.c
@@ -1,30 +1,20 @@
1/* 1/*
2 * Copyright (C) 2007 MIPS Technologies, Inc. 2 * This file is subject to the terms and conditions of the GNU General Public
3 * All rights reserved. 3 * License. See the file "COPYING" in the main directory of this archive
4 4 * for more details.
5 * 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 * 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
12 * for more details.
13 * 5 *
14 * You should have received a copy of the GNU General Public License along 6 * Copyright (C) 2007 MIPS Technologies, Inc. All rights reserved.
15 * with this program; if not, write to the Free Software Foundation, Inc., 7 * Copyright (C) 2013 Imagination Technologies Ltd.
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 * 8 *
18 * Arbitrary Monitor interface 9 * Arbitrary Monitor Interface
19 */ 10 */
20
21#include <linux/kernel.h> 11#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/smp.h> 12#include <linux/smp.h>
24 13
25#include <asm/addrspace.h> 14#include <asm/addrspace.h>
26#include <asm/mips-boards/launch.h>
27#include <asm/mipsmtregs.h> 15#include <asm/mipsmtregs.h>
16#include <asm/mips-boards/launch.h>
17#include <asm/vpe.h>
28 18
29int amon_cpu_avail(int cpu) 19int amon_cpu_avail(int cpu)
30{ 20{
@@ -48,7 +38,7 @@ int amon_cpu_avail(int cpu)
48 return 1; 38 return 1;
49} 39}
50 40
51void amon_cpu_start(int cpu, 41int amon_cpu_start(int cpu,
52 unsigned long pc, unsigned long sp, 42 unsigned long pc, unsigned long sp,
53 unsigned long gp, unsigned long a0) 43 unsigned long gp, unsigned long a0)
54{ 44{
@@ -56,10 +46,10 @@ void amon_cpu_start(int cpu,
56 (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH); 46 (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH);
57 47
58 if (!amon_cpu_avail(cpu)) 48 if (!amon_cpu_avail(cpu))
59 return; 49 return -1;
60 if (cpu == smp_processor_id()) { 50 if (cpu == smp_processor_id()) {
61 pr_debug("launch: I am cpu%d!\n", cpu); 51 pr_debug("launch: I am cpu%d!\n", cpu);
62 return; 52 return -1;
63 } 53 }
64 launch += cpu; 54 launch += cpu;
65 55
@@ -78,4 +68,21 @@ void amon_cpu_start(int cpu,
78 ; 68 ;
79 smp_rmb(); /* Target will be updating flags soon */ 69 smp_rmb(); /* Target will be updating flags soon */
80 pr_debug("launch: cpu%d gone!\n", cpu); 70 pr_debug("launch: cpu%d gone!\n", cpu);
71
72 return 0;
73}
74
75#ifdef CONFIG_MIPS_VPE_LOADER
76int vpe_run(struct vpe *v)
77{
78 struct vpe_notifications *n;
79
80 if (amon_cpu_start(aprp_cpu_index(), v->__start, 0, 0, 0) < 0)
81 return -1;
82
83 list_for_each_entry(n, &v->notify, list)
84 n->start(VPE_MODULE_MINOR);
85
86 return 0;
81} 87}
88#endif
diff --git a/arch/mips/mti-malta/malta-console.c b/arch/mips/mti-malta/malta-console.c
deleted file mode 100644
index 43bcfb4f8167..000000000000
--- a/arch/mips/mti-malta/malta-console.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * 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 * 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
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Putting things on the screen/serial line using YAMONs facilities.
19 */
20#include <linux/console.h>
21#include <linux/init.h>
22#include <linux/serial_reg.h>
23#include <asm/io.h>
24
25
26#define PORT(offset) (0x3f8 + (offset))
27
28
29static inline unsigned int serial_in(int offset)
30{
31 return inb(PORT(offset));
32}
33
34static inline void serial_out(int offset, int value)
35{
36 outb(value, PORT(offset));
37}
38
39int prom_putchar(char c)
40{
41 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
42 ;
43
44 serial_out(UART_TX, c);
45
46 return 1;
47}
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index ff8caffd3266..fcebfced26d0 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/string.h> 15#include <linux/string.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/serial_8250.h>
17 18
18#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
19#include <asm/smp-ops.h> 20#include <asm/smp-ops.h>
@@ -44,32 +45,39 @@ static void __init console_config(void)
44 char parity = '\0', bits = '\0', flow = '\0'; 45 char parity = '\0', bits = '\0', flow = '\0';
45 char *s; 46 char *s;
46 47
47 if ((strstr(fw_getcmdline(), "console=")) == NULL) { 48 s = fw_getenv("modetty0");
48 s = fw_getenv("modetty0"); 49 if (s) {
49 if (s) { 50 while (*s >= '0' && *s <= '9')
50 while (*s >= '0' && *s <= '9') 51 baud = baud*10 + *s++ - '0';
51 baud = baud*10 + *s++ - '0'; 52 if (*s == ',')
52 if (*s == ',') 53 s++;
53 s++; 54 if (*s)
54 if (*s) 55 parity = *s++;
55 parity = *s++; 56 if (*s == ',')
56 if (*s == ',') 57 s++;
57 s++; 58 if (*s)
58 if (*s) 59 bits = *s++;
59 bits = *s++; 60 if (*s == ',')
60 if (*s == ',') 61 s++;
61 s++; 62 if (*s == 'h')
62 if (*s == 'h')
63 flow = 'r';
64 }
65 if (baud == 0)
66 baud = 38400;
67 if (parity != 'n' && parity != 'o' && parity != 'e')
68 parity = 'n';
69 if (bits != '7' && bits != '8')
70 bits = '8';
71 if (flow == '\0')
72 flow = 'r'; 63 flow = 'r';
64 }
65 if (baud == 0)
66 baud = 38400;
67 if (parity != 'n' && parity != 'o' && parity != 'e')
68 parity = 'n';
69 if (bits != '7' && bits != '8')
70 bits = '8';
71 if (flow == '\0')
72 flow = 'r';
73
74 if ((strstr(fw_getcmdline(), "earlycon=")) == NULL) {
75 sprintf(console_string, "uart8250,io,0x3f8,%d%c%c", baud,
76 parity, bits);
77 setup_early_serial8250_console(console_string);
78 }
79
80 if ((strstr(fw_getcmdline(), "console=")) == NULL) {
73 sprintf(console_string, " console=ttyS0,%d%c%c%c", baud, 81 sprintf(console_string, " console=ttyS0,%d%c%c%c", baud,
74 parity, bits, flow); 82 parity, bits, flow);
75 strcat(fw_getcmdline(), console_string); 83 strcat(fw_getcmdline(), console_string);
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 0892575f829d..ca3e3a46a42f 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -1,25 +1,16 @@
1/* 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 *
2 * Carsten Langgaard, carstenl@mips.com 6 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc. 7 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc.
4 * Copyright (C) 2001 Ralf Baechle 8 * Copyright (C) 2001 Ralf Baechle
5 * 9 * Copyright (C) 2013 Imagination Technologies Ltd.
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 * 10 *
19 * Routines for generic manipulation of the interrupts found on the MIPS 11 * Routines for generic manipulation of the interrupts found on the MIPS
20 * Malta board. 12 * Malta board. The interrupt controller is located in the South Bridge
21 * The interrupt controller is located in the South Bridge a PIIX4 device 13 * a PIIX4 device with two internal 82C95 interrupt controllers.
22 * with two internal 82C95 interrupt controllers.
23 */ 14 */
24#include <linux/init.h> 15#include <linux/init.h>
25#include <linux/irq.h> 16#include <linux/irq.h>
@@ -44,6 +35,7 @@
44#include <asm/gic.h> 35#include <asm/gic.h>
45#include <asm/gcmpregs.h> 36#include <asm/gcmpregs.h>
46#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/rtlx.h>
47 39
48int gcmp_present = -1; 40int gcmp_present = -1;
49static unsigned long _msc01_biu_base; 41static unsigned long _msc01_biu_base;
@@ -90,7 +82,7 @@ static inline int mips_pcibios_iack(void)
90 BONITO_PCIMAP_CFG = 0; 82 BONITO_PCIMAP_CFG = 0;
91 break; 83 break;
92 default: 84 default:
93 printk(KERN_WARNING "Unknown system controller.\n"); 85 pr_emerg("Unknown system controller.\n");
94 return -1; 86 return -1;
95 } 87 }
96 return irq; 88 return irq;
@@ -126,6 +118,11 @@ static void malta_hw0_irqdispatch(void)
126 } 118 }
127 119
128 do_IRQ(MALTA_INT_BASE + irq); 120 do_IRQ(MALTA_INT_BASE + irq);
121
122#ifdef MIPS_VPE_APSP_API
123 if (aprp_hook)
124 aprp_hook();
125#endif
129} 126}
130 127
131static void malta_ipi_irqdispatch(void) 128static void malta_ipi_irqdispatch(void)
@@ -149,11 +146,11 @@ static void corehi_irqdispatch(void)
149 unsigned int intrcause, datalo, datahi; 146 unsigned int intrcause, datalo, datahi;
150 struct pt_regs *regs = get_irq_regs(); 147 struct pt_regs *regs = get_irq_regs();
151 148
152 printk(KERN_EMERG "CoreHI interrupt, shouldn't happen, we die here!\n"); 149 pr_emerg("CoreHI interrupt, shouldn't happen, we die here!\n");
153 printk(KERN_EMERG "epc : %08lx\nStatus: %08lx\n" 150 pr_emerg("epc : %08lx\nStatus: %08lx\n"
154 "Cause : %08lx\nbadVaddr : %08lx\n", 151 "Cause : %08lx\nbadVaddr : %08lx\n",
155 regs->cp0_epc, regs->cp0_status, 152 regs->cp0_epc, regs->cp0_status,
156 regs->cp0_cause, regs->cp0_badvaddr); 153 regs->cp0_cause, regs->cp0_badvaddr);
157 154
158 /* Read all the registers and then print them as there is a 155 /* Read all the registers and then print them as there is a
159 problem with interspersed printk's upsetting the Bonito controller. 156 problem with interspersed printk's upsetting the Bonito controller.
@@ -171,8 +168,8 @@ static void corehi_irqdispatch(void)
171 intrcause = GT_READ(GT_INTRCAUSE_OFS); 168 intrcause = GT_READ(GT_INTRCAUSE_OFS);
172 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS); 169 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
173 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS); 170 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
174 printk(KERN_EMERG "GT_INTRCAUSE = %08x\n", intrcause); 171 pr_emerg("GT_INTRCAUSE = %08x\n", intrcause);
175 printk(KERN_EMERG "GT_CPUERR_ADDR = %02x%08x\n", 172 pr_emerg("GT_CPUERR_ADDR = %02x%08x\n",
176 datahi, datalo); 173 datahi, datalo);
177 break; 174 break;
178 case MIPS_REVISION_SCON_BONITO: 175 case MIPS_REVISION_SCON_BONITO:
@@ -184,14 +181,14 @@ static void corehi_irqdispatch(void)
184 intedge = BONITO_INTEDGE; 181 intedge = BONITO_INTEDGE;
185 intsteer = BONITO_INTSTEER; 182 intsteer = BONITO_INTSTEER;
186 pcicmd = BONITO_PCICMD; 183 pcicmd = BONITO_PCICMD;
187 printk(KERN_EMERG "BONITO_INTISR = %08x\n", intisr); 184 pr_emerg("BONITO_INTISR = %08x\n", intisr);
188 printk(KERN_EMERG "BONITO_INTEN = %08x\n", inten); 185 pr_emerg("BONITO_INTEN = %08x\n", inten);
189 printk(KERN_EMERG "BONITO_INTPOL = %08x\n", intpol); 186 pr_emerg("BONITO_INTPOL = %08x\n", intpol);
190 printk(KERN_EMERG "BONITO_INTEDGE = %08x\n", intedge); 187 pr_emerg("BONITO_INTEDGE = %08x\n", intedge);
191 printk(KERN_EMERG "BONITO_INTSTEER = %08x\n", intsteer); 188 pr_emerg("BONITO_INTSTEER = %08x\n", intsteer);
192 printk(KERN_EMERG "BONITO_PCICMD = %08x\n", pcicmd); 189 pr_emerg("BONITO_PCICMD = %08x\n", pcicmd);
193 printk(KERN_EMERG "BONITO_PCIBADADDR = %08x\n", pcibadaddr); 190 pr_emerg("BONITO_PCIBADADDR = %08x\n", pcibadaddr);
194 printk(KERN_EMERG "BONITO_PCIMSTAT = %08x\n", pcimstat); 191 pr_emerg("BONITO_PCIMSTAT = %08x\n", pcimstat);
195 break; 192 break;
196 } 193 }
197 194
@@ -313,6 +310,11 @@ static void ipi_call_dispatch(void)
313 310
314static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) 311static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
315{ 312{
313#ifdef MIPS_VPE_APSP_API
314 if (aprp_hook)
315 aprp_hook();
316#endif
317
316 scheduler_ipi(); 318 scheduler_ipi();
317 319
318 return IRQ_HANDLED; 320 return IRQ_HANDLED;
@@ -365,13 +367,13 @@ static struct irqaction corehi_irqaction = {
365 .flags = IRQF_NO_THREAD, 367 .flags = IRQF_NO_THREAD,
366}; 368};
367 369
368static msc_irqmap_t __initdata msc_irqmap[] = { 370static msc_irqmap_t msc_irqmap[] __initdata = {
369 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0}, 371 {MSC01C_INT_TMR, MSC01_IRQ_EDGE, 0},
370 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0}, 372 {MSC01C_INT_PCI, MSC01_IRQ_LEVEL, 0},
371}; 373};
372static int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap); 374static int msc_nr_irqs __initdata = ARRAY_SIZE(msc_irqmap);
373 375
374static msc_irqmap_t __initdata msc_eicirqmap[] = { 376static msc_irqmap_t msc_eicirqmap[] __initdata = {
375 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0}, 377 {MSC01E_INT_SW0, MSC01_IRQ_LEVEL, 0},
376 {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0}, 378 {MSC01E_INT_SW1, MSC01_IRQ_LEVEL, 0},
377 {MSC01E_INT_I8259A, MSC01_IRQ_LEVEL, 0}, 379 {MSC01E_INT_I8259A, MSC01_IRQ_LEVEL, 0},
@@ -384,7 +386,7 @@ static msc_irqmap_t __initdata msc_eicirqmap[] = {
384 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0} 386 {MSC01E_INT_CPUCTR, MSC01_IRQ_LEVEL, 0}
385}; 387};
386 388
387static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap); 389static int msc_nr_eicirqs __initdata = ARRAY_SIZE(msc_eicirqmap);
388 390
389/* 391/*
390 * This GIC specific tabular array defines the association between External 392 * This GIC specific tabular array defines the association between External
@@ -431,9 +433,12 @@ int __init gcmp_probe(unsigned long addr, unsigned long size)
431 if (gcmp_present >= 0) 433 if (gcmp_present >= 0)
432 return gcmp_present; 434 return gcmp_present;
433 435
434 _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ); 436 _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR,
435 _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE, MSC01_BIU_ADDRSPACE_SZ); 437 GCMP_ADDRSPACE_SZ);
436 gcmp_present = (GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) == GCMP_BASE_ADDR; 438 _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE,
439 MSC01_BIU_ADDRSPACE_SZ);
440 gcmp_present = ((GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) ==
441 GCMP_BASE_ADDR);
437 442
438 if (gcmp_present) 443 if (gcmp_present)
439 pr_debug("GCMP present\n"); 444 pr_debug("GCMP present\n");
@@ -443,9 +448,8 @@ int __init gcmp_probe(unsigned long addr, unsigned long size)
443/* Return the number of IOCU's present */ 448/* Return the number of IOCU's present */
444int __init gcmp_niocu(void) 449int __init gcmp_niocu(void)
445{ 450{
446 return gcmp_present ? 451 return gcmp_present ? ((GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >>
447 (GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >> GCMP_GCB_GC_NUMIOCU_SHF : 452 GCMP_GCB_GC_NUMIOCU_SHF) : 0;
448 0;
449} 453}
450 454
451/* Set GCMP region attributes */ 455/* Set GCMP region attributes */
@@ -594,11 +598,14 @@ void __init arch_init_irq(void)
594 set_vi_handler(MIPSCPU_INT_IPI1, malta_ipi_irqdispatch); 598 set_vi_handler(MIPSCPU_INT_IPI1, malta_ipi_irqdispatch);
595 } 599 }
596 /* Argh.. this really needs sorting out.. */ 600 /* Argh.. this really needs sorting out.. */
597 printk("CPU%d: status register was %08x\n", smp_processor_id(), read_c0_status()); 601 pr_info("CPU%d: status register was %08x\n",
602 smp_processor_id(), read_c0_status());
598 write_c0_status(read_c0_status() | STATUSF_IP3 | STATUSF_IP4); 603 write_c0_status(read_c0_status() | STATUSF_IP3 | STATUSF_IP4);
599 printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); 604 pr_info("CPU%d: status register now %08x\n",
605 smp_processor_id(), read_c0_status());
600 write_c0_status(0x1100dc00); 606 write_c0_status(0x1100dc00);
601 printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); 607 pr_info("CPU%d: status register frc %08x\n",
608 smp_processor_id(), read_c0_status());
602 for (i = 0; i < nr_cpu_ids; i++) { 609 for (i = 0; i < nr_cpu_ids; i++) {
603 arch_init_ipiirq(MIPS_GIC_IRQ_BASE + 610 arch_init_ipiirq(MIPS_GIC_IRQ_BASE +
604 GIC_RESCHED_INT(i), &irq_resched); 611 GIC_RESCHED_INT(i), &irq_resched);
@@ -616,11 +623,15 @@ void __init arch_init_irq(void)
616 cpu_ipi_call_irq = MSC01E_INT_SW1; 623 cpu_ipi_call_irq = MSC01E_INT_SW1;
617 } else { 624 } else {
618 if (cpu_has_vint) { 625 if (cpu_has_vint) {
619 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); 626 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ,
620 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); 627 ipi_resched_dispatch);
628 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ,
629 ipi_call_dispatch);
621 } 630 }
622 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ; 631 cpu_ipi_resched_irq = MIPS_CPU_IRQ_BASE +
623 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ; 632 MIPS_CPU_IPI_RESCHED_IRQ;
633 cpu_ipi_call_irq = MIPS_CPU_IRQ_BASE +
634 MIPS_CPU_IPI_CALL_IRQ;
624 } 635 }
625 arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched); 636 arch_init_ipiirq(cpu_ipi_resched_irq, &irq_resched);
626 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call); 637 arch_init_ipiirq(cpu_ipi_call_irq, &irq_call);
@@ -630,9 +641,7 @@ void __init arch_init_irq(void)
630 641
631void malta_be_init(void) 642void malta_be_init(void)
632{ 643{
633 if (gcmp_present) { 644 /* Could change CM error mask register. */
634 /* Could change CM error mask register */
635 }
636} 645}
637 646
638 647
@@ -712,14 +721,14 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
712 if (cause < 16) { 721 if (cause < 16) {
713 unsigned long cca_bits = (cm_error >> 15) & 7; 722 unsigned long cca_bits = (cm_error >> 15) & 7;
714 unsigned long tr_bits = (cm_error >> 12) & 7; 723 unsigned long tr_bits = (cm_error >> 12) & 7;
715 unsigned long mcmd_bits = (cm_error >> 7) & 0x1f; 724 unsigned long cmd_bits = (cm_error >> 7) & 0x1f;
716 unsigned long stag_bits = (cm_error >> 3) & 15; 725 unsigned long stag_bits = (cm_error >> 3) & 15;
717 unsigned long sport_bits = (cm_error >> 0) & 7; 726 unsigned long sport_bits = (cm_error >> 0) & 7;
718 727
719 snprintf(buf, sizeof(buf), 728 snprintf(buf, sizeof(buf),
720 "CCA=%lu TR=%s MCmd=%s STag=%lu " 729 "CCA=%lu TR=%s MCmd=%s STag=%lu "
721 "SPort=%lu\n", 730 "SPort=%lu\n",
722 cca_bits, tr[tr_bits], mcmd[mcmd_bits], 731 cca_bits, tr[tr_bits], mcmd[cmd_bits],
723 stag_bits, sport_bits); 732 stag_bits, sport_bits);
724 } else { 733 } else {
725 /* glob state & sresp together */ 734 /* glob state & sresp together */
@@ -728,7 +737,7 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
728 unsigned long c1_bits = (cm_error >> 12) & 7; 737 unsigned long c1_bits = (cm_error >> 12) & 7;
729 unsigned long c0_bits = (cm_error >> 9) & 7; 738 unsigned long c0_bits = (cm_error >> 9) & 7;
730 unsigned long sc_bit = (cm_error >> 8) & 1; 739 unsigned long sc_bit = (cm_error >> 8) & 1;
731 unsigned long mcmd_bits = (cm_error >> 3) & 0x1f; 740 unsigned long cmd_bits = (cm_error >> 3) & 0x1f;
732 unsigned long sport_bits = (cm_error >> 0) & 7; 741 unsigned long sport_bits = (cm_error >> 0) & 7;
733 snprintf(buf, sizeof(buf), 742 snprintf(buf, sizeof(buf),
734 "C3=%s C2=%s C1=%s C0=%s SC=%s " 743 "C3=%s C2=%s C1=%s C0=%s SC=%s "
@@ -736,16 +745,16 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
736 core[c3_bits], core[c2_bits], 745 core[c3_bits], core[c2_bits],
737 core[c1_bits], core[c0_bits], 746 core[c1_bits], core[c0_bits],
738 sc_bit ? "True" : "False", 747 sc_bit ? "True" : "False",
739 mcmd[mcmd_bits], sport_bits); 748 mcmd[cmd_bits], sport_bits);
740 } 749 }
741 750
742 ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >> 751 ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >>
743 GCMP_GCB_GMEO_ERROR_2ND_SHF; 752 GCMP_GCB_GMEO_ERROR_2ND_SHF;
744 753
745 printk("CM_ERROR=%08lx %s <%s>\n", cm_error, 754 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error,
746 causes[cause], buf); 755 causes[cause], buf);
747 printk("CM_ADDR =%08lx\n", cm_addr); 756 pr_err("CM_ADDR =%08lx\n", cm_addr);
748 printk("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]); 757 pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]);
749 758
750 /* reprime cause register */ 759 /* reprime cause register */
751 GCMPGCB(GCMEC) = 0; 760 GCMPGCB(GCMEC) = 0;
diff --git a/arch/mips/mti-malta/malta-platform.c b/arch/mips/mti-malta/malta-platform.c
index 132f8663825e..e1dd1c1d3fde 100644
--- a/arch/mips/mti-malta/malta-platform.c
+++ b/arch/mips/mti-malta/malta-platform.c
@@ -47,6 +47,7 @@
47static struct plat_serial8250_port uart8250_data[] = { 47static struct plat_serial8250_port uart8250_data[] = {
48 SMC_PORT(0x3F8, 4), 48 SMC_PORT(0x3F8, 4),
49 SMC_PORT(0x2F8, 3), 49 SMC_PORT(0x2F8, 3),
50#ifndef CONFIG_MIPS_CMP
50 { 51 {
51 .mapbase = 0x1f000900, /* The CBUS UART */ 52 .mapbase = 0x1f000900, /* The CBUS UART */
52 .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2, 53 .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2,
@@ -55,6 +56,7 @@ static struct plat_serial8250_port uart8250_data[] = {
55 .flags = CBUS_UART_FLAGS, 56 .flags = CBUS_UART_FLAGS,
56 .regshift = 3, 57 .regshift = 3,
57 }, 58 },
59#endif
58 { }, 60 { },
59}; 61};
60 62
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c
index a18af5fce67e..319009912142 100644
--- a/arch/mips/mti-malta/malta-time.c
+++ b/arch/mips/mti-malta/malta-time.c
@@ -42,8 +42,6 @@
42#include <asm/mips-boards/generic.h> 42#include <asm/mips-boards/generic.h>
43#include <asm/mips-boards/maltaint.h> 43#include <asm/mips-boards/maltaint.h>
44 44
45unsigned long cpu_khz;
46
47static int mips_cpu_timer_irq; 45static int mips_cpu_timer_irq;
48static int mips_cpu_perf_irq; 46static int mips_cpu_perf_irq;
49extern int cp0_perfcount_irq; 47extern int cp0_perfcount_irq;
@@ -168,11 +166,24 @@ unsigned int get_c0_compare_int(void)
168 return mips_cpu_timer_irq; 166 return mips_cpu_timer_irq;
169} 167}
170 168
169static void __init init_rtc(void)
170{
171 /* stop the clock whilst setting it up */
172 CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL);
173
174 /* 32KHz time base */
175 CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);
176
177 /* start the clock */
178 CMOS_WRITE(RTC_24H, RTC_CONTROL);
179}
180
171void __init plat_time_init(void) 181void __init plat_time_init(void)
172{ 182{
173 unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK); 183 unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK);
174 unsigned int freq; 184 unsigned int freq;
175 185
186 init_rtc();
176 estimate_frequencies(); 187 estimate_frequencies();
177 188
178 freq = mips_hpt_frequency; 189 freq = mips_hpt_frequency;
@@ -182,7 +193,6 @@ void __init plat_time_init(void)
182 freq = freqround(freq, 5000); 193 freq = freqround(freq, 5000);
183 printk("CPU frequency %d.%02d MHz\n", freq/1000000, 194 printk("CPU frequency %d.%02d MHz\n", freq/1000000,
184 (freq%1000000)*100/1000000); 195 (freq%1000000)*100/1000000);
185 cpu_khz = freq / 1000;
186 196
187 mips_scroll_message(); 197 mips_scroll_message();
188 198
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index be114209217c..071786fa234b 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -21,5 +21,7 @@ obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
21obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o 21obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o
22obj-$(CONFIG_OF) += sead3.dtb.o 22obj-$(CONFIG_OF) += sead3.dtb.o
23 23
24CFLAGS_sead3-setup.o = -I$(src)/../../../scripts/dtc/libfdt
25
24$(obj)/%.dtb: $(obj)/%.dts 26$(obj)/%.dtb: $(obj)/%.dts
25 $(call if_changed,dtc) 27 $(call if_changed,dtc)
diff --git a/arch/mips/mti-sead3/sead3-pic32-bus.c b/arch/mips/mti-sead3/sead3-pic32-bus.c
index eb2bf936d102..3b12aa5a7c88 100644
--- a/arch/mips/mti-sead3/sead3-pic32-bus.c
+++ b/arch/mips/mti-sead3/sead3-pic32-bus.c
@@ -8,7 +8,6 @@
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/init.h>
12#include <linux/io.h> 11#include <linux/io.h>
13#include <linux/errno.h> 12#include <linux/errno.h>
14 13
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index 928ba84c8a78..bf7fe48bf2f9 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -4,13 +4,15 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. 6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 * Copyright (C) 2013 Imagination Technologies Ltd.
7 */ 8 */
8#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/libfdt.h>
9#include <linux/of_platform.h> 11#include <linux/of_platform.h>
10#include <linux/of_fdt.h> 12#include <linux/of_fdt.h>
11#include <linux/bootmem.h>
12 13
13#include <asm/prom.h> 14#include <asm/prom.h>
15#include <asm/fw/fw.h>
14 16
15#include <asm/mips-boards/generic.h> 17#include <asm/mips-boards/generic.h>
16 18
@@ -19,8 +21,73 @@ const char *get_system_type(void)
19 return "MIPS SEAD3"; 21 return "MIPS SEAD3";
20} 22}
21 23
24static uint32_t get_memsize_from_cmdline(void)
25{
26 int memsize = 0;
27 char *p = arcs_cmdline;
28 char *s = "memsize=";
29
30 p = strstr(p, s);
31 if (p) {
32 p += strlen(s);
33 memsize = memparse(p, NULL);
34 }
35
36 return memsize;
37}
38
39static uint32_t get_memsize_from_env(void)
40{
41 int memsize = 0;
42 char *p;
43
44 p = fw_getenv("memsize");
45 if (p)
46 memsize = memparse(p, NULL);
47
48 return memsize;
49}
50
51static uint32_t get_memsize(void)
52{
53 uint32_t memsize;
54
55 memsize = get_memsize_from_cmdline();
56 if (memsize)
57 return memsize;
58
59 return get_memsize_from_env();
60}
61
62static void __init parse_memsize_param(void)
63{
64 int offset;
65 const uint64_t *prop_value;
66 int prop_len;
67 uint32_t memsize = get_memsize();
68
69 if (!memsize)
70 return;
71
72 offset = fdt_path_offset(&__dtb_start, "/memory");
73 if (offset > 0) {
74 uint64_t new_value;
75 /*
76 * reg contains 2 32-bits BE values, offset and size. We just
77 * want to replace the size value without affecting the offset
78 */
79 prop_value = fdt_getprop(&__dtb_start, offset, "reg", &prop_len);
80 new_value = be64_to_cpu(*prop_value);
81 new_value = (new_value & ~0xffffffffllu) | memsize;
82 fdt_setprop_inplace_u64(&__dtb_start, offset, "reg", new_value);
83 }
84}
85
22void __init plat_mem_setup(void) 86void __init plat_mem_setup(void)
23{ 87{
88 /* allow command line/bootloader env to override memory size in DT */
89 parse_memsize_param();
90
24 /* 91 /*
25 * Load the builtin devicetree. This causes the chosen node to be 92 * Load the builtin devicetree. This causes the chosen node to be
26 * parsed resulting in our memory appearing 93 * parsed resulting in our memory appearing
@@ -30,16 +97,15 @@ void __init plat_mem_setup(void)
30 97
31void __init device_tree_init(void) 98void __init device_tree_init(void)
32{ 99{
33 unsigned long base, size;
34
35 if (!initial_boot_params) 100 if (!initial_boot_params)
36 return; 101 return;
37 102
38 base = virt_to_phys((void *)initial_boot_params); 103 unflatten_and_copy_device_tree();
39 size = be32_to_cpu(initial_boot_params->totalsize); 104}
40
41 /* Before we do anything, lets reserve the dt blob */
42 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
43 105
44 unflatten_device_tree(); 106static int __init customize_machine(void)
107{
108 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
109 return 0;
45} 110}
111arch_initcall(customize_machine);
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c
index 552d26c34386..678d03d53c60 100644
--- a/arch/mips/mti-sead3/sead3-time.c
+++ b/arch/mips/mti-sead3/sead3-time.c
@@ -13,8 +13,6 @@
13#include <asm/irq.h> 13#include <asm/irq.h>
14#include <asm/mips-boards/generic.h> 14#include <asm/mips-boards/generic.h>
15 15
16unsigned long cpu_khz;
17
18static int mips_cpu_timer_irq; 16static int mips_cpu_timer_irq;
19static int mips_cpu_perf_irq; 17static int mips_cpu_perf_irq;
20 18
@@ -109,8 +107,6 @@ void __init plat_time_init(void)
109 pr_debug("CPU frequency %d.%02d MHz\n", (est_freq / 1000000), 107 pr_debug("CPU frequency %d.%02d MHz\n", (est_freq / 1000000),
110 (est_freq % 1000000) * 100 / 1000000); 108 (est_freq % 1000000) * 100 / 1000000);
111 109
112 cpu_khz = est_freq / 1000;
113
114 mips_scroll_message(); 110 mips_scroll_message();
115 111
116 plat_perf_setup(); 112 plat_perf_setup();
diff --git a/arch/mips/mti-sead3/sead3.dts b/arch/mips/mti-sead3/sead3.dts
index 658f43787056..e4b317d414f1 100644
--- a/arch/mips/mti-sead3/sead3.dts
+++ b/arch/mips/mti-sead3/sead3.dts
@@ -15,10 +15,6 @@
15 }; 15 };
16 }; 16 };
17 17
18 chosen {
19 bootargs = "console=ttyS1,38400 rootdelay=10 root=/dev/sda3";
20 };
21
22 memory { 18 memory {
23 device_type = "memory"; 19 device_type = "memory";
24 reg = <0x0 0x08000000>; 20 reg = <0x0 0x08000000>;
diff --git a/arch/mips/netlogic/Kconfig b/arch/mips/netlogic/Kconfig
index 852a4ee09954..4eb683aef7d7 100644
--- a/arch/mips/netlogic/Kconfig
+++ b/arch/mips/netlogic/Kconfig
@@ -28,6 +28,15 @@ config DT_XLP_FVP
28 pointer to the kernel. The corresponding DTS file is at 28 pointer to the kernel. The corresponding DTS file is at
29 arch/mips/netlogic/dts/xlp_fvp.dts 29 arch/mips/netlogic/dts/xlp_fvp.dts
30 30
31config DT_XLP_GVP
32 bool "Built-in device tree for XLP GVP boards"
33 default y
34 help
35 Add an FDT blob for XLP GVP board into the kernel.
36 This DTB will be used if the firmware does not pass in a DTB
37 pointer to the kernel. The corresponding DTS file is at
38 arch/mips/netlogic/dts/xlp_gvp.dts
39
31config NLM_MULTINODE 40config NLM_MULTINODE
32 bool "Support for multi-chip boards" 41 bool "Support for multi-chip boards"
33 depends on NLM_XLP_BOARD 42 depends on NLM_XLP_BOARD
diff --git a/arch/mips/netlogic/common/earlycons.c b/arch/mips/netlogic/common/earlycons.c
index 1902fa22d277..769f93032c53 100644
--- a/arch/mips/netlogic/common/earlycons.c
+++ b/arch/mips/netlogic/common/earlycons.c
@@ -37,9 +37,11 @@
37 37
38#include <asm/mipsregs.h> 38#include <asm/mipsregs.h>
39#include <asm/netlogic/haldefs.h> 39#include <asm/netlogic/haldefs.h>
40#include <asm/netlogic/common.h>
40 41
41#if defined(CONFIG_CPU_XLP) 42#if defined(CONFIG_CPU_XLP)
42#include <asm/netlogic/xlp-hal/iomap.h> 43#include <asm/netlogic/xlp-hal/iomap.h>
44#include <asm/netlogic/xlp-hal/xlp.h>
43#include <asm/netlogic/xlp-hal/uart.h> 45#include <asm/netlogic/xlp-hal/uart.h>
44#elif defined(CONFIG_CPU_XLR) 46#elif defined(CONFIG_CPU_XLR)
45#include <asm/netlogic/xlr/iomap.h> 47#include <asm/netlogic/xlr/iomap.h>
diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c
index 1c7e3a1b81ab..5afc4b7fce0f 100644
--- a/arch/mips/netlogic/common/irq.c
+++ b/arch/mips/netlogic/common/irq.c
@@ -180,6 +180,7 @@ static void __init nlm_init_percpu_irqs(void)
180#endif 180#endif
181} 181}
182 182
183
183void nlm_setup_pic_irq(int node, int picirq, int irq, int irt) 184void nlm_setup_pic_irq(int node, int picirq, int irq, int irt)
184{ 185{
185 struct nlm_pic_irq *pic_data; 186 struct nlm_pic_irq *pic_data;
@@ -207,32 +208,32 @@ void nlm_set_pic_extra_ack(int node, int irq, void (*xack)(struct irq_data *))
207 208
208static void nlm_init_node_irqs(int node) 209static void nlm_init_node_irqs(int node)
209{ 210{
210 int i, irt;
211 uint64_t irqmask;
212 struct nlm_soc_info *nodep; 211 struct nlm_soc_info *nodep;
212 int i, irt;
213 213
214 pr_info("Init IRQ for node %d\n", node); 214 pr_info("Init IRQ for node %d\n", node);
215 nodep = nlm_get_node(node); 215 nodep = nlm_get_node(node);
216 irqmask = PERCPU_IRQ_MASK; 216 nodep->irqmask = PERCPU_IRQ_MASK;
217 for (i = PIC_IRT_FIRST_IRQ; i <= PIC_IRT_LAST_IRQ; i++) { 217 for (i = PIC_IRT_FIRST_IRQ; i <= PIC_IRT_LAST_IRQ; i++) {
218 irt = nlm_irq_to_irt(i); 218 irt = nlm_irq_to_irt(i);
219 if (irt == -1) 219 if (irt == -1) /* unused irq */
220 continue; 220 continue;
221 nlm_setup_pic_irq(node, i, i, irt); 221 nodep->irqmask |= 1ull << i;
222 /* set interrupts to first cpu in node */ 222 if (irt == -2) /* not a direct PIC irq */
223 continue;
224
223 nlm_pic_init_irt(nodep->picbase, irt, i, 225 nlm_pic_init_irt(nodep->picbase, irt, i,
224 node * NLM_CPUS_PER_NODE, 0); 226 node * nlm_threads_per_node(), 0);
225 irqmask |= (1ull << i); 227 nlm_setup_pic_irq(node, i, i, irt);
226 } 228 }
227 nodep->irqmask = irqmask;
228} 229}
229 230
230void nlm_smp_irq_init(int hwcpuid) 231void nlm_smp_irq_init(int hwcpuid)
231{ 232{
232 int node, cpu; 233 int node, cpu;
233 234
234 node = hwcpuid / NLM_CPUS_PER_NODE; 235 node = nlm_cpuid_to_node(hwcpuid);
235 cpu = hwcpuid % NLM_CPUS_PER_NODE; 236 cpu = hwcpuid % nlm_threads_per_node();
236 237
237 if (cpu == 0 && node != 0) 238 if (cpu == 0 && node != 0)
238 nlm_init_node_irqs(node); 239 nlm_init_node_irqs(node);
@@ -256,13 +257,23 @@ asmlinkage void plat_irq_dispatch(void)
256 return; 257 return;
257 } 258 }
258 259
260#if defined(CONFIG_PCI_MSI) && defined(CONFIG_CPU_XLP)
261 /* PCI interrupts need a second level dispatch for MSI bits */
262 if (i >= PIC_PCIE_LINK_MSI_IRQ(0) && i <= PIC_PCIE_LINK_MSI_IRQ(3)) {
263 nlm_dispatch_msi(node, i);
264 return;
265 }
266 if (i >= PIC_PCIE_MSIX_IRQ(0) && i <= PIC_PCIE_MSIX_IRQ(3)) {
267 nlm_dispatch_msix(node, i);
268 return;
269 }
270
271#endif
259 /* top level irq handling */ 272 /* top level irq handling */
260 do_IRQ(nlm_irq_to_xirq(node, i)); 273 do_IRQ(nlm_irq_to_xirq(node, i));
261} 274}
262 275
263#ifdef CONFIG_OF 276#ifdef CONFIG_OF
264static struct irq_domain *xlp_pic_domain;
265
266static const struct irq_domain_ops xlp_pic_irq_domain_ops = { 277static const struct irq_domain_ops xlp_pic_irq_domain_ops = {
267 .xlate = irq_domain_xlate_onetwocell, 278 .xlate = irq_domain_xlate_onetwocell,
268}; 279};
@@ -271,8 +282,9 @@ static int __init xlp_of_pic_init(struct device_node *node,
271 struct device_node *parent) 282 struct device_node *parent)
272{ 283{
273 const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1; 284 const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1;
285 struct irq_domain *xlp_pic_domain;
274 struct resource res; 286 struct resource res;
275 int socid, ret; 287 int socid, ret, bus;
276 288
277 /* we need a hack to get the PIC's SoC chip id */ 289 /* we need a hack to get the PIC's SoC chip id */
278 ret = of_address_to_resource(node, 0, &res); 290 ret = of_address_to_resource(node, 0, &res);
@@ -280,7 +292,34 @@ static int __init xlp_of_pic_init(struct device_node *node,
280 pr_err("PIC %s: reg property not found!\n", node->name); 292 pr_err("PIC %s: reg property not found!\n", node->name);
281 return -EINVAL; 293 return -EINVAL;
282 } 294 }
283 socid = (res.start >> 18) & 0x3; 295
296 if (cpu_is_xlp9xx()) {
297 bus = (res.start >> 20) & 0xf;
298 for (socid = 0; socid < NLM_NR_NODES; socid++) {
299 if (!nlm_node_present(socid))
300 continue;
301 if (nlm_get_node(socid)->socbus == bus)
302 break;
303 }
304 if (socid == NLM_NR_NODES) {
305 pr_err("PIC %s: Node mapping for bus %d not found!\n",
306 node->name, bus);
307 return -EINVAL;
308 }
309 } else {
310 socid = (res.start >> 18) & 0x3;
311 if (!nlm_node_present(socid)) {
312 pr_err("PIC %s: node %d does not exist!\n",
313 node->name, socid);
314 return -EINVAL;
315 }
316 }
317
318 if (!nlm_node_present(socid)) {
319 pr_err("PIC %s: node %d does not exist!\n", node->name, socid);
320 return -EINVAL;
321 }
322
284 xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs, 323 xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs,
285 nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE, 324 nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE,
286 &xlp_pic_irq_domain_ops, NULL); 325 &xlp_pic_irq_domain_ops, NULL);
@@ -288,8 +327,7 @@ static int __init xlp_of_pic_init(struct device_node *node,
288 pr_err("PIC %s: Creating legacy domain failed!\n", node->name); 327 pr_err("PIC %s: Creating legacy domain failed!\n", node->name);
289 return -EINVAL; 328 return -EINVAL;
290 } 329 }
291 pr_info("Node %d: IRQ domain created for PIC@%pa\n", socid, 330 pr_info("Node %d: IRQ domain created for PIC@%pR\n", socid, &res);
292 &res.start);
293 return 0; 331 return 0;
294} 332}
295 333
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S
index adb18288a6c0..b231fe1e7a09 100644
--- a/arch/mips/netlogic/common/reset.S
+++ b/arch/mips/netlogic/common/reset.S
@@ -32,10 +32,10 @@
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <linux/init.h>
36 35
37#include <asm/asm.h> 36#include <asm/asm.h>
38#include <asm/asm-offsets.h> 37#include <asm/asm-offsets.h>
38#include <asm/cacheops.h>
39#include <asm/regdef.h> 39#include <asm/regdef.h>
40#include <asm/mipsregs.h> 40#include <asm/mipsregs.h>
41#include <asm/stackframe.h> 41#include <asm/stackframe.h>
@@ -50,8 +50,8 @@
50#include <asm/netlogic/xlp-hal/cpucontrol.h> 50#include <asm/netlogic/xlp-hal/cpucontrol.h>
51 51
52#define CP0_EBASE $15 52#define CP0_EBASE $15
53#define SYS_CPU_COHERENT_BASE(node) CKSEG1ADDR(XLP_DEFAULT_IO_BASE) + \ 53#define SYS_CPU_COHERENT_BASE CKSEG1ADDR(XLP_DEFAULT_IO_BASE) + \
54 XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \ 54 XLP_IO_SYS_OFFSET(0) + XLP_IO_PCI_HDRSZ + \
55 SYS_CPU_NONCOHERENT_MODE * 4 55 SYS_CPU_NONCOHERENT_MODE * 4
56 56
57/* Enable XLP features and workarounds in the LSU */ 57/* Enable XLP features and workarounds in the LSU */
@@ -74,35 +74,55 @@
74.endm 74.endm
75 75
76/* 76/*
77 * Low level flush for L1D cache on XLP, the normal cache ops does 77 * L1D cache has to be flushed before enabling threads in XLP.
78 * not do the complete and correct cache flush. 78 * On XLP8xx/XLP3xx, we do a low level flush using processor control
79 * registers. On XLPII CPUs, usual cache instructions work.
79 */ 80 */
80.macro xlp_flush_l1_dcache 81.macro xlp_flush_l1_dcache
82 mfc0 t0, CP0_EBASE, 0
83 andi t0, t0, 0xff00
84 slt t1, t0, 0x1200
85 beqz t1, 15f
86 nop
87
88 /* XLP8xx low level cache flush */
81 li t0, LSU_DEBUG_DATA0 89 li t0, LSU_DEBUG_DATA0
82 li t1, LSU_DEBUG_ADDR 90 li t1, LSU_DEBUG_ADDR
83 li t2, 0 /* index */ 91 li t2, 0 /* index */
84 li t3, 0x1000 /* loop count */ 92 li t3, 0x1000 /* loop count */
851: 9311:
86 sll v0, t2, 5 94 sll v0, t2, 5
87 mtcr zero, t0 95 mtcr zero, t0
88 ori v1, v0, 0x3 /* way0 | write_enable | write_active */ 96 ori v1, v0, 0x3 /* way0 | write_enable | write_active */
89 mtcr v1, t1 97 mtcr v1, t1
902: 9812:
91 mfcr v1, t1 99 mfcr v1, t1
92 andi v1, 0x1 /* wait for write_active == 0 */ 100 andi v1, 0x1 /* wait for write_active == 0 */
93 bnez v1, 2b 101 bnez v1, 12b
94 nop 102 nop
95 mtcr zero, t0 103 mtcr zero, t0
96 ori v1, v0, 0x7 /* way1 | write_enable | write_active */ 104 ori v1, v0, 0x7 /* way1 | write_enable | write_active */
97 mtcr v1, t1 105 mtcr v1, t1
983: 10613:
99 mfcr v1, t1 107 mfcr v1, t1
100 andi v1, 0x1 /* wait for write_active == 0 */ 108 andi v1, 0x1 /* wait for write_active == 0 */
101 bnez v1, 3b 109 bnez v1, 13b
102 nop 110 nop
103 addi t2, 1 111 addi t2, 1
104 bne t3, t2, 1b 112 bne t3, t2, 11b
113 nop
114 b 17f
115 nop
116
117 /* XLPII CPUs, Invalidate all 64k of L1 D-cache */
11815:
119 li t0, 0x80000000
120 li t1, 0x80010000
12116: cache Index_Writeback_Inv_D, 0(t0)
122 addiu t0, t0, 32
123 bne t0, t1, 16b
105 nop 124 nop
12517:
106.endm 126.endm
107 127
108/* 128/*
@@ -138,6 +158,13 @@ FEXPORT(nlm_reset_entry)
138 nop 158 nop
139 159
1401: /* Entry point on core wakeup */ 1601: /* Entry point on core wakeup */
161 mfc0 t0, CP0_EBASE, 0 /* processor ID */
162 andi t0, 0xff00
163 li t1, 0x1500 /* XLP 9xx */
164 beq t0, t1, 2f /* does not need to set coherent */
165 nop
166
167 /* set bit in SYS coherent register for the core */
141 mfc0 t0, CP0_EBASE, 1 168 mfc0 t0, CP0_EBASE, 1
142 mfc0 t1, CP0_EBASE, 1 169 mfc0 t1, CP0_EBASE, 1
143 srl t1, 5 170 srl t1, 5
@@ -149,7 +176,7 @@ FEXPORT(nlm_reset_entry)
149 li t1, 0x1 176 li t1, 0x1
150 sll t0, t1, t0 177 sll t0, t1, t0
151 nor t0, t0, zero /* t0 <- ~(1 << core) */ 178 nor t0, t0, zero /* t0 <- ~(1 << core) */
152 li t2, SYS_CPU_COHERENT_BASE(0) 179 li t2, SYS_CPU_COHERENT_BASE
153 add t2, t2, t3 /* t2 <- SYS offset for node */ 180 add t2, t2, t3 /* t2 <- SYS offset for node */
154 lw t1, 0(t2) 181 lw t1, 0(t2)
155 and t1, t1, t0 182 and t1, t1, t0
@@ -159,13 +186,13 @@ FEXPORT(nlm_reset_entry)
159 lw t1, 0(t2) 186 lw t1, 0(t2)
160 sync 187 sync
161 188
1892:
162 /* Configure LSU on Non-0 Cores. */ 190 /* Configure LSU on Non-0 Cores. */
163 xlp_config_lsu 191 xlp_config_lsu
164 /* FALL THROUGH */ 192 /* FALL THROUGH */
165 193
166/* 194/*
167 * Wake up sibling threads from the initial thread in 195 * Wake up sibling threads from the initial thread in a core.
168 * a core.
169 */ 196 */
170EXPORT(nlm_boot_siblings) 197EXPORT(nlm_boot_siblings)
171 /* core L1D flush before enable threads */ 198 /* core L1D flush before enable threads */
@@ -181,8 +208,10 @@ EXPORT(nlm_boot_siblings)
181 /* 208 /*
182 * The new hardware thread starts at the next instruction 209 * The new hardware thread starts at the next instruction
183 * For all the cases other than core 0 thread 0, we will 210 * For all the cases other than core 0 thread 0, we will
184 * jump to the secondary wait function. 211 * jump to the secondary wait function.
185 */ 212
213 * NOTE: All GPR contents are lost after the mtcr above!
214 */
186 mfc0 v0, CP0_EBASE, 1 215 mfc0 v0, CP0_EBASE, 1
187 andi v0, 0x3ff /* v0 <- node/core */ 216 andi v0, 0x3ff /* v0 <- node/core */
188 217
@@ -196,7 +225,7 @@ EXPORT(nlm_boot_siblings)
196#endif 225#endif
197 mtc0 t1, CP0_STATUS 226 mtc0 t1, CP0_STATUS
198 227
199 /* mark CPU ready, careful here, previous mtcr trashed registers */ 228 /* mark CPU ready */
200 li t3, CKSEG1ADDR(RESET_DATA_PHYS) 229 li t3, CKSEG1ADDR(RESET_DATA_PHYS)
201 ADDIU t1, t3, BOOT_CPU_READY 230 ADDIU t1, t3, BOOT_CPU_READY
202 sll v1, v0, 2 231 sll v1, v0, 2
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index c0eded01fde9..6baae15cc7b1 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -63,7 +63,7 @@ void nlm_send_ipi_single(int logical_cpu, unsigned int action)
63 uint64_t picbase; 63 uint64_t picbase;
64 64
65 cpu = cpu_logical_map(logical_cpu); 65 cpu = cpu_logical_map(logical_cpu);
66 node = cpu / NLM_CPUS_PER_NODE; 66 node = nlm_cpuid_to_node(cpu);
67 picbase = nlm_get_node(node)->picbase; 67 picbase = nlm_get_node(node)->picbase;
68 68
69 if (action & SMP_CALL_FUNCTION) 69 if (action & SMP_CALL_FUNCTION)
@@ -152,7 +152,7 @@ void nlm_boot_secondary(int logical_cpu, struct task_struct *idle)
152 int cpu, node; 152 int cpu, node;
153 153
154 cpu = cpu_logical_map(logical_cpu); 154 cpu = cpu_logical_map(logical_cpu);
155 node = cpu / NLM_CPUS_PER_NODE; 155 node = nlm_cpuid_to_node(logical_cpu);
156 nlm_next_sp = (unsigned long)__KSTK_TOS(idle); 156 nlm_next_sp = (unsigned long)__KSTK_TOS(idle);
157 nlm_next_gp = (unsigned long)task_thread_info(idle); 157 nlm_next_gp = (unsigned long)task_thread_info(idle);
158 158
@@ -164,7 +164,7 @@ void nlm_boot_secondary(int logical_cpu, struct task_struct *idle)
164void __init nlm_smp_setup(void) 164void __init nlm_smp_setup(void)
165{ 165{
166 unsigned int boot_cpu; 166 unsigned int boot_cpu;
167 int num_cpus, i, ncore; 167 int num_cpus, i, ncore, node;
168 volatile u32 *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY); 168 volatile u32 *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY);
169 char buf[64]; 169 char buf[64];
170 170
@@ -187,6 +187,8 @@ void __init nlm_smp_setup(void)
187 __cpu_number_map[i] = num_cpus; 187 __cpu_number_map[i] = num_cpus;
188 __cpu_logical_map[num_cpus] = i; 188 __cpu_logical_map[num_cpus] = i;
189 set_cpu_possible(num_cpus, true); 189 set_cpu_possible(num_cpus, true);
190 node = nlm_cpuid_to_node(i);
191 cpumask_set_cpu(num_cpus, &nlm_get_node(node)->cpumask);
190 ++num_cpus; 192 ++num_cpus;
191 } 193 }
192 } 194 }
diff --git a/arch/mips/netlogic/common/smpboot.S b/arch/mips/netlogic/common/smpboot.S
index aa6cff0a229b..8597657c27fc 100644
--- a/arch/mips/netlogic/common/smpboot.S
+++ b/arch/mips/netlogic/common/smpboot.S
@@ -32,7 +32,6 @@
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <linux/init.h>
36 35
37#include <asm/asm.h> 36#include <asm/asm.h>
38#include <asm/asm-offsets.h> 37#include <asm/asm-offsets.h>
@@ -98,7 +97,7 @@ END(nlm_boot_secondary_cpus)
98 * In case of RMIboot bootloader which is used on XLR boards, the CPUs 97 * In case of RMIboot bootloader which is used on XLR boards, the CPUs
99 * be already woken up and waiting in bootloader code. 98 * be already woken up and waiting in bootloader code.
100 * This will get them out of the bootloader code and into linux. Needed 99 * This will get them out of the bootloader code and into linux. Needed
101 * because the bootloader area will be taken and initialized by linux. 100 * because the bootloader area will be taken and initialized by linux.
102 */ 101 */
103NESTED(nlm_rmiboot_preboot, 16, sp) 102NESTED(nlm_rmiboot_preboot, 16, sp)
104 mfc0 t0, $15, 1 /* read ebase */ 103 mfc0 t0, $15, 1 /* read ebase */
@@ -133,6 +132,7 @@ NESTED(nlm_rmiboot_preboot, 16, sp)
133 or t1, t2, v1 /* put in new value */ 132 or t1, t2, v1 /* put in new value */
134 mtcr t1, t0 /* update core control */ 133 mtcr t1, t0 /* update core control */
135 134
135 /* wait for NMI to hit */
1361: wait 1361: wait
137 b 1b 137 b 1b
138 nop 138 nop
diff --git a/arch/mips/netlogic/dts/Makefile b/arch/mips/netlogic/dts/Makefile
index 0b9be5fd2e46..25c8e873ee25 100644
--- a/arch/mips/netlogic/dts/Makefile
+++ b/arch/mips/netlogic/dts/Makefile
@@ -1,3 +1,4 @@
1obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o 1obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o
2obj-$(CONFIG_DT_XLP_SVP) += xlp_svp.dtb.o 2obj-$(CONFIG_DT_XLP_SVP) += xlp_svp.dtb.o
3obj-$(CONFIG_DT_XLP_FVP) += xlp_fvp.dtb.o 3obj-$(CONFIG_DT_XLP_FVP) += xlp_fvp.dtb.o
4obj-$(CONFIG_DT_XLP_GVP) += xlp_gvp.dtb.o
diff --git a/arch/mips/netlogic/dts/xlp_gvp.dts b/arch/mips/netlogic/dts/xlp_gvp.dts
new file mode 100644
index 000000000000..047d27f54487
--- /dev/null
+++ b/arch/mips/netlogic/dts/xlp_gvp.dts
@@ -0,0 +1,76 @@
1/*
2 * XLP9XX Device Tree Source for GVP boards
3 */
4
5/dts-v1/;
6/ {
7 model = "netlogic,XLP-GVP";
8 compatible = "netlogic,xlp";
9 #address-cells = <2>;
10 #size-cells = <2>;
11
12 soc {
13 #address-cells = <2>;
14 #size-cells = <1>;
15 compatible = "simple-bus";
16 ranges = <0 0 0 0x18000000 0x04000000 // PCIe CFG
17 1 0 0 0x16000000 0x02000000>; // GBU chipselects
18
19 serial0: serial@30000 {
20 device_type = "serial";
21 compatible = "ns16550";
22 reg = <0 0x112100 0xa00>;
23 reg-shift = <2>;
24 reg-io-width = <4>;
25 clock-frequency = <125000000>;
26 interrupt-parent = <&pic>;
27 interrupts = <17>;
28 };
29 pic: pic@4000 {
30 interrupt-controller;
31 #address-cells = <0>;
32 #interrupt-cells = <1>;
33 reg = <0 0x110000 0x200>;
34 };
35
36 nor_flash@1,0 {
37 compatible = "cfi-flash";
38 #address-cells = <1>;
39 #size-cells = <1>;
40 bank-width = <2>;
41 reg = <1 0 0x1000000>;
42
43 partition@0 {
44 label = "x-loader";
45 reg = <0x0 0x100000>; /* 1M */
46 read-only;
47 };
48
49 partition@100000 {
50 label = "u-boot";
51 reg = <0x100000 0x100000>; /* 1M */
52 };
53
54 partition@200000 {
55 label = "kernel";
56 reg = <0x200000 0x500000>; /* 5M */
57 };
58
59 partition@700000 {
60 label = "rootfs";
61 reg = <0x700000 0x800000>; /* 8M */
62 };
63
64 partition@f00000 {
65 label = "env";
66 reg = <0xf00000 0x100000>; /* 1M */
67 read-only;
68 };
69 };
70
71 };
72
73 chosen {
74 bootargs = "console=ttyS0,115200 rdinit=/sbin/init";
75 };
76};
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 8316d5454b17..5754097b9cde 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -42,13 +42,18 @@
42#include <asm/prom.h> 42#include <asm/prom.h>
43 43
44extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], 44extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
45 __dtb_xlp_fvp_begin[], __dtb_start[]; 45 __dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[], __dtb_start[];
46static void *xlp_fdt_blob; 46static void *xlp_fdt_blob;
47 47
48void __init *xlp_dt_init(void *fdtp) 48void __init *xlp_dt_init(void *fdtp)
49{ 49{
50 if (!fdtp) { 50 if (!fdtp) {
51 switch (current_cpu_data.processor_id & 0xff00) { 51 switch (current_cpu_data.processor_id & 0xff00) {
52#ifdef CONFIG_DT_XLP_GVP
53 case PRID_IMP_NETLOGIC_XLP9XX:
54 fdtp = __dtb_xlp_gvp_begin;
55 break;
56#endif
52#ifdef CONFIG_DT_XLP_FVP 57#ifdef CONFIG_DT_XLP_FVP
53 case PRID_IMP_NETLOGIC_XLP2XX: 58 case PRID_IMP_NETLOGIC_XLP2XX:
54 fdtp = __dtb_xlp_fvp_begin; 59 fdtp = __dtb_xlp_fvp_begin;
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c
index 56c50ba43c9b..997cd9ee10de 100644
--- a/arch/mips/netlogic/xlp/nlm_hal.c
+++ b/arch/mips/netlogic/xlp/nlm_hal.c
@@ -57,6 +57,10 @@ void nlm_node_init(int node)
57 nodep->sysbase = nlm_get_sys_regbase(node); 57 nodep->sysbase = nlm_get_sys_regbase(node);
58 nodep->picbase = nlm_get_pic_regbase(node); 58 nodep->picbase = nlm_get_pic_regbase(node);
59 nodep->ebase = read_c0_ebase() & (~((1 << 12) - 1)); 59 nodep->ebase = read_c0_ebase() & (~((1 << 12) - 1));
60 if (cpu_is_xlp9xx())
61 nodep->socbus = xlp9xx_get_socbus(node);
62 else
63 nodep->socbus = 0;
60 spin_lock_init(&nodep->piclock); 64 spin_lock_init(&nodep->piclock);
61} 65}
62 66
@@ -65,6 +69,26 @@ int nlm_irq_to_irt(int irq)
65 uint64_t pcibase; 69 uint64_t pcibase;
66 int devoff, irt; 70 int devoff, irt;
67 71
72 /* bypass for 9xx */
73 if (cpu_is_xlp9xx()) {
74 switch (irq) {
75 case PIC_9XX_XHCI_0_IRQ:
76 return 114;
77 case PIC_9XX_XHCI_1_IRQ:
78 return 115;
79 case PIC_UART_0_IRQ:
80 return 133;
81 case PIC_UART_1_IRQ:
82 return 134;
83 case PIC_PCIE_LINK_LEGACY_IRQ(0):
84 case PIC_PCIE_LINK_LEGACY_IRQ(1):
85 case PIC_PCIE_LINK_LEGACY_IRQ(2):
86 case PIC_PCIE_LINK_LEGACY_IRQ(3):
87 return 191 + irq - PIC_PCIE_LINK_LEGACY_IRQ_BASE;
88 }
89 return -1;
90 }
91
68 devoff = 0; 92 devoff = 0;
69 switch (irq) { 93 switch (irq) {
70 case PIC_UART_0_IRQ: 94 case PIC_UART_0_IRQ:
@@ -135,9 +159,17 @@ int nlm_irq_to_irt(int irq)
135 case PIC_I2C_3_IRQ: 159 case PIC_I2C_3_IRQ:
136 irt = irt + 3; break; 160 irt = irt + 3; break;
137 } 161 }
138 } else if (irq >= PIC_PCIE_LINK_0_IRQ && irq <= PIC_PCIE_LINK_3_IRQ) { 162 } else if (irq >= PIC_PCIE_LINK_LEGACY_IRQ(0) &&
163 irq <= PIC_PCIE_LINK_LEGACY_IRQ(3)) {
139 /* HW bug, PCI IRT entries are bad on early silicon, fix */ 164 /* HW bug, PCI IRT entries are bad on early silicon, fix */
140 irt = PIC_IRT_PCIE_LINK_INDEX(irq - PIC_PCIE_LINK_0_IRQ); 165 irt = PIC_IRT_PCIE_LINK_INDEX(irq -
166 PIC_PCIE_LINK_LEGACY_IRQ_BASE);
167 } else if (irq >= PIC_PCIE_LINK_MSI_IRQ(0) &&
168 irq <= PIC_PCIE_LINK_MSI_IRQ(3)) {
169 irt = -2;
170 } else if (irq >= PIC_PCIE_MSIX_IRQ(0) &&
171 irq <= PIC_PCIE_MSIX_IRQ(3)) {
172 irt = -2;
141 } else { 173 } else {
142 irt = -1; 174 irt = -1;
143 } 175 }
@@ -151,7 +183,10 @@ unsigned int nlm_get_core_frequency(int node, int core)
151 uint64_t num, sysbase; 183 uint64_t num, sysbase;
152 184
153 sysbase = nlm_get_node(node)->sysbase; 185 sysbase = nlm_get_node(node)->sysbase;
154 rstval = nlm_read_sys_reg(sysbase, SYS_POWER_ON_RESET_CFG); 186 if (cpu_is_xlp9xx())
187 rstval = nlm_read_sys_reg(sysbase, SYS_9XX_POWER_ON_RESET_CFG);
188 else
189 rstval = nlm_read_sys_reg(sysbase, SYS_POWER_ON_RESET_CFG);
155 if (cpu_is_xlpii()) { 190 if (cpu_is_xlpii()) {
156 num = 1000000ULL * (400 * 3 + 100 * (rstval >> 26)); 191 num = 1000000ULL * (400 * 3 + 100 * (rstval >> 26));
157 denom = 3; 192 denom = 3;
@@ -265,6 +300,10 @@ static unsigned int nlm_2xx_get_pic_frequency(int node)
265 300
266unsigned int nlm_get_pic_frequency(int node) 301unsigned int nlm_get_pic_frequency(int node)
267{ 302{
303 /* TODO Has to calculate freq as like 2xx */
304 if (cpu_is_xlp9xx())
305 return 250000000;
306
268 if (cpu_is_xlpii()) 307 if (cpu_is_xlpii())
269 return nlm_2xx_get_pic_frequency(node); 308 return nlm_2xx_get_pic_frequency(node);
270 else 309 else
@@ -284,21 +323,33 @@ int xlp_get_dram_map(int n, uint64_t *dram_map)
284{ 323{
285 uint64_t bridgebase, base, lim; 324 uint64_t bridgebase, base, lim;
286 uint32_t val; 325 uint32_t val;
326 unsigned int barreg, limreg, xlatreg;
287 int i, node, rv; 327 int i, node, rv;
288 328
289 /* Look only at mapping on Node 0, we don't handle crazy configs */ 329 /* Look only at mapping on Node 0, we don't handle crazy configs */
290 bridgebase = nlm_get_bridge_regbase(0); 330 bridgebase = nlm_get_bridge_regbase(0);
291 rv = 0; 331 rv = 0;
292 for (i = 0; i < 8; i++) { 332 for (i = 0; i < 8; i++) {
293 val = nlm_read_bridge_reg(bridgebase, 333 if (cpu_is_xlp9xx()) {
294 BRIDGE_DRAM_NODE_TRANSLN(i)); 334 barreg = BRIDGE_9XX_DRAM_BAR(i);
295 node = (val >> 1) & 0x3; 335 limreg = BRIDGE_9XX_DRAM_LIMIT(i);
296 if (n >= 0 && n != node) 336 xlatreg = BRIDGE_9XX_DRAM_NODE_TRANSLN(i);
297 continue; 337 } else {
298 val = nlm_read_bridge_reg(bridgebase, BRIDGE_DRAM_BAR(i)); 338 barreg = BRIDGE_DRAM_BAR(i);
339 limreg = BRIDGE_DRAM_LIMIT(i);
340 xlatreg = BRIDGE_DRAM_NODE_TRANSLN(i);
341 }
342 if (n >= 0) {
343 /* node specified, get node mapping of BAR */
344 val = nlm_read_bridge_reg(bridgebase, xlatreg);
345 node = (val >> 1) & 0x3;
346 if (n != node)
347 continue;
348 }
349 val = nlm_read_bridge_reg(bridgebase, barreg);
299 val = (val >> 12) & 0xfffff; 350 val = (val >> 12) & 0xfffff;
300 base = (uint64_t) val << 20; 351 base = (uint64_t) val << 20;
301 val = nlm_read_bridge_reg(bridgebase, BRIDGE_DRAM_LIMIT(i)); 352 val = nlm_read_bridge_reg(bridgebase, limreg);
302 val = (val >> 12) & 0xfffff; 353 val = (val >> 12) & 0xfffff;
303 if (val == 0) /* BAR not used */ 354 if (val == 0) /* BAR not used */
304 continue; 355 continue;
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index 54e75c77184b..8c60a2dd9ef6 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -51,12 +51,16 @@ uint64_t nlm_io_base;
51struct nlm_soc_info nlm_nodes[NLM_NR_NODES]; 51struct nlm_soc_info nlm_nodes[NLM_NR_NODES];
52cpumask_t nlm_cpumask = CPU_MASK_CPU0; 52cpumask_t nlm_cpumask = CPU_MASK_CPU0;
53unsigned int nlm_threads_per_core; 53unsigned int nlm_threads_per_core;
54unsigned int xlp_cores_per_node;
54 55
55static void nlm_linux_exit(void) 56static void nlm_linux_exit(void)
56{ 57{
57 uint64_t sysbase = nlm_get_node(0)->sysbase; 58 uint64_t sysbase = nlm_get_node(0)->sysbase;
58 59
59 nlm_write_sys_reg(sysbase, SYS_CHIP_RESET, 1); 60 if (cpu_is_xlp9xx())
61 nlm_write_sys_reg(sysbase, SYS_9XX_CHIP_RESET, 1);
62 else
63 nlm_write_sys_reg(sysbase, SYS_CHIP_RESET, 1);
60 for ( ; ; ) 64 for ( ; ; )
61 cpu_wait(); 65 cpu_wait();
62} 66}
@@ -92,6 +96,14 @@ static void __init xlp_init_mem_from_bars(void)
92 96
93void __init plat_mem_setup(void) 97void __init plat_mem_setup(void)
94{ 98{
99#ifdef CONFIG_SMP
100 nlm_wakeup_secondary_cpus();
101
102 /* update TLB size after waking up threads */
103 current_cpu_data.tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
104
105 register_smp_ops(&nlm_smp_ops);
106#endif
95 _machine_restart = (void (*)(char *))nlm_linux_exit; 107 _machine_restart = (void (*)(char *))nlm_linux_exit;
96 _machine_halt = nlm_linux_exit; 108 _machine_halt = nlm_linux_exit;
97 pm_power_off = nlm_linux_exit; 109 pm_power_off = nlm_linux_exit;
@@ -110,6 +122,7 @@ void __init plat_mem_setup(void)
110const char *get_system_type(void) 122const char *get_system_type(void)
111{ 123{
112 switch (read_c0_prid() & 0xff00) { 124 switch (read_c0_prid() & 0xff00) {
125 case PRID_IMP_NETLOGIC_XLP9XX:
113 case PRID_IMP_NETLOGIC_XLP2XX: 126 case PRID_IMP_NETLOGIC_XLP2XX:
114 return "Broadcom XLPII Series"; 127 return "Broadcom XLPII Series";
115 default: 128 default:
@@ -149,6 +162,10 @@ void __init prom_init(void)
149 void *reset_vec; 162 void *reset_vec;
150 163
151 nlm_io_base = CKSEG1ADDR(XLP_DEFAULT_IO_BASE); 164 nlm_io_base = CKSEG1ADDR(XLP_DEFAULT_IO_BASE);
165 if (cpu_is_xlp9xx())
166 xlp_cores_per_node = 32;
167 else
168 xlp_cores_per_node = 8;
152 nlm_init_boot_cpu(); 169 nlm_init_boot_cpu();
153 xlp_mmu_init(); 170 xlp_mmu_init();
154 nlm_node_init(0); 171 nlm_node_init(0);
@@ -162,11 +179,5 @@ void __init prom_init(void)
162 179
163#ifdef CONFIG_SMP 180#ifdef CONFIG_SMP
164 cpumask_setall(&nlm_cpumask); 181 cpumask_setall(&nlm_cpumask);
165 nlm_wakeup_secondary_cpus();
166
167 /* update TLB size after waking up threads */
168 current_cpu_data.tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
169
170 register_smp_ops(&nlm_smp_ops);
171#endif 182#endif
172} 183}
diff --git a/arch/mips/netlogic/xlp/usb-init-xlp2.c b/arch/mips/netlogic/xlp/usb-init-xlp2.c
index 36e9c22afc46..17ade1ce5dfd 100644
--- a/arch/mips/netlogic/xlp/usb-init-xlp2.c
+++ b/arch/mips/netlogic/xlp/usb-init-xlp2.c
@@ -37,6 +37,7 @@
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/pci_ids.h>
40#include <linux/platform_device.h> 41#include <linux/platform_device.h>
41#include <linux/irq.h> 42#include <linux/irq.h>
42 43
@@ -83,12 +84,14 @@
83#define nlm_read_usb_reg(b, r) nlm_read_reg(b, r) 84#define nlm_read_usb_reg(b, r) nlm_read_reg(b, r)
84#define nlm_write_usb_reg(b, r, v) nlm_write_reg(b, r, v) 85#define nlm_write_usb_reg(b, r, v) nlm_write_reg(b, r, v)
85 86
86#define nlm_xlpii_get_usb_pcibase(node, inst) \ 87#define nlm_xlpii_get_usb_pcibase(node, inst) \
87 nlm_pcicfg_base(XLP2XX_IO_USB_OFFSET(node, inst)) 88 nlm_pcicfg_base(cpu_is_xlp9xx() ? \
89 XLP9XX_IO_USB_OFFSET(node, inst) : \
90 XLP2XX_IO_USB_OFFSET(node, inst))
88#define nlm_xlpii_get_usb_regbase(node, inst) \ 91#define nlm_xlpii_get_usb_regbase(node, inst) \
89 (nlm_xlpii_get_usb_pcibase(node, inst) + XLP_IO_PCI_HDRSZ) 92 (nlm_xlpii_get_usb_pcibase(node, inst) + XLP_IO_PCI_HDRSZ)
90 93
91static void xlpii_usb_ack(struct irq_data *data) 94static void xlp2xx_usb_ack(struct irq_data *data)
92{ 95{
93 u64 port_addr; 96 u64 port_addr;
94 97
@@ -109,6 +112,29 @@ static void xlpii_usb_ack(struct irq_data *data)
109 nlm_write_usb_reg(port_addr, XLPII_USB3_INT_REG, 0xffffffff); 112 nlm_write_usb_reg(port_addr, XLPII_USB3_INT_REG, 0xffffffff);
110} 113}
111 114
115static void xlp9xx_usb_ack(struct irq_data *data)
116{
117 u64 port_addr;
118 int node, irq;
119
120 /* Find the node and irq on the node */
121 irq = data->irq % NLM_IRQS_PER_NODE;
122 node = data->irq / NLM_IRQS_PER_NODE;
123
124 switch (irq) {
125 case PIC_9XX_XHCI_0_IRQ:
126 port_addr = nlm_xlpii_get_usb_regbase(node, 1);
127 break;
128 case PIC_9XX_XHCI_1_IRQ:
129 port_addr = nlm_xlpii_get_usb_regbase(node, 2);
130 break;
131 default:
132 pr_err("No matching USB irq %d node %d!\n", irq, node);
133 return;
134 }
135 nlm_write_usb_reg(port_addr, XLPII_USB3_INT_REG, 0xffffffff);
136}
137
112static void nlm_xlpii_usb_hw_reset(int node, int port) 138static void nlm_xlpii_usb_hw_reset(int node, int port)
113{ 139{
114 u64 port_addr, xhci_base, pci_base; 140 u64 port_addr, xhci_base, pci_base;
@@ -178,17 +204,33 @@ static void nlm_xlpii_usb_hw_reset(int node, int port)
178 204
179static int __init nlm_platform_xlpii_usb_init(void) 205static int __init nlm_platform_xlpii_usb_init(void)
180{ 206{
207 int node;
208
181 if (!cpu_is_xlpii()) 209 if (!cpu_is_xlpii())
182 return 0; 210 return 0;
183 211
184 pr_info("Initializing 2XX USB Interface\n"); 212 if (!cpu_is_xlp9xx()) {
185 nlm_xlpii_usb_hw_reset(0, 1); 213 /* XLP 2XX single node */
186 nlm_xlpii_usb_hw_reset(0, 2); 214 pr_info("Initializing 2XX USB Interface\n");
187 nlm_xlpii_usb_hw_reset(0, 3); 215 nlm_xlpii_usb_hw_reset(0, 1);
188 nlm_set_pic_extra_ack(0, PIC_2XX_XHCI_0_IRQ, xlpii_usb_ack); 216 nlm_xlpii_usb_hw_reset(0, 2);
189 nlm_set_pic_extra_ack(0, PIC_2XX_XHCI_1_IRQ, xlpii_usb_ack); 217 nlm_xlpii_usb_hw_reset(0, 3);
190 nlm_set_pic_extra_ack(0, PIC_2XX_XHCI_2_IRQ, xlpii_usb_ack); 218 nlm_set_pic_extra_ack(0, PIC_2XX_XHCI_0_IRQ, xlp2xx_usb_ack);
219 nlm_set_pic_extra_ack(0, PIC_2XX_XHCI_1_IRQ, xlp2xx_usb_ack);
220 nlm_set_pic_extra_ack(0, PIC_2XX_XHCI_2_IRQ, xlp2xx_usb_ack);
221 return 0;
222 }
191 223
224 /* XLP 9XX, multi-node */
225 pr_info("Initializing 9XX USB Interface\n");
226 for (node = 0; node < NLM_NR_NODES; node++) {
227 if (!nlm_node_present(node))
228 continue;
229 nlm_xlpii_usb_hw_reset(node, 1);
230 nlm_xlpii_usb_hw_reset(node, 2);
231 nlm_set_pic_extra_ack(node, PIC_9XX_XHCI_0_IRQ, xlp9xx_usb_ack);
232 nlm_set_pic_extra_ack(node, PIC_9XX_XHCI_1_IRQ, xlp9xx_usb_ack);
233 }
192 return 0; 234 return 0;
193} 235}
194 236
@@ -196,8 +238,26 @@ arch_initcall(nlm_platform_xlpii_usb_init);
196 238
197static u64 xlp_usb_dmamask = ~(u32)0; 239static u64 xlp_usb_dmamask = ~(u32)0;
198 240
199/* Fixup IRQ for USB devices on XLP the SoC PCIe bus */ 241/* Fixup the IRQ for USB devices which is exist on XLP9XX SOC PCIE bus */
200static void nlm_usb_fixup_final(struct pci_dev *dev) 242static void nlm_xlp9xx_usb_fixup_final(struct pci_dev *dev)
243{
244 int node;
245
246 node = xlp_socdev_to_node(dev);
247 dev->dev.dma_mask = &xlp_usb_dmamask;
248 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
249 switch (dev->devfn) {
250 case 0x21:
251 dev->irq = nlm_irq_to_xirq(node, PIC_9XX_XHCI_0_IRQ);
252 break;
253 case 0x22:
254 dev->irq = nlm_irq_to_xirq(node, PIC_9XX_XHCI_1_IRQ);
255 break;
256 }
257}
258
259/* Fixup the IRQ for USB devices which is exist on XLP2XX SOC PCIE bus */
260static void nlm_xlp2xx_usb_fixup_final(struct pci_dev *dev)
201{ 261{
202 dev->dev.dma_mask = &xlp_usb_dmamask; 262 dev->dev.dma_mask = &xlp_usb_dmamask;
203 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 263 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
@@ -214,5 +274,7 @@ static void nlm_usb_fixup_final(struct pci_dev *dev)
214 } 274 }
215} 275}
216 276
277DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_XLP9XX_XHCI,
278 nlm_xlp9xx_usb_fixup_final);
217DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_NETLOGIC, PCI_DEVICE_ID_NLM_XHCI, 279DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_NETLOGIC, PCI_DEVICE_ID_NLM_XHCI,
218 nlm_usb_fixup_final); 280 nlm_xlp2xx_usb_fixup_final);
diff --git a/arch/mips/netlogic/xlp/wakeup.c b/arch/mips/netlogic/xlp/wakeup.c
index 682d5638dc01..9a92617a2af5 100644
--- a/arch/mips/netlogic/xlp/wakeup.c
+++ b/arch/mips/netlogic/xlp/wakeup.c
@@ -32,7 +32,6 @@
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <linux/init.h>
36#include <linux/kernel.h> 35#include <linux/kernel.h>
37#include <linux/threads.h> 36#include <linux/threads.h>
38 37
@@ -47,14 +46,14 @@
47#include <asm/netlogic/mips-extns.h> 46#include <asm/netlogic/mips-extns.h>
48 47
49#include <asm/netlogic/xlp-hal/iomap.h> 48#include <asm/netlogic/xlp-hal/iomap.h>
50#include <asm/netlogic/xlp-hal/pic.h>
51#include <asm/netlogic/xlp-hal/xlp.h> 49#include <asm/netlogic/xlp-hal/xlp.h>
50#include <asm/netlogic/xlp-hal/pic.h>
52#include <asm/netlogic/xlp-hal/sys.h> 51#include <asm/netlogic/xlp-hal/sys.h>
53 52
54static int xlp_wakeup_core(uint64_t sysbase, int node, int core) 53static int xlp_wakeup_core(uint64_t sysbase, int node, int core)
55{ 54{
56 uint32_t coremask, value; 55 uint32_t coremask, value;
57 int count; 56 int count, resetreg;
58 57
59 coremask = (1 << core); 58 coremask = (1 << core);
60 59
@@ -65,12 +64,24 @@ static int xlp_wakeup_core(uint64_t sysbase, int node, int core)
65 nlm_write_sys_reg(sysbase, SYS_CORE_DFS_DIS_CTRL, value); 64 nlm_write_sys_reg(sysbase, SYS_CORE_DFS_DIS_CTRL, value);
66 } 65 }
67 66
67 /* On 9XX, mark coherent first */
68 if (cpu_is_xlp9xx()) {
69 value = nlm_read_sys_reg(sysbase, SYS_9XX_CPU_NONCOHERENT_MODE);
70 value &= ~coremask;
71 nlm_write_sys_reg(sysbase, SYS_9XX_CPU_NONCOHERENT_MODE, value);
72 }
73
68 /* Remove CPU Reset */ 74 /* Remove CPU Reset */
69 value = nlm_read_sys_reg(sysbase, SYS_CPU_RESET); 75 resetreg = cpu_is_xlp9xx() ? SYS_9XX_CPU_RESET : SYS_CPU_RESET;
76 value = nlm_read_sys_reg(sysbase, resetreg);
70 value &= ~coremask; 77 value &= ~coremask;
71 nlm_write_sys_reg(sysbase, SYS_CPU_RESET, value); 78 nlm_write_sys_reg(sysbase, resetreg, value);
79
80 /* We are done on 9XX */
81 if (cpu_is_xlp9xx())
82 return 1;
72 83
73 /* Poll for CPU to mark itself coherent */ 84 /* Poll for CPU to mark itself coherent on other type of XLP */
74 count = 100000; 85 count = 100000;
75 do { 86 do {
76 value = nlm_read_sys_reg(sysbase, SYS_CPU_NONCOHERENT_MODE); 87 value = nlm_read_sys_reg(sysbase, SYS_CPU_NONCOHERENT_MODE);
@@ -84,7 +95,7 @@ static int wait_for_cpus(int cpu, int bootcpu)
84 volatile uint32_t *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY); 95 volatile uint32_t *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY);
85 int i, count, notready; 96 int i, count, notready;
86 97
87 count = 0x20000000; 98 count = 0x800000;
88 do { 99 do {
89 notready = nlm_threads_per_core; 100 notready = nlm_threads_per_core;
90 for (i = 0; i < nlm_threads_per_core; i++) 101 for (i = 0; i < nlm_threads_per_core; i++)
@@ -98,27 +109,62 @@ static int wait_for_cpus(int cpu, int bootcpu)
98static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask) 109static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)
99{ 110{
100 struct nlm_soc_info *nodep; 111 struct nlm_soc_info *nodep;
101 uint64_t syspcibase; 112 uint64_t syspcibase, fusebase;
102 uint32_t syscoremask; 113 uint32_t syscoremask, mask, fusemask;
103 int core, n, cpu; 114 int core, n, cpu;
104 115
105 for (n = 0; n < NLM_NR_NODES; n++) { 116 for (n = 0; n < NLM_NR_NODES; n++) {
106 syspcibase = nlm_get_sys_pcibase(n); 117 if (n != 0) {
107 if (nlm_read_reg(syspcibase, 0) == 0xffffffff) 118 /* check if node exists and is online */
108 break; 119 if (cpu_is_xlp9xx()) {
120 int b = xlp9xx_get_socbus(n);
121 pr_info("Node %d SoC PCI bus %d.\n", n, b);
122 if (b == 0)
123 break;
124 } else {
125 syspcibase = nlm_get_sys_pcibase(n);
126 if (nlm_read_reg(syspcibase, 0) == 0xffffffff)
127 break;
128 }
129 nlm_node_init(n);
130 }
109 131
110 /* read cores in reset from SYS */ 132 /* read cores in reset from SYS */
111 if (n != 0)
112 nlm_node_init(n);
113 nodep = nlm_get_node(n); 133 nodep = nlm_get_node(n);
114 syscoremask = nlm_read_sys_reg(nodep->sysbase, SYS_CPU_RESET); 134
135 if (cpu_is_xlp9xx()) {
136 fusebase = nlm_get_fuse_regbase(n);
137 fusemask = nlm_read_reg(fusebase, FUSE_9XX_DEVCFG6);
138 mask = 0xfffff;
139 } else {
140 fusemask = nlm_read_sys_reg(nodep->sysbase,
141 SYS_EFUSE_DEVICE_CFG_STATUS0);
142 switch (read_c0_prid() & 0xff00) {
143 case PRID_IMP_NETLOGIC_XLP3XX:
144 mask = 0xf;
145 break;
146 case PRID_IMP_NETLOGIC_XLP2XX:
147 mask = 0x3;
148 break;
149 case PRID_IMP_NETLOGIC_XLP8XX:
150 default:
151 mask = 0xff;
152 break;
153 }
154 }
155
156 /*
157 * Fused out cores are set in the fusemask, and the remaining
158 * cores are renumbered to range 0 .. nactive-1
159 */
160 syscoremask = (1 << hweight32(~fusemask & mask)) - 1;
161
115 /* The boot cpu */ 162 /* The boot cpu */
116 if (n == 0) { 163 if (n == 0)
117 syscoremask |= 1;
118 nodep->coremask = 1; 164 nodep->coremask = 1;
119 }
120 165
121 for (core = 0; core < NLM_CORES_PER_NODE; core++) { 166 pr_info("Node %d - SYS/FUSE coremask %x\n", n, syscoremask);
167 for (core = 0; core < nlm_cores_per_node(); core++) {
122 /* we will be on node 0 core 0 */ 168 /* we will be on node 0 core 0 */
123 if (n == 0 && core == 0) 169 if (n == 0 && core == 0)
124 continue; 170 continue;
@@ -128,7 +174,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)
128 continue; 174 continue;
129 175
130 /* see if at least the first hw thread is enabled */ 176 /* see if at least the first hw thread is enabled */
131 cpu = (n * NLM_CORES_PER_NODE + core) 177 cpu = (n * nlm_cores_per_node() + core)
132 * NLM_THREADS_PER_CORE; 178 * NLM_THREADS_PER_CORE;
133 if (!cpumask_test_cpu(cpu, wakeup_mask)) 179 if (!cpumask_test_cpu(cpu, wakeup_mask))
134 continue; 180 continue;
@@ -141,7 +187,8 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)
141 nodep->coremask |= 1u << core; 187 nodep->coremask |= 1u << core;
142 188
143 /* spin until the hw threads sets their ready */ 189 /* spin until the hw threads sets their ready */
144 wait_for_cpus(cpu, 0); 190 if (!wait_for_cpus(cpu, 0))
191 pr_err("Node %d : timeout core %d\n", n, core);
145 } 192 }
146 } 193 }
147} 194}
@@ -153,7 +200,8 @@ void xlp_wakeup_secondary_cpus()
153 * first wakeup core 0 threads 200 * first wakeup core 0 threads
154 */ 201 */
155 xlp_boot_core0_siblings(); 202 xlp_boot_core0_siblings();
156 wait_for_cpus(0, 0); 203 if (!wait_for_cpus(0, 0))
204 pr_err("Node 0 : timeout core 0\n");
157 205
158 /* now get other cores out of reset */ 206 /* now get other cores out of reset */
159 xlp_enable_secondary_cores(&nlm_cpumask); 207 xlp_enable_secondary_cores(&nlm_cpumask);
diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c
index 7b96a91f4773..4785932af248 100644
--- a/arch/mips/netlogic/xlr/platform.c
+++ b/arch/mips/netlogic/xlr/platform.c
@@ -23,7 +23,7 @@
23#include <asm/netlogic/xlr/pic.h> 23#include <asm/netlogic/xlr/pic.h>
24#include <asm/netlogic/xlr/xlr.h> 24#include <asm/netlogic/xlr/xlr.h>
25 25
26unsigned int nlm_xlr_uart_in(struct uart_port *p, int offset) 26static unsigned int nlm_xlr_uart_in(struct uart_port *p, int offset)
27{ 27{
28 uint64_t uartbase; 28 uint64_t uartbase;
29 unsigned int value; 29 unsigned int value;
@@ -41,7 +41,7 @@ unsigned int nlm_xlr_uart_in(struct uart_port *p, int offset)
41 return value; 41 return value;
42} 42}
43 43
44void nlm_xlr_uart_out(struct uart_port *p, int offset, int value) 44static void nlm_xlr_uart_out(struct uart_port *p, int offset, int value)
45{ 45{
46 uint64_t uartbase; 46 uint64_t uartbase;
47 47
diff --git a/arch/mips/netlogic/xlr/setup.c b/arch/mips/netlogic/xlr/setup.c
index 921be5f77797..d118b9aa7647 100644
--- a/arch/mips/netlogic/xlr/setup.c
+++ b/arch/mips/netlogic/xlr/setup.c
@@ -60,25 +60,6 @@ unsigned int nlm_threads_per_core = 1;
60struct nlm_soc_info nlm_nodes[NLM_NR_NODES]; 60struct nlm_soc_info nlm_nodes[NLM_NR_NODES];
61cpumask_t nlm_cpumask = CPU_MASK_CPU0; 61cpumask_t nlm_cpumask = CPU_MASK_CPU0;
62 62
63static void __init nlm_early_serial_setup(void)
64{
65 struct uart_port s;
66 unsigned long uart_base;
67
68 uart_base = (unsigned long)nlm_mmio_base(NETLOGIC_IO_UART_0_OFFSET);
69 memset(&s, 0, sizeof(s));
70 s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
71 s.iotype = UPIO_MEM32;
72 s.regshift = 2;
73 s.irq = PIC_UART_0_IRQ;
74 s.uartclk = PIC_CLK_HZ;
75 s.serial_in = nlm_xlr_uart_in;
76 s.serial_out = nlm_xlr_uart_out;
77 s.mapbase = uart_base;
78 s.membase = (unsigned char __iomem *)uart_base;
79 early_serial_setup(&s);
80}
81
82static void nlm_linux_exit(void) 63static void nlm_linux_exit(void)
83{ 64{
84 uint64_t gpiobase; 65 uint64_t gpiobase;
@@ -214,7 +195,6 @@ void __init prom_init(void)
214 memcpy(reset_vec, (void *)nlm_reset_entry, 195 memcpy(reset_vec, (void *)nlm_reset_entry,
215 (nlm_reset_entry_end - nlm_reset_entry)); 196 (nlm_reset_entry_end - nlm_reset_entry));
216 197
217 nlm_early_serial_setup();
218 build_arcs_cmdline(argv); 198 build_arcs_cmdline(argv);
219 prom_add_memory(); 199 prom_add_memory();
220 200
diff --git a/arch/mips/netlogic/xlr/wakeup.c b/arch/mips/netlogic/xlr/wakeup.c
index 9fb81fa6272a..d61cba1e9c65 100644
--- a/arch/mips/netlogic/xlr/wakeup.c
+++ b/arch/mips/netlogic/xlr/wakeup.c
@@ -32,7 +32,6 @@
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <linux/init.h>
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <linux/threads.h> 36#include <linux/threads.h>
38 37
@@ -70,7 +69,7 @@ int xlr_wakeup_secondary_cpus(void)
70 69
71 /* Fill up the coremask early */ 70 /* Fill up the coremask early */
72 nodep->coremask = 1; 71 nodep->coremask = 1;
73 for (i = 1; i < NLM_CORES_PER_NODE; i++) { 72 for (i = 1; i < nlm_cores_per_node(); i++) {
74 for (j = 1000000; j > 0; j--) { 73 for (j = 1000000; j > 0; j--) {
75 if (cpu_ready[i * NLM_THREADS_PER_CORE]) 74 if (cpu_ready[i * NLM_THREADS_PER_CORE])
76 break; 75 break;
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 4d1736fc1955..2a86e38872a7 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -86,6 +86,8 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
86 case CPU_34K: 86 case CPU_34K:
87 case CPU_1004K: 87 case CPU_1004K:
88 case CPU_74K: 88 case CPU_74K:
89 case CPU_INTERAPTIV:
90 case CPU_PROAPTIV:
89 case CPU_LOONGSON1: 91 case CPU_LOONGSON1:
90 case CPU_SB1: 92 case CPU_SB1:
91 case CPU_SB1A: 93 case CPU_SB1A:
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 3a2b6e9f25cf..4d94d75ec6f9 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -376,6 +376,14 @@ static int __init mipsxx_init(void)
376 op_model_mipsxx_ops.cpu_type = "mips/74K"; 376 op_model_mipsxx_ops.cpu_type = "mips/74K";
377 break; 377 break;
378 378
379 case CPU_INTERAPTIV:
380 op_model_mipsxx_ops.cpu_type = "mips/interAptiv";
381 break;
382
383 case CPU_PROAPTIV:
384 op_model_mipsxx_ops.cpu_type = "mips/proAptiv";
385 break;
386
379 case CPU_5KC: 387 case CPU_5KC:
380 op_model_mipsxx_ops.cpu_type = "mips/5K"; 388 op_model_mipsxx_ops.cpu_type = "mips/5K";
381 break; 389 break;
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 719e4557e22e..137f2a6feb25 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -60,4 +60,5 @@ obj-$(CONFIG_CPU_XLP) += pci-xlp.o
60 60
61ifdef CONFIG_PCI_MSI 61ifdef CONFIG_PCI_MSI
62obj-$(CONFIG_CAVIUM_OCTEON_SOC) += msi-octeon.o 62obj-$(CONFIG_CAVIUM_OCTEON_SOC) += msi-octeon.o
63obj-$(CONFIG_CPU_XLP) += msi-xlp.o
63endif 64endif
diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c
index df36e2327c54..7a0eda782e35 100644
--- a/arch/mips/pci/fixup-malta.c
+++ b/arch/mips/pci/fixup-malta.c
@@ -54,6 +54,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
54static void malta_piix_func0_fixup(struct pci_dev *pdev) 54static void malta_piix_func0_fixup(struct pci_dev *pdev)
55{ 55{
56 unsigned char reg_val; 56 unsigned char reg_val;
57 u32 reg_val32;
57 /* PIIX PIRQC[A:D] irq mappings */ 58 /* PIIX PIRQC[A:D] irq mappings */
58 static int piixirqmap[PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX] = { 59 static int piixirqmap[PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX] = {
59 0, 0, 0, 3, 60 0, 0, 0, 3,
@@ -83,6 +84,16 @@ static void malta_piix_func0_fixup(struct pci_dev *pdev)
83 pci_write_config_byte(pdev, PIIX4_FUNC0_TOM, reg_val | 84 pci_write_config_byte(pdev, PIIX4_FUNC0_TOM, reg_val |
84 PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK); 85 PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK);
85 } 86 }
87
88 /* Mux SERIRQ to its pin */
89 pci_read_config_dword(pdev, PIIX4_FUNC0_GENCFG, &reg_val32);
90 pci_write_config_dword(pdev, PIIX4_FUNC0_GENCFG,
91 reg_val32 | PIIX4_FUNC0_GENCFG_SERIRQ);
92
93 /* Enable SERIRQ */
94 pci_read_config_byte(pdev, PIIX4_FUNC0_SERIRQC, &reg_val);
95 reg_val |= PIIX4_FUNC0_SERIRQC_EN | PIIX4_FUNC0_SERIRQC_CONT;
96 pci_write_config_byte(pdev, PIIX4_FUNC0_SERIRQC, reg_val);
86} 97}
87 98
88DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, 99DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
diff --git a/arch/mips/pci/fixup-rc32434.c b/arch/mips/pci/fixup-rc32434.c
index d0f6ecbf35f7..7fcafd5da7da 100644
--- a/arch/mips/pci/fixup-rc32434.c
+++ b/arch/mips/pci/fixup-rc32434.c
@@ -27,7 +27,6 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/init.h>
31 30
32#include <asm/mach-rc32434/rc32434.h> 31#include <asm/mach-rc32434/rc32434.h>
33#include <asm/mach-rc32434/irq.h> 32#include <asm/mach-rc32434/irq.h>
diff --git a/arch/mips/pci/fixup-sb1250.c b/arch/mips/pci/fixup-sb1250.c
index 1441becdcb6c..8feae9154baf 100644
--- a/arch/mips/pci/fixup-sb1250.c
+++ b/arch/mips/pci/fixup-sb1250.c
@@ -8,7 +8,6 @@
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 10
11#include <linux/init.h>
12#include <linux/pci.h> 11#include <linux/pci.h>
13 12
14/* 13/*
diff --git a/arch/mips/pci/msi-xlp.c b/arch/mips/pci/msi-xlp.c
new file mode 100644
index 000000000000..afd8405e0188
--- /dev/null
+++ b/arch/mips/pci/msi-xlp.c
@@ -0,0 +1,494 @@
1/*
2 * Copyright (c) 2003-2012 Broadcom Corporation
3 * All Rights Reserved
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#include <linux/types.h>
36#include <linux/pci.h>
37#include <linux/kernel.h>
38#include <linux/init.h>
39#include <linux/msi.h>
40#include <linux/mm.h>
41#include <linux/irq.h>
42#include <linux/irqdesc.h>
43#include <linux/console.h>
44
45#include <asm/io.h>
46
47#include <asm/netlogic/interrupt.h>
48#include <asm/netlogic/haldefs.h>
49#include <asm/netlogic/common.h>
50#include <asm/netlogic/mips-extns.h>
51
52#include <asm/netlogic/xlp-hal/iomap.h>
53#include <asm/netlogic/xlp-hal/xlp.h>
54#include <asm/netlogic/xlp-hal/pic.h>
55#include <asm/netlogic/xlp-hal/pcibus.h>
56#include <asm/netlogic/xlp-hal/bridge.h>
57
58#define XLP_MSIVEC_PER_LINK 32
59#define XLP_MSIXVEC_TOTAL 32
60#define XLP_MSIXVEC_PER_LINK 8
61
62/* 128 MSI irqs per node, mapped starting at NLM_MSI_VEC_BASE */
63static inline int nlm_link_msiirq(int link, int msivec)
64{
65 return NLM_MSI_VEC_BASE + link * XLP_MSIVEC_PER_LINK + msivec;
66}
67
68static inline int nlm_irq_msivec(int irq)
69{
70 return irq % XLP_MSIVEC_PER_LINK;
71}
72
73static inline int nlm_irq_msilink(int irq)
74{
75 return (irq % (XLP_MSIVEC_PER_LINK * PCIE_NLINKS)) /
76 XLP_MSIVEC_PER_LINK;
77}
78
79/*
80 * Only 32 MSI-X vectors are possible because there are only 32 PIC
81 * interrupts for MSI. We split them statically and use 8 MSI-X vectors
82 * per link - this keeps the allocation and lookup simple.
83 */
84static inline int nlm_link_msixirq(int link, int bit)
85{
86 return NLM_MSIX_VEC_BASE + link * XLP_MSIXVEC_PER_LINK + bit;
87}
88
89static inline int nlm_irq_msixvec(int irq)
90{
91 return irq % XLP_MSIXVEC_TOTAL; /* works when given xirq */
92}
93
94static inline int nlm_irq_msixlink(int irq)
95{
96 return nlm_irq_msixvec(irq) / XLP_MSIXVEC_PER_LINK;
97}
98
99/*
100 * Per link MSI and MSI-X information, set as IRQ handler data for
101 * MSI and MSI-X interrupts.
102 */
103struct xlp_msi_data {
104 struct nlm_soc_info *node;
105 uint64_t lnkbase;
106 uint32_t msi_enabled_mask;
107 uint32_t msi_alloc_mask;
108 uint32_t msix_alloc_mask;
109 spinlock_t msi_lock;
110};
111
112/*
113 * MSI Chip definitions
114 *
115 * On XLP, there is a PIC interrupt associated with each PCIe link on the
116 * chip (which appears as a PCI bridge to us). This gives us 32 MSI irqa
117 * per link and 128 overall.
118 *
119 * When a device connected to the link raises a MSI interrupt, we get a
120 * link interrupt and we then have to look at PCIE_MSI_STATUS register at
121 * the bridge to map it to the IRQ
122 */
123static void xlp_msi_enable(struct irq_data *d)
124{
125 struct xlp_msi_data *md = irq_data_get_irq_handler_data(d);
126 unsigned long flags;
127 int vec;
128
129 vec = nlm_irq_msivec(d->irq);
130 spin_lock_irqsave(&md->msi_lock, flags);
131 md->msi_enabled_mask |= 1u << vec;
132 nlm_write_reg(md->lnkbase, PCIE_MSI_EN, md->msi_enabled_mask);
133 spin_unlock_irqrestore(&md->msi_lock, flags);
134}
135
136static void xlp_msi_disable(struct irq_data *d)
137{
138 struct xlp_msi_data *md = irq_data_get_irq_handler_data(d);
139 unsigned long flags;
140 int vec;
141
142 vec = nlm_irq_msivec(d->irq);
143 spin_lock_irqsave(&md->msi_lock, flags);
144 md->msi_enabled_mask &= ~(1u << vec);
145 nlm_write_reg(md->lnkbase, PCIE_MSI_EN, md->msi_enabled_mask);
146 spin_unlock_irqrestore(&md->msi_lock, flags);
147}
148
149static void xlp_msi_mask_ack(struct irq_data *d)
150{
151 struct xlp_msi_data *md = irq_data_get_irq_handler_data(d);
152 int link, vec;
153
154 link = nlm_irq_msilink(d->irq);
155 vec = nlm_irq_msivec(d->irq);
156 xlp_msi_disable(d);
157
158 /* Ack MSI on bridge */
159 nlm_write_reg(md->lnkbase, PCIE_MSI_STATUS, 1u << vec);
160
161 /* Ack at eirr and PIC */
162 ack_c0_eirr(PIC_PCIE_LINK_MSI_IRQ(link));
163 nlm_pic_ack(md->node->picbase, PIC_IRT_PCIE_LINK_INDEX(link));
164}
165
166static struct irq_chip xlp_msi_chip = {
167 .name = "XLP-MSI",
168 .irq_enable = xlp_msi_enable,
169 .irq_disable = xlp_msi_disable,
170 .irq_mask_ack = xlp_msi_mask_ack,
171 .irq_unmask = xlp_msi_enable,
172};
173
174/*
175 * The MSI-X interrupt handling is different from MSI, there are 32
176 * MSI-X interrupts generated by the PIC and each of these correspond
177 * to a MSI-X vector (0-31) that can be assigned.
178 *
179 * We divide the MSI-X vectors to 8 per link and do a per-link
180 * allocation
181 *
182 * Enable and disable done using standard MSI functions.
183 */
184static void xlp_msix_mask_ack(struct irq_data *d)
185{
186 struct xlp_msi_data *md = irq_data_get_irq_handler_data(d);
187 int link, msixvec;
188
189 msixvec = nlm_irq_msixvec(d->irq);
190 link = nlm_irq_msixlink(d->irq);
191 mask_msi_irq(d);
192
193 /* Ack MSI on bridge */
194 nlm_write_reg(md->lnkbase, PCIE_MSIX_STATUS, 1u << msixvec);
195
196 /* Ack at eirr and PIC */
197 ack_c0_eirr(PIC_PCIE_MSIX_IRQ(link));
198 nlm_pic_ack(md->node->picbase, PIC_IRT_PCIE_MSIX_INDEX(msixvec));
199}
200
201static struct irq_chip xlp_msix_chip = {
202 .name = "XLP-MSIX",
203 .irq_enable = unmask_msi_irq,
204 .irq_disable = mask_msi_irq,
205 .irq_mask_ack = xlp_msix_mask_ack,
206 .irq_unmask = unmask_msi_irq,
207};
208
209void destroy_irq(unsigned int irq)
210{
211 /* nothing to do yet */
212}
213
214void arch_teardown_msi_irq(unsigned int irq)
215{
216 destroy_irq(irq);
217}
218
219/*
220 * Setup a PCIe link for MSI. By default, the links are in
221 * legacy interrupt mode. We will switch them to MSI mode
222 * at the first MSI request.
223 */
224static void xlp_config_link_msi(uint64_t lnkbase, int lirq, uint64_t msiaddr)
225{
226 u32 val;
227
228 val = nlm_read_reg(lnkbase, PCIE_INT_EN0);
229 if ((val & 0x200) == 0) {
230 val |= 0x200; /* MSI Interrupt enable */
231 nlm_write_reg(lnkbase, PCIE_INT_EN0, val);
232 }
233
234 val = nlm_read_reg(lnkbase, 0x1); /* CMD */
235 if ((val & 0x0400) == 0) {
236 val |= 0x0400;
237 nlm_write_reg(lnkbase, 0x1, val);
238 }
239
240 /* Update IRQ in the PCI irq reg */
241 val = nlm_read_pci_reg(lnkbase, 0xf);
242 val &= ~0x1fu;
243 val |= (1 << 8) | lirq;
244 nlm_write_pci_reg(lnkbase, 0xf, val);
245
246 /* MSI addr */
247 nlm_write_reg(lnkbase, PCIE_BRIDGE_MSI_ADDRH, msiaddr >> 32);
248 nlm_write_reg(lnkbase, PCIE_BRIDGE_MSI_ADDRL, msiaddr & 0xffffffff);
249
250 /* MSI cap for bridge */
251 val = nlm_read_reg(lnkbase, PCIE_BRIDGE_MSI_CAP);
252 if ((val & (1 << 16)) == 0) {
253 val |= 0xb << 16; /* mmc32, msi enable */
254 nlm_write_reg(lnkbase, PCIE_BRIDGE_MSI_CAP, val);
255 }
256}
257
258/*
259 * Allocate a MSI vector on a link
260 */
261static int xlp_setup_msi(uint64_t lnkbase, int node, int link,
262 struct msi_desc *desc)
263{
264 struct xlp_msi_data *md;
265 struct msi_msg msg;
266 unsigned long flags;
267 int msivec, irt, lirq, xirq, ret;
268 uint64_t msiaddr;
269
270 /* Get MSI data for the link */
271 lirq = PIC_PCIE_LINK_MSI_IRQ(link);
272 xirq = nlm_irq_to_xirq(node, nlm_link_msiirq(link, 0));
273 md = irq_get_handler_data(xirq);
274 msiaddr = MSI_LINK_ADDR(node, link);
275
276 spin_lock_irqsave(&md->msi_lock, flags);
277 if (md->msi_alloc_mask == 0) {
278 /* switch the link IRQ to MSI range */
279 xlp_config_link_msi(lnkbase, lirq, msiaddr);
280 irt = PIC_IRT_PCIE_LINK_INDEX(link);
281 nlm_setup_pic_irq(node, lirq, lirq, irt);
282 nlm_pic_init_irt(nlm_get_node(node)->picbase, irt, lirq,
283 node * nlm_threads_per_node(), 1 /*en */);
284 }
285
286 /* allocate a MSI vec, and tell the bridge about it */
287 msivec = fls(md->msi_alloc_mask);
288 if (msivec == XLP_MSIVEC_PER_LINK) {
289 spin_unlock_irqrestore(&md->msi_lock, flags);
290 return -ENOMEM;
291 }
292 md->msi_alloc_mask |= (1u << msivec);
293 spin_unlock_irqrestore(&md->msi_lock, flags);
294
295 msg.address_hi = msiaddr >> 32;
296 msg.address_lo = msiaddr & 0xffffffff;
297 msg.data = 0xc00 | msivec;
298
299 xirq = xirq + msivec; /* msi mapped to global irq space */
300 ret = irq_set_msi_desc(xirq, desc);
301 if (ret < 0) {
302 destroy_irq(xirq);
303 return ret;
304 }
305
306 write_msi_msg(xirq, &msg);
307 return 0;
308}
309
310/*
311 * Switch a link to MSI-X mode
312 */
313static void xlp_config_link_msix(uint64_t lnkbase, int lirq, uint64_t msixaddr)
314{
315 u32 val;
316
317 val = nlm_read_reg(lnkbase, 0x2C);
318 if ((val & 0x80000000U) == 0) {
319 val |= 0x80000000U;
320 nlm_write_reg(lnkbase, 0x2C, val);
321 }
322 val = nlm_read_reg(lnkbase, PCIE_INT_EN0);
323 if ((val & 0x200) == 0) {
324 val |= 0x200; /* MSI Interrupt enable */
325 nlm_write_reg(lnkbase, PCIE_INT_EN0, val);
326 }
327
328 val = nlm_read_reg(lnkbase, 0x1); /* CMD */
329 if ((val & 0x0400) == 0) {
330 val |= 0x0400;
331 nlm_write_reg(lnkbase, 0x1, val);
332 }
333
334 /* Update IRQ in the PCI irq reg */
335 val = nlm_read_pci_reg(lnkbase, 0xf);
336 val &= ~0x1fu;
337 val |= (1 << 8) | lirq;
338 nlm_write_pci_reg(lnkbase, 0xf, val);
339
340 /* MSI-X addresses */
341 nlm_write_reg(lnkbase, PCIE_BRIDGE_MSIX_ADDR_BASE, msixaddr >> 8);
342 nlm_write_reg(lnkbase, PCIE_BRIDGE_MSIX_ADDR_LIMIT,
343 (msixaddr + MSI_ADDR_SZ) >> 8);
344}
345
346/*
347 * Allocate a MSI-X vector
348 */
349static int xlp_setup_msix(uint64_t lnkbase, int node, int link,
350 struct msi_desc *desc)
351{
352 struct xlp_msi_data *md;
353 struct msi_msg msg;
354 unsigned long flags;
355 int t, msixvec, lirq, xirq, ret;
356 uint64_t msixaddr;
357
358 /* Get MSI data for the link */
359 lirq = PIC_PCIE_MSIX_IRQ(link);
360 xirq = nlm_irq_to_xirq(node, nlm_link_msixirq(link, 0));
361 md = irq_get_handler_data(xirq);
362 msixaddr = MSIX_LINK_ADDR(node, link);
363
364 spin_lock_irqsave(&md->msi_lock, flags);
365 /* switch the PCIe link to MSI-X mode at the first alloc */
366 if (md->msix_alloc_mask == 0)
367 xlp_config_link_msix(lnkbase, lirq, msixaddr);
368
369 /* allocate a MSI-X vec, and tell the bridge about it */
370 t = fls(md->msix_alloc_mask);
371 if (t == XLP_MSIXVEC_PER_LINK) {
372 spin_unlock_irqrestore(&md->msi_lock, flags);
373 return -ENOMEM;
374 }
375 md->msix_alloc_mask |= (1u << t);
376 spin_unlock_irqrestore(&md->msi_lock, flags);
377
378 xirq += t;
379 msixvec = nlm_irq_msixvec(xirq);
380 msg.address_hi = msixaddr >> 32;
381 msg.address_lo = msixaddr & 0xffffffff;
382 msg.data = 0xc00 | msixvec;
383
384 ret = irq_set_msi_desc(xirq, desc);
385 if (ret < 0) {
386 destroy_irq(xirq);
387 return ret;
388 }
389
390 write_msi_msg(xirq, &msg);
391 return 0;
392}
393
394int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
395{
396 struct pci_dev *lnkdev;
397 uint64_t lnkbase;
398 int node, link, slot;
399
400 lnkdev = xlp_get_pcie_link(dev);
401 if (lnkdev == NULL) {
402 dev_err(&dev->dev, "Could not find bridge\n");
403 return 1;
404 }
405 slot = PCI_SLOT(lnkdev->devfn);
406 link = PCI_FUNC(lnkdev->devfn);
407 node = slot / 8;
408 lnkbase = nlm_get_pcie_base(node, link);
409
410 if (desc->msi_attrib.is_msix)
411 return xlp_setup_msix(lnkbase, node, link, desc);
412 else
413 return xlp_setup_msi(lnkbase, node, link, desc);
414}
415
416void __init xlp_init_node_msi_irqs(int node, int link)
417{
418 struct nlm_soc_info *nodep;
419 struct xlp_msi_data *md;
420 int irq, i, irt, msixvec;
421
422 pr_info("[%d %d] Init node PCI IRT\n", node, link);
423 nodep = nlm_get_node(node);
424
425 /* Alloc an MSI block for the link */
426 md = kzalloc(sizeof(*md), GFP_KERNEL);
427 spin_lock_init(&md->msi_lock);
428 md->msi_enabled_mask = 0;
429 md->msi_alloc_mask = 0;
430 md->msix_alloc_mask = 0;
431 md->node = nodep;
432 md->lnkbase = nlm_get_pcie_base(node, link);
433
434 /* extended space for MSI interrupts */
435 irq = nlm_irq_to_xirq(node, nlm_link_msiirq(link, 0));
436 for (i = irq; i < irq + XLP_MSIVEC_PER_LINK; i++) {
437 irq_set_chip_and_handler(i, &xlp_msi_chip, handle_level_irq);
438 irq_set_handler_data(i, md);
439 }
440
441 for (i = 0; i < XLP_MSIXVEC_PER_LINK; i++) {
442 /* Initialize MSI-X irts to generate one interrupt per link */
443 msixvec = link * XLP_MSIXVEC_PER_LINK + i;
444 irt = PIC_IRT_PCIE_MSIX_INDEX(msixvec);
445 nlm_pic_init_irt(nodep->picbase, irt, PIC_PCIE_MSIX_IRQ(link),
446 node * nlm_threads_per_node(), 1 /* enable */);
447
448 /* Initialize MSI-X extended irq space for the link */
449 irq = nlm_irq_to_xirq(node, nlm_link_msixirq(link, i));
450 irq_set_chip_and_handler(irq, &xlp_msix_chip, handle_level_irq);
451 irq_set_handler_data(irq, md);
452 }
453
454}
455
456void nlm_dispatch_msi(int node, int lirq)
457{
458 struct xlp_msi_data *md;
459 int link, i, irqbase;
460 u32 status;
461
462 link = lirq - PIC_PCIE_LINK_MSI_IRQ_BASE;
463 irqbase = nlm_irq_to_xirq(node, nlm_link_msiirq(link, 0));
464 md = irq_get_handler_data(irqbase);
465 status = nlm_read_reg(md->lnkbase, PCIE_MSI_STATUS) &
466 md->msi_enabled_mask;
467 while (status) {
468 i = __ffs(status);
469 do_IRQ(irqbase + i);
470 status &= status - 1;
471 }
472}
473
474void nlm_dispatch_msix(int node, int lirq)
475{
476 struct xlp_msi_data *md;
477 int link, i, irqbase;
478 u32 status;
479
480 link = lirq - PIC_PCIE_MSIX_IRQ_BASE;
481 irqbase = nlm_irq_to_xirq(node, nlm_link_msixirq(link, 0));
482 md = irq_get_handler_data(irqbase);
483 status = nlm_read_reg(md->lnkbase, PCIE_MSIX_STATUS);
484
485 /* narrow it down to the MSI-x vectors for our link */
486 status = (status >> (link * XLP_MSIXVEC_PER_LINK)) &
487 ((1 << XLP_MSIXVEC_PER_LINK) - 1);
488
489 while (status) {
490 i = __ffs(status);
491 do_IRQ(irqbase + i);
492 status &= status - 1;
493 }
494}
diff --git a/arch/mips/pci/ops-bcm63xx.c b/arch/mips/pci/ops-bcm63xx.c
index 6144bb337e44..13eea696bbe7 100644
--- a/arch/mips/pci/ops-bcm63xx.c
+++ b/arch/mips/pci/ops-bcm63xx.c
@@ -9,7 +9,6 @@
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/delay.h> 12#include <linux/delay.h>
14#include <linux/io.h> 13#include <linux/io.h>
15 14
diff --git a/arch/mips/pci/ops-bonito64.c b/arch/mips/pci/ops-bonito64.c
index 830352e3aeda..c06205a87348 100644
--- a/arch/mips/pci/ops-bonito64.c
+++ b/arch/mips/pci/ops-bonito64.c
@@ -22,7 +22,6 @@
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/init.h>
26 25
27#include <asm/mips-boards/bonito64.h> 26#include <asm/mips-boards/bonito64.h>
28 27
diff --git a/arch/mips/pci/ops-lantiq.c b/arch/mips/pci/ops-lantiq.c
index 16e7c2526d77..e5738ee26f4f 100644
--- a/arch/mips/pci/ops-lantiq.c
+++ b/arch/mips/pci/ops-lantiq.c
@@ -9,7 +9,6 @@
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/delay.h> 12#include <linux/delay.h>
14#include <linux/mm.h> 13#include <linux/mm.h>
15#include <asm/addrspace.h> 14#include <asm/addrspace.h>
diff --git a/arch/mips/pci/ops-loongson2.c b/arch/mips/pci/ops-loongson2.c
index 98254afa0287..24138bb0cbe1 100644
--- a/arch/mips/pci/ops-loongson2.c
+++ b/arch/mips/pci/ops-loongson2.c
@@ -14,7 +14,6 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/export.h> 17#include <linux/export.h>
19 18
20#include <loongson.h> 19#include <loongson.h>
diff --git a/arch/mips/pci/ops-mace.c b/arch/mips/pci/ops-mace.c
index 1cfb5588699f..6b5821febc38 100644
--- a/arch/mips/pci/ops-mace.c
+++ b/arch/mips/pci/ops-mace.c
@@ -6,7 +6,6 @@
6 * Copyright (C) 2000, 2001 Keith M Wesolowski 6 * Copyright (C) 2000, 2001 Keith M Wesolowski
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/pci.h> 9#include <linux/pci.h>
11#include <linux/types.h> 10#include <linux/types.h>
12#include <asm/pci.h> 11#include <asm/pci.h>
diff --git a/arch/mips/pci/ops-msc.c b/arch/mips/pci/ops-msc.c
index 92a8543361bb..dbbf3657896c 100644
--- a/arch/mips/pci/ops-msc.c
+++ b/arch/mips/pci/ops-msc.c
@@ -24,7 +24,6 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/init.h>
28 27
29#include <asm/mips-boards/msc01_pci.h> 28#include <asm/mips-boards/msc01_pci.h>
30 29
diff --git a/arch/mips/pci/ops-nile4.c b/arch/mips/pci/ops-nile4.c
index 499e35c3eb35..a1a7c9f4096e 100644
--- a/arch/mips/pci/ops-nile4.c
+++ b/arch/mips/pci/ops-nile4.c
@@ -1,5 +1,4 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/pci.h> 2#include <linux/pci.h>
4#include <asm/bootinfo.h> 3#include <asm/bootinfo.h>
5 4
diff --git a/arch/mips/pci/ops-rc32434.c b/arch/mips/pci/ops-rc32434.c
index 7c7182e2350a..874ed6df9768 100644
--- a/arch/mips/pci/ops-rc32434.c
+++ b/arch/mips/pci/ops-rc32434.c
@@ -26,7 +26,6 @@
26 * 675 Mass Ave, Cambridge, MA 02139, USA. 26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */ 27 */
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/init.h>
30#include <linux/io.h> 29#include <linux/io.h>
31#include <linux/pci.h> 30#include <linux/pci.h>
32#include <linux/types.h> 31#include <linux/types.h>
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index 162b4cb29dba..0f09eafa5e3a 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -7,7 +7,6 @@
7 * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org) 7 * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */ 9 */
10#include <linux/init.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <linux/export.h> 11#include <linux/export.h>
13#include <linux/pci.h> 12#include <linux/pci.h>
diff --git a/arch/mips/pci/pci-malta.c b/arch/mips/pci/pci-malta.c
index 37134ddfeaa5..f1a73890dd4f 100644
--- a/arch/mips/pci/pci-malta.c
+++ b/arch/mips/pci/pci-malta.c
@@ -241,9 +241,9 @@ void __init mips_pcibios_init(void)
241 return; 241 return;
242 } 242 }
243 243
244 /* Change start address to avoid conflicts with ACPI and SMB devices */ 244 /* PIIX4 ACPI starts at 0x1000 */
245 if (controller->io_resource->start < 0x00002000UL) 245 if (controller->io_resource->start < 0x00001000UL)
246 controller->io_resource->start = 0x00002000UL; 246 controller->io_resource->start = 0x00001000UL;
247 247
248 iomem_resource.end &= 0xfffffffffULL; /* 64 GB */ 248 iomem_resource.end &= 0xfffffffffULL; /* 64 GB */
249 ioport_resource.end = controller->io_resource->end; 249 ioport_resource.end = controller->io_resource->end;
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c
index adeff2bfe4cd..72919aeef42b 100644
--- a/arch/mips/pci/pci-rt3883.c
+++ b/arch/mips/pci/pci-rt3883.c
@@ -436,9 +436,6 @@ static int rt3883_pci_probe(struct platform_device *pdev)
436 return -ENOMEM; 436 return -ENOMEM;
437 437
438 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 438 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
439 if (!res)
440 return -EINVAL;
441
442 rpc->base = devm_ioremap_resource(dev, res); 439 rpc->base = devm_ioremap_resource(dev, res);
443 if (IS_ERR(rpc->base)) 440 if (IS_ERR(rpc->base))
444 return PTR_ERR(rpc->base); 441 return PTR_ERR(rpc->base);
diff --git a/arch/mips/pci/pci-xlp.c b/arch/mips/pci/pci-xlp.c
index 653d2db9e0c5..7babf01600cb 100644
--- a/arch/mips/pci/pci-xlp.c
+++ b/arch/mips/pci/pci-xlp.c
@@ -47,10 +47,11 @@
47#include <asm/netlogic/interrupt.h> 47#include <asm/netlogic/interrupt.h>
48#include <asm/netlogic/haldefs.h> 48#include <asm/netlogic/haldefs.h>
49#include <asm/netlogic/common.h> 49#include <asm/netlogic/common.h>
50#include <asm/netlogic/mips-extns.h>
50 51
51#include <asm/netlogic/xlp-hal/iomap.h> 52#include <asm/netlogic/xlp-hal/iomap.h>
52#include <asm/netlogic/xlp-hal/pic.h>
53#include <asm/netlogic/xlp-hal/xlp.h> 53#include <asm/netlogic/xlp-hal/xlp.h>
54#include <asm/netlogic/xlp-hal/pic.h>
54#include <asm/netlogic/xlp-hal/pcibus.h> 55#include <asm/netlogic/xlp-hal/pcibus.h>
55#include <asm/netlogic/xlp-hal/bridge.h> 56#include <asm/netlogic/xlp-hal/bridge.h>
56 57
@@ -66,9 +67,22 @@ static inline u32 pci_cfg_read_32bit(struct pci_bus *bus, unsigned int devfn,
66 u32 *cfgaddr; 67 u32 *cfgaddr;
67 68
68 where &= ~3; 69 where &= ~3;
69 if (bus->number == 0 && PCI_SLOT(devfn) == 1 && where == 0x954) 70 if (cpu_is_xlp9xx()) {
71 /* be very careful on SoC buses */
72 if (bus->number == 0) {
73 /* Scan only existing nodes - uboot bug? */
74 if (PCI_SLOT(devfn) != 0 ||
75 !nlm_node_present(PCI_FUNC(devfn)))
76 return 0xffffffff;
77 } else if (bus->parent->number == 0) { /* SoC bus */
78 if (PCI_SLOT(devfn) == 0) /* b.0.0 hangs */
79 return 0xffffffff;
80 if (devfn == 44) /* b.5.4 hangs */
81 return 0xffffffff;
82 }
83 } else if (bus->number == 0 && PCI_SLOT(devfn) == 1 && where == 0x954) {
70 return 0xffffffff; 84 return 0xffffffff;
71 85 }
72 cfgaddr = (u32 *)(pci_config_base + 86 cfgaddr = (u32 *)(pci_config_base +
73 pci_cfg_addr(bus->number, devfn, where)); 87 pci_cfg_addr(bus->number, devfn, where));
74 data = *cfgaddr; 88 data = *cfgaddr;
@@ -162,27 +176,39 @@ struct pci_controller nlm_pci_controller = {
162 .io_offset = 0x00000000UL, 176 .io_offset = 0x00000000UL,
163}; 177};
164 178
165static struct pci_dev *xlp_get_pcie_link(const struct pci_dev *dev) 179struct pci_dev *xlp_get_pcie_link(const struct pci_dev *dev)
166{ 180{
167 struct pci_bus *bus, *p; 181 struct pci_bus *bus, *p;
168 182
169 /* Find the bridge on bus 0 */
170 bus = dev->bus; 183 bus = dev->bus;
171 for (p = bus->parent; p && p->number != 0; p = p->parent)
172 bus = p;
173 184
174 return p ? bus->self : NULL; 185 if (cpu_is_xlp9xx()) {
186 /* find bus with grand parent number == 0 */
187 for (p = bus->parent; p && p->parent && p->parent->number != 0;
188 p = p->parent)
189 bus = p;
190 return (p && p->parent) ? bus->self : NULL;
191 } else {
192 /* Find the bridge on bus 0 */
193 for (p = bus->parent; p && p->number != 0; p = p->parent)
194 bus = p;
195
196 return p ? bus->self : NULL;
197 }
175} 198}
176 199
177static inline int nlm_pci_link_to_irq(int link) 200int xlp_socdev_to_node(const struct pci_dev *lnkdev)
178{ 201{
179 return PIC_PCIE_LINK_0_IRQ + link; 202 if (cpu_is_xlp9xx())
203 return PCI_FUNC(lnkdev->bus->self->devfn);
204 else
205 return PCI_SLOT(lnkdev->devfn) / 8;
180} 206}
181 207
182int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 208int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
183{ 209{
184 struct pci_dev *lnkdev; 210 struct pci_dev *lnkdev;
185 int lnkslot, lnkfunc; 211 int lnkfunc, node;
186 212
187 /* 213 /*
188 * For XLP PCIe, there is an IRQ per Link, find out which 214 * For XLP PCIe, there is an IRQ per Link, find out which
@@ -191,9 +217,11 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
191 lnkdev = xlp_get_pcie_link(dev); 217 lnkdev = xlp_get_pcie_link(dev);
192 if (lnkdev == NULL) 218 if (lnkdev == NULL)
193 return 0; 219 return 0;
220
194 lnkfunc = PCI_FUNC(lnkdev->devfn); 221 lnkfunc = PCI_FUNC(lnkdev->devfn);
195 lnkslot = PCI_SLOT(lnkdev->devfn); 222 node = xlp_socdev_to_node(lnkdev);
196 return nlm_irq_to_xirq(lnkslot / 8, nlm_pci_link_to_irq(lnkfunc)); 223
224 return nlm_irq_to_xirq(node, PIC_PCIE_LINK_LEGACY_IRQ(lnkfunc));
197} 225}
198 226
199/* Do platform specific device initialization at pci_enable_device() time */ 227/* Do platform specific device initialization at pci_enable_device() time */
@@ -220,17 +248,38 @@ static void xlp_config_pci_bswap(int node, int link)
220 * Enable byte swap in hardware. Program each link's PCIe SWAP regions 248 * Enable byte swap in hardware. Program each link's PCIe SWAP regions
221 * from the link's address ranges. 249 * from the link's address ranges.
222 */ 250 */
223 reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEMEM_BASE0 + link); 251 if (cpu_is_xlp9xx()) {
224 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_MEM_BASE, reg); 252 reg = nlm_read_bridge_reg(nbubase,
225 253 BRIDGE_9XX_PCIEMEM_BASE0 + link);
226 reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEMEM_LIMIT0 + link); 254 nlm_write_pci_reg(lnkbase, PCIE_9XX_BYTE_SWAP_MEM_BASE, reg);
227 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_MEM_LIM, reg | 0xfff); 255
228 256 reg = nlm_read_bridge_reg(nbubase,
229 reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEIO_BASE0 + link); 257 BRIDGE_9XX_PCIEMEM_LIMIT0 + link);
230 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_IO_BASE, reg); 258 nlm_write_pci_reg(lnkbase,
231 259 PCIE_9XX_BYTE_SWAP_MEM_LIM, reg | 0xfff);
232 reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEIO_LIMIT0 + link); 260
233 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_IO_LIM, reg | 0xfff); 261 reg = nlm_read_bridge_reg(nbubase,
262 BRIDGE_9XX_PCIEIO_BASE0 + link);
263 nlm_write_pci_reg(lnkbase, PCIE_9XX_BYTE_SWAP_IO_BASE, reg);
264
265 reg = nlm_read_bridge_reg(nbubase,
266 BRIDGE_9XX_PCIEIO_LIMIT0 + link);
267 nlm_write_pci_reg(lnkbase,
268 PCIE_9XX_BYTE_SWAP_IO_LIM, reg | 0xfff);
269 } else {
270 reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEMEM_BASE0 + link);
271 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_MEM_BASE, reg);
272
273 reg = nlm_read_bridge_reg(nbubase,
274 BRIDGE_PCIEMEM_LIMIT0 + link);
275 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_MEM_LIM, reg | 0xfff);
276
277 reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEIO_BASE0 + link);
278 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_IO_BASE, reg);
279
280 reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEIO_LIMIT0 + link);
281 nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_IO_LIM, reg | 0xfff);
282 }
234} 283}
235#else 284#else
236/* Swap configuration not needed in little-endian mode */ 285/* Swap configuration not needed in little-endian mode */
@@ -239,7 +288,6 @@ static inline void xlp_config_pci_bswap(int node, int link) {}
239 288
240static int __init pcibios_init(void) 289static int __init pcibios_init(void)
241{ 290{
242 struct nlm_soc_info *nodep;
243 uint64_t pciebase; 291 uint64_t pciebase;
244 int link, n; 292 int link, n;
245 u32 reg; 293 u32 reg;
@@ -253,20 +301,20 @@ static int __init pcibios_init(void)
253 ioport_resource.end = ~0; 301 ioport_resource.end = ~0;
254 302
255 for (n = 0; n < NLM_NR_NODES; n++) { 303 for (n = 0; n < NLM_NR_NODES; n++) {
256 nodep = nlm_get_node(n); 304 if (!nlm_node_present(n))
257 if (!nodep->coremask) 305 continue;
258 continue; /* node does not exist */
259 306
260 for (link = 0; link < 4; link++) { 307 for (link = 0; link < PCIE_NLINKS; link++) {
261 pciebase = nlm_get_pcie_base(n, link); 308 pciebase = nlm_get_pcie_base(n, link);
262 if (nlm_read_pci_reg(pciebase, 0) == 0xffffffff) 309 if (nlm_read_pci_reg(pciebase, 0) == 0xffffffff)
263 continue; 310 continue;
264 xlp_config_pci_bswap(n, link); 311 xlp_config_pci_bswap(n, link);
312 xlp_init_node_msi_irqs(n, link);
265 313
266 /* put in intpin and irq - u-boot does not */ 314 /* put in intpin and irq - u-boot does not */
267 reg = nlm_read_pci_reg(pciebase, 0xf); 315 reg = nlm_read_pci_reg(pciebase, 0xf);
268 reg &= ~0x1fu; 316 reg &= ~0x1ffu;
269 reg |= (1 << 8) | nlm_pci_link_to_irq(link); 317 reg |= (1 << 8) | PIC_PCIE_LINK_LEGACY_IRQ(link);
270 nlm_write_pci_reg(pciebase, 0xf, reg); 318 nlm_write_pci_reg(pciebase, 0xf, reg);
271 pr_info("XLP PCIe: Link %d-%d initialized.\n", n, link); 319 pr_info("XLP PCIe: Link %d-%d initialized.\n", n, link);
272 } 320 }
diff --git a/arch/mips/pmcs-msp71xx/Kconfig b/arch/mips/pmcs-msp71xx/Kconfig
index 3482b8c8640c..6073ca456d11 100644
--- a/arch/mips/pmcs-msp71xx/Kconfig
+++ b/arch/mips/pmcs-msp71xx/Kconfig
@@ -6,6 +6,7 @@ config PMC_MSP4200_EVAL
6 bool "PMC-Sierra MSP4200 Eval Board" 6 bool "PMC-Sierra MSP4200 Eval Board"
7 select IRQ_MSP_SLP 7 select IRQ_MSP_SLP
8 select HW_HAS_PCI 8 select HW_HAS_PCI
9 select MIPS_L1_CACHE_SHIFT_4
9 10
10config PMC_MSP4200_GW 11config PMC_MSP4200_GW
11 bool "PMC-Sierra MSP4200 VoIP Gateway" 12 bool "PMC-Sierra MSP4200 VoIP Gateway"
diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
index 424f03496d14..1bfd1c17b3c2 100644
--- a/arch/mips/ralink/Kconfig
+++ b/arch/mips/ralink/Kconfig
@@ -15,6 +15,7 @@ choice
15 15
16 config SOC_RT288X 16 config SOC_RT288X
17 bool "RT288x" 17 bool "RT288x"
18 select MIPS_L1_CACHE_SHIFT_4
18 19
19 config SOC_RT305X 20 config SOC_RT305X
20 bool "RT305x" 21 bool "RT305x"
diff --git a/arch/mips/ralink/cevt-rt3352.c b/arch/mips/ralink/cevt-rt3352.c
index cc17566d1934..24bf057a3613 100644
--- a/arch/mips/ralink/cevt-rt3352.c
+++ b/arch/mips/ralink/cevt-rt3352.c
@@ -138,7 +138,7 @@ static void __init ralink_systick_init(struct device_node *np)
138 138
139 clockevents_register_device(&systick.dev); 139 clockevents_register_device(&systick.dev);
140 140
141 pr_info("%s: runing - mult: %d, shift: %d\n", 141 pr_info("%s: running - mult: %d, shift: %d\n",
142 np->name, systick.dev.mult, systick.dev.shift); 142 np->name, systick.dev.mult, systick.dev.shift);
143} 143}
144 144
diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c
index 202785709441..e38692a44e69 100644
--- a/arch/mips/ralink/timer.c
+++ b/arch/mips/ralink/timer.c
@@ -147,7 +147,7 @@ static int rt_timer_probe(struct platform_device *pdev)
147 rt_timer_config(rt, 2); 147 rt_timer_config(rt, 2);
148 rt_timer_enable(rt); 148 rt_timer_enable(rt);
149 149
150 dev_info(&pdev->dev, "maximum frequncy is %luHz\n", rt->timer_freq); 150 dev_info(&pdev->dev, "maximum frequency is %luHz\n", rt->timer_freq);
151 151
152 return 0; 152 return 0;
153} 153}
diff --git a/arch/mips/sgi-ip27/ip27-console.c b/arch/mips/sgi-ip27/ip27-console.c
index b952d5b1af86..45fdfbcbd4c6 100644
--- a/arch/mips/sgi-ip27/ip27-console.c
+++ b/arch/mips/sgi-ip27/ip27-console.c
@@ -5,7 +5,6 @@
5 * 5 *
6 * Copyright (C) 2001, 2002 Ralf Baechle 6 * Copyright (C) 2001, 2002 Ralf Baechle
7 */ 7 */
8#include <linux/init.h>
9 8
10#include <asm/page.h> 9#include <asm/page.h>
11#include <asm/sn/addrs.h> 10#include <asm/sn/addrs.h>
diff --git a/arch/mips/sgi-ip27/ip27-irq-pci.c b/arch/mips/sgi-ip27/ip27-irq-pci.c
index ec22ec5600f3..2a1c40784bd9 100644
--- a/arch/mips/sgi-ip27/ip27-irq-pci.c
+++ b/arch/mips/sgi-ip27/ip27-irq-pci.c
@@ -8,7 +8,6 @@
8 8
9#undef DEBUG 9#undef DEBUG
10 10
11#include <linux/init.h>
12#include <linux/irq.h> 11#include <linux/irq.h>
13#include <linux/errno.h> 12#include <linux/errno.h>
14#include <linux/signal.h> 13#include <linux/signal.h>
diff --git a/arch/mips/sgi-ip27/ip27-klconfig.c b/arch/mips/sgi-ip27/ip27-klconfig.c
index 7afe14688003..c873d62ff083 100644
--- a/arch/mips/sgi-ip27/ip27-klconfig.c
+++ b/arch/mips/sgi-ip27/ip27-klconfig.c
@@ -2,7 +2,6 @@
2 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org) 2 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
3 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 3 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
4 */ 4 */
5#include <linux/init.h>
6#include <linux/kernel.h> 5#include <linux/kernel.h>
7#include <linux/sched.h> 6#include <linux/sched.h>
8#include <linux/interrupt.h> 7#include <linux/interrupt.h>
diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c
index d59b820f528d..20f582a2137a 100644
--- a/arch/mips/sgi-ip27/ip27-xtalk.c
+++ b/arch/mips/sgi-ip27/ip27-xtalk.c
@@ -7,7 +7,6 @@
7 * Generic XTALK initialization code 7 * Generic XTALK initialization code
8 */ 8 */
9 9
10#include <linux/init.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <linux/smp.h> 11#include <linux/smp.h>
13#include <asm/sn/types.h> 12#include <asm/sn/types.h>
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 8bde9237d13b..a648de1b1096 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -184,13 +184,13 @@ config SMP
184 depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050 184 depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050
185 ---help--- 185 ---help---
186 This enables support for systems with more than one CPU. If you have 186 This enables support for systems with more than one CPU. If you have
187 a system with only one CPU, like most personal computers, say N. If 187 a system with only one CPU, say N. If you have a system with more
188 you have a system with more than one CPU, say Y. 188 than one CPU, say Y.
189 189
190 If you say N here, the kernel will run on single and multiprocessor 190 If you say N here, the kernel will run on uni- and multiprocessor
191 machines, but will use only one CPU of a multiprocessor machine. If 191 machines, but will use only one CPU of a multiprocessor machine. If
192 you say Y here, the kernel will run on many, but not all, 192 you say Y here, the kernel will run on many, but not all,
193 singleprocessor machines. On a singleprocessor machine, the kernel 193 uniprocessor machines. On a uniprocessor machine, the kernel
194 will run faster if you say N here. 194 will run faster if you say N here.
195 195
196 See also <file:Documentation/x86/i386/IO-APIC.txt>, 196 See also <file:Documentation/x86/i386/IO-APIC.txt>,
diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile
index a3d0fef3b126..3f1ea5ddc402 100644
--- a/arch/mn10300/Makefile
+++ b/arch/mn10300/Makefile
@@ -92,14 +92,6 @@ define archhelp
92 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' 92 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
93endef 93endef
94 94
95# If you make sure the .S files get compiled with debug info,
96# uncomment the following to disable optimisations
97# that are unhelpful whilst debugging.
98ifdef CONFIG_DEBUG_INFO
99#KBUILD_CFLAGS += -O1
100KBUILD_AFLAGS += -Wa,--gdwarf2
101endif
102
103# 95#
104# include the appropriate processor- and unit-specific headers 96# include the appropriate processor- and unit-specific headers
105# 97#
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index 032143ec2324..992e989ab785 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -2,5 +2,6 @@
2generic-y += barrier.h 2generic-y += barrier.h
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += hash.h
5generic-y += trace_clock.h 6generic-y += trace_clock.h
6generic-y += preempt.h 7generic-y += preempt.h
diff --git a/arch/mn10300/include/uapi/asm/socket.h b/arch/mn10300/include/uapi/asm/socket.h
index 71dedcae55a6..6aa3ce1854aa 100644
--- a/arch/mn10300/include/uapi/asm/socket.h
+++ b/arch/mn10300/include/uapi/asm/socket.h
@@ -78,4 +78,6 @@
78 78
79#define SO_MAX_PACING_RATE 47 79#define SO_MAX_PACING_RATE 47
80 80
81#define SO_BPF_EXTENSIONS 48
82
81#endif /* _ASM_SOCKET_H */ 83#endif /* _ASM_SOCKET_H */
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index da1951a22907..2e40f1ca8667 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -69,3 +69,4 @@ generic-y += vga.h
69generic-y += word-at-a-time.h 69generic-y += word-at-a-time.h
70generic-y += xor.h 70generic-y += xor.h
71generic-y += preempt.h 71generic-y += preempt.h
72generic-y += hash.h
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index d8a455ede5a7..fec8bf97d806 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -853,37 +853,44 @@ UNHANDLED_EXCEPTION(_vector_0x1f00,0x1f00)
853 853
854/* ========================================================[ return ] === */ 854/* ========================================================[ return ] === */
855 855
856_resume_userspace:
857 DISABLE_INTERRUPTS(r3,r4)
858 l.lwz r4,TI_FLAGS(r10)
859 l.andi r13,r4,_TIF_WORK_MASK
860 l.sfeqi r13,0
861 l.bf _restore_all
862 l.nop
863
856_work_pending: 864_work_pending:
857 /* 865 l.lwz r5,PT_ORIG_GPR11(r1)
858 * if (current_thread_info->flags & _TIF_NEED_RESCHED) 866 l.sfltsi r5,0
859 * schedule(); 867 l.bnf 1f
860 */
861 l.lwz r5,TI_FLAGS(r10)
862 l.andi r3,r5,_TIF_NEED_RESCHED
863 l.sfnei r3,0
864 l.bnf _work_notifysig
865 l.nop 868 l.nop
866 l.jal schedule 869 l.andi r5,r5,0
8701:
871 l.jal do_work_pending
872 l.ori r3,r1,0 /* pt_regs */
873
874 l.sfeqi r11,0
875 l.bf _restore_all
867 l.nop 876 l.nop
868 l.j _resume_userspace 877 l.sfltsi r11,0
878 l.bnf 1f
869 l.nop 879 l.nop
870 880 l.and r11,r11,r0
871/* Handle pending signals and notify-resume requests. 881 l.ori r11,r11,__NR_restart_syscall
872 * do_notify_resume must be passed the latest pushed pt_regs, not 882 l.j _syscall_check_trace_enter
873 * necessarily the "userspace" ones. Also, pt_regs->syscallno
874 * must be set so that the syscall restart functionality works.
875 */
876_work_notifysig:
877 l.jal do_notify_resume
878 l.ori r3,r1,0 /* pt_regs */
879
880_resume_userspace:
881 DISABLE_INTERRUPTS(r3,r4)
882 l.lwz r3,TI_FLAGS(r10)
883 l.andi r3,r3,_TIF_WORK_MASK
884 l.sfnei r3,0
885 l.bf _work_pending
886 l.nop 883 l.nop
8841:
885 l.lwz r11,PT_ORIG_GPR11(r1)
886 /* Restore arg registers */
887 l.lwz r3,PT_GPR3(r1)
888 l.lwz r4,PT_GPR4(r1)
889 l.lwz r5,PT_GPR5(r1)
890 l.lwz r6,PT_GPR6(r1)
891 l.lwz r7,PT_GPR7(r1)
892 l.j _syscall_check_trace_enter
893 l.lwz r8,PT_GPR8(r1)
887 894
888_restore_all: 895_restore_all:
889 RESTORE_ALL 896 RESTORE_ALL
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index ae167f7e081a..66775bc07a8e 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -28,24 +28,24 @@
28#include <linux/tracehook.h> 28#include <linux/tracehook.h>
29 29
30#include <asm/processor.h> 30#include <asm/processor.h>
31#include <asm/syscall.h>
31#include <asm/ucontext.h> 32#include <asm/ucontext.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33 34
34#define DEBUG_SIG 0 35#define DEBUG_SIG 0
35 36
36struct rt_sigframe { 37struct rt_sigframe {
37 struct siginfo *pinfo;
38 void *puc;
39 struct siginfo info; 38 struct siginfo info;
40 struct ucontext uc; 39 struct ucontext uc;
41 unsigned char retcode[16]; /* trampoline code */ 40 unsigned char retcode[16]; /* trampoline code */
42}; 41};
43 42
44static int restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc) 43static int restore_sigcontext(struct pt_regs *regs,
44 struct sigcontext __user *sc)
45{ 45{
46 unsigned int err = 0; 46 int err = 0;
47 47
48 /* Alwys make any pending restarted system call return -EINTR */ 48 /* Always make any pending restarted system calls return -EINTR */
49 current_thread_info()->restart_block.fn = do_no_restart_syscall; 49 current_thread_info()->restart_block.fn = do_no_restart_syscall;
50 50
51 /* 51 /*
@@ -53,25 +53,21 @@ static int restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
53 * (sc is already checked for VERIFY_READ since the sigframe was 53 * (sc is already checked for VERIFY_READ since the sigframe was
54 * checked in sys_sigreturn previously) 54 * checked in sys_sigreturn previously)
55 */ 55 */
56 if (__copy_from_user(regs, sc->regs.gpr, 32 * sizeof(unsigned long))) 56 err |= __copy_from_user(regs, sc->regs.gpr, 32 * sizeof(unsigned long));
57 goto badframe; 57 err |= __copy_from_user(&regs->pc, &sc->regs.pc, sizeof(unsigned long));
58 if (__copy_from_user(&regs->pc, &sc->regs.pc, sizeof(unsigned long))) 58 err |= __copy_from_user(&regs->sr, &sc->regs.sr, sizeof(unsigned long));
59 goto badframe;
60 if (__copy_from_user(&regs->sr, &sc->regs.sr, sizeof(unsigned long)))
61 goto badframe;
62 59
63 /* make sure the SM-bit is cleared so user-mode cannot fool us */ 60 /* make sure the SM-bit is cleared so user-mode cannot fool us */
64 regs->sr &= ~SPR_SR_SM; 61 regs->sr &= ~SPR_SR_SM;
65 62
63 regs->orig_gpr11 = -1; /* Avoid syscall restart checks */
64
66 /* TODO: the other ports use regs->orig_XX to disable syscall checks 65 /* TODO: the other ports use regs->orig_XX to disable syscall checks
67 * after this completes, but we don't use that mechanism. maybe we can 66 * after this completes, but we don't use that mechanism. maybe we can
68 * use it now ? 67 * use it now ?
69 */ 68 */
70 69
71 return err; 70 return err;
72
73badframe:
74 return 1;
75} 71}
76 72
77asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs) 73asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
@@ -111,21 +107,18 @@ badframe:
111 * Set up a signal frame. 107 * Set up a signal frame.
112 */ 108 */
113 109
114static int setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, 110static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
115 unsigned long mask)
116{ 111{
117 int err = 0; 112 int err = 0;
118 113
119 /* copy the regs */ 114 /* copy the regs */
120 115 /* There should be no need to save callee-saved registers here...
116 * ...but we save them anyway. Revisit this
117 */
121 err |= __copy_to_user(sc->regs.gpr, regs, 32 * sizeof(unsigned long)); 118 err |= __copy_to_user(sc->regs.gpr, regs, 32 * sizeof(unsigned long));
122 err |= __copy_to_user(&sc->regs.pc, &regs->pc, sizeof(unsigned long)); 119 err |= __copy_to_user(&sc->regs.pc, &regs->pc, sizeof(unsigned long));
123 err |= __copy_to_user(&sc->regs.sr, &regs->sr, sizeof(unsigned long)); 120 err |= __copy_to_user(&sc->regs.sr, &regs->sr, sizeof(unsigned long));
124 121
125 /* then some other stuff */
126
127 err |= __put_user(mask, &sc->oldmask);
128
129 return err; 122 return err;
130} 123}
131 124
@@ -173,55 +166,53 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
173 * trampoline which performs the syscall sigreturn, or a provided 166 * trampoline which performs the syscall sigreturn, or a provided
174 * user-mode trampoline. 167 * user-mode trampoline.
175 */ 168 */
176static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 169static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
177 sigset_t *set, struct pt_regs *regs) 170 struct pt_regs *regs)
178{ 171{
179 struct rt_sigframe *frame; 172 struct rt_sigframe *frame;
180 unsigned long return_ip; 173 unsigned long return_ip;
181 int err = 0; 174 int err = 0;
182 175
183 frame = get_sigframe(ka, regs, sizeof(*frame)); 176 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
184 177
185 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 178 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
186 goto give_sigsegv; 179 return -EFAULT;
187 180
188 err |= __put_user(&frame->info, &frame->pinfo); 181 /* Create siginfo. */
189 err |= __put_user(&frame->uc, &frame->puc); 182 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
183 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
190 184
191 if (ka->sa.sa_flags & SA_SIGINFO) 185 /* Create the ucontext. */
192 err |= copy_siginfo_to_user(&frame->info, info);
193 if (err)
194 goto give_sigsegv;
195
196 /* Clear all the bits of the ucontext we don't use. */
197 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
198 err |= __put_user(0, &frame->uc.uc_flags); 186 err |= __put_user(0, &frame->uc.uc_flags);
199 err |= __put_user(NULL, &frame->uc.uc_link); 187 err |= __put_user(NULL, &frame->uc.uc_link);
200 err |= __save_altstack(&frame->uc.uc_stack, regs->sp); 188 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
201 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 189 err |= setup_sigcontext(regs, &frame->uc.uc_mcontext);
202 190
203 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 191 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
204 192
205 if (err) 193 if (err)
206 goto give_sigsegv; 194 return -EFAULT;
207 195
208 /* trampoline - the desired return ip is the retcode itself */ 196 /* trampoline - the desired return ip is the retcode itself */
209 return_ip = (unsigned long)&frame->retcode; 197 return_ip = (unsigned long)&frame->retcode;
210 /* This is l.ori r11,r0,__NR_sigreturn, l.sys 1 */ 198 /* This is:
211 err |= __put_user(0xa960, (short *)(frame->retcode + 0)); 199 l.ori r11,r0,__NR_sigreturn
212 err |= __put_user(__NR_rt_sigreturn, (short *)(frame->retcode + 2)); 200 l.sys 1
201 */
202 err |= __put_user(0xa960, (short *)(frame->retcode + 0));
203 err |= __put_user(__NR_rt_sigreturn, (short *)(frame->retcode + 2));
213 err |= __put_user(0x20000001, (unsigned long *)(frame->retcode + 4)); 204 err |= __put_user(0x20000001, (unsigned long *)(frame->retcode + 4));
214 err |= __put_user(0x15000000, (unsigned long *)(frame->retcode + 8)); 205 err |= __put_user(0x15000000, (unsigned long *)(frame->retcode + 8));
215 206
216 if (err) 207 if (err)
217 goto give_sigsegv; 208 return -EFAULT;
218 209
219 /* TODO what is the current->exec_domain stuff and invmap ? */ 210 /* TODO what is the current->exec_domain stuff and invmap ? */
220 211
221 /* Set up registers for signal handler */ 212 /* Set up registers for signal handler */
222 regs->pc = (unsigned long)ka->sa.sa_handler; /* what we enter NOW */ 213 regs->pc = (unsigned long)ksig->ka.sa.sa_handler; /* what we enter NOW */
223 regs->gpr[9] = (unsigned long)return_ip; /* what we enter LATER */ 214 regs->gpr[9] = (unsigned long)return_ip; /* what we enter LATER */
224 regs->gpr[3] = (unsigned long)sig; /* arg 1: signo */ 215 regs->gpr[3] = (unsigned long)ksig->sig; /* arg 1: signo */
225 regs->gpr[4] = (unsigned long)&frame->info; /* arg 2: (siginfo_t*) */ 216 regs->gpr[4] = (unsigned long)&frame->info; /* arg 2: (siginfo_t*) */
226 regs->gpr[5] = (unsigned long)&frame->uc; /* arg 3: ucontext */ 217 regs->gpr[5] = (unsigned long)&frame->uc; /* arg 3: ucontext */
227 218
@@ -229,25 +220,16 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
229 regs->sp = (unsigned long)frame; 220 regs->sp = (unsigned long)frame;
230 221
231 return 0; 222 return 0;
232
233give_sigsegv:
234 force_sigsegv(sig, current);
235 return -EFAULT;
236} 223}
237 224
238static inline void 225static inline void
239handle_signal(unsigned long sig, 226handle_signal(struct ksignal *ksig, struct pt_regs *regs)
240 siginfo_t *info, struct k_sigaction *ka,
241 struct pt_regs *regs)
242{ 227{
243 int ret; 228 int ret;
244 229
245 ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); 230 ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
246 if (ret)
247 return;
248 231
249 signal_delivered(sig, info, ka, regs, 232 signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
250 test_thread_flag(TIF_SINGLESTEP));
251} 233}
252 234
253/* 235/*
@@ -262,82 +244,99 @@ handle_signal(unsigned long sig,
262 * mode below. 244 * mode below.
263 */ 245 */
264 246
265void do_signal(struct pt_regs *regs) 247int do_signal(struct pt_regs *regs, int syscall)
266{ 248{
267 siginfo_t info; 249 struct ksignal ksig;
268 int signr; 250 unsigned long continue_addr = 0;
269 struct k_sigaction ka; 251 unsigned long restart_addr = 0;
270 252 unsigned long retval = 0;
271 /* 253 int restart = 0;
272 * We want the common case to go fast, which 254
273 * is why we may in certain cases get here from 255 if (syscall) {
274 * kernel mode. Just return without doing anything 256 continue_addr = regs->pc;
275 * if so. 257 restart_addr = continue_addr - 4;
276 */ 258 retval = regs->gpr[11];
277 if (!user_mode(regs)) 259
278 return; 260 /*
279 261 * Setup syscall restart here so that a debugger will
280 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 262 * see the already changed PC.
281 263 */
282 /* If we are coming out of a syscall then we need 264 switch (retval) {
283 * to check if the syscall was interrupted and wants to be
284 * restarted after handling the signal. If so, the original
285 * syscall number is put back into r11 and the PC rewound to
286 * point at the l.sys instruction that resulted in the
287 * original syscall. Syscall results other than the four
288 * below mean that the syscall executed to completion and no
289 * restart is necessary.
290 */
291 if (regs->orig_gpr11) {
292 int restart = 0;
293
294 switch (regs->gpr[11]) {
295 case -ERESTART_RESTARTBLOCK: 265 case -ERESTART_RESTARTBLOCK:
266 restart = -2;
267 /* Fall through */
296 case -ERESTARTNOHAND: 268 case -ERESTARTNOHAND:
297 /* Restart if there is no signal handler */
298 restart = (signr <= 0);
299 break;
300 case -ERESTARTSYS: 269 case -ERESTARTSYS:
301 /* Restart if there no signal handler or
302 * SA_RESTART flag is set */
303 restart = (signr <= 0 || (ka.sa.sa_flags & SA_RESTART));
304 break;
305 case -ERESTARTNOINTR: 270 case -ERESTARTNOINTR:
306 /* Always restart */ 271 restart++;
307 restart = 1; 272 regs->gpr[11] = regs->orig_gpr11;
273 regs->pc = restart_addr;
308 break; 274 break;
309 } 275 }
310
311 if (restart) {
312 if (regs->gpr[11] == -ERESTART_RESTARTBLOCK)
313 regs->gpr[11] = __NR_restart_syscall;
314 else
315 regs->gpr[11] = regs->orig_gpr11;
316 regs->pc -= 4;
317 } else {
318 regs->gpr[11] = -EINTR;
319 }
320 } 276 }
321 277
322 if (signr <= 0) { 278 /*
323 /* no signal to deliver so we just put the saved sigmask 279 * Get the signal to deliver. During the call to get_signal the
324 * back */ 280 * debugger may change all our registers so we may need to revert
281 * the decision to restart the syscall; specifically, if the PC is
282 * changed, don't restart the syscall.
283 */
284 if (get_signal(&ksig)) {
285 if (unlikely(restart) && regs->pc == restart_addr) {
286 if (retval == -ERESTARTNOHAND ||
287 retval == -ERESTART_RESTARTBLOCK
288 || (retval == -ERESTARTSYS
289 && !(ksig.ka.sa.sa_flags & SA_RESTART))) {
290 /* No automatic restart */
291 regs->gpr[11] = -EINTR;
292 regs->pc = continue_addr;
293 }
294 }
295 handle_signal(&ksig, regs);
296 } else {
297 /* no handler */
325 restore_saved_sigmask(); 298 restore_saved_sigmask();
326 } else { /* signr > 0 */ 299 /*
327 /* Whee! Actually deliver the signal. */ 300 * Restore pt_regs PC as syscall restart will be handled by
328 handle_signal(signr, &info, &ka, regs); 301 * kernel without return to userspace
302 */
303 if (unlikely(restart) && regs->pc == restart_addr) {
304 regs->pc = continue_addr;
305 return restart;
306 }
329 } 307 }
330 308
331 return; 309 return 0;
332} 310}
333 311
334asmlinkage void do_notify_resume(struct pt_regs *regs) 312asmlinkage int
313do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
335{ 314{
336 if (current_thread_info()->flags & _TIF_SIGPENDING) 315 do {
337 do_signal(regs); 316 if (likely(thread_flags & _TIF_NEED_RESCHED)) {
338 317 schedule();
339 if (current_thread_info()->flags & _TIF_NOTIFY_RESUME) { 318 } else {
340 clear_thread_flag(TIF_NOTIFY_RESUME); 319 if (unlikely(!user_mode(regs)))
341 tracehook_notify_resume(regs); 320 return 0;
342 } 321 local_irq_enable();
322 if (thread_flags & _TIF_SIGPENDING) {
323 int restart = do_signal(regs, syscall);
324 if (unlikely(restart)) {
325 /*
326 * Restart without handlers.
327 * Deal with it without leaving
328 * the kernel space.
329 */
330 return restart;
331 }
332 syscall = 0;
333 } else {
334 clear_thread_flag(TIF_NOTIFY_RESUME);
335 tracehook_notify_resume(regs);
336 }
337 }
338 local_irq_disable();
339 thread_flags = current_thread_info()->flags;
340 } while (thread_flags & _TIF_WORK_MASK);
341 return 0;
343} 342}
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index b5f1858baf33..bb2a8ec440e7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -229,13 +229,13 @@ config SMP
229 bool "Symmetric multi-processing support" 229 bool "Symmetric multi-processing support"
230 ---help--- 230 ---help---
231 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
232 a system with only one CPU, like most personal computers, say N. If 232 a system with only one CPU, say N. If you have a system with more
233 you have a system with more than one CPU, say Y. 233 than one CPU, say Y.
234 234
235 If you say N here, the kernel will run on single and multiprocessor 235 If you say N here, the kernel will run on uni- and multiprocessor
236 machines, but will use only one CPU of a multiprocessor machine. If 236 machines, but will use only one CPU of a multiprocessor machine. If
237 you say Y here, the kernel will run on many, but not all, 237 you say Y here, the kernel will run on many, but not all,
238 singleprocessor machines. On a singleprocessor machine, the kernel 238 uniprocessor machines. On a uniprocessor machine, the kernel
239 will run faster if you say N here. 239 will run faster if you say N here.
240 240
241 See also <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO 241 See also <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 34b0be4ca52d..752c981bc3c7 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -6,3 +6,4 @@ generic-y += word-at-a-time.h auxvec.h user.h cputime.h emergency-restart.h \
6 poll.h xor.h clkdev.h exec.h 6 poll.h xor.h clkdev.h exec.h
7generic-y += trace_clock.h 7generic-y += trace_clock.h
8generic-y += preempt.h 8generic-y += preempt.h
9generic-y += hash.h
diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index 2f9b751878ba..de65f66ea64e 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -132,7 +132,6 @@ void mark_rodata_ro(void);
132static inline void *kmap(struct page *page) 132static inline void *kmap(struct page *page)
133{ 133{
134 might_sleep(); 134 might_sleep();
135 flush_dcache_page(page);
136 return page_address(page); 135 return page_address(page);
137} 136}
138 137
@@ -144,7 +143,6 @@ static inline void kunmap(struct page *page)
144static inline void *kmap_atomic(struct page *page) 143static inline void *kmap_atomic(struct page *page)
145{ 144{
146 pagefault_disable(); 145 pagefault_disable();
147 flush_dcache_page(page);
148 return page_address(page); 146 return page_address(page);
149} 147}
150 148
diff --git a/arch/parisc/include/asm/elf.h b/arch/parisc/include/asm/elf.h
index ad2b50397894..3391d061eccc 100644
--- a/arch/parisc/include/asm/elf.h
+++ b/arch/parisc/include/asm/elf.h
@@ -348,4 +348,8 @@ struct pt_regs; /* forward declaration... */
348 348
349#define ELF_HWCAP 0 349#define ELF_HWCAP 0
350 350
351struct mm_struct;
352extern unsigned long arch_randomize_brk(struct mm_struct *);
353#define arch_randomize_brk arch_randomize_brk
354
351#endif 355#endif
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index c53fc63149e8..637fe031aa84 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -29,7 +29,8 @@ struct page;
29void clear_page_asm(void *page); 29void clear_page_asm(void *page);
30void copy_page_asm(void *to, void *from); 30void copy_page_asm(void *to, void *from);
31#define clear_user_page(vto, vaddr, page) clear_page_asm(vto) 31#define clear_user_page(vto, vaddr, page) clear_page_asm(vto)
32#define copy_user_page(vto, vfrom, vaddr, page) copy_page_asm(vto, vfrom) 32void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
33 struct page *pg);
33 34
34/* #define CONFIG_PARISC_TMPALIAS */ 35/* #define CONFIG_PARISC_TMPALIAS */
35 36
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 34899b5d959a..22b89d1edba7 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -511,6 +511,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
511/* We provide our own get_unmapped_area to provide cache coherency */ 511/* We provide our own get_unmapped_area to provide cache coherency */
512 512
513#define HAVE_ARCH_UNMAPPED_AREA 513#define HAVE_ARCH_UNMAPPED_AREA
514#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
514 515
515#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 516#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
516#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 517#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h
index cc2290a3cace..198a86feb574 100644
--- a/arch/parisc/include/asm/processor.h
+++ b/arch/parisc/include/asm/processor.h
@@ -30,6 +30,8 @@
30#endif 30#endif
31#define current_text_addr() ({ void *pc; current_ia(pc); pc; }) 31#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
32 32
33#define HAVE_ARCH_PICK_MMAP_LAYOUT
34
33#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size) 35#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
34#define TASK_SIZE TASK_SIZE_OF(current) 36#define TASK_SIZE TASK_SIZE_OF(current)
35#define TASK_UNMAPPED_BASE (current->thread.map_base) 37#define TASK_UNMAPPED_BASE (current->thread.map_base)
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index d5f97ea3a4e1..4b9b10ce1f9d 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -76,6 +76,16 @@ struct thread_info {
76#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 76#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
77 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT) 77 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT)
78 78
79#ifdef CONFIG_64BIT
80# ifdef CONFIG_COMPAT
81# define is_32bit_task() (test_thread_flag(TIF_32BIT))
82# else
83# define is_32bit_task() (0)
84# endif
85#else
86# define is_32bit_task() (1)
87#endif
88
79#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
80 90
81#endif /* _ASM_PARISC_THREAD_INFO_H */ 91#endif /* _ASM_PARISC_THREAD_INFO_H */
diff --git a/arch/parisc/include/uapi/asm/errno.h b/arch/parisc/include/uapi/asm/errno.h
index f3a8aa554841..c0ae62520d15 100644
--- a/arch/parisc/include/uapi/asm/errno.h
+++ b/arch/parisc/include/uapi/asm/errno.h
@@ -106,7 +106,7 @@
106 106
107#define EALREADY 244 /* Operation already in progress */ 107#define EALREADY 244 /* Operation already in progress */
108#define EINPROGRESS 245 /* Operation now in progress */ 108#define EINPROGRESS 245 /* Operation now in progress */
109#define EWOULDBLOCK 246 /* Operation would block (Linux returns EAGAIN) */ 109#define EWOULDBLOCK EAGAIN /* Operation would block (Not HPUX compliant) */
110#define ENOTEMPTY 247 /* Directory not empty */ 110#define ENOTEMPTY 247 /* Directory not empty */
111#define ENAMETOOLONG 248 /* File name too long */ 111#define ENAMETOOLONG 248 /* File name too long */
112#define ELOOP 249 /* Too many symbolic links encountered */ 112#define ELOOP 249 /* Too many symbolic links encountered */
diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
index 70b3674dac4e..fe35ceacf0e7 100644
--- a/arch/parisc/include/uapi/asm/socket.h
+++ b/arch/parisc/include/uapi/asm/socket.h
@@ -77,4 +77,6 @@
77 77
78#define SO_MAX_PACING_RATE 0x4028 78#define SO_MAX_PACING_RATE 0x4028
79 79
80#define SO_BPF_EXTENSIONS 0x4029
81
80#endif /* _UAPI_ASM_SOCKET_H */ 82#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/parisc/include/uapi/asm/stat.h b/arch/parisc/include/uapi/asm/stat.h
index d76fbda5d62c..b606b366d0a7 100644
--- a/arch/parisc/include/uapi/asm/stat.h
+++ b/arch/parisc/include/uapi/asm/stat.h
@@ -5,67 +5,65 @@
5 5
6struct stat { 6struct stat {
7 unsigned int st_dev; /* dev_t is 32 bits on parisc */ 7 unsigned int st_dev; /* dev_t is 32 bits on parisc */
8 ino_t st_ino; /* 32 bits */ 8 unsigned int st_ino; /* 32 bits */
9 mode_t st_mode; /* 16 bits */ 9 unsigned short st_mode; /* 16 bits */
10 unsigned short st_nlink; /* 16 bits */ 10 unsigned short st_nlink; /* 16 bits */
11 unsigned short st_reserved1; /* old st_uid */ 11 unsigned short st_reserved1; /* old st_uid */
12 unsigned short st_reserved2; /* old st_gid */ 12 unsigned short st_reserved2; /* old st_gid */
13 unsigned int st_rdev; 13 unsigned int st_rdev;
14 off_t st_size; 14 signed int st_size;
15 time_t st_atime; 15 signed int st_atime;
16 unsigned int st_atime_nsec; 16 unsigned int st_atime_nsec;
17 time_t st_mtime; 17 signed int st_mtime;
18 unsigned int st_mtime_nsec; 18 unsigned int st_mtime_nsec;
19 time_t st_ctime; 19 signed int st_ctime;
20 unsigned int st_ctime_nsec; 20 unsigned int st_ctime_nsec;
21 int st_blksize; 21 int st_blksize;
22 int st_blocks; 22 int st_blocks;
23 unsigned int __unused1; /* ACL stuff */ 23 unsigned int __unused1; /* ACL stuff */
24 unsigned int __unused2; /* network */ 24 unsigned int __unused2; /* network */
25 ino_t __unused3; /* network */ 25 unsigned int __unused3; /* network */
26 unsigned int __unused4; /* cnodes */ 26 unsigned int __unused4; /* cnodes */
27 unsigned short __unused5; /* netsite */ 27 unsigned short __unused5; /* netsite */
28 short st_fstype; 28 short st_fstype;
29 unsigned int st_realdev; 29 unsigned int st_realdev;
30 unsigned short st_basemode; 30 unsigned short st_basemode;
31 unsigned short st_spareshort; 31 unsigned short st_spareshort;
32 uid_t st_uid; 32 unsigned int st_uid;
33 gid_t st_gid; 33 unsigned int st_gid;
34 unsigned int st_spare4[3]; 34 unsigned int st_spare4[3];
35}; 35};
36 36
37#define STAT_HAVE_NSEC 37#define STAT_HAVE_NSEC
38 38
39typedef __kernel_off64_t off64_t;
40
41struct hpux_stat64 { 39struct hpux_stat64 {
42 unsigned int st_dev; /* dev_t is 32 bits on parisc */ 40 unsigned int st_dev; /* dev_t is 32 bits on parisc */
43 ino_t st_ino; /* 32 bits */ 41 unsigned int st_ino; /* 32 bits */
44 mode_t st_mode; /* 16 bits */ 42 unsigned short st_mode; /* 16 bits */
45 unsigned short st_nlink; /* 16 bits */ 43 unsigned short st_nlink; /* 16 bits */
46 unsigned short st_reserved1; /* old st_uid */ 44 unsigned short st_reserved1; /* old st_uid */
47 unsigned short st_reserved2; /* old st_gid */ 45 unsigned short st_reserved2; /* old st_gid */
48 unsigned int st_rdev; 46 unsigned int st_rdev;
49 off64_t st_size; 47 signed long long st_size;
50 time_t st_atime; 48 signed int st_atime;
51 unsigned int st_spare1; 49 unsigned int st_spare1;
52 time_t st_mtime; 50 signed int st_mtime;
53 unsigned int st_spare2; 51 unsigned int st_spare2;
54 time_t st_ctime; 52 signed int st_ctime;
55 unsigned int st_spare3; 53 unsigned int st_spare3;
56 int st_blksize; 54 int st_blksize;
57 __u64 st_blocks; 55 unsigned long long st_blocks;
58 unsigned int __unused1; /* ACL stuff */ 56 unsigned int __unused1; /* ACL stuff */
59 unsigned int __unused2; /* network */ 57 unsigned int __unused2; /* network */
60 ino_t __unused3; /* network */ 58 unsigned int __unused3; /* network */
61 unsigned int __unused4; /* cnodes */ 59 unsigned int __unused4; /* cnodes */
62 unsigned short __unused5; /* netsite */ 60 unsigned short __unused5; /* netsite */
63 short st_fstype; 61 short st_fstype;
64 unsigned int st_realdev; 62 unsigned int st_realdev;
65 unsigned short st_basemode; 63 unsigned short st_basemode;
66 unsigned short st_spareshort; 64 unsigned short st_spareshort;
67 uid_t st_uid; 65 unsigned int st_uid;
68 gid_t st_gid; 66 unsigned int st_gid;
69 unsigned int st_spare4[3]; 67 unsigned int st_spare4[3];
70}; 68};
71 69
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index 2c8b9bde18eb..42706794a36f 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -826,8 +826,10 @@
826#define __NR_process_vm_writev (__NR_Linux + 331) 826#define __NR_process_vm_writev (__NR_Linux + 331)
827#define __NR_kcmp (__NR_Linux + 332) 827#define __NR_kcmp (__NR_Linux + 332)
828#define __NR_finit_module (__NR_Linux + 333) 828#define __NR_finit_module (__NR_Linux + 333)
829#define __NR_sched_setattr (__NR_Linux + 334)
830#define __NR_sched_getattr (__NR_Linux + 335)
829 831
830#define __NR_Linux_syscalls (__NR_finit_module + 1) 832#define __NR_Linux_syscalls (__NR_sched_getattr + 1)
831 833
832 834
833#define __IGNORE_select /* newselect */ 835#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index a72545554a31..ac87a40502e6 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -388,6 +388,20 @@ void flush_kernel_dcache_page_addr(void *addr)
388} 388}
389EXPORT_SYMBOL(flush_kernel_dcache_page_addr); 389EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
390 390
391void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
392 struct page *pg)
393{
394 /* Copy using kernel mapping. No coherency is needed (all in
395 kunmap) for the `to' page. However, the `from' page needs to
396 be flushed through a mapping equivalent to the user mapping
397 before it can be accessed through the kernel mapping. */
398 preempt_disable();
399 flush_dcache_page_asm(__pa(vfrom), vaddr);
400 preempt_enable();
401 copy_page_asm(vto, vfrom);
402}
403EXPORT_SYMBOL(copy_user_page);
404
391void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) 405void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
392{ 406{
393 unsigned long flags; 407 unsigned long flags;
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index 14285caec71a..dba508fe1683 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -282,18 +282,6 @@ find_pa_parent_type(const struct parisc_device *padev, int type)
282 return NULL; 282 return NULL;
283} 283}
284 284
285#ifdef CONFIG_PCI
286static inline int is_pci_dev(struct device *dev)
287{
288 return dev->bus == &pci_bus_type;
289}
290#else
291static inline int is_pci_dev(struct device *dev)
292{
293 return 0;
294}
295#endif
296
297/* 285/*
298 * get_node_path fills in @path with the firmware path to the device. 286 * get_node_path fills in @path with the firmware path to the device.
299 * Note that if @node is a parisc device, we don't fill in the 'mod' field. 287 * Note that if @node is a parisc device, we don't fill in the 'mod' field.
@@ -306,7 +294,7 @@ static void get_node_path(struct device *dev, struct hardware_path *path)
306 int i = 5; 294 int i = 5;
307 memset(&path->bc, -1, 6); 295 memset(&path->bc, -1, 6);
308 296
309 if (is_pci_dev(dev)) { 297 if (dev_is_pci(dev)) {
310 unsigned int devfn = to_pci_dev(dev)->devfn; 298 unsigned int devfn = to_pci_dev(dev)->devfn;
311 path->mod = PCI_FUNC(devfn); 299 path->mod = PCI_FUNC(devfn);
312 path->bc[i--] = PCI_SLOT(devfn); 300 path->bc[i--] = PCI_SLOT(devfn);
@@ -314,7 +302,7 @@ static void get_node_path(struct device *dev, struct hardware_path *path)
314 } 302 }
315 303
316 while (dev != &root) { 304 while (dev != &root) {
317 if (is_pci_dev(dev)) { 305 if (dev_is_pci(dev)) {
318 unsigned int devfn = to_pci_dev(dev)->devfn; 306 unsigned int devfn = to_pci_dev(dev)->devfn;
319 path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5); 307 path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5);
320 } else if (dev->bus == &parisc_bus_type) { 308 } else if (dev->bus == &parisc_bus_type) {
@@ -695,7 +683,7 @@ static int check_parent(struct device * dev, void * data)
695 if (dev->bus == &parisc_bus_type) { 683 if (dev->bus == &parisc_bus_type) {
696 if (match_parisc_device(dev, d->index, d->modpath)) 684 if (match_parisc_device(dev, d->index, d->modpath))
697 d->dev = dev; 685 d->dev = dev;
698 } else if (is_pci_dev(dev)) { 686 } else if (dev_is_pci(dev)) {
699 if (match_pci_device(dev, d->index, d->modpath)) 687 if (match_pci_device(dev, d->index, d->modpath))
700 d->dev = dev; 688 d->dev = dev;
701 } else if (dev->bus == NULL) { 689 } else if (dev->bus == NULL) {
@@ -753,7 +741,7 @@ struct device *hwpath_to_device(struct hardware_path *modpath)
753 if (!parent) 741 if (!parent)
754 return NULL; 742 return NULL;
755 } 743 }
756 if (is_pci_dev(parent)) /* pci devices already parse MOD */ 744 if (dev_is_pci(parent)) /* pci devices already parse MOD */
757 return parent; 745 return parent;
758 else 746 else
759 return parse_tree_node(parent, 6, modpath); 747 return parse_tree_node(parent, 6, modpath);
@@ -772,7 +760,7 @@ void device_to_hwpath(struct device *dev, struct hardware_path *path)
772 padev = to_parisc_device(dev); 760 padev = to_parisc_device(dev);
773 get_node_path(dev->parent, path); 761 get_node_path(dev->parent, path);
774 path->mod = padev->hw_path; 762 path->mod = padev->hw_path;
775 } else if (is_pci_dev(dev)) { 763 } else if (dev_is_pci(dev)) {
776 get_node_path(dev, path); 764 get_node_path(dev, path);
777 } 765 }
778} 766}
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 55f92b614182..0bbbf0d3f608 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -13,7 +13,7 @@
13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org> 13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org>
14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org> 14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org>
15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> 15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
16 * Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org> 16 * Copyright (C) 2001-2014 Helge Deller <deller@gmx.de>
17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
18 * 18 *
19 * 19 *
@@ -49,6 +49,7 @@
49#include <linux/kallsyms.h> 49#include <linux/kallsyms.h>
50#include <linux/uaccess.h> 50#include <linux/uaccess.h>
51#include <linux/rcupdate.h> 51#include <linux/rcupdate.h>
52#include <linux/random.h>
52 53
53#include <asm/io.h> 54#include <asm/io.h>
54#include <asm/asm-offsets.h> 55#include <asm/asm-offsets.h>
@@ -286,3 +287,21 @@ void *dereference_function_descriptor(void *ptr)
286 return ptr; 287 return ptr;
287} 288}
288#endif 289#endif
290
291static inline unsigned long brk_rnd(void)
292{
293 /* 8MB for 32bit, 1GB for 64bit */
294 if (is_32bit_task())
295 return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
296 else
297 return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT;
298}
299
300unsigned long arch_randomize_brk(struct mm_struct *mm)
301{
302 unsigned long ret = PAGE_ALIGN(mm->brk + brk_rnd());
303
304 if (ret < mm->brk)
305 return mm->brk;
306 return ret;
307}
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 0d3a9d4927b5..b7cadc4a06cd 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -5,6 +5,7 @@
5 * Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org> 5 * Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org>
6 * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org> 6 * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org>
7 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org> 7 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
8 * Copyright (C) 1999-2014 Helge Deller <deller@gmx.de>
8 * 9 *
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
@@ -23,6 +24,7 @@
23 */ 24 */
24 25
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/elf.h>
26#include <linux/file.h> 28#include <linux/file.h>
27#include <linux/fs.h> 29#include <linux/fs.h>
28#include <linux/linkage.h> 30#include <linux/linkage.h>
@@ -32,78 +34,230 @@
32#include <linux/syscalls.h> 34#include <linux/syscalls.h>
33#include <linux/utsname.h> 35#include <linux/utsname.h>
34#include <linux/personality.h> 36#include <linux/personality.h>
37#include <linux/random.h>
35 38
36static unsigned long get_unshared_area(unsigned long addr, unsigned long len) 39/* we construct an artificial offset for the mapping based on the physical
40 * address of the kernel mapping variable */
41#define GET_LAST_MMAP(filp) \
42 (filp ? ((unsigned long) filp->f_mapping) >> 8 : 0UL)
43#define SET_LAST_MMAP(filp, val) \
44 { /* nothing */ }
45
46static int get_offset(unsigned int last_mmap)
37{ 47{
38 struct vm_unmapped_area_info info; 48 return (last_mmap & (SHMLBA-1)) >> PAGE_SHIFT;
49}
39 50
40 info.flags = 0; 51static unsigned long shared_align_offset(unsigned int last_mmap,
41 info.length = len; 52 unsigned long pgoff)
42 info.low_limit = PAGE_ALIGN(addr); 53{
43 info.high_limit = TASK_SIZE; 54 return (get_offset(last_mmap) + pgoff) << PAGE_SHIFT;
44 info.align_mask = 0;
45 info.align_offset = 0;
46 return vm_unmapped_area(&info);
47} 55}
48 56
49/* 57static inline unsigned long COLOR_ALIGN(unsigned long addr,
50 * We need to know the offset to use. Old scheme was to look for 58 unsigned int last_mmap, unsigned long pgoff)
51 * existing mapping and use the same offset. New scheme is to use the
52 * address of the kernel data structure as the seed for the offset.
53 * We'll see how that works...
54 *
55 * The mapping is cacheline aligned, so there's no information in the bottom
56 * few bits of the address. We're looking for 10 bits (4MB / 4k), so let's
57 * drop the bottom 8 bits and use bits 8-17.
58 */
59static int get_offset(struct address_space *mapping)
60{ 59{
61 return (unsigned long) mapping >> 8; 60 unsigned long base = (addr+SHMLBA-1) & ~(SHMLBA-1);
61 unsigned long off = (SHMLBA-1) &
62 (shared_align_offset(last_mmap, pgoff) << PAGE_SHIFT);
63
64 return base + off;
62} 65}
63 66
64static unsigned long shared_align_offset(struct file *filp, unsigned long pgoff) 67/*
68 * Top of mmap area (just below the process stack).
69 */
70
71static unsigned long mmap_upper_limit(void)
65{ 72{
66 struct address_space *mapping = filp ? filp->f_mapping : NULL; 73 unsigned long stack_base;
67 74
68 return (get_offset(mapping) + pgoff) << PAGE_SHIFT; 75 /* Limit stack size to 1GB - see setup_arg_pages() in fs/exec.c */
76 stack_base = rlimit_max(RLIMIT_STACK);
77 if (stack_base > (1 << 30))
78 stack_base = 1 << 30;
79
80 return PAGE_ALIGN(STACK_TOP - stack_base);
69} 81}
70 82
71static unsigned long get_shared_area(struct file *filp, unsigned long addr, 83
72 unsigned long len, unsigned long pgoff) 84unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
85 unsigned long len, unsigned long pgoff, unsigned long flags)
73{ 86{
87 struct mm_struct *mm = current->mm;
88 struct vm_area_struct *vma;
89 unsigned long task_size = TASK_SIZE;
90 int do_color_align, last_mmap;
74 struct vm_unmapped_area_info info; 91 struct vm_unmapped_area_info info;
75 92
93 if (len > task_size)
94 return -ENOMEM;
95
96 do_color_align = 0;
97 if (filp || (flags & MAP_SHARED))
98 do_color_align = 1;
99 last_mmap = GET_LAST_MMAP(filp);
100
101 if (flags & MAP_FIXED) {
102 if ((flags & MAP_SHARED) && last_mmap &&
103 (addr - shared_align_offset(last_mmap, pgoff))
104 & (SHMLBA - 1))
105 return -EINVAL;
106 goto found_addr;
107 }
108
109 if (addr) {
110 if (do_color_align && last_mmap)
111 addr = COLOR_ALIGN(addr, last_mmap, pgoff);
112 else
113 addr = PAGE_ALIGN(addr);
114
115 vma = find_vma(mm, addr);
116 if (task_size - len >= addr &&
117 (!vma || addr + len <= vma->vm_start))
118 goto found_addr;
119 }
120
76 info.flags = 0; 121 info.flags = 0;
77 info.length = len; 122 info.length = len;
78 info.low_limit = PAGE_ALIGN(addr); 123 info.low_limit = mm->mmap_legacy_base;
79 info.high_limit = TASK_SIZE; 124 info.high_limit = mmap_upper_limit();
80 info.align_mask = PAGE_MASK & (SHMLBA - 1); 125 info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0;
81 info.align_offset = shared_align_offset(filp, pgoff); 126 info.align_offset = shared_align_offset(last_mmap, pgoff);
82 return vm_unmapped_area(&info); 127 addr = vm_unmapped_area(&info);
128
129found_addr:
130 if (do_color_align && !last_mmap && !(addr & ~PAGE_MASK))
131 SET_LAST_MMAP(filp, addr - (pgoff << PAGE_SHIFT));
132
133 return addr;
83} 134}
84 135
85unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, 136unsigned long
86 unsigned long len, unsigned long pgoff, unsigned long flags) 137arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
138 const unsigned long len, const unsigned long pgoff,
139 const unsigned long flags)
87{ 140{
141 struct vm_area_struct *vma;
142 struct mm_struct *mm = current->mm;
143 unsigned long addr = addr0;
144 int do_color_align, last_mmap;
145 struct vm_unmapped_area_info info;
146
147#ifdef CONFIG_64BIT
148 /* This should only ever run for 32-bit processes. */
149 BUG_ON(!test_thread_flag(TIF_32BIT));
150#endif
151
152 /* requested length too big for entire address space */
88 if (len > TASK_SIZE) 153 if (len > TASK_SIZE)
89 return -ENOMEM; 154 return -ENOMEM;
155
156 do_color_align = 0;
157 if (filp || (flags & MAP_SHARED))
158 do_color_align = 1;
159 last_mmap = GET_LAST_MMAP(filp);
160
90 if (flags & MAP_FIXED) { 161 if (flags & MAP_FIXED) {
91 if ((flags & MAP_SHARED) && 162 if ((flags & MAP_SHARED) && last_mmap &&
92 (addr - shared_align_offset(filp, pgoff)) & (SHMLBA - 1)) 163 (addr - shared_align_offset(last_mmap, pgoff))
164 & (SHMLBA - 1))
93 return -EINVAL; 165 return -EINVAL;
94 return addr; 166 goto found_addr;
95 } 167 }
96 if (!addr)
97 addr = TASK_UNMAPPED_BASE;
98 168
99 if (filp || (flags & MAP_SHARED)) 169 /* requesting a specific address */
100 addr = get_shared_area(filp, addr, len, pgoff); 170 if (addr) {
101 else 171 if (do_color_align && last_mmap)
102 addr = get_unshared_area(addr, len); 172 addr = COLOR_ALIGN(addr, last_mmap, pgoff);
173 else
174 addr = PAGE_ALIGN(addr);
175 vma = find_vma(mm, addr);
176 if (TASK_SIZE - len >= addr &&
177 (!vma || addr + len <= vma->vm_start))
178 goto found_addr;
179 }
180
181 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
182 info.length = len;
183 info.low_limit = PAGE_SIZE;
184 info.high_limit = mm->mmap_base;
185 info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0;
186 info.align_offset = shared_align_offset(last_mmap, pgoff);
187 addr = vm_unmapped_area(&info);
188 if (!(addr & ~PAGE_MASK))
189 goto found_addr;
190 VM_BUG_ON(addr != -ENOMEM);
191
192 /*
193 * A failed mmap() very likely causes application failure,
194 * so fall back to the bottom-up function here. This scenario
195 * can happen with large stack limits and large mmap()
196 * allocations.
197 */
198 return arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
199
200found_addr:
201 if (do_color_align && !last_mmap && !(addr & ~PAGE_MASK))
202 SET_LAST_MMAP(filp, addr - (pgoff << PAGE_SHIFT));
103 203
104 return addr; 204 return addr;
105} 205}
106 206
207static int mmap_is_legacy(void)
208{
209 if (current->personality & ADDR_COMPAT_LAYOUT)
210 return 1;
211
212 /* parisc stack always grows up - so a unlimited stack should
213 * not be an indicator to use the legacy memory layout.
214 * if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
215 * return 1;
216 */
217
218 return sysctl_legacy_va_layout;
219}
220
221static unsigned long mmap_rnd(void)
222{
223 unsigned long rnd = 0;
224
225 /*
226 * 8 bits of randomness in 32bit mmaps, 20 address space bits
227 * 28 bits of randomness in 64bit mmaps, 40 address space bits
228 */
229 if (current->flags & PF_RANDOMIZE) {
230 if (is_32bit_task())
231 rnd = get_random_int() % (1<<8);
232 else
233 rnd = get_random_int() % (1<<28);
234 }
235 return rnd << PAGE_SHIFT;
236}
237
238static unsigned long mmap_legacy_base(void)
239{
240 return TASK_UNMAPPED_BASE + mmap_rnd();
241}
242
243/*
244 * This function, called very early during the creation of a new
245 * process VM image, sets up which VM layout function to use:
246 */
247void arch_pick_mmap_layout(struct mm_struct *mm)
248{
249 mm->mmap_legacy_base = mmap_legacy_base();
250 mm->mmap_base = mmap_upper_limit();
251
252 if (mmap_is_legacy()) {
253 mm->mmap_base = mm->mmap_legacy_base;
254 mm->get_unmapped_area = arch_get_unmapped_area;
255 } else {
256 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
257 }
258}
259
260
107asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 261asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
108 unsigned long prot, unsigned long flags, unsigned long fd, 262 unsigned long prot, unsigned long flags, unsigned long fd,
109 unsigned long pgoff) 263 unsigned long pgoff)
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 0c9107285e66..8fa3fbb3e4d3 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -429,6 +429,8 @@
429 ENTRY_COMP(process_vm_writev) 429 ENTRY_COMP(process_vm_writev)
430 ENTRY_SAME(kcmp) 430 ENTRY_SAME(kcmp)
431 ENTRY_SAME(finit_module) 431 ENTRY_SAME(finit_module)
432 ENTRY_SAME(sched_setattr)
433 ENTRY_SAME(sched_getattr) /* 335 */
432 434
433 /* Nothing yet */ 435 /* Nothing yet */
434 436
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 96f8168cf4ec..ae085ad0fba0 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -645,55 +645,30 @@ EXPORT_SYMBOL(empty_zero_page);
645 645
646void show_mem(unsigned int filter) 646void show_mem(unsigned int filter)
647{ 647{
648 int i,free = 0,total = 0,reserved = 0; 648 int total = 0,reserved = 0;
649 int shared = 0, cached = 0; 649 pg_data_t *pgdat;
650 650
651 printk(KERN_INFO "Mem-info:\n"); 651 printk(KERN_INFO "Mem-info:\n");
652 show_free_areas(filter); 652 show_free_areas(filter);
653 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
654 return;
655#ifndef CONFIG_DISCONTIGMEM
656 i = max_mapnr;
657 while (i-- > 0) {
658 total++;
659 if (PageReserved(mem_map+i))
660 reserved++;
661 else if (PageSwapCache(mem_map+i))
662 cached++;
663 else if (!page_count(&mem_map[i]))
664 free++;
665 else
666 shared += page_count(&mem_map[i]) - 1;
667 }
668#else
669 for (i = 0; i < npmem_ranges; i++) {
670 int j;
671 653
672 for (j = node_start_pfn(i); j < node_end_pfn(i); j++) { 654 for_each_online_pgdat(pgdat) {
673 struct page *p; 655 unsigned long flags;
674 unsigned long flags; 656 int zoneid;
675 657
676 pgdat_resize_lock(NODE_DATA(i), &flags); 658 pgdat_resize_lock(pgdat, &flags);
677 p = nid_page_nr(i, j) - node_start_pfn(i); 659 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
678 660 struct zone *zone = &pgdat->node_zones[zoneid];
679 total++; 661 if (!populated_zone(zone))
680 if (PageReserved(p)) 662 continue;
681 reserved++; 663
682 else if (PageSwapCache(p)) 664 total += zone->present_pages;
683 cached++; 665 reserved = zone->present_pages - zone->managed_pages;
684 else if (!page_count(p)) 666 }
685 free++; 667 pgdat_resize_unlock(pgdat, &flags);
686 else
687 shared += page_count(p) - 1;
688 pgdat_resize_unlock(NODE_DATA(i), &flags);
689 }
690 } 668 }
691#endif 669
692 printk(KERN_INFO "%d pages of RAM\n", total); 670 printk(KERN_INFO "%d pages of RAM\n", total);
693 printk(KERN_INFO "%d reserved pages\n", reserved); 671 printk(KERN_INFO "%d reserved pages\n", reserved);
694 printk(KERN_INFO "%d pages shared\n", shared);
695 printk(KERN_INFO "%d pages swap cached\n", cached);
696
697 672
698#ifdef CONFIG_DISCONTIGMEM 673#ifdef CONFIG_DISCONTIGMEM
699 { 674 {
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index b2be8e8cb5c7..957bf344c0f5 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -86,6 +86,7 @@ config PPC
86 bool 86 bool
87 default y 87 default y
88 select ARCH_MIGHT_HAVE_PC_PARPORT 88 select ARCH_MIGHT_HAVE_PC_PARPORT
89 select ARCH_MIGHT_HAVE_PC_SERIO
89 select BINFMT_ELF 90 select BINFMT_ELF
90 select OF 91 select OF
91 select OF_EARLY_FLATTREE 92 select OF_EARLY_FLATTREE
@@ -139,6 +140,7 @@ config PPC
139 select OLD_SIGACTION if PPC32 140 select OLD_SIGACTION if PPC32
140 select HAVE_DEBUG_STACKOVERFLOW 141 select HAVE_DEBUG_STACKOVERFLOW
141 select HAVE_IRQ_EXIT_ON_IRQ_STACK 142 select HAVE_IRQ_EXIT_ON_IRQ_STACK
143 select ARCH_USE_CMPXCHG_LOCKREF if PPC64
142 144
143config GENERIC_CSUM 145config GENERIC_CSUM
144 def_bool CPU_LITTLE_ENDIAN 146 def_bool CPU_LITTLE_ENDIAN
@@ -213,9 +215,6 @@ config DEFAULT_UIMAGE
213 Used to allow a board to specify it wants a uImage built by default 215 Used to allow a board to specify it wants a uImage built by default
214 default n 216 default n
215 217
216config REDBOOT
217 bool
218
219config ARCH_HIBERNATION_POSSIBLE 218config ARCH_HIBERNATION_POSSIBLE
220 bool 219 bool
221 default y 220 default y
@@ -343,6 +342,8 @@ config PPC_TRANSACTIONAL_MEM
343 bool "Transactional Memory support for POWERPC" 342 bool "Transactional Memory support for POWERPC"
344 depends on PPC_BOOK3S_64 343 depends on PPC_BOOK3S_64
345 depends on SMP 344 depends on SMP
345 select ALTIVEC
346 select VSX
346 default n 347 default n
347 ---help--- 348 ---help---
348 Support user-mode Transactional Memory on POWERPC. 349 Support user-mode Transactional Memory on POWERPC.
@@ -383,6 +384,12 @@ config ARCH_HAS_WALK_MEMORY
383config ARCH_ENABLE_MEMORY_HOTREMOVE 384config ARCH_ENABLE_MEMORY_HOTREMOVE
384 def_bool y 385 def_bool y
385 386
387config PPC64_SUPPORTS_MEMORY_FAILURE
388 bool "Add support for memory hwpoison"
389 depends on PPC_BOOK3S_64
390 default "y" if PPC_POWERNV
391 select ARCH_SUPPORTS_MEMORY_FAILURE
392
386config KEXEC 393config KEXEC
387 bool "kexec system call" 394 bool "kexec system call"
388 depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) 395 depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
@@ -403,8 +410,7 @@ config KEXEC
403config CRASH_DUMP 410config CRASH_DUMP
404 bool "Build a kdump crash kernel" 411 bool "Build a kdump crash kernel"
405 depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP) 412 depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
406 select RELOCATABLE if PPC64 || 44x 413 select RELOCATABLE if PPC64 || 44x || FSL_BOOKE
407 select DYNAMIC_MEMSTART if FSL_BOOKE
408 help 414 help
409 Build a kernel suitable for use as a kdump capture kernel. 415 Build a kernel suitable for use as a kdump capture kernel.
410 The same kernel binary can be used as production kernel and dump 416 The same kernel binary can be used as production kernel and dump
@@ -528,6 +534,7 @@ config PPC_16K_PAGES
528 534
529config PPC_64K_PAGES 535config PPC_64K_PAGES
530 bool "64k page size" if 44x || PPC_STD_MMU_64 || PPC_BOOK3E_64 536 bool "64k page size" if 44x || PPC_STD_MMU_64 || PPC_BOOK3E_64
537 depends on !PPC_FSL_BOOK3E
531 select PPC_HAS_HASH_64K if PPC_STD_MMU_64 538 select PPC_HAS_HASH_64K if PPC_STD_MMU_64
532 539
533config PPC_256K_PAGES 540config PPC_256K_PAGES
@@ -794,7 +801,7 @@ config HAS_RAPIDIO
794 default n 801 default n
795 802
796config RAPIDIO 803config RAPIDIO
797 bool "RapidIO support" 804 tristate "RapidIO support"
798 depends on HAS_RAPIDIO || PCI 805 depends on HAS_RAPIDIO || PCI
799 help 806 help
800 If you say Y here, the kernel will include drivers and 807 If you say Y here, the kernel will include drivers and
@@ -802,7 +809,7 @@ config RAPIDIO
802 809
803config FSL_RIO 810config FSL_RIO
804 bool "Freescale Embedded SRIO Controller support" 811 bool "Freescale Embedded SRIO Controller support"
805 depends on RAPIDIO && HAS_RAPIDIO 812 depends on RAPIDIO = y && HAS_RAPIDIO
806 default "n" 813 default "n"
807 ---help--- 814 ---help---
808 Include support for RapidIO controller on Freescale embedded 815 Include support for RapidIO controller on Freescale embedded
@@ -885,7 +892,7 @@ config DYNAMIC_MEMSTART
885 892
886config RELOCATABLE 893config RELOCATABLE
887 bool "Build a relocatable kernel" 894 bool "Build a relocatable kernel"
888 depends on ADVANCED_OPTIONS && FLATMEM && 44x 895 depends on ADVANCED_OPTIONS && FLATMEM && (44x || FSL_BOOKE)
889 select NONSTATIC_KERNEL 896 select NONSTATIC_KERNEL
890 help 897 help
891 This builds a kernel image that is capable of running at the 898 This builds a kernel image that is capable of running at the
@@ -1041,11 +1048,6 @@ config KEYS_COMPAT
1041 1048
1042source "crypto/Kconfig" 1049source "crypto/Kconfig"
1043 1050
1044config PPC_CLOCK
1045 bool
1046 default n
1047 select HAVE_CLK
1048
1049config PPC_LIB_RHEAP 1051config PPC_LIB_RHEAP
1050 bool 1052 bool
1051 1053
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 554734ff302e..d61c03525777 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -16,6 +16,7 @@ mktree
16uImage 16uImage
17cuImage.* 17cuImage.*
18dtbImage.* 18dtbImage.*
19*.dtb
19treeImage.* 20treeImage.*
20zImage 21zImage
21zImage.initrd 22zImage.initrd
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index ca7f08cc4afd..90e9d9548660 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -71,9 +71,9 @@ src-wlib-y := string.S crt0.S crtsavres.S stdio.c main.c \
71 uartlite.c mpc52xx-psc.c 71 uartlite.c mpc52xx-psc.c
72src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c 72src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
73src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c 73src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
74src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c 74src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c fsl-soc.c
75src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c 75src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
76src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c 76src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c fsl-soc.c
77 77
78src-plat-y := of.c epapr.c 78src-plat-y := of.c epapr.c
79src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \ 79src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
@@ -95,7 +95,7 @@ src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
95src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \ 95src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
96 cuboot-c2k.c gamecube-head.S \ 96 cuboot-c2k.c gamecube-head.S \
97 gamecube.c wii-head.S wii.c holly.c \ 97 gamecube.c wii-head.S wii.c holly.c \
98 prpmc2800.c 98 prpmc2800.c fixed-head.S mvme5100.c
99src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c 99src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
100src-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
101src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c 101src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c epapr-wrapper.c
@@ -286,6 +286,7 @@ image-$(CONFIG_MPC7448HPC2) += cuImage.mpc7448hpc2
286image-$(CONFIG_PPC_C2K) += cuImage.c2k 286image-$(CONFIG_PPC_C2K) += cuImage.c2k
287image-$(CONFIG_GAMECUBE) += dtbImage.gamecube 287image-$(CONFIG_GAMECUBE) += dtbImage.gamecube
288image-$(CONFIG_WII) += dtbImage.wii 288image-$(CONFIG_WII) += dtbImage.wii
289image-$(CONFIG_MVME5100) += dtbImage.mvme5100
289 290
290# Board port in arch/powerpc/platform/amigaone/Kconfig 291# Board port in arch/powerpc/platform/amigaone/Kconfig
291image-$(CONFIG_AMIGAONE) += cuImage.amigaone 292image-$(CONFIG_AMIGAONE) += cuImage.amigaone
diff --git a/arch/powerpc/boot/dts/ac14xx.dts b/arch/powerpc/boot/dts/ac14xx.dts
index a543c4088cba..a1b883730b31 100644
--- a/arch/powerpc/boot/dts/ac14xx.dts
+++ b/arch/powerpc/boot/dts/ac14xx.dts
@@ -139,7 +139,14 @@
139 }; 139 };
140 }; 140 };
141 141
142 clocks {
143 osc {
144 clock-frequency = <25000000>;
145 };
146 };
147
142 soc@80000000 { 148 soc@80000000 {
149 bus-frequency = <80000000>; /* 80 MHz ips bus */
143 150
144 clock@f00 { 151 clock@f00 {
145 compatible = "fsl,mpc5121rev2-clock", "fsl,mpc5121-clock"; 152 compatible = "fsl,mpc5121rev2-clock", "fsl,mpc5121-clock";
diff --git a/arch/powerpc/boot/dts/adder875-redboot.dts b/arch/powerpc/boot/dts/adder875-redboot.dts
index 28e9cd3d7a21..083984720b2f 100644
--- a/arch/powerpc/boot/dts/adder875-redboot.dts
+++ b/arch/powerpc/boot/dts/adder875-redboot.dts
@@ -87,12 +87,10 @@
87 87
88 PHY0: ethernet-phy@0 { 88 PHY0: ethernet-phy@0 {
89 reg = <0>; 89 reg = <0>;
90 device_type = "ethernet-phy";
91 }; 90 };
92 91
93 PHY1: ethernet-phy@1 { 92 PHY1: ethernet-phy@1 {
94 reg = <1>; 93 reg = <1>;
95 device_type = "ethernet-phy";
96 }; 94 };
97 }; 95 };
98 96
diff --git a/arch/powerpc/boot/dts/adder875-uboot.dts b/arch/powerpc/boot/dts/adder875-uboot.dts
index 54fb60ec03e5..e4554caf8f8d 100644
--- a/arch/powerpc/boot/dts/adder875-uboot.dts
+++ b/arch/powerpc/boot/dts/adder875-uboot.dts
@@ -86,12 +86,10 @@
86 86
87 PHY0: ethernet-phy@0 { 87 PHY0: ethernet-phy@0 {
88 reg = <0>; 88 reg = <0>;
89 device_type = "ethernet-phy";
90 }; 89 };
91 90
92 PHY1: ethernet-phy@1 { 91 PHY1: ethernet-phy@1 {
93 reg = <1>; 92 reg = <1>;
94 device_type = "ethernet-phy";
95 }; 93 };
96 }; 94 };
97 95
diff --git a/arch/powerpc/boot/dts/asp834x-redboot.dts b/arch/powerpc/boot/dts/asp834x-redboot.dts
index 227290db866d..9198745f45fb 100644
--- a/arch/powerpc/boot/dts/asp834x-redboot.dts
+++ b/arch/powerpc/boot/dts/asp834x-redboot.dts
@@ -207,14 +207,12 @@
207 interrupt-parent = <&ipic>; 207 interrupt-parent = <&ipic>;
208 interrupts = <17 0x8>; 208 interrupts = <17 0x8>;
209 reg = <0x1>; 209 reg = <0x1>;
210 device_type = "ethernet-phy";
211 }; 210 };
212 211
213 phy1: ethernet-phy@1 { 212 phy1: ethernet-phy@1 {
214 interrupt-parent = <&ipic>; 213 interrupt-parent = <&ipic>;
215 interrupts = <18 0x8>; 214 interrupts = <18 0x8>;
216 reg = <0x2>; 215 reg = <0x2>;
217 device_type = "ethernet-phy";
218 }; 216 };
219 217
220 tbi0: tbi-phy@11 { 218 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/c2k.dts b/arch/powerpc/boot/dts/c2k.dts
index f5d625fa3e52..1e32903cb0a8 100644
--- a/arch/powerpc/boot/dts/c2k.dts
+++ b/arch/powerpc/boot/dts/c2k.dts
@@ -73,19 +73,16 @@
73 compatible = "marvell,mv64360-mdio"; 73 compatible = "marvell,mv64360-mdio";
74 reg = <0x2000 4>; 74 reg = <0x2000 4>;
75 PHY0: ethernet-phy@0 { 75 PHY0: ethernet-phy@0 {
76 device_type = "ethernet-phy";
77 interrupts = <76>; /* GPP 12 */ 76 interrupts = <76>; /* GPP 12 */
78 interrupt-parent = <&PIC>; 77 interrupt-parent = <&PIC>;
79 reg = <0>; 78 reg = <0>;
80 }; 79 };
81 PHY1: ethernet-phy@1 { 80 PHY1: ethernet-phy@1 {
82 device_type = "ethernet-phy";
83 interrupts = <76>; /* GPP 12 */ 81 interrupts = <76>; /* GPP 12 */
84 interrupt-parent = <&PIC>; 82 interrupt-parent = <&PIC>;
85 reg = <1>; 83 reg = <1>;
86 }; 84 };
87 PHY2: ethernet-phy@2 { 85 PHY2: ethernet-phy@2 {
88 device_type = "ethernet-phy";
89 interrupts = <76>; /* GPP 12 */ 86 interrupts = <76>; /* GPP 12 */
90 interrupt-parent = <&PIC>; 87 interrupt-parent = <&PIC>;
91 reg = <2>; 88 reg = <2>;
@@ -174,7 +171,6 @@
174 }; 171 };
175 172
176 MPSC0: mpsc@8000 { 173 MPSC0: mpsc@8000 {
177 device_type = "serial";
178 compatible = "marvell,mv64360-mpsc"; 174 compatible = "marvell,mv64360-mpsc";
179 reg = <0x8000 0x38>; 175 reg = <0x8000 0x38>;
180 virtual-reg = <0xd8008000>; 176 virtual-reg = <0xd8008000>;
@@ -189,7 +185,6 @@
189 }; 185 };
190 186
191 MPSC1: mpsc@9000 { 187 MPSC1: mpsc@9000 {
192 device_type = "serial";
193 compatible = "marvell,mv64360-mpsc"; 188 compatible = "marvell,mv64360-mpsc";
194 reg = <0x9000 0x38>; 189 reg = <0x9000 0x38>;
195 virtual-reg = <0xd8009000>; 190 virtual-reg = <0xd8009000>;
diff --git a/arch/powerpc/boot/dts/ep8248e.dts b/arch/powerpc/boot/dts/ep8248e.dts
index 756758fb5b7b..8b3a49f34f5a 100644
--- a/arch/powerpc/boot/dts/ep8248e.dts
+++ b/arch/powerpc/boot/dts/ep8248e.dts
@@ -67,7 +67,6 @@
67 ranges; 67 ranges;
68 68
69 mdio { 69 mdio {
70 device_type = "mdio";
71 compatible = "fsl,ep8248e-mdio-bitbang"; 70 compatible = "fsl,ep8248e-mdio-bitbang";
72 #address-cells = <1>; 71 #address-cells = <1>;
73 #size-cells = <0>; 72 #size-cells = <0>;
@@ -76,13 +75,11 @@
76 PHY0: ethernet-phy@0 { 75 PHY0: ethernet-phy@0 {
77 interrupt-parent = <&PIC>; 76 interrupt-parent = <&PIC>;
78 reg = <0>; 77 reg = <0>;
79 device_type = "ethernet-phy";
80 }; 78 };
81 79
82 PHY1: ethernet-phy@1 { 80 PHY1: ethernet-phy@1 {
83 interrupt-parent = <&PIC>; 81 interrupt-parent = <&PIC>;
84 reg = <1>; 82 reg = <1>;
85 device_type = "ethernet-phy";
86 }; 83 };
87 }; 84 };
88 }; 85 };
diff --git a/arch/powerpc/boot/dts/ep88xc.dts b/arch/powerpc/boot/dts/ep88xc.dts
index ae57d6240120..2aa5bf559645 100644
--- a/arch/powerpc/boot/dts/ep88xc.dts
+++ b/arch/powerpc/boot/dts/ep88xc.dts
@@ -85,12 +85,10 @@
85 85
86 PHY0: ethernet-phy@0 { 86 PHY0: ethernet-phy@0 {
87 reg = <0x0>; 87 reg = <0x0>;
88 device_type = "ethernet-phy";
89 }; 88 };
90 89
91 PHY1: ethernet-phy@1 { 90 PHY1: ethernet-phy@1 {
92 reg = <0x1>; 91 reg = <0x1>;
93 device_type = "ethernet-phy";
94 }; 92 };
95 }; 93 };
96 94
diff --git a/arch/powerpc/boot/dts/fsl/elo3-dma-2.dtsi b/arch/powerpc/boot/dts/fsl/elo3-dma-2.dtsi
new file mode 100644
index 000000000000..d3cc8d0f7c25
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/elo3-dma-2.dtsi
@@ -0,0 +1,82 @@
1/*
2 * QorIQ Elo3 DMA device tree stub [ controller @ offset 0x102300 ]
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
35dma2: dma@102300 {
36 #address-cells = <1>;
37 #size-cells = <1>;
38 compatible = "fsl,elo3-dma";
39 reg = <0x102300 0x4>,
40 <0x102600 0x4>;
41 ranges = <0x0 0x102100 0x500>;
42 dma-channel@0 {
43 compatible = "fsl,eloplus-dma-channel";
44 reg = <0x0 0x80>;
45 interrupts = <464 2 0 0>;
46 };
47 dma-channel@80 {
48 compatible = "fsl,eloplus-dma-channel";
49 reg = <0x80 0x80>;
50 interrupts = <465 2 0 0>;
51 };
52 dma-channel@100 {
53 compatible = "fsl,eloplus-dma-channel";
54 reg = <0x100 0x80>;
55 interrupts = <466 2 0 0>;
56 };
57 dma-channel@180 {
58 compatible = "fsl,eloplus-dma-channel";
59 reg = <0x180 0x80>;
60 interrupts = <467 2 0 0>;
61 };
62 dma-channel@300 {
63 compatible = "fsl,eloplus-dma-channel";
64 reg = <0x300 0x80>;
65 interrupts = <468 2 0 0>;
66 };
67 dma-channel@380 {
68 compatible = "fsl,eloplus-dma-channel";
69 reg = <0x380 0x80>;
70 interrupts = <469 2 0 0>;
71 };
72 dma-channel@400 {
73 compatible = "fsl,eloplus-dma-channel";
74 reg = <0x400 0x80>;
75 interrupts = <470 2 0 0>;
76 };
77 dma-channel@480 {
78 compatible = "fsl,eloplus-dma-channel";
79 reg = <0x480 0x80>;
80 interrupts = <471 2 0 0>;
81 };
82};
diff --git a/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi
index 68cc5e7f6477..642dc3a83d0e 100644
--- a/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1020si-post.dtsi
@@ -36,7 +36,8 @@
36 #address-cells = <2>; 36 #address-cells = <2>;
37 #size-cells = <1>; 37 #size-cells = <1>;
38 compatible = "fsl,p1020-elbc", "fsl,elbc", "simple-bus"; 38 compatible = "fsl,p1020-elbc", "fsl,elbc", "simple-bus";
39 interrupts = <19 2 0 0>; 39 interrupts = <19 2 0 0>,
40 <16 2 0 0>;
40}; 41};
41 42
42/* controller at 0x9000 */ 43/* controller at 0x9000 */
diff --git a/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
index adb82fd9057f..407cb5fd0f5b 100644
--- a/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
@@ -36,7 +36,8 @@
36 #address-cells = <2>; 36 #address-cells = <2>;
37 #size-cells = <1>; 37 #size-cells = <1>;
38 compatible = "fsl,p1021-elbc", "fsl,elbc", "simple-bus"; 38 compatible = "fsl,p1021-elbc", "fsl,elbc", "simple-bus";
39 interrupts = <19 2 0 0>; 39 interrupts = <19 2 0 0>,
40 <16 2 0 0>;
40}; 41};
41 42
42/* controller at 0x9000 */ 43/* controller at 0x9000 */
diff --git a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
index e179803a81ef..ebf202234549 100644
--- a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
@@ -40,7 +40,8 @@
40 * pin muxing when the DIU is enabled. 40 * pin muxing when the DIU is enabled.
41 */ 41 */
42 compatible = "fsl,p1022-elbc", "fsl,elbc"; 42 compatible = "fsl,p1022-elbc", "fsl,elbc";
43 interrupts = <19 2 0 0>; 43 interrupts = <19 2 0 0>,
44 <16 2 0 0>;
44}; 45};
45 46
46/* controller at 0x9000 */ 47/* controller at 0x9000 */
diff --git a/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
index f1105bffa915..81437fdf1db4 100644
--- a/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
@@ -36,7 +36,8 @@
36 #address-cells = <2>; 36 #address-cells = <2>;
37 #size-cells = <1>; 37 #size-cells = <1>;
38 compatible = "fsl,p1023-elbc", "fsl,elbc", "simple-bus"; 38 compatible = "fsl,p1023-elbc", "fsl,elbc", "simple-bus";
39 interrupts = <19 2 0 0>; 39 interrupts = <19 2 0 0>,
40 <16 2 0 0>;
40}; 41};
41 42
42/* controller at 0xa000 */ 43/* controller at 0xa000 */
diff --git a/arch/powerpc/boot/dts/gef_ppc9a.dts b/arch/powerpc/boot/dts/gef_ppc9a.dts
index 38dcb96c8e26..83eb0fda2666 100644
--- a/arch/powerpc/boot/dts/gef_ppc9a.dts
+++ b/arch/powerpc/boot/dts/gef_ppc9a.dts
@@ -292,13 +292,11 @@
292 interrupt-parent = <&gef_pic>; 292 interrupt-parent = <&gef_pic>;
293 interrupts = <0x9 0x4>; 293 interrupts = <0x9 0x4>;
294 reg = <1>; 294 reg = <1>;
295 device_type = "ethernet-phy";
296 }; 295 };
297 phy2: ethernet-phy@2 { 296 phy2: ethernet-phy@2 {
298 interrupt-parent = <&gef_pic>; 297 interrupt-parent = <&gef_pic>;
299 interrupts = <0x8 0x4>; 298 interrupts = <0x8 0x4>;
300 reg = <3>; 299 reg = <3>;
301 device_type = "ethernet-phy";
302 }; 300 };
303 tbi0: tbi-phy@11 { 301 tbi0: tbi-phy@11 {
304 reg = <0x11>; 302 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/gef_sbc310.dts b/arch/powerpc/boot/dts/gef_sbc310.dts
index 5ab8932d09b7..d426dd3de9ef 100644
--- a/arch/powerpc/boot/dts/gef_sbc310.dts
+++ b/arch/powerpc/boot/dts/gef_sbc310.dts
@@ -290,13 +290,11 @@
290 interrupt-parent = <&gef_pic>; 290 interrupt-parent = <&gef_pic>;
291 interrupts = <0x9 0x4>; 291 interrupts = <0x9 0x4>;
292 reg = <1>; 292 reg = <1>;
293 device_type = "ethernet-phy";
294 }; 293 };
295 phy2: ethernet-phy@2 { 294 phy2: ethernet-phy@2 {
296 interrupt-parent = <&gef_pic>; 295 interrupt-parent = <&gef_pic>;
297 interrupts = <0x8 0x4>; 296 interrupts = <0x8 0x4>;
298 reg = <3>; 297 reg = <3>;
299 device_type = "ethernet-phy";
300 }; 298 };
301 tbi0: tbi-phy@11 { 299 tbi0: tbi-phy@11 {
302 reg = <0x11>; 300 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/gef_sbc610.dts b/arch/powerpc/boot/dts/gef_sbc610.dts
index d5341f5741aa..5db3399b76b7 100644
--- a/arch/powerpc/boot/dts/gef_sbc610.dts
+++ b/arch/powerpc/boot/dts/gef_sbc610.dts
@@ -290,13 +290,11 @@
290 interrupt-parent = <&gef_pic>; 290 interrupt-parent = <&gef_pic>;
291 interrupts = <0x9 0x4>; 291 interrupts = <0x9 0x4>;
292 reg = <1>; 292 reg = <1>;
293 device_type = "ethernet-phy";
294 }; 293 };
295 phy2: ethernet-phy@2 { 294 phy2: ethernet-phy@2 {
296 interrupt-parent = <&gef_pic>; 295 interrupt-parent = <&gef_pic>;
297 interrupts = <0x8 0x4>; 296 interrupts = <0x8 0x4>;
298 reg = <3>; 297 reg = <3>;
299 device_type = "ethernet-phy";
300 }; 298 };
301 tbi0: tbi-phy@11 { 299 tbi0: tbi-phy@11 {
302 reg = <0x11>; 300 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/holly.dts b/arch/powerpc/boot/dts/holly.dts
index c6e11ebecebb..43e6f0c8e449 100644
--- a/arch/powerpc/boot/dts/holly.dts
+++ b/arch/powerpc/boot/dts/holly.dts
@@ -58,7 +58,6 @@
58 }; 58 };
59 59
60 MDIO: mdio@6000 { 60 MDIO: mdio@6000 {
61 device_type = "mdio";
62 compatible = "tsi109-mdio", "tsi108-mdio"; 61 compatible = "tsi109-mdio", "tsi108-mdio";
63 reg = <0x00006000 0x00000050>; 62 reg = <0x00006000 0x00000050>;
64 #address-cells = <1>; 63 #address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
index 1613d6e4049e..5ba7f01e2a29 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -406,7 +406,7 @@
406 406
407 MSI: ppc4xx-msi@C10000000 { 407 MSI: ppc4xx-msi@C10000000 {
408 compatible = "amcc,ppc4xx-msi", "ppc4xx-msi"; 408 compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
409 reg = < 0x0 0xEF620000 0x100>; 409 reg = <0xEF620000 0x100>;
410 sdr-base = <0x4B0>; 410 sdr-base = <0x4B0>;
411 msi-data = <0x00000000>; 411 msi-data = <0x00000000>;
412 msi-mask = <0x44440000>; 412 msi-mask = <0x44440000>;
diff --git a/arch/powerpc/boot/dts/ksi8560.dts b/arch/powerpc/boot/dts/ksi8560.dts
index 296c572ea605..5d68236e7c3c 100644
--- a/arch/powerpc/boot/dts/ksi8560.dts
+++ b/arch/powerpc/boot/dts/ksi8560.dts
@@ -161,13 +161,11 @@
161 PHY1: ethernet-phy@1 { 161 PHY1: ethernet-phy@1 {
162 interrupt-parent = <&mpic>; 162 interrupt-parent = <&mpic>;
163 reg = <0x1>; 163 reg = <0x1>;
164 device_type = "ethernet-phy";
165 }; 164 };
166 165
167 PHY2: ethernet-phy@2 { 166 PHY2: ethernet-phy@2 {
168 interrupt-parent = <&mpic>; 167 interrupt-parent = <&mpic>;
169 reg = <0x2>; 168 reg = <0x2>;
170 device_type = "ethernet-phy";
171 }; 169 };
172 170
173 tbi0: tbi-phy@11 { 171 tbi0: tbi-phy@11 {
@@ -284,7 +282,6 @@
284 PHY0: ethernet-phy@0 { 282 PHY0: ethernet-phy@0 {
285 interrupt-parent = <&mpic>; 283 interrupt-parent = <&mpic>;
286 reg = <0x0>; 284 reg = <0x0>;
287 device_type = "ethernet-phy";
288 }; 285 };
289 }; 286 };
290 287
diff --git a/arch/powerpc/boot/dts/mpc5121.dtsi b/arch/powerpc/boot/dts/mpc5121.dtsi
index 2d7cb04ac962..2c0e1552d20b 100644
--- a/arch/powerpc/boot/dts/mpc5121.dtsi
+++ b/arch/powerpc/boot/dts/mpc5121.dtsi
@@ -9,6 +9,8 @@
9 * option) any later version. 9 * option) any later version.
10 */ 10 */
11 11
12#include <dt-bindings/clock/mpc512x-clock.h>
13
12/dts-v1/; 14/dts-v1/;
13 15
14/ { 16/ {
@@ -49,6 +51,10 @@
49 compatible = "fsl,mpc5121-mbx"; 51 compatible = "fsl,mpc5121-mbx";
50 reg = <0x20000000 0x4000>; 52 reg = <0x20000000 0x4000>;
51 interrupts = <66 0x8>; 53 interrupts = <66 0x8>;
54 clocks = <&clks MPC512x_CLK_MBX_BUS>,
55 <&clks MPC512x_CLK_MBX_3D>,
56 <&clks MPC512x_CLK_MBX>;
57 clock-names = "mbx-bus", "mbx-3d", "mbx";
52 }; 58 };
53 59
54 sram@30000000 { 60 sram@30000000 {
@@ -62,6 +68,8 @@
62 interrupts = <6 8>; 68 interrupts = <6 8>;
63 #address-cells = <1>; 69 #address-cells = <1>;
64 #size-cells = <1>; 70 #size-cells = <1>;
71 clocks = <&clks MPC512x_CLK_NFC>;
72 clock-names = "ipg";
65 }; 73 };
66 74
67 localbus@80000020 { 75 localbus@80000020 {
@@ -73,6 +81,17 @@
73 ranges = <0x0 0x0 0xfc000000 0x04000000>; 81 ranges = <0x0 0x0 0xfc000000 0x04000000>;
74 }; 82 };
75 83
84 clocks {
85 #address-cells = <1>;
86 #size-cells = <0>;
87
88 osc: osc {
89 compatible = "fixed-clock";
90 #clock-cells = <0>;
91 clock-frequency = <33000000>;
92 };
93 };
94
76 soc@80000000 { 95 soc@80000000 {
77 compatible = "fsl,mpc5121-immr"; 96 compatible = "fsl,mpc5121-immr";
78 #address-cells = <1>; 97 #address-cells = <1>;
@@ -117,9 +136,12 @@
117 }; 136 };
118 137
119 /* Clock control */ 138 /* Clock control */
120 clock@f00 { 139 clks: clock@f00 {
121 compatible = "fsl,mpc5121-clock"; 140 compatible = "fsl,mpc5121-clock";
122 reg = <0xf00 0x100>; 141 reg = <0xf00 0x100>;
142 #clock-cells = <1>;
143 clocks = <&osc>;
144 clock-names = "osc";
123 }; 145 };
124 146
125 /* Power Management Controller */ 147 /* Power Management Controller */
@@ -139,12 +161,24 @@
139 compatible = "fsl,mpc5121-mscan"; 161 compatible = "fsl,mpc5121-mscan";
140 reg = <0x1300 0x80>; 162 reg = <0x1300 0x80>;
141 interrupts = <12 0x8>; 163 interrupts = <12 0x8>;
164 clocks = <&clks MPC512x_CLK_BDLC>,
165 <&clks MPC512x_CLK_IPS>,
166 <&clks MPC512x_CLK_SYS>,
167 <&clks MPC512x_CLK_REF>,
168 <&clks MPC512x_CLK_MSCAN0_MCLK>;
169 clock-names = "ipg", "ips", "sys", "ref", "mclk";
142 }; 170 };
143 171
144 can@1380 { 172 can@1380 {
145 compatible = "fsl,mpc5121-mscan"; 173 compatible = "fsl,mpc5121-mscan";
146 reg = <0x1380 0x80>; 174 reg = <0x1380 0x80>;
147 interrupts = <13 0x8>; 175 interrupts = <13 0x8>;
176 clocks = <&clks MPC512x_CLK_BDLC>,
177 <&clks MPC512x_CLK_IPS>,
178 <&clks MPC512x_CLK_SYS>,
179 <&clks MPC512x_CLK_REF>,
180 <&clks MPC512x_CLK_MSCAN1_MCLK>;
181 clock-names = "ipg", "ips", "sys", "ref", "mclk";
148 }; 182 };
149 183
150 sdhc@1500 { 184 sdhc@1500 {
@@ -153,6 +187,9 @@
153 interrupts = <8 0x8>; 187 interrupts = <8 0x8>;
154 dmas = <&dma0 30>; 188 dmas = <&dma0 30>;
155 dma-names = "rx-tx"; 189 dma-names = "rx-tx";
190 clocks = <&clks MPC512x_CLK_IPS>,
191 <&clks MPC512x_CLK_SDHC>;
192 clock-names = "ipg", "per";
156 }; 193 };
157 194
158 i2c@1700 { 195 i2c@1700 {
@@ -161,6 +198,8 @@
161 compatible = "fsl,mpc5121-i2c", "fsl-i2c"; 198 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
162 reg = <0x1700 0x20>; 199 reg = <0x1700 0x20>;
163 interrupts = <9 0x8>; 200 interrupts = <9 0x8>;
201 clocks = <&clks MPC512x_CLK_I2C>;
202 clock-names = "ipg";
164 }; 203 };
165 204
166 i2c@1720 { 205 i2c@1720 {
@@ -169,6 +208,8 @@
169 compatible = "fsl,mpc5121-i2c", "fsl-i2c"; 208 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
170 reg = <0x1720 0x20>; 209 reg = <0x1720 0x20>;
171 interrupts = <10 0x8>; 210 interrupts = <10 0x8>;
211 clocks = <&clks MPC512x_CLK_I2C>;
212 clock-names = "ipg";
172 }; 213 };
173 214
174 i2c@1740 { 215 i2c@1740 {
@@ -177,6 +218,8 @@
177 compatible = "fsl,mpc5121-i2c", "fsl-i2c"; 218 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
178 reg = <0x1740 0x20>; 219 reg = <0x1740 0x20>;
179 interrupts = <11 0x8>; 220 interrupts = <11 0x8>;
221 clocks = <&clks MPC512x_CLK_I2C>;
222 clock-names = "ipg";
180 }; 223 };
181 224
182 i2ccontrol@1760 { 225 i2ccontrol@1760 {
@@ -188,30 +231,48 @@
188 compatible = "fsl,mpc5121-axe"; 231 compatible = "fsl,mpc5121-axe";
189 reg = <0x2000 0x100>; 232 reg = <0x2000 0x100>;
190 interrupts = <42 0x8>; 233 interrupts = <42 0x8>;
234 clocks = <&clks MPC512x_CLK_AXE>;
235 clock-names = "ipg";
191 }; 236 };
192 237
193 display@2100 { 238 display@2100 {
194 compatible = "fsl,mpc5121-diu"; 239 compatible = "fsl,mpc5121-diu";
195 reg = <0x2100 0x100>; 240 reg = <0x2100 0x100>;
196 interrupts = <64 0x8>; 241 interrupts = <64 0x8>;
242 clocks = <&clks MPC512x_CLK_DIU>;
243 clock-names = "ipg";
197 }; 244 };
198 245
199 can@2300 { 246 can@2300 {
200 compatible = "fsl,mpc5121-mscan"; 247 compatible = "fsl,mpc5121-mscan";
201 reg = <0x2300 0x80>; 248 reg = <0x2300 0x80>;
202 interrupts = <90 0x8>; 249 interrupts = <90 0x8>;
250 clocks = <&clks MPC512x_CLK_BDLC>,
251 <&clks MPC512x_CLK_IPS>,
252 <&clks MPC512x_CLK_SYS>,
253 <&clks MPC512x_CLK_REF>,
254 <&clks MPC512x_CLK_MSCAN2_MCLK>;
255 clock-names = "ipg", "ips", "sys", "ref", "mclk";
203 }; 256 };
204 257
205 can@2380 { 258 can@2380 {
206 compatible = "fsl,mpc5121-mscan"; 259 compatible = "fsl,mpc5121-mscan";
207 reg = <0x2380 0x80>; 260 reg = <0x2380 0x80>;
208 interrupts = <91 0x8>; 261 interrupts = <91 0x8>;
262 clocks = <&clks MPC512x_CLK_BDLC>,
263 <&clks MPC512x_CLK_IPS>,
264 <&clks MPC512x_CLK_SYS>,
265 <&clks MPC512x_CLK_REF>,
266 <&clks MPC512x_CLK_MSCAN3_MCLK>;
267 clock-names = "ipg", "ips", "sys", "ref", "mclk";
209 }; 268 };
210 269
211 viu@2400 { 270 viu@2400 {
212 compatible = "fsl,mpc5121-viu"; 271 compatible = "fsl,mpc5121-viu";
213 reg = <0x2400 0x400>; 272 reg = <0x2400 0x400>;
214 interrupts = <67 0x8>; 273 interrupts = <67 0x8>;
274 clocks = <&clks MPC512x_CLK_VIU>;
275 clock-names = "ipg";
215 }; 276 };
216 277
217 mdio@2800 { 278 mdio@2800 {
@@ -219,6 +280,8 @@
219 reg = <0x2800 0x800>; 280 reg = <0x2800 0x800>;
220 #address-cells = <1>; 281 #address-cells = <1>;
221 #size-cells = <0>; 282 #size-cells = <0>;
283 clocks = <&clks MPC512x_CLK_FEC>;
284 clock-names = "per";
222 }; 285 };
223 286
224 eth0: ethernet@2800 { 287 eth0: ethernet@2800 {
@@ -227,6 +290,8 @@
227 reg = <0x2800 0x800>; 290 reg = <0x2800 0x800>;
228 local-mac-address = [ 00 00 00 00 00 00 ]; 291 local-mac-address = [ 00 00 00 00 00 00 ];
229 interrupts = <4 0x8>; 292 interrupts = <4 0x8>;
293 clocks = <&clks MPC512x_CLK_FEC>;
294 clock-names = "per";
230 }; 295 };
231 296
232 /* USB1 using external ULPI PHY */ 297 /* USB1 using external ULPI PHY */
@@ -238,6 +303,8 @@
238 interrupts = <43 0x8>; 303 interrupts = <43 0x8>;
239 dr_mode = "otg"; 304 dr_mode = "otg";
240 phy_type = "ulpi"; 305 phy_type = "ulpi";
306 clocks = <&clks MPC512x_CLK_USB1>;
307 clock-names = "ipg";
241 }; 308 };
242 309
243 /* USB0 using internal UTMI PHY */ 310 /* USB0 using internal UTMI PHY */
@@ -249,6 +316,8 @@
249 interrupts = <44 0x8>; 316 interrupts = <44 0x8>;
250 dr_mode = "otg"; 317 dr_mode = "otg";
251 phy_type = "utmi_wide"; 318 phy_type = "utmi_wide";
319 clocks = <&clks MPC512x_CLK_USB2>;
320 clock-names = "ipg";
252 }; 321 };
253 322
254 /* IO control */ 323 /* IO control */
@@ -267,6 +336,8 @@
267 compatible = "fsl,mpc5121-pata"; 336 compatible = "fsl,mpc5121-pata";
268 reg = <0x10200 0x100>; 337 reg = <0x10200 0x100>;
269 interrupts = <5 0x8>; 338 interrupts = <5 0x8>;
339 clocks = <&clks MPC512x_CLK_PATA>;
340 clock-names = "ipg";
270 }; 341 };
271 342
272 /* 512x PSCs are not 52xx PSC compatible */ 343 /* 512x PSCs are not 52xx PSC compatible */
@@ -278,6 +349,9 @@
278 interrupts = <40 0x8>; 349 interrupts = <40 0x8>;
279 fsl,rx-fifo-size = <16>; 350 fsl,rx-fifo-size = <16>;
280 fsl,tx-fifo-size = <16>; 351 fsl,tx-fifo-size = <16>;
352 clocks = <&clks MPC512x_CLK_PSC0>,
353 <&clks MPC512x_CLK_PSC0_MCLK>;
354 clock-names = "ipg", "mclk";
281 }; 355 };
282 356
283 /* PSC1 */ 357 /* PSC1 */
@@ -287,6 +361,9 @@
287 interrupts = <40 0x8>; 361 interrupts = <40 0x8>;
288 fsl,rx-fifo-size = <16>; 362 fsl,rx-fifo-size = <16>;
289 fsl,tx-fifo-size = <16>; 363 fsl,tx-fifo-size = <16>;
364 clocks = <&clks MPC512x_CLK_PSC1>,
365 <&clks MPC512x_CLK_PSC1_MCLK>;
366 clock-names = "ipg", "mclk";
290 }; 367 };
291 368
292 /* PSC2 */ 369 /* PSC2 */
@@ -296,6 +373,9 @@
296 interrupts = <40 0x8>; 373 interrupts = <40 0x8>;
297 fsl,rx-fifo-size = <16>; 374 fsl,rx-fifo-size = <16>;
298 fsl,tx-fifo-size = <16>; 375 fsl,tx-fifo-size = <16>;
376 clocks = <&clks MPC512x_CLK_PSC2>,
377 <&clks MPC512x_CLK_PSC2_MCLK>;
378 clock-names = "ipg", "mclk";
299 }; 379 };
300 380
301 /* PSC3 */ 381 /* PSC3 */
@@ -305,6 +385,9 @@
305 interrupts = <40 0x8>; 385 interrupts = <40 0x8>;
306 fsl,rx-fifo-size = <16>; 386 fsl,rx-fifo-size = <16>;
307 fsl,tx-fifo-size = <16>; 387 fsl,tx-fifo-size = <16>;
388 clocks = <&clks MPC512x_CLK_PSC3>,
389 <&clks MPC512x_CLK_PSC3_MCLK>;
390 clock-names = "ipg", "mclk";
308 }; 391 };
309 392
310 /* PSC4 */ 393 /* PSC4 */
@@ -314,6 +397,9 @@
314 interrupts = <40 0x8>; 397 interrupts = <40 0x8>;
315 fsl,rx-fifo-size = <16>; 398 fsl,rx-fifo-size = <16>;
316 fsl,tx-fifo-size = <16>; 399 fsl,tx-fifo-size = <16>;
400 clocks = <&clks MPC512x_CLK_PSC4>,
401 <&clks MPC512x_CLK_PSC4_MCLK>;
402 clock-names = "ipg", "mclk";
317 }; 403 };
318 404
319 /* PSC5 */ 405 /* PSC5 */
@@ -323,6 +409,9 @@
323 interrupts = <40 0x8>; 409 interrupts = <40 0x8>;
324 fsl,rx-fifo-size = <16>; 410 fsl,rx-fifo-size = <16>;
325 fsl,tx-fifo-size = <16>; 411 fsl,tx-fifo-size = <16>;
412 clocks = <&clks MPC512x_CLK_PSC5>,
413 <&clks MPC512x_CLK_PSC5_MCLK>;
414 clock-names = "ipg", "mclk";
326 }; 415 };
327 416
328 /* PSC6 */ 417 /* PSC6 */
@@ -332,6 +421,9 @@
332 interrupts = <40 0x8>; 421 interrupts = <40 0x8>;
333 fsl,rx-fifo-size = <16>; 422 fsl,rx-fifo-size = <16>;
334 fsl,tx-fifo-size = <16>; 423 fsl,tx-fifo-size = <16>;
424 clocks = <&clks MPC512x_CLK_PSC6>,
425 <&clks MPC512x_CLK_PSC6_MCLK>;
426 clock-names = "ipg", "mclk";
335 }; 427 };
336 428
337 /* PSC7 */ 429 /* PSC7 */
@@ -341,6 +433,9 @@
341 interrupts = <40 0x8>; 433 interrupts = <40 0x8>;
342 fsl,rx-fifo-size = <16>; 434 fsl,rx-fifo-size = <16>;
343 fsl,tx-fifo-size = <16>; 435 fsl,tx-fifo-size = <16>;
436 clocks = <&clks MPC512x_CLK_PSC7>,
437 <&clks MPC512x_CLK_PSC7_MCLK>;
438 clock-names = "ipg", "mclk";
344 }; 439 };
345 440
346 /* PSC8 */ 441 /* PSC8 */
@@ -350,6 +445,9 @@
350 interrupts = <40 0x8>; 445 interrupts = <40 0x8>;
351 fsl,rx-fifo-size = <16>; 446 fsl,rx-fifo-size = <16>;
352 fsl,tx-fifo-size = <16>; 447 fsl,tx-fifo-size = <16>;
448 clocks = <&clks MPC512x_CLK_PSC8>,
449 <&clks MPC512x_CLK_PSC8_MCLK>;
450 clock-names = "ipg", "mclk";
353 }; 451 };
354 452
355 /* PSC9 */ 453 /* PSC9 */
@@ -359,6 +457,9 @@
359 interrupts = <40 0x8>; 457 interrupts = <40 0x8>;
360 fsl,rx-fifo-size = <16>; 458 fsl,rx-fifo-size = <16>;
361 fsl,tx-fifo-size = <16>; 459 fsl,tx-fifo-size = <16>;
460 clocks = <&clks MPC512x_CLK_PSC9>,
461 <&clks MPC512x_CLK_PSC9_MCLK>;
462 clock-names = "ipg", "mclk";
362 }; 463 };
363 464
364 /* PSC10 */ 465 /* PSC10 */
@@ -368,6 +469,9 @@
368 interrupts = <40 0x8>; 469 interrupts = <40 0x8>;
369 fsl,rx-fifo-size = <16>; 470 fsl,rx-fifo-size = <16>;
370 fsl,tx-fifo-size = <16>; 471 fsl,tx-fifo-size = <16>;
472 clocks = <&clks MPC512x_CLK_PSC10>,
473 <&clks MPC512x_CLK_PSC10_MCLK>;
474 clock-names = "ipg", "mclk";
371 }; 475 };
372 476
373 /* PSC11 */ 477 /* PSC11 */
@@ -377,12 +481,17 @@
377 interrupts = <40 0x8>; 481 interrupts = <40 0x8>;
378 fsl,rx-fifo-size = <16>; 482 fsl,rx-fifo-size = <16>;
379 fsl,tx-fifo-size = <16>; 483 fsl,tx-fifo-size = <16>;
484 clocks = <&clks MPC512x_CLK_PSC11>,
485 <&clks MPC512x_CLK_PSC11_MCLK>;
486 clock-names = "ipg", "mclk";
380 }; 487 };
381 488
382 pscfifo@11f00 { 489 pscfifo@11f00 {
383 compatible = "fsl,mpc5121-psc-fifo"; 490 compatible = "fsl,mpc5121-psc-fifo";
384 reg = <0x11f00 0x100>; 491 reg = <0x11f00 0x100>;
385 interrupts = <40 0x8>; 492 interrupts = <40 0x8>;
493 clocks = <&clks MPC512x_CLK_PSC_FIFO>;
494 clock-names = "ipg";
386 }; 495 };
387 496
388 dma0: dma@14000 { 497 dma0: dma@14000 {
@@ -400,6 +509,8 @@
400 #address-cells = <3>; 509 #address-cells = <3>;
401 #size-cells = <2>; 510 #size-cells = <2>;
402 #interrupt-cells = <1>; 511 #interrupt-cells = <1>;
512 clocks = <&clks MPC512x_CLK_PCI>;
513 clock-names = "ipg";
403 514
404 reg = <0x80008500 0x100 /* internal registers */ 515 reg = <0x80008500 0x100 /* internal registers */
405 0x80008300 0x8>; /* config space access registers */ 516 0x80008300 0x8>; /* config space access registers */
diff --git a/arch/powerpc/boot/dts/mpc5125twr.dts b/arch/powerpc/boot/dts/mpc5125twr.dts
index a618dfc13e4c..e4f297471748 100644
--- a/arch/powerpc/boot/dts/mpc5125twr.dts
+++ b/arch/powerpc/boot/dts/mpc5125twr.dts
@@ -12,6 +12,8 @@
12 * option) any later version. 12 * option) any later version.
13 */ 13 */
14 14
15#include <dt-bindings/clock/mpc512x-clock.h>
16
15/dts-v1/; 17/dts-v1/;
16 18
17/ { 19/ {
@@ -54,6 +56,17 @@
54 reg = <0x30000000 0x08000>; // 32K at 0x30000000 56 reg = <0x30000000 0x08000>; // 32K at 0x30000000
55 }; 57 };
56 58
59 clocks {
60 #address-cells = <1>;
61 #size-cells = <0>;
62
63 osc: osc {
64 compatible = "fixed-clock";
65 #clock-cells = <0>;
66 clock-frequency = <33000000>;
67 };
68 };
69
57 soc@80000000 { 70 soc@80000000 {
58 compatible = "fsl,mpc5121-immr"; 71 compatible = "fsl,mpc5121-immr";
59 #address-cells = <1>; 72 #address-cells = <1>;
@@ -87,9 +100,12 @@
87 reg = <0xe00 0x100>; 100 reg = <0xe00 0x100>;
88 }; 101 };
89 102
90 clock@f00 { // Clock control 103 clks: clock@f00 { // Clock control
91 compatible = "fsl,mpc5121-clock"; 104 compatible = "fsl,mpc5121-clock";
92 reg = <0xf00 0x100>; 105 reg = <0xf00 0x100>;
106 #clock-cells = <1>;
107 clocks = <&osc>;
108 clock-names = "osc";
93 }; 109 };
94 110
95 pmc@1000{ // Power Management Controller 111 pmc@1000{ // Power Management Controller
@@ -114,18 +130,33 @@
114 compatible = "fsl,mpc5121-mscan"; 130 compatible = "fsl,mpc5121-mscan";
115 interrupts = <12 0x8>; 131 interrupts = <12 0x8>;
116 reg = <0x1300 0x80>; 132 reg = <0x1300 0x80>;
133 clocks = <&clks MPC512x_CLK_BDLC>,
134 <&clks MPC512x_CLK_IPS>,
135 <&clks MPC512x_CLK_SYS>,
136 <&clks MPC512x_CLK_REF>,
137 <&clks MPC512x_CLK_MSCAN0_MCLK>;
138 clock-names = "ipg", "ips", "sys", "ref", "mclk";
117 }; 139 };
118 140
119 can@1380 { 141 can@1380 {
120 compatible = "fsl,mpc5121-mscan"; 142 compatible = "fsl,mpc5121-mscan";
121 interrupts = <13 0x8>; 143 interrupts = <13 0x8>;
122 reg = <0x1380 0x80>; 144 reg = <0x1380 0x80>;
145 clocks = <&clks MPC512x_CLK_BDLC>,
146 <&clks MPC512x_CLK_IPS>,
147 <&clks MPC512x_CLK_SYS>,
148 <&clks MPC512x_CLK_REF>,
149 <&clks MPC512x_CLK_MSCAN1_MCLK>;
150 clock-names = "ipg", "ips", "sys", "ref", "mclk";
123 }; 151 };
124 152
125 sdhc@1500 { 153 sdhc@1500 {
126 compatible = "fsl,mpc5121-sdhc"; 154 compatible = "fsl,mpc5121-sdhc";
127 interrupts = <8 0x8>; 155 interrupts = <8 0x8>;
128 reg = <0x1500 0x100>; 156 reg = <0x1500 0x100>;
157 clocks = <&clks MPC512x_CLK_IPS>,
158 <&clks MPC512x_CLK_SDHC>;
159 clock-names = "ipg", "per";
129 }; 160 };
130 161
131 i2c@1700 { 162 i2c@1700 {
@@ -134,6 +165,8 @@
134 compatible = "fsl,mpc5121-i2c", "fsl-i2c"; 165 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
135 reg = <0x1700 0x20>; 166 reg = <0x1700 0x20>;
136 interrupts = <0x9 0x8>; 167 interrupts = <0x9 0x8>;
168 clocks = <&clks MPC512x_CLK_I2C>;
169 clock-names = "ipg";
137 }; 170 };
138 171
139 i2c@1720 { 172 i2c@1720 {
@@ -142,6 +175,8 @@
142 compatible = "fsl,mpc5121-i2c", "fsl-i2c"; 175 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
143 reg = <0x1720 0x20>; 176 reg = <0x1720 0x20>;
144 interrupts = <0xa 0x8>; 177 interrupts = <0xa 0x8>;
178 clocks = <&clks MPC512x_CLK_I2C>;
179 clock-names = "ipg";
145 }; 180 };
146 181
147 i2c@1740 { 182 i2c@1740 {
@@ -150,6 +185,8 @@
150 compatible = "fsl,mpc5121-i2c", "fsl-i2c"; 185 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
151 reg = <0x1740 0x20>; 186 reg = <0x1740 0x20>;
152 interrupts = <0xb 0x8>; 187 interrupts = <0xb 0x8>;
188 clocks = <&clks MPC512x_CLK_I2C>;
189 clock-names = "ipg";
153 }; 190 };
154 191
155 i2ccontrol@1760 { 192 i2ccontrol@1760 {
@@ -161,6 +198,8 @@
161 compatible = "fsl,mpc5121-diu"; 198 compatible = "fsl,mpc5121-diu";
162 reg = <0x2100 0x100>; 199 reg = <0x2100 0x100>;
163 interrupts = <64 0x8>; 200 interrupts = <64 0x8>;
201 clocks = <&clks MPC512x_CLK_DIU>;
202 clock-names = "ipg";
164 }; 203 };
165 204
166 mdio@2800 { 205 mdio@2800 {
@@ -180,6 +219,8 @@
180 interrupts = <4 0x8>; 219 interrupts = <4 0x8>;
181 phy-handle = < &phy0 >; 220 phy-handle = < &phy0 >;
182 phy-connection-type = "rmii"; 221 phy-connection-type = "rmii";
222 clocks = <&clks MPC512x_CLK_FEC>;
223 clock-names = "per";
183 }; 224 };
184 225
185 // IO control 226 // IO control
@@ -200,6 +241,8 @@
200 interrupts = <43 0x8>; 241 interrupts = <43 0x8>;
201 dr_mode = "host"; 242 dr_mode = "host";
202 phy_type = "ulpi"; 243 phy_type = "ulpi";
244 clocks = <&clks MPC512x_CLK_USB1>;
245 clock-names = "ipg";
203 status = "disabled"; 246 status = "disabled";
204 }; 247 };
205 248
@@ -211,6 +254,9 @@
211 interrupts = <40 0x8>; 254 interrupts = <40 0x8>;
212 fsl,rx-fifo-size = <16>; 255 fsl,rx-fifo-size = <16>;
213 fsl,tx-fifo-size = <16>; 256 fsl,tx-fifo-size = <16>;
257 clocks = <&clks MPC512x_CLK_PSC1>,
258 <&clks MPC512x_CLK_PSC1_MCLK>;
259 clock-names = "ipg", "mclk";
214 }; 260 };
215 261
216 // PSC9 uart1 aka ttyPSC1 262 // PSC9 uart1 aka ttyPSC1
@@ -220,12 +266,17 @@
220 interrupts = <40 0x8>; 266 interrupts = <40 0x8>;
221 fsl,rx-fifo-size = <16>; 267 fsl,rx-fifo-size = <16>;
222 fsl,tx-fifo-size = <16>; 268 fsl,tx-fifo-size = <16>;
269 clocks = <&clks MPC512x_CLK_PSC9>,
270 <&clks MPC512x_CLK_PSC9_MCLK>;
271 clock-names = "ipg", "mclk";
223 }; 272 };
224 273
225 pscfifo@11f00 { 274 pscfifo@11f00 {
226 compatible = "fsl,mpc5121-psc-fifo"; 275 compatible = "fsl,mpc5121-psc-fifo";
227 reg = <0x11f00 0x100>; 276 reg = <0x11f00 0x100>;
228 interrupts = <40 0x8>; 277 interrupts = <40 0x8>;
278 clocks = <&clks MPC512x_CLK_PSC_FIFO>;
279 clock-names = "ipg";
229 }; 280 };
230 281
231 dma@14000 { 282 dma@14000 {
diff --git a/arch/powerpc/boot/dts/mpc7448hpc2.dts b/arch/powerpc/boot/dts/mpc7448hpc2.dts
index 2544f3ecd6e9..20a0d22df473 100644
--- a/arch/powerpc/boot/dts/mpc7448hpc2.dts
+++ b/arch/powerpc/boot/dts/mpc7448hpc2.dts
@@ -68,7 +68,6 @@
68 }; 68 };
69 69
70 MDIO: mdio@6000 { 70 MDIO: mdio@6000 {
71 device_type = "mdio";
72 compatible = "tsi108-mdio"; 71 compatible = "tsi108-mdio";
73 reg = <0x6000 0x50>; 72 reg = <0x6000 0x50>;
74 #address-cells = <1>; 73 #address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts
index e802ebd88cb1..6d2cddf64cfd 100644
--- a/arch/powerpc/boot/dts/mpc8272ads.dts
+++ b/arch/powerpc/boot/dts/mpc8272ads.dts
@@ -182,7 +182,6 @@
182 }; 182 };
183 183
184 mdio@10d40 { 184 mdio@10d40 {
185 device_type = "mdio";
186 compatible = "fsl,mpc8272ads-mdio-bitbang", 185 compatible = "fsl,mpc8272ads-mdio-bitbang",
187 "fsl,mpc8272-mdio-bitbang", 186 "fsl,mpc8272-mdio-bitbang",
188 "fsl,cpm2-mdio-bitbang"; 187 "fsl,cpm2-mdio-bitbang";
@@ -196,14 +195,12 @@
196 interrupt-parent = <&PIC>; 195 interrupt-parent = <&PIC>;
197 interrupts = <23 8>; 196 interrupts = <23 8>;
198 reg = <0x0>; 197 reg = <0x0>;
199 device_type = "ethernet-phy";
200 }; 198 };
201 199
202 PHY1: ethernet-phy@1 { 200 PHY1: ethernet-phy@1 {
203 interrupt-parent = <&PIC>; 201 interrupt-parent = <&PIC>;
204 interrupts = <23 8>; 202 interrupts = <23 8>;
205 reg = <0x3>; 203 reg = <0x3>;
206 device_type = "ethernet-phy";
207 }; 204 };
208 }; 205 };
209 206
diff --git a/arch/powerpc/boot/dts/mpc8308_p1m.dts b/arch/powerpc/boot/dts/mpc8308_p1m.dts
index 22b0832b6c31..651e4f55acdb 100644
--- a/arch/powerpc/boot/dts/mpc8308_p1m.dts
+++ b/arch/powerpc/boot/dts/mpc8308_p1m.dts
@@ -189,13 +189,11 @@
189 interrupt-parent = <&ipic>; 189 interrupt-parent = <&ipic>;
190 interrupts = <17 0x8>; 190 interrupts = <17 0x8>;
191 reg = <0x1>; 191 reg = <0x1>;
192 device_type = "ethernet-phy";
193 }; 192 };
194 phy2: ethernet-phy@2 { 193 phy2: ethernet-phy@2 {
195 interrupt-parent = <&ipic>; 194 interrupt-parent = <&ipic>;
196 interrupts = <19 0x8>; 195 interrupts = <19 0x8>;
197 reg = <0x2>; 196 reg = <0x2>;
198 device_type = "ethernet-phy";
199 }; 197 };
200 tbi0: tbi-phy@11 { 198 tbi0: tbi-phy@11 {
201 reg = <0x11>; 199 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8308rdb.dts b/arch/powerpc/boot/dts/mpc8308rdb.dts
index f66d10d95a8d..9ce45f2efd34 100644
--- a/arch/powerpc/boot/dts/mpc8308rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8308rdb.dts
@@ -166,7 +166,6 @@
166 interrupt-parent = <&ipic>; 166 interrupt-parent = <&ipic>;
167 interrupts = <17 0x8>; 167 interrupts = <17 0x8>;
168 reg = <0x2>; 168 reg = <0x2>;
169 device_type = "ethernet-phy";
170 }; 169 };
171 tbi0: tbi-phy@11 { 170 tbi0: tbi-phy@11 {
172 reg = <0x11>; 171 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 1c836c6c5be6..4b635dc4ecde 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -217,7 +217,6 @@
217 interrupt-parent = <&ipic>; 217 interrupt-parent = <&ipic>;
218 interrupts = <20 0x8>; 218 interrupts = <20 0x8>;
219 reg = <0x4>; 219 reg = <0x4>;
220 device_type = "ethernet-phy";
221 }; 220 };
222 tbi0: tbi-phy@11 { 221 tbi0: tbi-phy@11 {
223 reg = <0x11>; 222 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 811848e93aef..43546844ea5a 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -216,14 +216,12 @@
216 interrupt-parent = <&ipic>; 216 interrupt-parent = <&ipic>;
217 interrupts = <20 0x8>; 217 interrupts = <20 0x8>;
218 reg = <0x0>; 218 reg = <0x0>;
219 device_type = "ethernet-phy";
220 }; 219 };
221 220
222 phy1: ethernet-phy@1 { 221 phy1: ethernet-phy@1 {
223 interrupt-parent = <&ipic>; 222 interrupt-parent = <&ipic>;
224 interrupts = <19 0x8>; 223 interrupts = <19 0x8>;
225 reg = <0x1>; 224 reg = <0x1>;
226 device_type = "ethernet-phy";
227 }; 225 };
228 226
229 tbi0: tbi-phy@11 { 227 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index da9c72ddc343..0793cdf0d46e 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -356,13 +356,11 @@
356 interrupt-parent = <&ipic>; 356 interrupt-parent = <&ipic>;
357 interrupts = <17 0x8>; 357 interrupts = <17 0x8>;
358 reg = <0x3>; 358 reg = <0x3>;
359 device_type = "ethernet-phy";
360 }; 359 };
361 phy4: ethernet-phy@04 { 360 phy4: ethernet-phy@04 {
362 interrupt-parent = <&ipic>; 361 interrupt-parent = <&ipic>;
363 interrupts = <18 0x8>; 362 interrupts = <18 0x8>;
364 reg = <0x4>; 363 reg = <0x4>;
365 device_type = "ethernet-phy";
366 }; 364 };
367 }; 365 };
368 366
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index ff7b15b340a3..91df1eb16667 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -314,13 +314,11 @@
314 interrupt-parent = <&ipic>; 314 interrupt-parent = <&ipic>;
315 interrupts = <0>; 315 interrupts = <0>;
316 reg = <0x0>; 316 reg = <0x0>;
317 device_type = "ethernet-phy";
318 }; 317 };
319 phy04:ethernet-phy@04 { 318 phy04:ethernet-phy@04 {
320 interrupt-parent = <&ipic>; 319 interrupt-parent = <&ipic>;
321 interrupts = <0>; 320 interrupts = <0>;
322 reg = <0x4>; 321 reg = <0x4>;
323 device_type = "ethernet-phy";
324 }; 322 };
325 }; 323 };
326 324
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 2608679d0d4a..cf8542401a3c 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -240,7 +240,6 @@
240 interrupt-parent = <&ipic>; 240 interrupt-parent = <&ipic>;
241 interrupts = <18 0x8>; 241 interrupts = <18 0x8>;
242 reg = <0x1c>; 242 reg = <0x1c>;
243 device_type = "ethernet-phy";
244 }; 243 };
245 244
246 tbi0: tbi-phy@11 { 245 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index 6cd044d8fb89..f00066dcc8de 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -176,7 +176,6 @@
176 interrupt-parent = <&ipic>; 176 interrupt-parent = <&ipic>;
177 interrupts = <18 0x8>; 177 interrupts = <18 0x8>;
178 reg = <0x1c>; 178 reg = <0x1c>;
179 device_type = "ethernet-phy";
180 }; 179 };
181 180
182 tbi0: tbi-phy@11 { 181 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 4552864082c2..4843c3ff7166 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -193,14 +193,12 @@
193 interrupt-parent = <&ipic>; 193 interrupt-parent = <&ipic>;
194 interrupts = <17 0x8>; 194 interrupts = <17 0x8>;
195 reg = <0x0>; 195 reg = <0x0>;
196 device_type = "ethernet-phy";
197 }; 196 };
198 197
199 phy1: ethernet-phy@1 { 198 phy1: ethernet-phy@1 {
200 interrupt-parent = <&ipic>; 199 interrupt-parent = <&ipic>;
201 interrupts = <18 0x8>; 200 interrupts = <18 0x8>;
202 reg = <0x1>; 201 reg = <0x1>;
203 device_type = "ethernet-phy";
204 }; 202 };
205 203
206 tbi0: tbi-phy@11 { 204 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 81dd513d6308..ecb6ccd3a6aa 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -397,13 +397,11 @@
397 interrupt-parent = <&ipic>; 397 interrupt-parent = <&ipic>;
398 interrupts = <17 0x8>; 398 interrupts = <17 0x8>;
399 reg = <0x0>; 399 reg = <0x0>;
400 device_type = "ethernet-phy";
401 }; 400 };
402 phy1: ethernet-phy@01 { 401 phy1: ethernet-phy@01 {
403 interrupt-parent = <&ipic>; 402 interrupt-parent = <&ipic>;
404 interrupts = <18 0x8>; 403 interrupts = <18 0x8>;
405 reg = <0x1>; 404 reg = <0x1>;
406 device_type = "ethernet-phy";
407 }; 405 };
408 tbi-phy@2 { 406 tbi-phy@2 {
409 device_type = "tbi-phy"; 407 device_type = "tbi-phy";
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index b6e9aec1d860..daeacbdcf8b4 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -332,25 +332,21 @@
332 reg = <0x2120 0x18>; 332 reg = <0x2120 0x18>;
333 333
334 phy1: ethernet-phy@1 { 334 phy1: ethernet-phy@1 {
335 device_type = "ethernet-phy";
336 compatible = "national,DP83848VV"; 335 compatible = "national,DP83848VV";
337 reg = <1>; 336 reg = <1>;
338 }; 337 };
339 338
340 phy2: ethernet-phy@2 { 339 phy2: ethernet-phy@2 {
341 device_type = "ethernet-phy";
342 compatible = "broadcom,BCM5481UA2KMLG"; 340 compatible = "broadcom,BCM5481UA2KMLG";
343 reg = <2>; 341 reg = <2>;
344 }; 342 };
345 343
346 phy3: ethernet-phy@3 { 344 phy3: ethernet-phy@3 {
347 device_type = "ethernet-phy";
348 compatible = "national,DP83848VV"; 345 compatible = "national,DP83848VV";
349 reg = <3>; 346 reg = <3>;
350 }; 347 };
351 348
352 phy4: ethernet-phy@4 { 349 phy4: ethernet-phy@4 {
353 device_type = "ethernet-phy";
354 compatible = "broadcom,BCM5481UA2KMLG"; 350 compatible = "broadcom,BCM5481UA2KMLG";
355 reg = <4>; 351 reg = <4>;
356 }; 352 };
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index cfccef57cd1d..c2c062e8175d 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -225,14 +225,12 @@
225 interrupt-parent = <&ipic>; 225 interrupt-parent = <&ipic>;
226 interrupts = <17 0x8>; 226 interrupts = <17 0x8>;
227 reg = <0x2>; 227 reg = <0x2>;
228 device_type = "ethernet-phy";
229 }; 228 };
230 229
231 phy3: ethernet-phy@3 { 230 phy3: ethernet-phy@3 {
232 interrupt-parent = <&ipic>; 231 interrupt-parent = <&ipic>;
233 interrupts = <18 0x8>; 232 interrupts = <18 0x8>;
234 reg = <0x3>; 233 reg = <0x3>;
235 device_type = "ethernet-phy";
236 }; 234 };
237 235
238 tbi0: tbi-phy@11 { 236 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8377_rdb.dts b/arch/powerpc/boot/dts/mpc8377_rdb.dts
index 353deff1b7f6..2b4b6532d69c 100644
--- a/arch/powerpc/boot/dts/mpc8377_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8377_rdb.dts
@@ -277,7 +277,6 @@
277 interrupt-parent = <&ipic>; 277 interrupt-parent = <&ipic>;
278 interrupts = <17 0x8>; 278 interrupts = <17 0x8>;
279 reg = <0x2>; 279 reg = <0x2>;
280 device_type = "ethernet-phy";
281 }; 280 };
282 281
283 tbi0: tbi-phy@11 { 282 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8377_wlan.dts b/arch/powerpc/boot/dts/mpc8377_wlan.dts
index ef4a305a0d0c..c0c790168b96 100644
--- a/arch/powerpc/boot/dts/mpc8377_wlan.dts
+++ b/arch/powerpc/boot/dts/mpc8377_wlan.dts
@@ -253,14 +253,12 @@
253 interrupt-parent = <&ipic>; 253 interrupt-parent = <&ipic>;
254 interrupts = <17 0x8>; 254 interrupts = <17 0x8>;
255 reg = <0x2>; 255 reg = <0x2>;
256 device_type = "ethernet-phy";
257 }; 256 };
258 257
259 phy3: ethernet-phy@3 { 258 phy3: ethernet-phy@3 {
260 interrupt-parent = <&ipic>; 259 interrupt-parent = <&ipic>;
261 interrupts = <18 0x8>; 260 interrupts = <18 0x8>;
262 reg = <0x3>; 261 reg = <0x3>;
263 device_type = "ethernet-phy";
264 }; 262 };
265 263
266 tbi0: tbi-phy@11 { 264 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
index 538fcb927337..1b82b77f9415 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -264,14 +264,12 @@
264 interrupt-parent = <&ipic>; 264 interrupt-parent = <&ipic>;
265 interrupts = <17 0x8>; 265 interrupts = <17 0x8>;
266 reg = <0x2>; 266 reg = <0x2>;
267 device_type = "ethernet-phy";
268 }; 267 };
269 268
270 phy3: ethernet-phy@3 { 269 phy3: ethernet-phy@3 {
271 interrupt-parent = <&ipic>; 270 interrupt-parent = <&ipic>;
272 interrupts = <18 0x8>; 271 interrupts = <18 0x8>;
273 reg = <0x3>; 272 reg = <0x3>;
274 device_type = "ethernet-phy";
275 }; 273 };
276 274
277 tbi0: tbi-phy@11 { 275 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8378_rdb.dts b/arch/powerpc/boot/dts/mpc8378_rdb.dts
index 32333a908f3d..74b6a535a413 100644
--- a/arch/powerpc/boot/dts/mpc8378_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8378_rdb.dts
@@ -277,7 +277,6 @@
277 interrupt-parent = <&ipic>; 277 interrupt-parent = <&ipic>;
278 interrupts = <17 0x8>; 278 interrupts = <17 0x8>;
279 reg = <0x2>; 279 reg = <0x2>;
280 device_type = "ethernet-phy";
281 }; 280 };
282 281
283 tbi0: tbi-phy@11 { 282 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
index 5387092fdfb4..38e5048d65d2 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -262,14 +262,12 @@
262 interrupt-parent = <&ipic>; 262 interrupt-parent = <&ipic>;
263 interrupts = <17 0x8>; 263 interrupts = <17 0x8>;
264 reg = <0x2>; 264 reg = <0x2>;
265 device_type = "ethernet-phy";
266 }; 265 };
267 266
268 phy3: ethernet-phy@3 { 267 phy3: ethernet-phy@3 {
269 interrupt-parent = <&ipic>; 268 interrupt-parent = <&ipic>;
270 interrupts = <18 0x8>; 269 interrupts = <18 0x8>;
271 reg = <0x3>; 270 reg = <0x3>;
272 device_type = "ethernet-phy";
273 }; 271 };
274 272
275 tbi0: tbi-phy@11 { 273 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8379_rdb.dts b/arch/powerpc/boot/dts/mpc8379_rdb.dts
index 46224c2430ff..3b5cbac85368 100644
--- a/arch/powerpc/boot/dts/mpc8379_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8379_rdb.dts
@@ -275,7 +275,6 @@
275 interrupt-parent = <&ipic>; 275 interrupt-parent = <&ipic>;
276 interrupts = <17 0x8>; 276 interrupts = <17 0x8>;
277 reg = <0x2>; 277 reg = <0x2>;
278 device_type = "ethernet-phy";
279 }; 278 };
280 279
281 tbi0: tbi-phy@11 { 280 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dtsi b/arch/powerpc/boot/dts/mpc8536ds.dtsi
index 7c3dde84d193..937ad7e46119 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8536ds.dtsi
@@ -200,12 +200,10 @@
200 phy0: ethernet-phy@0 { 200 phy0: ethernet-phy@0 {
201 interrupts = <10 0x1 0 0>; 201 interrupts = <10 0x1 0 0>;
202 reg = <0>; 202 reg = <0>;
203 device_type = "ethernet-phy";
204 }; 203 };
205 phy1: ethernet-phy@1 { 204 phy1: ethernet-phy@1 {
206 interrupts = <10 0x1 0 0>; 205 interrupts = <10 0x1 0 0>;
207 reg = <1>; 206 reg = <1>;
208 device_type = "ethernet-phy";
209 }; 207 };
210 sgmii_phy0: sgmii-phy@0 { 208 sgmii_phy0: sgmii-phy@0 {
211 interrupts = <6 1 0 0>; 209 interrupts = <6 1 0 0>;
diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index 2d31863accf5..7ce274c9a2d5 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -165,19 +165,16 @@
165 interrupt-parent = <&mpic>; 165 interrupt-parent = <&mpic>;
166 interrupts = <5 1>; 166 interrupts = <5 1>;
167 reg = <0x0>; 167 reg = <0x0>;
168 device_type = "ethernet-phy";
169 }; 168 };
170 phy1: ethernet-phy@1 { 169 phy1: ethernet-phy@1 {
171 interrupt-parent = <&mpic>; 170 interrupt-parent = <&mpic>;
172 interrupts = <5 1>; 171 interrupts = <5 1>;
173 reg = <0x1>; 172 reg = <0x1>;
174 device_type = "ethernet-phy";
175 }; 173 };
176 phy3: ethernet-phy@3 { 174 phy3: ethernet-phy@3 {
177 interrupt-parent = <&mpic>; 175 interrupt-parent = <&mpic>;
178 interrupts = <7 1>; 176 interrupts = <7 1>;
179 reg = <0x3>; 177 reg = <0x3>;
180 device_type = "ethernet-phy";
181 }; 178 };
182 tbi0: tbi-phy@11 { 179 tbi0: tbi-phy@11 {
183 reg = <0x11>; 180 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8541cds.dts b/arch/powerpc/boot/dts/mpc8541cds.dts
index 1c03c2667373..4d35a3e0fb02 100644
--- a/arch/powerpc/boot/dts/mpc8541cds.dts
+++ b/arch/powerpc/boot/dts/mpc8541cds.dts
@@ -165,13 +165,11 @@
165 interrupt-parent = <&mpic>; 165 interrupt-parent = <&mpic>;
166 interrupts = <5 1>; 166 interrupts = <5 1>;
167 reg = <0x0>; 167 reg = <0x0>;
168 device_type = "ethernet-phy";
169 }; 168 };
170 phy1: ethernet-phy@1 { 169 phy1: ethernet-phy@1 {
171 interrupt-parent = <&mpic>; 170 interrupt-parent = <&mpic>;
172 interrupts = <5 1>; 171 interrupts = <5 1>;
173 reg = <0x1>; 172 reg = <0x1>;
174 device_type = "ethernet-phy";
175 }; 173 };
176 tbi0: tbi-phy@11 { 174 tbi0: tbi-phy@11 {
177 reg = <0x11>; 175 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dtsi b/arch/powerpc/boot/dts/mpc8544ds.dtsi
index b219d035d794..47d986b041f6 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8544ds.dtsi
@@ -82,12 +82,10 @@
82 phy0: ethernet-phy@0 { 82 phy0: ethernet-phy@0 {
83 interrupts = <10 1 0 0>; 83 interrupts = <10 1 0 0>;
84 reg = <0x0>; 84 reg = <0x0>;
85 device_type = "ethernet-phy";
86 }; 85 };
87 phy1: ethernet-phy@1 { 86 phy1: ethernet-phy@1 {
88 interrupts = <10 1 0 0>; 87 interrupts = <10 1 0 0>;
89 reg = <0x1>; 88 reg = <0x1>;
90 device_type = "ethernet-phy";
91 }; 89 };
92 90
93 sgmii_phy0: sgmii-phy@0 { 91 sgmii_phy0: sgmii-phy@0 {
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dtsi b/arch/powerpc/boot/dts/mpc8548cds.dtsi
index c61f525e4740..3bc7d4711220 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8548cds.dtsi
@@ -109,22 +109,18 @@
109 phy0: ethernet-phy@0 { 109 phy0: ethernet-phy@0 {
110 interrupts = <5 1 0 0>; 110 interrupts = <5 1 0 0>;
111 reg = <0x0>; 111 reg = <0x0>;
112 device_type = "ethernet-phy";
113 }; 112 };
114 phy1: ethernet-phy@1 { 113 phy1: ethernet-phy@1 {
115 interrupts = <5 1 0 0>; 114 interrupts = <5 1 0 0>;
116 reg = <0x1>; 115 reg = <0x1>;
117 device_type = "ethernet-phy";
118 }; 116 };
119 phy2: ethernet-phy@2 { 117 phy2: ethernet-phy@2 {
120 interrupts = <5 1 0 0>; 118 interrupts = <5 1 0 0>;
121 reg = <0x2>; 119 reg = <0x2>;
122 device_type = "ethernet-phy";
123 }; 120 };
124 phy3: ethernet-phy@3 { 121 phy3: ethernet-phy@3 {
125 interrupts = <5 1 0 0>; 122 interrupts = <5 1 0 0>;
126 reg = <0x3>; 123 reg = <0x3>;
127 device_type = "ethernet-phy";
128 }; 124 };
129 tbi0: tbi-phy@11 { 125 tbi0: tbi-phy@11 {
130 reg = <0x11>; 126 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8555cds.dts b/arch/powerpc/boot/dts/mpc8555cds.dts
index 36a7ea138c2f..f115f21cb0ae 100644
--- a/arch/powerpc/boot/dts/mpc8555cds.dts
+++ b/arch/powerpc/boot/dts/mpc8555cds.dts
@@ -165,13 +165,11 @@
165 interrupt-parent = <&mpic>; 165 interrupt-parent = <&mpic>;
166 interrupts = <5 1>; 166 interrupts = <5 1>;
167 reg = <0x0>; 167 reg = <0x0>;
168 device_type = "ethernet-phy";
169 }; 168 };
170 phy1: ethernet-phy@1 { 169 phy1: ethernet-phy@1 {
171 interrupt-parent = <&mpic>; 170 interrupt-parent = <&mpic>;
172 interrupts = <5 1>; 171 interrupts = <5 1>;
173 reg = <0x1>; 172 reg = <0x1>;
174 device_type = "ethernet-phy";
175 }; 173 };
176 tbi0: tbi-phy@11 { 174 tbi0: tbi-phy@11 {
177 reg = <0x11>; 175 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index 1a43f5a968f5..0d70921d6125 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -154,25 +154,21 @@
154 interrupt-parent = <&mpic>; 154 interrupt-parent = <&mpic>;
155 interrupts = <5 1>; 155 interrupts = <5 1>;
156 reg = <0x0>; 156 reg = <0x0>;
157 device_type = "ethernet-phy";
158 }; 157 };
159 phy1: ethernet-phy@1 { 158 phy1: ethernet-phy@1 {
160 interrupt-parent = <&mpic>; 159 interrupt-parent = <&mpic>;
161 interrupts = <5 1>; 160 interrupts = <5 1>;
162 reg = <0x1>; 161 reg = <0x1>;
163 device_type = "ethernet-phy";
164 }; 162 };
165 phy2: ethernet-phy@2 { 163 phy2: ethernet-phy@2 {
166 interrupt-parent = <&mpic>; 164 interrupt-parent = <&mpic>;
167 interrupts = <7 1>; 165 interrupts = <7 1>;
168 reg = <0x2>; 166 reg = <0x2>;
169 device_type = "ethernet-phy";
170 }; 167 };
171 phy3: ethernet-phy@3 { 168 phy3: ethernet-phy@3 {
172 interrupt-parent = <&mpic>; 169 interrupt-parent = <&mpic>;
173 interrupts = <7 1>; 170 interrupts = <7 1>;
174 reg = <0x3>; 171 reg = <0x3>;
175 device_type = "ethernet-phy";
176 }; 172 };
177 tbi0: tbi-phy@11 { 173 tbi0: tbi-phy@11 {
178 reg = <0x11>; 174 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 09598bb5d443..bead2b655b9f 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -91,22 +91,18 @@
91 phy0: ethernet-phy@7 { 91 phy0: ethernet-phy@7 {
92 interrupts = <1 1 0 0>; 92 interrupts = <1 1 0 0>;
93 reg = <0x7>; 93 reg = <0x7>;
94 device_type = "ethernet-phy";
95 }; 94 };
96 phy1: ethernet-phy@1 { 95 phy1: ethernet-phy@1 {
97 interrupts = <2 1 0 0>; 96 interrupts = <2 1 0 0>;
98 reg = <0x1>; 97 reg = <0x1>;
99 device_type = "ethernet-phy";
100 }; 98 };
101 phy2: ethernet-phy@2 { 99 phy2: ethernet-phy@2 {
102 interrupts = <1 1 0 0>; 100 interrupts = <1 1 0 0>;
103 reg = <0x2>; 101 reg = <0x2>;
104 device_type = "ethernet-phy";
105 }; 102 };
106 phy3: ethernet-phy@3 { 103 phy3: ethernet-phy@3 {
107 interrupts = <2 1 0 0>; 104 interrupts = <2 1 0 0>;
108 reg = <0x3>; 105 reg = <0x3>;
109 device_type = "ethernet-phy";
110 }; 106 };
111 tbi0: tbi-phy@11 { 107 tbi0: tbi-phy@11 {
112 reg = <0x11>; 108 reg = <0x11>;
@@ -236,25 +232,21 @@
236 interrupt-parent = <&mpic>; 232 interrupt-parent = <&mpic>;
237 interrupts = <1 1 0 0>; 233 interrupts = <1 1 0 0>;
238 reg = <0x7>; 234 reg = <0x7>;
239 device_type = "ethernet-phy";
240 }; 235 };
241 qe_phy1: ethernet-phy@01 { 236 qe_phy1: ethernet-phy@01 {
242 interrupt-parent = <&mpic>; 237 interrupt-parent = <&mpic>;
243 interrupts = <2 1 0 0>; 238 interrupts = <2 1 0 0>;
244 reg = <0x1>; 239 reg = <0x1>;
245 device_type = "ethernet-phy";
246 }; 240 };
247 qe_phy2: ethernet-phy@02 { 241 qe_phy2: ethernet-phy@02 {
248 interrupt-parent = <&mpic>; 242 interrupt-parent = <&mpic>;
249 interrupts = <1 1 0 0>; 243 interrupts = <1 1 0 0>;
250 reg = <0x2>; 244 reg = <0x2>;
251 device_type = "ethernet-phy";
252 }; 245 };
253 qe_phy3: ethernet-phy@03 { 246 qe_phy3: ethernet-phy@03 {
254 interrupt-parent = <&mpic>; 247 interrupt-parent = <&mpic>;
255 interrupts = <2 1 0 0>; 248 interrupts = <2 1 0 0>;
256 reg = <0x3>; 249 reg = <0x3>;
257 device_type = "ethernet-phy";
258 }; 250 };
259 }; 251 };
260 }; 252 };
diff --git a/arch/powerpc/boot/dts/mpc8569mds.dts b/arch/powerpc/boot/dts/mpc8569mds.dts
index fe0d60935e9b..d0dcdafa5eb2 100644
--- a/arch/powerpc/boot/dts/mpc8569mds.dts
+++ b/arch/powerpc/boot/dts/mpc8569mds.dts
@@ -276,33 +276,27 @@
276 interrupt-parent = <&mpic>; 276 interrupt-parent = <&mpic>;
277 interrupts = <1 1 0 0>; 277 interrupts = <1 1 0 0>;
278 reg = <0x7>; 278 reg = <0x7>;
279 device_type = "ethernet-phy";
280 }; 279 };
281 qe_phy1: ethernet-phy@01 { 280 qe_phy1: ethernet-phy@01 {
282 interrupt-parent = <&mpic>; 281 interrupt-parent = <&mpic>;
283 interrupts = <2 1 0 0>; 282 interrupts = <2 1 0 0>;
284 reg = <0x1>; 283 reg = <0x1>;
285 device_type = "ethernet-phy";
286 }; 284 };
287 qe_phy2: ethernet-phy@02 { 285 qe_phy2: ethernet-phy@02 {
288 interrupt-parent = <&mpic>; 286 interrupt-parent = <&mpic>;
289 interrupts = <3 1 0 0>; 287 interrupts = <3 1 0 0>;
290 reg = <0x2>; 288 reg = <0x2>;
291 device_type = "ethernet-phy";
292 }; 289 };
293 qe_phy3: ethernet-phy@03 { 290 qe_phy3: ethernet-phy@03 {
294 interrupt-parent = <&mpic>; 291 interrupt-parent = <&mpic>;
295 interrupts = <4 1 0 0>; 292 interrupts = <4 1 0 0>;
296 reg = <0x3>; 293 reg = <0x3>;
297 device_type = "ethernet-phy";
298 }; 294 };
299 qe_phy5: ethernet-phy@04 { 295 qe_phy5: ethernet-phy@04 {
300 reg = <0x04>; 296 reg = <0x04>;
301 device_type = "ethernet-phy";
302 }; 297 };
303 qe_phy7: ethernet-phy@06 { 298 qe_phy7: ethernet-phy@06 {
304 reg = <0x6>; 299 reg = <0x6>;
305 device_type = "ethernet-phy";
306 }; 300 };
307 tbi1: tbi-phy@11 { 301 tbi1: tbi-phy@11 {
308 reg = <0x11>; 302 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index 1e8666ccbed8..1c03060dd0b8 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -211,25 +211,21 @@
211 interrupt-parent = <&mpic>; 211 interrupt-parent = <&mpic>;
212 interrupts = <10 1>; 212 interrupts = <10 1>;
213 reg = <0>; 213 reg = <0>;
214 device_type = "ethernet-phy";
215 }; 214 };
216 phy1: ethernet-phy@1 { 215 phy1: ethernet-phy@1 {
217 interrupt-parent = <&mpic>; 216 interrupt-parent = <&mpic>;
218 interrupts = <10 1>; 217 interrupts = <10 1>;
219 reg = <1>; 218 reg = <1>;
220 device_type = "ethernet-phy";
221 }; 219 };
222 phy2: ethernet-phy@2 { 220 phy2: ethernet-phy@2 {
223 interrupt-parent = <&mpic>; 221 interrupt-parent = <&mpic>;
224 interrupts = <10 1>; 222 interrupts = <10 1>;
225 reg = <2>; 223 reg = <2>;
226 device_type = "ethernet-phy";
227 }; 224 };
228 phy3: ethernet-phy@3 { 225 phy3: ethernet-phy@3 {
229 interrupt-parent = <&mpic>; 226 interrupt-parent = <&mpic>;
230 interrupts = <10 1>; 227 interrupts = <10 1>;
231 reg = <3>; 228 reg = <3>;
232 device_type = "ethernet-phy";
233 }; 229 };
234 tbi0: tbi-phy@11 { 230 tbi0: tbi-phy@11 {
235 reg = <0x11>; 231 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts b/arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts
index fd4cd4da60b5..bb575e28042a 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn_36b.dts
@@ -211,25 +211,21 @@
211 interrupt-parent = <&mpic>; 211 interrupt-parent = <&mpic>;
212 interrupts = <10 1>; 212 interrupts = <10 1>;
213 reg = <0>; 213 reg = <0>;
214 device_type = "ethernet-phy";
215 }; 214 };
216 phy1: ethernet-phy@1 { 215 phy1: ethernet-phy@1 {
217 interrupt-parent = <&mpic>; 216 interrupt-parent = <&mpic>;
218 interrupts = <10 1>; 217 interrupts = <10 1>;
219 reg = <1>; 218 reg = <1>;
220 device_type = "ethernet-phy";
221 }; 219 };
222 phy2: ethernet-phy@2 { 220 phy2: ethernet-phy@2 {
223 interrupt-parent = <&mpic>; 221 interrupt-parent = <&mpic>;
224 interrupts = <10 1>; 222 interrupts = <10 1>;
225 reg = <2>; 223 reg = <2>;
226 device_type = "ethernet-phy";
227 }; 224 };
228 phy3: ethernet-phy@3 { 225 phy3: ethernet-phy@3 {
229 interrupt-parent = <&mpic>; 226 interrupt-parent = <&mpic>;
230 interrupts = <10 1>; 227 interrupts = <10 1>;
231 reg = <3>; 228 reg = <3>;
232 device_type = "ethernet-phy";
233 }; 229 };
234 tbi0: tbi-phy@11 { 230 tbi0: tbi-phy@11 {
235 reg = <0x11>; 231 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/mpc866ads.dts b/arch/powerpc/boot/dts/mpc866ads.dts
index bd700651f360..34c1f48b1a09 100644
--- a/arch/powerpc/boot/dts/mpc866ads.dts
+++ b/arch/powerpc/boot/dts/mpc866ads.dts
@@ -74,7 +74,6 @@
74 #size-cells = <0>; 74 #size-cells = <0>;
75 PHY: ethernet-phy@f { 75 PHY: ethernet-phy@f {
76 reg = <0xf>; 76 reg = <0xf>;
77 device_type = "ethernet-phy";
78 }; 77 };
79 }; 78 };
80 79
diff --git a/arch/powerpc/boot/dts/mpc885ads.dts b/arch/powerpc/boot/dts/mpc885ads.dts
index b123e9f7a5a8..4e93bd961e0f 100644
--- a/arch/powerpc/boot/dts/mpc885ads.dts
+++ b/arch/powerpc/boot/dts/mpc885ads.dts
@@ -86,17 +86,14 @@
86 86
87 PHY0: ethernet-phy@0 { 87 PHY0: ethernet-phy@0 {
88 reg = <0x0>; 88 reg = <0x0>;
89 device_type = "ethernet-phy";
90 }; 89 };
91 90
92 PHY1: ethernet-phy@1 { 91 PHY1: ethernet-phy@1 {
93 reg = <0x1>; 92 reg = <0x1>;
94 device_type = "ethernet-phy";
95 }; 93 };
96 94
97 PHY2: ethernet-phy@2 { 95 PHY2: ethernet-phy@2 {
98 reg = <0x2>; 96 reg = <0x2>;
99 device_type = "ethernet-phy";
100 }; 97 };
101 }; 98 };
102 99
diff --git a/arch/powerpc/boot/dts/mvme5100.dts b/arch/powerpc/boot/dts/mvme5100.dts
new file mode 100644
index 000000000000..1ecb341a232a
--- /dev/null
+++ b/arch/powerpc/boot/dts/mvme5100.dts
@@ -0,0 +1,185 @@
1/*
2 * Device Tree Source for Motorola/Emerson MVME5100.
3 *
4 * Copyright 2013 CSC Australia Pty. Ltd.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without
8 * any warranty of any kind, whether express or implied.
9 */
10
11/dts-v1/;
12
13/ {
14 model = "MVME5100";
15 compatible = "MVME5100";
16 #address-cells = <1>;
17 #size-cells = <1>;
18
19 aliases {
20 serial0 = &serial0;
21 pci0 = &pci0;
22 };
23
24 cpus {
25 #address-cells = <1>;
26 #size-cells = <0>;
27
28 PowerPC,7410 {
29 device_type = "cpu";
30 reg = <0x0>;
31 /* Following required by dtc but not used */
32 d-cache-line-size = <32>;
33 i-cache-line-size = <32>;
34 i-cache-size = <32768>;
35 d-cache-size = <32768>;
36 timebase-frequency = <25000000>;
37 clock-frequency = <500000000>;
38 bus-frequency = <100000000>;
39 };
40 };
41
42 memory {
43 device_type = "memory";
44 reg = <0x0 0x20000000>;
45 };
46
47 hawk@fef80000 {
48 #address-cells = <1>;
49 #size-cells = <1>;
50 compatible = "hawk-bridge", "simple-bus";
51 ranges = <0x0 0xfef80000 0x10000>;
52 reg = <0xfef80000 0x10000>;
53
54 serial0: serial@8000 {
55 device_type = "serial";
56 compatible = "ns16550";
57 reg = <0x8000 0x80>;
58 reg-shift = <4>;
59 clock-frequency = <1843200>;
60 current-speed = <9600>;
61 interrupts = <1 1>; // IRQ1 Level Active Low.
62 interrupt-parent = <&mpic>;
63 };
64
65 serial1: serial@8200 {
66 device_type = "serial";
67 compatible = "ns16550";
68 reg = <0x8200 0x80>;
69 reg-shift = <4>;
70 clock-frequency = <1843200>;
71 current-speed = <9600>;
72 interrupts = <1 1>; // IRQ1 Level Active Low.
73 interrupt-parent = <&mpic>;
74 };
75
76 mpic: interrupt-controller@f3f80000 {
77 #interrupt-cells = <2>;
78 #address-cells = <0>;
79 device_type = "open-pic";
80 compatible = "chrp,open-pic";
81 interrupt-controller;
82 reg = <0xf3f80000 0x40000>;
83 };
84 };
85
86 pci0: pci@feff0000 {
87 #address-cells = <3>;
88 #size-cells = <2>;
89 #interrupt-cells = <1>;
90 device_type = "pci";
91 compatible = "hawk-pci";
92 reg = <0xfec00000 0x400000>;
93 8259-interrupt-acknowledge = <0xfeff0030>;
94 ranges = <0x1000000 0x0 0x0 0xfe000000 0x0 0x800000
95 0x2000000 0x0 0x80000000 0x80000000 0x0 0x74000000>;
96 bus-range = <0 255>;
97 clock-frequency = <33333333>;
98 interrupt-parent = <&mpic>;
99 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
100 interrupt-map = <
101
102 /*
103 * This definition (IDSEL 11) duplicates the
104 * interrupts definition in the i8259
105 * interrupt controller below.
106 *
107 * Do not change the interrupt sense/polarity from
108 * 0x2 to anything else, doing so will cause endless
109 * "spurious" i8259 interrupts to be fielded.
110 */
111 // IDSEL 11 - iPMC712 PCI/ISA Bridge
112 0x5800 0x0 0x0 0x1 &mpic 0x0 0x2
113 0x5800 0x0 0x0 0x2 &mpic 0x0 0x2
114 0x5800 0x0 0x0 0x3 &mpic 0x0 0x2
115 0x5800 0x0 0x0 0x4 &mpic 0x0 0x2
116
117 /* IDSEL 12 - Not Used */
118
119 /* IDSEL 13 - Universe VME Bridge */
120 0x6800 0x0 0x0 0x1 &mpic 0x5 0x1
121 0x6800 0x0 0x0 0x2 &mpic 0x6 0x1
122 0x6800 0x0 0x0 0x3 &mpic 0x7 0x1
123 0x6800 0x0 0x0 0x4 &mpic 0x8 0x1
124
125 /* IDSEL 14 - ENET 1 */
126 0x7000 0x0 0x0 0x1 &mpic 0x2 0x1
127
128 /* IDSEL 15 - Not Used */
129
130 /* IDSEL 16 - PMC Slot 1 */
131 0x8000 0x0 0x0 0x1 &mpic 0x9 0x1
132 0x8000 0x0 0x0 0x2 &mpic 0xa 0x1
133 0x8000 0x0 0x0 0x3 &mpic 0xb 0x1
134 0x8000 0x0 0x0 0x4 &mpic 0xc 0x1
135
136 /* IDSEL 17 - PMC Slot 2 */
137 0x8800 0x0 0x0 0x1 &mpic 0xc 0x1
138 0x8800 0x0 0x0 0x2 &mpic 0x9 0x1
139 0x8800 0x0 0x0 0x3 &mpic 0xa 0x1
140 0x8800 0x0 0x0 0x4 &mpic 0xb 0x1
141
142 /* IDSEL 18 - Not Used */
143
144 /* IDSEL 19 - ENET 2 */
145 0x9800 0x0 0x0 0x1 &mpic 0xd 0x1
146
147 /* IDSEL 20 - PMCSPAN (PCI-X) */
148 0xa000 0x0 0x0 0x1 &mpic 0x9 0x1
149 0xa000 0x0 0x0 0x2 &mpic 0xa 0x1
150 0xa000 0x0 0x0 0x3 &mpic 0xb 0x1
151 0xa000 0x0 0x0 0x4 &mpic 0xc 0x1
152
153 >;
154
155 isa {
156 #address-cells = <2>;
157 #size-cells = <1>;
158 #interrupt-cells = <2>;
159 device_type = "isa";
160 compatible = "isa";
161 ranges = <0x00000001 0 0x01000000 0 0x00000000 0x00001000>;
162 interrupt-parent = <&i8259>;
163
164 i8259: interrupt-controller@20 {
165 #interrupt-cells = <2>;
166 #address-cells = <0>;
167 interrupts = <0 2>;
168 device_type = "interrupt-controller";
169 compatible = "chrp,iic";
170 interrupt-controller;
171 reg = <1 0x00000020 0x00000002
172 1 0x000000a0 0x00000002
173 1 0x000004d0 0x00000002>;
174 interrupt-parent = <&mpic>;
175 };
176
177 };
178
179 };
180
181 chosen {
182 linux,stdout-path = &serial0;
183 };
184
185};
diff --git a/arch/powerpc/boot/dts/p1010rdb-pa.dts b/arch/powerpc/boot/dts/p1010rdb-pa.dts
new file mode 100644
index 000000000000..767d4c032857
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb-pa.dts
@@ -0,0 +1,23 @@
1/*
2 * P1010 RDB Device Tree Source
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/ "fsl/p1010si-pre.dtsi"
13
14/ {
15 model = "fsl,P1010RDB";
16 compatible = "fsl,P1010RDB";
17
18 /include/ "p1010rdb_32b.dtsi"
19};
20
21/include/ "p1010rdb.dtsi"
22/include/ "p1010rdb-pa.dtsi"
23/include/ "fsl/p1010si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1010rdb-pa.dtsi b/arch/powerpc/boot/dts/p1010rdb-pa.dtsi
new file mode 100644
index 000000000000..434fb2d58575
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb-pa.dtsi
@@ -0,0 +1,85 @@
1/*
2 * P1010 RDB Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&ifc_nand {
36 partition@0 {
37 /* This location must not be altered */
38 /* 1MB for u-boot Bootloader Image */
39 reg = <0x0 0x00100000>;
40 label = "NAND U-Boot Image";
41 read-only;
42 };
43
44 partition@100000 {
45 /* 1MB for DTB Image */
46 reg = <0x00100000 0x00100000>;
47 label = "NAND DTB Image";
48 };
49
50 partition@200000 {
51 /* 4MB for Linux Kernel Image */
52 reg = <0x00200000 0x00400000>;
53 label = "NAND Linux Kernel Image";
54 };
55
56 partition@600000 {
57 /* 4MB for Compressed Root file System Image */
58 reg = <0x00600000 0x00400000>;
59 label = "NAND Compressed RFS Image";
60 };
61
62 partition@a00000 {
63 /* 15MB for JFFS2 based Root file System */
64 reg = <0x00a00000 0x00f00000>;
65 label = "NAND JFFS2 Root File System";
66 };
67
68 partition@1900000 {
69 /* 7MB for User Area */
70 reg = <0x01900000 0x00700000>;
71 label = "NAND User area";
72 };
73};
74
75&phy0 {
76 interrupts = <1 1 0 0>;
77};
78
79&phy1 {
80 interrupts = <2 1 0 0>;
81};
82
83&phy2 {
84 interrupts = <4 1 0 0>;
85};
diff --git a/arch/powerpc/boot/dts/p1010rdb_36b.dts b/arch/powerpc/boot/dts/p1010rdb-pa_36b.dts
index 64776f4a4651..3033371bc007 100644
--- a/arch/powerpc/boot/dts/p1010rdb_36b.dts
+++ b/arch/powerpc/boot/dts/p1010rdb-pa_36b.dts
@@ -38,52 +38,9 @@
38 model = "fsl,P1010RDB"; 38 model = "fsl,P1010RDB";
39 compatible = "fsl,P1010RDB"; 39 compatible = "fsl,P1010RDB";
40 40
41 memory { 41 /include/ "p1010rdb_36b.dtsi"
42 device_type = "memory";
43 };
44
45 board_ifc: ifc: ifc@fffe1e000 {
46 /* NOR, NAND Flashes and CPLD on board */
47 ranges = <0x0 0x0 0xf 0xee000000 0x02000000
48 0x1 0x0 0xf 0xff800000 0x00010000
49 0x3 0x0 0xf 0xffb00000 0x00000020>;
50 reg = <0xf 0xffe1e000 0 0x2000>;
51 };
52
53 board_soc: soc: soc@fffe00000 {
54 ranges = <0x0 0xf 0xffe00000 0x100000>;
55 };
56
57 pci0: pcie@fffe09000 {
58 reg = <0xf 0xffe09000 0 0x1000>;
59 ranges = <0x2000000 0x0 0xc0000000 0xc 0x20000000 0x0 0x20000000
60 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
61 pcie@0 {
62 ranges = <0x2000000 0x0 0xc0000000
63 0x2000000 0x0 0xc0000000
64 0x0 0x20000000
65
66 0x1000000 0x0 0x0
67 0x1000000 0x0 0x0
68 0x0 0x100000>;
69 };
70 };
71
72 pci1: pcie@fffe0a000 {
73 reg = <0xf 0xffe0a000 0 0x1000>;
74 ranges = <0x2000000 0x0 0xc0000000 0xc 0x20000000 0x0 0x20000000
75 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
76 pcie@0 {
77 ranges = <0x2000000 0x0 0xc0000000
78 0x2000000 0x0 0xc0000000
79 0x0 0x20000000
80
81 0x1000000 0x0 0x0
82 0x1000000 0x0 0x0
83 0x0 0x100000>;
84 };
85 };
86}; 42};
87 43
88/include/ "p1010rdb.dtsi" 44/include/ "p1010rdb.dtsi"
45/include/ "p1010rdb-pa.dtsi"
89/include/ "fsl/p1010si-post.dtsi" 46/include/ "fsl/p1010si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1010rdb-pb.dts b/arch/powerpc/boot/dts/p1010rdb-pb.dts
new file mode 100644
index 000000000000..6eeb7d3185be
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb-pb.dts
@@ -0,0 +1,35 @@
1/*
2 * P1010 RDB Device Tree Source
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/ "fsl/p1010si-pre.dtsi"
13
14/ {
15 model = "fsl,P1010RDB-PB";
16 compatible = "fsl,P1010RDB-PB";
17
18 /include/ "p1010rdb_32b.dtsi"
19};
20
21/include/ "p1010rdb.dtsi"
22
23&phy0 {
24 interrupts = <0 1 0 0>;
25};
26
27&phy1 {
28 interrupts = <2 1 0 0>;
29};
30
31&phy2 {
32 interrupts = <1 1 0 0>;
33};
34
35/include/ "fsl/p1010si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1010rdb-pb_36b.dts b/arch/powerpc/boot/dts/p1010rdb-pb_36b.dts
new file mode 100644
index 000000000000..7ab3c907b326
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb-pb_36b.dts
@@ -0,0 +1,58 @@
1/*
2 * P1010 RDB Device Tree Source (36-bit address map)
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1010si-pre.dtsi"
36
37/ {
38 model = "fsl,P1010RDB-PB";
39 compatible = "fsl,P1010RDB-PB";
40
41 /include/ "p1010rdb_36b.dtsi"
42};
43
44/include/ "p1010rdb.dtsi"
45
46&phy0 {
47 interrupts = <0 1 0 0>;
48};
49
50&phy1 {
51 interrupts = <2 1 0 0>;
52};
53
54&phy2 {
55 interrupts = <1 1 0 0>;
56};
57
58/include/ "fsl/p1010si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1010rdb.dts b/arch/powerpc/boot/dts/p1010rdb.dts
deleted file mode 100644
index b868d22984e9..000000000000
--- a/arch/powerpc/boot/dts/p1010rdb.dts
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * P1010 RDB Device Tree Source
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/ "fsl/p1010si-pre.dtsi"
13
14/ {
15 model = "fsl,P1010RDB";
16 compatible = "fsl,P1010RDB";
17
18 memory {
19 device_type = "memory";
20 };
21
22 board_ifc: ifc: ifc@ffe1e000 {
23 /* NOR, NAND Flashes and CPLD on board */
24 ranges = <0x0 0x0 0x0 0xee000000 0x02000000
25 0x1 0x0 0x0 0xff800000 0x00010000
26 0x3 0x0 0x0 0xffb00000 0x00000020>;
27 reg = <0x0 0xffe1e000 0 0x2000>;
28 };
29
30 board_soc: soc: soc@ffe00000 {
31 ranges = <0x0 0x0 0xffe00000 0x100000>;
32 };
33
34 pci0: pcie@ffe09000 {
35 reg = <0 0xffe09000 0 0x1000>;
36 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
37 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
38 pcie@0 {
39 ranges = <0x2000000 0x0 0xa0000000
40 0x2000000 0x0 0xa0000000
41 0x0 0x20000000
42
43 0x1000000 0x0 0x0
44 0x1000000 0x0 0x0
45 0x0 0x100000>;
46 };
47 };
48
49 pci1: pcie@ffe0a000 {
50 reg = <0 0xffe0a000 0 0x1000>;
51 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
52 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
53 pcie@0 {
54 ranges = <0x2000000 0x0 0x80000000
55 0x2000000 0x0 0x80000000
56 0x0 0x20000000
57
58 0x1000000 0x0 0x0
59 0x1000000 0x0 0x0
60 0x0 0x100000>;
61 };
62 };
63};
64
65/include/ "p1010rdb.dtsi"
66/include/ "fsl/p1010si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1010rdb.dtsi b/arch/powerpc/boot/dts/p1010rdb.dtsi
index ec7c27a64671..ea534efa790d 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dtsi
+++ b/arch/powerpc/boot/dts/p1010rdb.dtsi
@@ -69,49 +69,11 @@
69 }; 69 };
70 }; 70 };
71 71
72 nand@1,0 { 72 ifc_nand: nand@1,0 {
73 #address-cells = <1>; 73 #address-cells = <1>;
74 #size-cells = <1>; 74 #size-cells = <1>;
75 compatible = "fsl,ifc-nand"; 75 compatible = "fsl,ifc-nand";
76 reg = <0x1 0x0 0x10000>; 76 reg = <0x1 0x0 0x10000>;
77
78 partition@0 {
79 /* This location must not be altered */
80 /* 1MB for u-boot Bootloader Image */
81 reg = <0x0 0x00100000>;
82 label = "NAND U-Boot Image";
83 read-only;
84 };
85
86 partition@100000 {
87 /* 1MB for DTB Image */
88 reg = <0x00100000 0x00100000>;
89 label = "NAND DTB Image";
90 };
91
92 partition@200000 {
93 /* 4MB for Linux Kernel Image */
94 reg = <0x00200000 0x00400000>;
95 label = "NAND Linux Kernel Image";
96 };
97
98 partition@600000 {
99 /* 4MB for Compressed Root file System Image */
100 reg = <0x00600000 0x00400000>;
101 label = "NAND Compressed RFS Image";
102 };
103
104 partition@a00000 {
105 /* 15MB for JFFS2 based Root file System */
106 reg = <0x00a00000 0x00f00000>;
107 label = "NAND JFFS2 Root File System";
108 };
109
110 partition@1900000 {
111 /* 7MB for User Area */
112 reg = <0x01900000 0x00700000>;
113 label = "NAND User area";
114 };
115 }; 77 };
116 78
117 cpld@3,0 { 79 cpld@3,0 {
@@ -193,17 +155,14 @@
193 155
194 mdio@24000 { 156 mdio@24000 {
195 phy0: ethernet-phy@0 { 157 phy0: ethernet-phy@0 {
196 interrupts = <3 1 0 0>;
197 reg = <0x1>; 158 reg = <0x1>;
198 }; 159 };
199 160
200 phy1: ethernet-phy@1 { 161 phy1: ethernet-phy@1 {
201 interrupts = <2 1 0 0>;
202 reg = <0x0>; 162 reg = <0x0>;
203 }; 163 };
204 164
205 phy2: ethernet-phy@2 { 165 phy2: ethernet-phy@2 {
206 interrupts = <2 1 0 0>;
207 reg = <0x2>; 166 reg = <0x2>;
208 }; 167 };
209 168
diff --git a/arch/powerpc/boot/dts/p1010rdb_32b.dtsi b/arch/powerpc/boot/dts/p1010rdb_32b.dtsi
new file mode 100644
index 000000000000..fdc19aab2f70
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb_32b.dtsi
@@ -0,0 +1,79 @@
1/*
2 * P1010 RDB Device Tree Source stub (no addresses or top-level ranges)
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
35memory {
36 device_type = "memory";
37};
38
39board_ifc: ifc: ifc@ffe1e000 {
40 /* NOR, NAND Flashes and CPLD on board */
41 ranges = <0x0 0x0 0x0 0xee000000 0x02000000
42 0x1 0x0 0x0 0xff800000 0x00010000
43 0x3 0x0 0x0 0xffb00000 0x00000020>;
44 reg = <0x0 0xffe1e000 0 0x2000>;
45};
46
47board_soc: soc: soc@ffe00000 {
48 ranges = <0x0 0x0 0xffe00000 0x100000>;
49};
50
51pci0: pcie@ffe09000 {
52 reg = <0 0xffe09000 0 0x1000>;
53 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
54 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
55 pcie@0 {
56 ranges = <0x2000000 0x0 0xa0000000
57 0x2000000 0x0 0xa0000000
58 0x0 0x20000000
59
60 0x1000000 0x0 0x0
61 0x1000000 0x0 0x0
62 0x0 0x100000>;
63 };
64};
65
66pci1: pcie@ffe0a000 {
67 reg = <0 0xffe0a000 0 0x1000>;
68 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
69 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
70 pcie@0 {
71 ranges = <0x2000000 0x0 0x80000000
72 0x2000000 0x0 0x80000000
73 0x0 0x20000000
74
75 0x1000000 0x0 0x0
76 0x1000000 0x0 0x0
77 0x0 0x100000>;
78 };
79};
diff --git a/arch/powerpc/boot/dts/p1010rdb_36b.dtsi b/arch/powerpc/boot/dts/p1010rdb_36b.dtsi
new file mode 100644
index 000000000000..de2fceed4f79
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1010rdb_36b.dtsi
@@ -0,0 +1,79 @@
1/*
2 * P1010 RDB Device Tree Source stub (no addresses or top-level ranges)
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
35memory {
36 device_type = "memory";
37};
38
39board_ifc: ifc: ifc@fffe1e000 {
40 /* NOR, NAND Flashes and CPLD on board */
41 ranges = <0x0 0x0 0xf 0xee000000 0x02000000
42 0x1 0x0 0xf 0xff800000 0x00010000
43 0x3 0x0 0xf 0xffb00000 0x00000020>;
44 reg = <0xf 0xffe1e000 0 0x2000>;
45};
46
47board_soc: soc: soc@fffe00000 {
48 ranges = <0x0 0xf 0xffe00000 0x100000>;
49};
50
51pci0: pcie@fffe09000 {
52 reg = <0xf 0xffe09000 0 0x1000>;
53 ranges = <0x2000000 0x0 0xc0000000 0xc 0x20000000 0x0 0x20000000
54 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
55 pcie@0 {
56 ranges = <0x2000000 0x0 0xc0000000
57 0x2000000 0x0 0xc0000000
58 0x0 0x20000000
59
60 0x1000000 0x0 0x0
61 0x1000000 0x0 0x0
62 0x0 0x100000>;
63 };
64};
65
66pci1: pcie@fffe0a000 {
67 reg = <0xf 0xffe0a000 0 0x1000>;
68 ranges = <0x2000000 0x0 0xc0000000 0xc 0x20000000 0x0 0x20000000
69 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
70 pcie@0 {
71 ranges = <0x2000000 0x0 0xc0000000
72 0x2000000 0x0 0xc0000000
73 0x0 0x20000000
74
75 0x1000000 0x0 0x0
76 0x1000000 0x0 0x0
77 0x0 0x100000>;
78 };
79};
diff --git a/arch/powerpc/boot/dts/p1021mds.dts b/arch/powerpc/boot/dts/p1021mds.dts
index 97116f198a37..76559044df41 100644
--- a/arch/powerpc/boot/dts/p1021mds.dts
+++ b/arch/powerpc/boot/dts/p1021mds.dts
@@ -295,13 +295,11 @@
295 interrupt-parent = <&mpic>; 295 interrupt-parent = <&mpic>;
296 interrupts = <4 1 0 0>; 296 interrupts = <4 1 0 0>;
297 reg = <0x0>; 297 reg = <0x0>;
298 device_type = "ethernet-phy";
299 }; 298 };
300 qe_phy1: ethernet-phy@03 { 299 qe_phy1: ethernet-phy@03 {
301 interrupt-parent = <&mpic>; 300 interrupt-parent = <&mpic>;
302 interrupts = <5 1 0 0>; 301 interrupts = <5 1 0 0>;
303 reg = <0x3>; 302 reg = <0x3>;
304 device_type = "ethernet-phy";
305 }; 303 };
306 tbi-phy@11 { 304 tbi-phy@11 {
307 reg = <0x11>; 305 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/p1022ds.dtsi b/arch/powerpc/boot/dts/p1022ds.dtsi
index 873da350d01b..957e0dc1dc0f 100644
--- a/arch/powerpc/boot/dts/p1022ds.dtsi
+++ b/arch/powerpc/boot/dts/p1022ds.dtsi
@@ -146,8 +146,9 @@
146 */ 146 */
147 }; 147 };
148 rtc@68 { 148 rtc@68 {
149 compatible = "dallas,ds1339"; 149 compatible = "dallas,ds3232";
150 reg = <0x68>; 150 reg = <0x68>;
151 interrupts = <0x1 0x1 0 0>;
151 }; 152 };
152 adt7461@4c { 153 adt7461@4c {
153 compatible = "adi,adt7461"; 154 compatible = "adi,adt7461";
diff --git a/arch/powerpc/boot/dts/p1025rdb_32b.dts b/arch/powerpc/boot/dts/p1025rdb_32b.dts
index ac5729c14eda..a2ed6280ba7a 100644
--- a/arch/powerpc/boot/dts/p1025rdb_32b.dts
+++ b/arch/powerpc/boot/dts/p1025rdb_32b.dts
@@ -105,13 +105,11 @@
105 interrupt-parent = <&mpic>; 105 interrupt-parent = <&mpic>;
106 interrupts = <4 1 0 0>; 106 interrupts = <4 1 0 0>;
107 reg = <0x6>; 107 reg = <0x6>;
108 device_type = "ethernet-phy";
109 }; 108 };
110 qe_phy1: ethernet-phy@03 { 109 qe_phy1: ethernet-phy@03 {
111 interrupt-parent = <&mpic>; 110 interrupt-parent = <&mpic>;
112 interrupts = <5 1 0 0>; 111 interrupts = <5 1 0 0>;
113 reg = <0x3>; 112 reg = <0x3>;
114 device_type = "ethernet-phy";
115 }; 113 };
116 tbi-phy@11 { 114 tbi-phy@11 {
117 reg = <0x11>; 115 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/p1025twr.dts b/arch/powerpc/boot/dts/p1025twr.dts
new file mode 100644
index 000000000000..9036a4987905
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1025twr.dts
@@ -0,0 +1,95 @@
1/*
2 * P1025 TWR Device Tree Source (32-bit address map)
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/p1021si-pre.dtsi"
36/ {
37 model = "fsl,P1025";
38 compatible = "fsl,TWR-P1025";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@ffe05000 {
45 reg = <0 0xffe05000 0 0x1000>;
46
47 /* NOR Flash and SSD1289 */
48 ranges = <0x0 0x0 0x0 0xec000000 0x04000000
49 0x2 0x0 0x0 0xe0000000 0x00020000>;
50 };
51
52 soc: soc@ffe00000 {
53 ranges = <0x0 0x0 0xffe00000 0x100000>;
54 };
55
56 pci0: pcie@ffe09000 {
57 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
58 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
59 reg = <0 0xffe09000 0 0x1000>;
60 pcie@0 {
61 ranges = <0x2000000 0x0 0xa0000000
62 0x2000000 0x0 0xa0000000
63 0x0 0x20000000
64
65 0x1000000 0x0 0x0
66 0x1000000 0x0 0x0
67 0x0 0x100000>;
68 };
69 };
70
71 pci1: pcie@ffe0a000 {
72 reg = <0 0xffe0a000 0 0x1000>;
73 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
74 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
75 pcie@0 {
76 ranges = <0x2000000 0x0 0x80000000
77 0x2000000 0x0 0x80000000
78 0x0 0x20000000
79
80 0x1000000 0x0 0x0
81 0x1000000 0x0 0x0
82 0x0 0x100000>;
83 };
84 };
85
86 qe: qe@ffe80000 {
87 ranges = <0x0 0x0 0xffe80000 0x40000>;
88 reg = <0 0xffe80000 0 0x480>;
89 brg-frequency = <0>;
90 bus-frequency = <0>;
91 };
92};
93
94/include/ "p1025twr.dtsi"
95/include/ "fsl/p1021si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1025twr.dtsi b/arch/powerpc/boot/dts/p1025twr.dtsi
new file mode 100644
index 000000000000..8453501c256e
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1025twr.dtsi
@@ -0,0 +1,280 @@
1/*
2 * P1025 TWR Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/{
36 aliases {
37 ethernet3 = &enet3;
38 ethernet4 = &enet4;
39 };
40};
41
42&lbc {
43 nor@0,0 {
44 #address-cells = <1>;
45 #size-cells = <1>;
46 compatible = "cfi-flash";
47 reg = <0x0 0x0 0x4000000>;
48 bank-width = <2>;
49 device-width = <1>;
50
51 partition@0 {
52 /* This location must not be altered */
53 /* 256KB for Vitesse 7385 Switch firmware */
54 reg = <0x0 0x00040000>;
55 label = "NOR Vitesse-7385 Firmware";
56 read-only;
57 };
58
59 partition@40000 {
60 /* 256KB for DTB Image */
61 reg = <0x00040000 0x00040000>;
62 label = "NOR DTB Image";
63 };
64
65 partition@80000 {
66 /* 5.5 MB for Linux Kernel Image */
67 reg = <0x00080000 0x00580000>;
68 label = "NOR Linux Kernel Image";
69 };
70
71 partition@400000 {
72 /* 56.75MB for Root file System */
73 reg = <0x00600000 0x038c0000>;
74 label = "NOR Root File System";
75 };
76
77 partition@ec0000 {
78 /* This location must not be altered */
79 /* 256KB for QE ucode firmware*/
80 reg = <0x03ec0000 0x00040000>;
81 label = "NOR QE microcode firmware";
82 read-only;
83 };
84
85 partition@f00000 {
86 /* This location must not be altered */
87 /* 512KB for u-boot Bootloader Image */
88 /* 512KB for u-boot Environment Variables */
89 reg = <0x03f00000 0x00100000>;
90 label = "NOR U-Boot Image";
91 read-only;
92 };
93 };
94
95 /* CS2 for Display */
96 display@2,0 {
97 compatible = "solomon,ssd1289fb";
98 reg = <0x2 0x0000 0x0004>;
99 };
100
101};
102
103&soc {
104 usb@22000 {
105 phy_type = "ulpi";
106 };
107
108 mdio@24000 {
109 phy0: ethernet-phy@2 {
110 interrupt-parent = <&mpic>;
111 interrupts = <1 1 0 0>;
112 reg = <0x2>;
113 };
114
115 phy1: ethernet-phy@1 {
116 interrupt-parent = <&mpic>;
117 interrupts = <2 1 0 0>;
118 reg = <0x1>;
119 };
120
121 tbi0: tbi-phy@11 {
122 reg = <0x11>;
123 device_type = "tbi-phy";
124 };
125 };
126
127 mdio@25000 {
128 tbi1: tbi-phy@11 {
129 reg = <0x11>;
130 device_type = "tbi-phy";
131 };
132 };
133
134 mdio@26000 {
135 tbi2: tbi-phy@11 {
136 reg = <0x11>;
137 device_type = "tbi-phy";
138 };
139 };
140
141 enet0: ethernet@b0000 {
142 phy-handle = <&phy0>;
143 phy-connection-type = "rgmii-id";
144
145 };
146
147 enet1: ethernet@b1000 {
148 status = "disabled";
149 };
150
151 enet2: ethernet@b2000 {
152 phy-handle = <&phy1>;
153 phy-connection-type = "rgmii-id";
154 };
155
156 par_io@e0100 {
157 #address-cells = <1>;
158 #size-cells = <1>;
159 reg = <0xe0100 0x60>;
160 ranges = <0x0 0xe0100 0x60>;
161 device_type = "par_io";
162 num-ports = <3>;
163 pio1: ucc_pin@01 {
164 pio-map = <
165 /* port pin dir open_drain assignment has_irq */
166 0x1 0x13 0x1 0x0 0x1 0x0 /* QE_MUX_MDC */
167 0x1 0x14 0x3 0x0 0x1 0x0 /* QE_MUX_MDIO */
168 0x0 0x17 0x2 0x0 0x2 0x0 /* CLK12 */
169 0x0 0x18 0x2 0x0 0x1 0x0 /* CLK9 */
170 0x0 0x7 0x1 0x0 0x2 0x0 /* ENET1_TXD0_SER1_TXD0 */
171 0x0 0x9 0x1 0x0 0x2 0x0 /* ENET1_TXD1_SER1_TXD1 */
172 0x0 0xb 0x1 0x0 0x2 0x0 /* ENET1_TXD2_SER1_TXD2 */
173 0x0 0xc 0x1 0x0 0x2 0x0 /* ENET1_TXD3_SER1_TXD3 */
174 0x0 0x6 0x2 0x0 0x2 0x0 /* ENET1_RXD0_SER1_RXD0 */
175 0x0 0xa 0x2 0x0 0x2 0x0 /* ENET1_RXD1_SER1_RXD1 */
176 0x0 0xe 0x2 0x0 0x2 0x0 /* ENET1_RXD2_SER1_RXD2 */
177 0x0 0xf 0x2 0x0 0x2 0x0 /* ENET1_RXD3_SER1_RXD3 */
178 0x0 0x5 0x1 0x0 0x2 0x0 /* ENET1_TX_EN_SER1_RTS_B */
179 0x0 0xd 0x1 0x0 0x2 0x0 /* ENET1_TX_ER */
180 0x0 0x4 0x2 0x0 0x2 0x0 /* ENET1_RX_DV_SER1_CTS_B */
181 0x0 0x8 0x2 0x0 0x2 0x0 /* ENET1_RX_ER_SER1_CD_B */
182 0x0 0x11 0x2 0x0 0x2 0x0 /* ENET1_CRS */
183 0x0 0x10 0x2 0x0 0x2 0x0>; /* ENET1_COL */
184 };
185
186 pio2: ucc_pin@02 {
187 pio-map = <
188 /* port pin dir open_drain assignment has_irq */
189 0x1 0x13 0x1 0x0 0x1 0x0 /* QE_MUX_MDC */
190 0x1 0x14 0x3 0x0 0x1 0x0 /* QE_MUX_MDIO */
191 0x1 0xb 0x2 0x0 0x1 0x0 /* CLK13 */
192 0x1 0x7 0x1 0x0 0x2 0x0 /* ENET5_TXD0_SER5_TXD0 */
193 0x1 0xa 0x1 0x0 0x2 0x0 /* ENET5_TXD1_SER5_TXD1 */
194 0x1 0x6 0x2 0x0 0x2 0x0 /* ENET5_RXD0_SER5_RXD0 */
195 0x1 0x9 0x2 0x0 0x2 0x0 /* ENET5_RXD1_SER5_RXD1 */
196 0x1 0x5 0x1 0x0 0x2 0x0 /* ENET5_TX_EN_SER5_RTS_B */
197 0x1 0x4 0x2 0x0 0x2 0x0 /* ENET5_RX_DV_SER5_CTS_B */
198 0x1 0x8 0x2 0x0 0x2 0x0>; /* ENET5_RX_ER_SER5_CD_B */
199 };
200
201 pio3: ucc_pin@03 {
202 pio-map = <
203 /* port pin dir open_drain assignment has_irq */
204 0x0 0x16 0x2 0x0 0x2 0x0 /* SER7_CD_B*/
205 0x0 0x12 0x2 0x0 0x2 0x0 /* SER7_CTS_B*/
206 0x0 0x13 0x1 0x0 0x2 0x0 /* SER7_RTS_B*/
207 0x0 0x14 0x2 0x0 0x2 0x0 /* SER7_RXD0*/
208 0x0 0x15 0x1 0x0 0x2 0x0>; /* SER7_TXD0*/
209 };
210
211 pio4: ucc_pin@04 {
212 pio-map = <
213 /* port pin dir open_drain assignment has_irq */
214 0x1 0x0 0x2 0x0 0x2 0x0 /* SER3_CD_B*/
215 0x0 0x1c 0x2 0x0 0x2 0x0 /* SER3_CTS_B*/
216 0x0 0x1d 0x1 0x0 0x2 0x0 /* SER3_RTS_B*/
217 0x0 0x1e 0x2 0x0 0x2 0x0 /* SER3_RXD0*/
218 0x0 0x1f 0x1 0x0 0x2 0x0>; /* SER3_TXD0*/
219 };
220 };
221};
222
223&qe {
224 enet3: ucc@2000 {
225 device_type = "network";
226 compatible = "ucc_geth";
227 rx-clock-name = "clk12";
228 tx-clock-name = "clk9";
229 pio-handle = <&pio1>;
230 phy-handle = <&qe_phy0>;
231 phy-connection-type = "mii";
232 };
233
234 mdio@2120 {
235 qe_phy0: ethernet-phy@18 {
236 interrupt-parent = <&mpic>;
237 interrupts = <4 1 0 0>;
238 reg = <0x18>;
239 device_type = "ethernet-phy";
240 };
241 qe_phy1: ethernet-phy@19 {
242 interrupt-parent = <&mpic>;
243 interrupts = <5 1 0 0>;
244 reg = <0x19>;
245 device_type = "ethernet-phy";
246 };
247 tbi-phy@11 {
248 reg = <0x11>;
249 device_type = "tbi-phy";
250 };
251 };
252
253 enet4: ucc@2400 {
254 device_type = "network";
255 compatible = "ucc_geth";
256 rx-clock-name = "none";
257 tx-clock-name = "clk13";
258 pio-handle = <&pio2>;
259 phy-handle = <&qe_phy1>;
260 phy-connection-type = "rmii";
261 };
262
263 serial2: ucc@2600 {
264 device_type = "serial";
265 compatible = "ucc_uart";
266 port-number = <0>;
267 rx-clock-name = "brg6";
268 tx-clock-name = "brg6";
269 pio-handle = <&pio3>;
270 };
271
272 serial3: ucc@2200 {
273 device_type = "serial";
274 compatible = "ucc_uart";
275 port-number = <1>;
276 rx-clock-name = "brg2";
277 tx-clock-name = "brg2";
278 pio-handle = <&pio4>;
279 };
280};
diff --git a/arch/powerpc/boot/dts/ppa8548.dts b/arch/powerpc/boot/dts/ppa8548.dts
index f97eceed610a..27b0699ee923 100644
--- a/arch/powerpc/boot/dts/ppa8548.dts
+++ b/arch/powerpc/boot/dts/ppa8548.dts
@@ -110,12 +110,10 @@
110 phy0: ethernet-phy@0 { 110 phy0: ethernet-phy@0 {
111 interrupts = <7 1 0 0>; 111 interrupts = <7 1 0 0>;
112 reg = <0x0>; 112 reg = <0x0>;
113 device_type = "ethernet-phy";
114 }; 113 };
115 phy1: ethernet-phy@1 { 114 phy1: ethernet-phy@1 {
116 interrupts = <8 1 0 0>; 115 interrupts = <8 1 0 0>;
117 reg = <0x1>; 116 reg = <0x1>;
118 device_type = "ethernet-phy";
119 }; 117 };
120 tbi0: tbi-phy@11 { 118 tbi0: tbi-phy@11 {
121 reg = <0x11>; 119 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/pq2fads.dts b/arch/powerpc/boot/dts/pq2fads.dts
index 0bb669376743..0c525ff0c257 100644
--- a/arch/powerpc/boot/dts/pq2fads.dts
+++ b/arch/powerpc/boot/dts/pq2fads.dts
@@ -198,7 +198,6 @@
198 }; 198 };
199 199
200 mdio@10d40 { 200 mdio@10d40 {
201 device_type = "mdio";
202 compatible = "fsl,pq2fads-mdio-bitbang", 201 compatible = "fsl,pq2fads-mdio-bitbang",
203 "fsl,mpc8280-mdio-bitbang", 202 "fsl,mpc8280-mdio-bitbang",
204 "fsl,cpm2-mdio-bitbang"; 203 "fsl,cpm2-mdio-bitbang";
@@ -212,14 +211,12 @@
212 interrupt-parent = <&PIC>; 211 interrupt-parent = <&PIC>;
213 interrupts = <25 2>; 212 interrupts = <25 2>;
214 reg = <0x0>; 213 reg = <0x0>;
215 device_type = "ethernet-phy";
216 }; 214 };
217 215
218 PHY1: ethernet-phy@1 { 216 PHY1: ethernet-phy@1 {
219 interrupt-parent = <&PIC>; 217 interrupt-parent = <&PIC>;
220 interrupts = <25 2>; 218 interrupts = <25 2>;
221 reg = <0x3>; 219 reg = <0x3>;
222 device_type = "ethernet-phy";
223 }; 220 };
224 }; 221 };
225 222
diff --git a/arch/powerpc/boot/dts/prpmc2800.dts b/arch/powerpc/boot/dts/prpmc2800.dts
index 1ee6ff43dd57..00afaacf8c8c 100644
--- a/arch/powerpc/boot/dts/prpmc2800.dts
+++ b/arch/powerpc/boot/dts/prpmc2800.dts
@@ -73,17 +73,14 @@
73 mdio { 73 mdio {
74 #address-cells = <1>; 74 #address-cells = <1>;
75 #size-cells = <0>; 75 #size-cells = <0>;
76 device_type = "mdio";
77 compatible = "marvell,mv64360-mdio"; 76 compatible = "marvell,mv64360-mdio";
78 PHY0: ethernet-phy@1 { 77 PHY0: ethernet-phy@1 {
79 device_type = "ethernet-phy";
80 compatible = "broadcom,bcm5421"; 78 compatible = "broadcom,bcm5421";
81 interrupts = <76>; /* GPP 12 */ 79 interrupts = <76>; /* GPP 12 */
82 interrupt-parent = <&PIC>; 80 interrupt-parent = <&PIC>;
83 reg = <1>; 81 reg = <1>;
84 }; 82 };
85 PHY1: ethernet-phy@3 { 83 PHY1: ethernet-phy@3 {
86 device_type = "ethernet-phy";
87 compatible = "broadcom,bcm5421"; 84 compatible = "broadcom,bcm5421";
88 interrupts = <76>; /* GPP 12 */ 85 interrupts = <76>; /* GPP 12 */
89 interrupt-parent = <&PIC>; 86 interrupt-parent = <&PIC>;
@@ -162,7 +159,6 @@
162 }; 159 };
163 160
164 MPSC0: mpsc@8000 { 161 MPSC0: mpsc@8000 {
165 device_type = "serial";
166 compatible = "marvell,mv64360-mpsc"; 162 compatible = "marvell,mv64360-mpsc";
167 reg = <0x8000 0x38>; 163 reg = <0x8000 0x38>;
168 virtual-reg = <0xf1008000>; 164 virtual-reg = <0xf1008000>;
@@ -177,7 +173,6 @@
177 }; 173 };
178 174
179 MPSC1: mpsc@9000 { 175 MPSC1: mpsc@9000 {
180 device_type = "serial";
181 compatible = "marvell,mv64360-mpsc"; 176 compatible = "marvell,mv64360-mpsc";
182 reg = <0x9000 0x38>; 177 reg = <0x9000 0x38>;
183 virtual-reg = <0xf1009000>; 178 virtual-reg = <0xf1009000>;
diff --git a/arch/powerpc/boot/dts/sbc8349.dts b/arch/powerpc/boot/dts/sbc8349.dts
index b1e45a8537a5..fc89e00b765c 100644
--- a/arch/powerpc/boot/dts/sbc8349.dts
+++ b/arch/powerpc/boot/dts/sbc8349.dts
@@ -173,14 +173,12 @@
173 interrupt-parent = <&ipic>; 173 interrupt-parent = <&ipic>;
174 interrupts = <20 0x8>; 174 interrupts = <20 0x8>;
175 reg = <0x19>; 175 reg = <0x19>;
176 device_type = "ethernet-phy";
177 }; 176 };
178 177
179 phy1: ethernet-phy@1a { 178 phy1: ethernet-phy@1a {
180 interrupt-parent = <&ipic>; 179 interrupt-parent = <&ipic>;
181 interrupts = <21 0x8>; 180 interrupts = <21 0x8>;
182 reg = <0x1a>; 181 reg = <0x1a>;
183 device_type = "ethernet-phy";
184 }; 182 };
185 183
186 tbi0: tbi-phy@11 { 184 tbi0: tbi-phy@11 {
diff --git a/arch/powerpc/boot/dts/sbc8548-post.dtsi b/arch/powerpc/boot/dts/sbc8548-post.dtsi
index 33a47e27a11e..9b505c8e5350 100644
--- a/arch/powerpc/boot/dts/sbc8548-post.dtsi
+++ b/arch/powerpc/boot/dts/sbc8548-post.dtsi
@@ -137,13 +137,11 @@
137 interrupt-parent = <&mpic>; 137 interrupt-parent = <&mpic>;
138 interrupts = <0x6 0x1>; 138 interrupts = <0x6 0x1>;
139 reg = <0x19>; 139 reg = <0x19>;
140 device_type = "ethernet-phy";
141 }; 140 };
142 phy1: ethernet-phy@1a { 141 phy1: ethernet-phy@1a {
143 interrupt-parent = <&mpic>; 142 interrupt-parent = <&mpic>;
144 interrupts = <0x7 0x1>; 143 interrupts = <0x7 0x1>;
145 reg = <0x1a>; 144 reg = <0x1a>;
146 device_type = "ethernet-phy";
147 }; 145 };
148 tbi0: tbi-phy@11 { 146 tbi0: tbi-phy@11 {
149 reg = <0x11>; 147 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/sbc8641d.dts b/arch/powerpc/boot/dts/sbc8641d.dts
index 56bebce87842..631ede72e226 100644
--- a/arch/powerpc/boot/dts/sbc8641d.dts
+++ b/arch/powerpc/boot/dts/sbc8641d.dts
@@ -230,25 +230,21 @@
230 interrupt-parent = <&mpic>; 230 interrupt-parent = <&mpic>;
231 interrupts = <10 1>; 231 interrupts = <10 1>;
232 reg = <0x1f>; 232 reg = <0x1f>;
233 device_type = "ethernet-phy";
234 }; 233 };
235 phy1: ethernet-phy@0 { 234 phy1: ethernet-phy@0 {
236 interrupt-parent = <&mpic>; 235 interrupt-parent = <&mpic>;
237 interrupts = <10 1>; 236 interrupts = <10 1>;
238 reg = <0>; 237 reg = <0>;
239 device_type = "ethernet-phy";
240 }; 238 };
241 phy2: ethernet-phy@1 { 239 phy2: ethernet-phy@1 {
242 interrupt-parent = <&mpic>; 240 interrupt-parent = <&mpic>;
243 interrupts = <10 1>; 241 interrupts = <10 1>;
244 reg = <1>; 242 reg = <1>;
245 device_type = "ethernet-phy";
246 }; 243 };
247 phy3: ethernet-phy@2 { 244 phy3: ethernet-phy@2 {
248 interrupt-parent = <&mpic>; 245 interrupt-parent = <&mpic>;
249 interrupts = <10 1>; 246 interrupts = <10 1>;
250 reg = <2>; 247 reg = <2>;
251 device_type = "ethernet-phy";
252 }; 248 };
253 tbi0: tbi-phy@11 { 249 tbi0: tbi-phy@11 {
254 reg = <0x11>; 250 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/stx_gp3_8560.dts b/arch/powerpc/boot/dts/stx_gp3_8560.dts
index b670d03fbcd9..78a72ee48205 100644
--- a/arch/powerpc/boot/dts/stx_gp3_8560.dts
+++ b/arch/powerpc/boot/dts/stx_gp3_8560.dts
@@ -161,13 +161,11 @@
161 interrupt-parent = <&mpic>; 161 interrupt-parent = <&mpic>;
162 interrupts = <5 4>; 162 interrupts = <5 4>;
163 reg = <2>; 163 reg = <2>;
164 device_type = "ethernet-phy";
165 }; 164 };
166 phy4: ethernet-phy@4 { 165 phy4: ethernet-phy@4 {
167 interrupt-parent = <&mpic>; 166 interrupt-parent = <&mpic>;
168 interrupts = <5 4>; 167 interrupts = <5 4>;
169 reg = <4>; 168 reg = <4>;
170 device_type = "ethernet-phy";
171 }; 169 };
172 tbi0: tbi-phy@11 { 170 tbi0: tbi-phy@11 {
173 reg = <0x11>; 171 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/stxssa8555.dts b/arch/powerpc/boot/dts/stxssa8555.dts
index 4f166b01c1b6..859f854ba538 100644
--- a/arch/powerpc/boot/dts/stxssa8555.dts
+++ b/arch/powerpc/boot/dts/stxssa8555.dts
@@ -164,13 +164,11 @@
164 interrupt-parent = <&mpic>; 164 interrupt-parent = <&mpic>;
165 interrupts = <5 1>; 165 interrupts = <5 1>;
166 reg = <0x2>; 166 reg = <0x2>;
167 device_type = "ethernet-phy";
168 }; 167 };
169 phy1: ethernet-phy@4 { 168 phy1: ethernet-phy@4 {
170 interrupt-parent = <&mpic>; 169 interrupt-parent = <&mpic>;
171 interrupts = <5 1>; 170 interrupts = <5 1>;
172 reg = <0x4>; 171 reg = <0x4>;
173 device_type = "ethernet-phy";
174 }; 172 };
175 tbi0: tbi-phy@11 { 173 tbi0: tbi-phy@11 {
176 reg = <0x11>; 174 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/tqm8540.dts b/arch/powerpc/boot/dts/tqm8540.dts
index ed264d9ae356..91cbd7acd276 100644
--- a/arch/powerpc/boot/dts/tqm8540.dts
+++ b/arch/powerpc/boot/dts/tqm8540.dts
@@ -172,19 +172,16 @@
172 interrupt-parent = <&mpic>; 172 interrupt-parent = <&mpic>;
173 interrupts = <8 1>; 173 interrupts = <8 1>;
174 reg = <1>; 174 reg = <1>;
175 device_type = "ethernet-phy";
176 }; 175 };
177 phy2: ethernet-phy@2 { 176 phy2: ethernet-phy@2 {
178 interrupt-parent = <&mpic>; 177 interrupt-parent = <&mpic>;
179 interrupts = <8 1>; 178 interrupts = <8 1>;
180 reg = <2>; 179 reg = <2>;
181 device_type = "ethernet-phy";
182 }; 180 };
183 phy3: ethernet-phy@3 { 181 phy3: ethernet-phy@3 {
184 interrupt-parent = <&mpic>; 182 interrupt-parent = <&mpic>;
185 interrupts = <8 1>; 183 interrupts = <8 1>;
186 reg = <3>; 184 reg = <3>;
187 device_type = "ethernet-phy";
188 }; 185 };
189 tbi0: tbi-phy@11 { 186 tbi0: tbi-phy@11 {
190 reg = <0x11>; 187 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/tqm8541.dts b/arch/powerpc/boot/dts/tqm8541.dts
index 925242115814..84dce2d5fc48 100644
--- a/arch/powerpc/boot/dts/tqm8541.dts
+++ b/arch/powerpc/boot/dts/tqm8541.dts
@@ -172,19 +172,16 @@
172 interrupt-parent = <&mpic>; 172 interrupt-parent = <&mpic>;
173 interrupts = <8 1>; 173 interrupts = <8 1>;
174 reg = <1>; 174 reg = <1>;
175 device_type = "ethernet-phy";
176 }; 175 };
177 phy2: ethernet-phy@2 { 176 phy2: ethernet-phy@2 {
178 interrupt-parent = <&mpic>; 177 interrupt-parent = <&mpic>;
179 interrupts = <8 1>; 178 interrupts = <8 1>;
180 reg = <2>; 179 reg = <2>;
181 device_type = "ethernet-phy";
182 }; 180 };
183 phy3: ethernet-phy@3 { 181 phy3: ethernet-phy@3 {
184 interrupt-parent = <&mpic>; 182 interrupt-parent = <&mpic>;
185 interrupts = <8 1>; 183 interrupts = <8 1>;
186 reg = <3>; 184 reg = <3>;
187 device_type = "ethernet-phy";
188 }; 185 };
189 tbi0: tbi-phy@11 { 186 tbi0: tbi-phy@11 {
190 reg = <0x11>; 187 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/tqm8548-bigflash.dts b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
index 6e1ac50852a4..7a333dd02d9c 100644
--- a/arch/powerpc/boot/dts/tqm8548-bigflash.dts
+++ b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
@@ -185,31 +185,26 @@
185 interrupt-parent = <&mpic>; 185 interrupt-parent = <&mpic>;
186 interrupts = <8 1>; 186 interrupts = <8 1>;
187 reg = <1>; 187 reg = <1>;
188 device_type = "ethernet-phy";
189 }; 188 };
190 phy2: ethernet-phy@1 { 189 phy2: ethernet-phy@1 {
191 interrupt-parent = <&mpic>; 190 interrupt-parent = <&mpic>;
192 interrupts = <8 1>; 191 interrupts = <8 1>;
193 reg = <2>; 192 reg = <2>;
194 device_type = "ethernet-phy";
195 }; 193 };
196 phy3: ethernet-phy@3 { 194 phy3: ethernet-phy@3 {
197 interrupt-parent = <&mpic>; 195 interrupt-parent = <&mpic>;
198 interrupts = <8 1>; 196 interrupts = <8 1>;
199 reg = <3>; 197 reg = <3>;
200 device_type = "ethernet-phy";
201 }; 198 };
202 phy4: ethernet-phy@4 { 199 phy4: ethernet-phy@4 {
203 interrupt-parent = <&mpic>; 200 interrupt-parent = <&mpic>;
204 interrupts = <8 1>; 201 interrupts = <8 1>;
205 reg = <4>; 202 reg = <4>;
206 device_type = "ethernet-phy";
207 }; 203 };
208 phy5: ethernet-phy@5 { 204 phy5: ethernet-phy@5 {
209 interrupt-parent = <&mpic>; 205 interrupt-parent = <&mpic>;
210 interrupts = <8 1>; 206 interrupts = <8 1>;
211 reg = <5>; 207 reg = <5>;
212 device_type = "ethernet-phy";
213 }; 208 };
214 tbi0: tbi-phy@11 { 209 tbi0: tbi-phy@11 {
215 reg = <0x11>; 210 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
index 161e75eac7f7..c737caff10c7 100644
--- a/arch/powerpc/boot/dts/tqm8548.dts
+++ b/arch/powerpc/boot/dts/tqm8548.dts
@@ -185,31 +185,26 @@
185 interrupt-parent = <&mpic>; 185 interrupt-parent = <&mpic>;
186 interrupts = <8 1>; 186 interrupts = <8 1>;
187 reg = <1>; 187 reg = <1>;
188 device_type = "ethernet-phy";
189 }; 188 };
190 phy2: ethernet-phy@1 { 189 phy2: ethernet-phy@1 {
191 interrupt-parent = <&mpic>; 190 interrupt-parent = <&mpic>;
192 interrupts = <8 1>; 191 interrupts = <8 1>;
193 reg = <2>; 192 reg = <2>;
194 device_type = "ethernet-phy";
195 }; 193 };
196 phy3: ethernet-phy@3 { 194 phy3: ethernet-phy@3 {
197 interrupt-parent = <&mpic>; 195 interrupt-parent = <&mpic>;
198 interrupts = <8 1>; 196 interrupts = <8 1>;
199 reg = <3>; 197 reg = <3>;
200 device_type = "ethernet-phy";
201 }; 198 };
202 phy4: ethernet-phy@4 { 199 phy4: ethernet-phy@4 {
203 interrupt-parent = <&mpic>; 200 interrupt-parent = <&mpic>;
204 interrupts = <8 1>; 201 interrupts = <8 1>;
205 reg = <4>; 202 reg = <4>;
206 device_type = "ethernet-phy";
207 }; 203 };
208 phy5: ethernet-phy@5 { 204 phy5: ethernet-phy@5 {
209 interrupt-parent = <&mpic>; 205 interrupt-parent = <&mpic>;
210 interrupts = <8 1>; 206 interrupts = <8 1>;
211 reg = <5>; 207 reg = <5>;
212 device_type = "ethernet-phy";
213 }; 208 };
214 tbi0: tbi-phy@11 { 209 tbi0: tbi-phy@11 {
215 reg = <0x11>; 210 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/tqm8555.dts b/arch/powerpc/boot/dts/tqm8555.dts
index aa6ff0d3dd9a..d0416a5cdddf 100644
--- a/arch/powerpc/boot/dts/tqm8555.dts
+++ b/arch/powerpc/boot/dts/tqm8555.dts
@@ -172,19 +172,16 @@
172 interrupt-parent = <&mpic>; 172 interrupt-parent = <&mpic>;
173 interrupts = <8 1>; 173 interrupts = <8 1>;
174 reg = <1>; 174 reg = <1>;
175 device_type = "ethernet-phy";
176 }; 175 };
177 phy2: ethernet-phy@2 { 176 phy2: ethernet-phy@2 {
178 interrupt-parent = <&mpic>; 177 interrupt-parent = <&mpic>;
179 interrupts = <8 1>; 178 interrupts = <8 1>;
180 reg = <2>; 179 reg = <2>;
181 device_type = "ethernet-phy";
182 }; 180 };
183 phy3: ethernet-phy@3 { 181 phy3: ethernet-phy@3 {
184 interrupt-parent = <&mpic>; 182 interrupt-parent = <&mpic>;
185 interrupts = <8 1>; 183 interrupts = <8 1>;
186 reg = <3>; 184 reg = <3>;
187 device_type = "ethernet-phy";
188 }; 185 };
189 tbi0: tbi-phy@11 { 186 tbi0: tbi-phy@11 {
190 reg = <0x11>; 187 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/tqm8560.dts b/arch/powerpc/boot/dts/tqm8560.dts
index 7665a16a8b9a..f9a11ebf736c 100644
--- a/arch/powerpc/boot/dts/tqm8560.dts
+++ b/arch/powerpc/boot/dts/tqm8560.dts
@@ -174,19 +174,16 @@
174 interrupt-parent = <&mpic>; 174 interrupt-parent = <&mpic>;
175 interrupts = <8 1>; 175 interrupts = <8 1>;
176 reg = <1>; 176 reg = <1>;
177 device_type = "ethernet-phy";
178 }; 177 };
179 phy2: ethernet-phy@2 { 178 phy2: ethernet-phy@2 {
180 interrupt-parent = <&mpic>; 179 interrupt-parent = <&mpic>;
181 interrupts = <8 1>; 180 interrupts = <8 1>;
182 reg = <2>; 181 reg = <2>;
183 device_type = "ethernet-phy";
184 }; 182 };
185 phy3: ethernet-phy@3 { 183 phy3: ethernet-phy@3 {
186 interrupt-parent = <&mpic>; 184 interrupt-parent = <&mpic>;
187 interrupts = <8 1>; 185 interrupts = <8 1>;
188 reg = <3>; 186 reg = <3>;
189 device_type = "ethernet-phy";
190 }; 187 };
191 tbi0: tbi-phy@11 { 188 tbi0: tbi-phy@11 {
192 reg = <0x11>; 189 reg = <0x11>;
diff --git a/arch/powerpc/boot/dts/tqm8xx.dts b/arch/powerpc/boot/dts/tqm8xx.dts
index c3dba2518d8c..3d1446b99c7e 100644
--- a/arch/powerpc/boot/dts/tqm8xx.dts
+++ b/arch/powerpc/boot/dts/tqm8xx.dts
@@ -107,7 +107,6 @@
107 #size-cells = <0>; 107 #size-cells = <0>;
108 PHY: ethernet-phy@f { 108 PHY: ethernet-phy@f {
109 reg = <0xf>; 109 reg = <0xf>;
110 device_type = "ethernet-phy";
111 }; 110 };
112 }; 111 };
113 112
diff --git a/arch/powerpc/boot/dts/virtex440-ml507.dts b/arch/powerpc/boot/dts/virtex440-ml507.dts
index fc7073bc547e..391a4e299783 100644
--- a/arch/powerpc/boot/dts/virtex440-ml507.dts
+++ b/arch/powerpc/boot/dts/virtex440-ml507.dts
@@ -257,6 +257,8 @@
257 #size-cells = <1>; 257 #size-cells = <1>;
258 compatible = "xlnx,compound"; 258 compatible = "xlnx,compound";
259 ethernet@81c00000 { 259 ethernet@81c00000 {
260 #address-cells = <1>;
261 #size-cells = <0>;
260 compatible = "xlnx,xps-ll-temac-1.01.b"; 262 compatible = "xlnx,xps-ll-temac-1.01.b";
261 device_type = "network"; 263 device_type = "network";
262 interrupt-parent = <&xps_intc_0>; 264 interrupt-parent = <&xps_intc_0>;
diff --git a/arch/powerpc/boot/mvme5100.c b/arch/powerpc/boot/mvme5100.c
new file mode 100644
index 000000000000..cb865f83c60b
--- /dev/null
+++ b/arch/powerpc/boot/mvme5100.c
@@ -0,0 +1,27 @@
1/*
2 * Motorola/Emerson MVME5100 with PPCBug firmware.
3 *
4 * Author: Stephen Chivers <schivers@csc.com>
5 *
6 * Copyright 2013 CSC Australia Pty. Ltd.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 */
13#include "types.h"
14#include "ops.h"
15#include "io.h"
16
17BSS_STACK(4096);
18
19void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
20{
21 u32 heapsize;
22
23 heapsize = 0x8000000 - (u32)_end; /* 128M */
24 simple_alloc_init(_end, heapsize, 32, 64);
25 fdt_init(_dtb_start);
26 serial_console_init();
27}
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 2e1af74a64be..d27a25518b01 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -265,6 +265,10 @@ epapr)
265 link_address='0x20000000' 265 link_address='0x20000000'
266 pie=-pie 266 pie=-pie
267 ;; 267 ;;
268mvme5100)
269 platformo="$object/fixed-head.o $object/mvme5100.o"
270 binary=y
271 ;;
268esac 272esac
269 273
270vmz="$tmpdir/`basename \"$kernel\"`.$ext" 274vmz="$tmpdir/`basename \"$kernel\"`.$ext"
diff --git a/arch/powerpc/configs/85xx/p1023_defconfig b/arch/powerpc/configs/85xx/p1023_defconfig
deleted file mode 100644
index b06d37da44f4..000000000000
--- a/arch/powerpc/configs/85xx/p1023_defconfig
+++ /dev/null
@@ -1,188 +0,0 @@
1CONFIG_PPC_85xx=y
2CONFIG_SMP=y
3CONFIG_NR_CPUS=2
4CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y
6CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_AUDIT=y
8CONFIG_NO_HZ=y
9CONFIG_HIGH_RES_TIMERS=y
10CONFIG_RCU_FANOUT=32
11CONFIG_IKCONFIG=y
12CONFIG_IKCONFIG_PROC=y
13CONFIG_LOG_BUF_SHIFT=14
14CONFIG_BLK_DEV_INITRD=y
15CONFIG_KALLSYMS_ALL=y
16CONFIG_EMBEDDED=y
17CONFIG_MODULES=y
18CONFIG_MODULE_UNLOAD=y
19CONFIG_MODULE_FORCE_UNLOAD=y
20CONFIG_MODVERSIONS=y
21# CONFIG_BLK_DEV_BSG is not set
22CONFIG_PARTITION_ADVANCED=y
23CONFIG_MAC_PARTITION=y
24CONFIG_PHYSICAL_START=0x00000000
25CONFIG_P1023_RDB=y
26CONFIG_P1023_RDS=y
27CONFIG_QUICC_ENGINE=y
28CONFIG_QE_GPIO=y
29CONFIG_CPM2=y
30CONFIG_HIGHMEM=y
31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
32CONFIG_BINFMT_MISC=m
33CONFIG_MATH_EMULATION=y
34CONFIG_SWIOTLB=y
35CONFIG_PCI=y
36CONFIG_PCIEPORTBUS=y
37# CONFIG_PCIEAER is not set
38# CONFIG_PCIEASPM is not set
39CONFIG_PCI_MSI=y
40CONFIG_NET=y
41CONFIG_PACKET=y
42CONFIG_UNIX=y
43CONFIG_XFRM_USER=y
44CONFIG_NET_KEY=y
45CONFIG_INET=y
46CONFIG_IP_MULTICAST=y
47CONFIG_IP_ADVANCED_ROUTER=y
48CONFIG_IP_MULTIPLE_TABLES=y
49CONFIG_IP_ROUTE_MULTIPATH=y
50CONFIG_IP_ROUTE_VERBOSE=y
51CONFIG_IP_PNP=y
52CONFIG_IP_PNP_DHCP=y
53CONFIG_IP_PNP_BOOTP=y
54CONFIG_IP_PNP_RARP=y
55CONFIG_NET_IPIP=y
56CONFIG_IP_MROUTE=y
57CONFIG_IP_PIMSM_V1=y
58CONFIG_IP_PIMSM_V2=y
59CONFIG_ARPD=y
60CONFIG_INET_ESP=y
61# CONFIG_INET_XFRM_MODE_BEET is not set
62# CONFIG_INET_LRO is not set
63CONFIG_IPV6=y
64CONFIG_IP_SCTP=m
65CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
66CONFIG_DEVTMPFS=y
67CONFIG_DEVTMPFS_MOUNT=y
68CONFIG_MTD=y
69CONFIG_MTD_CMDLINE_PARTS=y
70CONFIG_MTD_CHAR=y
71CONFIG_MTD_BLOCK=y
72CONFIG_MTD_CFI=y
73CONFIG_MTD_CFI_AMDSTD=y
74CONFIG_MTD_PHYSMAP_OF=y
75CONFIG_MTD_NAND=y
76CONFIG_MTD_NAND_FSL_ELBC=y
77CONFIG_PROC_DEVICETREE=y
78CONFIG_BLK_DEV_LOOP=y
79CONFIG_BLK_DEV_RAM=y
80CONFIG_BLK_DEV_RAM_SIZE=131072
81CONFIG_EEPROM_AT24=y
82CONFIG_EEPROM_LEGACY=y
83CONFIG_BLK_DEV_SD=y
84CONFIG_CHR_DEV_ST=y
85CONFIG_BLK_DEV_SR=y
86CONFIG_CHR_DEV_SG=y
87CONFIG_SCSI_MULTI_LUN=y
88CONFIG_SCSI_LOGGING=y
89CONFIG_ATA=y
90CONFIG_SATA_FSL=y
91CONFIG_SATA_SIL24=y
92CONFIG_NETDEVICES=y
93CONFIG_DUMMY=y
94CONFIG_FS_ENET=y
95CONFIG_FSL_PQ_MDIO=y
96CONFIG_E1000E=y
97CONFIG_PHYLIB=y
98CONFIG_AT803X_PHY=y
99CONFIG_MARVELL_PHY=y
100CONFIG_DAVICOM_PHY=y
101CONFIG_CICADA_PHY=y
102CONFIG_VITESSE_PHY=y
103CONFIG_FIXED_PHY=y
104CONFIG_INPUT_FF_MEMLESS=m
105# CONFIG_INPUT_MOUSEDEV is not set
106# CONFIG_INPUT_KEYBOARD is not set
107# CONFIG_INPUT_MOUSE is not set
108CONFIG_SERIO_LIBPS2=y
109CONFIG_SERIAL_8250=y
110CONFIG_SERIAL_8250_CONSOLE=y
111CONFIG_SERIAL_8250_NR_UARTS=2
112CONFIG_SERIAL_8250_RUNTIME_UARTS=2
113CONFIG_SERIAL_8250_EXTENDED=y
114CONFIG_SERIAL_8250_MANY_PORTS=y
115CONFIG_SERIAL_8250_SHARE_IRQ=y
116CONFIG_SERIAL_8250_DETECT_IRQ=y
117CONFIG_SERIAL_8250_RSA=y
118CONFIG_HW_RANDOM=y
119CONFIG_NVRAM=y
120CONFIG_I2C=y
121CONFIG_I2C_CHARDEV=y
122CONFIG_I2C_CPM=m
123CONFIG_I2C_MPC=y
124CONFIG_GPIO_MPC8XXX=y
125# CONFIG_HWMON is not set
126CONFIG_VIDEO_OUTPUT_CONTROL=y
127CONFIG_SOUND=y
128CONFIG_SND=y
129CONFIG_SND_MIXER_OSS=y
130CONFIG_SND_PCM_OSS=y
131# CONFIG_SND_SUPPORT_OLD_API is not set
132CONFIG_USB=y
133CONFIG_USB_DEVICEFS=y
134CONFIG_USB_MON=y
135CONFIG_USB_EHCI_HCD=y
136CONFIG_USB_EHCI_FSL=y
137CONFIG_USB_STORAGE=y
138CONFIG_EDAC=y
139CONFIG_EDAC_MM_EDAC=y
140CONFIG_RTC_CLASS=y
141CONFIG_RTC_DRV_DS1307=y
142CONFIG_RTC_DRV_CMOS=y
143CONFIG_DMADEVICES=y
144CONFIG_FSL_DMA=y
145# CONFIG_NET_DMA is not set
146CONFIG_STAGING=y
147CONFIG_EXT2_FS=y
148CONFIG_EXT3_FS=y
149# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
150CONFIG_ISO9660_FS=m
151CONFIG_JOLIET=y
152CONFIG_ZISOFS=y
153CONFIG_UDF_FS=m
154CONFIG_MSDOS_FS=m
155CONFIG_VFAT_FS=y
156CONFIG_NTFS_FS=y
157CONFIG_PROC_KCORE=y
158CONFIG_TMPFS=y
159CONFIG_ADFS_FS=m
160CONFIG_AFFS_FS=m
161CONFIG_HFS_FS=m
162CONFIG_HFSPLUS_FS=m
163CONFIG_BEFS_FS=m
164CONFIG_BFS_FS=m
165CONFIG_EFS_FS=m
166CONFIG_CRAMFS=y
167CONFIG_VXFS_FS=m
168CONFIG_HPFS_FS=m
169CONFIG_QNX4FS_FS=m
170CONFIG_SYSV_FS=m
171CONFIG_UFS_FS=m
172CONFIG_NFS_FS=y
173CONFIG_NFS_V4=y
174CONFIG_ROOT_NFS=y
175CONFIG_NFSD=y
176CONFIG_CRC_T10DIF=y
177CONFIG_FRAME_WARN=8092
178CONFIG_DEBUG_FS=y
179CONFIG_DETECT_HUNG_TASK=y
180# CONFIG_DEBUG_BUGVERBOSE is not set
181CONFIG_DEBUG_INFO=y
182CONFIG_STRICT_DEVMEM=y
183CONFIG_CRYPTO_PCBC=m
184CONFIG_CRYPTO_SHA256=y
185CONFIG_CRYPTO_SHA512=y
186CONFIG_CRYPTO_AES=y
187# CONFIG_CRYPTO_ANSI_CPRNG is not set
188CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff --git a/arch/powerpc/configs/adder875_defconfig b/arch/powerpc/configs/adder875_defconfig
index 69128740c14d..15b1ff5d96e7 100644
--- a/arch/powerpc/configs/adder875_defconfig
+++ b/arch/powerpc/configs/adder875_defconfig
@@ -70,3 +70,4 @@ CONFIG_DEBUG_KERNEL=y
70CONFIG_DETECT_HUNG_TASK=y 70CONFIG_DETECT_HUNG_TASK=y
71CONFIG_DEBUG_INFO=y 71CONFIG_DEBUG_INFO=y
72# CONFIG_RCU_CPU_STALL_DETECTOR is not set 72# CONFIG_RCU_CPU_STALL_DETECTOR is not set
73CONFIG_CRC32_SLICEBY4=y
diff --git a/arch/powerpc/configs/ep88xc_defconfig b/arch/powerpc/configs/ep88xc_defconfig
index 219fd470ed22..b8a79d7ee89f 100644
--- a/arch/powerpc/configs/ep88xc_defconfig
+++ b/arch/powerpc/configs/ep88xc_defconfig
@@ -72,3 +72,4 @@ CONFIG_DEBUG_KERNEL=y
72CONFIG_DETECT_HUNG_TASK=y 72CONFIG_DETECT_HUNG_TASK=y
73CONFIG_DEBUG_INFO=y 73CONFIG_DEBUG_INFO=y
74# CONFIG_RCU_CPU_STALL_DETECTOR is not set 74# CONFIG_RCU_CPU_STALL_DETECTOR is not set
75CONFIG_CRC32_SLICEBY4=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index d2e0fab5ee5b..83d3550fdb54 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -31,6 +31,7 @@ CONFIG_C293_PCIE=y
31CONFIG_P1010_RDB=y 31CONFIG_P1010_RDB=y
32CONFIG_P1022_DS=y 32CONFIG_P1022_DS=y
33CONFIG_P1022_RDK=y 33CONFIG_P1022_RDK=y
34CONFIG_P1023_RDB=y
34CONFIG_P1023_RDS=y 35CONFIG_P1023_RDS=y
35CONFIG_SOCRATES=y 36CONFIG_SOCRATES=y
36CONFIG_KSI8560=y 37CONFIG_KSI8560=y
@@ -113,6 +114,7 @@ CONFIG_BLK_DEV_LOOP=y
113CONFIG_BLK_DEV_NBD=y 114CONFIG_BLK_DEV_NBD=y
114CONFIG_BLK_DEV_RAM=y 115CONFIG_BLK_DEV_RAM=y
115CONFIG_BLK_DEV_RAM_SIZE=131072 116CONFIG_BLK_DEV_RAM_SIZE=131072
117CONFIG_EEPROM_AT24=y
116CONFIG_EEPROM_LEGACY=y 118CONFIG_EEPROM_LEGACY=y
117CONFIG_BLK_DEV_SD=y 119CONFIG_BLK_DEV_SD=y
118CONFIG_CHR_DEV_ST=y 120CONFIG_CHR_DEV_ST=y
@@ -211,6 +213,7 @@ CONFIG_EDAC=y
211CONFIG_EDAC_MM_EDAC=y 213CONFIG_EDAC_MM_EDAC=y
212CONFIG_RTC_CLASS=y 214CONFIG_RTC_CLASS=y
213CONFIG_RTC_DRV_CMOS=y 215CONFIG_RTC_DRV_CMOS=y
216CONFIG_RTC_DRV_DS1307=y
214CONFIG_DMADEVICES=y 217CONFIG_DMADEVICES=y
215CONFIG_FSL_DMA=y 218CONFIG_FSL_DMA=y
216# CONFIG_NET_DMA is not set 219# CONFIG_NET_DMA is not set
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 4cb7b59e98bd..4b686294feb4 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -34,6 +34,7 @@ CONFIG_C293_PCIE=y
34CONFIG_P1010_RDB=y 34CONFIG_P1010_RDB=y
35CONFIG_P1022_DS=y 35CONFIG_P1022_DS=y
36CONFIG_P1022_RDK=y 36CONFIG_P1022_RDK=y
37CONFIG_P1023_RDB=y
37CONFIG_P1023_RDS=y 38CONFIG_P1023_RDS=y
38CONFIG_SOCRATES=y 39CONFIG_SOCRATES=y
39CONFIG_KSI8560=y 40CONFIG_KSI8560=y
@@ -116,6 +117,7 @@ CONFIG_BLK_DEV_LOOP=y
116CONFIG_BLK_DEV_NBD=y 117CONFIG_BLK_DEV_NBD=y
117CONFIG_BLK_DEV_RAM=y 118CONFIG_BLK_DEV_RAM=y
118CONFIG_BLK_DEV_RAM_SIZE=131072 119CONFIG_BLK_DEV_RAM_SIZE=131072
120CONFIG_EEPROM_AT24=y
119CONFIG_EEPROM_LEGACY=y 121CONFIG_EEPROM_LEGACY=y
120CONFIG_BLK_DEV_SD=y 122CONFIG_BLK_DEV_SD=y
121CONFIG_CHR_DEV_ST=y 123CONFIG_CHR_DEV_ST=y
@@ -212,6 +214,7 @@ CONFIG_EDAC=y
212CONFIG_EDAC_MM_EDAC=y 214CONFIG_EDAC_MM_EDAC=y
213CONFIG_RTC_CLASS=y 215CONFIG_RTC_CLASS=y
214CONFIG_RTC_DRV_CMOS=y 216CONFIG_RTC_DRV_CMOS=y
217CONFIG_RTC_DRV_DS1307=y
215CONFIG_DMADEVICES=y 218CONFIG_DMADEVICES=y
216CONFIG_FSL_DMA=y 219CONFIG_FSL_DMA=y
217# CONFIG_NET_DMA is not set 220# CONFIG_NET_DMA is not set
diff --git a/arch/powerpc/configs/mpc866_ads_defconfig b/arch/powerpc/configs/mpc866_ads_defconfig
index 5c258823e694..d954e80c286a 100644
--- a/arch/powerpc/configs/mpc866_ads_defconfig
+++ b/arch/powerpc/configs/mpc866_ads_defconfig
@@ -55,3 +55,4 @@ CONFIG_PARTITION_ADVANCED=y
55CONFIG_CRC_CCITT=y 55CONFIG_CRC_CCITT=y
56# CONFIG_RCU_CPU_STALL_DETECTOR is not set 56# CONFIG_RCU_CPU_STALL_DETECTOR is not set
57# CONFIG_CRYPTO_ANSI_CPRNG is not set 57# CONFIG_CRYPTO_ANSI_CPRNG is not set
58CONFIG_CRC32_SLICEBY4=y
diff --git a/arch/powerpc/configs/mpc885_ads_defconfig b/arch/powerpc/configs/mpc885_ads_defconfig
index 9e146cdf63de..3f47d00a10c0 100644
--- a/arch/powerpc/configs/mpc885_ads_defconfig
+++ b/arch/powerpc/configs/mpc885_ads_defconfig
@@ -78,3 +78,4 @@ CONFIG_DEBUG_KERNEL=y
78CONFIG_DETECT_HUNG_TASK=y 78CONFIG_DETECT_HUNG_TASK=y
79CONFIG_DEBUG_INFO=y 79CONFIG_DEBUG_INFO=y
80# CONFIG_RCU_CPU_STALL_DETECTOR is not set 80# CONFIG_RCU_CPU_STALL_DETECTOR is not set
81CONFIG_CRC32_SLICEBY4=y
diff --git a/arch/powerpc/configs/mvme5100_defconfig b/arch/powerpc/configs/mvme5100_defconfig
new file mode 100644
index 000000000000..93c7752e2dbb
--- /dev/null
+++ b/arch/powerpc/configs/mvme5100_defconfig
@@ -0,0 +1,144 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y
5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14
8# CONFIG_UTS_NS is not set
9# CONFIG_IPC_NS is not set
10# CONFIG_PID_NS is not set
11# CONFIG_NET_NS is not set
12CONFIG_CC_OPTIMIZE_FOR_SIZE=y
13# CONFIG_COMPAT_BRK is not set
14CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y
16# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_PPC_CHRP is not set
18# CONFIG_PPC_PMAC is not set
19CONFIG_EMBEDDED6xx=y
20CONFIG_MVME5100=y
21CONFIG_KVM_GUEST=y
22CONFIG_HZ_100=y
23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
24# CONFIG_COMPACTION is not set
25CONFIG_CMDLINE_BOOL=y
26CONFIG_CMDLINE="console=ttyS0,9600 ip=dhcp root=/dev/nfs"
27CONFIG_NET=y
28CONFIG_PACKET=y
29CONFIG_UNIX=y
30CONFIG_INET=y
31CONFIG_IP_MULTICAST=y
32CONFIG_IP_PNP=y
33CONFIG_IP_PNP_DHCP=y
34CONFIG_IP_PNP_BOOTP=y
35# CONFIG_INET_LRO is not set
36# CONFIG_IPV6 is not set
37CONFIG_NETFILTER=y
38CONFIG_NF_CONNTRACK=m
39CONFIG_NF_CT_PROTO_SCTP=m
40CONFIG_NF_CONNTRACK_AMANDA=m
41CONFIG_NF_CONNTRACK_FTP=m
42CONFIG_NF_CONNTRACK_H323=m
43CONFIG_NF_CONNTRACK_IRC=m
44CONFIG_NF_CONNTRACK_NETBIOS_NS=m
45CONFIG_NF_CONNTRACK_PPTP=m
46CONFIG_NF_CONNTRACK_SIP=m
47CONFIG_NF_CONNTRACK_TFTP=m
48CONFIG_NETFILTER_XT_MATCH_MAC=m
49CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
50CONFIG_NETFILTER_XT_MATCH_STATE=m
51CONFIG_NF_CONNTRACK_IPV4=m
52CONFIG_IP_NF_IPTABLES=m
53CONFIG_IP_NF_FILTER=m
54CONFIG_IP_NF_TARGET_REJECT=m
55CONFIG_IP_NF_MANGLE=m
56CONFIG_IP_NF_TARGET_ECN=m
57CONFIG_IP_NF_TARGET_TTL=m
58CONFIG_IP_NF_RAW=m
59CONFIG_IP_NF_ARPTABLES=m
60CONFIG_IP_NF_ARPFILTER=m
61CONFIG_IP_NF_ARP_MANGLE=m
62CONFIG_LAPB=m
63CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
64CONFIG_PROC_DEVICETREE=y
65CONFIG_BLK_DEV_LOOP=y
66CONFIG_BLK_DEV_RAM=y
67CONFIG_BLK_DEV_RAM_COUNT=2
68CONFIG_BLK_DEV_RAM_SIZE=8192
69CONFIG_EEPROM_LEGACY=m
70CONFIG_NETDEVICES=y
71CONFIG_TUN=m
72# CONFIG_NET_VENDOR_3COM is not set
73CONFIG_E100=y
74# CONFIG_WLAN is not set
75# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
76# CONFIG_INPUT_KEYBOARD is not set
77# CONFIG_INPUT_MOUSE is not set
78# CONFIG_SERIO is not set
79CONFIG_SERIAL_8250=y
80CONFIG_SERIAL_8250_CONSOLE=y
81CONFIG_SERIAL_8250_NR_UARTS=10
82CONFIG_SERIAL_8250_EXTENDED=y
83CONFIG_SERIAL_8250_MANY_PORTS=y
84CONFIG_SERIAL_8250_SHARE_IRQ=y
85CONFIG_SERIAL_OF_PLATFORM=y
86CONFIG_HW_RANDOM=y
87CONFIG_I2C=y
88CONFIG_I2C_CHARDEV=y
89CONFIG_I2C_MPC=y
90# CONFIG_HWMON is not set
91CONFIG_VIDEO_OUTPUT_CONTROL=m
92# CONFIG_VGA_CONSOLE is not set
93# CONFIG_HID is not set
94# CONFIG_USB_SUPPORT is not set
95# CONFIG_IOMMU_SUPPORT is not set
96CONFIG_VME_BUS=m
97CONFIG_VME_CA91CX42=m
98CONFIG_EXT2_FS=m
99CONFIG_EXT3_FS=m
100# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
101CONFIG_XFS_FS=m
102CONFIG_ISO9660_FS=m
103CONFIG_JOLIET=y
104CONFIG_ZISOFS=y
105CONFIG_UDF_FS=m
106CONFIG_MSDOS_FS=m
107CONFIG_VFAT_FS=m
108CONFIG_PROC_KCORE=y
109CONFIG_TMPFS=y
110CONFIG_NFS_FS=y
111CONFIG_NFS_V3_ACL=y
112CONFIG_NFS_V4=y
113CONFIG_ROOT_NFS=y
114CONFIG_NFSD=m
115CONFIG_NFSD_V3=y
116CONFIG_CIFS=m
117CONFIG_NLS=y
118CONFIG_NLS_CODEPAGE_437=m
119CONFIG_NLS_CODEPAGE_932=m
120CONFIG_NLS_ISO8859_1=m
121CONFIG_NLS_UTF8=m
122CONFIG_CRC_CCITT=m
123CONFIG_CRC_T10DIF=y
124CONFIG_XZ_DEC=y
125CONFIG_XZ_DEC_X86=y
126CONFIG_XZ_DEC_IA64=y
127CONFIG_XZ_DEC_ARM=y
128CONFIG_XZ_DEC_ARMTHUMB=y
129CONFIG_XZ_DEC_SPARC=y
130CONFIG_MAGIC_SYSRQ=y
131CONFIG_DEBUG_KERNEL=y
132CONFIG_DETECT_HUNG_TASK=y
133CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20
134CONFIG_CRYPTO_CBC=y
135CONFIG_CRYPTO_PCBC=m
136CONFIG_CRYPTO_MD5=y
137CONFIG_CRYPTO_MICHAEL_MIC=m
138CONFIG_CRYPTO_SHA1=m
139CONFIG_CRYPTO_BLOWFISH=m
140CONFIG_CRYPTO_DES=y
141CONFIG_CRYPTO_SERPENT=m
142CONFIG_CRYPTO_TWOFISH=m
143CONFIG_CRYPTO_DEFLATE=m
144# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 581a3bcae728..e015896b7e5c 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -186,6 +186,7 @@ CONFIG_SCSI_DH_RDAC=m
186CONFIG_SCSI_DH_ALUA=m 186CONFIG_SCSI_DH_ALUA=m
187CONFIG_ATA=y 187CONFIG_ATA=y
188CONFIG_SATA_SIL24=y 188CONFIG_SATA_SIL24=y
189CONFIG_SATA_MV=y
189CONFIG_SATA_SVW=y 190CONFIG_SATA_SVW=y
190CONFIG_MD=y 191CONFIG_MD=y
191CONFIG_BLK_DEV_MD=y 192CONFIG_BLK_DEV_MD=y
diff --git a/arch/powerpc/configs/tqm8xx_defconfig b/arch/powerpc/configs/tqm8xx_defconfig
index 8616fde0896f..4b6f8bf104e0 100644
--- a/arch/powerpc/configs/tqm8xx_defconfig
+++ b/arch/powerpc/configs/tqm8xx_defconfig
@@ -84,3 +84,4 @@ CONFIG_DEBUG_KERNEL=y
84CONFIG_DETECT_HUNG_TASK=y 84CONFIG_DETECT_HUNG_TASK=y
85CONFIG_DEBUG_INFO=y 85CONFIG_DEBUG_INFO=y
86# CONFIG_RCU_CPU_STALL_DETECTOR is not set 86# CONFIG_RCU_CPU_STALL_DETECTOR is not set
87CONFIG_CRC32_SLICEBY4=y
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index d8f9d2f18a23..6c0a955a1b06 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -3,4 +3,5 @@ generic-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 += preempt.h
6generic-y += vtime.h \ No newline at end of file 6generic-y += vtime.h
7generic-y += hash.h
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index 910194e9a1e2..a5e9a7d494d8 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -46,6 +46,11 @@
46#include <asm/asm-compat.h> 46#include <asm/asm-compat.h>
47#include <asm/synch.h> 47#include <asm/synch.h>
48 48
49/* PPC bit number conversion */
50#define PPC_BITLSHIFT(be) (BITS_PER_LONG - 1 - (be))
51#define PPC_BIT(bit) (1UL << PPC_BITLSHIFT(bit))
52#define PPC_BITMASK(bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
53
49/* 54/*
50 * clear_bit doesn't imply a memory barrier 55 * clear_bit doesn't imply a memory barrier
51 */ 56 */
diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
index 9e495c9a6a88..ed0afc1e44a4 100644
--- a/arch/powerpc/include/asm/cache.h
+++ b/arch/powerpc/include/asm/cache.h
@@ -41,8 +41,20 @@ struct ppc64_caches {
41extern struct ppc64_caches ppc64_caches; 41extern struct ppc64_caches ppc64_caches;
42#endif /* __powerpc64__ && ! __ASSEMBLY__ */ 42#endif /* __powerpc64__ && ! __ASSEMBLY__ */
43 43
44#if !defined(__ASSEMBLY__) 44#if defined(__ASSEMBLY__)
45/*
46 * For a snooping icache, we still need a dummy icbi to purge all the
47 * prefetched instructions from the ifetch buffers. We also need a sync
48 * before the icbi to order the the actual stores to memory that might
49 * have modified instructions with the icbi.
50 */
51#define PURGE_PREFETCHED_INS \
52 sync; \
53 icbi 0,r3; \
54 sync; \
55 isync
45 56
57#else
46#define __read_mostly __attribute__((__section__(".data..read_mostly"))) 58#define __read_mostly __attribute__((__section__(".data..read_mostly")))
47 59
48#ifdef CONFIG_6xx 60#ifdef CONFIG_6xx
diff --git a/arch/powerpc/include/asm/clk_interface.h b/arch/powerpc/include/asm/clk_interface.h
deleted file mode 100644
index ab1882c1e176..000000000000
--- a/arch/powerpc/include/asm/clk_interface.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef __ASM_POWERPC_CLK_INTERFACE_H
2#define __ASM_POWERPC_CLK_INTERFACE_H
3
4#include <linux/clk.h>
5
6struct clk_interface {
7 struct clk* (*clk_get) (struct device *dev, const char *id);
8 int (*clk_enable) (struct clk *clk);
9 void (*clk_disable) (struct clk *clk);
10 unsigned long (*clk_get_rate) (struct clk *clk);
11 void (*clk_put) (struct clk *clk);
12 long (*clk_round_rate) (struct clk *clk, unsigned long rate);
13 int (*clk_set_rate) (struct clk *clk, unsigned long rate);
14 int (*clk_set_parent) (struct clk *clk, struct clk *parent);
15 struct clk* (*clk_get_parent) (struct clk *clk);
16};
17
18extern struct clk_interface clk_functions;
19
20#endif /* __ASM_POWERPC_CLK_INTERFACE_H */
diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/cmpxchg.h
index e245aab7f191..d463c68fe7f0 100644
--- a/arch/powerpc/include/asm/cmpxchg.h
+++ b/arch/powerpc/include/asm/cmpxchg.h
@@ -300,6 +300,7 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
300 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ 300 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
301 cmpxchg_local((ptr), (o), (n)); \ 301 cmpxchg_local((ptr), (o), (n)); \
302 }) 302 })
303#define cmpxchg64_relaxed cmpxchg64_local
303#else 304#else
304#include <asm-generic/cmpxchg-local.h> 305#include <asm-generic/cmpxchg-local.h>
305#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 306#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index a6f8c7a5cbb7..97e02f985df8 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -34,6 +34,13 @@ int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr);
34unsigned long branch_target(const unsigned int *instr); 34unsigned long branch_target(const unsigned int *instr);
35unsigned int translate_branch(const unsigned int *dest, 35unsigned int translate_branch(const unsigned int *dest,
36 const unsigned int *src); 36 const unsigned int *src);
37#ifdef CONFIG_PPC_BOOK3E_64
38void __patch_exception(int exc, unsigned long addr);
39#define patch_exception(exc, name) do { \
40 extern unsigned int name; \
41 __patch_exception((exc), (unsigned long)&name); \
42} while (0)
43#endif
37 44
38static inline unsigned long ppc_function_entry(void *func) 45static inline unsigned long ppc_function_entry(void *func)
39{ 46{
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 0d4939ba48e7..617cc767c076 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -90,6 +90,18 @@ struct cpu_spec {
90 * if the error is fatal, 1 if it was fully recovered and 0 to 90 * if the error is fatal, 1 if it was fully recovered and 0 to
91 * pass up (not CPU originated) */ 91 * pass up (not CPU originated) */
92 int (*machine_check)(struct pt_regs *regs); 92 int (*machine_check)(struct pt_regs *regs);
93
94 /*
95 * Processor specific early machine check handler which is
96 * called in real mode to handle SLB and TLB errors.
97 */
98 long (*machine_check_early)(struct pt_regs *regs);
99
100 /*
101 * Processor specific routine to flush tlbs.
102 */
103 void (*flush_tlb)(unsigned long inval_selector);
104
93}; 105};
94 106
95extern struct cpu_spec *cur_cpu_spec; 107extern struct cpu_spec *cur_cpu_spec;
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index d3e5e9bc8f94..9e39ceb1d19f 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -90,7 +90,8 @@ struct eeh_pe {
90#define EEH_DEV_IRQ_DISABLED (1 << 3) /* Interrupt disabled */ 90#define EEH_DEV_IRQ_DISABLED (1 << 3) /* Interrupt disabled */
91#define EEH_DEV_DISCONNECTED (1 << 4) /* Removing from PE */ 91#define EEH_DEV_DISCONNECTED (1 << 4) /* Removing from PE */
92 92
93#define EEH_DEV_SYSFS (1 << 8) /* Sysfs created */ 93#define EEH_DEV_NO_HANDLER (1 << 8) /* No error handler */
94#define EEH_DEV_SYSFS (1 << 9) /* Sysfs created */
94 95
95struct eeh_dev { 96struct eeh_dev {
96 int mode; /* EEH mode */ 97 int mode; /* EEH mode */
@@ -117,6 +118,16 @@ static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
117 return edev ? edev->pdev : NULL; 118 return edev ? edev->pdev : NULL;
118} 119}
119 120
121/* Return values from eeh_ops::next_error */
122enum {
123 EEH_NEXT_ERR_NONE = 0,
124 EEH_NEXT_ERR_INF,
125 EEH_NEXT_ERR_FROZEN_PE,
126 EEH_NEXT_ERR_FENCED_PHB,
127 EEH_NEXT_ERR_DEAD_PHB,
128 EEH_NEXT_ERR_DEAD_IOC
129};
130
120/* 131/*
121 * The struct is used to trace the registered EEH operation 132 * The struct is used to trace the registered EEH operation
122 * callback functions. Actually, those operation callback 133 * callback functions. Actually, those operation callback
@@ -157,6 +168,7 @@ struct eeh_ops {
157 int (*read_config)(struct device_node *dn, int where, int size, u32 *val); 168 int (*read_config)(struct device_node *dn, int where, int size, u32 *val);
158 int (*write_config)(struct device_node *dn, int where, int size, u32 val); 169 int (*write_config)(struct device_node *dn, int where, int size, u32 val);
159 int (*next_error)(struct eeh_pe **pe); 170 int (*next_error)(struct eeh_pe **pe);
171 int (*restore_config)(struct device_node *dn);
160}; 172};
161 173
162extern struct eeh_ops *eeh_ops; 174extern struct eeh_ops *eeh_ops;
diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index 86b0ac79990c..334459ad145b 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -460,5 +460,116 @@ static inline unsigned int ev_idle(void)
460 460
461 return r3; 461 return r3;
462} 462}
463
464#ifdef CONFIG_EPAPR_PARAVIRT
465static inline unsigned long epapr_hypercall(unsigned long *in,
466 unsigned long *out,
467 unsigned long nr)
468{
469 unsigned long register r0 asm("r0");
470 unsigned long register r3 asm("r3") = in[0];
471 unsigned long register r4 asm("r4") = in[1];
472 unsigned long register r5 asm("r5") = in[2];
473 unsigned long register r6 asm("r6") = in[3];
474 unsigned long register r7 asm("r7") = in[4];
475 unsigned long register r8 asm("r8") = in[5];
476 unsigned long register r9 asm("r9") = in[6];
477 unsigned long register r10 asm("r10") = in[7];
478 unsigned long register r11 asm("r11") = nr;
479 unsigned long register r12 asm("r12");
480
481 asm volatile("bl epapr_hypercall_start"
482 : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6),
483 "=r"(r7), "=r"(r8), "=r"(r9), "=r"(r10), "=r"(r11),
484 "=r"(r12)
485 : "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "r"(r8),
486 "r"(r9), "r"(r10), "r"(r11)
487 : "memory", "cc", "xer", "ctr", "lr");
488
489 out[0] = r4;
490 out[1] = r5;
491 out[2] = r6;
492 out[3] = r7;
493 out[4] = r8;
494 out[5] = r9;
495 out[6] = r10;
496 out[7] = r11;
497
498 return r3;
499}
500#else
501static unsigned long epapr_hypercall(unsigned long *in,
502 unsigned long *out,
503 unsigned long nr)
504{
505 return EV_UNIMPLEMENTED;
506}
507#endif
508
509static inline long epapr_hypercall0_1(unsigned int nr, unsigned long *r2)
510{
511 unsigned long in[8];
512 unsigned long out[8];
513 unsigned long r;
514
515 r = epapr_hypercall(in, out, nr);
516 *r2 = out[0];
517
518 return r;
519}
520
521static inline long epapr_hypercall0(unsigned int nr)
522{
523 unsigned long in[8];
524 unsigned long out[8];
525
526 return epapr_hypercall(in, out, nr);
527}
528
529static inline long epapr_hypercall1(unsigned int nr, unsigned long p1)
530{
531 unsigned long in[8];
532 unsigned long out[8];
533
534 in[0] = p1;
535 return epapr_hypercall(in, out, nr);
536}
537
538static inline long epapr_hypercall2(unsigned int nr, unsigned long p1,
539 unsigned long p2)
540{
541 unsigned long in[8];
542 unsigned long out[8];
543
544 in[0] = p1;
545 in[1] = p2;
546 return epapr_hypercall(in, out, nr);
547}
548
549static inline long epapr_hypercall3(unsigned int nr, unsigned long p1,
550 unsigned long p2, unsigned long p3)
551{
552 unsigned long in[8];
553 unsigned long out[8];
554
555 in[0] = p1;
556 in[1] = p2;
557 in[2] = p3;
558 return epapr_hypercall(in, out, nr);
559}
560
561static inline long epapr_hypercall4(unsigned int nr, unsigned long p1,
562 unsigned long p2, unsigned long p3,
563 unsigned long p4)
564{
565 unsigned long in[8];
566 unsigned long out[8];
567
568 in[0] = p1;
569 in[1] = p2;
570 in[2] = p3;
571 in[3] = p4;
572 return epapr_hypercall(in, out, nr);
573}
463#endif /* !__ASSEMBLY__ */ 574#endif /* !__ASSEMBLY__ */
464#endif /* _EPAPR_HCALLS_H */ 575#endif /* _EPAPR_HCALLS_H */
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 243ce69ad685..66830618cc19 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -301,9 +301,12 @@ do_kvm_##n: \
301 beq 4f; /* if from kernel mode */ \ 301 beq 4f; /* if from kernel mode */ \
302 ACCOUNT_CPU_USER_ENTRY(r9, r10); \ 302 ACCOUNT_CPU_USER_ENTRY(r9, r10); \
303 SAVE_PPR(area, r9, r10); \ 303 SAVE_PPR(area, r9, r10); \
3044: std r2,GPR2(r1); /* save r2 in stackframe */ \ 3044: EXCEPTION_PROLOG_COMMON_2(area) \
305 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \ 305 EXCEPTION_PROLOG_COMMON_3(n) \
306 SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \ 306 ACCOUNT_STOLEN_TIME
307
308/* Save original regs values from save area to stack frame. */
309#define EXCEPTION_PROLOG_COMMON_2(area) \
307 ld r9,area+EX_R9(r13); /* move r9, r10 to stackframe */ \ 310 ld r9,area+EX_R9(r13); /* move r9, r10 to stackframe */ \
308 ld r10,area+EX_R10(r13); \ 311 ld r10,area+EX_R10(r13); \
309 std r9,GPR9(r1); \ 312 std r9,GPR9(r1); \
@@ -318,11 +321,16 @@ do_kvm_##n: \
318 ld r10,area+EX_CFAR(r13); \ 321 ld r10,area+EX_CFAR(r13); \
319 std r10,ORIG_GPR3(r1); \ 322 std r10,ORIG_GPR3(r1); \
320 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \ 323 END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66); \
324 GET_CTR(r10, area); \
325 std r10,_CTR(r1);
326
327#define EXCEPTION_PROLOG_COMMON_3(n) \
328 std r2,GPR2(r1); /* save r2 in stackframe */ \
329 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \
330 SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \
321 mflr r9; /* Get LR, later save to stack */ \ 331 mflr r9; /* Get LR, later save to stack */ \
322 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \ 332 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \
323 std r9,_LINK(r1); \ 333 std r9,_LINK(r1); \
324 GET_CTR(r10, area); \
325 std r10,_CTR(r1); \
326 lbz r10,PACASOFTIRQEN(r13); \ 334 lbz r10,PACASOFTIRQEN(r13); \
327 mfspr r11,SPRN_XER; /* save XER in stackframe */ \ 335 mfspr r11,SPRN_XER; /* save XER in stackframe */ \
328 std r10,SOFTE(r1); \ 336 std r10,SOFTE(r1); \
@@ -332,8 +340,7 @@ do_kvm_##n: \
332 li r10,0; \ 340 li r10,0; \
333 ld r11,exception_marker@toc(r2); \ 341 ld r11,exception_marker@toc(r2); \
334 std r10,RESULT(r1); /* clear regs->result */ \ 342 std r10,RESULT(r1); /* clear regs->result */ \
335 std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */ \ 343 std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */
336 ACCOUNT_STOLEN_TIME
337 344
338/* 345/*
339 * Exception vectors. 346 * Exception vectors.
diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h
index 5c2c0233175e..90f604bbcd19 100644
--- a/arch/powerpc/include/asm/fixmap.h
+++ b/arch/powerpc/include/asm/fixmap.h
@@ -58,52 +58,12 @@ enum fixed_addresses {
58extern void __set_fixmap (enum fixed_addresses idx, 58extern void __set_fixmap (enum fixed_addresses idx,
59 phys_addr_t phys, pgprot_t flags); 59 phys_addr_t phys, pgprot_t flags);
60 60
61#define set_fixmap(idx, phys) \
62 __set_fixmap(idx, phys, PAGE_KERNEL)
63/*
64 * Some hardware wants to get fixmapped without caching.
65 */
66#define set_fixmap_nocache(idx, phys) \
67 __set_fixmap(idx, phys, PAGE_KERNEL_NCG)
68
69#define clear_fixmap(idx) \
70 __set_fixmap(idx, 0, __pgprot(0))
71
72#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 61#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
73#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) 62#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
74 63
75#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) 64#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NCG
76#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
77
78extern void __this_fixmap_does_not_exist(void);
79
80/*
81 * 'index to address' translation. If anyone tries to use the idx
82 * directly without tranlation, we catch the bug with a NULL-deference
83 * kernel oops. Illegal ranges of incoming indices are caught too.
84 */
85static __always_inline unsigned long fix_to_virt(const unsigned int idx)
86{
87 /*
88 * this branch gets completely eliminated after inlining,
89 * except when someone tries to use fixaddr indices in an
90 * illegal way. (such as mixing up address types or using
91 * out-of-range indices).
92 *
93 * If it doesn't get removed, the linker will complain
94 * loudly with a reasonably clear error message..
95 */
96 if (idx >= __end_of_fixed_addresses)
97 __this_fixmap_does_not_exist();
98
99 return __fix_to_virt(idx);
100}
101 65
102static inline unsigned long virt_to_fix(const unsigned long vaddr) 66#include <asm-generic/fixmap.h>
103{
104 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
105 return __virt_to_fix(vaddr);
106}
107 67
108#endif /* !__ASSEMBLY__ */ 68#endif /* !__ASSEMBLY__ */
109#endif 69#endif
diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h
index 420b45368fcf..067fb0dca549 100644
--- a/arch/powerpc/include/asm/fsl_lbc.h
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -285,7 +285,7 @@ struct fsl_lbc_ctrl {
285 /* device info */ 285 /* device info */
286 struct device *dev; 286 struct device *dev;
287 struct fsl_lbc_regs __iomem *regs; 287 struct fsl_lbc_regs __iomem *regs;
288 int irq; 288 int irq[2];
289 wait_queue_head_t irq_wait; 289 wait_queue_head_t irq_wait;
290 spinlock_t lock; 290 spinlock_t lock;
291 void *nand; 291 void *nand;
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 3bdcfce2c42a..418fb654370d 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -6,7 +6,8 @@
6 6
7typedef struct { 7typedef struct {
8 unsigned int __softirq_pending; 8 unsigned int __softirq_pending;
9 unsigned int timer_irqs; 9 unsigned int timer_irqs_event;
10 unsigned int timer_irqs_others;
10 unsigned int pmu_irqs; 11 unsigned int pmu_irqs;
11 unsigned int mce_exceptions; 12 unsigned int mce_exceptions;
12 unsigned int spurious_irqs; 13 unsigned int spurious_irqs;
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 575fbf81fad0..97d3869991ca 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -191,8 +191,24 @@ DEF_MMIO_OUT_D(out_le32, 32, stw);
191 191
192#endif /* __BIG_ENDIAN */ 192#endif /* __BIG_ENDIAN */
193 193
194/*
195 * Cache inhibitied accessors for use in real mode, you don't want to use these
196 * unless you know what you're doing.
197 *
198 * NB. These use the cpu byte ordering.
199 */
200DEF_MMIO_OUT_X(out_rm8, 8, stbcix);
201DEF_MMIO_OUT_X(out_rm16, 16, sthcix);
202DEF_MMIO_OUT_X(out_rm32, 32, stwcix);
203DEF_MMIO_IN_X(in_rm8, 8, lbzcix);
204DEF_MMIO_IN_X(in_rm16, 16, lhzcix);
205DEF_MMIO_IN_X(in_rm32, 32, lwzcix);
206
194#ifdef __powerpc64__ 207#ifdef __powerpc64__
195 208
209DEF_MMIO_OUT_X(out_rm64, 64, stdcix);
210DEF_MMIO_IN_X(in_rm64, 64, ldcix);
211
196#ifdef __BIG_ENDIAN__ 212#ifdef __BIG_ENDIAN__
197DEF_MMIO_OUT_D(out_be64, 64, std); 213DEF_MMIO_OUT_D(out_be64, 64, std);
198DEF_MMIO_IN_D(in_be64, 64, ld); 214DEF_MMIO_IN_D(in_be64, 64, ld);
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index c34656a8925e..f7a8036579b5 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -30,22 +30,19 @@
30#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/types.h> 31#include <asm/types.h>
32 32
33#define IOMMU_PAGE_SHIFT 12 33#define IOMMU_PAGE_SHIFT_4K 12
34#define IOMMU_PAGE_SIZE (ASM_CONST(1) << IOMMU_PAGE_SHIFT) 34#define IOMMU_PAGE_SIZE_4K (ASM_CONST(1) << IOMMU_PAGE_SHIFT_4K)
35#define IOMMU_PAGE_MASK (~((1 << IOMMU_PAGE_SHIFT) - 1)) 35#define IOMMU_PAGE_MASK_4K (~((1 << IOMMU_PAGE_SHIFT_4K) - 1))
36#define IOMMU_PAGE_ALIGN(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE) 36#define IOMMU_PAGE_ALIGN_4K(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE_4K)
37
38#define IOMMU_PAGE_SIZE(tblptr) (ASM_CONST(1) << (tblptr)->it_page_shift)
39#define IOMMU_PAGE_MASK(tblptr) (~((1 << (tblptr)->it_page_shift) - 1))
40#define IOMMU_PAGE_ALIGN(addr, tblptr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE(tblptr))
37 41
38/* Boot time flags */ 42/* Boot time flags */
39extern int iommu_is_off; 43extern int iommu_is_off;
40extern int iommu_force_on; 44extern int iommu_force_on;
41 45
42/* Pure 2^n version of get_order */
43static __inline__ __attribute_const__ int get_iommu_order(unsigned long size)
44{
45 return __ilog2((size - 1) >> IOMMU_PAGE_SHIFT) + 1;
46}
47
48
49/* 46/*
50 * IOMAP_MAX_ORDER defines the largest contiguous block 47 * IOMAP_MAX_ORDER defines the largest contiguous block
51 * of dma space we can get. IOMAP_MAX_ORDER = 13 48 * of dma space we can get. IOMAP_MAX_ORDER = 13
@@ -76,11 +73,20 @@ struct iommu_table {
76 struct iommu_pool large_pool; 73 struct iommu_pool large_pool;
77 struct iommu_pool pools[IOMMU_NR_POOLS]; 74 struct iommu_pool pools[IOMMU_NR_POOLS];
78 unsigned long *it_map; /* A simple allocation bitmap for now */ 75 unsigned long *it_map; /* A simple allocation bitmap for now */
76 unsigned long it_page_shift;/* table iommu page size */
79#ifdef CONFIG_IOMMU_API 77#ifdef CONFIG_IOMMU_API
80 struct iommu_group *it_group; 78 struct iommu_group *it_group;
81#endif 79#endif
82}; 80};
83 81
82/* Pure 2^n version of get_order */
83static inline __attribute_const__
84int get_iommu_order(unsigned long size, struct iommu_table *tbl)
85{
86 return __ilog2((size - 1) >> tbl->it_page_shift) + 1;
87}
88
89
84struct scatterlist; 90struct scatterlist;
85 91
86static inline void set_iommu_table_base(struct device *dev, void *base) 92static inline void set_iommu_table_base(struct device *dev, void *base)
@@ -101,8 +107,34 @@ extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
101 */ 107 */
102extern struct iommu_table *iommu_init_table(struct iommu_table * tbl, 108extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
103 int nid); 109 int nid);
110#ifdef CONFIG_IOMMU_API
104extern void iommu_register_group(struct iommu_table *tbl, 111extern void iommu_register_group(struct iommu_table *tbl,
105 int pci_domain_number, unsigned long pe_num); 112 int pci_domain_number, unsigned long pe_num);
113extern int iommu_add_device(struct device *dev);
114extern void iommu_del_device(struct device *dev);
115#else
116static inline void iommu_register_group(struct iommu_table *tbl,
117 int pci_domain_number,
118 unsigned long pe_num)
119{
120}
121
122static inline int iommu_add_device(struct device *dev)
123{
124 return 0;
125}
126
127static inline void iommu_del_device(struct device *dev)
128{
129}
130#endif /* !CONFIG_IOMMU_API */
131
132static inline void set_iommu_table_base_and_group(struct device *dev,
133 void *base)
134{
135 set_iommu_table_base(dev, base);
136 iommu_add_device(dev);
137}
106 138
107extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 139extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
108 struct scatterlist *sglist, int nelems, 140 struct scatterlist *sglist, int nelems,
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index 1bd92fd43cfb..19eb74a95b59 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -74,6 +74,7 @@
74#define BOOKE_INTERRUPT_GUEST_DBELL_CRIT 39 74#define BOOKE_INTERRUPT_GUEST_DBELL_CRIT 39
75#define BOOKE_INTERRUPT_HV_SYSCALL 40 75#define BOOKE_INTERRUPT_HV_SYSCALL 40
76#define BOOKE_INTERRUPT_HV_PRIV 41 76#define BOOKE_INTERRUPT_HV_PRIV 41
77#define BOOKE_INTERRUPT_LRAT_ERROR 42
77 78
78/* book3s */ 79/* book3s */
79 80
@@ -91,14 +92,17 @@
91#define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800 92#define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800
92#define BOOK3S_INTERRUPT_DECREMENTER 0x900 93#define BOOK3S_INTERRUPT_DECREMENTER 0x900
93#define BOOK3S_INTERRUPT_HV_DECREMENTER 0x980 94#define BOOK3S_INTERRUPT_HV_DECREMENTER 0x980
95#define BOOK3S_INTERRUPT_DOORBELL 0xa00
94#define BOOK3S_INTERRUPT_SYSCALL 0xc00 96#define BOOK3S_INTERRUPT_SYSCALL 0xc00
95#define BOOK3S_INTERRUPT_TRACE 0xd00 97#define BOOK3S_INTERRUPT_TRACE 0xd00
96#define BOOK3S_INTERRUPT_H_DATA_STORAGE 0xe00 98#define BOOK3S_INTERRUPT_H_DATA_STORAGE 0xe00
97#define BOOK3S_INTERRUPT_H_INST_STORAGE 0xe20 99#define BOOK3S_INTERRUPT_H_INST_STORAGE 0xe20
98#define BOOK3S_INTERRUPT_H_EMUL_ASSIST 0xe40 100#define BOOK3S_INTERRUPT_H_EMUL_ASSIST 0xe40
101#define BOOK3S_INTERRUPT_H_DOORBELL 0xe80
99#define BOOK3S_INTERRUPT_PERFMON 0xf00 102#define BOOK3S_INTERRUPT_PERFMON 0xf00
100#define BOOK3S_INTERRUPT_ALTIVEC 0xf20 103#define BOOK3S_INTERRUPT_ALTIVEC 0xf20
101#define BOOK3S_INTERRUPT_VSX 0xf40 104#define BOOK3S_INTERRUPT_VSX 0xf40
105#define BOOK3S_INTERRUPT_H_FAC_UNAVAIL 0xf80
102 106
103#define BOOK3S_IRQPRIO_SYSTEM_RESET 0 107#define BOOK3S_IRQPRIO_SYSTEM_RESET 0
104#define BOOK3S_IRQPRIO_DATA_SEGMENT 1 108#define BOOK3S_IRQPRIO_DATA_SEGMENT 1
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index bc23b1ba7980..83851aabfdc8 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -186,9 +186,6 @@ extern void kvmppc_update_lpcr(struct kvm *kvm, unsigned long lpcr,
186 186
187extern void kvmppc_entry_trampoline(void); 187extern void kvmppc_entry_trampoline(void);
188extern void kvmppc_hv_entry_trampoline(void); 188extern void kvmppc_hv_entry_trampoline(void);
189extern void kvmppc_load_up_fpu(void);
190extern void kvmppc_load_up_altivec(void);
191extern void kvmppc_load_up_vsx(void);
192extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst); 189extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst);
193extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst); 190extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst);
194extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd); 191extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd);
@@ -271,16 +268,25 @@ static inline ulong kvmppc_get_pc(struct kvm_vcpu *vcpu)
271 return vcpu->arch.pc; 268 return vcpu->arch.pc;
272} 269}
273 270
274static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu) 271static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu)
275{ 272{
276 ulong pc = kvmppc_get_pc(vcpu); 273 return (vcpu->arch.shared->msr & MSR_LE) != (MSR_KERNEL & MSR_LE);
274}
277 275
276static inline u32 kvmppc_get_last_inst_internal(struct kvm_vcpu *vcpu, ulong pc)
277{
278 /* Load the instruction manually if it failed to do so in the 278 /* Load the instruction manually if it failed to do so in the
279 * exit path */ 279 * exit path */
280 if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED) 280 if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED)
281 kvmppc_ld(vcpu, &pc, sizeof(u32), &vcpu->arch.last_inst, false); 281 kvmppc_ld(vcpu, &pc, sizeof(u32), &vcpu->arch.last_inst, false);
282 282
283 return vcpu->arch.last_inst; 283 return kvmppc_need_byteswap(vcpu) ? swab32(vcpu->arch.last_inst) :
284 vcpu->arch.last_inst;
285}
286
287static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu)
288{
289 return kvmppc_get_last_inst_internal(vcpu, kvmppc_get_pc(vcpu));
284} 290}
285 291
286/* 292/*
@@ -290,14 +296,7 @@ static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu)
290 */ 296 */
291static inline u32 kvmppc_get_last_sc(struct kvm_vcpu *vcpu) 297static inline u32 kvmppc_get_last_sc(struct kvm_vcpu *vcpu)
292{ 298{
293 ulong pc = kvmppc_get_pc(vcpu) - 4; 299 return kvmppc_get_last_inst_internal(vcpu, kvmppc_get_pc(vcpu) - 4);
294
295 /* Load the instruction manually if it failed to do so in the
296 * exit path */
297 if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED)
298 kvmppc_ld(vcpu, &pc, sizeof(u32), &vcpu->arch.last_inst, false);
299
300 return vcpu->arch.last_inst;
301} 300}
302 301
303static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu) 302static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index 192917d2239c..f3a91dc02c98 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -88,6 +88,7 @@ struct kvmppc_host_state {
88 u8 hwthread_req; 88 u8 hwthread_req;
89 u8 hwthread_state; 89 u8 hwthread_state;
90 u8 host_ipi; 90 u8 host_ipi;
91 u8 ptid;
91 struct kvm_vcpu *kvm_vcpu; 92 struct kvm_vcpu *kvm_vcpu;
92 struct kvmppc_vcore *kvm_vcore; 93 struct kvmppc_vcore *kvm_vcore;
93 unsigned long xics_phys; 94 unsigned long xics_phys;
diff --git a/arch/powerpc/include/asm/kvm_booke.h b/arch/powerpc/include/asm/kvm_booke.h
index dd8f61510dfd..80d46b5a7efb 100644
--- a/arch/powerpc/include/asm/kvm_booke.h
+++ b/arch/powerpc/include/asm/kvm_booke.h
@@ -63,6 +63,12 @@ static inline u32 kvmppc_get_xer(struct kvm_vcpu *vcpu)
63 return vcpu->arch.xer; 63 return vcpu->arch.xer;
64} 64}
65 65
66static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu)
67{
68 /* XXX Would need to check TLB entry */
69 return false;
70}
71
66static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu) 72static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu)
67{ 73{
68 return vcpu->arch.last_inst; 74 return vcpu->arch.last_inst;
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 237d1d25b448..1eaea2dea174 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -288,6 +288,7 @@ struct kvmppc_vcore {
288 int n_woken; 288 int n_woken;
289 int nap_count; 289 int nap_count;
290 int napping_threads; 290 int napping_threads;
291 int first_vcpuid;
291 u16 pcpu; 292 u16 pcpu;
292 u16 last_cpu; 293 u16 last_cpu;
293 u8 vcore_state; 294 u8 vcore_state;
@@ -298,10 +299,12 @@ struct kvmppc_vcore {
298 u64 stolen_tb; 299 u64 stolen_tb;
299 u64 preempt_tb; 300 u64 preempt_tb;
300 struct kvm_vcpu *runner; 301 struct kvm_vcpu *runner;
302 struct kvm *kvm;
301 u64 tb_offset; /* guest timebase - host timebase */ 303 u64 tb_offset; /* guest timebase - host timebase */
302 ulong lpcr; 304 ulong lpcr;
303 u32 arch_compat; 305 u32 arch_compat;
304 ulong pcr; 306 ulong pcr;
307 ulong dpdes; /* doorbell state (POWER8) */
305}; 308};
306 309
307#define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff) 310#define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff)
@@ -410,8 +413,7 @@ struct kvm_vcpu_arch {
410 413
411 ulong gpr[32]; 414 ulong gpr[32];
412 415
413 u64 fpr[32]; 416 struct thread_fp_state fp;
414 u64 fpscr;
415 417
416#ifdef CONFIG_SPE 418#ifdef CONFIG_SPE
417 ulong evr[32]; 419 ulong evr[32];
@@ -420,12 +422,7 @@ struct kvm_vcpu_arch {
420 u64 acc; 422 u64 acc;
421#endif 423#endif
422#ifdef CONFIG_ALTIVEC 424#ifdef CONFIG_ALTIVEC
423 vector128 vr[32]; 425 struct thread_vr_state vr;
424 vector128 vscr;
425#endif
426
427#ifdef CONFIG_VSX
428 u64 vsr[64];
429#endif 426#endif
430 427
431#ifdef CONFIG_KVM_BOOKE_HV 428#ifdef CONFIG_KVM_BOOKE_HV
@@ -452,6 +449,7 @@ struct kvm_vcpu_arch {
452 ulong pc; 449 ulong pc;
453 ulong ctr; 450 ulong ctr;
454 ulong lr; 451 ulong lr;
452 ulong tar;
455 453
456 ulong xer; 454 ulong xer;
457 u32 cr; 455 u32 cr;
@@ -461,13 +459,30 @@ struct kvm_vcpu_arch {
461 ulong guest_owned_ext; 459 ulong guest_owned_ext;
462 ulong purr; 460 ulong purr;
463 ulong spurr; 461 ulong spurr;
462 ulong ic;
463 ulong vtb;
464 ulong dscr; 464 ulong dscr;
465 ulong amr; 465 ulong amr;
466 ulong uamor; 466 ulong uamor;
467 ulong iamr;
467 u32 ctrl; 468 u32 ctrl;
469 u32 dabrx;
468 ulong dabr; 470 ulong dabr;
471 ulong dawr;
472 ulong dawrx;
473 ulong ciabr;
469 ulong cfar; 474 ulong cfar;
470 ulong ppr; 475 ulong ppr;
476 ulong pspb;
477 ulong fscr;
478 ulong ebbhr;
479 ulong ebbrr;
480 ulong bescr;
481 ulong csigr;
482 ulong tacr;
483 ulong tcscr;
484 ulong acop;
485 ulong wort;
471 ulong shadow_srr1; 486 ulong shadow_srr1;
472#endif 487#endif
473 u32 vrsave; /* also USPRG0 */ 488 u32 vrsave; /* also USPRG0 */
@@ -502,10 +517,33 @@ struct kvm_vcpu_arch {
502 u32 ccr1; 517 u32 ccr1;
503 u32 dbsr; 518 u32 dbsr;
504 519
505 u64 mmcr[3]; 520 u64 mmcr[5];
506 u32 pmc[8]; 521 u32 pmc[8];
522 u32 spmc[2];
507 u64 siar; 523 u64 siar;
508 u64 sdar; 524 u64 sdar;
525 u64 sier;
526#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
527 u64 tfhar;
528 u64 texasr;
529 u64 tfiar;
530
531 u32 cr_tm;
532 u64 lr_tm;
533 u64 ctr_tm;
534 u64 amr_tm;
535 u64 ppr_tm;
536 u64 dscr_tm;
537 u64 tar_tm;
538
539 ulong gpr_tm[32];
540
541 struct thread_fp_state fp_tm;
542
543 struct thread_vr_state vr_tm;
544 u32 vrsave_tm; /* also USPRG0 */
545
546#endif
509 547
510#ifdef CONFIG_KVM_EXIT_TIMING 548#ifdef CONFIG_KVM_EXIT_TIMING
511 struct mutex exit_timing_lock; 549 struct mutex exit_timing_lock;
@@ -546,6 +584,7 @@ struct kvm_vcpu_arch {
546#endif 584#endif
547 gpa_t paddr_accessed; 585 gpa_t paddr_accessed;
548 gva_t vaddr_accessed; 586 gva_t vaddr_accessed;
587 pgd_t *pgdir;
549 588
550 u8 io_gpr; /* GPR used as IO source/target */ 589 u8 io_gpr; /* GPR used as IO source/target */
551 u8 mmio_is_bigendian; 590 u8 mmio_is_bigendian;
@@ -603,7 +642,6 @@ struct kvm_vcpu_arch {
603 struct list_head run_list; 642 struct list_head run_list;
604 struct task_struct *run_task; 643 struct task_struct *run_task;
605 struct kvm_run *kvm_run; 644 struct kvm_run *kvm_run;
606 pgd_t *pgdir;
607 645
608 spinlock_t vpa_update_lock; 646 spinlock_t vpa_update_lock;
609 struct kvmppc_vpa vpa; 647 struct kvmppc_vpa vpa;
@@ -616,9 +654,12 @@ struct kvm_vcpu_arch {
616 spinlock_t tbacct_lock; 654 spinlock_t tbacct_lock;
617 u64 busy_stolen; 655 u64 busy_stolen;
618 u64 busy_preempt; 656 u64 busy_preempt;
657 unsigned long intr_msr;
619#endif 658#endif
620}; 659};
621 660
661#define VCPU_FPR(vcpu, i) (vcpu)->arch.fp.fpr[i][TS_FPROFFSET]
662
622/* Values for vcpu->arch.state */ 663/* Values for vcpu->arch.state */
623#define KVMPPC_VCPU_NOTREADY 0 664#define KVMPPC_VCPU_NOTREADY 0
624#define KVMPPC_VCPU_RUNNABLE 1 665#define KVMPPC_VCPU_RUNNABLE 1
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 2b119654b4c1..336a91acb8b1 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -39,10 +39,6 @@ static inline int kvm_para_available(void)
39 return 1; 39 return 1;
40} 40}
41 41
42extern unsigned long kvm_hypercall(unsigned long *in,
43 unsigned long *out,
44 unsigned long nr);
45
46#else 42#else
47 43
48static inline int kvm_para_available(void) 44static inline int kvm_para_available(void)
@@ -50,82 +46,8 @@ static inline int kvm_para_available(void)
50 return 0; 46 return 0;
51} 47}
52 48
53static unsigned long kvm_hypercall(unsigned long *in,
54 unsigned long *out,
55 unsigned long nr)
56{
57 return EV_UNIMPLEMENTED;
58}
59
60#endif 49#endif
61 50
62static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2)
63{
64 unsigned long in[8];
65 unsigned long out[8];
66 unsigned long r;
67
68 r = kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
69 *r2 = out[0];
70
71 return r;
72}
73
74static inline long kvm_hypercall0(unsigned int nr)
75{
76 unsigned long in[8];
77 unsigned long out[8];
78
79 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
80}
81
82static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
83{
84 unsigned long in[8];
85 unsigned long out[8];
86
87 in[0] = p1;
88 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
89}
90
91static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
92 unsigned long p2)
93{
94 unsigned long in[8];
95 unsigned long out[8];
96
97 in[0] = p1;
98 in[1] = p2;
99 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
100}
101
102static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
103 unsigned long p2, unsigned long p3)
104{
105 unsigned long in[8];
106 unsigned long out[8];
107
108 in[0] = p1;
109 in[1] = p2;
110 in[2] = p3;
111 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
112}
113
114static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
115 unsigned long p2, unsigned long p3,
116 unsigned long p4)
117{
118 unsigned long in[8];
119 unsigned long out[8];
120
121 in[0] = p1;
122 in[1] = p2;
123 in[2] = p3;
124 in[3] = p4;
125 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
126}
127
128
129static inline unsigned int kvm_arch_para_features(void) 51static inline unsigned int kvm_arch_para_features(void)
130{ 52{
131 unsigned long r; 53 unsigned long r;
@@ -133,7 +55,7 @@ static inline unsigned int kvm_arch_para_features(void)
133 if (!kvm_para_available()) 55 if (!kvm_para_available())
134 return 0; 56 return 0;
135 57
136 if(kvm_hypercall0_1(KVM_HC_FEATURES, &r)) 58 if(epapr_hypercall0_1(KVM_HCALL_TOKEN(KVM_HC_FEATURES), &r))
137 return 0; 59 return 0;
138 60
139 return r; 61 return r;
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index c8317fbf92c4..fcd53f0d34ba 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -54,12 +54,13 @@ extern void kvmppc_handler_highmem(void);
54extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu); 54extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu);
55extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, 55extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
56 unsigned int rt, unsigned int bytes, 56 unsigned int rt, unsigned int bytes,
57 int is_bigendian); 57 int is_default_endian);
58extern int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu, 58extern int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
59 unsigned int rt, unsigned int bytes, 59 unsigned int rt, unsigned int bytes,
60 int is_bigendian); 60 int is_default_endian);
61extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu, 61extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
62 u64 val, unsigned int bytes, int is_bigendian); 62 u64 val, unsigned int bytes,
63 int is_default_endian);
63 64
64extern int kvmppc_emulate_instruction(struct kvm_run *run, 65extern int kvmppc_emulate_instruction(struct kvm_run *run,
65 struct kvm_vcpu *vcpu); 66 struct kvm_vcpu *vcpu);
@@ -455,6 +456,12 @@ static inline void kvmppc_fix_ee_before_entry(void)
455 trace_hardirqs_on(); 456 trace_hardirqs_on();
456 457
457#ifdef CONFIG_PPC64 458#ifdef CONFIG_PPC64
459 /*
460 * To avoid races, the caller must have gone directly from having
461 * interrupts fully-enabled to hard-disabled.
462 */
463 WARN_ON(local_paca->irq_happened != PACA_IRQ_HARD_DIS);
464
458 /* Only need to enable IRQs by hard enabling them after this */ 465 /* Only need to enable IRQs by hard enabling them after this */
459 local_paca->irq_happened = 0; 466 local_paca->irq_happened = 0;
460 local_paca->soft_enabled = 1; 467 local_paca->soft_enabled = 1;
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
index 844c28de7ec0..d0a2a2f99564 100644
--- a/arch/powerpc/include/asm/lppaca.h
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -132,8 +132,6 @@ struct slb_shadow {
132 } save_area[SLB_NUM_BOLTED]; 132 } save_area[SLB_NUM_BOLTED];
133} ____cacheline_aligned; 133} ____cacheline_aligned;
134 134
135extern struct slb_shadow slb_shadow[];
136
137/* 135/*
138 * Layout of entries in the hypervisor's dispatch trace log buffer. 136 * Layout of entries in the hypervisor's dispatch trace log buffer.
139 */ 137 */
diff --git a/arch/powerpc/include/asm/mce.h b/arch/powerpc/include/asm/mce.h
new file mode 100644
index 000000000000..8e99edf6d966
--- /dev/null
+++ b/arch/powerpc/include/asm/mce.h
@@ -0,0 +1,197 @@
1/*
2 * Machine check exception header file.
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 2013 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20 */
21
22#ifndef __ASM_PPC64_MCE_H__
23#define __ASM_PPC64_MCE_H__
24
25#include <linux/bitops.h>
26
27/*
28 * Machine Check bits on power7 and power8
29 */
30#define P7_SRR1_MC_LOADSTORE(srr1) ((srr1) & PPC_BIT(42)) /* P8 too */
31
32/* SRR1 bits for machine check (On Power7 and Power8) */
33#define P7_SRR1_MC_IFETCH(srr1) ((srr1) & PPC_BITMASK(43, 45)) /* P8 too */
34
35#define P7_SRR1_MC_IFETCH_UE (0x1 << PPC_BITLSHIFT(45)) /* P8 too */
36#define P7_SRR1_MC_IFETCH_SLB_PARITY (0x2 << PPC_BITLSHIFT(45)) /* P8 too */
37#define P7_SRR1_MC_IFETCH_SLB_MULTIHIT (0x3 << PPC_BITLSHIFT(45)) /* P8 too */
38#define P7_SRR1_MC_IFETCH_SLB_BOTH (0x4 << PPC_BITLSHIFT(45))
39#define P7_SRR1_MC_IFETCH_TLB_MULTIHIT (0x5 << PPC_BITLSHIFT(45)) /* P8 too */
40#define P7_SRR1_MC_IFETCH_UE_TLB_RELOAD (0x6 << PPC_BITLSHIFT(45)) /* P8 too */
41#define P7_SRR1_MC_IFETCH_UE_IFU_INTERNAL (0x7 << PPC_BITLSHIFT(45))
42
43/* SRR1 bits for machine check (On Power8) */
44#define P8_SRR1_MC_IFETCH_ERAT_MULTIHIT (0x4 << PPC_BITLSHIFT(45))
45
46/* DSISR bits for machine check (On Power7 and Power8) */
47#define P7_DSISR_MC_UE (PPC_BIT(48)) /* P8 too */
48#define P7_DSISR_MC_UE_TABLEWALK (PPC_BIT(49)) /* P8 too */
49#define P7_DSISR_MC_ERAT_MULTIHIT (PPC_BIT(52)) /* P8 too */
50#define P7_DSISR_MC_TLB_MULTIHIT_MFTLB (PPC_BIT(53)) /* P8 too */
51#define P7_DSISR_MC_SLB_PARITY_MFSLB (PPC_BIT(55)) /* P8 too */
52#define P7_DSISR_MC_SLB_MULTIHIT (PPC_BIT(56)) /* P8 too */
53#define P7_DSISR_MC_SLB_MULTIHIT_PARITY (PPC_BIT(57)) /* P8 too */
54
55/*
56 * DSISR bits for machine check (Power8) in addition to above.
57 * Secondary DERAT Multihit
58 */
59#define P8_DSISR_MC_ERAT_MULTIHIT_SEC (PPC_BIT(54))
60
61/* SLB error bits */
62#define P7_DSISR_MC_SLB_ERRORS (P7_DSISR_MC_ERAT_MULTIHIT | \
63 P7_DSISR_MC_SLB_PARITY_MFSLB | \
64 P7_DSISR_MC_SLB_MULTIHIT | \
65 P7_DSISR_MC_SLB_MULTIHIT_PARITY)
66
67#define P8_DSISR_MC_SLB_ERRORS (P7_DSISR_MC_SLB_ERRORS | \
68 P8_DSISR_MC_ERAT_MULTIHIT_SEC)
69enum MCE_Version {
70 MCE_V1 = 1,
71};
72
73enum MCE_Severity {
74 MCE_SEV_NO_ERROR = 0,
75 MCE_SEV_WARNING = 1,
76 MCE_SEV_ERROR_SYNC = 2,
77 MCE_SEV_FATAL = 3,
78};
79
80enum MCE_Disposition {
81 MCE_DISPOSITION_RECOVERED = 0,
82 MCE_DISPOSITION_NOT_RECOVERED = 1,
83};
84
85enum MCE_Initiator {
86 MCE_INITIATOR_UNKNOWN = 0,
87 MCE_INITIATOR_CPU = 1,
88};
89
90enum MCE_ErrorType {
91 MCE_ERROR_TYPE_UNKNOWN = 0,
92 MCE_ERROR_TYPE_UE = 1,
93 MCE_ERROR_TYPE_SLB = 2,
94 MCE_ERROR_TYPE_ERAT = 3,
95 MCE_ERROR_TYPE_TLB = 4,
96};
97
98enum MCE_UeErrorType {
99 MCE_UE_ERROR_INDETERMINATE = 0,
100 MCE_UE_ERROR_IFETCH = 1,
101 MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
102 MCE_UE_ERROR_LOAD_STORE = 3,
103 MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4,
104};
105
106enum MCE_SlbErrorType {
107 MCE_SLB_ERROR_INDETERMINATE = 0,
108 MCE_SLB_ERROR_PARITY = 1,
109 MCE_SLB_ERROR_MULTIHIT = 2,
110};
111
112enum MCE_EratErrorType {
113 MCE_ERAT_ERROR_INDETERMINATE = 0,
114 MCE_ERAT_ERROR_PARITY = 1,
115 MCE_ERAT_ERROR_MULTIHIT = 2,
116};
117
118enum MCE_TlbErrorType {
119 MCE_TLB_ERROR_INDETERMINATE = 0,
120 MCE_TLB_ERROR_PARITY = 1,
121 MCE_TLB_ERROR_MULTIHIT = 2,
122};
123
124struct machine_check_event {
125 enum MCE_Version version:8; /* 0x00 */
126 uint8_t in_use; /* 0x01 */
127 enum MCE_Severity severity:8; /* 0x02 */
128 enum MCE_Initiator initiator:8; /* 0x03 */
129 enum MCE_ErrorType error_type:8; /* 0x04 */
130 enum MCE_Disposition disposition:8; /* 0x05 */
131 uint8_t reserved_1[2]; /* 0x06 */
132 uint64_t gpr3; /* 0x08 */
133 uint64_t srr0; /* 0x10 */
134 uint64_t srr1; /* 0x18 */
135 union { /* 0x20 */
136 struct {
137 enum MCE_UeErrorType ue_error_type:8;
138 uint8_t effective_address_provided;
139 uint8_t physical_address_provided;
140 uint8_t reserved_1[5];
141 uint64_t effective_address;
142 uint64_t physical_address;
143 uint8_t reserved_2[8];
144 } ue_error;
145
146 struct {
147 enum MCE_SlbErrorType slb_error_type:8;
148 uint8_t effective_address_provided;
149 uint8_t reserved_1[6];
150 uint64_t effective_address;
151 uint8_t reserved_2[16];
152 } slb_error;
153
154 struct {
155 enum MCE_EratErrorType erat_error_type:8;
156 uint8_t effective_address_provided;
157 uint8_t reserved_1[6];
158 uint64_t effective_address;
159 uint8_t reserved_2[16];
160 } erat_error;
161
162 struct {
163 enum MCE_TlbErrorType tlb_error_type:8;
164 uint8_t effective_address_provided;
165 uint8_t reserved_1[6];
166 uint64_t effective_address;
167 uint8_t reserved_2[16];
168 } tlb_error;
169 } u;
170};
171
172struct mce_error_info {
173 enum MCE_ErrorType error_type:8;
174 union {
175 enum MCE_UeErrorType ue_error_type:8;
176 enum MCE_SlbErrorType slb_error_type:8;
177 enum MCE_EratErrorType erat_error_type:8;
178 enum MCE_TlbErrorType tlb_error_type:8;
179 } u;
180 uint8_t reserved[2];
181};
182
183#define MAX_MC_EVT 100
184
185/* Release flags for get_mce_event() */
186#define MCE_EVENT_RELEASE true
187#define MCE_EVENT_DONTRELEASE false
188
189extern void save_mce_event(struct pt_regs *regs, long handled,
190 struct mce_error_info *mce_err, uint64_t addr);
191extern int get_mce_event(struct machine_check_event *mce, bool release);
192extern void release_mce_event(void);
193extern void machine_check_queue_event(void);
194extern void machine_check_print_event_info(struct machine_check_event *evt);
195extern uint64_t get_mce_fault_addr(struct machine_check_event *evt);
196
197#endif /* __ASM_PPC64_MCE_H__ */
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h
index 936db360790a..89b785d16846 100644
--- a/arch/powerpc/include/asm/mmu-book3e.h
+++ b/arch/powerpc/include/asm/mmu-book3e.h
@@ -286,8 +286,21 @@ static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
286extern int mmu_linear_psize; 286extern int mmu_linear_psize;
287extern int mmu_vmemmap_psize; 287extern int mmu_vmemmap_psize;
288 288
289struct tlb_core_data {
290 /* For software way selection, as on Freescale TLB1 */
291 u8 esel_next, esel_max, esel_first;
292
293 /* Per-core spinlock for e6500 TLB handlers (no tlbsrx.) */
294 u8 lock;
295};
296
289#ifdef CONFIG_PPC64 297#ifdef CONFIG_PPC64
290extern unsigned long linear_map_top; 298extern unsigned long linear_map_top;
299extern int book3e_htw_mode;
300
301#define PPC_HTW_NONE 0
302#define PPC_HTW_IBM 1
303#define PPC_HTW_E6500 2
291 304
292/* 305/*
293 * 64-bit booke platforms don't load the tlb in the tlb miss handler code. 306 * 64-bit booke platforms don't load the tlb in the tlb miss handler code.
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 691fd8aca939..f8d1d6dcf7db 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -180,16 +180,17 @@ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
180#define MMU_PAGE_64K_AP 3 /* "Admixed pages" (hash64 only) */ 180#define MMU_PAGE_64K_AP 3 /* "Admixed pages" (hash64 only) */
181#define MMU_PAGE_256K 4 181#define MMU_PAGE_256K 4
182#define MMU_PAGE_1M 5 182#define MMU_PAGE_1M 5
183#define MMU_PAGE_4M 6 183#define MMU_PAGE_2M 6
184#define MMU_PAGE_8M 7 184#define MMU_PAGE_4M 7
185#define MMU_PAGE_16M 8 185#define MMU_PAGE_8M 8
186#define MMU_PAGE_64M 9 186#define MMU_PAGE_16M 9
187#define MMU_PAGE_256M 10 187#define MMU_PAGE_64M 10
188#define MMU_PAGE_1G 11 188#define MMU_PAGE_256M 11
189#define MMU_PAGE_16G 12 189#define MMU_PAGE_1G 12
190#define MMU_PAGE_64G 13 190#define MMU_PAGE_16G 13
191 191#define MMU_PAGE_64G 14
192#define MMU_PAGE_COUNT 14 192
193#define MMU_PAGE_COUNT 15
193 194
194#if defined(CONFIG_PPC_STD_MMU_64) 195#if defined(CONFIG_PPC_STD_MMU_64)
195/* 64-bit classic hash table MMU */ 196/* 64-bit classic hash table MMU */
diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
index 887d3d6133e3..4a69cd1d5041 100644
--- a/arch/powerpc/include/asm/mpc5121.h
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -37,7 +37,12 @@ struct mpc512x_ccm {
37 u32 cccr; /* CFM Clock Control Register */ 37 u32 cccr; /* CFM Clock Control Register */
38 u32 dccr; /* DIU Clock Control Register */ 38 u32 dccr; /* DIU Clock Control Register */
39 u32 mscan_ccr[4]; /* MSCAN Clock Control Registers */ 39 u32 mscan_ccr[4]; /* MSCAN Clock Control Registers */
40 u8 res[0x98]; /* Reserved */ 40 u32 out_ccr[4]; /* OUT CLK Configure Registers */
41 u32 rsv0[2]; /* Reserved */
42 u32 scfr3; /* System Clock Frequency Register 3 */
43 u32 rsv1[3]; /* Reserved */
44 u32 spll_lock_cnt; /* System PLL Lock Counter */
45 u8 res[0x6c]; /* Reserved */
41}; 46};
42 47
43/* 48/*
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 7bdcf340016c..40157e2ca691 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -33,6 +33,28 @@ struct opal_takeover_args {
33 u64 rd_loc; /* r11 */ 33 u64 rd_loc; /* r11 */
34}; 34};
35 35
36/*
37 * SG entry
38 *
39 * WARNING: The current implementation requires each entry
40 * to represent a block that is 4k aligned *and* each block
41 * size except the last one in the list to be as well.
42 */
43struct opal_sg_entry {
44 void *data;
45 long length;
46};
47
48/* sg list */
49struct opal_sg_list {
50 unsigned long num_entries;
51 struct opal_sg_list *next;
52 struct opal_sg_entry entry[];
53};
54
55/* We calculate number of sg entries based on PAGE_SIZE */
56#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
57
36extern long opal_query_takeover(u64 *hal_size, u64 *hal_align); 58extern long opal_query_takeover(u64 *hal_size, u64 *hal_align);
37 59
38extern long opal_do_takeover(struct opal_takeover_args *args); 60extern long opal_do_takeover(struct opal_takeover_args *args);
@@ -132,6 +154,9 @@ extern int opal_enter_rtas(struct rtas_args *args,
132#define OPAL_FLASH_VALIDATE 76 154#define OPAL_FLASH_VALIDATE 76
133#define OPAL_FLASH_MANAGE 77 155#define OPAL_FLASH_MANAGE 77
134#define OPAL_FLASH_UPDATE 78 156#define OPAL_FLASH_UPDATE 78
157#define OPAL_GET_MSG 85
158#define OPAL_CHECK_ASYNC_COMPLETION 86
159#define OPAL_SYNC_HOST_REBOOT 87
135 160
136#ifndef __ASSEMBLY__ 161#ifndef __ASSEMBLY__
137 162
@@ -211,7 +236,16 @@ enum OpalPendingState {
211 OPAL_EVENT_ERROR_LOG = 0x40, 236 OPAL_EVENT_ERROR_LOG = 0x40,
212 OPAL_EVENT_EPOW = 0x80, 237 OPAL_EVENT_EPOW = 0x80,
213 OPAL_EVENT_LED_STATUS = 0x100, 238 OPAL_EVENT_LED_STATUS = 0x100,
214 OPAL_EVENT_PCI_ERROR = 0x200 239 OPAL_EVENT_PCI_ERROR = 0x200,
240 OPAL_EVENT_MSG_PENDING = 0x800,
241};
242
243enum OpalMessageType {
244 OPAL_MSG_ASYNC_COMP = 0,
245 OPAL_MSG_MEM_ERR,
246 OPAL_MSG_EPOW,
247 OPAL_MSG_SHUTDOWN,
248 OPAL_MSG_TYPE_MAX,
215}; 249};
216 250
217/* Machine check related definitions */ 251/* Machine check related definitions */
@@ -311,12 +345,16 @@ enum OpalMveEnableAction {
311 OPAL_ENABLE_MVE = 1 345 OPAL_ENABLE_MVE = 1
312}; 346};
313 347
314enum OpalPciResetAndReinitScope { 348enum OpalPciResetScope {
315 OPAL_PHB_COMPLETE = 1, OPAL_PCI_LINK = 2, OPAL_PHB_ERROR = 3, 349 OPAL_PHB_COMPLETE = 1, OPAL_PCI_LINK = 2, OPAL_PHB_ERROR = 3,
316 OPAL_PCI_HOT_RESET = 4, OPAL_PCI_FUNDAMENTAL_RESET = 5, 350 OPAL_PCI_HOT_RESET = 4, OPAL_PCI_FUNDAMENTAL_RESET = 5,
317 OPAL_PCI_IODA_TABLE_RESET = 6, 351 OPAL_PCI_IODA_TABLE_RESET = 6,
318}; 352};
319 353
354enum OpalPciReinitScope {
355 OPAL_REINIT_PCI_DEV = 1000
356};
357
320enum OpalPciResetState { 358enum OpalPciResetState {
321 OPAL_DEASSERT_RESET = 0, 359 OPAL_DEASSERT_RESET = 0,
322 OPAL_ASSERT_RESET = 1 360 OPAL_ASSERT_RESET = 1
@@ -356,6 +394,12 @@ enum OpalLPCAddressType {
356 OPAL_LPC_FW = 2, 394 OPAL_LPC_FW = 2,
357}; 395};
358 396
397struct opal_msg {
398 uint32_t msg_type;
399 uint32_t reserved;
400 uint64_t params[8];
401};
402
359struct opal_machine_check_event { 403struct opal_machine_check_event {
360 enum OpalMCE_Version version:8; /* 0x00 */ 404 enum OpalMCE_Version version:8; /* 0x00 */
361 uint8_t in_use; /* 0x01 */ 405 uint8_t in_use; /* 0x01 */
@@ -404,6 +448,58 @@ struct opal_machine_check_event {
404 } u; 448 } u;
405}; 449};
406 450
451/* FSP memory errors handling */
452enum OpalMemErr_Version {
453 OpalMemErr_V1 = 1,
454};
455
456enum OpalMemErrType {
457 OPAL_MEM_ERR_TYPE_RESILIENCE = 0,
458 OPAL_MEM_ERR_TYPE_DYN_DALLOC,
459 OPAL_MEM_ERR_TYPE_SCRUB,
460};
461
462/* Memory Reilience error type */
463enum OpalMemErr_ResilErrType {
464 OPAL_MEM_RESILIENCE_CE = 0,
465 OPAL_MEM_RESILIENCE_UE,
466 OPAL_MEM_RESILIENCE_UE_SCRUB,
467};
468
469/* Dynamic Memory Deallocation type */
470enum OpalMemErr_DynErrType {
471 OPAL_MEM_DYNAMIC_DEALLOC = 0,
472};
473
474/* OpalMemoryErrorData->flags */
475#define OPAL_MEM_CORRECTED_ERROR 0x0001
476#define OPAL_MEM_THRESHOLD_EXCEEDED 0x0002
477#define OPAL_MEM_ACK_REQUIRED 0x8000
478
479struct OpalMemoryErrorData {
480 enum OpalMemErr_Version version:8; /* 0x00 */
481 enum OpalMemErrType type:8; /* 0x01 */
482 uint16_t flags; /* 0x02 */
483 uint8_t reserved_1[4]; /* 0x04 */
484
485 union {
486 /* Memory Resilience corrected/uncorrected error info */
487 struct {
488 enum OpalMemErr_ResilErrType resil_err_type:8;
489 uint8_t reserved_1[7];
490 uint64_t physical_address_start;
491 uint64_t physical_address_end;
492 } resilience;
493 /* Dynamic memory deallocation error info */
494 struct {
495 enum OpalMemErr_DynErrType dyn_err_type:8;
496 uint8_t reserved_1[7];
497 uint64_t physical_address_start;
498 uint64_t physical_address_end;
499 } dyn_dealloc;
500 } u;
501};
502
407enum { 503enum {
408 OPAL_P7IOC_DIAG_TYPE_NONE = 0, 504 OPAL_P7IOC_DIAG_TYPE_NONE = 0,
409 OPAL_P7IOC_DIAG_TYPE_RGC = 1, 505 OPAL_P7IOC_DIAG_TYPE_RGC = 1,
@@ -710,7 +806,7 @@ int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer,
710int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer, 806int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer,
711 uint64_t diag_buffer_len); 807 uint64_t diag_buffer_len);
712int64_t opal_pci_fence_phb(uint64_t phb_id); 808int64_t opal_pci_fence_phb(uint64_t phb_id);
713int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope); 809int64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data);
714int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); 810int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action);
715int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); 811int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action);
716int64_t opal_get_epow_status(__be64 *status); 812int64_t opal_get_epow_status(__be64 *status);
@@ -731,6 +827,10 @@ int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result);
731int64_t opal_manage_flash(uint8_t op); 827int64_t opal_manage_flash(uint8_t op);
732int64_t opal_update_flash(uint64_t blk_list); 828int64_t opal_update_flash(uint64_t blk_list);
733 829
830int64_t opal_get_msg(uint64_t buffer, size_t size);
831int64_t opal_check_completion(uint64_t buffer, size_t size, uint64_t token);
832int64_t opal_sync_host_reboot(void);
833
734/* Internal functions */ 834/* Internal functions */
735extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); 835extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
736 836
@@ -744,6 +844,8 @@ extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
744 int depth, void *data); 844 int depth, void *data);
745 845
746extern int opal_notifier_register(struct notifier_block *nb); 846extern int opal_notifier_register(struct notifier_block *nb);
847extern int opal_message_notifier_register(enum OpalMessageType msg_type,
848 struct notifier_block *nb);
747extern void opal_notifier_enable(void); 849extern void opal_notifier_enable(void);
748extern void opal_notifier_disable(void); 850extern void opal_notifier_disable(void);
749extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val); 851extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val);
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index b6ea9e068c13..9c5dbc3833fb 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -16,7 +16,6 @@
16 16
17#ifdef CONFIG_PPC64 17#ifdef CONFIG_PPC64
18 18
19#include <linux/init.h>
20#include <asm/types.h> 19#include <asm/types.h>
21#include <asm/lppaca.h> 20#include <asm/lppaca.h>
22#include <asm/mmu.h> 21#include <asm/mmu.h>
@@ -113,6 +112,10 @@ struct paca_struct {
113 /* Keep pgd in the same cacheline as the start of extlb */ 112 /* Keep pgd in the same cacheline as the start of extlb */
114 pgd_t *pgd __attribute__((aligned(0x80))); /* Current PGD */ 113 pgd_t *pgd __attribute__((aligned(0x80))); /* Current PGD */
115 pgd_t *kernel_pgd; /* Kernel PGD */ 114 pgd_t *kernel_pgd; /* Kernel PGD */
115
116 /* Shared by all threads of a core -- points to tcd of first thread */
117 struct tlb_core_data *tcd_ptr;
118
116 /* We can have up to 3 levels of reentrancy in the TLB miss handler */ 119 /* We can have up to 3 levels of reentrancy in the TLB miss handler */
117 u64 extlb[3][EX_TLB_SIZE / sizeof(u64)]; 120 u64 extlb[3][EX_TLB_SIZE / sizeof(u64)];
118 u64 exmc[8]; /* used for machine checks */ 121 u64 exmc[8]; /* used for machine checks */
@@ -123,6 +126,8 @@ struct paca_struct {
123 void *mc_kstack; 126 void *mc_kstack;
124 void *crit_kstack; 127 void *crit_kstack;
125 void *dbg_kstack; 128 void *dbg_kstack;
129
130 struct tlb_core_data tcd;
126#endif /* CONFIG_PPC_BOOK3E */ 131#endif /* CONFIG_PPC_BOOK3E */
127 132
128 mm_context_t context; 133 mm_context_t context;
@@ -152,6 +157,15 @@ struct paca_struct {
152 */ 157 */
153 struct opal_machine_check_event *opal_mc_evt; 158 struct opal_machine_check_event *opal_mc_evt;
154#endif 159#endif
160#ifdef CONFIG_PPC_BOOK3S_64
161 /* Exclusive emergency stack pointer for machine check exception. */
162 void *mc_emergency_sp;
163 /*
164 * Flag to check whether we are in machine check early handler
165 * and already using emergency stack.
166 */
167 u16 in_mce;
168#endif
155 169
156 /* Stuff for accurate time accounting */ 170 /* Stuff for accurate time accounting */
157 u64 user_time; /* accumulated usermode TB ticks */ 171 u64 user_time; /* accumulated usermode TB ticks */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 4a191c472867..bc141c950b1e 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -558,5 +558,19 @@ extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
558#define __HAVE_ARCH_PMDP_INVALIDATE 558#define __HAVE_ARCH_PMDP_INVALIDATE
559extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, 559extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
560 pmd_t *pmdp); 560 pmd_t *pmdp);
561
562#define pmd_move_must_withdraw pmd_move_must_withdraw
563struct spinlock;
564static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
565 struct spinlock *old_pmd_ptl)
566{
567 /*
568 * Archs like ppc64 use pgtable to store per pmd
569 * specific information. So when we switch the pmd,
570 * we should also withdraw and deposit the pgtable
571 */
572 return true;
573}
574
561#endif /* __ASSEMBLY__ */ 575#endif /* __ASSEMBLY__ */
562#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ 576#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 7d6eacf249cf..f83b6f3e1b39 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -3,6 +3,7 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6#include <linux/mmdebug.h>
6#include <asm/processor.h> /* For TASK_SIZE */ 7#include <asm/processor.h> /* For TASK_SIZE */
7#include <asm/mmu.h> 8#include <asm/mmu.h>
8#include <asm/page.h> 9#include <asm/page.h>
@@ -33,10 +34,73 @@ static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
33static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 34static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
34static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 35static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
35static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } 36static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
36static inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; }
37static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; } 37static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; }
38static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } 38static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); }
39 39
40#ifdef CONFIG_NUMA_BALANCING
41
42static inline int pte_present(pte_t pte)
43{
44 return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA);
45}
46
47#define pte_numa pte_numa
48static inline int pte_numa(pte_t pte)
49{
50 return (pte_val(pte) &
51 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
52}
53
54#define pte_mknonnuma pte_mknonnuma
55static inline pte_t pte_mknonnuma(pte_t pte)
56{
57 pte_val(pte) &= ~_PAGE_NUMA;
58 pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED;
59 return pte;
60}
61
62#define pte_mknuma pte_mknuma
63static inline pte_t pte_mknuma(pte_t pte)
64{
65 /*
66 * We should not set _PAGE_NUMA on non present ptes. Also clear the
67 * present bit so that hash_page will return 1 and we collect this
68 * as numa fault.
69 */
70 if (pte_present(pte)) {
71 pte_val(pte) |= _PAGE_NUMA;
72 pte_val(pte) &= ~_PAGE_PRESENT;
73 } else
74 VM_BUG_ON(1);
75 return pte;
76}
77
78#define pmd_numa pmd_numa
79static inline int pmd_numa(pmd_t pmd)
80{
81 return pte_numa(pmd_pte(pmd));
82}
83
84#define pmd_mknonnuma pmd_mknonnuma
85static inline pmd_t pmd_mknonnuma(pmd_t pmd)
86{
87 return pte_pmd(pte_mknonnuma(pmd_pte(pmd)));
88}
89
90#define pmd_mknuma pmd_mknuma
91static inline pmd_t pmd_mknuma(pmd_t pmd)
92{
93 return pte_pmd(pte_mknuma(pmd_pte(pmd)));
94}
95
96# else
97
98static inline int pte_present(pte_t pte)
99{
100 return pte_val(pte) & _PAGE_PRESENT;
101}
102#endif /* CONFIG_NUMA_BALANCING */
103
40/* Conversion functions: convert a page and protection to a page entry, 104/* Conversion functions: convert a page and protection to a page entry,
41 * and a page entry and page directory to the page they refer to. 105 * and a page entry and page directory to the page they refer to.
42 * 106 *
@@ -223,6 +287,27 @@ extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
223#endif 287#endif
224pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, 288pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
225 unsigned *shift); 289 unsigned *shift);
290
291static inline pte_t *lookup_linux_ptep(pgd_t *pgdir, unsigned long hva,
292 unsigned long *pte_sizep)
293{
294 pte_t *ptep;
295 unsigned long ps = *pte_sizep;
296 unsigned int shift;
297
298 ptep = find_linux_pte_or_hugepte(pgdir, hva, &shift);
299 if (!ptep)
300 return NULL;
301 if (shift)
302 *pte_sizep = 1ul << shift;
303 else
304 *pte_sizep = PAGE_SIZE;
305
306 if (ps > *pte_sizep)
307 return NULL;
308
309 return ptep;
310}
226#endif /* __ASSEMBLY__ */ 311#endif /* __ASSEMBLY__ */
227 312
228#endif /* __KERNEL__ */ 313#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index f595b98079ee..6586a40a46ce 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -4,7 +4,6 @@
4#ifndef _ASM_POWERPC_PPC_ASM_H 4#ifndef _ASM_POWERPC_PPC_ASM_H
5#define _ASM_POWERPC_PPC_ASM_H 5#define _ASM_POWERPC_PPC_ASM_H
6 6
7#include <linux/init.h>
8#include <linux/stringify.h> 7#include <linux/stringify.h>
9#include <asm/asm-compat.h> 8#include <asm/asm-compat.h>
10#include <asm/processor.h> 9#include <asm/processor.h>
@@ -295,6 +294,11 @@ n:
295 * you want to access various offsets within it). On ppc32 this is 294 * you want to access various offsets within it). On ppc32 this is
296 * identical to LOAD_REG_IMMEDIATE. 295 * identical to LOAD_REG_IMMEDIATE.
297 * 296 *
297 * LOAD_REG_ADDR_PIC(rn, name)
298 * Loads the address of label 'name' into register 'run'. Use this when
299 * the kernel doesn't run at the linked or relocated address. Please
300 * note that this macro will clobber the lr register.
301 *
298 * LOAD_REG_ADDRBASE(rn, name) 302 * LOAD_REG_ADDRBASE(rn, name)
299 * ADDROFF(name) 303 * ADDROFF(name)
300 * LOAD_REG_ADDRBASE loads part of the address of label 'name' into 304 * LOAD_REG_ADDRBASE loads part of the address of label 'name' into
@@ -305,6 +309,14 @@ n:
305 * LOAD_REG_ADDRBASE(rX, name) 309 * LOAD_REG_ADDRBASE(rX, name)
306 * ld rY,ADDROFF(name)(rX) 310 * ld rY,ADDROFF(name)(rX)
307 */ 311 */
312
313/* Be careful, this will clobber the lr register. */
314#define LOAD_REG_ADDR_PIC(reg, name) \
315 bl 0f; \
3160: mflr reg; \
317 addis reg,reg,(name - 0b)@ha; \
318 addi reg,reg,(name - 0b)@l;
319
308#ifdef __powerpc64__ 320#ifdef __powerpc64__
309#define LOAD_REG_IMMEDIATE(reg,expr) \ 321#define LOAD_REG_IMMEDIATE(reg,expr) \
310 lis reg,(expr)@highest; \ 322 lis reg,(expr)@highest; \
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index fc14a38c7ccf..b62de43ae5f3 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -256,6 +256,8 @@ struct thread_struct {
256 unsigned long evr[32]; /* upper 32-bits of SPE regs */ 256 unsigned long evr[32]; /* upper 32-bits of SPE regs */
257 u64 acc; /* Accumulator */ 257 u64 acc; /* Accumulator */
258 unsigned long spefscr; /* SPE & eFP status */ 258 unsigned long spefscr; /* SPE & eFP status */
259 unsigned long spefscr_last; /* SPEFSCR value on last prctl
260 call or trap return */
259 int used_spe; /* set if process has used spe */ 261 int used_spe; /* set if process has used spe */
260#endif /* CONFIG_SPE */ 262#endif /* CONFIG_SPE */
261#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 263#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -317,7 +319,9 @@ struct thread_struct {
317 (_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack) 319 (_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack)
318 320
319#ifdef CONFIG_SPE 321#ifdef CONFIG_SPE
320#define SPEFSCR_INIT .spefscr = SPEFSCR_FINVE | SPEFSCR_FDBZE | SPEFSCR_FUNFE | SPEFSCR_FOVFE, 322#define SPEFSCR_INIT \
323 .spefscr = SPEFSCR_FINVE | SPEFSCR_FDBZE | SPEFSCR_FUNFE | SPEFSCR_FOVFE, \
324 .spefscr_last = SPEFSCR_FINVE | SPEFSCR_FDBZE | SPEFSCR_FUNFE | SPEFSCR_FOVFE,
321#else 325#else
322#define SPEFSCR_INIT 326#define SPEFSCR_INIT
323#endif 327#endif
@@ -373,6 +377,8 @@ extern int set_endian(struct task_struct *tsk, unsigned int val);
373extern int get_unalign_ctl(struct task_struct *tsk, unsigned long adr); 377extern int get_unalign_ctl(struct task_struct *tsk, unsigned long adr);
374extern int set_unalign_ctl(struct task_struct *tsk, unsigned int val); 378extern int set_unalign_ctl(struct task_struct *tsk, unsigned int val);
375 379
380extern void fp_enable(void);
381extern void vec_enable(void);
376extern void load_fp_state(struct thread_fp_state *fp); 382extern void load_fp_state(struct thread_fp_state *fp);
377extern void store_fp_state(struct thread_fp_state *fp); 383extern void store_fp_state(struct thread_fp_state *fp);
378extern void load_vr_state(struct thread_vr_state *vr); 384extern void load_vr_state(struct thread_vr_state *vr);
@@ -444,13 +450,6 @@ enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};
444 450
445extern int powersave_nap; /* set if nap mode can be used in idle loop */ 451extern int powersave_nap; /* set if nap mode can be used in idle loop */
446extern void power7_nap(void); 452extern void power7_nap(void);
447
448#ifdef CONFIG_PSERIES_IDLE
449extern void update_smt_snooze_delay(int cpu, int residency);
450#else
451static inline void update_smt_snooze_delay(int cpu, int residency) {}
452#endif
453
454extern void flush_instruction_cache(void); 453extern void flush_instruction_cache(void);
455extern void hard_reset_now(void); 454extern void hard_reset_now(void);
456extern void poweroff_now(void); 455extern void poweroff_now(void);
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index 678a7c1d9cb8..a1bc7e758422 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -21,7 +21,6 @@
21#if !defined(_ASM_POWERPC_PS3_H) 21#if !defined(_ASM_POWERPC_PS3_H)
22#define _ASM_POWERPC_PS3_H 22#define _ASM_POWERPC_PS3_H
23 23
24#include <linux/init.h>
25#include <linux/types.h> 24#include <linux/types.h>
26#include <linux/device.h> 25#include <linux/device.h>
27#include <asm/cell-pmu.h> 26#include <asm/cell-pmu.h>
diff --git a/arch/powerpc/include/asm/pte-hash64.h b/arch/powerpc/include/asm/pte-hash64.h
index 0419eeb53274..2505d8eab15c 100644
--- a/arch/powerpc/include/asm/pte-hash64.h
+++ b/arch/powerpc/include/asm/pte-hash64.h
@@ -19,7 +19,7 @@
19#define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */ 19#define _PAGE_FILE 0x0002 /* (!present only) software: pte holds file offset */
20#define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */ 20#define _PAGE_EXEC 0x0004 /* No execute on POWER4 and newer (we invert) */
21#define _PAGE_GUARDED 0x0008 21#define _PAGE_GUARDED 0x0008
22#define _PAGE_COHERENT 0x0010 /* M: enforce memory coherence (SMP systems) */ 22/* We can derive Memory coherence from _PAGE_NO_CACHE */
23#define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */ 23#define _PAGE_NO_CACHE 0x0020 /* I: cache inhibit */
24#define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */ 24#define _PAGE_WRITETHRU 0x0040 /* W: cache write-through */
25#define _PAGE_DIRTY 0x0080 /* C: page changed */ 25#define _PAGE_DIRTY 0x0080 /* C: page changed */
@@ -27,6 +27,12 @@
27#define _PAGE_RW 0x0200 /* software: user write access allowed */ 27#define _PAGE_RW 0x0200 /* software: user write access allowed */
28#define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ 28#define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */
29 29
30/*
31 * Used for tracking numa faults
32 */
33#define _PAGE_NUMA 0x00000010 /* Gather numa placement stats */
34
35
30/* No separate kernel read-only */ 36/* No separate kernel read-only */
31#define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */ 37#define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */
32#define _PAGE_KERNEL_RO _PAGE_KERNEL_RW 38#define _PAGE_KERNEL_RO _PAGE_KERNEL_RW
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index fa8388ed94c5..90c06ec6eff5 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -223,17 +223,26 @@
223#define CTRL_TE 0x00c00000 /* thread enable */ 223#define CTRL_TE 0x00c00000 /* thread enable */
224#define CTRL_RUNLATCH 0x1 224#define CTRL_RUNLATCH 0x1
225#define SPRN_DAWR 0xB4 225#define SPRN_DAWR 0xB4
226#define SPRN_CIABR 0xBB
227#define CIABR_PRIV 0x3
228#define CIABR_PRIV_USER 1
229#define CIABR_PRIV_SUPER 2
230#define CIABR_PRIV_HYPER 3
226#define SPRN_DAWRX 0xBC 231#define SPRN_DAWRX 0xBC
227#define DAWRX_USER (1UL << 0) 232#define DAWRX_USER __MASK(0)
228#define DAWRX_KERNEL (1UL << 1) 233#define DAWRX_KERNEL __MASK(1)
229#define DAWRX_HYP (1UL << 2) 234#define DAWRX_HYP __MASK(2)
235#define DAWRX_WTI __MASK(3)
236#define DAWRX_WT __MASK(4)
237#define DAWRX_DR __MASK(5)
238#define DAWRX_DW __MASK(6)
230#define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ 239#define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */
231#define SPRN_DABR2 0x13D /* e300 */ 240#define SPRN_DABR2 0x13D /* e300 */
232#define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */ 241#define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */
233#define DABRX_USER (1UL << 0) 242#define DABRX_USER __MASK(0)
234#define DABRX_KERNEL (1UL << 1) 243#define DABRX_KERNEL __MASK(1)
235#define DABRX_HYP (1UL << 2) 244#define DABRX_HYP __MASK(2)
236#define DABRX_BTI (1UL << 3) 245#define DABRX_BTI __MASK(3)
237#define DABRX_ALL (DABRX_BTI | DABRX_HYP | DABRX_KERNEL | DABRX_USER) 246#define DABRX_ALL (DABRX_BTI | DABRX_HYP | DABRX_KERNEL | DABRX_USER)
238#define SPRN_DAR 0x013 /* Data Address Register */ 247#define SPRN_DAR 0x013 /* Data Address Register */
239#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */ 248#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */
@@ -260,6 +269,8 @@
260#define SPRN_HRMOR 0x139 /* Real mode offset register */ 269#define SPRN_HRMOR 0x139 /* Real mode offset register */
261#define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */ 270#define SPRN_HSRR0 0x13A /* Hypervisor Save/Restore 0 */
262#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ 271#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */
272#define SPRN_IC 0x350 /* Virtual Instruction Count */
273#define SPRN_VTB 0x351 /* Virtual Time Base */
263/* HFSCR and FSCR bit numbers are the same */ 274/* HFSCR and FSCR bit numbers are the same */
264#define FSCR_TAR_LG 8 /* Enable Target Address Register */ 275#define FSCR_TAR_LG 8 /* Enable Target Address Register */
265#define FSCR_EBB_LG 7 /* Enable Event Based Branching */ 276#define FSCR_EBB_LG 7 /* Enable Event Based Branching */
@@ -298,9 +309,13 @@
298#define LPCR_RMLS 0x1C000000 /* impl dependent rmo limit sel */ 309#define LPCR_RMLS 0x1C000000 /* impl dependent rmo limit sel */
299#define LPCR_RMLS_SH (63-37) 310#define LPCR_RMLS_SH (63-37)
300#define LPCR_ILE 0x02000000 /* !HV irqs set MSR:LE */ 311#define LPCR_ILE 0x02000000 /* !HV irqs set MSR:LE */
312#define LPCR_AIL 0x01800000 /* Alternate interrupt location */
301#define LPCR_AIL_0 0x00000000 /* MMU off exception offset 0x0 */ 313#define LPCR_AIL_0 0x00000000 /* MMU off exception offset 0x0 */
302#define LPCR_AIL_3 0x01800000 /* MMU on exception offset 0xc00...4xxx */ 314#define LPCR_AIL_3 0x01800000 /* MMU on exception offset 0xc00...4xxx */
303#define LPCR_PECE 0x00007000 /* powersave exit cause enable */ 315#define LPCR_ONL 0x00040000 /* online - PURR/SPURR count */
316#define LPCR_PECE 0x0001f000 /* powersave exit cause enable */
317#define LPCR_PECEDP 0x00010000 /* directed priv dbells cause exit */
318#define LPCR_PECEDH 0x00008000 /* directed hyp dbells cause exit */
304#define LPCR_PECE0 0x00004000 /* ext. exceptions can cause exit */ 319#define LPCR_PECE0 0x00004000 /* ext. exceptions can cause exit */
305#define LPCR_PECE1 0x00002000 /* decrementer can cause exit */ 320#define LPCR_PECE1 0x00002000 /* decrementer can cause exit */
306#define LPCR_PECE2 0x00001000 /* machine check etc can cause exit */ 321#define LPCR_PECE2 0x00001000 /* machine check etc can cause exit */
@@ -322,6 +337,8 @@
322#define SPRN_PCR 0x152 /* Processor compatibility register */ 337#define SPRN_PCR 0x152 /* Processor compatibility register */
323#define PCR_VEC_DIS (1ul << (63-0)) /* Vec. disable (bit NA since POWER8) */ 338#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) */ 339#define PCR_VSX_DIS (1ul << (63-1)) /* VSX disable (bit NA since POWER8) */
340#define PCR_TM_DIS (1ul << (63-2)) /* Trans. memory disable (POWER8) */
341#define PCR_ARCH_206 0x4 /* Architecture 2.06 */
325#define PCR_ARCH_205 0x2 /* Architecture 2.05 */ 342#define PCR_ARCH_205 0x2 /* Architecture 2.05 */
326#define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */ 343#define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */
327#define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */ 344#define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */
@@ -368,6 +385,8 @@
368#define DER_EBRKE 0x00000002 /* External Breakpoint Interrupt */ 385#define DER_EBRKE 0x00000002 /* External Breakpoint Interrupt */
369#define DER_DPIE 0x00000001 /* Dev. Port Nonmaskable Request */ 386#define DER_DPIE 0x00000001 /* Dev. Port Nonmaskable Request */
370#define SPRN_DMISS 0x3D0 /* Data TLB Miss Register */ 387#define SPRN_DMISS 0x3D0 /* Data TLB Miss Register */
388#define SPRN_DHDES 0x0B1 /* Directed Hyp. Doorbell Exc. State */
389#define SPRN_DPDES 0x0B0 /* Directed Priv. Doorbell Exc. State */
371#define SPRN_EAR 0x11A /* External Address Register */ 390#define SPRN_EAR 0x11A /* External Address Register */
372#define SPRN_HASH1 0x3D2 /* Primary Hash Address Register */ 391#define SPRN_HASH1 0x3D2 /* Primary Hash Address Register */
373#define SPRN_HASH2 0x3D3 /* Secondary Hash Address Resgister */ 392#define SPRN_HASH2 0x3D3 /* Secondary Hash Address Resgister */
@@ -427,6 +446,7 @@
427#define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ 446#define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */
428#define SPRN_IABR2 0x3FA /* 83xx */ 447#define SPRN_IABR2 0x3FA /* 83xx */
429#define SPRN_IBCR 0x135 /* 83xx Insn Breakpoint Control Reg */ 448#define SPRN_IBCR 0x135 /* 83xx Insn Breakpoint Control Reg */
449#define SPRN_IAMR 0x03D /* Instr. Authority Mask Reg */
430#define SPRN_HID4 0x3F4 /* 970 HID4 */ 450#define SPRN_HID4 0x3F4 /* 970 HID4 */
431#define HID4_LPES0 (1ul << (63-0)) /* LPAR env. sel. bit 0 */ 451#define HID4_LPES0 (1ul << (63-0)) /* LPAR env. sel. bit 0 */
432#define HID4_RMLS2_SH (63 - 2) /* Real mode limit bottom 2 bits */ 452#define HID4_RMLS2_SH (63 - 2) /* Real mode limit bottom 2 bits */
@@ -541,6 +561,7 @@
541#define SPRN_PIR 0x3FF /* Processor Identification Register */ 561#define SPRN_PIR 0x3FF /* Processor Identification Register */
542#endif 562#endif
543#define SPRN_TIR 0x1BE /* Thread Identification Register */ 563#define SPRN_TIR 0x1BE /* Thread Identification Register */
564#define SPRN_PSPB 0x09F /* Problem State Priority Boost reg */
544#define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */ 565#define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */
545#define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */ 566#define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */
546#define SPRN_PURR 0x135 /* Processor Utilization of Resources Reg */ 567#define SPRN_PURR 0x135 /* Processor Utilization of Resources Reg */
@@ -682,6 +703,7 @@
682#define SPRN_EBBHR 804 /* Event based branch handler register */ 703#define SPRN_EBBHR 804 /* Event based branch handler register */
683#define SPRN_EBBRR 805 /* Event based branch return register */ 704#define SPRN_EBBRR 805 /* Event based branch return register */
684#define SPRN_BESCR 806 /* Branch event status and control register */ 705#define SPRN_BESCR 806 /* Branch event status and control register */
706#define SPRN_WORT 895 /* Workload optimization register - thread */
685 707
686#define SPRN_PMC1 787 708#define SPRN_PMC1 787
687#define SPRN_PMC2 788 709#define SPRN_PMC2 788
@@ -698,6 +720,11 @@
698#define SIER_SIHV 0x1000000 /* Sampled MSR_HV */ 720#define SIER_SIHV 0x1000000 /* Sampled MSR_HV */
699#define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */ 721#define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */
700#define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */ 722#define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */
723#define SPRN_TACR 888
724#define SPRN_TCSCR 889
725#define SPRN_CSIGR 890
726#define SPRN_SPMC1 892
727#define SPRN_SPMC2 893
701 728
702/* When EBB is enabled, some of MMCR0/MMCR2/SIER are user accessible */ 729/* When EBB is enabled, some of MMCR0/MMCR2/SIER are user accessible */
703#define MMCR0_USER_MASK (MMCR0_FC | MMCR0_PMXE | MMCR0_PMAO) 730#define MMCR0_USER_MASK (MMCR0_FC | MMCR0_PMXE | MMCR0_PMAO)
@@ -1075,6 +1102,8 @@
1075#define PVR_8560 0x80200000 1102#define PVR_8560 0x80200000
1076#define PVR_VER_E500V1 0x8020 1103#define PVR_VER_E500V1 0x8020
1077#define PVR_VER_E500V2 0x8021 1104#define PVR_VER_E500V2 0x8021
1105#define PVR_VER_E6500 0x8040
1106
1078/* 1107/*
1079 * For the 8xx processors, all of them report the same PVR family for 1108 * For the 8xx processors, all of them report the same PVR family for
1080 * the PowerPC core. The various versions of these processors must be 1109 * the PowerPC core. The various versions of these processors must be
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 2e31aacd8acc..163c3b05a76e 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -101,6 +101,7 @@
101#define SPRN_IVOR39 0x1B1 /* Interrupt Vector Offset Register 39 */ 101#define SPRN_IVOR39 0x1B1 /* Interrupt Vector Offset Register 39 */
102#define SPRN_IVOR40 0x1B2 /* Interrupt Vector Offset Register 40 */ 102#define SPRN_IVOR40 0x1B2 /* Interrupt Vector Offset Register 40 */
103#define SPRN_IVOR41 0x1B3 /* Interrupt Vector Offset Register 41 */ 103#define SPRN_IVOR41 0x1B3 /* Interrupt Vector Offset Register 41 */
104#define SPRN_IVOR42 0x1B4 /* Interrupt Vector Offset Register 42 */
104#define SPRN_GIVOR2 0x1B8 /* Guest IVOR2 */ 105#define SPRN_GIVOR2 0x1B8 /* Guest IVOR2 */
105#define SPRN_GIVOR3 0x1B9 /* Guest IVOR3 */ 106#define SPRN_GIVOR3 0x1B9 /* Guest IVOR3 */
106#define SPRN_GIVOR4 0x1BA /* Guest IVOR4 */ 107#define SPRN_GIVOR4 0x1BA /* Guest IVOR4 */
@@ -170,6 +171,7 @@
170#define SPRN_L2CSR1 0x3FA /* L2 Data Cache Control and Status Register 1 */ 171#define SPRN_L2CSR1 0x3FA /* L2 Data Cache Control and Status Register 1 */
171#define SPRN_DCCR 0x3FA /* Data Cache Cacheability Register */ 172#define SPRN_DCCR 0x3FA /* Data Cache Cacheability Register */
172#define SPRN_ICCR 0x3FB /* Instruction Cache Cacheability Register */ 173#define SPRN_ICCR 0x3FB /* Instruction Cache Cacheability Register */
174#define SPRN_PWRMGTCR0 0x3FB /* Power management control register 0 */
173#define SPRN_SVR 0x3FF /* System Version Register */ 175#define SPRN_SVR 0x3FF /* System Version Register */
174 176
175/* 177/*
@@ -216,6 +218,14 @@
216#define CCR1_DPC 0x00000100 /* Disable L1 I-Cache/D-Cache parity checking */ 218#define CCR1_DPC 0x00000100 /* Disable L1 I-Cache/D-Cache parity checking */
217#define CCR1_TCS 0x00000080 /* Timer Clock Select */ 219#define CCR1_TCS 0x00000080 /* Timer Clock Select */
218 220
221/* Bit definitions for PWRMGTCR0. */
222#define PWRMGTCR0_PW20_WAIT (1 << 14) /* PW20 state enable bit */
223#define PWRMGTCR0_PW20_ENT_SHIFT 8
224#define PWRMGTCR0_PW20_ENT 0x3F00
225#define PWRMGTCR0_AV_IDLE_PD_EN (1 << 22) /* Altivec idle enable */
226#define PWRMGTCR0_AV_IDLE_CNT_SHIFT 16
227#define PWRMGTCR0_AV_IDLE_CNT 0x3F0000
228
219/* Bit definitions for the MCSR. */ 229/* Bit definitions for the MCSR. */
220#define MCSR_MCS 0x80000000 /* Machine Check Summary */ 230#define MCSR_MCS 0x80000000 /* Machine Check Summary */
221#define MCSR_IB 0x40000000 /* Instruction PLB Error */ 231#define MCSR_IB 0x40000000 /* Instruction PLB Error */
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index f6e78d63fb6a..35aa339410bd 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -30,8 +30,6 @@
30 30
31#define smp_mb__after_unlock_lock() smp_mb() /* Full ordering for lock. */ 31#define smp_mb__after_unlock_lock() smp_mb() /* Full ordering for lock. */
32 32
33#define arch_spin_is_locked(x) ((x)->slock != 0)
34
35#ifdef CONFIG_PPC64 33#ifdef CONFIG_PPC64
36/* use 0x800000yy when locked, where yy == CPU number */ 34/* use 0x800000yy when locked, where yy == CPU number */
37#ifdef __BIG_ENDIAN__ 35#ifdef __BIG_ENDIAN__
@@ -56,6 +54,16 @@
56#define SYNC_IO 54#define SYNC_IO
57#endif 55#endif
58 56
57static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock)
58{
59 return lock.slock == 0;
60}
61
62static inline int arch_spin_is_locked(arch_spinlock_t *lock)
63{
64 return !arch_spin_value_unlocked(*lock);
65}
66
59/* 67/*
60 * This returns the old value in the lock, so we succeeded 68 * This returns the old value in the lock, so we succeeded
61 * in getting the lock if the return value is 0. 69 * in getting the lock if the return value is 0.
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index aace90547614..0e83e7d8c73f 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -25,10 +25,8 @@ static inline void save_tar(struct thread_struct *prev)
25static inline void save_tar(struct thread_struct *prev) {} 25static inline void save_tar(struct thread_struct *prev) {}
26#endif 26#endif
27 27
28extern void load_up_fpu(void);
29extern void enable_kernel_fp(void); 28extern void enable_kernel_fp(void);
30extern void enable_kernel_altivec(void); 29extern void enable_kernel_altivec(void);
31extern void load_up_altivec(struct task_struct *);
32extern int emulate_altivec(struct pt_regs *); 30extern int emulate_altivec(struct pt_regs *);
33extern void __giveup_vsx(struct task_struct *); 31extern void __giveup_vsx(struct task_struct *);
34extern void giveup_vsx(struct task_struct *); 32extern void giveup_vsx(struct task_struct *);
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 43523fe0d8b4..3ddf70276706 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -359,3 +359,5 @@ COMPAT_SYS(process_vm_readv)
359COMPAT_SYS(process_vm_writev) 359COMPAT_SYS(process_vm_writev)
360SYSCALL(finit_module) 360SYSCALL(finit_module)
361SYSCALL(ni_syscall) /* sys_kcmp */ 361SYSCALL(ni_syscall) /* sys_kcmp */
362SYSCALL_SPU(sched_setattr)
363SYSCALL_SPU(sched_getattr)
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 9854c564ac52..b034ecdb7c74 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -91,8 +91,7 @@ static inline struct thread_info *current_thread_info(void)
91#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling 91#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
92 TIF_NEED_RESCHED */ 92 TIF_NEED_RESCHED */
93#define TIF_32BIT 4 /* 32 bit binary */ 93#define TIF_32BIT 4 /* 32 bit binary */
94#define TIF_PERFMON_WORK 5 /* work for pfm_handle_work() */ 94#define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */
95#define TIF_PERFMON_CTXSW 6 /* perfmon needs ctxsw calls */
96#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 95#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
97#define TIF_SINGLESTEP 8 /* singlestepping active */ 96#define TIF_SINGLESTEP 8 /* singlestepping active */
98#define TIF_NOHZ 9 /* in adaptive nohz mode */ 97#define TIF_NOHZ 9 /* in adaptive nohz mode */
@@ -115,8 +114,7 @@ static inline struct thread_info *current_thread_info(void)
115#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 114#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
116#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 115#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
117#define _TIF_32BIT (1<<TIF_32BIT) 116#define _TIF_32BIT (1<<TIF_32BIT)
118#define _TIF_PERFMON_WORK (1<<TIF_PERFMON_WORK) 117#define _TIF_RESTORE_TM (1<<TIF_RESTORE_TM)
119#define _TIF_PERFMON_CTXSW (1<<TIF_PERFMON_CTXSW)
120#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 118#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
121#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 119#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
122#define _TIF_SECCOMP (1<<TIF_SECCOMP) 120#define _TIF_SECCOMP (1<<TIF_SECCOMP)
@@ -132,7 +130,8 @@ static inline struct thread_info *current_thread_info(void)
132 _TIF_NOHZ) 130 _TIF_NOHZ)
133 131
134#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 132#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
135 _TIF_NOTIFY_RESUME | _TIF_UPROBE) 133 _TIF_NOTIFY_RESUME | _TIF_UPROBE | \
134 _TIF_RESTORE_TM)
136#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) 135#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
137 136
138/* Bits in local_flags */ 137/* Bits in local_flags */
diff --git a/arch/powerpc/include/asm/tm.h b/arch/powerpc/include/asm/tm.h
index 9dfbc34bdbf5..0c9f8b74dd97 100644
--- a/arch/powerpc/include/asm/tm.h
+++ b/arch/powerpc/include/asm/tm.h
@@ -15,6 +15,7 @@ extern void do_load_up_transact_altivec(struct thread_struct *thread);
15extern void tm_enable(void); 15extern void tm_enable(void);
16extern void tm_reclaim(struct thread_struct *thread, 16extern void tm_reclaim(struct thread_struct *thread,
17 unsigned long orig_msr, uint8_t cause); 17 unsigned long orig_msr, uint8_t cause);
18extern void tm_reclaim_current(uint8_t cause);
18extern void tm_recheckpoint(struct thread_struct *thread, 19extern void tm_recheckpoint(struct thread_struct *thread,
19 unsigned long orig_msr); 20 unsigned long orig_msr);
20extern void tm_abort(uint8_t cause); 21extern void tm_abort(uint8_t cause);
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 89e3ef2496ac..d0b5fca6b077 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -22,7 +22,15 @@ struct device_node;
22 22
23static inline int cpu_to_node(int cpu) 23static inline int cpu_to_node(int cpu)
24{ 24{
25 return numa_cpu_lookup_table[cpu]; 25 int nid;
26
27 nid = numa_cpu_lookup_table[cpu];
28
29 /*
30 * During early boot, the numa-cpu lookup table might not have been
31 * setup for all CPUs yet. In such cases, default to node 0.
32 */
33 return (nid < 0) ? 0 : nid;
26} 34}
27 35
28#define parent_node(node) (node) 36#define parent_node(node) (node)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 3ca819f541bf..4494f029b632 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
12#include <uapi/asm/unistd.h> 12#include <uapi/asm/unistd.h>
13 13
14 14
15#define __NR_syscalls 355 15#define __NR_syscalls 357
16 16
17#define __NR__exit __NR_exit 17#define __NR__exit __NR_exit
18#define NR_syscalls __NR_syscalls 18#define NR_syscalls __NR_syscalls
diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h
index 68d0cc998b1b..4f9b7ca0710f 100644
--- a/arch/powerpc/include/asm/vio.h
+++ b/arch/powerpc/include/asm/vio.h
@@ -15,7 +15,6 @@
15#define _ASM_POWERPC_VIO_H 15#define _ASM_POWERPC_VIO_H
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#include <linux/init.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/device.h> 19#include <linux/device.h>
21#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h
index 6836ec79a830..a6665be4f3ab 100644
--- a/arch/powerpc/include/uapi/asm/kvm.h
+++ b/arch/powerpc/include/uapi/asm/kvm.h
@@ -545,6 +545,7 @@ struct kvm_get_htab_header {
545#define KVM_REG_PPC_TCSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb1) 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) 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) 547#define KVM_REG_PPC_ACOP (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb3)
548#define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb4)
548 549
549#define KVM_REG_PPC_VRSAVE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb4) 550#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_LPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb5)
@@ -553,6 +554,8 @@ struct kvm_get_htab_header {
553/* Architecture compatibility level */ 554/* Architecture compatibility level */
554#define KVM_REG_PPC_ARCH_COMPAT (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb7) 555#define KVM_REG_PPC_ARCH_COMPAT (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb7)
555 556
557#define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8)
558
556/* Transactional Memory checkpointed state: 559/* Transactional Memory checkpointed state:
557 * This is all GPRs, all VSX regs and a subset of SPRs 560 * This is all GPRs, all VSX regs and a subset of SPRs
558 */ 561 */
diff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h
index fa698324a1fd..a9c3e2e18c05 100644
--- a/arch/powerpc/include/uapi/asm/socket.h
+++ b/arch/powerpc/include/uapi/asm/socket.h
@@ -85,4 +85,6 @@
85 85
86#define SO_MAX_PACING_RATE 47 86#define SO_MAX_PACING_RATE 47
87 87
88#define SO_BPF_EXTENSIONS 48
89
88#endif /* _ASM_POWERPC_SOCKET_H */ 90#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/arch/powerpc/include/uapi/asm/tm.h b/arch/powerpc/include/uapi/asm/tm.h
index 85059a00f560..5d836b7c1176 100644
--- a/arch/powerpc/include/uapi/asm/tm.h
+++ b/arch/powerpc/include/uapi/asm/tm.h
@@ -6,6 +6,8 @@
6 * the failure is persistent. PAPR saves 0xff-0xe0 for the hypervisor. 6 * the failure is persistent. PAPR saves 0xff-0xe0 for the hypervisor.
7 */ 7 */
8#define TM_CAUSE_PERSISTENT 0x01 8#define TM_CAUSE_PERSISTENT 0x01
9#define TM_CAUSE_KVM_RESCHED 0xe0 /* From PAPR */
10#define TM_CAUSE_KVM_FAC_UNAV 0xe2 /* From PAPR */
9#define TM_CAUSE_RESCHED 0xde 11#define TM_CAUSE_RESCHED 0xde
10#define TM_CAUSE_TLBI 0xdc 12#define TM_CAUSE_TLBI 0xdc
11#define TM_CAUSE_FAC_UNAV 0xda 13#define TM_CAUSE_FAC_UNAV 0xda
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
index 74cb4d72d673..881bf2e2560d 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -377,6 +377,7 @@
377#define __NR_process_vm_writev 352 377#define __NR_process_vm_writev 352
378#define __NR_finit_module 353 378#define __NR_finit_module 353
379#define __NR_kcmp 354 379#define __NR_kcmp 354
380 380#define __NR_sched_setattr 355
381#define __NR_sched_getattr 356
381 382
382#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ 383#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 445cb6e39d5b..fcc9a89a4695 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
39obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 39obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
40obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o 40obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o
41obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o 41obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
42obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o
42obj64-$(CONFIG_RELOCATABLE) += reloc_64.o 43obj64-$(CONFIG_RELOCATABLE) += reloc_64.o
43obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o 44obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o
44obj-$(CONFIG_PPC_A2) += cpu_setup_a2.o 45obj-$(CONFIG_PPC_A2) += cpu_setup_a2.o
@@ -47,7 +48,6 @@ obj-$(CONFIG_ALTIVEC) += vecemu.o
47obj-$(CONFIG_PPC_970_NAP) += idle_power4.o 48obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
48obj-$(CONFIG_PPC_P7_NAP) += idle_power7.o 49obj-$(CONFIG_PPC_P7_NAP) += idle_power7.o
49obj-$(CONFIG_PPC_OF) += of_platform.o prom_parse.o 50obj-$(CONFIG_PPC_OF) += of_platform.o prom_parse.o
50obj-$(CONFIG_PPC_CLOCK) += clock.o
51procfs-y := proc_powerpc.o 51procfs-y := proc_powerpc.o
52obj-$(CONFIG_PROC_FS) += $(procfs-y) 52obj-$(CONFIG_PROC_FS) += $(procfs-y)
53rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI) := rtas_pci.o 53rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI) := rtas_pci.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index d3de01066f7d..b5aacf72ae6f 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -203,6 +203,15 @@ int main(void)
203 DEFINE(PACA_MC_STACK, offsetof(struct paca_struct, mc_kstack)); 203 DEFINE(PACA_MC_STACK, offsetof(struct paca_struct, mc_kstack));
204 DEFINE(PACA_CRIT_STACK, offsetof(struct paca_struct, crit_kstack)); 204 DEFINE(PACA_CRIT_STACK, offsetof(struct paca_struct, crit_kstack));
205 DEFINE(PACA_DBG_STACK, offsetof(struct paca_struct, dbg_kstack)); 205 DEFINE(PACA_DBG_STACK, offsetof(struct paca_struct, dbg_kstack));
206 DEFINE(PACA_TCD_PTR, offsetof(struct paca_struct, tcd_ptr));
207
208 DEFINE(TCD_ESEL_NEXT,
209 offsetof(struct tlb_core_data, esel_next));
210 DEFINE(TCD_ESEL_MAX,
211 offsetof(struct tlb_core_data, esel_max));
212 DEFINE(TCD_ESEL_FIRST,
213 offsetof(struct tlb_core_data, esel_first));
214 DEFINE(TCD_LOCK, offsetof(struct tlb_core_data, lock));
206#endif /* CONFIG_PPC_BOOK3E */ 215#endif /* CONFIG_PPC_BOOK3E */
207 216
208#ifdef CONFIG_PPC_STD_MMU_64 217#ifdef CONFIG_PPC_STD_MMU_64
@@ -232,6 +241,10 @@ int main(void)
232 DEFINE(PACA_DTL_RIDX, offsetof(struct paca_struct, dtl_ridx)); 241 DEFINE(PACA_DTL_RIDX, offsetof(struct paca_struct, dtl_ridx));
233#endif /* CONFIG_PPC_STD_MMU_64 */ 242#endif /* CONFIG_PPC_STD_MMU_64 */
234 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp)); 243 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
244#ifdef CONFIG_PPC_BOOK3S_64
245 DEFINE(PACAMCEMERGSP, offsetof(struct paca_struct, mc_emergency_sp));
246 DEFINE(PACA_IN_MCE, offsetof(struct paca_struct, in_mce));
247#endif
235 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id)); 248 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
236 DEFINE(PACAKEXECSTATE, offsetof(struct paca_struct, kexec_state)); 249 DEFINE(PACAKEXECSTATE, offsetof(struct paca_struct, kexec_state));
237 DEFINE(PACA_STARTTIME, offsetof(struct paca_struct, starttime)); 250 DEFINE(PACA_STARTTIME, offsetof(struct paca_struct, starttime));
@@ -425,18 +438,14 @@ int main(void)
425 DEFINE(VCPU_GUEST_PID, offsetof(struct kvm_vcpu, arch.pid)); 438 DEFINE(VCPU_GUEST_PID, offsetof(struct kvm_vcpu, arch.pid));
426 DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr)); 439 DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr));
427 DEFINE(VCPU_VRSAVE, offsetof(struct kvm_vcpu, arch.vrsave)); 440 DEFINE(VCPU_VRSAVE, offsetof(struct kvm_vcpu, arch.vrsave));
428 DEFINE(VCPU_FPRS, offsetof(struct kvm_vcpu, arch.fpr)); 441 DEFINE(VCPU_FPRS, offsetof(struct kvm_vcpu, arch.fp.fpr));
429 DEFINE(VCPU_FPSCR, offsetof(struct kvm_vcpu, arch.fpscr));
430#ifdef CONFIG_ALTIVEC 442#ifdef CONFIG_ALTIVEC
431 DEFINE(VCPU_VRS, offsetof(struct kvm_vcpu, arch.vr)); 443 DEFINE(VCPU_VRS, offsetof(struct kvm_vcpu, arch.vr.vr));
432 DEFINE(VCPU_VSCR, offsetof(struct kvm_vcpu, arch.vscr));
433#endif
434#ifdef CONFIG_VSX
435 DEFINE(VCPU_VSRS, offsetof(struct kvm_vcpu, arch.vsr));
436#endif 444#endif
437 DEFINE(VCPU_XER, offsetof(struct kvm_vcpu, arch.xer)); 445 DEFINE(VCPU_XER, offsetof(struct kvm_vcpu, arch.xer));
438 DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr)); 446 DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr));
439 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr)); 447 DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
448 DEFINE(VCPU_TAR, offsetof(struct kvm_vcpu, arch.tar));
440 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr)); 449 DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr));
441 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc)); 450 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
442#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE 451#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
@@ -484,16 +493,24 @@ int main(void)
484 DEFINE(VCPU_DAR, offsetof(struct kvm_vcpu, arch.shregs.dar)); 493 DEFINE(VCPU_DAR, offsetof(struct kvm_vcpu, arch.shregs.dar));
485 DEFINE(VCPU_VPA, offsetof(struct kvm_vcpu, arch.vpa.pinned_addr)); 494 DEFINE(VCPU_VPA, offsetof(struct kvm_vcpu, arch.vpa.pinned_addr));
486 DEFINE(VCPU_VPA_DIRTY, offsetof(struct kvm_vcpu, arch.vpa.dirty)); 495 DEFINE(VCPU_VPA_DIRTY, offsetof(struct kvm_vcpu, arch.vpa.dirty));
496 DEFINE(VCPU_INTR_MSR, offsetof(struct kvm_vcpu, arch.intr_msr));
487#endif 497#endif
488#ifdef CONFIG_PPC_BOOK3S 498#ifdef CONFIG_PPC_BOOK3S
489 DEFINE(VCPU_VCPUID, offsetof(struct kvm_vcpu, vcpu_id)); 499 DEFINE(VCPU_VCPUID, offsetof(struct kvm_vcpu, vcpu_id));
490 DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr)); 500 DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr));
491 DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr)); 501 DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr));
502 DEFINE(VCPU_IC, offsetof(struct kvm_vcpu, arch.ic));
503 DEFINE(VCPU_VTB, offsetof(struct kvm_vcpu, arch.vtb));
492 DEFINE(VCPU_DSCR, offsetof(struct kvm_vcpu, arch.dscr)); 504 DEFINE(VCPU_DSCR, offsetof(struct kvm_vcpu, arch.dscr));
493 DEFINE(VCPU_AMR, offsetof(struct kvm_vcpu, arch.amr)); 505 DEFINE(VCPU_AMR, offsetof(struct kvm_vcpu, arch.amr));
494 DEFINE(VCPU_UAMOR, offsetof(struct kvm_vcpu, arch.uamor)); 506 DEFINE(VCPU_UAMOR, offsetof(struct kvm_vcpu, arch.uamor));
507 DEFINE(VCPU_IAMR, offsetof(struct kvm_vcpu, arch.iamr));
495 DEFINE(VCPU_CTRL, offsetof(struct kvm_vcpu, arch.ctrl)); 508 DEFINE(VCPU_CTRL, offsetof(struct kvm_vcpu, arch.ctrl));
496 DEFINE(VCPU_DABR, offsetof(struct kvm_vcpu, arch.dabr)); 509 DEFINE(VCPU_DABR, offsetof(struct kvm_vcpu, arch.dabr));
510 DEFINE(VCPU_DABRX, offsetof(struct kvm_vcpu, arch.dabrx));
511 DEFINE(VCPU_DAWR, offsetof(struct kvm_vcpu, arch.dawr));
512 DEFINE(VCPU_DAWRX, offsetof(struct kvm_vcpu, arch.dawrx));
513 DEFINE(VCPU_CIABR, offsetof(struct kvm_vcpu, arch.ciabr));
497 DEFINE(VCPU_HFLAGS, offsetof(struct kvm_vcpu, arch.hflags)); 514 DEFINE(VCPU_HFLAGS, offsetof(struct kvm_vcpu, arch.hflags));
498 DEFINE(VCPU_DEC, offsetof(struct kvm_vcpu, arch.dec)); 515 DEFINE(VCPU_DEC, offsetof(struct kvm_vcpu, arch.dec));
499 DEFINE(VCPU_DEC_EXPIRES, offsetof(struct kvm_vcpu, arch.dec_expires)); 516 DEFINE(VCPU_DEC_EXPIRES, offsetof(struct kvm_vcpu, arch.dec_expires));
@@ -502,8 +519,10 @@ int main(void)
502 DEFINE(VCPU_PRODDED, offsetof(struct kvm_vcpu, arch.prodded)); 519 DEFINE(VCPU_PRODDED, offsetof(struct kvm_vcpu, arch.prodded));
503 DEFINE(VCPU_MMCR, offsetof(struct kvm_vcpu, arch.mmcr)); 520 DEFINE(VCPU_MMCR, offsetof(struct kvm_vcpu, arch.mmcr));
504 DEFINE(VCPU_PMC, offsetof(struct kvm_vcpu, arch.pmc)); 521 DEFINE(VCPU_PMC, offsetof(struct kvm_vcpu, arch.pmc));
522 DEFINE(VCPU_SPMC, offsetof(struct kvm_vcpu, arch.spmc));
505 DEFINE(VCPU_SIAR, offsetof(struct kvm_vcpu, arch.siar)); 523 DEFINE(VCPU_SIAR, offsetof(struct kvm_vcpu, arch.siar));
506 DEFINE(VCPU_SDAR, offsetof(struct kvm_vcpu, arch.sdar)); 524 DEFINE(VCPU_SDAR, offsetof(struct kvm_vcpu, arch.sdar));
525 DEFINE(VCPU_SIER, offsetof(struct kvm_vcpu, arch.sier));
507 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb)); 526 DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb));
508 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max)); 527 DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max));
509 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr)); 528 DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr));
@@ -511,20 +530,47 @@ int main(void)
511 DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar)); 530 DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar));
512 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); 531 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
513 DEFINE(VCPU_TRAP, offsetof(struct kvm_vcpu, arch.trap)); 532 DEFINE(VCPU_TRAP, offsetof(struct kvm_vcpu, arch.trap));
514 DEFINE(VCPU_PTID, offsetof(struct kvm_vcpu, arch.ptid));
515 DEFINE(VCPU_CFAR, offsetof(struct kvm_vcpu, arch.cfar)); 533 DEFINE(VCPU_CFAR, offsetof(struct kvm_vcpu, arch.cfar));
516 DEFINE(VCPU_PPR, offsetof(struct kvm_vcpu, arch.ppr)); 534 DEFINE(VCPU_PPR, offsetof(struct kvm_vcpu, arch.ppr));
535 DEFINE(VCPU_FSCR, offsetof(struct kvm_vcpu, arch.fscr));
536 DEFINE(VCPU_PSPB, offsetof(struct kvm_vcpu, arch.pspb));
537 DEFINE(VCPU_EBBHR, offsetof(struct kvm_vcpu, arch.ebbhr));
538 DEFINE(VCPU_EBBRR, offsetof(struct kvm_vcpu, arch.ebbrr));
539 DEFINE(VCPU_BESCR, offsetof(struct kvm_vcpu, arch.bescr));
540 DEFINE(VCPU_CSIGR, offsetof(struct kvm_vcpu, arch.csigr));
541 DEFINE(VCPU_TACR, offsetof(struct kvm_vcpu, arch.tacr));
542 DEFINE(VCPU_TCSCR, offsetof(struct kvm_vcpu, arch.tcscr));
543 DEFINE(VCPU_ACOP, offsetof(struct kvm_vcpu, arch.acop));
544 DEFINE(VCPU_WORT, offsetof(struct kvm_vcpu, arch.wort));
517 DEFINE(VCPU_SHADOW_SRR1, offsetof(struct kvm_vcpu, arch.shadow_srr1)); 545 DEFINE(VCPU_SHADOW_SRR1, offsetof(struct kvm_vcpu, arch.shadow_srr1));
518 DEFINE(VCORE_ENTRY_EXIT, offsetof(struct kvmppc_vcore, entry_exit_count)); 546 DEFINE(VCORE_ENTRY_EXIT, offsetof(struct kvmppc_vcore, entry_exit_count));
519 DEFINE(VCORE_NAP_COUNT, offsetof(struct kvmppc_vcore, nap_count)); 547 DEFINE(VCORE_NAP_COUNT, offsetof(struct kvmppc_vcore, nap_count));
520 DEFINE(VCORE_IN_GUEST, offsetof(struct kvmppc_vcore, in_guest)); 548 DEFINE(VCORE_IN_GUEST, offsetof(struct kvmppc_vcore, in_guest));
521 DEFINE(VCORE_NAPPING_THREADS, offsetof(struct kvmppc_vcore, napping_threads)); 549 DEFINE(VCORE_NAPPING_THREADS, offsetof(struct kvmppc_vcore, napping_threads));
550 DEFINE(VCORE_KVM, offsetof(struct kvmppc_vcore, kvm));
522 DEFINE(VCORE_TB_OFFSET, offsetof(struct kvmppc_vcore, tb_offset)); 551 DEFINE(VCORE_TB_OFFSET, offsetof(struct kvmppc_vcore, tb_offset));
523 DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr)); 552 DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr));
524 DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr)); 553 DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr));
554 DEFINE(VCORE_DPDES, offsetof(struct kvmppc_vcore, dpdes));
525 DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige)); 555 DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige));
526 DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv)); 556 DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv));
527 DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb)); 557 DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb));
558#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
559 DEFINE(VCPU_TFHAR, offsetof(struct kvm_vcpu, arch.tfhar));
560 DEFINE(VCPU_TFIAR, offsetof(struct kvm_vcpu, arch.tfiar));
561 DEFINE(VCPU_TEXASR, offsetof(struct kvm_vcpu, arch.texasr));
562 DEFINE(VCPU_GPR_TM, offsetof(struct kvm_vcpu, arch.gpr_tm));
563 DEFINE(VCPU_FPRS_TM, offsetof(struct kvm_vcpu, arch.fp_tm.fpr));
564 DEFINE(VCPU_VRS_TM, offsetof(struct kvm_vcpu, arch.vr_tm.vr));
565 DEFINE(VCPU_VRSAVE_TM, offsetof(struct kvm_vcpu, arch.vrsave_tm));
566 DEFINE(VCPU_CR_TM, offsetof(struct kvm_vcpu, arch.cr_tm));
567 DEFINE(VCPU_LR_TM, offsetof(struct kvm_vcpu, arch.lr_tm));
568 DEFINE(VCPU_CTR_TM, offsetof(struct kvm_vcpu, arch.ctr_tm));
569 DEFINE(VCPU_AMR_TM, offsetof(struct kvm_vcpu, arch.amr_tm));
570 DEFINE(VCPU_PPR_TM, offsetof(struct kvm_vcpu, arch.ppr_tm));
571 DEFINE(VCPU_DSCR_TM, offsetof(struct kvm_vcpu, arch.dscr_tm));
572 DEFINE(VCPU_TAR_TM, offsetof(struct kvm_vcpu, arch.tar_tm));
573#endif
528 574
529#ifdef CONFIG_PPC_BOOK3S_64 575#ifdef CONFIG_PPC_BOOK3S_64
530#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE 576#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
@@ -589,6 +635,7 @@ int main(void)
589 HSTATE_FIELD(HSTATE_XICS_PHYS, xics_phys); 635 HSTATE_FIELD(HSTATE_XICS_PHYS, xics_phys);
590 HSTATE_FIELD(HSTATE_SAVED_XIRR, saved_xirr); 636 HSTATE_FIELD(HSTATE_SAVED_XIRR, saved_xirr);
591 HSTATE_FIELD(HSTATE_HOST_IPI, host_ipi); 637 HSTATE_FIELD(HSTATE_HOST_IPI, host_ipi);
638 HSTATE_FIELD(HSTATE_PTID, ptid);
592 HSTATE_FIELD(HSTATE_MMCR, host_mmcr); 639 HSTATE_FIELD(HSTATE_MMCR, host_mmcr);
593 HSTATE_FIELD(HSTATE_PMC, host_pmc); 640 HSTATE_FIELD(HSTATE_PMC, host_pmc);
594 HSTATE_FIELD(HSTATE_PURR, host_purr); 641 HSTATE_FIELD(HSTATE_PURR, host_purr);
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index 654932727873..2912b8787aa4 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/cpu.h> 13#include <linux/cpu.h>
14#include <linux/cpumask.h> 14#include <linux/cpumask.h>
15#include <linux/init.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/kobject.h> 16#include <linux/kobject.h>
18#include <linux/list.h> 17#include <linux/list.h>
@@ -794,6 +793,9 @@ static void remove_cache_dir(struct cache_dir *cache_dir)
794{ 793{
795 remove_index_dirs(cache_dir); 794 remove_index_dirs(cache_dir);
796 795
796 /* Remove cache dir from sysfs */
797 kobject_del(cache_dir->kobj);
798
797 kobject_put(cache_dir->kobj); 799 kobject_put(cache_dir->kobj);
798 800
799 kfree(cache_dir); 801 kfree(cache_dir);
diff --git a/arch/powerpc/kernel/clock.c b/arch/powerpc/kernel/clock.c
deleted file mode 100644
index a764b47791e8..000000000000
--- a/arch/powerpc/kernel/clock.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Dummy clk implementations for powerpc.
3 * These need to be overridden in platform code.
4 */
5
6#include <linux/clk.h>
7#include <linux/err.h>
8#include <linux/errno.h>
9#include <linux/export.h>
10#include <asm/clk_interface.h>
11
12struct clk_interface clk_functions;
13
14struct clk *clk_get(struct device *dev, const char *id)
15{
16 if (clk_functions.clk_get)
17 return clk_functions.clk_get(dev, id);
18 return ERR_PTR(-ENOSYS);
19}
20EXPORT_SYMBOL(clk_get);
21
22void clk_put(struct clk *clk)
23{
24 if (clk_functions.clk_put)
25 clk_functions.clk_put(clk);
26}
27EXPORT_SYMBOL(clk_put);
28
29int clk_enable(struct clk *clk)
30{
31 if (clk_functions.clk_enable)
32 return clk_functions.clk_enable(clk);
33 return -ENOSYS;
34}
35EXPORT_SYMBOL(clk_enable);
36
37void clk_disable(struct clk *clk)
38{
39 if (clk_functions.clk_disable)
40 clk_functions.clk_disable(clk);
41}
42EXPORT_SYMBOL(clk_disable);
43
44unsigned long clk_get_rate(struct clk *clk)
45{
46 if (clk_functions.clk_get_rate)
47 return clk_functions.clk_get_rate(clk);
48 return 0;
49}
50EXPORT_SYMBOL(clk_get_rate);
51
52long clk_round_rate(struct clk *clk, unsigned long rate)
53{
54 if (clk_functions.clk_round_rate)
55 return clk_functions.clk_round_rate(clk, rate);
56 return -ENOSYS;
57}
58EXPORT_SYMBOL(clk_round_rate);
59
60int clk_set_rate(struct clk *clk, unsigned long rate)
61{
62 if (clk_functions.clk_set_rate)
63 return clk_functions.clk_set_rate(clk, rate);
64 return -ENOSYS;
65}
66EXPORT_SYMBOL(clk_set_rate);
67
68struct clk *clk_get_parent(struct clk *clk)
69{
70 if (clk_functions.clk_get_parent)
71 return clk_functions.clk_get_parent(clk);
72 return ERR_PTR(-ENOSYS);
73}
74EXPORT_SYMBOL(clk_get_parent);
75
76int clk_set_parent(struct clk *clk, struct clk *parent)
77{
78 if (clk_functions.clk_set_parent)
79 return clk_functions.clk_set_parent(clk, parent);
80 return -ENOSYS;
81}
82EXPORT_SYMBOL(clk_set_parent);
diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
index bfb18c7290b7..cc2d8962e090 100644
--- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S
+++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
@@ -53,11 +53,57 @@ _GLOBAL(__e500_dcache_setup)
53 isync 53 isync
54 blr 54 blr
55 55
56/*
57 * FIXME - we haven't yet done testing to determine a reasonable default
58 * value for PW20_WAIT_IDLE_BIT.
59 */
60#define PW20_WAIT_IDLE_BIT 50 /* 1ms, TB frequency is 41.66MHZ */
61_GLOBAL(setup_pw20_idle)
62 mfspr r3, SPRN_PWRMGTCR0
63
64 /* Set PW20_WAIT bit, enable pw20 state*/
65 ori r3, r3, PWRMGTCR0_PW20_WAIT
66 li r11, PW20_WAIT_IDLE_BIT
67
68 /* Set Automatic PW20 Core Idle Count */
69 rlwimi r3, r11, PWRMGTCR0_PW20_ENT_SHIFT, PWRMGTCR0_PW20_ENT
70
71 mtspr SPRN_PWRMGTCR0, r3
72
73 blr
74
75/*
76 * FIXME - we haven't yet done testing to determine a reasonable default
77 * value for AV_WAIT_IDLE_BIT.
78 */
79#define AV_WAIT_IDLE_BIT 50 /* 1ms, TB frequency is 41.66MHZ */
80_GLOBAL(setup_altivec_idle)
81 mfspr r3, SPRN_PWRMGTCR0
82
83 /* Enable Altivec Idle */
84 oris r3, r3, PWRMGTCR0_AV_IDLE_PD_EN@h
85 li r11, AV_WAIT_IDLE_BIT
86
87 /* Set Automatic AltiVec Idle Count */
88 rlwimi r3, r11, PWRMGTCR0_AV_IDLE_CNT_SHIFT, PWRMGTCR0_AV_IDLE_CNT
89
90 mtspr SPRN_PWRMGTCR0, r3
91
92 blr
93
56_GLOBAL(__setup_cpu_e6500) 94_GLOBAL(__setup_cpu_e6500)
57 mflr r6 95 mflr r6
58#ifdef CONFIG_PPC64 96#ifdef CONFIG_PPC64
59 bl .setup_altivec_ivors 97 bl .setup_altivec_ivors
98 /* Touch IVOR42 only if the CPU supports E.HV category */
99 mfspr r10,SPRN_MMUCFG
100 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
101 beq 1f
102 bl .setup_lrat_ivor
1031:
60#endif 104#endif
105 bl setup_pw20_idle
106 bl setup_altivec_idle
61 bl __setup_cpu_e5500 107 bl __setup_cpu_e5500
62 mtlr r6 108 mtlr r6
63 blr 109 blr
@@ -119,6 +165,14 @@ _GLOBAL(__setup_cpu_e5500)
119_GLOBAL(__restore_cpu_e6500) 165_GLOBAL(__restore_cpu_e6500)
120 mflr r5 166 mflr r5
121 bl .setup_altivec_ivors 167 bl .setup_altivec_ivors
168 /* Touch IVOR42 only if the CPU supports E.HV category */
169 mfspr r10,SPRN_MMUCFG
170 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
171 beq 1f
172 bl .setup_lrat_ivor
1731:
174 bl .setup_pw20_idle
175 bl .setup_altivec_idle
122 bl __restore_cpu_e5500 176 bl __restore_cpu_e5500
123 mtlr r5 177 mtlr r5
124 blr 178 blr
diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S
index 18b5b9cf8e37..37d1bb002aa9 100644
--- a/arch/powerpc/kernel/cpu_setup_power.S
+++ b/arch/powerpc/kernel/cpu_setup_power.S
@@ -29,7 +29,7 @@ _GLOBAL(__setup_cpu_power7)
29 mtspr SPRN_LPID,r0 29 mtspr SPRN_LPID,r0
30 mfspr r3,SPRN_LPCR 30 mfspr r3,SPRN_LPCR
31 bl __init_LPCR 31 bl __init_LPCR
32 bl __init_TLB 32 bl __init_tlb_power7
33 mtlr r11 33 mtlr r11
34 blr 34 blr
35 35
@@ -42,7 +42,7 @@ _GLOBAL(__restore_cpu_power7)
42 mtspr SPRN_LPID,r0 42 mtspr SPRN_LPID,r0
43 mfspr r3,SPRN_LPCR 43 mfspr r3,SPRN_LPCR
44 bl __init_LPCR 44 bl __init_LPCR
45 bl __init_TLB 45 bl __init_tlb_power7
46 mtlr r11 46 mtlr r11
47 blr 47 blr
48 48
@@ -59,7 +59,7 @@ _GLOBAL(__setup_cpu_power8)
59 oris r3, r3, LPCR_AIL_3@h 59 oris r3, r3, LPCR_AIL_3@h
60 bl __init_LPCR 60 bl __init_LPCR
61 bl __init_HFSCR 61 bl __init_HFSCR
62 bl __init_TLB 62 bl __init_tlb_power8
63 bl __init_PMU_HV 63 bl __init_PMU_HV
64 mtlr r11 64 mtlr r11
65 blr 65 blr
@@ -78,7 +78,7 @@ _GLOBAL(__restore_cpu_power8)
78 oris r3, r3, LPCR_AIL_3@h 78 oris r3, r3, LPCR_AIL_3@h
79 bl __init_LPCR 79 bl __init_LPCR
80 bl __init_HFSCR 80 bl __init_HFSCR
81 bl __init_TLB 81 bl __init_tlb_power8
82 bl __init_PMU_HV 82 bl __init_PMU_HV
83 mtlr r11 83 mtlr r11
84 blr 84 blr
@@ -134,15 +134,31 @@ __init_HFSCR:
134 mtspr SPRN_HFSCR,r3 134 mtspr SPRN_HFSCR,r3
135 blr 135 blr
136 136
137__init_TLB: 137/*
138 /* 138 * Clear the TLB using the specified IS form of tlbiel instruction
139 * Clear the TLB using the "IS 3" form of tlbiel instruction 139 * (invalidate by congruence class). P7 has 128 CCs., P8 has 512.
140 * (invalidate by congruence class). P7 has 128 CCs, P8 has 512 140 *
141 * so we just always do 512 141 * r3 = IS field
142 */ 142 */
143__init_tlb_power7:
144 li r3,0xc00 /* IS field = 0b11 */
145_GLOBAL(__flush_tlb_power7)
146 li r6,128
147 mtctr r6
148 mr r7,r3 /* IS field */
149 ptesync
1502: tlbiel r7
151 addi r7,r7,0x1000
152 bdnz 2b
153 ptesync
1541: blr
155
156__init_tlb_power8:
157 li r3,0xc00 /* IS field = 0b11 */
158_GLOBAL(__flush_tlb_power8)
143 li r6,512 159 li r6,512
144 mtctr r6 160 mtctr r6
145 li r7,0xc00 /* IS field = 0b11 */ 161 mr r7,r3 /* IS field */
146 ptesync 162 ptesync
1472: tlbiel r7 1632: tlbiel r7
148 addi r7,r7,0x1000 164 addi r7,r7,0x1000
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 597d954e5860..6c8dd5da4de5 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -71,6 +71,10 @@ extern void __restore_cpu_power7(void);
71extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec); 71extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec);
72extern void __restore_cpu_power8(void); 72extern void __restore_cpu_power8(void);
73extern void __restore_cpu_a2(void); 73extern void __restore_cpu_a2(void);
74extern void __flush_tlb_power7(unsigned long inval_selector);
75extern void __flush_tlb_power8(unsigned long inval_selector);
76extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
77extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
74#endif /* CONFIG_PPC64 */ 78#endif /* CONFIG_PPC64 */
75#if defined(CONFIG_E500) 79#if defined(CONFIG_E500)
76extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec); 80extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec);
@@ -440,6 +444,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
440 .oprofile_cpu_type = "ppc64/ibm-compat-v1", 444 .oprofile_cpu_type = "ppc64/ibm-compat-v1",
441 .cpu_setup = __setup_cpu_power7, 445 .cpu_setup = __setup_cpu_power7,
442 .cpu_restore = __restore_cpu_power7, 446 .cpu_restore = __restore_cpu_power7,
447 .flush_tlb = __flush_tlb_power7,
448 .machine_check_early = __machine_check_early_realmode_p7,
443 .platform = "power7", 449 .platform = "power7",
444 }, 450 },
445 { /* 2.07-compliant processor, i.e. Power8 "architected" mode */ 451 { /* 2.07-compliant processor, i.e. Power8 "architected" mode */
@@ -456,6 +462,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
456 .oprofile_cpu_type = "ppc64/ibm-compat-v1", 462 .oprofile_cpu_type = "ppc64/ibm-compat-v1",
457 .cpu_setup = __setup_cpu_power8, 463 .cpu_setup = __setup_cpu_power8,
458 .cpu_restore = __restore_cpu_power8, 464 .cpu_restore = __restore_cpu_power8,
465 .flush_tlb = __flush_tlb_power8,
466 .machine_check_early = __machine_check_early_realmode_p8,
459 .platform = "power8", 467 .platform = "power8",
460 }, 468 },
461 { /* Power7 */ 469 { /* Power7 */
@@ -474,6 +482,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
474 .oprofile_type = PPC_OPROFILE_POWER4, 482 .oprofile_type = PPC_OPROFILE_POWER4,
475 .cpu_setup = __setup_cpu_power7, 483 .cpu_setup = __setup_cpu_power7,
476 .cpu_restore = __restore_cpu_power7, 484 .cpu_restore = __restore_cpu_power7,
485 .flush_tlb = __flush_tlb_power7,
486 .machine_check_early = __machine_check_early_realmode_p7,
477 .platform = "power7", 487 .platform = "power7",
478 }, 488 },
479 { /* Power7+ */ 489 { /* Power7+ */
@@ -492,6 +502,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
492 .oprofile_type = PPC_OPROFILE_POWER4, 502 .oprofile_type = PPC_OPROFILE_POWER4,
493 .cpu_setup = __setup_cpu_power7, 503 .cpu_setup = __setup_cpu_power7,
494 .cpu_restore = __restore_cpu_power7, 504 .cpu_restore = __restore_cpu_power7,
505 .flush_tlb = __flush_tlb_power7,
506 .machine_check_early = __machine_check_early_realmode_p7,
495 .platform = "power7+", 507 .platform = "power7+",
496 }, 508 },
497 { /* Power8E */ 509 { /* Power8E */
@@ -510,6 +522,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
510 .oprofile_type = PPC_OPROFILE_INVALID, 522 .oprofile_type = PPC_OPROFILE_INVALID,
511 .cpu_setup = __setup_cpu_power8, 523 .cpu_setup = __setup_cpu_power8,
512 .cpu_restore = __restore_cpu_power8, 524 .cpu_restore = __restore_cpu_power8,
525 .flush_tlb = __flush_tlb_power8,
526 .machine_check_early = __machine_check_early_realmode_p8,
513 .platform = "power8", 527 .platform = "power8",
514 }, 528 },
515 { /* Power8 */ 529 { /* Power8 */
@@ -528,6 +542,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
528 .oprofile_type = PPC_OPROFILE_INVALID, 542 .oprofile_type = PPC_OPROFILE_INVALID,
529 .cpu_setup = __setup_cpu_power8, 543 .cpu_setup = __setup_cpu_power8,
530 .cpu_restore = __restore_cpu_power8, 544 .cpu_restore = __restore_cpu_power8,
545 .flush_tlb = __flush_tlb_power8,
546 .machine_check_early = __machine_check_early_realmode_p8,
531 .platform = "power8", 547 .platform = "power8",
532 }, 548 },
533 { /* Cell Broadband Engine */ 549 { /* Cell Broadband Engine */
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index fdcd8f551aff..18d7c80ddeb9 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -17,7 +17,6 @@
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/crash_dump.h> 18#include <linux/crash_dump.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/init.h>
21#include <linux/irq.h> 20#include <linux/irq.h>
22#include <linux/types.h> 21#include <linux/types.h>
23 22
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index e4897523de41..54d0116256f7 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -83,10 +83,10 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)
83 return 0; 83 return 0;
84 } 84 }
85 85
86 if (tbl->it_offset > (mask >> IOMMU_PAGE_SHIFT)) { 86 if (tbl->it_offset > (mask >> tbl->it_page_shift)) {
87 dev_info(dev, "Warning: IOMMU offset too big for device mask\n"); 87 dev_info(dev, "Warning: IOMMU offset too big for device mask\n");
88 dev_info(dev, "mask: 0x%08llx, table offset: 0x%08lx\n", 88 dev_info(dev, "mask: 0x%08llx, table offset: 0x%08lx\n",
89 mask, tbl->it_offset << IOMMU_PAGE_SHIFT); 89 mask, tbl->it_offset << tbl->it_page_shift);
90 return 0; 90 return 0;
91 } else 91 } else
92 return 1; 92 return 1;
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 4bd687d5e7aa..148db72a8c43 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -84,7 +84,7 @@
84#define EEH_MAX_FAILS 2100000 84#define EEH_MAX_FAILS 2100000
85 85
86/* Time to wait for a PCI slot to report status, in milliseconds */ 86/* Time to wait for a PCI slot to report status, in milliseconds */
87#define PCI_BUS_RESET_WAIT_MSEC (60*1000) 87#define PCI_BUS_RESET_WAIT_MSEC (5*60*1000)
88 88
89/* Platform dependent EEH operations */ 89/* Platform dependent EEH operations */
90struct eeh_ops *eeh_ops = NULL; 90struct eeh_ops *eeh_ops = NULL;
@@ -921,6 +921,13 @@ void eeh_add_device_late(struct pci_dev *dev)
921 eeh_sysfs_remove_device(edev->pdev); 921 eeh_sysfs_remove_device(edev->pdev);
922 edev->mode &= ~EEH_DEV_SYSFS; 922 edev->mode &= ~EEH_DEV_SYSFS;
923 923
924 /*
925 * We definitely should have the PCI device removed
926 * though it wasn't correctly. So we needn't call
927 * into error handler afterwards.
928 */
929 edev->mode |= EEH_DEV_NO_HANDLER;
930
924 edev->pdev = NULL; 931 edev->pdev = NULL;
925 dev->dev.archdata.edev = NULL; 932 dev->dev.archdata.edev = NULL;
926 } 933 }
@@ -1023,6 +1030,14 @@ void eeh_remove_device(struct pci_dev *dev)
1023 else 1030 else
1024 edev->mode |= EEH_DEV_DISCONNECTED; 1031 edev->mode |= EEH_DEV_DISCONNECTED;
1025 1032
1033 /*
1034 * We're removing from the PCI subsystem, that means
1035 * the PCI device driver can't support EEH or not
1036 * well. So we rely on hotplug completely to do recovery
1037 * for the specific PCI device.
1038 */
1039 edev->mode |= EEH_DEV_NO_HANDLER;
1040
1026 eeh_addr_cache_rmv_dev(dev); 1041 eeh_addr_cache_rmv_dev(dev);
1027 eeh_sysfs_remove_device(dev); 1042 eeh_sysfs_remove_device(dev);
1028 edev->mode &= ~EEH_DEV_SYSFS; 1043 edev->mode &= ~EEH_DEV_SYSFS;
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 36bed5a12750..7bb30dca4e19 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -217,7 +217,8 @@ static void *eeh_report_mmio_enabled(void *data, void *userdata)
217 if (!driver) return NULL; 217 if (!driver) return NULL;
218 218
219 if (!driver->err_handler || 219 if (!driver->err_handler ||
220 !driver->err_handler->mmio_enabled) { 220 !driver->err_handler->mmio_enabled ||
221 (edev->mode & EEH_DEV_NO_HANDLER)) {
221 eeh_pcid_put(dev); 222 eeh_pcid_put(dev);
222 return NULL; 223 return NULL;
223 } 224 }
@@ -258,7 +259,8 @@ static void *eeh_report_reset(void *data, void *userdata)
258 eeh_enable_irq(dev); 259 eeh_enable_irq(dev);
259 260
260 if (!driver->err_handler || 261 if (!driver->err_handler ||
261 !driver->err_handler->slot_reset) { 262 !driver->err_handler->slot_reset ||
263 (edev->mode & EEH_DEV_NO_HANDLER)) {
262 eeh_pcid_put(dev); 264 eeh_pcid_put(dev);
263 return NULL; 265 return NULL;
264 } 266 }
@@ -297,7 +299,9 @@ static void *eeh_report_resume(void *data, void *userdata)
297 eeh_enable_irq(dev); 299 eeh_enable_irq(dev);
298 300
299 if (!driver->err_handler || 301 if (!driver->err_handler ||
300 !driver->err_handler->resume) { 302 !driver->err_handler->resume ||
303 (edev->mode & EEH_DEV_NO_HANDLER)) {
304 edev->mode &= ~EEH_DEV_NO_HANDLER;
301 eeh_pcid_put(dev); 305 eeh_pcid_put(dev);
302 return NULL; 306 return NULL;
303 } 307 }
@@ -369,7 +373,9 @@ static void *eeh_rmv_device(void *data, void *userdata)
369 edev->mode |= EEH_DEV_DISCONNECTED; 373 edev->mode |= EEH_DEV_DISCONNECTED;
370 (*removed)++; 374 (*removed)++;
371 375
376 pci_lock_rescan_remove();
372 pci_stop_and_remove_bus_device(dev); 377 pci_stop_and_remove_bus_device(dev);
378 pci_unlock_rescan_remove();
373 379
374 return NULL; 380 return NULL;
375} 381}
@@ -416,10 +422,13 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
416 * into pcibios_add_pci_devices(). 422 * into pcibios_add_pci_devices().
417 */ 423 */
418 eeh_pe_state_mark(pe, EEH_PE_KEEP); 424 eeh_pe_state_mark(pe, EEH_PE_KEEP);
419 if (bus) 425 if (bus) {
426 pci_lock_rescan_remove();
420 pcibios_remove_pci_devices(bus); 427 pcibios_remove_pci_devices(bus);
421 else if (frozen_bus) 428 pci_unlock_rescan_remove();
429 } else if (frozen_bus) {
422 eeh_pe_dev_traverse(pe, eeh_rmv_device, &removed); 430 eeh_pe_dev_traverse(pe, eeh_rmv_device, &removed);
431 }
423 432
424 /* Reset the pci controller. (Asserts RST#; resets config space). 433 /* Reset the pci controller. (Asserts RST#; resets config space).
425 * Reconfigure bridges and devices. Don't try to bring the system 434 * Reconfigure bridges and devices. Don't try to bring the system
@@ -429,6 +438,8 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
429 if (rc) 438 if (rc)
430 return rc; 439 return rc;
431 440
441 pci_lock_rescan_remove();
442
432 /* Restore PE */ 443 /* Restore PE */
433 eeh_ops->configure_bridge(pe); 444 eeh_ops->configure_bridge(pe);
434 eeh_pe_restore_bars(pe); 445 eeh_pe_restore_bars(pe);
@@ -462,13 +473,14 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
462 pe->tstamp = tstamp; 473 pe->tstamp = tstamp;
463 pe->freeze_count = cnt; 474 pe->freeze_count = cnt;
464 475
476 pci_unlock_rescan_remove();
465 return 0; 477 return 0;
466} 478}
467 479
468/* The longest amount of time to wait for a pci device 480/* The longest amount of time to wait for a pci device
469 * to come back on line, in seconds. 481 * to come back on line, in seconds.
470 */ 482 */
471#define MAX_WAIT_FOR_RECOVERY 150 483#define MAX_WAIT_FOR_RECOVERY 300
472 484
473static void eeh_handle_normal_event(struct eeh_pe *pe) 485static void eeh_handle_normal_event(struct eeh_pe *pe)
474{ 486{
@@ -618,92 +630,103 @@ perm_error:
618 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL); 630 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
619 631
620 /* Shut down the device drivers for good. */ 632 /* Shut down the device drivers for good. */
621 if (frozen_bus) 633 if (frozen_bus) {
634 pci_lock_rescan_remove();
622 pcibios_remove_pci_devices(frozen_bus); 635 pcibios_remove_pci_devices(frozen_bus);
636 pci_unlock_rescan_remove();
637 }
623} 638}
624 639
625static void eeh_handle_special_event(void) 640static void eeh_handle_special_event(void)
626{ 641{
627 struct eeh_pe *pe, *phb_pe; 642 struct eeh_pe *pe, *phb_pe;
628 struct pci_bus *bus; 643 struct pci_bus *bus;
629 struct pci_controller *hose, *tmp; 644 struct pci_controller *hose;
630 unsigned long flags; 645 unsigned long flags;
631 int rc = 0; 646 int rc;
632 647
633 /*
634 * The return value from next_error() has been classified as follows.
635 * It might be good to enumerate them. However, next_error() is only
636 * supported by PowerNV platform for now. So it would be fine to use
637 * integer directly:
638 *
639 * 4 - Dead IOC 3 - Dead PHB
640 * 2 - Fenced PHB 1 - Frozen PE
641 * 0 - No error found
642 *
643 */
644 rc = eeh_ops->next_error(&pe);
645 if (rc <= 0)
646 return;
647 648
648 switch (rc) { 649 do {
649 case 4: 650 rc = eeh_ops->next_error(&pe);
650 /* Mark all PHBs in dead state */ 651
651 eeh_serialize_lock(&flags); 652 switch (rc) {
652 list_for_each_entry_safe(hose, tmp, 653 case EEH_NEXT_ERR_DEAD_IOC:
653 &hose_list, list_node) { 654 /* Mark all PHBs in dead state */
654 phb_pe = eeh_phb_pe_get(hose); 655 eeh_serialize_lock(&flags);
655 if (!phb_pe) continue; 656
656 657 /* Purge all events */
657 eeh_pe_state_mark(phb_pe, 658 eeh_remove_event(NULL);
658 EEH_PE_ISOLATED | EEH_PE_PHB_DEAD); 659
660 list_for_each_entry(hose, &hose_list, list_node) {
661 phb_pe = eeh_phb_pe_get(hose);
662 if (!phb_pe) continue;
663
664 eeh_pe_state_mark(phb_pe,
665 EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
666 }
667
668 eeh_serialize_unlock(flags);
669
670 break;
671 case EEH_NEXT_ERR_FROZEN_PE:
672 case EEH_NEXT_ERR_FENCED_PHB:
673 case EEH_NEXT_ERR_DEAD_PHB:
674 /* Mark the PE in fenced state */
675 eeh_serialize_lock(&flags);
676
677 /* Purge all events of the PHB */
678 eeh_remove_event(pe);
679
680 if (rc == EEH_NEXT_ERR_DEAD_PHB)
681 eeh_pe_state_mark(pe,
682 EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
683 else
684 eeh_pe_state_mark(pe,
685 EEH_PE_ISOLATED | EEH_PE_RECOVERING);
686
687 eeh_serialize_unlock(flags);
688
689 break;
690 case EEH_NEXT_ERR_NONE:
691 return;
692 default:
693 pr_warn("%s: Invalid value %d from next_error()\n",
694 __func__, rc);
695 return;
659 } 696 }
660 eeh_serialize_unlock(flags);
661
662 /* Purge all events */
663 eeh_remove_event(NULL);
664 break;
665 case 3:
666 case 2:
667 case 1:
668 /* Mark the PE in fenced state */
669 eeh_serialize_lock(&flags);
670 if (rc == 3)
671 eeh_pe_state_mark(pe,
672 EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
673 else
674 eeh_pe_state_mark(pe,
675 EEH_PE_ISOLATED | EEH_PE_RECOVERING);
676 eeh_serialize_unlock(flags);
677
678 /* Purge all events of the PHB */
679 eeh_remove_event(pe);
680 break;
681 default:
682 pr_err("%s: Invalid value %d from next_error()\n",
683 __func__, rc);
684 return;
685 }
686 697
687 /* 698 /*
688 * For fenced PHB and frozen PE, it's handled as normal 699 * For fenced PHB and frozen PE, it's handled as normal
689 * event. We have to remove the affected PHBs for dead 700 * event. We have to remove the affected PHBs for dead
690 * PHB and IOC 701 * PHB and IOC
691 */ 702 */
692 if (rc == 2 || rc == 1) 703 if (rc == EEH_NEXT_ERR_FROZEN_PE ||
693 eeh_handle_normal_event(pe); 704 rc == EEH_NEXT_ERR_FENCED_PHB) {
694 else { 705 eeh_handle_normal_event(pe);
695 list_for_each_entry_safe(hose, tmp, 706 } else {
696 &hose_list, list_node) { 707 pci_lock_rescan_remove();
697 phb_pe = eeh_phb_pe_get(hose); 708 list_for_each_entry(hose, &hose_list, list_node) {
698 if (!phb_pe || !(phb_pe->state & EEH_PE_PHB_DEAD)) 709 phb_pe = eeh_phb_pe_get(hose);
699 continue; 710 if (!phb_pe ||
700 711 !(phb_pe->state & EEH_PE_PHB_DEAD))
701 bus = eeh_pe_bus_get(phb_pe); 712 continue;
702 /* Notify all devices that they're about to go down. */ 713
703 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL); 714 /* Notify all devices to be down */
704 pcibios_remove_pci_devices(bus); 715 bus = eeh_pe_bus_get(phb_pe);
716 eeh_pe_dev_traverse(pe,
717 eeh_report_failure, NULL);
718 pcibios_remove_pci_devices(bus);
719 }
720 pci_unlock_rescan_remove();
705 } 721 }
706 } 722
723 /*
724 * If we have detected dead IOC, we needn't proceed
725 * any more since all PHBs would have been removed
726 */
727 if (rc == EEH_NEXT_ERR_DEAD_IOC)
728 break;
729 } while (rc != EEH_NEXT_ERR_NONE);
707} 730}
708 731
709/** 732/**
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index f9450537e335..f0c353fa655a 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -25,7 +25,6 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/gfp.h> 27#include <linux/gfp.h>
28#include <linux/init.h>
29#include <linux/kernel.h> 28#include <linux/kernel.h>
30#include <linux/pci.h> 29#include <linux/pci.h>
31#include <linux/string.h> 30#include <linux/string.h>
@@ -737,6 +736,9 @@ static void *eeh_restore_one_device_bars(void *data, void *flag)
737 else 736 else
738 eeh_restore_device_bars(edev, dn); 737 eeh_restore_device_bars(edev, dn);
739 738
739 if (eeh_ops->restore_config)
740 eeh_ops->restore_config(dn);
741
740 return NULL; 742 return NULL;
741} 743}
742 744
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index bbfb0294b354..662c6dd98072 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -664,8 +664,16 @@ _GLOBAL(ret_from_except_lite)
664 bl .restore_interrupts 664 bl .restore_interrupts
665 SCHEDULE_USER 665 SCHEDULE_USER
666 b .ret_from_except_lite 666 b .ret_from_except_lite
667 6672:
6682: bl .save_nvgprs 668#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
669 andi. r0,r4,_TIF_USER_WORK_MASK & ~_TIF_RESTORE_TM
670 bne 3f /* only restore TM if nothing else to do */
671 addi r3,r1,STACK_FRAME_OVERHEAD
672 bl .restore_tm_state
673 b restore
6743:
675#endif
676 bl .save_nvgprs
669 bl .restore_interrupts 677 bl .restore_interrupts
670 addi r3,r1,STACK_FRAME_OVERHEAD 678 addi r3,r1,STACK_FRAME_OVERHEAD
671 bl .do_notify_resume 679 bl .do_notify_resume
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index e7751561fd1d..063b65dd4f27 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -308,6 +308,7 @@ interrupt_base_book3e: /* fake trap */
308 EXCEPTION_STUB(0x2e0, guest_doorbell_crit) 308 EXCEPTION_STUB(0x2e0, guest_doorbell_crit)
309 EXCEPTION_STUB(0x300, hypercall) 309 EXCEPTION_STUB(0x300, hypercall)
310 EXCEPTION_STUB(0x320, ehpriv) 310 EXCEPTION_STUB(0x320, ehpriv)
311 EXCEPTION_STUB(0x340, lrat_error)
311 312
312 .globl interrupt_end_book3e 313 .globl interrupt_end_book3e
313interrupt_end_book3e: 314interrupt_end_book3e:
@@ -677,6 +678,17 @@ kernel_dbg_exc:
677 bl .unknown_exception 678 bl .unknown_exception
678 b .ret_from_except 679 b .ret_from_except
679 680
681/* LRAT Error interrupt */
682 START_EXCEPTION(lrat_error);
683 NORMAL_EXCEPTION_PROLOG(0x340, BOOKE_INTERRUPT_LRAT_ERROR,
684 PROLOG_ADDITION_NONE)
685 EXCEPTION_COMMON(0x340, PACA_EXGEN, INTS_KEEP)
686 addi r3,r1,STACK_FRAME_OVERHEAD
687 bl .save_nvgprs
688 INTS_RESTORE_HARD
689 bl .unknown_exception
690 b .ret_from_except
691
680/* 692/*
681 * An interrupt came in while soft-disabled; We mark paca->irq_happened 693 * An interrupt came in while soft-disabled; We mark paca->irq_happened
682 * accordingly and if the interrupt is level sensitive, we hard disable 694 * accordingly and if the interrupt is level sensitive, we hard disable
@@ -859,6 +871,7 @@ BAD_STACK_TRAMPOLINE(0x2e0)
859BAD_STACK_TRAMPOLINE(0x300) 871BAD_STACK_TRAMPOLINE(0x300)
860BAD_STACK_TRAMPOLINE(0x310) 872BAD_STACK_TRAMPOLINE(0x310)
861BAD_STACK_TRAMPOLINE(0x320) 873BAD_STACK_TRAMPOLINE(0x320)
874BAD_STACK_TRAMPOLINE(0x340)
862BAD_STACK_TRAMPOLINE(0x400) 875BAD_STACK_TRAMPOLINE(0x400)
863BAD_STACK_TRAMPOLINE(0x500) 876BAD_STACK_TRAMPOLINE(0x500)
864BAD_STACK_TRAMPOLINE(0x600) 877BAD_STACK_TRAMPOLINE(0x600)
@@ -1055,12 +1068,9 @@ skpinv: addi r6,r6,1 /* Increment */
1055 mtspr SPRN_MAS0,r3 1068 mtspr SPRN_MAS0,r3
1056 tlbre 1069 tlbre
1057 mfspr r6,SPRN_MAS1 1070 mfspr r6,SPRN_MAS1
1058 rlwinm r6,r6,0,2,0 /* clear IPROT */ 1071 rlwinm r6,r6,0,2,31 /* clear IPROT and VALID */
1059 mtspr SPRN_MAS1,r6 1072 mtspr SPRN_MAS1,r6
1060 tlbwe 1073 tlbwe
1061
1062 /* Invalidate TLB1 */
1063 PPC_TLBILX_ALL(0,R0)
1064 sync 1074 sync
1065 isync 1075 isync
1066 1076
@@ -1114,12 +1124,9 @@ skpinv: addi r6,r6,1 /* Increment */
1114 mtspr SPRN_MAS0,r4 1124 mtspr SPRN_MAS0,r4
1115 tlbre 1125 tlbre
1116 mfspr r5,SPRN_MAS1 1126 mfspr r5,SPRN_MAS1
1117 rlwinm r5,r5,0,2,0 /* clear IPROT */ 1127 rlwinm r5,r5,0,2,31 /* clear IPROT and VALID */
1118 mtspr SPRN_MAS1,r5 1128 mtspr SPRN_MAS1,r5
1119 tlbwe 1129 tlbwe
1120
1121 /* Invalidate TLB1 */
1122 PPC_TLBILX_ALL(0,R0)
1123 sync 1130 sync
1124 isync 1131 isync
1125 1132
@@ -1414,3 +1421,7 @@ _GLOBAL(setup_ehv_ivors)
1414 SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */ 1421 SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */
1415 SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */ 1422 SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */
1416 blr 1423 blr
1424
1425_GLOBAL(setup_lrat_ivor)
1426 SET_IVOR(42, 0x340) /* LRAT Error */
1427 blr
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 9f905e40922e..38d507306a11 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -155,8 +155,30 @@ machine_check_pSeries_1:
155 */ 155 */
156 HMT_MEDIUM_PPR_DISCARD 156 HMT_MEDIUM_PPR_DISCARD
157 SET_SCRATCH0(r13) /* save r13 */ 157 SET_SCRATCH0(r13) /* save r13 */
158#ifdef CONFIG_PPC_P7_NAP
159BEGIN_FTR_SECTION
160 /* Running native on arch 2.06 or later, check if we are
161 * waking up from nap. We only handle no state loss and
162 * supervisor state loss. We do -not- handle hypervisor
163 * state loss at this time.
164 */
165 mfspr r13,SPRN_SRR1
166 rlwinm. r13,r13,47-31,30,31
167 beq 9f
168
169 /* waking up from powersave (nap) state */
170 cmpwi cr1,r13,2
171 /* Total loss of HV state is fatal. let's just stay stuck here */
172 bgt cr1,.
1739:
174END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
175#endif /* CONFIG_PPC_P7_NAP */
158 EXCEPTION_PROLOG_0(PACA_EXMC) 176 EXCEPTION_PROLOG_0(PACA_EXMC)
177BEGIN_FTR_SECTION
178 b machine_check_pSeries_early
179FTR_SECTION_ELSE
159 b machine_check_pSeries_0 180 b machine_check_pSeries_0
181ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
160 182
161 . = 0x300 183 . = 0x300
162 .globl data_access_pSeries 184 .globl data_access_pSeries
@@ -405,6 +427,64 @@ denorm_exception_hv:
405 427
406 .align 7 428 .align 7
407 /* moved from 0x200 */ 429 /* moved from 0x200 */
430machine_check_pSeries_early:
431BEGIN_FTR_SECTION
432 EXCEPTION_PROLOG_1(PACA_EXMC, NOTEST, 0x200)
433 /*
434 * Register contents:
435 * R13 = PACA
436 * R9 = CR
437 * Original R9 to R13 is saved on PACA_EXMC
438 *
439 * Switch to mc_emergency stack and handle re-entrancy (though we
440 * currently don't test for overflow). Save MCE registers srr1,
441 * srr0, dar and dsisr and then set ME=1
442 *
443 * We use paca->in_mce to check whether this is the first entry or
444 * nested machine check. We increment paca->in_mce to track nested
445 * machine checks.
446 *
447 * If this is the first entry then set stack pointer to
448 * paca->mc_emergency_sp, otherwise r1 is already pointing to
449 * stack frame on mc_emergency stack.
450 *
451 * NOTE: We are here with MSR_ME=0 (off), which means we risk a
452 * checkstop if we get another machine check exception before we do
453 * rfid with MSR_ME=1.
454 */
455 mr r11,r1 /* Save r1 */
456 lhz r10,PACA_IN_MCE(r13)
457 cmpwi r10,0 /* Are we in nested machine check */
458 bne 0f /* Yes, we are. */
459 /* First machine check entry */
460 ld r1,PACAMCEMERGSP(r13) /* Use MC emergency stack */
4610: subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
462 addi r10,r10,1 /* increment paca->in_mce */
463 sth r10,PACA_IN_MCE(r13)
464 std r11,GPR1(r1) /* Save r1 on the stack. */
465 std r11,0(r1) /* make stack chain pointer */
466 mfspr r11,SPRN_SRR0 /* Save SRR0 */
467 std r11,_NIP(r1)
468 mfspr r11,SPRN_SRR1 /* Save SRR1 */
469 std r11,_MSR(r1)
470 mfspr r11,SPRN_DAR /* Save DAR */
471 std r11,_DAR(r1)
472 mfspr r11,SPRN_DSISR /* Save DSISR */
473 std r11,_DSISR(r1)
474 std r9,_CCR(r1) /* Save CR in stackframe */
475 /* Save r9 through r13 from EXMC save area to stack frame. */
476 EXCEPTION_PROLOG_COMMON_2(PACA_EXMC)
477 mfmsr r11 /* get MSR value */
478 ori r11,r11,MSR_ME /* turn on ME bit */
479 ori r11,r11,MSR_RI /* turn on RI bit */
480 ld r12,PACAKBASE(r13) /* get high part of &label */
481 LOAD_HANDLER(r12, machine_check_handle_early)
482 mtspr SPRN_SRR0,r12
483 mtspr SPRN_SRR1,r11
484 rfid
485 b . /* prevent speculative execution */
486END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
487
408machine_check_pSeries: 488machine_check_pSeries:
409 .globl machine_check_fwnmi 489 .globl machine_check_fwnmi
410machine_check_fwnmi: 490machine_check_fwnmi:
@@ -688,30 +768,6 @@ kvmppc_skip_Hinterrupt:
688 768
689 STD_EXCEPTION_COMMON(0x100, system_reset, .system_reset_exception) 769 STD_EXCEPTION_COMMON(0x100, system_reset, .system_reset_exception)
690 770
691 /*
692 * Machine check is different because we use a different
693 * save area: PACA_EXMC instead of PACA_EXGEN.
694 */
695 .align 7
696 .globl machine_check_common
697machine_check_common:
698
699 mfspr r10,SPRN_DAR
700 std r10,PACA_EXGEN+EX_DAR(r13)
701 mfspr r10,SPRN_DSISR
702 stw r10,PACA_EXGEN+EX_DSISR(r13)
703 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
704 FINISH_NAP
705 DISABLE_INTS
706 ld r3,PACA_EXGEN+EX_DAR(r13)
707 lwz r4,PACA_EXGEN+EX_DSISR(r13)
708 std r3,_DAR(r1)
709 std r4,_DSISR(r1)
710 bl .save_nvgprs
711 addi r3,r1,STACK_FRAME_OVERHEAD
712 bl .machine_check_exception
713 b .ret_from_except
714
715 STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ) 771 STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ)
716 STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, .timer_interrupt) 772 STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, .timer_interrupt)
717 STD_EXCEPTION_COMMON(0x980, hdecrementer, .hdec_interrupt) 773 STD_EXCEPTION_COMMON(0x980, hdecrementer, .hdec_interrupt)
@@ -1080,6 +1136,30 @@ unrecov_user_slb:
1080#endif /* __DISABLED__ */ 1136#endif /* __DISABLED__ */
1081 1137
1082 1138
1139 /*
1140 * Machine check is different because we use a different
1141 * save area: PACA_EXMC instead of PACA_EXGEN.
1142 */
1143 .align 7
1144 .globl machine_check_common
1145machine_check_common:
1146
1147 mfspr r10,SPRN_DAR
1148 std r10,PACA_EXGEN+EX_DAR(r13)
1149 mfspr r10,SPRN_DSISR
1150 stw r10,PACA_EXGEN+EX_DSISR(r13)
1151 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
1152 FINISH_NAP
1153 DISABLE_INTS
1154 ld r3,PACA_EXGEN+EX_DAR(r13)
1155 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1156 std r3,_DAR(r1)
1157 std r4,_DSISR(r1)
1158 bl .save_nvgprs
1159 addi r3,r1,STACK_FRAME_OVERHEAD
1160 bl .machine_check_exception
1161 b .ret_from_except
1162
1083 .align 7 1163 .align 7
1084 .globl alignment_common 1164 .globl alignment_common
1085alignment_common: 1165alignment_common:
@@ -1263,6 +1343,120 @@ _GLOBAL(opal_mc_secondary_handler)
1263#endif /* CONFIG_PPC_POWERNV */ 1343#endif /* CONFIG_PPC_POWERNV */
1264 1344
1265 1345
1346#define MACHINE_CHECK_HANDLER_WINDUP \
1347 /* Clear MSR_RI before setting SRR0 and SRR1. */\
1348 li r0,MSR_RI; \
1349 mfmsr r9; /* get MSR value */ \
1350 andc r9,r9,r0; \
1351 mtmsrd r9,1; /* Clear MSR_RI */ \
1352 /* Move original SRR0 and SRR1 into the respective regs */ \
1353 ld r9,_MSR(r1); \
1354 mtspr SPRN_SRR1,r9; \
1355 ld r3,_NIP(r1); \
1356 mtspr SPRN_SRR0,r3; \
1357 ld r9,_CTR(r1); \
1358 mtctr r9; \
1359 ld r9,_XER(r1); \
1360 mtxer r9; \
1361 ld r9,_LINK(r1); \
1362 mtlr r9; \
1363 REST_GPR(0, r1); \
1364 REST_8GPRS(2, r1); \
1365 REST_GPR(10, r1); \
1366 ld r11,_CCR(r1); \
1367 mtcr r11; \
1368 /* Decrement paca->in_mce. */ \
1369 lhz r12,PACA_IN_MCE(r13); \
1370 subi r12,r12,1; \
1371 sth r12,PACA_IN_MCE(r13); \
1372 REST_GPR(11, r1); \
1373 REST_2GPRS(12, r1); \
1374 /* restore original r1. */ \
1375 ld r1,GPR1(r1)
1376
1377 /*
1378 * Handle machine check early in real mode. We come here with
1379 * ME=1, MMU (IR=0 and DR=0) off and using MC emergency stack.
1380 */
1381 .align 7
1382 .globl machine_check_handle_early
1383machine_check_handle_early:
1384 std r0,GPR0(r1) /* Save r0 */
1385 EXCEPTION_PROLOG_COMMON_3(0x200)
1386 bl .save_nvgprs
1387 addi r3,r1,STACK_FRAME_OVERHEAD
1388 bl .machine_check_early
1389 ld r12,_MSR(r1)
1390#ifdef CONFIG_PPC_P7_NAP
1391 /*
1392 * Check if thread was in power saving mode. We come here when any
1393 * of the following is true:
1394 * a. thread wasn't in power saving mode
1395 * b. thread was in power saving mode with no state loss or
1396 * supervisor state loss
1397 *
1398 * Go back to nap again if (b) is true.
1399 */
1400 rlwinm. r11,r12,47-31,30,31 /* Was it in power saving mode? */
1401 beq 4f /* No, it wasn;t */
1402 /* Thread was in power saving mode. Go back to nap again. */
1403 cmpwi r11,2
1404 bne 3f
1405 /* Supervisor state loss */
1406 li r0,1
1407 stb r0,PACA_NAPSTATELOST(r13)
14083: bl .machine_check_queue_event
1409 MACHINE_CHECK_HANDLER_WINDUP
1410 GET_PACA(r13)
1411 ld r1,PACAR1(r13)
1412 b .power7_enter_nap_mode
14134:
1414#endif
1415 /*
1416 * Check if we are coming from hypervisor userspace. If yes then we
1417 * continue in host kernel in V mode to deliver the MC event.
1418 */
1419 rldicl. r11,r12,4,63 /* See if MC hit while in HV mode. */
1420 beq 5f
1421 andi. r11,r12,MSR_PR /* See if coming from user. */
1422 bne 9f /* continue in V mode if we are. */
1423
14245:
1425#ifdef CONFIG_KVM_BOOK3S_64_HV
1426 /*
1427 * We are coming from kernel context. Check if we are coming from
1428 * guest. if yes, then we can continue. We will fall through
1429 * do_kvm_200->kvmppc_interrupt to deliver the MC event to guest.
1430 */
1431 lbz r11,HSTATE_IN_GUEST(r13)
1432 cmpwi r11,0 /* Check if coming from guest */
1433 bne 9f /* continue if we are. */
1434#endif
1435 /*
1436 * At this point we are not sure about what context we come from.
1437 * Queue up the MCE event and return from the interrupt.
1438 * But before that, check if this is an un-recoverable exception.
1439 * If yes, then stay on emergency stack and panic.
1440 */
1441 andi. r11,r12,MSR_RI
1442 bne 2f
14431: addi r3,r1,STACK_FRAME_OVERHEAD
1444 bl .unrecoverable_exception
1445 b 1b
14462:
1447 /*
1448 * Return from MC interrupt.
1449 * Queue up the MCE event so that we can log it later, while
1450 * returning from kernel or opal call.
1451 */
1452 bl .machine_check_queue_event
1453 MACHINE_CHECK_HANDLER_WINDUP
1454 rfid
14559:
1456 /* Deliver the machine check to host kernel in V mode. */
1457 MACHINE_CHECK_HANDLER_WINDUP
1458 b machine_check_pSeries
1459
1266/* 1460/*
1267 * r13 points to the PACA, r9 contains the saved CR, 1461 * r13 points to the PACA, r9 contains the saved CR,
1268 * r12 contain the saved SRR1, SRR0 is still ready for return 1462 * r12 contain the saved SRR1, SRR0 is still ready for return
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index f7f5b8bed68f..9ad236e5d2c9 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -81,6 +81,22 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
81#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 81#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
82 82
83/* 83/*
84 * Enable use of the FPU, and VSX if possible, for the caller.
85 */
86_GLOBAL(fp_enable)
87 mfmsr r3
88 ori r3,r3,MSR_FP
89#ifdef CONFIG_VSX
90BEGIN_FTR_SECTION
91 oris r3,r3,MSR_VSX@h
92END_FTR_SECTION_IFSET(CPU_FTR_VSX)
93#endif
94 SYNC
95 MTMSRD(r3)
96 isync /* (not necessary for arch 2.02 and later) */
97 blr
98
99/*
84 * Load state from memory into FP registers including FPSCR. 100 * Load state from memory into FP registers including FPSCR.
85 * Assumes the caller has enabled FP in the MSR. 101 * Assumes the caller has enabled FP in the MSR.
86 */ 102 */
diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
index a92c79be2728..f22e7e44fbf3 100644
--- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
+++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
@@ -176,6 +176,8 @@ skpinv: addi r6,r6,1 /* Increment */
176/* 7. Jump to KERNELBASE mapping */ 176/* 7. Jump to KERNELBASE mapping */
177 lis r6,(KERNELBASE & ~0xfff)@h 177 lis r6,(KERNELBASE & ~0xfff)@h
178 ori r6,r6,(KERNELBASE & ~0xfff)@l 178 ori r6,r6,(KERNELBASE & ~0xfff)@l
179 rlwinm r7,r25,0,0x03ffffff
180 add r6,r7,r6
179 181
180#elif defined(ENTRY_MAPPING_KEXEC_SETUP) 182#elif defined(ENTRY_MAPPING_KEXEC_SETUP)
181/* 183/*
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 4f0946de2d5c..b7363bd42452 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include <linux/threads.h> 25#include <linux/threads.h>
26#include <linux/init.h>
26#include <asm/reg.h> 27#include <asm/reg.h>
27#include <asm/page.h> 28#include <asm/page.h>
28#include <asm/mmu.h> 29#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index f45726a1d963..b497188a94a1 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -65,29 +65,78 @@ _ENTRY(_start);
65 nop 65 nop
66 66
67 /* Translate device tree address to physical, save in r30/r31 */ 67 /* Translate device tree address to physical, save in r30/r31 */
68 mfmsr r16 68 bl get_phys_addr
69 mfspr r17,SPRN_PID 69 mr r30,r3
70 rlwinm r17,r17,16,0x3fff0000 /* turn PID into MAS6[SPID] */ 70 mr r31,r4
71 rlwimi r17,r16,28,0x00000001 /* turn MSR[DS] into MAS6[SAS] */
72 mtspr SPRN_MAS6,r17
73
74 tlbsx 0,r3 /* must succeed */
75
76 mfspr r16,SPRN_MAS1
77 mfspr r20,SPRN_MAS3
78 rlwinm r17,r16,25,0x1f /* r17 = log2(page size) */
79 li r18,1024
80 slw r18,r18,r17 /* r18 = page size */
81 addi r18,r18,-1
82 and r19,r3,r18 /* r19 = page offset */
83 andc r31,r20,r18 /* r31 = page base */
84 or r31,r31,r19 /* r31 = devtree phys addr */
85 mfspr r30,SPRN_MAS7
86 71
87 li r25,0 /* phys kernel start (low) */ 72 li r25,0 /* phys kernel start (low) */
88 li r24,0 /* CPU number */ 73 li r24,0 /* CPU number */
89 li r23,0 /* phys kernel start (high) */ 74 li r23,0 /* phys kernel start (high) */
90 75
76#ifdef CONFIG_RELOCATABLE
77 LOAD_REG_ADDR_PIC(r3, _stext) /* Get our current runtime base */
78
79 /* Translate _stext address to physical, save in r23/r25 */
80 bl get_phys_addr
81 mr r23,r3
82 mr r25,r4
83
84 bl 0f
850: mflr r8
86 addis r3,r8,(is_second_reloc - 0b)@ha
87 lwz r19,(is_second_reloc - 0b)@l(r3)
88
89 /* Check if this is the second relocation. */
90 cmpwi r19,1
91 bne 1f
92
93 /*
94 * For the second relocation, we already get the real memstart_addr
95 * from device tree. So we will map PAGE_OFFSET to memstart_addr,
96 * then the virtual address of start kernel should be:
97 * PAGE_OFFSET + (kernstart_addr - memstart_addr)
98 * Since the offset between kernstart_addr and memstart_addr should
99 * never be beyond 1G, so we can just use the lower 32bit of them
100 * for the calculation.
101 */
102 lis r3,PAGE_OFFSET@h
103
104 addis r4,r8,(kernstart_addr - 0b)@ha
105 addi r4,r4,(kernstart_addr - 0b)@l
106 lwz r5,4(r4)
107
108 addis r6,r8,(memstart_addr - 0b)@ha
109 addi r6,r6,(memstart_addr - 0b)@l
110 lwz r7,4(r6)
111
112 subf r5,r7,r5
113 add r3,r3,r5
114 b 2f
115
1161:
117 /*
118 * We have the runtime (virutal) address of our base.
119 * We calculate our shift of offset from a 64M page.
120 * We could map the 64M page we belong to at PAGE_OFFSET and
121 * get going from there.
122 */
123 lis r4,KERNELBASE@h
124 ori r4,r4,KERNELBASE@l
125 rlwinm r6,r25,0,0x3ffffff /* r6 = PHYS_START % 64M */
126 rlwinm r5,r4,0,0x3ffffff /* r5 = KERNELBASE % 64M */
127 subf r3,r5,r6 /* r3 = r6 - r5 */
128 add r3,r4,r3 /* Required Virtual Address */
129
1302: bl relocate
131
132 /*
133 * For the second relocation, we already set the right tlb entries
134 * for the kernel space, so skip the code in fsl_booke_entry_mapping.S
135 */
136 cmpwi r19,1
137 beq set_ivor
138#endif
139
91/* We try to not make any assumptions about how the boot loader 140/* We try to not make any assumptions about how the boot loader
92 * setup or used the TLBs. We invalidate all mappings from the 141 * setup or used the TLBs. We invalidate all mappings from the
93 * boot loader and load a single entry in TLB1[0] to map the 142 * boot loader and load a single entry in TLB1[0] to map the
@@ -113,6 +162,7 @@ _ENTRY(__early_start)
113#include "fsl_booke_entry_mapping.S" 162#include "fsl_booke_entry_mapping.S"
114#undef ENTRY_MAPPING_BOOT_SETUP 163#undef ENTRY_MAPPING_BOOT_SETUP
115 164
165set_ivor:
116 /* Establish the interrupt vector offsets */ 166 /* Establish the interrupt vector offsets */
117 SET_IVOR(0, CriticalInput); 167 SET_IVOR(0, CriticalInput);
118 SET_IVOR(1, MachineCheck); 168 SET_IVOR(1, MachineCheck);
@@ -166,8 +216,7 @@ _ENTRY(__early_start)
166 /* Check to see if we're the second processor, and jump 216 /* Check to see if we're the second processor, and jump
167 * to the secondary_start code if so 217 * to the secondary_start code if so
168 */ 218 */
169 lis r24, boot_cpuid@h 219 LOAD_REG_ADDR_PIC(r24, boot_cpuid)
170 ori r24, r24, boot_cpuid@l
171 lwz r24, 0(r24) 220 lwz r24, 0(r24)
172 cmpwi r24, -1 221 cmpwi r24, -1
173 mfspr r24,SPRN_PIR 222 mfspr r24,SPRN_PIR
@@ -197,6 +246,18 @@ _ENTRY(__early_start)
197 246
198 bl early_init 247 bl early_init
199 248
249#ifdef CONFIG_RELOCATABLE
250 mr r3,r30
251 mr r4,r31
252#ifdef CONFIG_PHYS_64BIT
253 mr r5,r23
254 mr r6,r25
255#else
256 mr r5,r25
257#endif
258 bl relocate_init
259#endif
260
200#ifdef CONFIG_DYNAMIC_MEMSTART 261#ifdef CONFIG_DYNAMIC_MEMSTART
201 lis r3,kernstart_addr@ha 262 lis r3,kernstart_addr@ha
202 la r3,kernstart_addr@l(r3) 263 la r3,kernstart_addr@l(r3)
@@ -856,6 +917,33 @@ KernelSPE:
856#endif /* CONFIG_SPE */ 917#endif /* CONFIG_SPE */
857 918
858/* 919/*
920 * Translate the effec addr in r3 to phys addr. The phys addr will be put
921 * into r3(higher 32bit) and r4(lower 32bit)
922 */
923get_phys_addr:
924 mfmsr r8
925 mfspr r9,SPRN_PID
926 rlwinm r9,r9,16,0x3fff0000 /* turn PID into MAS6[SPID] */
927 rlwimi r9,r8,28,0x00000001 /* turn MSR[DS] into MAS6[SAS] */
928 mtspr SPRN_MAS6,r9
929
930 tlbsx 0,r3 /* must succeed */
931
932 mfspr r8,SPRN_MAS1
933 mfspr r12,SPRN_MAS3
934 rlwinm r9,r8,25,0x1f /* r9 = log2(page size) */
935 li r10,1024
936 slw r10,r10,r9 /* r10 = page size */
937 addi r10,r10,-1
938 and r11,r3,r10 /* r11 = page offset */
939 andc r4,r12,r10 /* r4 = page base */
940 or r4,r4,r11 /* r4 = devtree phys addr */
941#ifdef CONFIG_PHYS_64BIT
942 mfspr r3,SPRN_MAS7
943#endif
944 blr
945
946/*
859 * Global functions 947 * Global functions
860 */ 948 */
861 949
@@ -1057,24 +1145,36 @@ _GLOBAL(__flush_disable_L1)
1057/* When we get here, r24 needs to hold the CPU # */ 1145/* When we get here, r24 needs to hold the CPU # */
1058 .globl __secondary_start 1146 .globl __secondary_start
1059__secondary_start: 1147__secondary_start:
1060 lis r3,__secondary_hold_acknowledge@h 1148 LOAD_REG_ADDR_PIC(r3, tlbcam_index)
1061 ori r3,r3,__secondary_hold_acknowledge@l 1149 lwz r3,0(r3)
1062 stw r24,0(r3)
1063
1064 li r3,0
1065 mr r4,r24 /* Why? */
1066 bl call_setup_cpu
1067
1068 lis r3,tlbcam_index@ha
1069 lwz r3,tlbcam_index@l(r3)
1070 mtctr r3 1150 mtctr r3
1071 li r26,0 /* r26 safe? */ 1151 li r26,0 /* r26 safe? */
1072 1152
1153 bl switch_to_as1
1154 mr r27,r3 /* tlb entry */
1073 /* Load each CAM entry */ 1155 /* Load each CAM entry */
10741: mr r3,r26 11561: mr r3,r26
1075 bl loadcam_entry 1157 bl loadcam_entry
1076 addi r26,r26,1 1158 addi r26,r26,1
1077 bdnz 1b 1159 bdnz 1b
1160 mr r3,r27 /* tlb entry */
1161 LOAD_REG_ADDR_PIC(r4, memstart_addr)
1162 lwz r4,0(r4)
1163 mr r5,r25 /* phys kernel start */
1164 rlwinm r5,r5,0,~0x3ffffff /* aligned 64M */
1165 subf r4,r5,r4 /* memstart_addr - phys kernel start */
1166 li r5,0 /* no device tree */
1167 li r6,0 /* not boot cpu */
1168 bl restore_to_as0
1169
1170
1171 lis r3,__secondary_hold_acknowledge@h
1172 ori r3,r3,__secondary_hold_acknowledge@l
1173 stw r24,0(r3)
1174
1175 li r3,0
1176 mr r4,r24 /* Why? */
1177 bl call_setup_cpu
1078 1178
1079 /* get current_thread_info and current */ 1179 /* get current_thread_info and current */
1080 lis r1,secondary_ti@ha 1180 lis r1,secondary_ti@ha
@@ -1111,6 +1211,112 @@ __secondary_hold_acknowledge:
1111#endif 1211#endif
1112 1212
1113/* 1213/*
1214 * Create a tlb entry with the same effective and physical address as
1215 * the tlb entry used by the current running code. But set the TS to 1.
1216 * Then switch to the address space 1. It will return with the r3 set to
1217 * the ESEL of the new created tlb.
1218 */
1219_GLOBAL(switch_to_as1)
1220 mflr r5
1221
1222 /* Find a entry not used */
1223 mfspr r3,SPRN_TLB1CFG
1224 andi. r3,r3,0xfff
1225 mfspr r4,SPRN_PID
1226 rlwinm r4,r4,16,0x3fff0000 /* turn PID into MAS6[SPID] */
1227 mtspr SPRN_MAS6,r4
12281: lis r4,0x1000 /* Set MAS0(TLBSEL) = 1 */
1229 addi r3,r3,-1
1230 rlwimi r4,r3,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r3) */
1231 mtspr SPRN_MAS0,r4
1232 tlbre
1233 mfspr r4,SPRN_MAS1
1234 andis. r4,r4,MAS1_VALID@h
1235 bne 1b
1236
1237 /* Get the tlb entry used by the current running code */
1238 bl 0f
12390: mflr r4
1240 tlbsx 0,r4
1241
1242 mfspr r4,SPRN_MAS1
1243 ori r4,r4,MAS1_TS /* Set the TS = 1 */
1244 mtspr SPRN_MAS1,r4
1245
1246 mfspr r4,SPRN_MAS0
1247 rlwinm r4,r4,0,~MAS0_ESEL_MASK
1248 rlwimi r4,r3,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r3) */
1249 mtspr SPRN_MAS0,r4
1250 tlbwe
1251 isync
1252 sync
1253
1254 mfmsr r4
1255 ori r4,r4,MSR_IS | MSR_DS
1256 mtspr SPRN_SRR0,r5
1257 mtspr SPRN_SRR1,r4
1258 sync
1259 rfi
1260
1261/*
1262 * Restore to the address space 0 and also invalidate the tlb entry created
1263 * by switch_to_as1.
1264 * r3 - the tlb entry which should be invalidated
1265 * r4 - __pa(PAGE_OFFSET in AS1) - __pa(PAGE_OFFSET in AS0)
1266 * r5 - device tree virtual address. If r4 is 0, r5 is ignored.
1267 * r6 - boot cpu
1268*/
1269_GLOBAL(restore_to_as0)
1270 mflr r0
1271
1272 bl 0f
12730: mflr r9
1274 addi r9,r9,1f - 0b
1275
1276 /*
1277 * We may map the PAGE_OFFSET in AS0 to a different physical address,
1278 * so we need calculate the right jump and device tree address based
1279 * on the offset passed by r4.
1280 */
1281 add r9,r9,r4
1282 add r5,r5,r4
1283 add r0,r0,r4
1284
12852: mfmsr r7
1286 li r8,(MSR_IS | MSR_DS)
1287 andc r7,r7,r8
1288
1289 mtspr SPRN_SRR0,r9
1290 mtspr SPRN_SRR1,r7
1291 sync
1292 rfi
1293
1294 /* Invalidate the temporary tlb entry for AS1 */
12951: lis r9,0x1000 /* Set MAS0(TLBSEL) = 1 */
1296 rlwimi r9,r3,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r3) */
1297 mtspr SPRN_MAS0,r9
1298 tlbre
1299 mfspr r9,SPRN_MAS1
1300 rlwinm r9,r9,0,2,31 /* Clear MAS1 Valid and IPPROT */
1301 mtspr SPRN_MAS1,r9
1302 tlbwe
1303 isync
1304
1305 cmpwi r4,0
1306 cmpwi cr1,r6,0
1307 cror eq,4*cr1+eq,eq
1308 bne 3f /* offset != 0 && is_boot_cpu */
1309 mtlr r0
1310 blr
1311
1312 /*
1313 * The PAGE_OFFSET will map to a different physical address,
1314 * jump to _start to do another relocation again.
1315 */
13163: mr r3,r5
1317 bl _start
1318
1319/*
1114 * We put a few things here that have to be page-aligned. This stuff 1320 * We put a few things here that have to be page-aligned. This stuff
1115 * goes at the beginning of the data segment, which is page-aligned. 1321 * goes at the beginning of the data segment, which is page-aligned.
1116 */ 1322 */
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index f0b47d1a6b0e..b0a1792279bb 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -28,7 +28,6 @@
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/init.h>
32#include <linux/smp.h> 31#include <linux/smp.h>
33 32
34#include <asm/hw_breakpoint.h> 33#include <asm/hw_breakpoint.h>
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S
index 847e40e62fce..3fdef0f0c67f 100644
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -84,6 +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_GLOBAL(power7_enter_nap_mode)
87#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE 88#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
88 /* Tell KVM we're napping */ 89 /* Tell KVM we're napping */
89 li r4,KVM_HWTHREAD_IN_NAP 90 li r4,KVM_HWTHREAD_IN_NAP
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index 97a3715ac8bd..b82227e7e21b 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * (C) Copyright 2004 Linus Torvalds 4 * (C) Copyright 2004 Linus Torvalds
5 */ 5 */
6#include <linux/init.h>
7#include <linux/pci.h> 6#include <linux/pci.h>
8#include <linux/mm.h> 7#include <linux/mm.h>
9#include <linux/export.h> 8#include <linux/export.h>
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 572bb5b95f35..d773dd440a45 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -251,14 +251,13 @@ again:
251 251
252 if (dev) 252 if (dev)
253 boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, 253 boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
254 1 << IOMMU_PAGE_SHIFT); 254 1 << tbl->it_page_shift);
255 else 255 else
256 boundary_size = ALIGN(1UL << 32, 1 << IOMMU_PAGE_SHIFT); 256 boundary_size = ALIGN(1UL << 32, 1 << tbl->it_page_shift);
257 /* 4GB boundary for iseries_hv_alloc and iseries_hv_map */ 257 /* 4GB boundary for iseries_hv_alloc and iseries_hv_map */
258 258
259 n = iommu_area_alloc(tbl->it_map, limit, start, npages, 259 n = iommu_area_alloc(tbl->it_map, limit, start, npages, tbl->it_offset,
260 tbl->it_offset, boundary_size >> IOMMU_PAGE_SHIFT, 260 boundary_size >> tbl->it_page_shift, align_mask);
261 align_mask);
262 if (n == -1) { 261 if (n == -1) {
263 if (likely(pass == 0)) { 262 if (likely(pass == 0)) {
264 /* First try the pool from the start */ 263 /* First try the pool from the start */
@@ -320,12 +319,12 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
320 return DMA_ERROR_CODE; 319 return DMA_ERROR_CODE;
321 320
322 entry += tbl->it_offset; /* Offset into real TCE table */ 321 entry += tbl->it_offset; /* Offset into real TCE table */
323 ret = entry << IOMMU_PAGE_SHIFT; /* Set the return dma address */ 322 ret = entry << tbl->it_page_shift; /* Set the return dma address */
324 323
325 /* Put the TCEs in the HW table */ 324 /* Put the TCEs in the HW table */
326 build_fail = ppc_md.tce_build(tbl, entry, npages, 325 build_fail = ppc_md.tce_build(tbl, entry, npages,
327 (unsigned long)page & IOMMU_PAGE_MASK, 326 (unsigned long)page &
328 direction, attrs); 327 IOMMU_PAGE_MASK(tbl), direction, attrs);
329 328
330 /* ppc_md.tce_build() only returns non-zero for transient errors. 329 /* ppc_md.tce_build() only returns non-zero for transient errors.
331 * Clean up the table bitmap in this case and return 330 * Clean up the table bitmap in this case and return
@@ -352,7 +351,7 @@ static bool iommu_free_check(struct iommu_table *tbl, dma_addr_t dma_addr,
352{ 351{
353 unsigned long entry, free_entry; 352 unsigned long entry, free_entry;
354 353
355 entry = dma_addr >> IOMMU_PAGE_SHIFT; 354 entry = dma_addr >> tbl->it_page_shift;
356 free_entry = entry - tbl->it_offset; 355 free_entry = entry - tbl->it_offset;
357 356
358 if (((free_entry + npages) > tbl->it_size) || 357 if (((free_entry + npages) > tbl->it_size) ||
@@ -401,7 +400,7 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
401 unsigned long flags; 400 unsigned long flags;
402 struct iommu_pool *pool; 401 struct iommu_pool *pool;
403 402
404 entry = dma_addr >> IOMMU_PAGE_SHIFT; 403 entry = dma_addr >> tbl->it_page_shift;
405 free_entry = entry - tbl->it_offset; 404 free_entry = entry - tbl->it_offset;
406 405
407 pool = get_pool(tbl, free_entry); 406 pool = get_pool(tbl, free_entry);
@@ -468,13 +467,13 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
468 } 467 }
469 /* Allocate iommu entries for that segment */ 468 /* Allocate iommu entries for that segment */
470 vaddr = (unsigned long) sg_virt(s); 469 vaddr = (unsigned long) sg_virt(s);
471 npages = iommu_num_pages(vaddr, slen, IOMMU_PAGE_SIZE); 470 npages = iommu_num_pages(vaddr, slen, IOMMU_PAGE_SIZE(tbl));
472 align = 0; 471 align = 0;
473 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE && 472 if (tbl->it_page_shift < PAGE_SHIFT && slen >= PAGE_SIZE &&
474 (vaddr & ~PAGE_MASK) == 0) 473 (vaddr & ~PAGE_MASK) == 0)
475 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT; 474 align = PAGE_SHIFT - tbl->it_page_shift;
476 entry = iommu_range_alloc(dev, tbl, npages, &handle, 475 entry = iommu_range_alloc(dev, tbl, npages, &handle,
477 mask >> IOMMU_PAGE_SHIFT, align); 476 mask >> tbl->it_page_shift, align);
478 477
479 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); 478 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen);
480 479
@@ -489,16 +488,16 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
489 488
490 /* Convert entry to a dma_addr_t */ 489 /* Convert entry to a dma_addr_t */
491 entry += tbl->it_offset; 490 entry += tbl->it_offset;
492 dma_addr = entry << IOMMU_PAGE_SHIFT; 491 dma_addr = entry << tbl->it_page_shift;
493 dma_addr |= (s->offset & ~IOMMU_PAGE_MASK); 492 dma_addr |= (s->offset & ~IOMMU_PAGE_MASK(tbl));
494 493
495 DBG(" - %lu pages, entry: %lx, dma_addr: %lx\n", 494 DBG(" - %lu pages, entry: %lx, dma_addr: %lx\n",
496 npages, entry, dma_addr); 495 npages, entry, dma_addr);
497 496
498 /* Insert into HW table */ 497 /* Insert into HW table */
499 build_fail = ppc_md.tce_build(tbl, entry, npages, 498 build_fail = ppc_md.tce_build(tbl, entry, npages,
500 vaddr & IOMMU_PAGE_MASK, 499 vaddr & IOMMU_PAGE_MASK(tbl),
501 direction, attrs); 500 direction, attrs);
502 if(unlikely(build_fail)) 501 if(unlikely(build_fail))
503 goto failure; 502 goto failure;
504 503
@@ -559,9 +558,9 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
559 if (s->dma_length != 0) { 558 if (s->dma_length != 0) {
560 unsigned long vaddr, npages; 559 unsigned long vaddr, npages;
561 560
562 vaddr = s->dma_address & IOMMU_PAGE_MASK; 561 vaddr = s->dma_address & IOMMU_PAGE_MASK(tbl);
563 npages = iommu_num_pages(s->dma_address, s->dma_length, 562 npages = iommu_num_pages(s->dma_address, s->dma_length,
564 IOMMU_PAGE_SIZE); 563 IOMMU_PAGE_SIZE(tbl));
565 __iommu_free(tbl, vaddr, npages); 564 __iommu_free(tbl, vaddr, npages);
566 s->dma_address = DMA_ERROR_CODE; 565 s->dma_address = DMA_ERROR_CODE;
567 s->dma_length = 0; 566 s->dma_length = 0;
@@ -592,7 +591,7 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
592 if (sg->dma_length == 0) 591 if (sg->dma_length == 0)
593 break; 592 break;
594 npages = iommu_num_pages(dma_handle, sg->dma_length, 593 npages = iommu_num_pages(dma_handle, sg->dma_length,
595 IOMMU_PAGE_SIZE); 594 IOMMU_PAGE_SIZE(tbl));
596 __iommu_free(tbl, dma_handle, npages); 595 __iommu_free(tbl, dma_handle, npages);
597 sg = sg_next(sg); 596 sg = sg_next(sg);
598 } 597 }
@@ -676,7 +675,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
676 set_bit(0, tbl->it_map); 675 set_bit(0, tbl->it_map);
677 676
678 /* We only split the IOMMU table if we have 1GB or more of space */ 677 /* We only split the IOMMU table if we have 1GB or more of space */
679 if ((tbl->it_size << IOMMU_PAGE_SHIFT) >= (1UL * 1024 * 1024 * 1024)) 678 if ((tbl->it_size << tbl->it_page_shift) >= (1UL * 1024 * 1024 * 1024))
680 tbl->nr_pools = IOMMU_NR_POOLS; 679 tbl->nr_pools = IOMMU_NR_POOLS;
681 else 680 else
682 tbl->nr_pools = 1; 681 tbl->nr_pools = 1;
@@ -768,16 +767,16 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,
768 767
769 vaddr = page_address(page) + offset; 768 vaddr = page_address(page) + offset;
770 uaddr = (unsigned long)vaddr; 769 uaddr = (unsigned long)vaddr;
771 npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE); 770 npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl));
772 771
773 if (tbl) { 772 if (tbl) {
774 align = 0; 773 align = 0;
775 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && size >= PAGE_SIZE && 774 if (tbl->it_page_shift < PAGE_SHIFT && size >= PAGE_SIZE &&
776 ((unsigned long)vaddr & ~PAGE_MASK) == 0) 775 ((unsigned long)vaddr & ~PAGE_MASK) == 0)
777 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT; 776 align = PAGE_SHIFT - tbl->it_page_shift;
778 777
779 dma_handle = iommu_alloc(dev, tbl, vaddr, npages, direction, 778 dma_handle = iommu_alloc(dev, tbl, vaddr, npages, direction,
780 mask >> IOMMU_PAGE_SHIFT, align, 779 mask >> tbl->it_page_shift, align,
781 attrs); 780 attrs);
782 if (dma_handle == DMA_ERROR_CODE) { 781 if (dma_handle == DMA_ERROR_CODE) {
783 if (printk_ratelimit()) { 782 if (printk_ratelimit()) {
@@ -786,7 +785,7 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,
786 npages); 785 npages);
787 } 786 }
788 } else 787 } else
789 dma_handle |= (uaddr & ~IOMMU_PAGE_MASK); 788 dma_handle |= (uaddr & ~IOMMU_PAGE_MASK(tbl));
790 } 789 }
791 790
792 return dma_handle; 791 return dma_handle;
@@ -801,7 +800,8 @@ void iommu_unmap_page(struct iommu_table *tbl, dma_addr_t dma_handle,
801 BUG_ON(direction == DMA_NONE); 800 BUG_ON(direction == DMA_NONE);
802 801
803 if (tbl) { 802 if (tbl) {
804 npages = iommu_num_pages(dma_handle, size, IOMMU_PAGE_SIZE); 803 npages = iommu_num_pages(dma_handle, size,
804 IOMMU_PAGE_SIZE(tbl));
805 iommu_free(tbl, dma_handle, npages); 805 iommu_free(tbl, dma_handle, npages);
806 } 806 }
807} 807}
@@ -845,10 +845,10 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
845 memset(ret, 0, size); 845 memset(ret, 0, size);
846 846
847 /* Set up tces to cover the allocated range */ 847 /* Set up tces to cover the allocated range */
848 nio_pages = size >> IOMMU_PAGE_SHIFT; 848 nio_pages = size >> tbl->it_page_shift;
849 io_order = get_iommu_order(size); 849 io_order = get_iommu_order(size, tbl);
850 mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL, 850 mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL,
851 mask >> IOMMU_PAGE_SHIFT, io_order, NULL); 851 mask >> tbl->it_page_shift, io_order, NULL);
852 if (mapping == DMA_ERROR_CODE) { 852 if (mapping == DMA_ERROR_CODE) {
853 free_pages((unsigned long)ret, order); 853 free_pages((unsigned long)ret, order);
854 return NULL; 854 return NULL;
@@ -864,7 +864,7 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size,
864 unsigned int nio_pages; 864 unsigned int nio_pages;
865 865
866 size = PAGE_ALIGN(size); 866 size = PAGE_ALIGN(size);
867 nio_pages = size >> IOMMU_PAGE_SHIFT; 867 nio_pages = size >> tbl->it_page_shift;
868 iommu_free(tbl, dma_handle, nio_pages); 868 iommu_free(tbl, dma_handle, nio_pages);
869 size = PAGE_ALIGN(size); 869 size = PAGE_ALIGN(size);
870 free_pages((unsigned long)vaddr, get_order(size)); 870 free_pages((unsigned long)vaddr, get_order(size));
@@ -935,10 +935,10 @@ int iommu_tce_clear_param_check(struct iommu_table *tbl,
935 if (tce_value) 935 if (tce_value)
936 return -EINVAL; 936 return -EINVAL;
937 937
938 if (ioba & ~IOMMU_PAGE_MASK) 938 if (ioba & ~IOMMU_PAGE_MASK(tbl))
939 return -EINVAL; 939 return -EINVAL;
940 940
941 ioba >>= IOMMU_PAGE_SHIFT; 941 ioba >>= tbl->it_page_shift;
942 if (ioba < tbl->it_offset) 942 if (ioba < tbl->it_offset)
943 return -EINVAL; 943 return -EINVAL;
944 944
@@ -955,13 +955,13 @@ int iommu_tce_put_param_check(struct iommu_table *tbl,
955 if (!(tce & (TCE_PCI_WRITE | TCE_PCI_READ))) 955 if (!(tce & (TCE_PCI_WRITE | TCE_PCI_READ)))
956 return -EINVAL; 956 return -EINVAL;
957 957
958 if (tce & ~(IOMMU_PAGE_MASK | TCE_PCI_WRITE | TCE_PCI_READ)) 958 if (tce & ~(IOMMU_PAGE_MASK(tbl) | TCE_PCI_WRITE | TCE_PCI_READ))
959 return -EINVAL; 959 return -EINVAL;
960 960
961 if (ioba & ~IOMMU_PAGE_MASK) 961 if (ioba & ~IOMMU_PAGE_MASK(tbl))
962 return -EINVAL; 962 return -EINVAL;
963 963
964 ioba >>= IOMMU_PAGE_SHIFT; 964 ioba >>= tbl->it_page_shift;
965 if (ioba < tbl->it_offset) 965 if (ioba < tbl->it_offset)
966 return -EINVAL; 966 return -EINVAL;
967 967
@@ -1037,7 +1037,7 @@ int iommu_tce_build(struct iommu_table *tbl, unsigned long entry,
1037 1037
1038 /* if (unlikely(ret)) 1038 /* if (unlikely(ret))
1039 pr_err("iommu_tce: %s failed on hwaddr=%lx ioba=%lx kva=%lx ret=%d\n", 1039 pr_err("iommu_tce: %s failed on hwaddr=%lx ioba=%lx kva=%lx ret=%d\n",
1040 __func__, hwaddr, entry << IOMMU_PAGE_SHIFT, 1040 __func__, hwaddr, entry << IOMMU_PAGE_SHIFT(tbl),
1041 hwaddr, ret); */ 1041 hwaddr, ret); */
1042 1042
1043 return ret; 1043 return ret;
@@ -1049,14 +1049,14 @@ int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
1049{ 1049{
1050 int ret; 1050 int ret;
1051 struct page *page = NULL; 1051 struct page *page = NULL;
1052 unsigned long hwaddr, offset = tce & IOMMU_PAGE_MASK & ~PAGE_MASK; 1052 unsigned long hwaddr, offset = tce & IOMMU_PAGE_MASK(tbl) & ~PAGE_MASK;
1053 enum dma_data_direction direction = iommu_tce_direction(tce); 1053 enum dma_data_direction direction = iommu_tce_direction(tce);
1054 1054
1055 ret = get_user_pages_fast(tce & PAGE_MASK, 1, 1055 ret = get_user_pages_fast(tce & PAGE_MASK, 1,
1056 direction != DMA_TO_DEVICE, &page); 1056 direction != DMA_TO_DEVICE, &page);
1057 if (unlikely(ret != 1)) { 1057 if (unlikely(ret != 1)) {
1058 /* pr_err("iommu_tce: get_user_pages_fast failed tce=%lx ioba=%lx ret=%d\n", 1058 /* pr_err("iommu_tce: get_user_pages_fast failed tce=%lx ioba=%lx ret=%d\n",
1059 tce, entry << IOMMU_PAGE_SHIFT, ret); */ 1059 tce, entry << IOMMU_PAGE_SHIFT(tbl), ret); */
1060 return -EFAULT; 1060 return -EFAULT;
1061 } 1061 }
1062 hwaddr = (unsigned long) page_address(page) + offset; 1062 hwaddr = (unsigned long) page_address(page) + offset;
@@ -1067,7 +1067,7 @@ int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
1067 1067
1068 if (ret < 0) 1068 if (ret < 0)
1069 pr_err("iommu_tce: %s failed ioba=%lx, tce=%lx, ret=%d\n", 1069 pr_err("iommu_tce: %s failed ioba=%lx, tce=%lx, ret=%d\n",
1070 __func__, entry << IOMMU_PAGE_SHIFT, tce, ret); 1070 __func__, entry << tbl->it_page_shift, tce, ret);
1071 1071
1072 return ret; 1072 return ret;
1073} 1073}
@@ -1105,7 +1105,7 @@ void iommu_release_ownership(struct iommu_table *tbl)
1105} 1105}
1106EXPORT_SYMBOL_GPL(iommu_release_ownership); 1106EXPORT_SYMBOL_GPL(iommu_release_ownership);
1107 1107
1108static int iommu_add_device(struct device *dev) 1108int iommu_add_device(struct device *dev)
1109{ 1109{
1110 struct iommu_table *tbl; 1110 struct iommu_table *tbl;
1111 int ret = 0; 1111 int ret = 0;
@@ -1127,6 +1127,12 @@ static int iommu_add_device(struct device *dev)
1127 pr_debug("iommu_tce: adding %s to iommu group %d\n", 1127 pr_debug("iommu_tce: adding %s to iommu group %d\n",
1128 dev_name(dev), iommu_group_id(tbl->it_group)); 1128 dev_name(dev), iommu_group_id(tbl->it_group));
1129 1129
1130 if (PAGE_SIZE < IOMMU_PAGE_SIZE(tbl)) {
1131 pr_err("iommu_tce: unsupported iommu page size.");
1132 pr_err("%s has not been added\n", dev_name(dev));
1133 return -EINVAL;
1134 }
1135
1130 ret = iommu_group_add_device(tbl->it_group, dev); 1136 ret = iommu_group_add_device(tbl->it_group, dev);
1131 if (ret < 0) 1137 if (ret < 0)
1132 pr_err("iommu_tce: %s has not been added, ret=%d\n", 1138 pr_err("iommu_tce: %s has not been added, ret=%d\n",
@@ -1134,52 +1140,23 @@ static int iommu_add_device(struct device *dev)
1134 1140
1135 return ret; 1141 return ret;
1136} 1142}
1143EXPORT_SYMBOL_GPL(iommu_add_device);
1137 1144
1138static void iommu_del_device(struct device *dev) 1145void iommu_del_device(struct device *dev)
1139{
1140 iommu_group_remove_device(dev);
1141}
1142
1143static int iommu_bus_notifier(struct notifier_block *nb,
1144 unsigned long action, void *data)
1145{ 1146{
1146 struct device *dev = data; 1147 /*
1147 1148 * Some devices might not have IOMMU table and group
1148 switch (action) { 1149 * and we needn't detach them from the associated
1149 case BUS_NOTIFY_ADD_DEVICE: 1150 * IOMMU groups
1150 return iommu_add_device(dev); 1151 */
1151 case BUS_NOTIFY_DEL_DEVICE: 1152 if (!dev->iommu_group) {
1152 iommu_del_device(dev); 1153 pr_debug("iommu_tce: skipping device %s with no tbl\n",
1153 return 0; 1154 dev_name(dev));
1154 default: 1155 return;
1155 return 0;
1156 } 1156 }
1157}
1158 1157
1159static struct notifier_block tce_iommu_bus_nb = { 1158 iommu_group_remove_device(dev);
1160 .notifier_call = iommu_bus_notifier,
1161};
1162
1163static int __init tce_iommu_init(void)
1164{
1165 struct pci_dev *pdev = NULL;
1166
1167 BUILD_BUG_ON(PAGE_SIZE < IOMMU_PAGE_SIZE);
1168
1169 for_each_pci_dev(pdev)
1170 iommu_add_device(&pdev->dev);
1171
1172 bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
1173 return 0;
1174}
1175
1176subsys_initcall_sync(tce_iommu_init);
1177
1178#else
1179
1180void iommu_register_group(struct iommu_table *tbl,
1181 int pci_domain_number, unsigned long pe_num)
1182{
1183} 1159}
1160EXPORT_SYMBOL_GPL(iommu_del_device);
1184 1161
1185#endif /* CONFIG_IOMMU_API */ 1162#endif /* CONFIG_IOMMU_API */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index ba0165615215..9729b23bfb0a 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -354,8 +354,13 @@ int arch_show_interrupts(struct seq_file *p, int prec)
354 354
355 seq_printf(p, "%*s: ", prec, "LOC"); 355 seq_printf(p, "%*s: ", prec, "LOC");
356 for_each_online_cpu(j) 356 for_each_online_cpu(j)
357 seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs); 357 seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs_event);
358 seq_printf(p, " Local timer interrupts\n"); 358 seq_printf(p, " Local timer interrupts for timer event device\n");
359
360 seq_printf(p, "%*s: ", prec, "LOC");
361 for_each_online_cpu(j)
362 seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs_others);
363 seq_printf(p, " Local timer interrupts for others\n");
359 364
360 seq_printf(p, "%*s: ", prec, "SPU"); 365 seq_printf(p, "%*s: ", prec, "SPU");
361 for_each_online_cpu(j) 366 for_each_online_cpu(j)
@@ -389,11 +394,12 @@ int arch_show_interrupts(struct seq_file *p, int prec)
389 */ 394 */
390u64 arch_irq_stat_cpu(unsigned int cpu) 395u64 arch_irq_stat_cpu(unsigned int cpu)
391{ 396{
392 u64 sum = per_cpu(irq_stat, cpu).timer_irqs; 397 u64 sum = per_cpu(irq_stat, cpu).timer_irqs_event;
393 398
394 sum += per_cpu(irq_stat, cpu).pmu_irqs; 399 sum += per_cpu(irq_stat, cpu).pmu_irqs;
395 sum += per_cpu(irq_stat, cpu).mce_exceptions; 400 sum += per_cpu(irq_stat, cpu).mce_exceptions;
396 sum += per_cpu(irq_stat, cpu).spurious_irqs; 401 sum += per_cpu(irq_stat, cpu).spurious_irqs;
402 sum += per_cpu(irq_stat, cpu).timer_irqs_others;
397#ifdef CONFIG_PPC_DOORBELL 403#ifdef CONFIG_PPC_DOORBELL
398 sum += per_cpu(irq_stat, cpu).doorbell_irqs; 404 sum += per_cpu(irq_stat, cpu).doorbell_irqs;
399#endif 405#endif
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 83e89d310734..8504657379f1 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/kgdb.h> 18#include <linux/kgdb.h>
20#include <linux/smp.h> 19#include <linux/smp.h>
21#include <linux/signal.h> 20#include <linux/signal.h>
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index db28032e320e..6a0175297b0d 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -413,13 +413,13 @@ static void kvm_map_magic_page(void *data)
413{ 413{
414 u32 *features = data; 414 u32 *features = data;
415 415
416 ulong in[8]; 416 ulong in[8] = {0};
417 ulong out[8]; 417 ulong out[8];
418 418
419 in[0] = KVM_MAGIC_PAGE; 419 in[0] = KVM_MAGIC_PAGE;
420 in[1] = KVM_MAGIC_PAGE; 420 in[1] = KVM_MAGIC_PAGE;
421 421
422 kvm_hypercall(in, out, KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE)); 422 epapr_hypercall(in, out, KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE));
423 423
424 *features = out[0]; 424 *features = out[0];
425} 425}
@@ -711,43 +711,6 @@ static void kvm_use_magic_page(void)
711 kvm_patching_worked ? "worked" : "failed"); 711 kvm_patching_worked ? "worked" : "failed");
712} 712}
713 713
714unsigned long kvm_hypercall(unsigned long *in,
715 unsigned long *out,
716 unsigned long nr)
717{
718 unsigned long register r0 asm("r0");
719 unsigned long register r3 asm("r3") = in[0];
720 unsigned long register r4 asm("r4") = in[1];
721 unsigned long register r5 asm("r5") = in[2];
722 unsigned long register r6 asm("r6") = in[3];
723 unsigned long register r7 asm("r7") = in[4];
724 unsigned long register r8 asm("r8") = in[5];
725 unsigned long register r9 asm("r9") = in[6];
726 unsigned long register r10 asm("r10") = in[7];
727 unsigned long register r11 asm("r11") = nr;
728 unsigned long register r12 asm("r12");
729
730 asm volatile("bl epapr_hypercall_start"
731 : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6),
732 "=r"(r7), "=r"(r8), "=r"(r9), "=r"(r10), "=r"(r11),
733 "=r"(r12)
734 : "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7), "r"(r8),
735 "r"(r9), "r"(r10), "r"(r11)
736 : "memory", "cc", "xer", "ctr", "lr");
737
738 out[0] = r4;
739 out[1] = r5;
740 out[2] = r6;
741 out[3] = r7;
742 out[4] = r8;
743 out[5] = r9;
744 out[6] = r10;
745 out[7] = r11;
746
747 return r3;
748}
749EXPORT_SYMBOL_GPL(kvm_hypercall);
750
751static __init void kvm_free_tmp(void) 714static __init void kvm_free_tmp(void)
752{ 715{
753 free_reserved_area(&kvm_tmp[kvm_tmp_index], 716 free_reserved_area(&kvm_tmp[kvm_tmp_index],
diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
new file mode 100644
index 000000000000..cadef7e64e42
--- /dev/null
+++ b/arch/powerpc/kernel/mce.c
@@ -0,0 +1,352 @@
1/*
2 * Machine check exception handling.
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 2013 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20 */
21
22#undef DEBUG
23#define pr_fmt(fmt) "mce: " fmt
24
25#include <linux/types.h>
26#include <linux/ptrace.h>
27#include <linux/percpu.h>
28#include <linux/export.h>
29#include <linux/irq_work.h>
30#include <asm/mce.h>
31
32static DEFINE_PER_CPU(int, mce_nest_count);
33static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event);
34
35/* Queue for delayed MCE events. */
36static DEFINE_PER_CPU(int, mce_queue_count);
37static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event_queue);
38
39static void machine_check_process_queued_event(struct irq_work *work);
40struct irq_work mce_event_process_work = {
41 .func = machine_check_process_queued_event,
42};
43
44static void mce_set_error_info(struct machine_check_event *mce,
45 struct mce_error_info *mce_err)
46{
47 mce->error_type = mce_err->error_type;
48 switch (mce_err->error_type) {
49 case MCE_ERROR_TYPE_UE:
50 mce->u.ue_error.ue_error_type = mce_err->u.ue_error_type;
51 break;
52 case MCE_ERROR_TYPE_SLB:
53 mce->u.slb_error.slb_error_type = mce_err->u.slb_error_type;
54 break;
55 case MCE_ERROR_TYPE_ERAT:
56 mce->u.erat_error.erat_error_type = mce_err->u.erat_error_type;
57 break;
58 case MCE_ERROR_TYPE_TLB:
59 mce->u.tlb_error.tlb_error_type = mce_err->u.tlb_error_type;
60 break;
61 case MCE_ERROR_TYPE_UNKNOWN:
62 default:
63 break;
64 }
65}
66
67/*
68 * Decode and save high level MCE information into per cpu buffer which
69 * is an array of machine_check_event structure.
70 */
71void save_mce_event(struct pt_regs *regs, long handled,
72 struct mce_error_info *mce_err,
73 uint64_t addr)
74{
75 uint64_t srr1;
76 int index = __get_cpu_var(mce_nest_count)++;
77 struct machine_check_event *mce = &__get_cpu_var(mce_event[index]);
78
79 /*
80 * Return if we don't have enough space to log mce event.
81 * mce_nest_count may go beyond MAX_MC_EVT but that's ok,
82 * the check below will stop buffer overrun.
83 */
84 if (index >= MAX_MC_EVT)
85 return;
86
87 /* Populate generic machine check info */
88 mce->version = MCE_V1;
89 mce->srr0 = regs->nip;
90 mce->srr1 = regs->msr;
91 mce->gpr3 = regs->gpr[3];
92 mce->in_use = 1;
93
94 mce->initiator = MCE_INITIATOR_CPU;
95 if (handled)
96 mce->disposition = MCE_DISPOSITION_RECOVERED;
97 else
98 mce->disposition = MCE_DISPOSITION_NOT_RECOVERED;
99 mce->severity = MCE_SEV_ERROR_SYNC;
100
101 srr1 = regs->msr;
102
103 /*
104 * Populate the mce error_type and type-specific error_type.
105 */
106 mce_set_error_info(mce, mce_err);
107
108 if (!addr)
109 return;
110
111 if (mce->error_type == MCE_ERROR_TYPE_TLB) {
112 mce->u.tlb_error.effective_address_provided = true;
113 mce->u.tlb_error.effective_address = addr;
114 } else if (mce->error_type == MCE_ERROR_TYPE_SLB) {
115 mce->u.slb_error.effective_address_provided = true;
116 mce->u.slb_error.effective_address = addr;
117 } else if (mce->error_type == MCE_ERROR_TYPE_ERAT) {
118 mce->u.erat_error.effective_address_provided = true;
119 mce->u.erat_error.effective_address = addr;
120 } else if (mce->error_type == MCE_ERROR_TYPE_UE) {
121 mce->u.ue_error.effective_address_provided = true;
122 mce->u.ue_error.effective_address = addr;
123 }
124 return;
125}
126
127/*
128 * get_mce_event:
129 * mce Pointer to machine_check_event structure to be filled.
130 * release Flag to indicate whether to free the event slot or not.
131 * 0 <= do not release the mce event. Caller will invoke
132 * release_mce_event() once event has been consumed.
133 * 1 <= release the slot.
134 *
135 * return 1 = success
136 * 0 = failure
137 *
138 * get_mce_event() will be called by platform specific machine check
139 * handle routine and in KVM.
140 * When we call get_mce_event(), we are still in interrupt context and
141 * preemption will not be scheduled until ret_from_expect() routine
142 * is called.
143 */
144int get_mce_event(struct machine_check_event *mce, bool release)
145{
146 int index = __get_cpu_var(mce_nest_count) - 1;
147 struct machine_check_event *mc_evt;
148 int ret = 0;
149
150 /* Sanity check */
151 if (index < 0)
152 return ret;
153
154 /* Check if we have MCE info to process. */
155 if (index < MAX_MC_EVT) {
156 mc_evt = &__get_cpu_var(mce_event[index]);
157 /* Copy the event structure and release the original */
158 if (mce)
159 *mce = *mc_evt;
160 if (release)
161 mc_evt->in_use = 0;
162 ret = 1;
163 }
164 /* Decrement the count to free the slot. */
165 if (release)
166 __get_cpu_var(mce_nest_count)--;
167
168 return ret;
169}
170
171void release_mce_event(void)
172{
173 get_mce_event(NULL, true);
174}
175
176/*
177 * Queue up the MCE event which then can be handled later.
178 */
179void machine_check_queue_event(void)
180{
181 int index;
182 struct machine_check_event evt;
183
184 if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
185 return;
186
187 index = __get_cpu_var(mce_queue_count)++;
188 /* If queue is full, just return for now. */
189 if (index >= MAX_MC_EVT) {
190 __get_cpu_var(mce_queue_count)--;
191 return;
192 }
193 __get_cpu_var(mce_event_queue[index]) = evt;
194
195 /* Queue irq work to process this event later. */
196 irq_work_queue(&mce_event_process_work);
197}
198
199/*
200 * process pending MCE event from the mce event queue. This function will be
201 * called during syscall exit.
202 */
203static void machine_check_process_queued_event(struct irq_work *work)
204{
205 int index;
206
207 /*
208 * For now just print it to console.
209 * TODO: log this error event to FSP or nvram.
210 */
211 while (__get_cpu_var(mce_queue_count) > 0) {
212 index = __get_cpu_var(mce_queue_count) - 1;
213 machine_check_print_event_info(
214 &__get_cpu_var(mce_event_queue[index]));
215 __get_cpu_var(mce_queue_count)--;
216 }
217}
218
219void machine_check_print_event_info(struct machine_check_event *evt)
220{
221 const char *level, *sevstr, *subtype;
222 static const char *mc_ue_types[] = {
223 "Indeterminate",
224 "Instruction fetch",
225 "Page table walk ifetch",
226 "Load/Store",
227 "Page table walk Load/Store",
228 };
229 static const char *mc_slb_types[] = {
230 "Indeterminate",
231 "Parity",
232 "Multihit",
233 };
234 static const char *mc_erat_types[] = {
235 "Indeterminate",
236 "Parity",
237 "Multihit",
238 };
239 static const char *mc_tlb_types[] = {
240 "Indeterminate",
241 "Parity",
242 "Multihit",
243 };
244
245 /* Print things out */
246 if (evt->version != MCE_V1) {
247 pr_err("Machine Check Exception, Unknown event version %d !\n",
248 evt->version);
249 return;
250 }
251 switch (evt->severity) {
252 case MCE_SEV_NO_ERROR:
253 level = KERN_INFO;
254 sevstr = "Harmless";
255 break;
256 case MCE_SEV_WARNING:
257 level = KERN_WARNING;
258 sevstr = "";
259 break;
260 case MCE_SEV_ERROR_SYNC:
261 level = KERN_ERR;
262 sevstr = "Severe";
263 break;
264 case MCE_SEV_FATAL:
265 default:
266 level = KERN_ERR;
267 sevstr = "Fatal";
268 break;
269 }
270
271 printk("%s%s Machine check interrupt [%s]\n", level, sevstr,
272 evt->disposition == MCE_DISPOSITION_RECOVERED ?
273 "Recovered" : "[Not recovered");
274 printk("%s Initiator: %s\n", level,
275 evt->initiator == MCE_INITIATOR_CPU ? "CPU" : "Unknown");
276 switch (evt->error_type) {
277 case MCE_ERROR_TYPE_UE:
278 subtype = evt->u.ue_error.ue_error_type <
279 ARRAY_SIZE(mc_ue_types) ?
280 mc_ue_types[evt->u.ue_error.ue_error_type]
281 : "Unknown";
282 printk("%s Error type: UE [%s]\n", level, subtype);
283 if (evt->u.ue_error.effective_address_provided)
284 printk("%s Effective address: %016llx\n",
285 level, evt->u.ue_error.effective_address);
286 if (evt->u.ue_error.physical_address_provided)
287 printk("%s Physial address: %016llx\n",
288 level, evt->u.ue_error.physical_address);
289 break;
290 case MCE_ERROR_TYPE_SLB:
291 subtype = evt->u.slb_error.slb_error_type <
292 ARRAY_SIZE(mc_slb_types) ?
293 mc_slb_types[evt->u.slb_error.slb_error_type]
294 : "Unknown";
295 printk("%s Error type: SLB [%s]\n", level, subtype);
296 if (evt->u.slb_error.effective_address_provided)
297 printk("%s Effective address: %016llx\n",
298 level, evt->u.slb_error.effective_address);
299 break;
300 case MCE_ERROR_TYPE_ERAT:
301 subtype = evt->u.erat_error.erat_error_type <
302 ARRAY_SIZE(mc_erat_types) ?
303 mc_erat_types[evt->u.erat_error.erat_error_type]
304 : "Unknown";
305 printk("%s Error type: ERAT [%s]\n", level, subtype);
306 if (evt->u.erat_error.effective_address_provided)
307 printk("%s Effective address: %016llx\n",
308 level, evt->u.erat_error.effective_address);
309 break;
310 case MCE_ERROR_TYPE_TLB:
311 subtype = evt->u.tlb_error.tlb_error_type <
312 ARRAY_SIZE(mc_tlb_types) ?
313 mc_tlb_types[evt->u.tlb_error.tlb_error_type]
314 : "Unknown";
315 printk("%s Error type: TLB [%s]\n", level, subtype);
316 if (evt->u.tlb_error.effective_address_provided)
317 printk("%s Effective address: %016llx\n",
318 level, evt->u.tlb_error.effective_address);
319 break;
320 default:
321 case MCE_ERROR_TYPE_UNKNOWN:
322 printk("%s Error type: Unknown\n", level);
323 break;
324 }
325}
326
327uint64_t get_mce_fault_addr(struct machine_check_event *evt)
328{
329 switch (evt->error_type) {
330 case MCE_ERROR_TYPE_UE:
331 if (evt->u.ue_error.effective_address_provided)
332 return evt->u.ue_error.effective_address;
333 break;
334 case MCE_ERROR_TYPE_SLB:
335 if (evt->u.slb_error.effective_address_provided)
336 return evt->u.slb_error.effective_address;
337 break;
338 case MCE_ERROR_TYPE_ERAT:
339 if (evt->u.erat_error.effective_address_provided)
340 return evt->u.erat_error.effective_address;
341 break;
342 case MCE_ERROR_TYPE_TLB:
343 if (evt->u.tlb_error.effective_address_provided)
344 return evt->u.tlb_error.effective_address;
345 break;
346 default:
347 case MCE_ERROR_TYPE_UNKNOWN:
348 break;
349 }
350 return 0;
351}
352EXPORT_SYMBOL(get_mce_fault_addr);
diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c
new file mode 100644
index 000000000000..27c93f41166f
--- /dev/null
+++ b/arch/powerpc/kernel/mce_power.c
@@ -0,0 +1,284 @@
1/*
2 * Machine check exception handling CPU-side for power7 and power8
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 2013 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20 */
21
22#undef DEBUG
23#define pr_fmt(fmt) "mce_power: " fmt
24
25#include <linux/types.h>
26#include <linux/ptrace.h>
27#include <asm/mmu.h>
28#include <asm/mce.h>
29
30/* flush SLBs and reload */
31static void flush_and_reload_slb(void)
32{
33 struct slb_shadow *slb;
34 unsigned long i, n;
35
36 /* Invalidate all SLBs */
37 asm volatile("slbmte %0,%0; slbia" : : "r" (0));
38
39#ifdef CONFIG_KVM_BOOK3S_HANDLER
40 /*
41 * If machine check is hit when in guest or in transition, we will
42 * only flush the SLBs and continue.
43 */
44 if (get_paca()->kvm_hstate.in_guest)
45 return;
46#endif
47
48 /* For host kernel, reload the SLBs from shadow SLB buffer. */
49 slb = get_slb_shadow();
50 if (!slb)
51 return;
52
53 n = min_t(u32, be32_to_cpu(slb->persistent), SLB_MIN_SIZE);
54
55 /* Load up the SLB entries from shadow SLB */
56 for (i = 0; i < n; i++) {
57 unsigned long rb = be64_to_cpu(slb->save_area[i].esid);
58 unsigned long rs = be64_to_cpu(slb->save_area[i].vsid);
59
60 rb = (rb & ~0xFFFul) | i;
61 asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb));
62 }
63}
64
65static long mce_handle_derror(uint64_t dsisr, uint64_t slb_error_bits)
66{
67 long handled = 1;
68
69 /*
70 * flush and reload SLBs for SLB errors and flush TLBs for TLB errors.
71 * reset the error bits whenever we handle them so that at the end
72 * we can check whether we handled all of them or not.
73 * */
74 if (dsisr & slb_error_bits) {
75 flush_and_reload_slb();
76 /* reset error bits */
77 dsisr &= ~(slb_error_bits);
78 }
79 if (dsisr & P7_DSISR_MC_TLB_MULTIHIT_MFTLB) {
80 if (cur_cpu_spec && cur_cpu_spec->flush_tlb)
81 cur_cpu_spec->flush_tlb(TLBIEL_INVAL_PAGE);
82 /* reset error bits */
83 dsisr &= ~P7_DSISR_MC_TLB_MULTIHIT_MFTLB;
84 }
85 /* Any other errors we don't understand? */
86 if (dsisr & 0xffffffffUL)
87 handled = 0;
88
89 return handled;
90}
91
92static long mce_handle_derror_p7(uint64_t dsisr)
93{
94 return mce_handle_derror(dsisr, P7_DSISR_MC_SLB_ERRORS);
95}
96
97static long mce_handle_common_ierror(uint64_t srr1)
98{
99 long handled = 0;
100
101 switch (P7_SRR1_MC_IFETCH(srr1)) {
102 case 0:
103 break;
104 case P7_SRR1_MC_IFETCH_SLB_PARITY:
105 case P7_SRR1_MC_IFETCH_SLB_MULTIHIT:
106 /* flush and reload SLBs for SLB errors. */
107 flush_and_reload_slb();
108 handled = 1;
109 break;
110 case P7_SRR1_MC_IFETCH_TLB_MULTIHIT:
111 if (cur_cpu_spec && cur_cpu_spec->flush_tlb) {
112 cur_cpu_spec->flush_tlb(TLBIEL_INVAL_PAGE);
113 handled = 1;
114 }
115 break;
116 default:
117 break;
118 }
119
120 return handled;
121}
122
123static long mce_handle_ierror_p7(uint64_t srr1)
124{
125 long handled = 0;
126
127 handled = mce_handle_common_ierror(srr1);
128
129 if (P7_SRR1_MC_IFETCH(srr1) == P7_SRR1_MC_IFETCH_SLB_BOTH) {
130 flush_and_reload_slb();
131 handled = 1;
132 }
133 return handled;
134}
135
136static void mce_get_common_ierror(struct mce_error_info *mce_err, uint64_t srr1)
137{
138 switch (P7_SRR1_MC_IFETCH(srr1)) {
139 case P7_SRR1_MC_IFETCH_SLB_PARITY:
140 mce_err->error_type = MCE_ERROR_TYPE_SLB;
141 mce_err->u.slb_error_type = MCE_SLB_ERROR_PARITY;
142 break;
143 case P7_SRR1_MC_IFETCH_SLB_MULTIHIT:
144 mce_err->error_type = MCE_ERROR_TYPE_SLB;
145 mce_err->u.slb_error_type = MCE_SLB_ERROR_MULTIHIT;
146 break;
147 case P7_SRR1_MC_IFETCH_TLB_MULTIHIT:
148 mce_err->error_type = MCE_ERROR_TYPE_TLB;
149 mce_err->u.tlb_error_type = MCE_TLB_ERROR_MULTIHIT;
150 break;
151 case P7_SRR1_MC_IFETCH_UE:
152 case P7_SRR1_MC_IFETCH_UE_IFU_INTERNAL:
153 mce_err->error_type = MCE_ERROR_TYPE_UE;
154 mce_err->u.ue_error_type = MCE_UE_ERROR_IFETCH;
155 break;
156 case P7_SRR1_MC_IFETCH_UE_TLB_RELOAD:
157 mce_err->error_type = MCE_ERROR_TYPE_UE;
158 mce_err->u.ue_error_type =
159 MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH;
160 break;
161 }
162}
163
164static void mce_get_ierror_p7(struct mce_error_info *mce_err, uint64_t srr1)
165{
166 mce_get_common_ierror(mce_err, srr1);
167 if (P7_SRR1_MC_IFETCH(srr1) == P7_SRR1_MC_IFETCH_SLB_BOTH) {
168 mce_err->error_type = MCE_ERROR_TYPE_SLB;
169 mce_err->u.slb_error_type = MCE_SLB_ERROR_INDETERMINATE;
170 }
171}
172
173static void mce_get_derror_p7(struct mce_error_info *mce_err, uint64_t dsisr)
174{
175 if (dsisr & P7_DSISR_MC_UE) {
176 mce_err->error_type = MCE_ERROR_TYPE_UE;
177 mce_err->u.ue_error_type = MCE_UE_ERROR_LOAD_STORE;
178 } else if (dsisr & P7_DSISR_MC_UE_TABLEWALK) {
179 mce_err->error_type = MCE_ERROR_TYPE_UE;
180 mce_err->u.ue_error_type =
181 MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE;
182 } else if (dsisr & P7_DSISR_MC_ERAT_MULTIHIT) {
183 mce_err->error_type = MCE_ERROR_TYPE_ERAT;
184 mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
185 } else if (dsisr & P7_DSISR_MC_SLB_MULTIHIT) {
186 mce_err->error_type = MCE_ERROR_TYPE_SLB;
187 mce_err->u.slb_error_type = MCE_SLB_ERROR_MULTIHIT;
188 } else if (dsisr & P7_DSISR_MC_SLB_PARITY_MFSLB) {
189 mce_err->error_type = MCE_ERROR_TYPE_SLB;
190 mce_err->u.slb_error_type = MCE_SLB_ERROR_PARITY;
191 } else if (dsisr & P7_DSISR_MC_TLB_MULTIHIT_MFTLB) {
192 mce_err->error_type = MCE_ERROR_TYPE_TLB;
193 mce_err->u.tlb_error_type = MCE_TLB_ERROR_MULTIHIT;
194 } else if (dsisr & P7_DSISR_MC_SLB_MULTIHIT_PARITY) {
195 mce_err->error_type = MCE_ERROR_TYPE_SLB;
196 mce_err->u.slb_error_type = MCE_SLB_ERROR_INDETERMINATE;
197 }
198}
199
200long __machine_check_early_realmode_p7(struct pt_regs *regs)
201{
202 uint64_t srr1, addr;
203 long handled = 1;
204 struct mce_error_info mce_error_info = { 0 };
205
206 srr1 = regs->msr;
207
208 /*
209 * Handle memory errors depending whether this was a load/store or
210 * ifetch exception. Also, populate the mce error_type and
211 * type-specific error_type from either SRR1 or DSISR, depending
212 * whether this was a load/store or ifetch exception
213 */
214 if (P7_SRR1_MC_LOADSTORE(srr1)) {
215 handled = mce_handle_derror_p7(regs->dsisr);
216 mce_get_derror_p7(&mce_error_info, regs->dsisr);
217 addr = regs->dar;
218 } else {
219 handled = mce_handle_ierror_p7(srr1);
220 mce_get_ierror_p7(&mce_error_info, srr1);
221 addr = regs->nip;
222 }
223
224 save_mce_event(regs, handled, &mce_error_info, addr);
225 return handled;
226}
227
228static void mce_get_ierror_p8(struct mce_error_info *mce_err, uint64_t srr1)
229{
230 mce_get_common_ierror(mce_err, srr1);
231 if (P7_SRR1_MC_IFETCH(srr1) == P8_SRR1_MC_IFETCH_ERAT_MULTIHIT) {
232 mce_err->error_type = MCE_ERROR_TYPE_ERAT;
233 mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
234 }
235}
236
237static void mce_get_derror_p8(struct mce_error_info *mce_err, uint64_t dsisr)
238{
239 mce_get_derror_p7(mce_err, dsisr);
240 if (dsisr & P8_DSISR_MC_ERAT_MULTIHIT_SEC) {
241 mce_err->error_type = MCE_ERROR_TYPE_ERAT;
242 mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
243 }
244}
245
246static long mce_handle_ierror_p8(uint64_t srr1)
247{
248 long handled = 0;
249
250 handled = mce_handle_common_ierror(srr1);
251
252 if (P7_SRR1_MC_IFETCH(srr1) == P8_SRR1_MC_IFETCH_ERAT_MULTIHIT) {
253 flush_and_reload_slb();
254 handled = 1;
255 }
256 return handled;
257}
258
259static long mce_handle_derror_p8(uint64_t dsisr)
260{
261 return mce_handle_derror(dsisr, P8_DSISR_MC_SLB_ERRORS);
262}
263
264long __machine_check_early_realmode_p8(struct pt_regs *regs)
265{
266 uint64_t srr1, addr;
267 long handled = 1;
268 struct mce_error_info mce_error_info = { 0 };
269
270 srr1 = regs->msr;
271
272 if (P7_SRR1_MC_LOADSTORE(srr1)) {
273 handled = mce_handle_derror_p8(regs->dsisr);
274 mce_get_derror_p8(&mce_error_info, regs->dsisr);
275 addr = regs->dar;
276 } else {
277 handled = mce_handle_ierror_p8(srr1);
278 mce_get_ierror_p8(&mce_error_info, srr1);
279 addr = regs->nip;
280 }
281
282 save_mce_event(regs, handled, &mce_error_info, addr);
283 return handled;
284}
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index e47d268727a4..879f09620f83 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -344,7 +344,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE)
344 */ 344 */
345_KPROBE(flush_icache_range) 345_KPROBE(flush_icache_range)
346BEGIN_FTR_SECTION 346BEGIN_FTR_SECTION
347 isync 347 PURGE_PREFETCHED_INS
348 blr /* for 601, do nothing */ 348 blr /* for 601, do nothing */
349END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) 349END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
350 li r5,L1_CACHE_BYTES-1 350 li r5,L1_CACHE_BYTES-1
@@ -448,6 +448,7 @@ _GLOBAL(invalidate_dcache_range)
448 */ 448 */
449_GLOBAL(__flush_dcache_icache) 449_GLOBAL(__flush_dcache_icache)
450BEGIN_FTR_SECTION 450BEGIN_FTR_SECTION
451 PURGE_PREFETCHED_INS
451 blr 452 blr
452END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) 453END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
453 rlwinm r3,r3,0,0,31-PAGE_SHIFT /* Get page base address */ 454 rlwinm r3,r3,0,0,31-PAGE_SHIFT /* Get page base address */
@@ -489,6 +490,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_44x)
489 */ 490 */
490_GLOBAL(__flush_dcache_icache_phys) 491_GLOBAL(__flush_dcache_icache_phys)
491BEGIN_FTR_SECTION 492BEGIN_FTR_SECTION
493 PURGE_PREFETCHED_INS
492 blr /* for 601, do nothing */ 494 blr /* for 601, do nothing */
493END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) 495END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
494 mfmsr r10 496 mfmsr r10
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 64bf8db12b15..3d0249599d52 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -67,6 +67,7 @@ PPC64_CACHES:
67 67
68_KPROBE(flush_icache_range) 68_KPROBE(flush_icache_range)
69BEGIN_FTR_SECTION 69BEGIN_FTR_SECTION
70 PURGE_PREFETCHED_INS
70 blr 71 blr
71END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) 72END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
72/* 73/*
@@ -211,6 +212,11 @@ _GLOBAL(__flush_dcache_icache)
211 * Different systems have different cache line sizes 212 * Different systems have different cache line sizes
212 */ 213 */
213 214
215BEGIN_FTR_SECTION
216 PURGE_PREFETCHED_INS
217 blr
218END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
219
214/* Flush the dcache */ 220/* Flush the dcache */
215 ld r7,PPC64_CACHES@toc(r2) 221 ld r7,PPC64_CACHES@toc(r2)
216 clrrdi r3,r3,PAGE_SHIFT /* Page align */ 222 clrrdi r3,r3,PAGE_SHIFT /* Page align */
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 0620eaaaad45..bf0aada02fe4 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -99,12 +99,28 @@ static inline void free_lppacas(void) { }
99 * 3 persistent SLBs are registered here. The buffer will be zero 99 * 3 persistent SLBs are registered here. The buffer will be zero
100 * initially, hence will all be invaild until we actually write them. 100 * initially, hence will all be invaild until we actually write them.
101 */ 101 */
102struct slb_shadow slb_shadow[] __cacheline_aligned = { 102static struct slb_shadow *slb_shadow;
103 [0 ... (NR_CPUS-1)] = { 103
104 .persistent = cpu_to_be32(SLB_NUM_BOLTED), 104static void __init allocate_slb_shadows(int nr_cpus, int limit)
105 .buffer_length = cpu_to_be32(sizeof(struct slb_shadow)), 105{
106 }, 106 int size = PAGE_ALIGN(sizeof(struct slb_shadow) * nr_cpus);
107}; 107 slb_shadow = __va(memblock_alloc_base(size, PAGE_SIZE, limit));
108 memset(slb_shadow, 0, size);
109}
110
111static struct slb_shadow * __init init_slb_shadow(int cpu)
112{
113 struct slb_shadow *s = &slb_shadow[cpu];
114
115 s->persistent = cpu_to_be32(SLB_NUM_BOLTED);
116 s->buffer_length = cpu_to_be32(sizeof(*s));
117
118 return s;
119}
120
121#else /* CONFIG_PPC_STD_MMU_64 */
122
123static void __init allocate_slb_shadows(int nr_cpus, int limit) { }
108 124
109#endif /* CONFIG_PPC_STD_MMU_64 */ 125#endif /* CONFIG_PPC_STD_MMU_64 */
110 126
@@ -142,8 +158,13 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu)
142 new_paca->__current = &init_task; 158 new_paca->__current = &init_task;
143 new_paca->data_offset = 0xfeeeeeeeeeeeeeeeULL; 159 new_paca->data_offset = 0xfeeeeeeeeeeeeeeeULL;
144#ifdef CONFIG_PPC_STD_MMU_64 160#ifdef CONFIG_PPC_STD_MMU_64
145 new_paca->slb_shadow_ptr = &slb_shadow[cpu]; 161 new_paca->slb_shadow_ptr = init_slb_shadow(cpu);
146#endif /* CONFIG_PPC_STD_MMU_64 */ 162#endif /* CONFIG_PPC_STD_MMU_64 */
163
164#ifdef CONFIG_PPC_BOOK3E
165 /* For now -- if we have threads this will be adjusted later */
166 new_paca->tcd_ptr = &new_paca->tcd;
167#endif
147} 168}
148 169
149/* Put the paca pointer into r13 and SPRG_PACA */ 170/* Put the paca pointer into r13 and SPRG_PACA */
@@ -190,6 +211,8 @@ void __init allocate_pacas(void)
190 211
191 allocate_lppacas(nr_cpu_ids, limit); 212 allocate_lppacas(nr_cpu_ids, limit);
192 213
214 allocate_slb_shadows(nr_cpu_ids, limit);
215
193 /* Can't use for_each_*_cpu, as they aren't functional yet */ 216 /* Can't use for_each_*_cpu, as they aren't functional yet */
194 for (cpu = 0; cpu < nr_cpu_ids; cpu++) 217 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
195 initialise_paca(&paca[cpu], cpu); 218 initialise_paca(&paca[cpu], cpu);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index a1e3e40ca3fd..d9476c1fc959 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -835,7 +835,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
835 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set 835 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set
836 * since in that case, we don't want to re-assign anything 836 * since in that case, we don't want to re-assign anything
837 */ 837 */
838 pcibios_resource_to_bus(dev, &reg, res); 838 pcibios_resource_to_bus(dev->bus, &reg, res);
839 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) || 839 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) ||
840 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { 840 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
841 /* Only print message if not re-assigning */ 841 /* Only print message if not re-assigning */
@@ -886,7 +886,7 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
886 886
887 /* Job is a bit different between memory and IO */ 887 /* Job is a bit different between memory and IO */
888 if (res->flags & IORESOURCE_MEM) { 888 if (res->flags & IORESOURCE_MEM) {
889 pcibios_resource_to_bus(dev, &region, res); 889 pcibios_resource_to_bus(dev->bus, &region, res);
890 890
891 /* If the BAR is non-0 then it's probably been initialized */ 891 /* If the BAR is non-0 then it's probably been initialized */
892 if (region.start != 0) 892 if (region.start != 0)
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index ac0b034f9ae0..83c26d829991 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -111,7 +111,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
111 res->name = pci_name(dev); 111 res->name = pci_name(dev);
112 region.start = base; 112 region.start = base;
113 region.end = base + size - 1; 113 region.end = base + size - 1;
114 pcibios_bus_to_resource(dev, res, &region); 114 pcibios_bus_to_resource(dev->bus, res, &region);
115 } 115 }
116} 116}
117 117
@@ -280,7 +280,7 @@ void of_scan_pci_bridge(struct pci_dev *dev)
280 res->flags = flags; 280 res->flags = flags;
281 region.start = of_read_number(&ranges[1], 2); 281 region.start = of_read_number(&ranges[1], 2);
282 region.end = region.start + size - 1; 282 region.end = region.start + size - 1;
283 pcibios_bus_to_resource(dev, res, &region); 283 pcibios_bus_to_resource(dev->bus, res, &region);
284 } 284 }
285 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 285 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
286 bus->number); 286 bus->number);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 4a96556fd2d4..8d4c247f1738 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -25,7 +25,6 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/user.h> 26#include <linux/user.h>
27#include <linux/elf.h> 27#include <linux/elf.h>
28#include <linux/init.h>
29#include <linux/prctl.h> 28#include <linux/prctl.h>
30#include <linux/init_task.h> 29#include <linux/init_task.h>
31#include <linux/export.h> 30#include <linux/export.h>
@@ -74,6 +73,48 @@ struct task_struct *last_task_used_vsx = NULL;
74struct task_struct *last_task_used_spe = NULL; 73struct task_struct *last_task_used_spe = NULL;
75#endif 74#endif
76 75
76#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
77void giveup_fpu_maybe_transactional(struct task_struct *tsk)
78{
79 /*
80 * If we are saving the current thread's registers, and the
81 * thread is in a transactional state, set the TIF_RESTORE_TM
82 * bit so that we know to restore the registers before
83 * returning to userspace.
84 */
85 if (tsk == current && tsk->thread.regs &&
86 MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
87 !test_thread_flag(TIF_RESTORE_TM)) {
88 tsk->thread.tm_orig_msr = tsk->thread.regs->msr;
89 set_thread_flag(TIF_RESTORE_TM);
90 }
91
92 giveup_fpu(tsk);
93}
94
95void giveup_altivec_maybe_transactional(struct task_struct *tsk)
96{
97 /*
98 * If we are saving the current thread's registers, and the
99 * thread is in a transactional state, set the TIF_RESTORE_TM
100 * bit so that we know to restore the registers before
101 * returning to userspace.
102 */
103 if (tsk == current && tsk->thread.regs &&
104 MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
105 !test_thread_flag(TIF_RESTORE_TM)) {
106 tsk->thread.tm_orig_msr = tsk->thread.regs->msr;
107 set_thread_flag(TIF_RESTORE_TM);
108 }
109
110 giveup_altivec(tsk);
111}
112
113#else
114#define giveup_fpu_maybe_transactional(tsk) giveup_fpu(tsk)
115#define giveup_altivec_maybe_transactional(tsk) giveup_altivec(tsk)
116#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
117
77#ifdef CONFIG_PPC_FPU 118#ifdef CONFIG_PPC_FPU
78/* 119/*
79 * Make sure the floating-point register state in the 120 * Make sure the floating-point register state in the
@@ -102,13 +143,13 @@ void flush_fp_to_thread(struct task_struct *tsk)
102 */ 143 */
103 BUG_ON(tsk != current); 144 BUG_ON(tsk != current);
104#endif 145#endif
105 giveup_fpu(tsk); 146 giveup_fpu_maybe_transactional(tsk);
106 } 147 }
107 preempt_enable(); 148 preempt_enable();
108 } 149 }
109} 150}
110EXPORT_SYMBOL_GPL(flush_fp_to_thread); 151EXPORT_SYMBOL_GPL(flush_fp_to_thread);
111#endif 152#endif /* CONFIG_PPC_FPU */
112 153
113void enable_kernel_fp(void) 154void enable_kernel_fp(void)
114{ 155{
@@ -116,11 +157,11 @@ void enable_kernel_fp(void)
116 157
117#ifdef CONFIG_SMP 158#ifdef CONFIG_SMP
118 if (current->thread.regs && (current->thread.regs->msr & MSR_FP)) 159 if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
119 giveup_fpu(current); 160 giveup_fpu_maybe_transactional(current);
120 else 161 else
121 giveup_fpu(NULL); /* just enables FP for kernel */ 162 giveup_fpu(NULL); /* just enables FP for kernel */
122#else 163#else
123 giveup_fpu(last_task_used_math); 164 giveup_fpu_maybe_transactional(last_task_used_math);
124#endif /* CONFIG_SMP */ 165#endif /* CONFIG_SMP */
125} 166}
126EXPORT_SYMBOL(enable_kernel_fp); 167EXPORT_SYMBOL(enable_kernel_fp);
@@ -132,11 +173,11 @@ void enable_kernel_altivec(void)
132 173
133#ifdef CONFIG_SMP 174#ifdef CONFIG_SMP
134 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC)) 175 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
135 giveup_altivec(current); 176 giveup_altivec_maybe_transactional(current);
136 else 177 else
137 giveup_altivec_notask(); 178 giveup_altivec_notask();
138#else 179#else
139 giveup_altivec(last_task_used_altivec); 180 giveup_altivec_maybe_transactional(last_task_used_altivec);
140#endif /* CONFIG_SMP */ 181#endif /* CONFIG_SMP */
141} 182}
142EXPORT_SYMBOL(enable_kernel_altivec); 183EXPORT_SYMBOL(enable_kernel_altivec);
@@ -153,7 +194,7 @@ void flush_altivec_to_thread(struct task_struct *tsk)
153#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
154 BUG_ON(tsk != current); 195 BUG_ON(tsk != current);
155#endif 196#endif
156 giveup_altivec(tsk); 197 giveup_altivec_maybe_transactional(tsk);
157 } 198 }
158 preempt_enable(); 199 preempt_enable();
159 } 200 }
@@ -182,8 +223,8 @@ EXPORT_SYMBOL(enable_kernel_vsx);
182 223
183void giveup_vsx(struct task_struct *tsk) 224void giveup_vsx(struct task_struct *tsk)
184{ 225{
185 giveup_fpu(tsk); 226 giveup_fpu_maybe_transactional(tsk);
186 giveup_altivec(tsk); 227 giveup_altivec_maybe_transactional(tsk);
187 __giveup_vsx(tsk); 228 __giveup_vsx(tsk);
188} 229}
189 230
@@ -479,7 +520,48 @@ static inline bool hw_brk_match(struct arch_hw_breakpoint *a,
479 return false; 520 return false;
480 return true; 521 return true;
481} 522}
523
482#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 524#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
525static void tm_reclaim_thread(struct thread_struct *thr,
526 struct thread_info *ti, uint8_t cause)
527{
528 unsigned long msr_diff = 0;
529
530 /*
531 * If FP/VSX registers have been already saved to the
532 * thread_struct, move them to the transact_fp array.
533 * We clear the TIF_RESTORE_TM bit since after the reclaim
534 * the thread will no longer be transactional.
535 */
536 if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) {
537 msr_diff = thr->tm_orig_msr & ~thr->regs->msr;
538 if (msr_diff & MSR_FP)
539 memcpy(&thr->transact_fp, &thr->fp_state,
540 sizeof(struct thread_fp_state));
541 if (msr_diff & MSR_VEC)
542 memcpy(&thr->transact_vr, &thr->vr_state,
543 sizeof(struct thread_vr_state));
544 clear_ti_thread_flag(ti, TIF_RESTORE_TM);
545 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX | MSR_FE0 | MSR_FE1;
546 }
547
548 tm_reclaim(thr, thr->regs->msr, cause);
549
550 /* Having done the reclaim, we now have the checkpointed
551 * FP/VSX values in the registers. These might be valid
552 * even if we have previously called enable_kernel_fp() or
553 * flush_fp_to_thread(), so update thr->regs->msr to
554 * indicate their current validity.
555 */
556 thr->regs->msr |= msr_diff;
557}
558
559void tm_reclaim_current(uint8_t cause)
560{
561 tm_enable();
562 tm_reclaim_thread(&current->thread, current_thread_info(), cause);
563}
564
483static inline void tm_reclaim_task(struct task_struct *tsk) 565static inline void tm_reclaim_task(struct task_struct *tsk)
484{ 566{
485 /* We have to work out if we're switching from/to a task that's in the 567 /* We have to work out if we're switching from/to a task that's in the
@@ -502,9 +584,11 @@ static inline void tm_reclaim_task(struct task_struct *tsk)
502 584
503 /* Stash the original thread MSR, as giveup_fpu et al will 585 /* Stash the original thread MSR, as giveup_fpu et al will
504 * modify it. We hold onto it to see whether the task used 586 * modify it. We hold onto it to see whether the task used
505 * FP & vector regs. 587 * FP & vector regs. If the TIF_RESTORE_TM flag is set,
588 * tm_orig_msr is already set.
506 */ 589 */
507 thr->tm_orig_msr = thr->regs->msr; 590 if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM))
591 thr->tm_orig_msr = thr->regs->msr;
508 592
509 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, " 593 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, "
510 "ccr=%lx, msr=%lx, trap=%lx)\n", 594 "ccr=%lx, msr=%lx, trap=%lx)\n",
@@ -512,7 +596,7 @@ static inline void tm_reclaim_task(struct task_struct *tsk)
512 thr->regs->ccr, thr->regs->msr, 596 thr->regs->ccr, thr->regs->msr,
513 thr->regs->trap); 597 thr->regs->trap);
514 598
515 tm_reclaim(thr, thr->regs->msr, TM_CAUSE_RESCHED); 599 tm_reclaim_thread(thr, task_thread_info(tsk), TM_CAUSE_RESCHED);
516 600
517 TM_DEBUG("--- tm_reclaim on pid %d complete\n", 601 TM_DEBUG("--- tm_reclaim on pid %d complete\n",
518 tsk->pid); 602 tsk->pid);
@@ -588,6 +672,43 @@ static inline void __switch_to_tm(struct task_struct *prev)
588 tm_reclaim_task(prev); 672 tm_reclaim_task(prev);
589 } 673 }
590} 674}
675
676/*
677 * This is called if we are on the way out to userspace and the
678 * TIF_RESTORE_TM flag is set. It checks if we need to reload
679 * FP and/or vector state and does so if necessary.
680 * If userspace is inside a transaction (whether active or
681 * suspended) and FP/VMX/VSX instructions have ever been enabled
682 * inside that transaction, then we have to keep them enabled
683 * and keep the FP/VMX/VSX state loaded while ever the transaction
684 * continues. The reason is that if we didn't, and subsequently
685 * got a FP/VMX/VSX unavailable interrupt inside a transaction,
686 * we don't know whether it's the same transaction, and thus we
687 * don't know which of the checkpointed state and the transactional
688 * state to use.
689 */
690void restore_tm_state(struct pt_regs *regs)
691{
692 unsigned long msr_diff;
693
694 clear_thread_flag(TIF_RESTORE_TM);
695 if (!MSR_TM_ACTIVE(regs->msr))
696 return;
697
698 msr_diff = current->thread.tm_orig_msr & ~regs->msr;
699 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX;
700 if (msr_diff & MSR_FP) {
701 fp_enable();
702 load_fp_state(&current->thread.fp_state);
703 regs->msr |= current->thread.fpexc_mode;
704 }
705 if (msr_diff & MSR_VEC) {
706 vec_enable();
707 load_vr_state(&current->thread.vr_state);
708 }
709 regs->msr |= msr_diff;
710}
711
591#else 712#else
592#define tm_recheckpoint_new_task(new) 713#define tm_recheckpoint_new_task(new)
593#define __switch_to_tm(prev) 714#define __switch_to_tm(prev)
@@ -690,7 +811,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
690 * schedule DABR 811 * schedule DABR
691 */ 812 */
692#ifndef CONFIG_HAVE_HW_BREAKPOINT 813#ifndef CONFIG_HAVE_HW_BREAKPOINT
693 if (unlikely(hw_brk_match(&__get_cpu_var(current_brk), &new->thread.hw_brk))) 814 if (unlikely(!hw_brk_match(&__get_cpu_var(current_brk), &new->thread.hw_brk)))
694 set_breakpoint(&new->thread.hw_brk); 815 set_breakpoint(&new->thread.hw_brk);
695#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 816#endif /* CONFIG_HAVE_HW_BREAKPOINT */
696#endif 817#endif
@@ -1175,6 +1296,19 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
1175 if (val & PR_FP_EXC_SW_ENABLE) { 1296 if (val & PR_FP_EXC_SW_ENABLE) {
1176#ifdef CONFIG_SPE 1297#ifdef CONFIG_SPE
1177 if (cpu_has_feature(CPU_FTR_SPE)) { 1298 if (cpu_has_feature(CPU_FTR_SPE)) {
1299 /*
1300 * When the sticky exception bits are set
1301 * directly by userspace, it must call prctl
1302 * with PR_GET_FPEXC (with PR_FP_EXC_SW_ENABLE
1303 * in the existing prctl settings) or
1304 * PR_SET_FPEXC (with PR_FP_EXC_SW_ENABLE in
1305 * the bits being set). <fenv.h> functions
1306 * saving and restoring the whole
1307 * floating-point environment need to do so
1308 * anyway to restore the prctl settings from
1309 * the saved environment.
1310 */
1311 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR);
1178 tsk->thread.fpexc_mode = val & 1312 tsk->thread.fpexc_mode = val &
1179 (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT); 1313 (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
1180 return 0; 1314 return 0;
@@ -1206,9 +1340,22 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
1206 1340
1207 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) 1341 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE)
1208#ifdef CONFIG_SPE 1342#ifdef CONFIG_SPE
1209 if (cpu_has_feature(CPU_FTR_SPE)) 1343 if (cpu_has_feature(CPU_FTR_SPE)) {
1344 /*
1345 * When the sticky exception bits are set
1346 * directly by userspace, it must call prctl
1347 * with PR_GET_FPEXC (with PR_FP_EXC_SW_ENABLE
1348 * in the existing prctl settings) or
1349 * PR_SET_FPEXC (with PR_FP_EXC_SW_ENABLE in
1350 * the bits being set). <fenv.h> functions
1351 * saving and restoring the whole
1352 * floating-point environment need to do so
1353 * anyway to restore the prctl settings from
1354 * the saved environment.
1355 */
1356 tsk->thread.spefscr_last = mfspr(SPRN_SPEFSCR);
1210 val = tsk->thread.fpexc_mode; 1357 val = tsk->thread.fpexc_mode;
1211 else 1358 } else
1212 return -EINVAL; 1359 return -EINVAL;
1213#else 1360#else
1214 return -EINVAL; 1361 return -EINVAL;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index fa0ad8aafbcc..f58c0d3aaeb4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -523,6 +523,20 @@ static int __init early_init_dt_scan_memory_ppc(unsigned long node,
523 return early_init_dt_scan_memory(node, uname, depth, data); 523 return early_init_dt_scan_memory(node, uname, depth, data);
524} 524}
525 525
526/*
527 * For a relocatable kernel, we need to get the memstart_addr first,
528 * then use it to calculate the virtual kernel start address. This has
529 * to happen at a very early stage (before machine_init). In this case,
530 * we just want to get the memstart_address and would not like to mess the
531 * memblock at this stage. So introduce a variable to skip the memblock_add()
532 * for this reason.
533 */
534#ifdef CONFIG_RELOCATABLE
535static int add_mem_to_memblock = 1;
536#else
537#define add_mem_to_memblock 1
538#endif
539
526void __init early_init_dt_add_memory_arch(u64 base, u64 size) 540void __init early_init_dt_add_memory_arch(u64 base, u64 size)
527{ 541{
528#ifdef CONFIG_PPC64 542#ifdef CONFIG_PPC64
@@ -543,7 +557,8 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
543 } 557 }
544 558
545 /* Add the chunk to the MEMBLOCK list */ 559 /* Add the chunk to the MEMBLOCK list */
546 memblock_add(base, size); 560 if (add_mem_to_memblock)
561 memblock_add(base, size);
547} 562}
548 563
549static void __init early_reserve_mem_dt(void) 564static void __init early_reserve_mem_dt(void)
@@ -740,6 +755,30 @@ void __init early_init_devtree(void *params)
740 DBG(" <- early_init_devtree()\n"); 755 DBG(" <- early_init_devtree()\n");
741} 756}
742 757
758#ifdef CONFIG_RELOCATABLE
759/*
760 * This function run before early_init_devtree, so we have to init
761 * initial_boot_params.
762 */
763void __init early_get_first_memblock_info(void *params, phys_addr_t *size)
764{
765 /* Setup flat device-tree pointer */
766 initial_boot_params = params;
767
768 /*
769 * Scan the memory nodes and set add_mem_to_memblock to 0 to avoid
770 * mess the memblock.
771 */
772 add_mem_to_memblock = 0;
773 of_scan_flat_dt(early_init_dt_scan_root, NULL);
774 of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
775 add_mem_to_memblock = 1;
776
777 if (size)
778 *size = first_memblock_size;
779}
780#endif
781
743/******* 782/*******
744 * 783 *
745 * New implementation of the OF "find" APIs, return a refcounted 784 * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 856dd4e99bfe..f5f11a7d30e5 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -97,6 +97,36 @@ int dcache_bsize;
97int icache_bsize; 97int icache_bsize;
98int ucache_bsize; 98int ucache_bsize;
99 99
100#if defined(CONFIG_PPC_BOOK3E) && defined(CONFIG_SMP)
101static void setup_tlb_core_data(void)
102{
103 int cpu;
104
105 for_each_possible_cpu(cpu) {
106 int first = cpu_first_thread_sibling(cpu);
107
108 paca[cpu].tcd_ptr = &paca[first].tcd;
109
110 /*
111 * If we have threads, we need either tlbsrx.
112 * or e6500 tablewalk mode, or else TLB handlers
113 * will be racy and could produce duplicate entries.
114 */
115 if (smt_enabled_at_boot >= 2 &&
116 !mmu_has_feature(MMU_FTR_USE_TLBRSRV) &&
117 book3e_htw_mode != PPC_HTW_E6500) {
118 /* Should we panic instead? */
119 WARN_ONCE("%s: unsupported MMU configuration -- expect problems\n",
120 __func__);
121 }
122 }
123}
124#else
125static void setup_tlb_core_data(void)
126{
127}
128#endif
129
100#ifdef CONFIG_SMP 130#ifdef CONFIG_SMP
101 131
102static char *smt_enabled_cmdline; 132static char *smt_enabled_cmdline;
@@ -445,6 +475,7 @@ void __init setup_system(void)
445 475
446 smp_setup_cpu_maps(); 476 smp_setup_cpu_maps();
447 check_smt_enabled(); 477 check_smt_enabled();
478 setup_tlb_core_data();
448 479
449#ifdef CONFIG_SMP 480#ifdef CONFIG_SMP
450 /* Release secondary cpus out of their spinloops at 0x60 now that 481 /* Release secondary cpus out of their spinloops at 0x60 now that
@@ -520,9 +551,6 @@ static void __init irqstack_early_init(void)
520#ifdef CONFIG_PPC_BOOK3E 551#ifdef CONFIG_PPC_BOOK3E
521static void __init exc_lvl_early_init(void) 552static void __init exc_lvl_early_init(void)
522{ 553{
523 extern unsigned int interrupt_base_book3e;
524 extern unsigned int exc_debug_debug_book3e;
525
526 unsigned int i; 554 unsigned int i;
527 555
528 for_each_possible_cpu(i) { 556 for_each_possible_cpu(i) {
@@ -535,8 +563,7 @@ static void __init exc_lvl_early_init(void)
535 } 563 }
536 564
537 if (cpu_has_feature(CPU_FTR_DEBUG_LVL_EXC)) 565 if (cpu_has_feature(CPU_FTR_DEBUG_LVL_EXC))
538 patch_branch(&interrupt_base_book3e + (0x040 / 4) + 1, 566 patch_exception(0x040, exc_debug_debug_book3e);
539 (unsigned long)&exc_debug_debug_book3e, 0);
540} 567}
541#else 568#else
542#define exc_lvl_early_init() 569#define exc_lvl_early_init()
@@ -544,7 +571,8 @@ static void __init exc_lvl_early_init(void)
544 571
545/* 572/*
546 * Stack space used when we detect a bad kernel stack pointer, and 573 * Stack space used when we detect a bad kernel stack pointer, and
547 * early in SMP boots before relocation is enabled. 574 * early in SMP boots before relocation is enabled. Exclusive emergency
575 * stack for machine checks.
548 */ 576 */
549static void __init emergency_stack_init(void) 577static void __init emergency_stack_init(void)
550{ 578{
@@ -567,6 +595,13 @@ static void __init emergency_stack_init(void)
567 sp = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit); 595 sp = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
568 sp += THREAD_SIZE; 596 sp += THREAD_SIZE;
569 paca[i].emergency_sp = __va(sp); 597 paca[i].emergency_sp = __va(sp);
598
599#ifdef CONFIG_PPC_BOOK3S_64
600 /* emergency stack for machine check exception handling. */
601 sp = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
602 sp += THREAD_SIZE;
603 paca[i].mc_emergency_sp = __va(sp);
604#endif
570 } 605 }
571} 606}
572 607
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 457e97aa2945..8fc4177ed65a 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -203,8 +203,7 @@ unsigned long get_tm_stackpointer(struct pt_regs *regs)
203 203
204#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 204#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
205 if (MSR_TM_ACTIVE(regs->msr)) { 205 if (MSR_TM_ACTIVE(regs->msr)) {
206 tm_enable(); 206 tm_reclaim_current(TM_CAUSE_SIGNAL);
207 tm_reclaim(&current->thread, regs->msr, TM_CAUSE_SIGNAL);
208 if (MSR_TM_TRANSACTIONAL(regs->msr)) 207 if (MSR_TM_TRANSACTIONAL(regs->msr))
209 return current->thread.ckpt_regs.gpr[1]; 208 return current->thread.ckpt_regs.gpr[1];
210 } 209 }
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 68027bfa5f8e..a67e00aa3caa 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -519,6 +519,13 @@ static int save_tm_user_regs(struct pt_regs *regs,
519{ 519{
520 unsigned long msr = regs->msr; 520 unsigned long msr = regs->msr;
521 521
522 /* Remove TM bits from thread's MSR. The MSR in the sigcontext
523 * just indicates to userland that we were doing a transaction, but we
524 * don't want to return in transactional state. This also ensures
525 * that flush_fp_to_thread won't set TIF_RESTORE_TM again.
526 */
527 regs->msr &= ~MSR_TS_MASK;
528
522 /* Make sure floating point registers are stored in regs */ 529 /* Make sure floating point registers are stored in regs */
523 flush_fp_to_thread(current); 530 flush_fp_to_thread(current);
524 531
@@ -1015,29 +1022,24 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1015#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1022#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1016 tm_frame = &rt_sf->uc_transact.uc_mcontext; 1023 tm_frame = &rt_sf->uc_transact.uc_mcontext;
1017 if (MSR_TM_ACTIVE(regs->msr)) { 1024 if (MSR_TM_ACTIVE(regs->msr)) {
1025 if (__put_user((unsigned long)&rt_sf->uc_transact,
1026 &rt_sf->uc.uc_link) ||
1027 __put_user((unsigned long)tm_frame,
1028 &rt_sf->uc_transact.uc_regs))
1029 goto badframe;
1018 if (save_tm_user_regs(regs, frame, tm_frame, sigret)) 1030 if (save_tm_user_regs(regs, frame, tm_frame, sigret))
1019 goto badframe; 1031 goto badframe;
1020 } 1032 }
1021 else 1033 else
1022#endif 1034#endif
1023 { 1035 {
1036 if (__put_user(0, &rt_sf->uc.uc_link))
1037 goto badframe;
1024 if (save_user_regs(regs, frame, tm_frame, sigret, 1)) 1038 if (save_user_regs(regs, frame, tm_frame, sigret, 1))
1025 goto badframe; 1039 goto badframe;
1026 } 1040 }
1027 regs->link = tramp; 1041 regs->link = tramp;
1028 1042
1029#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1030 if (MSR_TM_ACTIVE(regs->msr)) {
1031 if (__put_user((unsigned long)&rt_sf->uc_transact,
1032 &rt_sf->uc.uc_link)
1033 || __put_user((unsigned long)tm_frame, &rt_sf->uc_transact.uc_regs))
1034 goto badframe;
1035 }
1036 else
1037#endif
1038 if (__put_user(0, &rt_sf->uc.uc_link))
1039 goto badframe;
1040
1041 current->thread.fp_state.fpscr = 0; /* turn off all fp exceptions */ 1043 current->thread.fp_state.fpscr = 0; /* turn off all fp exceptions */
1042 1044
1043 /* create a stack frame for the caller of the handler */ 1045 /* create a stack frame for the caller of the handler */
@@ -1056,13 +1058,6 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1056 /* enter the signal handler in native-endian mode */ 1058 /* enter the signal handler in native-endian mode */
1057 regs->msr &= ~MSR_LE; 1059 regs->msr &= ~MSR_LE;
1058 regs->msr |= (MSR_KERNEL & MSR_LE); 1060 regs->msr |= (MSR_KERNEL & MSR_LE);
1059#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1060 /* Remove TM bits from thread's MSR. The MSR in the sigcontext
1061 * just indicates to userland that we were doing a transaction, but we
1062 * don't want to return in transactional state:
1063 */
1064 regs->msr &= ~MSR_TS_MASK;
1065#endif
1066 return 1; 1061 return 1;
1067 1062
1068badframe: 1063badframe:
@@ -1484,13 +1479,6 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1484 regs->nip = (unsigned long) ka->sa.sa_handler; 1479 regs->nip = (unsigned long) ka->sa.sa_handler;
1485 /* enter the signal handler in big-endian mode */ 1480 /* enter the signal handler in big-endian mode */
1486 regs->msr &= ~MSR_LE; 1481 regs->msr &= ~MSR_LE;
1487#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1488 /* Remove TM bits from thread's MSR. The MSR in the sigcontext
1489 * just indicates to userland that we were doing a transaction, but we
1490 * don't want to return in transactional state:
1491 */
1492 regs->msr &= ~MSR_TS_MASK;
1493#endif
1494 return 1; 1482 return 1;
1495 1483
1496badframe: 1484badframe:
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 42991045349f..e35bf773df7a 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -192,6 +192,13 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,
192 192
193 BUG_ON(!MSR_TM_ACTIVE(regs->msr)); 193 BUG_ON(!MSR_TM_ACTIVE(regs->msr));
194 194
195 /* Remove TM bits from thread's MSR. The MSR in the sigcontext
196 * just indicates to userland that we were doing a transaction, but we
197 * don't want to return in transactional state. This also ensures
198 * that flush_fp_to_thread won't set TIF_RESTORE_TM again.
199 */
200 regs->msr &= ~MSR_TS_MASK;
201
195 flush_fp_to_thread(current); 202 flush_fp_to_thread(current);
196 203
197#ifdef CONFIG_ALTIVEC 204#ifdef CONFIG_ALTIVEC
@@ -749,13 +756,6 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
749 756
750 /* Make sure signal handler doesn't get spurious FP exceptions */ 757 /* Make sure signal handler doesn't get spurious FP exceptions */
751 current->thread.fp_state.fpscr = 0; 758 current->thread.fp_state.fpscr = 0;
752#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
753 /* Remove TM bits from thread's MSR. The MSR in the sigcontext
754 * just indicates to userland that we were doing a transaction, but we
755 * don't want to return in transactional state:
756 */
757 regs->msr &= ~MSR_TS_MASK;
758#endif
759 759
760 /* Set up to return from userspace. */ 760 /* Set up to return from userspace. */
761 if (vdso64_rt_sigtramp && current->mm->context.vdso_base) { 761 if (vdso64_rt_sigtramp && current->mm->context.vdso_base) {
diff --git a/arch/powerpc/kernel/smp-tbsync.c b/arch/powerpc/kernel/smp-tbsync.c
index e68fd1ae727a..7a37ecd3afa3 100644
--- a/arch/powerpc/kernel/smp-tbsync.c
+++ b/arch/powerpc/kernel/smp-tbsync.c
@@ -9,7 +9,6 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/smp.h> 10#include <linux/smp.h>
11#include <linux/unistd.h> 11#include <linux/unistd.h>
12#include <linux/init.h>
13#include <linux/slab.h> 12#include <linux/slab.h>
14#include <linux/atomic.h> 13#include <linux/atomic.h>
15#include <asm/smp.h> 14#include <asm/smp.h>
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c1cf4a1522d9..ac2621af3154 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -369,13 +369,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
369 cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid)); 369 cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
370 cpumask_set_cpu(boot_cpuid, cpu_core_mask(boot_cpuid)); 370 cpumask_set_cpu(boot_cpuid, cpu_core_mask(boot_cpuid));
371 371
372 if (smp_ops) 372 if (smp_ops && smp_ops->probe)
373 if (smp_ops->probe) 373 smp_ops->probe();
374 max_cpus = smp_ops->probe();
375 else
376 max_cpus = NR_CPUS;
377 else
378 max_cpus = 1;
379} 374}
380 375
381void smp_prepare_boot_cpu(void) 376void smp_prepare_boot_cpu(void)
diff --git a/arch/powerpc/kernel/swsusp_booke.S b/arch/powerpc/kernel/swsusp_booke.S
index 0f204053e5b5..553c1405ee05 100644
--- a/arch/powerpc/kernel/swsusp_booke.S
+++ b/arch/powerpc/kernel/swsusp_booke.S
@@ -74,21 +74,21 @@ _GLOBAL(swsusp_arch_suspend)
74 bne 1b 74 bne 1b
75 75
76 /* Save SPRGs */ 76 /* Save SPRGs */
77 mfsprg r4,0 77 mfspr r4,SPRN_SPRG0
78 stw r4,SL_SPRG0(r11) 78 stw r4,SL_SPRG0(r11)
79 mfsprg r4,1 79 mfspr r4,SPRN_SPRG1
80 stw r4,SL_SPRG1(r11) 80 stw r4,SL_SPRG1(r11)
81 mfsprg r4,2 81 mfspr r4,SPRN_SPRG2
82 stw r4,SL_SPRG2(r11) 82 stw r4,SL_SPRG2(r11)
83 mfsprg r4,3 83 mfspr r4,SPRN_SPRG3
84 stw r4,SL_SPRG3(r11) 84 stw r4,SL_SPRG3(r11)
85 mfsprg r4,4 85 mfspr r4,SPRN_SPRG4
86 stw r4,SL_SPRG4(r11) 86 stw r4,SL_SPRG4(r11)
87 mfsprg r4,5 87 mfspr r4,SPRN_SPRG5
88 stw r4,SL_SPRG5(r11) 88 stw r4,SL_SPRG5(r11)
89 mfsprg r4,6 89 mfspr r4,SPRN_SPRG6
90 stw r4,SL_SPRG6(r11) 90 stw r4,SL_SPRG6(r11)
91 mfsprg r4,7 91 mfspr r4,SPRN_SPRG7
92 stw r4,SL_SPRG7(r11) 92 stw r4,SL_SPRG7(r11)
93 93
94 /* Call the low level suspend stuff (we should probably have made 94 /* Call the low level suspend stuff (we should probably have made
@@ -150,21 +150,21 @@ _GLOBAL(swsusp_arch_resume)
150 bl _tlbil_all 150 bl _tlbil_all
151 151
152 lwz r4,SL_SPRG0(r11) 152 lwz r4,SL_SPRG0(r11)
153 mtsprg 0,r4 153 mtspr SPRN_SPRG0,r4
154 lwz r4,SL_SPRG1(r11) 154 lwz r4,SL_SPRG1(r11)
155 mtsprg 1,r4 155 mtspr SPRN_SPRG1,r4
156 lwz r4,SL_SPRG2(r11) 156 lwz r4,SL_SPRG2(r11)
157 mtsprg 2,r4 157 mtspr SPRN_SPRG2,r4
158 lwz r4,SL_SPRG3(r11) 158 lwz r4,SL_SPRG3(r11)
159 mtsprg 3,r4 159 mtspr SPRN_SPRG3,r4
160 lwz r4,SL_SPRG4(r11) 160 lwz r4,SL_SPRG4(r11)
161 mtsprg 4,r4 161 mtspr SPRN_SPRG4,r4
162 lwz r4,SL_SPRG5(r11) 162 lwz r4,SL_SPRG5(r11)
163 mtsprg 5,r4 163 mtspr SPRN_SPRG5,r4
164 lwz r4,SL_SPRG6(r11) 164 lwz r4,SL_SPRG6(r11)
165 mtsprg 6,r4 165 mtspr SPRN_SPRG6,r4
166 lwz r4,SL_SPRG7(r11) 166 lwz r4,SL_SPRG7(r11)
167 mtsprg 7,r4 167 mtspr SPRN_SPRG7,r4
168 168
169 /* restore the MSR */ 169 /* restore the MSR */
170 lwz r3,SL_MSR(r11) 170 lwz r3,SL_MSR(r11)
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 4e3cc47f26b9..cd9be9aa016d 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -34,7 +34,6 @@
34#include <linux/ipc.h> 34#include <linux/ipc.h>
35#include <linux/utsname.h> 35#include <linux/utsname.h>
36#include <linux/file.h> 36#include <linux/file.h>
37#include <linux/init.h>
38#include <linux/personality.h> 37#include <linux/personality.h>
39 38
40#include <asm/uaccess.h> 39#include <asm/uaccess.h>
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index b4e667663d9b..97e1dc917683 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -51,8 +51,6 @@ static ssize_t store_smt_snooze_delay(struct device *dev,
51 return -EINVAL; 51 return -EINVAL;
52 52
53 per_cpu(smt_snooze_delay, cpu->dev.id) = snooze; 53 per_cpu(smt_snooze_delay, cpu->dev.id) = snooze;
54 update_smt_snooze_delay(cpu->dev.id, snooze);
55
56 return count; 54 return count;
57} 55}
58 56
@@ -86,6 +84,304 @@ __setup("smt-snooze-delay=", setup_smt_snooze_delay);
86 84
87#endif /* CONFIG_PPC64 */ 85#endif /* CONFIG_PPC64 */
88 86
87#ifdef CONFIG_PPC_FSL_BOOK3E
88#define MAX_BIT 63
89
90static u64 pw20_wt;
91static u64 altivec_idle_wt;
92
93static unsigned int get_idle_ticks_bit(u64 ns)
94{
95 u64 cycle;
96
97 if (ns >= 10000)
98 cycle = div_u64(ns + 500, 1000) * tb_ticks_per_usec;
99 else
100 cycle = div_u64(ns * tb_ticks_per_usec, 1000);
101
102 if (!cycle)
103 return 0;
104
105 return ilog2(cycle);
106}
107
108static void do_show_pwrmgtcr0(void *val)
109{
110 u32 *value = val;
111
112 *value = mfspr(SPRN_PWRMGTCR0);
113}
114
115static ssize_t show_pw20_state(struct device *dev,
116 struct device_attribute *attr, char *buf)
117{
118 u32 value;
119 unsigned int cpu = dev->id;
120
121 smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
122
123 value &= PWRMGTCR0_PW20_WAIT;
124
125 return sprintf(buf, "%u\n", value ? 1 : 0);
126}
127
128static void do_store_pw20_state(void *val)
129{
130 u32 *value = val;
131 u32 pw20_state;
132
133 pw20_state = mfspr(SPRN_PWRMGTCR0);
134
135 if (*value)
136 pw20_state |= PWRMGTCR0_PW20_WAIT;
137 else
138 pw20_state &= ~PWRMGTCR0_PW20_WAIT;
139
140 mtspr(SPRN_PWRMGTCR0, pw20_state);
141}
142
143static ssize_t store_pw20_state(struct device *dev,
144 struct device_attribute *attr,
145 const char *buf, size_t count)
146{
147 u32 value;
148 unsigned int cpu = dev->id;
149
150 if (kstrtou32(buf, 0, &value))
151 return -EINVAL;
152
153 if (value > 1)
154 return -EINVAL;
155
156 smp_call_function_single(cpu, do_store_pw20_state, &value, 1);
157
158 return count;
159}
160
161static ssize_t show_pw20_wait_time(struct device *dev,
162 struct device_attribute *attr, char *buf)
163{
164 u32 value;
165 u64 tb_cycle = 1;
166 u64 time;
167
168 unsigned int cpu = dev->id;
169
170 if (!pw20_wt) {
171 smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
172 value = (value & PWRMGTCR0_PW20_ENT) >>
173 PWRMGTCR0_PW20_ENT_SHIFT;
174
175 tb_cycle = (tb_cycle << (MAX_BIT - value + 1));
176 /* convert ms to ns */
177 if (tb_ticks_per_usec > 1000) {
178 time = div_u64(tb_cycle, tb_ticks_per_usec / 1000);
179 } else {
180 u32 rem_us;
181
182 time = div_u64_rem(tb_cycle, tb_ticks_per_usec,
183 &rem_us);
184 time = time * 1000 + rem_us * 1000 / tb_ticks_per_usec;
185 }
186 } else {
187 time = pw20_wt;
188 }
189
190 return sprintf(buf, "%llu\n", time > 0 ? time : 0);
191}
192
193static void set_pw20_wait_entry_bit(void *val)
194{
195 u32 *value = val;
196 u32 pw20_idle;
197
198 pw20_idle = mfspr(SPRN_PWRMGTCR0);
199
200 /* Set Automatic PW20 Core Idle Count */
201 /* clear count */
202 pw20_idle &= ~PWRMGTCR0_PW20_ENT;
203
204 /* set count */
205 pw20_idle |= ((MAX_BIT - *value) << PWRMGTCR0_PW20_ENT_SHIFT);
206
207 mtspr(SPRN_PWRMGTCR0, pw20_idle);
208}
209
210static ssize_t store_pw20_wait_time(struct device *dev,
211 struct device_attribute *attr,
212 const char *buf, size_t count)
213{
214 u32 entry_bit;
215 u64 value;
216
217 unsigned int cpu = dev->id;
218
219 if (kstrtou64(buf, 0, &value))
220 return -EINVAL;
221
222 if (!value)
223 return -EINVAL;
224
225 entry_bit = get_idle_ticks_bit(value);
226 if (entry_bit > MAX_BIT)
227 return -EINVAL;
228
229 pw20_wt = value;
230
231 smp_call_function_single(cpu, set_pw20_wait_entry_bit,
232 &entry_bit, 1);
233
234 return count;
235}
236
237static ssize_t show_altivec_idle(struct device *dev,
238 struct device_attribute *attr, char *buf)
239{
240 u32 value;
241 unsigned int cpu = dev->id;
242
243 smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
244
245 value &= PWRMGTCR0_AV_IDLE_PD_EN;
246
247 return sprintf(buf, "%u\n", value ? 1 : 0);
248}
249
250static void do_store_altivec_idle(void *val)
251{
252 u32 *value = val;
253 u32 altivec_idle;
254
255 altivec_idle = mfspr(SPRN_PWRMGTCR0);
256
257 if (*value)
258 altivec_idle |= PWRMGTCR0_AV_IDLE_PD_EN;
259 else
260 altivec_idle &= ~PWRMGTCR0_AV_IDLE_PD_EN;
261
262 mtspr(SPRN_PWRMGTCR0, altivec_idle);
263}
264
265static ssize_t store_altivec_idle(struct device *dev,
266 struct device_attribute *attr,
267 const char *buf, size_t count)
268{
269 u32 value;
270 unsigned int cpu = dev->id;
271
272 if (kstrtou32(buf, 0, &value))
273 return -EINVAL;
274
275 if (value > 1)
276 return -EINVAL;
277
278 smp_call_function_single(cpu, do_store_altivec_idle, &value, 1);
279
280 return count;
281}
282
283static ssize_t show_altivec_idle_wait_time(struct device *dev,
284 struct device_attribute *attr, char *buf)
285{
286 u32 value;
287 u64 tb_cycle = 1;
288 u64 time;
289
290 unsigned int cpu = dev->id;
291
292 if (!altivec_idle_wt) {
293 smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
294 value = (value & PWRMGTCR0_AV_IDLE_CNT) >>
295 PWRMGTCR0_AV_IDLE_CNT_SHIFT;
296
297 tb_cycle = (tb_cycle << (MAX_BIT - value + 1));
298 /* convert ms to ns */
299 if (tb_ticks_per_usec > 1000) {
300 time = div_u64(tb_cycle, tb_ticks_per_usec / 1000);
301 } else {
302 u32 rem_us;
303
304 time = div_u64_rem(tb_cycle, tb_ticks_per_usec,
305 &rem_us);
306 time = time * 1000 + rem_us * 1000 / tb_ticks_per_usec;
307 }
308 } else {
309 time = altivec_idle_wt;
310 }
311
312 return sprintf(buf, "%llu\n", time > 0 ? time : 0);
313}
314
315static void set_altivec_idle_wait_entry_bit(void *val)
316{
317 u32 *value = val;
318 u32 altivec_idle;
319
320 altivec_idle = mfspr(SPRN_PWRMGTCR0);
321
322 /* Set Automatic AltiVec Idle Count */
323 /* clear count */
324 altivec_idle &= ~PWRMGTCR0_AV_IDLE_CNT;
325
326 /* set count */
327 altivec_idle |= ((MAX_BIT - *value) << PWRMGTCR0_AV_IDLE_CNT_SHIFT);
328
329 mtspr(SPRN_PWRMGTCR0, altivec_idle);
330}
331
332static ssize_t store_altivec_idle_wait_time(struct device *dev,
333 struct device_attribute *attr,
334 const char *buf, size_t count)
335{
336 u32 entry_bit;
337 u64 value;
338
339 unsigned int cpu = dev->id;
340
341 if (kstrtou64(buf, 0, &value))
342 return -EINVAL;
343
344 if (!value)
345 return -EINVAL;
346
347 entry_bit = get_idle_ticks_bit(value);
348 if (entry_bit > MAX_BIT)
349 return -EINVAL;
350
351 altivec_idle_wt = value;
352
353 smp_call_function_single(cpu, set_altivec_idle_wait_entry_bit,
354 &entry_bit, 1);
355
356 return count;
357}
358
359/*
360 * Enable/Disable interface:
361 * 0, disable. 1, enable.
362 */
363static DEVICE_ATTR(pw20_state, 0600, show_pw20_state, store_pw20_state);
364static DEVICE_ATTR(altivec_idle, 0600, show_altivec_idle, store_altivec_idle);
365
366/*
367 * Set wait time interface:(Nanosecond)
368 * Example: Base on TBfreq is 41MHZ.
369 * 1~48(ns): TB[63]
370 * 49~97(ns): TB[62]
371 * 98~195(ns): TB[61]
372 * 196~390(ns): TB[60]
373 * 391~780(ns): TB[59]
374 * 781~1560(ns): TB[58]
375 * ...
376 */
377static DEVICE_ATTR(pw20_wait_time, 0600,
378 show_pw20_wait_time,
379 store_pw20_wait_time);
380static DEVICE_ATTR(altivec_idle_wait_time, 0600,
381 show_altivec_idle_wait_time,
382 store_altivec_idle_wait_time);
383#endif
384
89/* 385/*
90 * Enabling PMCs will slow partition context switch times so we only do 386 * Enabling PMCs will slow partition context switch times so we only do
91 * it the first time we write to the PMCs. 387 * it the first time we write to the PMCs.
@@ -108,14 +404,14 @@ void ppc_enable_pmcs(void)
108} 404}
109EXPORT_SYMBOL(ppc_enable_pmcs); 405EXPORT_SYMBOL(ppc_enable_pmcs);
110 406
111#define SYSFS_PMCSETUP(NAME, ADDRESS) \ 407#define __SYSFS_SPRSETUP(NAME, ADDRESS, EXTRA) \
112static void read_##NAME(void *val) \ 408static void read_##NAME(void *val) \
113{ \ 409{ \
114 *(unsigned long *)val = mfspr(ADDRESS); \ 410 *(unsigned long *)val = mfspr(ADDRESS); \
115} \ 411} \
116static void write_##NAME(void *val) \ 412static void write_##NAME(void *val) \
117{ \ 413{ \
118 ppc_enable_pmcs(); \ 414 EXTRA; \
119 mtspr(ADDRESS, *(unsigned long *)val); \ 415 mtspr(ADDRESS, *(unsigned long *)val); \
120} \ 416} \
121static ssize_t show_##NAME(struct device *dev, \ 417static ssize_t show_##NAME(struct device *dev, \
@@ -140,6 +436,10 @@ static ssize_t __used \
140 return count; \ 436 return count; \
141} 437}
142 438
439#define SYSFS_PMCSETUP(NAME, ADDRESS) \
440 __SYSFS_SPRSETUP(NAME, ADDRESS, ppc_enable_pmcs())
441#define SYSFS_SPRSETUP(NAME, ADDRESS) \
442 __SYSFS_SPRSETUP(NAME, ADDRESS, )
143 443
144/* Let's define all possible registers, we'll only hook up the ones 444/* Let's define all possible registers, we'll only hook up the ones
145 * that are implemented on the current processor 445 * that are implemented on the current processor
@@ -175,10 +475,10 @@ SYSFS_PMCSETUP(pmc7, SPRN_PMC7);
175SYSFS_PMCSETUP(pmc8, SPRN_PMC8); 475SYSFS_PMCSETUP(pmc8, SPRN_PMC8);
176 476
177SYSFS_PMCSETUP(mmcra, SPRN_MMCRA); 477SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
178SYSFS_PMCSETUP(purr, SPRN_PURR); 478SYSFS_SPRSETUP(purr, SPRN_PURR);
179SYSFS_PMCSETUP(spurr, SPRN_SPURR); 479SYSFS_SPRSETUP(spurr, SPRN_SPURR);
180SYSFS_PMCSETUP(dscr, SPRN_DSCR); 480SYSFS_SPRSETUP(dscr, SPRN_DSCR);
181SYSFS_PMCSETUP(pir, SPRN_PIR); 481SYSFS_SPRSETUP(pir, SPRN_PIR);
182 482
183/* 483/*
184 Lets only enable read for phyp resources and 484 Lets only enable read for phyp resources and
@@ -249,34 +549,34 @@ SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
249SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4); 549SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
250SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5); 550SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
251#ifdef CONFIG_DEBUG_KERNEL 551#ifdef CONFIG_DEBUG_KERNEL
252SYSFS_PMCSETUP(hid0, SPRN_HID0); 552SYSFS_SPRSETUP(hid0, SPRN_HID0);
253SYSFS_PMCSETUP(hid1, SPRN_HID1); 553SYSFS_SPRSETUP(hid1, SPRN_HID1);
254SYSFS_PMCSETUP(hid4, SPRN_HID4); 554SYSFS_SPRSETUP(hid4, SPRN_HID4);
255SYSFS_PMCSETUP(hid5, SPRN_HID5); 555SYSFS_SPRSETUP(hid5, SPRN_HID5);
256SYSFS_PMCSETUP(ima0, SPRN_PA6T_IMA0); 556SYSFS_SPRSETUP(ima0, SPRN_PA6T_IMA0);
257SYSFS_PMCSETUP(ima1, SPRN_PA6T_IMA1); 557SYSFS_SPRSETUP(ima1, SPRN_PA6T_IMA1);
258SYSFS_PMCSETUP(ima2, SPRN_PA6T_IMA2); 558SYSFS_SPRSETUP(ima2, SPRN_PA6T_IMA2);
259SYSFS_PMCSETUP(ima3, SPRN_PA6T_IMA3); 559SYSFS_SPRSETUP(ima3, SPRN_PA6T_IMA3);
260SYSFS_PMCSETUP(ima4, SPRN_PA6T_IMA4); 560SYSFS_SPRSETUP(ima4, SPRN_PA6T_IMA4);
261SYSFS_PMCSETUP(ima5, SPRN_PA6T_IMA5); 561SYSFS_SPRSETUP(ima5, SPRN_PA6T_IMA5);
262SYSFS_PMCSETUP(ima6, SPRN_PA6T_IMA6); 562SYSFS_SPRSETUP(ima6, SPRN_PA6T_IMA6);
263SYSFS_PMCSETUP(ima7, SPRN_PA6T_IMA7); 563SYSFS_SPRSETUP(ima7, SPRN_PA6T_IMA7);
264SYSFS_PMCSETUP(ima8, SPRN_PA6T_IMA8); 564SYSFS_SPRSETUP(ima8, SPRN_PA6T_IMA8);
265SYSFS_PMCSETUP(ima9, SPRN_PA6T_IMA9); 565SYSFS_SPRSETUP(ima9, SPRN_PA6T_IMA9);
266SYSFS_PMCSETUP(imaat, SPRN_PA6T_IMAAT); 566SYSFS_SPRSETUP(imaat, SPRN_PA6T_IMAAT);
267SYSFS_PMCSETUP(btcr, SPRN_PA6T_BTCR); 567SYSFS_SPRSETUP(btcr, SPRN_PA6T_BTCR);
268SYSFS_PMCSETUP(pccr, SPRN_PA6T_PCCR); 568SYSFS_SPRSETUP(pccr, SPRN_PA6T_PCCR);
269SYSFS_PMCSETUP(rpccr, SPRN_PA6T_RPCCR); 569SYSFS_SPRSETUP(rpccr, SPRN_PA6T_RPCCR);
270SYSFS_PMCSETUP(der, SPRN_PA6T_DER); 570SYSFS_SPRSETUP(der, SPRN_PA6T_DER);
271SYSFS_PMCSETUP(mer, SPRN_PA6T_MER); 571SYSFS_SPRSETUP(mer, SPRN_PA6T_MER);
272SYSFS_PMCSETUP(ber, SPRN_PA6T_BER); 572SYSFS_SPRSETUP(ber, SPRN_PA6T_BER);
273SYSFS_PMCSETUP(ier, SPRN_PA6T_IER); 573SYSFS_SPRSETUP(ier, SPRN_PA6T_IER);
274SYSFS_PMCSETUP(sier, SPRN_PA6T_SIER); 574SYSFS_SPRSETUP(sier, SPRN_PA6T_SIER);
275SYSFS_PMCSETUP(siar, SPRN_PA6T_SIAR); 575SYSFS_SPRSETUP(siar, SPRN_PA6T_SIAR);
276SYSFS_PMCSETUP(tsr0, SPRN_PA6T_TSR0); 576SYSFS_SPRSETUP(tsr0, SPRN_PA6T_TSR0);
277SYSFS_PMCSETUP(tsr1, SPRN_PA6T_TSR1); 577SYSFS_SPRSETUP(tsr1, SPRN_PA6T_TSR1);
278SYSFS_PMCSETUP(tsr2, SPRN_PA6T_TSR2); 578SYSFS_SPRSETUP(tsr2, SPRN_PA6T_TSR2);
279SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3); 579SYSFS_SPRSETUP(tsr3, SPRN_PA6T_TSR3);
280#endif /* CONFIG_DEBUG_KERNEL */ 580#endif /* CONFIG_DEBUG_KERNEL */
281#endif /* HAS_PPC_PMC_PA6T */ 581#endif /* HAS_PPC_PMC_PA6T */
282 582
@@ -421,6 +721,15 @@ static void register_cpu_online(unsigned int cpu)
421 device_create_file(s, &dev_attr_pir); 721 device_create_file(s, &dev_attr_pir);
422#endif /* CONFIG_PPC64 */ 722#endif /* CONFIG_PPC64 */
423 723
724#ifdef CONFIG_PPC_FSL_BOOK3E
725 if (PVR_VER(cur_cpu_spec->pvr_value) == PVR_VER_E6500) {
726 device_create_file(s, &dev_attr_pw20_state);
727 device_create_file(s, &dev_attr_pw20_wait_time);
728
729 device_create_file(s, &dev_attr_altivec_idle);
730 device_create_file(s, &dev_attr_altivec_idle_wait_time);
731 }
732#endif
424 cacheinfo_cpu_online(cpu); 733 cacheinfo_cpu_online(cpu);
425} 734}
426 735
@@ -493,6 +802,15 @@ static void unregister_cpu_online(unsigned int cpu)
493 device_remove_file(s, &dev_attr_pir); 802 device_remove_file(s, &dev_attr_pir);
494#endif /* CONFIG_PPC64 */ 803#endif /* CONFIG_PPC64 */
495 804
805#ifdef CONFIG_PPC_FSL_BOOK3E
806 if (PVR_VER(cur_cpu_spec->pvr_value) == PVR_VER_E6500) {
807 device_remove_file(s, &dev_attr_pw20_state);
808 device_remove_file(s, &dev_attr_pw20_wait_time);
809
810 device_remove_file(s, &dev_attr_altivec_idle);
811 device_remove_file(s, &dev_attr_altivec_idle_wait_time);
812 }
813#endif
496 cacheinfo_cpu_offline(cpu); 814 cacheinfo_cpu_offline(cpu);
497} 815}
498 816
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index b3b144121cc9..b3dab20acf34 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -510,7 +510,6 @@ void timer_interrupt(struct pt_regs * regs)
510 */ 510 */
511 may_hard_irq_enable(); 511 may_hard_irq_enable();
512 512
513 __get_cpu_var(irq_stat).timer_irqs++;
514 513
515#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC) 514#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
516 if (atomic_read(&ppc_n_lost_interrupts) != 0) 515 if (atomic_read(&ppc_n_lost_interrupts) != 0)
@@ -532,10 +531,15 @@ void timer_interrupt(struct pt_regs * regs)
532 *next_tb = ~(u64)0; 531 *next_tb = ~(u64)0;
533 if (evt->event_handler) 532 if (evt->event_handler)
534 evt->event_handler(evt); 533 evt->event_handler(evt);
534 __get_cpu_var(irq_stat).timer_irqs_event++;
535 } else { 535 } else {
536 now = *next_tb - now; 536 now = *next_tb - now;
537 if (now <= DECREMENTER_MAX) 537 if (now <= DECREMENTER_MAX)
538 set_dec((int)now); 538 set_dec((int)now);
539 /* We may have raced with new irq work */
540 if (test_irq_work_pending())
541 set_dec(1);
542 __get_cpu_var(irq_stat).timer_irqs_others++;
539 } 543 }
540 544
541#ifdef CONFIG_PPC64 545#ifdef CONFIG_PPC64
@@ -801,8 +805,16 @@ static void __init clocksource_init(void)
801static int decrementer_set_next_event(unsigned long evt, 805static int decrementer_set_next_event(unsigned long evt,
802 struct clock_event_device *dev) 806 struct clock_event_device *dev)
803{ 807{
808 /* Don't adjust the decrementer if some irq work is pending */
809 if (test_irq_work_pending())
810 return 0;
804 __get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt; 811 __get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt;
805 set_dec(evt); 812 set_dec(evt);
813
814 /* We may have raced with new irq work */
815 if (test_irq_work_pending())
816 set_dec(1);
817
806 return 0; 818 return 0;
807} 819}
808 820
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 907a472f9a9e..33cd7a0b8e73 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -285,6 +285,21 @@ void system_reset_exception(struct pt_regs *regs)
285 285
286 /* What should we do here? We could issue a shutdown or hard reset. */ 286 /* What should we do here? We could issue a shutdown or hard reset. */
287} 287}
288
289/*
290 * This function is called in real mode. Strictly no printk's please.
291 *
292 * regs->nip and regs->msr contains srr0 and ssr1.
293 */
294long machine_check_early(struct pt_regs *regs)
295{
296 long handled = 0;
297
298 if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
299 handled = cur_cpu_spec->machine_check_early(regs);
300 return handled;
301}
302
288#endif 303#endif
289 304
290/* 305/*
@@ -1384,7 +1399,6 @@ void fp_unavailable_tm(struct pt_regs *regs)
1384 1399
1385 TM_DEBUG("FP Unavailable trap whilst transactional at 0x%lx, MSR=%lx\n", 1400 TM_DEBUG("FP Unavailable trap whilst transactional at 0x%lx, MSR=%lx\n",
1386 regs->nip, regs->msr); 1401 regs->nip, regs->msr);
1387 tm_enable();
1388 1402
1389 /* We can only have got here if the task started using FP after 1403 /* We can only have got here if the task started using FP after
1390 * beginning the transaction. So, the transactional regs are just a 1404 * beginning the transaction. So, the transactional regs are just a
@@ -1393,8 +1407,7 @@ void fp_unavailable_tm(struct pt_regs *regs)
1393 * transaction, and probably retry but now with FP enabled. So the 1407 * transaction, and probably retry but now with FP enabled. So the
1394 * checkpointed FP registers need to be loaded. 1408 * checkpointed FP registers need to be loaded.
1395 */ 1409 */
1396 tm_reclaim(&current->thread, current->thread.regs->msr, 1410 tm_reclaim_current(TM_CAUSE_FAC_UNAV);
1397 TM_CAUSE_FAC_UNAV);
1398 /* Reclaim didn't save out any FPRs to transact_fprs. */ 1411 /* Reclaim didn't save out any FPRs to transact_fprs. */
1399 1412
1400 /* Enable FP for the task: */ 1413 /* Enable FP for the task: */
@@ -1403,11 +1416,19 @@ void fp_unavailable_tm(struct pt_regs *regs)
1403 /* This loads and recheckpoints the FP registers from 1416 /* This loads and recheckpoints the FP registers from
1404 * thread.fpr[]. They will remain in registers after the 1417 * thread.fpr[]. They will remain in registers after the
1405 * checkpoint so we don't need to reload them after. 1418 * checkpoint so we don't need to reload them after.
1419 * If VMX is in use, the VRs now hold checkpointed values,
1420 * so we don't want to load the VRs from the thread_struct.
1406 */ 1421 */
1407 tm_recheckpoint(&current->thread, regs->msr); 1422 tm_recheckpoint(&current->thread, MSR_FP);
1423
1424 /* If VMX is in use, get the transactional values back */
1425 if (regs->msr & MSR_VEC) {
1426 do_load_up_transact_altivec(&current->thread);
1427 /* At this point all the VSX state is loaded, so enable it */
1428 regs->msr |= MSR_VSX;
1429 }
1408} 1430}
1409 1431
1410#ifdef CONFIG_ALTIVEC
1411void altivec_unavailable_tm(struct pt_regs *regs) 1432void altivec_unavailable_tm(struct pt_regs *regs)
1412{ 1433{
1413 /* See the comments in fp_unavailable_tm(). This function operates 1434 /* See the comments in fp_unavailable_tm(). This function operates
@@ -1417,18 +1438,21 @@ void altivec_unavailable_tm(struct pt_regs *regs)
1417 TM_DEBUG("Vector Unavailable trap whilst transactional at 0x%lx," 1438 TM_DEBUG("Vector Unavailable trap whilst transactional at 0x%lx,"
1418 "MSR=%lx\n", 1439 "MSR=%lx\n",
1419 regs->nip, regs->msr); 1440 regs->nip, regs->msr);
1420 tm_enable(); 1441 tm_reclaim_current(TM_CAUSE_FAC_UNAV);
1421 tm_reclaim(&current->thread, current->thread.regs->msr,
1422 TM_CAUSE_FAC_UNAV);
1423 regs->msr |= MSR_VEC; 1442 regs->msr |= MSR_VEC;
1424 tm_recheckpoint(&current->thread, regs->msr); 1443 tm_recheckpoint(&current->thread, MSR_VEC);
1425 current->thread.used_vr = 1; 1444 current->thread.used_vr = 1;
1445
1446 if (regs->msr & MSR_FP) {
1447 do_load_up_transact_fpu(&current->thread);
1448 regs->msr |= MSR_VSX;
1449 }
1426} 1450}
1427#endif
1428 1451
1429#ifdef CONFIG_VSX
1430void vsx_unavailable_tm(struct pt_regs *regs) 1452void vsx_unavailable_tm(struct pt_regs *regs)
1431{ 1453{
1454 unsigned long orig_msr = regs->msr;
1455
1432 /* See the comments in fp_unavailable_tm(). This works similarly, 1456 /* See the comments in fp_unavailable_tm(). This works similarly,
1433 * though we're loading both FP and VEC registers in here. 1457 * though we're loading both FP and VEC registers in here.
1434 * 1458 *
@@ -1440,18 +1464,30 @@ void vsx_unavailable_tm(struct pt_regs *regs)
1440 "MSR=%lx\n", 1464 "MSR=%lx\n",
1441 regs->nip, regs->msr); 1465 regs->nip, regs->msr);
1442 1466
1443 tm_enable(); 1467 current->thread.used_vsr = 1;
1468
1469 /* If FP and VMX are already loaded, we have all the state we need */
1470 if ((orig_msr & (MSR_FP | MSR_VEC)) == (MSR_FP | MSR_VEC)) {
1471 regs->msr |= MSR_VSX;
1472 return;
1473 }
1474
1444 /* This reclaims FP and/or VR regs if they're already enabled */ 1475 /* This reclaims FP and/or VR regs if they're already enabled */
1445 tm_reclaim(&current->thread, current->thread.regs->msr, 1476 tm_reclaim_current(TM_CAUSE_FAC_UNAV);
1446 TM_CAUSE_FAC_UNAV);
1447 1477
1448 regs->msr |= MSR_VEC | MSR_FP | current->thread.fpexc_mode | 1478 regs->msr |= MSR_VEC | MSR_FP | current->thread.fpexc_mode |
1449 MSR_VSX; 1479 MSR_VSX;
1450 /* This loads & recheckpoints FP and VRs. */ 1480
1451 tm_recheckpoint(&current->thread, regs->msr); 1481 /* This loads & recheckpoints FP and VRs; but we have
1452 current->thread.used_vsr = 1; 1482 * to be sure not to overwrite previously-valid state.
1483 */
1484 tm_recheckpoint(&current->thread, regs->msr & ~orig_msr);
1485
1486 if (orig_msr & MSR_FP)
1487 do_load_up_transact_fpu(&current->thread);
1488 if (orig_msr & MSR_VEC)
1489 do_load_up_transact_altivec(&current->thread);
1453} 1490}
1454#endif
1455#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 1491#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
1456 1492
1457void performance_monitor_exception(struct pt_regs *regs) 1493void performance_monitor_exception(struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/vdso32/vdso32_wrapper.S b/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
index 6e8f507ed32b..79683d0393f5 100644
--- a/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
+++ b/arch/powerpc/kernel/vdso32/vdso32_wrapper.S
@@ -1,4 +1,3 @@
1#include <linux/init.h>
2#include <linux/linkage.h> 1#include <linux/linkage.h>
3#include <asm/page.h> 2#include <asm/page.h>
4 3
diff --git a/arch/powerpc/kernel/vdso64/vdso64_wrapper.S b/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
index b8553d62b792..8df9e2463007 100644
--- a/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
+++ b/arch/powerpc/kernel/vdso64/vdso64_wrapper.S
@@ -1,4 +1,3 @@
1#include <linux/init.h>
2#include <linux/linkage.h> 1#include <linux/linkage.h>
3#include <asm/page.h> 2#include <asm/page.h>
4 3
diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
index 0458a9aaba9d..74f8050518d6 100644
--- a/arch/powerpc/kernel/vector.S
+++ b/arch/powerpc/kernel/vector.S
@@ -37,6 +37,16 @@ _GLOBAL(do_load_up_transact_altivec)
37#endif 37#endif
38 38
39/* 39/*
40 * Enable use of VMX/Altivec for the caller.
41 */
42_GLOBAL(vec_enable)
43 mfmsr r3
44 oris r3,r3,MSR_VEC@h
45 MTMSRD(r3)
46 isync
47 blr
48
49/*
40 * Load state from memory into VMX registers including VSCR. 50 * Load state from memory into VMX registers including VSCR.
41 * Assumes the caller has enabled VMX in the MSR. 51 * Assumes the caller has enabled VMX in the MSR.
42 */ 52 */
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 76a64821f4a2..826d8bd9e522 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -518,16 +518,18 @@ static dma_addr_t vio_dma_iommu_map_page(struct device *dev, struct page *page,
518 struct dma_attrs *attrs) 518 struct dma_attrs *attrs)
519{ 519{
520 struct vio_dev *viodev = to_vio_dev(dev); 520 struct vio_dev *viodev = to_vio_dev(dev);
521 struct iommu_table *tbl;
521 dma_addr_t ret = DMA_ERROR_CODE; 522 dma_addr_t ret = DMA_ERROR_CODE;
522 523
523 if (vio_cmo_alloc(viodev, roundup(size, IOMMU_PAGE_SIZE))) { 524 tbl = get_iommu_table_base(dev);
525 if (vio_cmo_alloc(viodev, roundup(size, IOMMU_PAGE_SIZE(tbl)))) {
524 atomic_inc(&viodev->cmo.allocs_failed); 526 atomic_inc(&viodev->cmo.allocs_failed);
525 return ret; 527 return ret;
526 } 528 }
527 529
528 ret = dma_iommu_ops.map_page(dev, page, offset, size, direction, attrs); 530 ret = dma_iommu_ops.map_page(dev, page, offset, size, direction, attrs);
529 if (unlikely(dma_mapping_error(dev, ret))) { 531 if (unlikely(dma_mapping_error(dev, ret))) {
530 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE)); 532 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE(tbl)));
531 atomic_inc(&viodev->cmo.allocs_failed); 533 atomic_inc(&viodev->cmo.allocs_failed);
532 } 534 }
533 535
@@ -540,10 +542,12 @@ static void vio_dma_iommu_unmap_page(struct device *dev, dma_addr_t dma_handle,
540 struct dma_attrs *attrs) 542 struct dma_attrs *attrs)
541{ 543{
542 struct vio_dev *viodev = to_vio_dev(dev); 544 struct vio_dev *viodev = to_vio_dev(dev);
545 struct iommu_table *tbl;
543 546
547 tbl = get_iommu_table_base(dev);
544 dma_iommu_ops.unmap_page(dev, dma_handle, size, direction, attrs); 548 dma_iommu_ops.unmap_page(dev, dma_handle, size, direction, attrs);
545 549
546 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE)); 550 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE(tbl)));
547} 551}
548 552
549static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist, 553static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
@@ -551,12 +555,14 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
551 struct dma_attrs *attrs) 555 struct dma_attrs *attrs)
552{ 556{
553 struct vio_dev *viodev = to_vio_dev(dev); 557 struct vio_dev *viodev = to_vio_dev(dev);
558 struct iommu_table *tbl;
554 struct scatterlist *sgl; 559 struct scatterlist *sgl;
555 int ret, count = 0; 560 int ret, count = 0;
556 size_t alloc_size = 0; 561 size_t alloc_size = 0;
557 562
563 tbl = get_iommu_table_base(dev);
558 for (sgl = sglist; count < nelems; count++, sgl++) 564 for (sgl = sglist; count < nelems; count++, sgl++)
559 alloc_size += roundup(sgl->length, IOMMU_PAGE_SIZE); 565 alloc_size += roundup(sgl->length, IOMMU_PAGE_SIZE(tbl));
560 566
561 if (vio_cmo_alloc(viodev, alloc_size)) { 567 if (vio_cmo_alloc(viodev, alloc_size)) {
562 atomic_inc(&viodev->cmo.allocs_failed); 568 atomic_inc(&viodev->cmo.allocs_failed);
@@ -572,7 +578,7 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
572 } 578 }
573 579
574 for (sgl = sglist, count = 0; count < ret; count++, sgl++) 580 for (sgl = sglist, count = 0; count < ret; count++, sgl++)
575 alloc_size -= roundup(sgl->dma_length, IOMMU_PAGE_SIZE); 581 alloc_size -= roundup(sgl->dma_length, IOMMU_PAGE_SIZE(tbl));
576 if (alloc_size) 582 if (alloc_size)
577 vio_cmo_dealloc(viodev, alloc_size); 583 vio_cmo_dealloc(viodev, alloc_size);
578 584
@@ -585,12 +591,14 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,
585 struct dma_attrs *attrs) 591 struct dma_attrs *attrs)
586{ 592{
587 struct vio_dev *viodev = to_vio_dev(dev); 593 struct vio_dev *viodev = to_vio_dev(dev);
594 struct iommu_table *tbl;
588 struct scatterlist *sgl; 595 struct scatterlist *sgl;
589 size_t alloc_size = 0; 596 size_t alloc_size = 0;
590 int count = 0; 597 int count = 0;
591 598
599 tbl = get_iommu_table_base(dev);
592 for (sgl = sglist; count < nelems; count++, sgl++) 600 for (sgl = sglist; count < nelems; count++, sgl++)
593 alloc_size += roundup(sgl->dma_length, IOMMU_PAGE_SIZE); 601 alloc_size += roundup(sgl->dma_length, IOMMU_PAGE_SIZE(tbl));
594 602
595 dma_iommu_ops.unmap_sg(dev, sglist, nelems, direction, attrs); 603 dma_iommu_ops.unmap_sg(dev, sglist, nelems, direction, attrs);
596 604
@@ -706,11 +714,14 @@ static int vio_cmo_bus_probe(struct vio_dev *viodev)
706{ 714{
707 struct vio_cmo_dev_entry *dev_ent; 715 struct vio_cmo_dev_entry *dev_ent;
708 struct device *dev = &viodev->dev; 716 struct device *dev = &viodev->dev;
717 struct iommu_table *tbl;
709 struct vio_driver *viodrv = to_vio_driver(dev->driver); 718 struct vio_driver *viodrv = to_vio_driver(dev->driver);
710 unsigned long flags; 719 unsigned long flags;
711 size_t size; 720 size_t size;
712 bool dma_capable = false; 721 bool dma_capable = false;
713 722
723 tbl = get_iommu_table_base(dev);
724
714 /* A device requires entitlement if it has a DMA window property */ 725 /* A device requires entitlement if it has a DMA window property */
715 switch (viodev->family) { 726 switch (viodev->family) {
716 case VDEVICE: 727 case VDEVICE:
@@ -736,7 +747,8 @@ static int vio_cmo_bus_probe(struct vio_dev *viodev)
736 return -EINVAL; 747 return -EINVAL;
737 } 748 }
738 749
739 viodev->cmo.desired = IOMMU_PAGE_ALIGN(viodrv->get_desired_dma(viodev)); 750 viodev->cmo.desired =
751 IOMMU_PAGE_ALIGN(viodrv->get_desired_dma(viodev), tbl);
740 if (viodev->cmo.desired < VIO_CMO_MIN_ENT) 752 if (viodev->cmo.desired < VIO_CMO_MIN_ENT)
741 viodev->cmo.desired = VIO_CMO_MIN_ENT; 753 viodev->cmo.desired = VIO_CMO_MIN_ENT;
742 size = VIO_CMO_MIN_ENT; 754 size = VIO_CMO_MIN_ENT;
@@ -1176,9 +1188,10 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
1176 &tbl->it_index, &offset, &size); 1188 &tbl->it_index, &offset, &size);
1177 1189
1178 /* TCE table size - measured in tce entries */ 1190 /* TCE table size - measured in tce entries */
1179 tbl->it_size = size >> IOMMU_PAGE_SHIFT; 1191 tbl->it_page_shift = IOMMU_PAGE_SHIFT_4K;
1192 tbl->it_size = size >> tbl->it_page_shift;
1180 /* offset for VIO should always be 0 */ 1193 /* offset for VIO should always be 0 */
1181 tbl->it_offset = offset >> IOMMU_PAGE_SHIFT; 1194 tbl->it_offset = offset >> tbl->it_page_shift;
1182 tbl->it_busno = 0; 1195 tbl->it_busno = 0;
1183 tbl->it_type = TCE_VB; 1196 tbl->it_type = TCE_VB;
1184 tbl->it_blocksize = 16; 1197 tbl->it_blocksize = 16;
diff --git a/arch/powerpc/kvm/44x.c b/arch/powerpc/kvm/44x.c
index 93221e87b911..9cb4b0a36031 100644
--- a/arch/powerpc/kvm/44x.c
+++ b/arch/powerpc/kvm/44x.c
@@ -21,6 +21,8 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/export.h> 23#include <linux/export.h>
24#include <linux/module.h>
25#include <linux/miscdevice.h>
24 26
25#include <asm/reg.h> 27#include <asm/reg.h>
26#include <asm/cputable.h> 28#include <asm/cputable.h>
@@ -231,3 +233,5 @@ static void __exit kvmppc_44x_exit(void)
231 233
232module_init(kvmppc_44x_init); 234module_init(kvmppc_44x_init);
233module_exit(kvmppc_44x_exit); 235module_exit(kvmppc_44x_exit);
236MODULE_ALIAS_MISCDEV(KVM_MINOR);
237MODULE_ALIAS("devname:kvm");
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 8912608b7e1b..94e597e6f15c 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -18,6 +18,8 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/export.h> 19#include <linux/export.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/module.h>
22#include <linux/miscdevice.h>
21 23
22#include <asm/reg.h> 24#include <asm/reg.h>
23#include <asm/cputable.h> 25#include <asm/cputable.h>
@@ -575,10 +577,10 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
575 break; 577 break;
576 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 578 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
577 i = reg->id - KVM_REG_PPC_FPR0; 579 i = reg->id - KVM_REG_PPC_FPR0;
578 val = get_reg_val(reg->id, vcpu->arch.fpr[i]); 580 val = get_reg_val(reg->id, VCPU_FPR(vcpu, i));
579 break; 581 break;
580 case KVM_REG_PPC_FPSCR: 582 case KVM_REG_PPC_FPSCR:
581 val = get_reg_val(reg->id, vcpu->arch.fpscr); 583 val = get_reg_val(reg->id, vcpu->arch.fp.fpscr);
582 break; 584 break;
583#ifdef CONFIG_ALTIVEC 585#ifdef CONFIG_ALTIVEC
584 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31: 586 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
@@ -586,19 +588,30 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
586 r = -ENXIO; 588 r = -ENXIO;
587 break; 589 break;
588 } 590 }
589 val.vval = vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0]; 591 val.vval = vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0];
590 break; 592 break;
591 case KVM_REG_PPC_VSCR: 593 case KVM_REG_PPC_VSCR:
592 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { 594 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
593 r = -ENXIO; 595 r = -ENXIO;
594 break; 596 break;
595 } 597 }
596 val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]); 598 val = get_reg_val(reg->id, vcpu->arch.vr.vscr.u[3]);
597 break; 599 break;
598 case KVM_REG_PPC_VRSAVE: 600 case KVM_REG_PPC_VRSAVE:
599 val = get_reg_val(reg->id, vcpu->arch.vrsave); 601 val = get_reg_val(reg->id, vcpu->arch.vrsave);
600 break; 602 break;
601#endif /* CONFIG_ALTIVEC */ 603#endif /* CONFIG_ALTIVEC */
604#ifdef CONFIG_VSX
605 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31:
606 if (cpu_has_feature(CPU_FTR_VSX)) {
607 long int i = reg->id - KVM_REG_PPC_VSR0;
608 val.vsxval[0] = vcpu->arch.fp.fpr[i][0];
609 val.vsxval[1] = vcpu->arch.fp.fpr[i][1];
610 } else {
611 r = -ENXIO;
612 }
613 break;
614#endif /* CONFIG_VSX */
602 case KVM_REG_PPC_DEBUG_INST: { 615 case KVM_REG_PPC_DEBUG_INST: {
603 u32 opcode = INS_TW; 616 u32 opcode = INS_TW;
604 r = copy_to_user((u32 __user *)(long)reg->addr, 617 r = copy_to_user((u32 __user *)(long)reg->addr,
@@ -654,10 +667,10 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
654 break; 667 break;
655 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 668 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31:
656 i = reg->id - KVM_REG_PPC_FPR0; 669 i = reg->id - KVM_REG_PPC_FPR0;
657 vcpu->arch.fpr[i] = set_reg_val(reg->id, val); 670 VCPU_FPR(vcpu, i) = set_reg_val(reg->id, val);
658 break; 671 break;
659 case KVM_REG_PPC_FPSCR: 672 case KVM_REG_PPC_FPSCR:
660 vcpu->arch.fpscr = set_reg_val(reg->id, val); 673 vcpu->arch.fp.fpscr = set_reg_val(reg->id, val);
661 break; 674 break;
662#ifdef CONFIG_ALTIVEC 675#ifdef CONFIG_ALTIVEC
663 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31: 676 case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
@@ -665,14 +678,14 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
665 r = -ENXIO; 678 r = -ENXIO;
666 break; 679 break;
667 } 680 }
668 vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0] = val.vval; 681 vcpu->arch.vr.vr[reg->id - KVM_REG_PPC_VR0] = val.vval;
669 break; 682 break;
670 case KVM_REG_PPC_VSCR: 683 case KVM_REG_PPC_VSCR:
671 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { 684 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
672 r = -ENXIO; 685 r = -ENXIO;
673 break; 686 break;
674 } 687 }
675 vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val); 688 vcpu->arch.vr.vscr.u[3] = set_reg_val(reg->id, val);
676 break; 689 break;
677 case KVM_REG_PPC_VRSAVE: 690 case KVM_REG_PPC_VRSAVE:
678 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) { 691 if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
@@ -682,6 +695,17 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
682 vcpu->arch.vrsave = set_reg_val(reg->id, val); 695 vcpu->arch.vrsave = set_reg_val(reg->id, val);
683 break; 696 break;
684#endif /* CONFIG_ALTIVEC */ 697#endif /* CONFIG_ALTIVEC */
698#ifdef CONFIG_VSX
699 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31:
700 if (cpu_has_feature(CPU_FTR_VSX)) {
701 long int i = reg->id - KVM_REG_PPC_VSR0;
702 vcpu->arch.fp.fpr[i][0] = val.vsxval[0];
703 vcpu->arch.fp.fpr[i][1] = val.vsxval[1];
704 } else {
705 r = -ENXIO;
706 }
707 break;
708#endif /* CONFIG_VSX */
685#ifdef CONFIG_KVM_XICS 709#ifdef CONFIG_KVM_XICS
686 case KVM_REG_PPC_ICP_STATE: 710 case KVM_REG_PPC_ICP_STATE:
687 if (!vcpu->arch.icp) { 711 if (!vcpu->arch.icp) {
@@ -879,3 +903,9 @@ static void kvmppc_book3s_exit(void)
879 903
880module_init(kvmppc_book3s_init); 904module_init(kvmppc_book3s_init);
881module_exit(kvmppc_book3s_exit); 905module_exit(kvmppc_book3s_exit);
906
907/* On 32bit this is our one and only kernel module */
908#ifdef CONFIG_KVM_BOOK3S_32
909MODULE_ALIAS_MISCDEV(KVM_MINOR);
910MODULE_ALIAS("devname:kvm");
911#endif
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 3a0abd2e5a15..5fac89dfe4cd 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -243,6 +243,11 @@ next_pteg:
243 /* Now tell our Shadow PTE code about the new page */ 243 /* Now tell our Shadow PTE code about the new page */
244 244
245 pte = kvmppc_mmu_hpte_cache_next(vcpu); 245 pte = kvmppc_mmu_hpte_cache_next(vcpu);
246 if (!pte) {
247 kvm_release_pfn_clean(hpaddr >> PAGE_SHIFT);
248 r = -EAGAIN;
249 goto out;
250 }
246 251
247 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n", 252 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n",
248 orig_pte->may_write ? 'w' : '-', 253 orig_pte->may_write ? 'w' : '-',
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index c5d148434c08..303ece75b8e4 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -262,7 +262,7 @@ int kvmppc_mmu_hv_init(void)
262 262
263static 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)
264{ 264{
265 kvmppc_set_msr(vcpu, MSR_SF | MSR_ME); 265 kvmppc_set_msr(vcpu, vcpu->arch.intr_msr);
266} 266}
267 267
268/* 268/*
@@ -562,7 +562,7 @@ static int kvmppc_hv_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu,
562 * we just return and retry the instruction. 562 * we just return and retry the instruction.
563 */ 563 */
564 564
565 if (instruction_is_store(vcpu->arch.last_inst) != !!is_store) 565 if (instruction_is_store(kvmppc_get_last_inst(vcpu)) != !!is_store)
566 return RESUME_GUEST; 566 return RESUME_GUEST;
567 567
568 /* 568 /*
diff --git a/arch/powerpc/kvm/book3s_exports.c b/arch/powerpc/kvm/book3s_exports.c
index 852989a9bad3..20d4ea8e656d 100644
--- a/arch/powerpc/kvm/book3s_exports.c
+++ b/arch/powerpc/kvm/book3s_exports.c
@@ -25,9 +25,5 @@ EXPORT_SYMBOL_GPL(kvmppc_hv_entry_trampoline);
25#endif 25#endif
26#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE 26#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
27EXPORT_SYMBOL_GPL(kvmppc_entry_trampoline); 27EXPORT_SYMBOL_GPL(kvmppc_entry_trampoline);
28EXPORT_SYMBOL_GPL(kvmppc_load_up_fpu);
29#ifdef CONFIG_ALTIVEC
30EXPORT_SYMBOL_GPL(kvmppc_load_up_altivec);
31#endif
32#endif 28#endif
33 29
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index b51d5db78068..17fc9496b6ac 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -31,6 +31,7 @@
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/page-flags.h> 32#include <linux/page-flags.h>
33#include <linux/srcu.h> 33#include <linux/srcu.h>
34#include <linux/miscdevice.h>
34 35
35#include <asm/reg.h> 36#include <asm/reg.h>
36#include <asm/cputable.h> 37#include <asm/cputable.h>
@@ -85,10 +86,13 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu)
85 86
86 /* CPU points to the first thread of the core */ 87 /* CPU points to the first thread of the core */
87 if (cpu != me && cpu >= 0 && cpu < nr_cpu_ids) { 88 if (cpu != me && cpu >= 0 && cpu < nr_cpu_ids) {
89#ifdef CONFIG_KVM_XICS
88 int real_cpu = cpu + vcpu->arch.ptid; 90 int real_cpu = cpu + vcpu->arch.ptid;
89 if (paca[real_cpu].kvm_hstate.xics_phys) 91 if (paca[real_cpu].kvm_hstate.xics_phys)
90 xics_wake_cpu(real_cpu); 92 xics_wake_cpu(real_cpu);
91 else if (cpu_online(cpu)) 93 else
94#endif
95 if (cpu_online(cpu))
92 smp_send_reschedule(cpu); 96 smp_send_reschedule(cpu);
93 } 97 }
94 put_cpu(); 98 put_cpu();
@@ -182,14 +186,28 @@ int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat)
182 186
183 switch (arch_compat) { 187 switch (arch_compat) {
184 case PVR_ARCH_205: 188 case PVR_ARCH_205:
185 pcr = PCR_ARCH_205; 189 /*
190 * If an arch bit is set in PCR, all the defined
191 * higher-order arch bits also have to be set.
192 */
193 pcr = PCR_ARCH_206 | PCR_ARCH_205;
186 break; 194 break;
187 case PVR_ARCH_206: 195 case PVR_ARCH_206:
188 case PVR_ARCH_206p: 196 case PVR_ARCH_206p:
197 pcr = PCR_ARCH_206;
198 break;
199 case PVR_ARCH_207:
189 break; 200 break;
190 default: 201 default:
191 return -EINVAL; 202 return -EINVAL;
192 } 203 }
204
205 if (!cpu_has_feature(CPU_FTR_ARCH_207S)) {
206 /* POWER7 can't emulate POWER8 */
207 if (!(pcr & PCR_ARCH_206))
208 return -EINVAL;
209 pcr &= ~PCR_ARCH_206;
210 }
193 } 211 }
194 212
195 spin_lock(&vc->lock); 213 spin_lock(&vc->lock);
@@ -637,6 +655,7 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
637 r = RESUME_GUEST; 655 r = RESUME_GUEST;
638 break; 656 break;
639 case BOOK3S_INTERRUPT_EXTERNAL: 657 case BOOK3S_INTERRUPT_EXTERNAL:
658 case BOOK3S_INTERRUPT_H_DOORBELL:
640 vcpu->stat.ext_intr_exits++; 659 vcpu->stat.ext_intr_exits++;
641 r = RESUME_GUEST; 660 r = RESUME_GUEST;
642 break; 661 break;
@@ -673,12 +692,10 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
673 /* hcall - punt to userspace */ 692 /* hcall - punt to userspace */
674 int i; 693 int i;
675 694
676 if (vcpu->arch.shregs.msr & MSR_PR) { 695 /* hypercall with MSR_PR has already been handled in rmode,
677 /* sc 1 from userspace - reflect to guest syscall */ 696 * and never reaches here.
678 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_SYSCALL); 697 */
679 r = RESUME_GUEST; 698
680 break;
681 }
682 run->papr_hcall.nr = kvmppc_get_gpr(vcpu, 3); 699 run->papr_hcall.nr = kvmppc_get_gpr(vcpu, 3);
683 for (i = 0; i < 9; ++i) 700 for (i = 0; i < 9; ++i)
684 run->papr_hcall.args[i] = kvmppc_get_gpr(vcpu, 4 + i); 701 run->papr_hcall.args[i] = kvmppc_get_gpr(vcpu, 4 + i);
@@ -708,7 +725,16 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
708 * we don't emulate any guest instructions at this stage. 725 * we don't emulate any guest instructions at this stage.
709 */ 726 */
710 case BOOK3S_INTERRUPT_H_EMUL_ASSIST: 727 case BOOK3S_INTERRUPT_H_EMUL_ASSIST:
711 kvmppc_core_queue_program(vcpu, 0x80000); 728 kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
729 r = RESUME_GUEST;
730 break;
731 /*
732 * This occurs if the guest (kernel or userspace), does something that
733 * is prohibited by HFSCR. We just generate a program interrupt to
734 * the guest.
735 */
736 case BOOK3S_INTERRUPT_H_FAC_UNAVAIL:
737 kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
712 r = RESUME_GUEST; 738 r = RESUME_GUEST;
713 break; 739 break;
714 default: 740 default:
@@ -766,10 +792,34 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr)
766 792
767 spin_lock(&vc->lock); 793 spin_lock(&vc->lock);
768 /* 794 /*
795 * If ILE (interrupt little-endian) has changed, update the
796 * MSR_LE bit in the intr_msr for each vcpu in this vcore.
797 */
798 if ((new_lpcr & LPCR_ILE) != (vc->lpcr & LPCR_ILE)) {
799 struct kvm *kvm = vcpu->kvm;
800 struct kvm_vcpu *vcpu;
801 int i;
802
803 mutex_lock(&kvm->lock);
804 kvm_for_each_vcpu(i, vcpu, kvm) {
805 if (vcpu->arch.vcore != vc)
806 continue;
807 if (new_lpcr & LPCR_ILE)
808 vcpu->arch.intr_msr |= MSR_LE;
809 else
810 vcpu->arch.intr_msr &= ~MSR_LE;
811 }
812 mutex_unlock(&kvm->lock);
813 }
814
815 /*
769 * Userspace can only modify DPFD (default prefetch depth), 816 * Userspace can only modify DPFD (default prefetch depth),
770 * ILE (interrupt little-endian) and TC (translation control). 817 * ILE (interrupt little-endian) and TC (translation control).
818 * On POWER8 userspace can also modify AIL (alt. interrupt loc.)
771 */ 819 */
772 mask = LPCR_DPFD | LPCR_ILE | LPCR_TC; 820 mask = LPCR_DPFD | LPCR_ILE | LPCR_TC;
821 if (cpu_has_feature(CPU_FTR_ARCH_207S))
822 mask |= LPCR_AIL;
773 vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask); 823 vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask);
774 spin_unlock(&vc->lock); 824 spin_unlock(&vc->lock);
775} 825}
@@ -787,6 +837,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
787 case KVM_REG_PPC_DABR: 837 case KVM_REG_PPC_DABR:
788 *val = get_reg_val(id, vcpu->arch.dabr); 838 *val = get_reg_val(id, vcpu->arch.dabr);
789 break; 839 break;
840 case KVM_REG_PPC_DABRX:
841 *val = get_reg_val(id, vcpu->arch.dabrx);
842 break;
790 case KVM_REG_PPC_DSCR: 843 case KVM_REG_PPC_DSCR:
791 *val = get_reg_val(id, vcpu->arch.dscr); 844 *val = get_reg_val(id, vcpu->arch.dscr);
792 break; 845 break;
@@ -802,7 +855,7 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
802 case KVM_REG_PPC_UAMOR: 855 case KVM_REG_PPC_UAMOR:
803 *val = get_reg_val(id, vcpu->arch.uamor); 856 *val = get_reg_val(id, vcpu->arch.uamor);
804 break; 857 break;
805 case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCRA: 858 case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCRS:
806 i = id - KVM_REG_PPC_MMCR0; 859 i = id - KVM_REG_PPC_MMCR0;
807 *val = get_reg_val(id, vcpu->arch.mmcr[i]); 860 *val = get_reg_val(id, vcpu->arch.mmcr[i]);
808 break; 861 break;
@@ -810,33 +863,87 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
810 i = id - KVM_REG_PPC_PMC1; 863 i = id - KVM_REG_PPC_PMC1;
811 *val = get_reg_val(id, vcpu->arch.pmc[i]); 864 *val = get_reg_val(id, vcpu->arch.pmc[i]);
812 break; 865 break;
866 case KVM_REG_PPC_SPMC1 ... KVM_REG_PPC_SPMC2:
867 i = id - KVM_REG_PPC_SPMC1;
868 *val = get_reg_val(id, vcpu->arch.spmc[i]);
869 break;
813 case KVM_REG_PPC_SIAR: 870 case KVM_REG_PPC_SIAR:
814 *val = get_reg_val(id, vcpu->arch.siar); 871 *val = get_reg_val(id, vcpu->arch.siar);
815 break; 872 break;
816 case KVM_REG_PPC_SDAR: 873 case KVM_REG_PPC_SDAR:
817 *val = get_reg_val(id, vcpu->arch.sdar); 874 *val = get_reg_val(id, vcpu->arch.sdar);
818 break; 875 break;
819#ifdef CONFIG_VSX 876 case KVM_REG_PPC_SIER:
820 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 877 *val = get_reg_val(id, vcpu->arch.sier);
821 if (cpu_has_feature(CPU_FTR_VSX)) {
822 /* VSX => FP reg i is stored in arch.vsr[2*i] */
823 long int i = id - KVM_REG_PPC_FPR0;
824 *val = get_reg_val(id, vcpu->arch.vsr[2 * i]);
825 } else {
826 /* let generic code handle it */
827 r = -EINVAL;
828 }
829 break; 878 break;
830 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: 879 case KVM_REG_PPC_IAMR:
831 if (cpu_has_feature(CPU_FTR_VSX)) { 880 *val = get_reg_val(id, vcpu->arch.iamr);
832 long int i = id - KVM_REG_PPC_VSR0; 881 break;
833 val->vsxval[0] = vcpu->arch.vsr[2 * i]; 882#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
834 val->vsxval[1] = vcpu->arch.vsr[2 * i + 1]; 883 case KVM_REG_PPC_TFHAR:
835 } else { 884 *val = get_reg_val(id, vcpu->arch.tfhar);
836 r = -ENXIO; 885 break;
837 } 886 case KVM_REG_PPC_TFIAR:
887 *val = get_reg_val(id, vcpu->arch.tfiar);
888 break;
889 case KVM_REG_PPC_TEXASR:
890 *val = get_reg_val(id, vcpu->arch.texasr);
891 break;
892#endif
893 case KVM_REG_PPC_FSCR:
894 *val = get_reg_val(id, vcpu->arch.fscr);
895 break;
896 case KVM_REG_PPC_PSPB:
897 *val = get_reg_val(id, vcpu->arch.pspb);
898 break;
899 case KVM_REG_PPC_EBBHR:
900 *val = get_reg_val(id, vcpu->arch.ebbhr);
901 break;
902 case KVM_REG_PPC_EBBRR:
903 *val = get_reg_val(id, vcpu->arch.ebbrr);
904 break;
905 case KVM_REG_PPC_BESCR:
906 *val = get_reg_val(id, vcpu->arch.bescr);
907 break;
908 case KVM_REG_PPC_TAR:
909 *val = get_reg_val(id, vcpu->arch.tar);
910 break;
911 case KVM_REG_PPC_DPDES:
912 *val = get_reg_val(id, vcpu->arch.vcore->dpdes);
913 break;
914 case KVM_REG_PPC_DAWR:
915 *val = get_reg_val(id, vcpu->arch.dawr);
916 break;
917 case KVM_REG_PPC_DAWRX:
918 *val = get_reg_val(id, vcpu->arch.dawrx);
919 break;
920 case KVM_REG_PPC_CIABR:
921 *val = get_reg_val(id, vcpu->arch.ciabr);
922 break;
923 case KVM_REG_PPC_IC:
924 *val = get_reg_val(id, vcpu->arch.ic);
925 break;
926 case KVM_REG_PPC_VTB:
927 *val = get_reg_val(id, vcpu->arch.vtb);
928 break;
929 case KVM_REG_PPC_CSIGR:
930 *val = get_reg_val(id, vcpu->arch.csigr);
931 break;
932 case KVM_REG_PPC_TACR:
933 *val = get_reg_val(id, vcpu->arch.tacr);
934 break;
935 case KVM_REG_PPC_TCSCR:
936 *val = get_reg_val(id, vcpu->arch.tcscr);
937 break;
938 case KVM_REG_PPC_PID:
939 *val = get_reg_val(id, vcpu->arch.pid);
940 break;
941 case KVM_REG_PPC_ACOP:
942 *val = get_reg_val(id, vcpu->arch.acop);
943 break;
944 case KVM_REG_PPC_WORT:
945 *val = get_reg_val(id, vcpu->arch.wort);
838 break; 946 break;
839#endif /* CONFIG_VSX */
840 case KVM_REG_PPC_VPA_ADDR: 947 case KVM_REG_PPC_VPA_ADDR:
841 spin_lock(&vcpu->arch.vpa_update_lock); 948 spin_lock(&vcpu->arch.vpa_update_lock);
842 *val = get_reg_val(id, vcpu->arch.vpa.next_gpa); 949 *val = get_reg_val(id, vcpu->arch.vpa.next_gpa);
@@ -890,6 +997,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
890 case KVM_REG_PPC_DABR: 997 case KVM_REG_PPC_DABR:
891 vcpu->arch.dabr = set_reg_val(id, *val); 998 vcpu->arch.dabr = set_reg_val(id, *val);
892 break; 999 break;
1000 case KVM_REG_PPC_DABRX:
1001 vcpu->arch.dabrx = set_reg_val(id, *val) & ~DABRX_HYP;
1002 break;
893 case KVM_REG_PPC_DSCR: 1003 case KVM_REG_PPC_DSCR:
894 vcpu->arch.dscr = set_reg_val(id, *val); 1004 vcpu->arch.dscr = set_reg_val(id, *val);
895 break; 1005 break;
@@ -905,7 +1015,7 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
905 case KVM_REG_PPC_UAMOR: 1015 case KVM_REG_PPC_UAMOR:
906 vcpu->arch.uamor = set_reg_val(id, *val); 1016 vcpu->arch.uamor = set_reg_val(id, *val);
907 break; 1017 break;
908 case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCRA: 1018 case KVM_REG_PPC_MMCR0 ... KVM_REG_PPC_MMCRS:
909 i = id - KVM_REG_PPC_MMCR0; 1019 i = id - KVM_REG_PPC_MMCR0;
910 vcpu->arch.mmcr[i] = set_reg_val(id, *val); 1020 vcpu->arch.mmcr[i] = set_reg_val(id, *val);
911 break; 1021 break;
@@ -913,33 +1023,90 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
913 i = id - KVM_REG_PPC_PMC1; 1023 i = id - KVM_REG_PPC_PMC1;
914 vcpu->arch.pmc[i] = set_reg_val(id, *val); 1024 vcpu->arch.pmc[i] = set_reg_val(id, *val);
915 break; 1025 break;
1026 case KVM_REG_PPC_SPMC1 ... KVM_REG_PPC_SPMC2:
1027 i = id - KVM_REG_PPC_SPMC1;
1028 vcpu->arch.spmc[i] = set_reg_val(id, *val);
1029 break;
916 case KVM_REG_PPC_SIAR: 1030 case KVM_REG_PPC_SIAR:
917 vcpu->arch.siar = set_reg_val(id, *val); 1031 vcpu->arch.siar = set_reg_val(id, *val);
918 break; 1032 break;
919 case KVM_REG_PPC_SDAR: 1033 case KVM_REG_PPC_SDAR:
920 vcpu->arch.sdar = set_reg_val(id, *val); 1034 vcpu->arch.sdar = set_reg_val(id, *val);
921 break; 1035 break;
922#ifdef CONFIG_VSX 1036 case KVM_REG_PPC_SIER:
923 case KVM_REG_PPC_FPR0 ... KVM_REG_PPC_FPR31: 1037 vcpu->arch.sier = set_reg_val(id, *val);
924 if (cpu_has_feature(CPU_FTR_VSX)) {
925 /* VSX => FP reg i is stored in arch.vsr[2*i] */
926 long int i = id - KVM_REG_PPC_FPR0;
927 vcpu->arch.vsr[2 * i] = set_reg_val(id, *val);
928 } else {
929 /* let generic code handle it */
930 r = -EINVAL;
931 }
932 break; 1038 break;
933 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: 1039 case KVM_REG_PPC_IAMR:
934 if (cpu_has_feature(CPU_FTR_VSX)) { 1040 vcpu->arch.iamr = set_reg_val(id, *val);
935 long int i = id - KVM_REG_PPC_VSR0; 1041 break;
936 vcpu->arch.vsr[2 * i] = val->vsxval[0]; 1042#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
937 vcpu->arch.vsr[2 * i + 1] = val->vsxval[1]; 1043 case KVM_REG_PPC_TFHAR:
938 } else { 1044 vcpu->arch.tfhar = set_reg_val(id, *val);
939 r = -ENXIO; 1045 break;
940 } 1046 case KVM_REG_PPC_TFIAR:
1047 vcpu->arch.tfiar = set_reg_val(id, *val);
1048 break;
1049 case KVM_REG_PPC_TEXASR:
1050 vcpu->arch.texasr = set_reg_val(id, *val);
1051 break;
1052#endif
1053 case KVM_REG_PPC_FSCR:
1054 vcpu->arch.fscr = set_reg_val(id, *val);
1055 break;
1056 case KVM_REG_PPC_PSPB:
1057 vcpu->arch.pspb = set_reg_val(id, *val);
1058 break;
1059 case KVM_REG_PPC_EBBHR:
1060 vcpu->arch.ebbhr = set_reg_val(id, *val);
1061 break;
1062 case KVM_REG_PPC_EBBRR:
1063 vcpu->arch.ebbrr = set_reg_val(id, *val);
1064 break;
1065 case KVM_REG_PPC_BESCR:
1066 vcpu->arch.bescr = set_reg_val(id, *val);
1067 break;
1068 case KVM_REG_PPC_TAR:
1069 vcpu->arch.tar = set_reg_val(id, *val);
1070 break;
1071 case KVM_REG_PPC_DPDES:
1072 vcpu->arch.vcore->dpdes = set_reg_val(id, *val);
1073 break;
1074 case KVM_REG_PPC_DAWR:
1075 vcpu->arch.dawr = set_reg_val(id, *val);
1076 break;
1077 case KVM_REG_PPC_DAWRX:
1078 vcpu->arch.dawrx = set_reg_val(id, *val) & ~DAWRX_HYP;
1079 break;
1080 case KVM_REG_PPC_CIABR:
1081 vcpu->arch.ciabr = set_reg_val(id, *val);
1082 /* Don't allow setting breakpoints in hypervisor code */
1083 if ((vcpu->arch.ciabr & CIABR_PRIV) == CIABR_PRIV_HYPER)
1084 vcpu->arch.ciabr &= ~CIABR_PRIV; /* disable */
1085 break;
1086 case KVM_REG_PPC_IC:
1087 vcpu->arch.ic = set_reg_val(id, *val);
1088 break;
1089 case KVM_REG_PPC_VTB:
1090 vcpu->arch.vtb = set_reg_val(id, *val);
1091 break;
1092 case KVM_REG_PPC_CSIGR:
1093 vcpu->arch.csigr = set_reg_val(id, *val);
1094 break;
1095 case KVM_REG_PPC_TACR:
1096 vcpu->arch.tacr = set_reg_val(id, *val);
1097 break;
1098 case KVM_REG_PPC_TCSCR:
1099 vcpu->arch.tcscr = set_reg_val(id, *val);
1100 break;
1101 case KVM_REG_PPC_PID:
1102 vcpu->arch.pid = set_reg_val(id, *val);
1103 break;
1104 case KVM_REG_PPC_ACOP:
1105 vcpu->arch.acop = set_reg_val(id, *val);
1106 break;
1107 case KVM_REG_PPC_WORT:
1108 vcpu->arch.wort = set_reg_val(id, *val);
941 break; 1109 break;
942#endif /* CONFIG_VSX */
943 case KVM_REG_PPC_VPA_ADDR: 1110 case KVM_REG_PPC_VPA_ADDR:
944 addr = set_reg_val(id, *val); 1111 addr = set_reg_val(id, *val);
945 r = -EINVAL; 1112 r = -EINVAL;
@@ -1017,6 +1184,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
1017 spin_lock_init(&vcpu->arch.vpa_update_lock); 1184 spin_lock_init(&vcpu->arch.vpa_update_lock);
1018 spin_lock_init(&vcpu->arch.tbacct_lock); 1185 spin_lock_init(&vcpu->arch.tbacct_lock);
1019 vcpu->arch.busy_preempt = TB_NIL; 1186 vcpu->arch.busy_preempt = TB_NIL;
1187 vcpu->arch.intr_msr = MSR_SF | MSR_ME;
1020 1188
1021 kvmppc_mmu_book3s_hv_init(vcpu); 1189 kvmppc_mmu_book3s_hv_init(vcpu);
1022 1190
@@ -1034,6 +1202,8 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
1034 init_waitqueue_head(&vcore->wq); 1202 init_waitqueue_head(&vcore->wq);
1035 vcore->preempt_tb = TB_NIL; 1203 vcore->preempt_tb = TB_NIL;
1036 vcore->lpcr = kvm->arch.lpcr; 1204 vcore->lpcr = kvm->arch.lpcr;
1205 vcore->first_vcpuid = core * threads_per_core;
1206 vcore->kvm = kvm;
1037 } 1207 }
1038 kvm->arch.vcores[core] = vcore; 1208 kvm->arch.vcores[core] = vcore;
1039 kvm->arch.online_vcores++; 1209 kvm->arch.online_vcores++;
@@ -1047,6 +1217,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
1047 ++vcore->num_threads; 1217 ++vcore->num_threads;
1048 spin_unlock(&vcore->lock); 1218 spin_unlock(&vcore->lock);
1049 vcpu->arch.vcore = vcore; 1219 vcpu->arch.vcore = vcore;
1220 vcpu->arch.ptid = vcpu->vcpu_id - vcore->first_vcpuid;
1050 1221
1051 vcpu->arch.cpu_type = KVM_CPU_3S_64; 1222 vcpu->arch.cpu_type = KVM_CPU_3S_64;
1052 kvmppc_sanity_check(vcpu); 1223 kvmppc_sanity_check(vcpu);
@@ -1110,7 +1281,7 @@ static void kvmppc_end_cede(struct kvm_vcpu *vcpu)
1110 } 1281 }
1111} 1282}
1112 1283
1113extern int __kvmppc_vcore_entry(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); 1284extern void __kvmppc_vcore_entry(void);
1114 1285
1115static void kvmppc_remove_runnable(struct kvmppc_vcore *vc, 1286static void kvmppc_remove_runnable(struct kvmppc_vcore *vc,
1116 struct kvm_vcpu *vcpu) 1287 struct kvm_vcpu *vcpu)
@@ -1184,13 +1355,16 @@ static void kvmppc_start_thread(struct kvm_vcpu *vcpu)
1184 tpaca = &paca[cpu]; 1355 tpaca = &paca[cpu];
1185 tpaca->kvm_hstate.kvm_vcpu = vcpu; 1356 tpaca->kvm_hstate.kvm_vcpu = vcpu;
1186 tpaca->kvm_hstate.kvm_vcore = vc; 1357 tpaca->kvm_hstate.kvm_vcore = vc;
1187 tpaca->kvm_hstate.napping = 0; 1358 tpaca->kvm_hstate.ptid = vcpu->arch.ptid;
1188 vcpu->cpu = vc->pcpu; 1359 vcpu->cpu = vc->pcpu;
1189 smp_wmb(); 1360 smp_wmb();
1190#if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP) 1361#if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP)
1191 if (vcpu->arch.ptid) { 1362 if (cpu != smp_processor_id()) {
1363#ifdef CONFIG_KVM_XICS
1192 xics_wake_cpu(cpu); 1364 xics_wake_cpu(cpu);
1193 ++vc->n_woken; 1365#endif
1366 if (vcpu->arch.ptid)
1367 ++vc->n_woken;
1194 } 1368 }
1195#endif 1369#endif
1196} 1370}
@@ -1247,10 +1421,10 @@ static int on_primary_thread(void)
1247 */ 1421 */
1248static void kvmppc_run_core(struct kvmppc_vcore *vc) 1422static void kvmppc_run_core(struct kvmppc_vcore *vc)
1249{ 1423{
1250 struct kvm_vcpu *vcpu, *vcpu0, *vnext; 1424 struct kvm_vcpu *vcpu, *vnext;
1251 long ret; 1425 long ret;
1252 u64 now; 1426 u64 now;
1253 int ptid, i, need_vpa_update; 1427 int i, need_vpa_update;
1254 int srcu_idx; 1428 int srcu_idx;
1255 struct kvm_vcpu *vcpus_to_update[threads_per_core]; 1429 struct kvm_vcpu *vcpus_to_update[threads_per_core];
1256 1430
@@ -1288,25 +1462,6 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
1288 } 1462 }
1289 1463
1290 /* 1464 /*
1291 * Assign physical thread IDs, first to non-ceded vcpus
1292 * and then to ceded ones.
1293 */
1294 ptid = 0;
1295 vcpu0 = NULL;
1296 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
1297 if (!vcpu->arch.ceded) {
1298 if (!ptid)
1299 vcpu0 = vcpu;
1300 vcpu->arch.ptid = ptid++;
1301 }
1302 }
1303 if (!vcpu0)
1304 goto out; /* nothing to run; should never happen */
1305 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list)
1306 if (vcpu->arch.ceded)
1307 vcpu->arch.ptid = ptid++;
1308
1309 /*
1310 * Make sure we are running on thread 0, and that 1465 * Make sure we are running on thread 0, and that
1311 * secondary threads are offline. 1466 * secondary threads are offline.
1312 */ 1467 */
@@ -1322,15 +1477,19 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
1322 kvmppc_create_dtl_entry(vcpu, vc); 1477 kvmppc_create_dtl_entry(vcpu, vc);
1323 } 1478 }
1324 1479
1480 /* Set this explicitly in case thread 0 doesn't have a vcpu */
1481 get_paca()->kvm_hstate.kvm_vcore = vc;
1482 get_paca()->kvm_hstate.ptid = 0;
1483
1325 vc->vcore_state = VCORE_RUNNING; 1484 vc->vcore_state = VCORE_RUNNING;
1326 preempt_disable(); 1485 preempt_disable();
1327 spin_unlock(&vc->lock); 1486 spin_unlock(&vc->lock);
1328 1487
1329 kvm_guest_enter(); 1488 kvm_guest_enter();
1330 1489
1331 srcu_idx = srcu_read_lock(&vcpu0->kvm->srcu); 1490 srcu_idx = srcu_read_lock(&vc->kvm->srcu);
1332 1491
1333 __kvmppc_vcore_entry(NULL, vcpu0); 1492 __kvmppc_vcore_entry();
1334 1493
1335 spin_lock(&vc->lock); 1494 spin_lock(&vc->lock);
1336 /* disable sending of IPIs on virtual external irqs */ 1495 /* disable sending of IPIs on virtual external irqs */
@@ -1345,14 +1504,14 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
1345 vc->vcore_state = VCORE_EXITING; 1504 vc->vcore_state = VCORE_EXITING;
1346 spin_unlock(&vc->lock); 1505 spin_unlock(&vc->lock);
1347 1506
1348 srcu_read_unlock(&vcpu0->kvm->srcu, srcu_idx); 1507 srcu_read_unlock(&vc->kvm->srcu, srcu_idx);
1349 1508
1350 /* make sure updates to secondary vcpu structs are visible now */ 1509 /* make sure updates to secondary vcpu structs are visible now */
1351 smp_mb(); 1510 smp_mb();
1352 kvm_guest_exit(); 1511 kvm_guest_exit();
1353 1512
1354 preempt_enable(); 1513 preempt_enable();
1355 kvm_resched(vcpu); 1514 cond_resched();
1356 1515
1357 spin_lock(&vc->lock); 1516 spin_lock(&vc->lock);
1358 now = get_tb(); 1517 now = get_tb();
@@ -1453,7 +1612,6 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1453 if (!signal_pending(current)) { 1612 if (!signal_pending(current)) {
1454 if (vc->vcore_state == VCORE_RUNNING && 1613 if (vc->vcore_state == VCORE_RUNNING &&
1455 VCORE_EXIT_COUNT(vc) == 0) { 1614 VCORE_EXIT_COUNT(vc) == 0) {
1456 vcpu->arch.ptid = vc->n_runnable - 1;
1457 kvmppc_create_dtl_entry(vcpu, vc); 1615 kvmppc_create_dtl_entry(vcpu, vc);
1458 kvmppc_start_thread(vcpu); 1616 kvmppc_start_thread(vcpu);
1459 } else if (vc->vcore_state == VCORE_SLEEPING) { 1617 } else if (vc->vcore_state == VCORE_SLEEPING) {
@@ -2048,6 +2206,9 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm)
2048 LPCR_VPM0 | LPCR_VPM1; 2206 LPCR_VPM0 | LPCR_VPM1;
2049 kvm->arch.vrma_slb_v = SLB_VSID_B_1T | 2207 kvm->arch.vrma_slb_v = SLB_VSID_B_1T |
2050 (VRMA_VSID << SLB_VSID_SHIFT_1T); 2208 (VRMA_VSID << SLB_VSID_SHIFT_1T);
2209 /* On POWER8 turn on online bit to enable PURR/SPURR */
2210 if (cpu_has_feature(CPU_FTR_ARCH_207S))
2211 lpcr |= LPCR_ONL;
2051 } 2212 }
2052 kvm->arch.lpcr = lpcr; 2213 kvm->arch.lpcr = lpcr;
2053 2214
@@ -2222,3 +2383,5 @@ static void kvmppc_book3s_exit_hv(void)
2222module_init(kvmppc_book3s_init_hv); 2383module_init(kvmppc_book3s_init_hv);
2223module_exit(kvmppc_book3s_exit_hv); 2384module_exit(kvmppc_book3s_exit_hv);
2224MODULE_LICENSE("GPL"); 2385MODULE_LICENSE("GPL");
2386MODULE_ALIAS_MISCDEV(KVM_MINOR);
2387MODULE_ALIAS("devname:kvm");
diff --git a/arch/powerpc/kvm/book3s_hv_interrupts.S b/arch/powerpc/kvm/book3s_hv_interrupts.S
index 928142c64cb0..e873796b1a29 100644
--- a/arch/powerpc/kvm/book3s_hv_interrupts.S
+++ b/arch/powerpc/kvm/book3s_hv_interrupts.S
@@ -35,7 +35,7 @@
35 ****************************************************************************/ 35 ****************************************************************************/
36 36
37/* Registers: 37/* Registers:
38 * r4: vcpu pointer 38 * none
39 */ 39 */
40_GLOBAL(__kvmppc_vcore_entry) 40_GLOBAL(__kvmppc_vcore_entry)
41 41
@@ -57,9 +57,11 @@ BEGIN_FTR_SECTION
57 std r3, HSTATE_DSCR(r13) 57 std r3, HSTATE_DSCR(r13)
58END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 58END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
59 59
60BEGIN_FTR_SECTION
60 /* Save host DABR */ 61 /* Save host DABR */
61 mfspr r3, SPRN_DABR 62 mfspr r3, SPRN_DABR
62 std r3, HSTATE_DABR(r13) 63 std r3, HSTATE_DABR(r13)
64END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
63 65
64 /* Hard-disable interrupts */ 66 /* Hard-disable interrupts */
65 mfmsr r10 67 mfmsr r10
@@ -69,7 +71,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
69 mtmsrd r10,1 71 mtmsrd r10,1
70 72
71 /* Save host PMU registers */ 73 /* Save host PMU registers */
72 /* R4 is live here (vcpu pointer) but not r3 or r5 */
73 li r3, 1 74 li r3, 1
74 sldi r3, r3, 31 /* MMCR0_FC (freeze counters) bit */ 75 sldi r3, r3, 31 /* MMCR0_FC (freeze counters) bit */
75 mfspr r7, SPRN_MMCR0 /* save MMCR0 */ 76 mfspr r7, SPRN_MMCR0 /* save MMCR0 */
@@ -134,16 +135,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
134 * enters the guest with interrupts enabled. 135 * enters the guest with interrupts enabled.
135 */ 136 */
136BEGIN_FTR_SECTION 137BEGIN_FTR_SECTION
138 ld r4, HSTATE_KVM_VCPU(r13)
137 ld r0, VCPU_PENDING_EXC(r4) 139 ld r0, VCPU_PENDING_EXC(r4)
138 li r7, (1 << BOOK3S_IRQPRIO_EXTERNAL) 140 li r7, (1 << BOOK3S_IRQPRIO_EXTERNAL)
139 oris r7, r7, (1 << BOOK3S_IRQPRIO_EXTERNAL_LEVEL)@h 141 oris r7, r7, (1 << BOOK3S_IRQPRIO_EXTERNAL_LEVEL)@h
140 and. r0, r0, r7 142 and. r0, r0, r7
141 beq 32f 143 beq 32f
142 mr r31, r4
143 lhz r3, PACAPACAINDEX(r13) 144 lhz r3, PACAPACAINDEX(r13)
144 bl smp_send_reschedule 145 bl smp_send_reschedule
145 nop 146 nop
146 mr r4, r31
14732: 14732:
148END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) 148END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
149#endif /* CONFIG_SMP */ 149#endif /* CONFIG_SMP */
diff --git a/arch/powerpc/kvm/book3s_hv_ras.c b/arch/powerpc/kvm/book3s_hv_ras.c
index a353c485808c..768a9f977c00 100644
--- a/arch/powerpc/kvm/book3s_hv_ras.c
+++ b/arch/powerpc/kvm/book3s_hv_ras.c
@@ -12,6 +12,7 @@
12#include <linux/kvm_host.h> 12#include <linux/kvm_host.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <asm/opal.h> 14#include <asm/opal.h>
15#include <asm/mce.h>
15 16
16/* SRR1 bits for machine check on POWER7 */ 17/* SRR1 bits for machine check on POWER7 */
17#define SRR1_MC_LDSTERR (1ul << (63-42)) 18#define SRR1_MC_LDSTERR (1ul << (63-42))
@@ -58,18 +59,6 @@ static void reload_slb(struct kvm_vcpu *vcpu)
58 } 59 }
59} 60}
60 61
61/* POWER7 TLB flush */
62static void flush_tlb_power7(struct kvm_vcpu *vcpu)
63{
64 unsigned long i, rb;
65
66 rb = TLBIEL_INVAL_SET_LPID;
67 for (i = 0; i < POWER7_TLB_SETS; ++i) {
68 asm volatile("tlbiel %0" : : "r" (rb));
69 rb += 1 << TLBIEL_INVAL_SET_SHIFT;
70 }
71}
72
73/* 62/*
74 * On POWER7, see if we can handle a machine check that occurred inside 63 * On POWER7, see if we can handle a machine check that occurred inside
75 * the guest in real mode, without switching to the host partition. 64 * the guest in real mode, without switching to the host partition.
@@ -79,9 +68,7 @@ static void flush_tlb_power7(struct kvm_vcpu *vcpu)
79static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu) 68static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
80{ 69{
81 unsigned long srr1 = vcpu->arch.shregs.msr; 70 unsigned long srr1 = vcpu->arch.shregs.msr;
82#ifdef CONFIG_PPC_POWERNV 71 struct machine_check_event mce_evt;
83 struct opal_machine_check_event *opal_evt;
84#endif
85 long handled = 1; 72 long handled = 1;
86 73
87 if (srr1 & SRR1_MC_LDSTERR) { 74 if (srr1 & SRR1_MC_LDSTERR) {
@@ -96,7 +83,8 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
96 DSISR_MC_SLB_PARITY | DSISR_MC_DERAT_MULTI); 83 DSISR_MC_SLB_PARITY | DSISR_MC_DERAT_MULTI);
97 } 84 }
98 if (dsisr & DSISR_MC_TLB_MULTI) { 85 if (dsisr & DSISR_MC_TLB_MULTI) {
99 flush_tlb_power7(vcpu); 86 if (cur_cpu_spec && cur_cpu_spec->flush_tlb)
87 cur_cpu_spec->flush_tlb(TLBIEL_INVAL_SET_LPID);
100 dsisr &= ~DSISR_MC_TLB_MULTI; 88 dsisr &= ~DSISR_MC_TLB_MULTI;
101 } 89 }
102 /* Any other errors we don't understand? */ 90 /* Any other errors we don't understand? */
@@ -113,28 +101,38 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
113 reload_slb(vcpu); 101 reload_slb(vcpu);
114 break; 102 break;
115 case SRR1_MC_IFETCH_TLBMULTI: 103 case SRR1_MC_IFETCH_TLBMULTI:
116 flush_tlb_power7(vcpu); 104 if (cur_cpu_spec && cur_cpu_spec->flush_tlb)
105 cur_cpu_spec->flush_tlb(TLBIEL_INVAL_SET_LPID);
117 break; 106 break;
118 default: 107 default:
119 handled = 0; 108 handled = 0;
120 } 109 }
121 110
122#ifdef CONFIG_PPC_POWERNV
123 /* 111 /*
124 * See if OPAL has already handled the condition. 112 * See if we have already handled the condition in the linux host.
125 * We assume that if the condition is recovered then OPAL 113 * We assume that if the condition is recovered then linux host
126 * will have generated an error log event that we will pick 114 * will have generated an error log event that we will pick
127 * up and log later. 115 * up and log later.
116 * Don't release mce event now. In case if condition is not
117 * recovered we do guest exit and go back to linux host machine
118 * check handler. Hence we need make sure that current mce event
119 * is available for linux host to consume.
128 */ 120 */
129 opal_evt = local_paca->opal_mc_evt; 121 if (!get_mce_event(&mce_evt, MCE_EVENT_DONTRELEASE))
130 if (opal_evt->version == OpalMCE_V1 && 122 goto out;
131 (opal_evt->severity == OpalMCE_SEV_NO_ERROR || 123
132 opal_evt->disposition == OpalMCE_DISPOSITION_RECOVERED)) 124 if (mce_evt.version == MCE_V1 &&
125 (mce_evt.severity == MCE_SEV_NO_ERROR ||
126 mce_evt.disposition == MCE_DISPOSITION_RECOVERED))
133 handled = 1; 127 handled = 1;
134 128
129out:
130 /*
131 * If we have handled the error, then release the mce event because
132 * we will be delivering machine check to guest.
133 */
135 if (handled) 134 if (handled)
136 opal_evt->in_use = 0; 135 release_mce_event();
137#endif
138 136
139 return handled; 137 return handled;
140} 138}
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 8689e2e30857..37fb3caa4c80 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -134,7 +134,7 @@ static void remove_revmap_chain(struct kvm *kvm, long pte_index,
134 unlock_rmap(rmap); 134 unlock_rmap(rmap);
135} 135}
136 136
137static pte_t lookup_linux_pte(pgd_t *pgdir, unsigned long hva, 137static pte_t lookup_linux_pte_and_update(pgd_t *pgdir, unsigned long hva,
138 int writing, unsigned long *pte_sizep) 138 int writing, unsigned long *pte_sizep)
139{ 139{
140 pte_t *ptep; 140 pte_t *ptep;
@@ -232,7 +232,8 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
232 232
233 /* Look up the Linux PTE for the backing page */ 233 /* Look up the Linux PTE for the backing page */
234 pte_size = psize; 234 pte_size = psize;
235 pte = lookup_linux_pte(pgdir, hva, writing, &pte_size); 235 pte = lookup_linux_pte_and_update(pgdir, hva, writing,
236 &pte_size);
236 if (pte_present(pte)) { 237 if (pte_present(pte)) {
237 if (writing && !pte_write(pte)) 238 if (writing && !pte_write(pte))
238 /* make the actual HPTE be read-only */ 239 /* make the actual HPTE be read-only */
@@ -672,7 +673,8 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
672 memslot = __gfn_to_memslot(kvm_memslots(kvm), gfn); 673 memslot = __gfn_to_memslot(kvm_memslots(kvm), gfn);
673 if (memslot) { 674 if (memslot) {
674 hva = __gfn_to_hva_memslot(memslot, gfn); 675 hva = __gfn_to_hva_memslot(memslot, gfn);
675 pte = lookup_linux_pte(pgdir, hva, 1, &psize); 676 pte = lookup_linux_pte_and_update(pgdir, hva,
677 1, &psize);
676 if (pte_present(pte) && !pte_write(pte)) 678 if (pte_present(pte) && !pte_write(pte))
677 r = hpte_make_readonly(r); 679 r = hpte_make_readonly(r);
678 } 680 }
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index be4fa04a37c9..e66d4ec04d95 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -33,6 +33,10 @@
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/* Values in HSTATE_NAPPING(r13) */
37#define NAPPING_CEDE 1
38#define NAPPING_NOVCPU 2
39
36/* 40/*
37 * Call kvmppc_hv_entry in real mode. 41 * Call kvmppc_hv_entry in real mode.
38 * Must be called with interrupts hard-disabled. 42 * Must be called with interrupts hard-disabled.
@@ -57,29 +61,23 @@ _GLOBAL(kvmppc_hv_entry_trampoline)
57 RFI 61 RFI
58 62
59kvmppc_call_hv_entry: 63kvmppc_call_hv_entry:
64 ld r4, HSTATE_KVM_VCPU(r13)
60 bl kvmppc_hv_entry 65 bl kvmppc_hv_entry
61 66
62 /* Back from guest - restore host state and return to caller */ 67 /* Back from guest - restore host state and return to caller */
63 68
69BEGIN_FTR_SECTION
64 /* Restore host DABR and DABRX */ 70 /* Restore host DABR and DABRX */
65 ld r5,HSTATE_DABR(r13) 71 ld r5,HSTATE_DABR(r13)
66 li r6,7 72 li r6,7
67 mtspr SPRN_DABR,r5 73 mtspr SPRN_DABR,r5
68 mtspr SPRN_DABRX,r6 74 mtspr SPRN_DABRX,r6
75END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
69 76
70 /* Restore SPRG3 */ 77 /* Restore SPRG3 */
71 ld r3,PACA_SPRG3(r13) 78 ld r3,PACA_SPRG3(r13)
72 mtspr SPRN_SPRG3,r3 79 mtspr SPRN_SPRG3,r3
73 80
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 */ 81 /* Reload the host's PMU registers */
84 ld r3, PACALPPACAPTR(r13) /* is the host using the PMU? */ 82 ld r3, PACALPPACAPTR(r13) /* is the host using the PMU? */
85 lbz r4, LPPACA_PMCINUSE(r3) 83 lbz r4, LPPACA_PMCINUSE(r3)
@@ -115,6 +113,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
11523: 11323:
116 114
117 /* 115 /*
116 * Reload DEC. HDEC interrupts were disabled when
117 * we reloaded the host's LPCR value.
118 */
119 ld r3, HSTATE_DECEXP(r13)
120 mftb r4
121 subf r4, r4, r3
122 mtspr SPRN_DEC, r4
123
124 /*
118 * For external and machine check interrupts, we need 125 * For external and machine check interrupts, we need
119 * to call the Linux handler to process the interrupt. 126 * to call the Linux handler to process the interrupt.
120 * We do that by jumping to absolute address 0x500 for 127 * We do that by jumping to absolute address 0x500 for
@@ -153,15 +160,75 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
153 160
15413: b machine_check_fwnmi 16113: b machine_check_fwnmi
155 162
163kvmppc_primary_no_guest:
164 /* We handle this much like a ceded vcpu */
165 /* set our bit in napping_threads */
166 ld r5, HSTATE_KVM_VCORE(r13)
167 lbz r7, HSTATE_PTID(r13)
168 li r0, 1
169 sld r0, r0, r7
170 addi r6, r5, VCORE_NAPPING_THREADS
1711: lwarx r3, 0, r6
172 or r3, r3, r0
173 stwcx. r3, 0, r6
174 bne 1b
175 /* order napping_threads update vs testing entry_exit_count */
176 isync
177 li r12, 0
178 lwz r7, VCORE_ENTRY_EXIT(r5)
179 cmpwi r7, 0x100
180 bge kvm_novcpu_exit /* another thread already exiting */
181 li r3, NAPPING_NOVCPU
182 stb r3, HSTATE_NAPPING(r13)
183 li r3, 1
184 stb r3, HSTATE_HWTHREAD_REQ(r13)
185
186 b kvm_do_nap
187
188kvm_novcpu_wakeup:
189 ld r1, HSTATE_HOST_R1(r13)
190 ld r5, HSTATE_KVM_VCORE(r13)
191 li r0, 0
192 stb r0, HSTATE_NAPPING(r13)
193 stb r0, HSTATE_HWTHREAD_REQ(r13)
194
195 /* check the wake reason */
196 bl kvmppc_check_wake_reason
197
198 /* see if any other thread is already exiting */
199 lwz r0, VCORE_ENTRY_EXIT(r5)
200 cmpwi r0, 0x100
201 bge kvm_novcpu_exit
202
203 /* clear our bit in napping_threads */
204 lbz r7, HSTATE_PTID(r13)
205 li r0, 1
206 sld r0, r0, r7
207 addi r6, r5, VCORE_NAPPING_THREADS
2084: lwarx r7, 0, r6
209 andc r7, r7, r0
210 stwcx. r7, 0, r6
211 bne 4b
212
213 /* See if the wake reason means we need to exit */
214 cmpdi r3, 0
215 bge kvm_novcpu_exit
216
217 /* Got an IPI but other vcpus aren't yet exiting, must be a latecomer */
218 ld r4, HSTATE_KVM_VCPU(r13)
219 cmpdi r4, 0
220 bne kvmppc_got_guest
221
222kvm_novcpu_exit:
223 b hdec_soon
224
156/* 225/*
157 * We come in here when wakened from nap mode on a secondary hw thread. 226 * We come in here when wakened from nap mode.
158 * Relocation is off and most register values are lost. 227 * Relocation is off and most register values are lost.
159 * r13 points to the PACA. 228 * r13 points to the PACA.
160 */ 229 */
161 .globl kvm_start_guest 230 .globl kvm_start_guest
162kvm_start_guest: 231kvm_start_guest:
163 ld r1,PACAEMERGSP(r13)
164 subi r1,r1,STACK_FRAME_OVERHEAD
165 ld r2,PACATOC(r13) 232 ld r2,PACATOC(r13)
166 233
167 li r0,KVM_HWTHREAD_IN_KVM 234 li r0,KVM_HWTHREAD_IN_KVM
@@ -173,8 +240,13 @@ kvm_start_guest:
173 240
174 /* were we napping due to cede? */ 241 /* were we napping due to cede? */
175 lbz r0,HSTATE_NAPPING(r13) 242 lbz r0,HSTATE_NAPPING(r13)
176 cmpwi r0,0 243 cmpwi r0,NAPPING_CEDE
177 bne kvm_end_cede 244 beq kvm_end_cede
245 cmpwi r0,NAPPING_NOVCPU
246 beq kvm_novcpu_wakeup
247
248 ld r1,PACAEMERGSP(r13)
249 subi r1,r1,STACK_FRAME_OVERHEAD
178 250
179 /* 251 /*
180 * We weren't napping due to cede, so this must be a secondary 252 * We weren't napping due to cede, so this must be a secondary
@@ -184,40 +256,22 @@ kvm_start_guest:
184 */ 256 */
185 257
186 /* Check the wake reason in SRR1 to see why we got here */ 258 /* Check the wake reason in SRR1 to see why we got here */
187 mfspr r3,SPRN_SRR1 259 bl kvmppc_check_wake_reason
188 rlwinm r3,r3,44-31,0x7 /* extract wake reason field */ 260 cmpdi r3, 0
189 cmpwi r3,4 /* was it an external interrupt? */ 261 bge kvm_no_guest
190 bne 27f /* if not */
191 ld r5,HSTATE_XICS_PHYS(r13)
192 li r7,XICS_XIRR /* if it was an external interrupt, */
193 lwzcix r8,r5,r7 /* get and ack the interrupt */
194 sync
195 clrldi. r9,r8,40 /* get interrupt source ID. */
196 beq 28f /* none there? */
197 cmpwi r9,XICS_IPI /* was it an IPI? */
198 bne 29f
199 li r0,0xff
200 li r6,XICS_MFRR
201 stbcix r0,r5,r6 /* clear IPI */
202 stwcix r8,r5,r7 /* EOI the interrupt */
203 sync /* order loading of vcpu after that */
204 262
205 /* get vcpu pointer, NULL if we have no vcpu to run */ 263 /* get vcpu pointer, NULL if we have no vcpu to run */
206 ld r4,HSTATE_KVM_VCPU(r13) 264 ld r4,HSTATE_KVM_VCPU(r13)
207 cmpdi r4,0 265 cmpdi r4,0
208 /* if we have no vcpu to run, go back to sleep */ 266 /* if we have no vcpu to run, go back to sleep */
209 beq kvm_no_guest 267 beq kvm_no_guest
210 b 30f
211 268
21227: /* XXX should handle hypervisor maintenance interrupts etc. here */ 269 /* Set HSTATE_DSCR(r13) to something sensible */
213 b kvm_no_guest 270 LOAD_REG_ADDR(r6, dscr_default)
21428: /* SRR1 said external but ICP said nope?? */ 271 ld r6, 0(r6)
215 b kvm_no_guest 272 std r6, HSTATE_DSCR(r13)
21629: /* External non-IPI interrupt to offline secondary thread? help?? */
217 stw r8,HSTATE_SAVED_XIRR(r13)
218 b kvm_no_guest
219 273
22030: bl kvmppc_hv_entry 274 bl kvmppc_hv_entry
221 275
222 /* Back from the guest, go back to nap */ 276 /* Back from the guest, go back to nap */
223 /* Clear our vcpu pointer so we don't come back in early */ 277 /* Clear our vcpu pointer so we don't come back in early */
@@ -229,18 +283,6 @@ kvm_start_guest:
229 * visible we could be given another vcpu. 283 * visible we could be given another vcpu.
230 */ 284 */
231 lwsync 285 lwsync
232 /* Clear any pending IPI - we're an offline thread */
233 ld r5, HSTATE_XICS_PHYS(r13)
234 li r7, XICS_XIRR
235 lwzcix r3, r5, r7 /* ack any pending interrupt */
236 rlwinm. r0, r3, 0, 0xffffff /* any pending? */
237 beq 37f
238 sync
239 li r0, 0xff
240 li r6, XICS_MFRR
241 stbcix r0, r5, r6 /* clear the IPI */
242 stwcix r3, r5, r7 /* EOI it */
24337: sync
244 286
245 /* increment the nap count and then go to nap mode */ 287 /* increment the nap count and then go to nap mode */
246 ld r4, HSTATE_KVM_VCORE(r13) 288 ld r4, HSTATE_KVM_VCORE(r13)
@@ -253,6 +295,7 @@ kvm_start_guest:
253kvm_no_guest: 295kvm_no_guest:
254 li r0, KVM_HWTHREAD_IN_NAP 296 li r0, KVM_HWTHREAD_IN_NAP
255 stb r0, HSTATE_HWTHREAD_STATE(r13) 297 stb r0, HSTATE_HWTHREAD_STATE(r13)
298kvm_do_nap:
256 li r3, LPCR_PECE0 299 li r3, LPCR_PECE0
257 mfspr r4, SPRN_LPCR 300 mfspr r4, SPRN_LPCR
258 rlwimi r4, r3, 0, LPCR_PECE0 | LPCR_PECE1 301 rlwimi r4, r3, 0, LPCR_PECE0 | LPCR_PECE1
@@ -277,7 +320,7 @@ kvmppc_hv_entry:
277 320
278 /* Required state: 321 /* Required state:
279 * 322 *
280 * R4 = vcpu pointer 323 * R4 = vcpu pointer (or NULL)
281 * MSR = ~IR|DR 324 * MSR = ~IR|DR
282 * R13 = PACA 325 * R13 = PACA
283 * R1 = host R1 326 * R1 = host R1
@@ -287,122 +330,12 @@ kvmppc_hv_entry:
287 std r0, PPC_LR_STKOFF(r1) 330 std r0, PPC_LR_STKOFF(r1)
288 stdu r1, -112(r1) 331 stdu r1, -112(r1)
289 332
290 /* Set partition DABR */
291 /* Do this before re-enabling PMU to avoid P7 DABR corruption bug */
292 li r5,3
293 ld r6,VCPU_DABR(r4)
294 mtspr SPRN_DABRX,r5
295 mtspr SPRN_DABR,r6
296BEGIN_FTR_SECTION
297 isync
298END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
299
300 /* Load guest PMU registers */
301 /* R4 is live here (vcpu pointer) */
302 li r3, 1
303 sldi r3, r3, 31 /* MMCR0_FC (freeze counters) bit */
304 mtspr SPRN_MMCR0, r3 /* freeze all counters, disable ints */
305 isync
306 lwz r3, VCPU_PMC(r4) /* always load up guest PMU registers */
307 lwz r5, VCPU_PMC + 4(r4) /* to prevent information leak */
308 lwz r6, VCPU_PMC + 8(r4)
309 lwz r7, VCPU_PMC + 12(r4)
310 lwz r8, VCPU_PMC + 16(r4)
311 lwz r9, VCPU_PMC + 20(r4)
312BEGIN_FTR_SECTION
313 lwz r10, VCPU_PMC + 24(r4)
314 lwz r11, VCPU_PMC + 28(r4)
315END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
316 mtspr SPRN_PMC1, r3
317 mtspr SPRN_PMC2, r5
318 mtspr SPRN_PMC3, r6
319 mtspr SPRN_PMC4, r7
320 mtspr SPRN_PMC5, r8
321 mtspr SPRN_PMC6, r9
322BEGIN_FTR_SECTION
323 mtspr SPRN_PMC7, r10
324 mtspr SPRN_PMC8, r11
325END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
326 ld r3, VCPU_MMCR(r4)
327 ld r5, VCPU_MMCR + 8(r4)
328 ld r6, VCPU_MMCR + 16(r4)
329 ld r7, VCPU_SIAR(r4)
330 ld r8, VCPU_SDAR(r4)
331 mtspr SPRN_MMCR1, r5
332 mtspr SPRN_MMCRA, r6
333 mtspr SPRN_SIAR, r7
334 mtspr SPRN_SDAR, r8
335 mtspr SPRN_MMCR0, r3
336 isync
337
338 /* Load up FP, VMX and VSX registers */
339 bl kvmppc_load_fp
340
341 ld r14, VCPU_GPR(R14)(r4)
342 ld r15, VCPU_GPR(R15)(r4)
343 ld r16, VCPU_GPR(R16)(r4)
344 ld r17, VCPU_GPR(R17)(r4)
345 ld r18, VCPU_GPR(R18)(r4)
346 ld r19, VCPU_GPR(R19)(r4)
347 ld r20, VCPU_GPR(R20)(r4)
348 ld r21, VCPU_GPR(R21)(r4)
349 ld r22, VCPU_GPR(R22)(r4)
350 ld r23, VCPU_GPR(R23)(r4)
351 ld r24, VCPU_GPR(R24)(r4)
352 ld r25, VCPU_GPR(R25)(r4)
353 ld r26, VCPU_GPR(R26)(r4)
354 ld r27, VCPU_GPR(R27)(r4)
355 ld r28, VCPU_GPR(R28)(r4)
356 ld r29, VCPU_GPR(R29)(r4)
357 ld r30, VCPU_GPR(R30)(r4)
358 ld r31, VCPU_GPR(R31)(r4)
359
360BEGIN_FTR_SECTION
361 /* Switch DSCR to guest value */
362 ld r5, VCPU_DSCR(r4)
363 mtspr SPRN_DSCR, r5
364END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
365
366 /*
367 * Set the decrementer to the guest decrementer.
368 */
369 ld r8,VCPU_DEC_EXPIRES(r4)
370 mftb r7
371 subf r3,r7,r8
372 mtspr SPRN_DEC,r3
373 stw r3,VCPU_DEC(r4)
374
375 ld r5, VCPU_SPRG0(r4)
376 ld r6, VCPU_SPRG1(r4)
377 ld r7, VCPU_SPRG2(r4)
378 ld r8, VCPU_SPRG3(r4)
379 mtspr SPRN_SPRG0, r5
380 mtspr SPRN_SPRG1, r6
381 mtspr SPRN_SPRG2, r7
382 mtspr SPRN_SPRG3, r8
383
384 /* Save R1 in the PACA */ 333 /* Save R1 in the PACA */
385 std r1, HSTATE_HOST_R1(r13) 334 std r1, HSTATE_HOST_R1(r13)
386 335
387 /* Load up DAR and DSISR */
388 ld r5, VCPU_DAR(r4)
389 lwz r6, VCPU_DSISR(r4)
390 mtspr SPRN_DAR, r5
391 mtspr SPRN_DSISR, r6
392
393 li r6, KVM_GUEST_MODE_HOST_HV 336 li r6, KVM_GUEST_MODE_HOST_HV
394 stb r6, HSTATE_IN_GUEST(r13) 337 stb r6, HSTATE_IN_GUEST(r13)
395 338
396BEGIN_FTR_SECTION
397 /* Restore AMR and UAMOR, set AMOR to all 1s */
398 ld r5,VCPU_AMR(r4)
399 ld r6,VCPU_UAMOR(r4)
400 li r7,-1
401 mtspr SPRN_AMR,r5
402 mtspr SPRN_UAMOR,r6
403 mtspr SPRN_AMOR,r7
404END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
405
406 /* Clear out SLB */ 339 /* Clear out SLB */
407 li r6,0 340 li r6,0
408 slbmte r6,r6 341 slbmte r6,r6
@@ -428,8 +361,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
428 bne 21b 361 bne 21b
429 362
430 /* Primary thread switches to guest partition. */ 363 /* Primary thread switches to guest partition. */
431 ld r9,VCPU_KVM(r4) /* pointer to struct kvm */ 364 ld r9,VCORE_KVM(r5) /* pointer to struct kvm */
432 lwz r6,VCPU_PTID(r4) 365 lbz r6,HSTATE_PTID(r13)
433 cmpwi r6,0 366 cmpwi r6,0
434 bne 20f 367 bne 20f
435 ld r6,KVM_SDR1(r9) 368 ld r6,KVM_SDR1(r9)
@@ -457,7 +390,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
457 andc r7,r7,r0 390 andc r7,r7,r0
458 stdcx. r7,0,r6 391 stdcx. r7,0,r6
459 bne 23b 392 bne 23b
460 li r6,128 /* and flush the TLB */ 393 /* Flush the TLB of any entries for this LPID */
394 /* use arch 2.07S as a proxy for POWER8 */
395BEGIN_FTR_SECTION
396 li r6,512 /* POWER8 has 512 sets */
397FTR_SECTION_ELSE
398 li r6,128 /* POWER7 has 128 sets */
399ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_207S)
461 mtctr r6 400 mtctr r6
462 li r7,0x800 /* IS field = 0b10 */ 401 li r7,0x800 /* IS field = 0b10 */
463 ptesync 402 ptesync
@@ -487,6 +426,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
487 beq 38f 426 beq 38f
488 mtspr SPRN_PCR, r7 427 mtspr SPRN_PCR, r7
48938: 42838:
429
430BEGIN_FTR_SECTION
431 /* DPDES is shared between threads */
432 ld r8, VCORE_DPDES(r5)
433 mtspr SPRN_DPDES, r8
434END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
435
490 li r0,1 436 li r0,1
491 stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */ 437 stb r0,VCORE_IN_GUEST(r5) /* signal secondaries to continue */
492 b 10f 438 b 10f
@@ -503,32 +449,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
503 mtspr SPRN_RMOR,r8 449 mtspr SPRN_RMOR,r8
504 isync 450 isync
505 451
506 /* Increment yield count if they have a VPA */
507 ld r3, VCPU_VPA(r4)
508 cmpdi r3, 0
509 beq 25f
510 lwz r5, LPPACA_YIELDCOUNT(r3)
511 addi r5, r5, 1
512 stw r5, LPPACA_YIELDCOUNT(r3)
513 li r6, 1
514 stb r6, VCPU_VPA_DIRTY(r4)
51525:
516 /* Check if HDEC expires soon */ 452 /* Check if HDEC expires soon */
517 mfspr r3,SPRN_HDEC 453 mfspr r3,SPRN_HDEC
518 cmpwi r3,10 454 cmpwi r3,512 /* 1 microsecond */
519 li r12,BOOK3S_INTERRUPT_HV_DECREMENTER 455 li r12,BOOK3S_INTERRUPT_HV_DECREMENTER
520 mr r9,r4
521 blt hdec_soon 456 blt hdec_soon
522
523 /* Save purr/spurr */
524 mfspr r5,SPRN_PURR
525 mfspr r6,SPRN_SPURR
526 std r5,HSTATE_PURR(r13)
527 std r6,HSTATE_SPURR(r13)
528 ld r7,VCPU_PURR(r4)
529 ld r8,VCPU_SPURR(r4)
530 mtspr SPRN_PURR,r7
531 mtspr SPRN_SPURR,r8
532 b 31f 457 b 31f
533 458
534 /* 459 /*
@@ -539,7 +464,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
539 * We also have to invalidate the TLB since its 464 * We also have to invalidate the TLB since its
540 * entries aren't tagged with the LPID. 465 * entries aren't tagged with the LPID.
541 */ 466 */
54230: ld r9,VCPU_KVM(r4) /* pointer to struct kvm */ 46730: ld r5,HSTATE_KVM_VCORE(r13)
468 ld r9,VCORE_KVM(r5) /* pointer to struct kvm */
543 469
544 /* first take native_tlbie_lock */ 470 /* first take native_tlbie_lock */
545 .section ".toc","aw" 471 .section ".toc","aw"
@@ -604,7 +530,6 @@ toc_tlbie_lock:
604 mfspr r3,SPRN_HDEC 530 mfspr r3,SPRN_HDEC
605 cmpwi r3,10 531 cmpwi r3,10
606 li r12,BOOK3S_INTERRUPT_HV_DECREMENTER 532 li r12,BOOK3S_INTERRUPT_HV_DECREMENTER
607 mr r9,r4
608 blt hdec_soon 533 blt hdec_soon
609 534
610 /* Enable HDEC interrupts */ 535 /* Enable HDEC interrupts */
@@ -619,9 +544,14 @@ toc_tlbie_lock:
619 mfspr r0,SPRN_HID0 544 mfspr r0,SPRN_HID0
620 mfspr r0,SPRN_HID0 545 mfspr r0,SPRN_HID0
621 mfspr r0,SPRN_HID0 546 mfspr r0,SPRN_HID0
54731:
548 /* Do we have a guest vcpu to run? */
549 cmpdi r4, 0
550 beq kvmppc_primary_no_guest
551kvmppc_got_guest:
622 552
623 /* Load up guest SLB entries */ 553 /* Load up guest SLB entries */
62431: lwz r5,VCPU_SLB_MAX(r4) 554 lwz r5,VCPU_SLB_MAX(r4)
625 cmpwi r5,0 555 cmpwi r5,0
626 beq 9f 556 beq 9f
627 mtctr r5 557 mtctr r5
@@ -632,6 +562,209 @@ toc_tlbie_lock:
632 addi r6,r6,VCPU_SLB_SIZE 562 addi r6,r6,VCPU_SLB_SIZE
633 bdnz 1b 563 bdnz 1b
6349: 5649:
565 /* Increment yield count if they have a VPA */
566 ld r3, VCPU_VPA(r4)
567 cmpdi r3, 0
568 beq 25f
569 lwz r5, LPPACA_YIELDCOUNT(r3)
570 addi r5, r5, 1
571 stw r5, LPPACA_YIELDCOUNT(r3)
572 li r6, 1
573 stb r6, VCPU_VPA_DIRTY(r4)
57425:
575
576BEGIN_FTR_SECTION
577 /* Save purr/spurr */
578 mfspr r5,SPRN_PURR
579 mfspr r6,SPRN_SPURR
580 std r5,HSTATE_PURR(r13)
581 std r6,HSTATE_SPURR(r13)
582 ld r7,VCPU_PURR(r4)
583 ld r8,VCPU_SPURR(r4)
584 mtspr SPRN_PURR,r7
585 mtspr SPRN_SPURR,r8
586END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
587
588BEGIN_FTR_SECTION
589 /* Set partition DABR */
590 /* Do this before re-enabling PMU to avoid P7 DABR corruption bug */
591 lwz r5,VCPU_DABRX(r4)
592 ld r6,VCPU_DABR(r4)
593 mtspr SPRN_DABRX,r5
594 mtspr SPRN_DABR,r6
595 BEGIN_FTR_SECTION_NESTED(89)
596 isync
597 END_FTR_SECTION_NESTED(CPU_FTR_ARCH_206, CPU_FTR_ARCH_206, 89)
598END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
599
600 /* Load guest PMU registers */
601 /* R4 is live here (vcpu pointer) */
602 li r3, 1
603 sldi r3, r3, 31 /* MMCR0_FC (freeze counters) bit */
604 mtspr SPRN_MMCR0, r3 /* freeze all counters, disable ints */
605 isync
606 lwz r3, VCPU_PMC(r4) /* always load up guest PMU registers */
607 lwz r5, VCPU_PMC + 4(r4) /* to prevent information leak */
608 lwz r6, VCPU_PMC + 8(r4)
609 lwz r7, VCPU_PMC + 12(r4)
610 lwz r8, VCPU_PMC + 16(r4)
611 lwz r9, VCPU_PMC + 20(r4)
612BEGIN_FTR_SECTION
613 lwz r10, VCPU_PMC + 24(r4)
614 lwz r11, VCPU_PMC + 28(r4)
615END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
616 mtspr SPRN_PMC1, r3
617 mtspr SPRN_PMC2, r5
618 mtspr SPRN_PMC3, r6
619 mtspr SPRN_PMC4, r7
620 mtspr SPRN_PMC5, r8
621 mtspr SPRN_PMC6, r9
622BEGIN_FTR_SECTION
623 mtspr SPRN_PMC7, r10
624 mtspr SPRN_PMC8, r11
625END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
626 ld r3, VCPU_MMCR(r4)
627 ld r5, VCPU_MMCR + 8(r4)
628 ld r6, VCPU_MMCR + 16(r4)
629 ld r7, VCPU_SIAR(r4)
630 ld r8, VCPU_SDAR(r4)
631 mtspr SPRN_MMCR1, r5
632 mtspr SPRN_MMCRA, r6
633 mtspr SPRN_SIAR, r7
634 mtspr SPRN_SDAR, r8
635BEGIN_FTR_SECTION
636 ld r5, VCPU_MMCR + 24(r4)
637 ld r6, VCPU_SIER(r4)
638 lwz r7, VCPU_PMC + 24(r4)
639 lwz r8, VCPU_PMC + 28(r4)
640 ld r9, VCPU_MMCR + 32(r4)
641 mtspr SPRN_MMCR2, r5
642 mtspr SPRN_SIER, r6
643 mtspr SPRN_SPMC1, r7
644 mtspr SPRN_SPMC2, r8
645 mtspr SPRN_MMCRS, r9
646END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
647 mtspr SPRN_MMCR0, r3
648 isync
649
650 /* Load up FP, VMX and VSX registers */
651 bl kvmppc_load_fp
652
653 ld r14, VCPU_GPR(R14)(r4)
654 ld r15, VCPU_GPR(R15)(r4)
655 ld r16, VCPU_GPR(R16)(r4)
656 ld r17, VCPU_GPR(R17)(r4)
657 ld r18, VCPU_GPR(R18)(r4)
658 ld r19, VCPU_GPR(R19)(r4)
659 ld r20, VCPU_GPR(R20)(r4)
660 ld r21, VCPU_GPR(R21)(r4)
661 ld r22, VCPU_GPR(R22)(r4)
662 ld r23, VCPU_GPR(R23)(r4)
663 ld r24, VCPU_GPR(R24)(r4)
664 ld r25, VCPU_GPR(R25)(r4)
665 ld r26, VCPU_GPR(R26)(r4)
666 ld r27, VCPU_GPR(R27)(r4)
667 ld r28, VCPU_GPR(R28)(r4)
668 ld r29, VCPU_GPR(R29)(r4)
669 ld r30, VCPU_GPR(R30)(r4)
670 ld r31, VCPU_GPR(R31)(r4)
671
672BEGIN_FTR_SECTION
673 /* Switch DSCR to guest value */
674 ld r5, VCPU_DSCR(r4)
675 mtspr SPRN_DSCR, r5
676END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
677
678BEGIN_FTR_SECTION
679 /* Skip next section on POWER7 or PPC970 */
680 b 8f
681END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
682 /* Turn on TM so we can access TFHAR/TFIAR/TEXASR */
683 mfmsr r8
684 li r0, 1
685 rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG
686 mtmsrd r8
687
688 /* Load up POWER8-specific registers */
689 ld r5, VCPU_IAMR(r4)
690 lwz r6, VCPU_PSPB(r4)
691 ld r7, VCPU_FSCR(r4)
692 mtspr SPRN_IAMR, r5
693 mtspr SPRN_PSPB, r6
694 mtspr SPRN_FSCR, r7
695 ld r5, VCPU_DAWR(r4)
696 ld r6, VCPU_DAWRX(r4)
697 ld r7, VCPU_CIABR(r4)
698 ld r8, VCPU_TAR(r4)
699 mtspr SPRN_DAWR, r5
700 mtspr SPRN_DAWRX, r6
701 mtspr SPRN_CIABR, r7
702 mtspr SPRN_TAR, r8
703 ld r5, VCPU_IC(r4)
704 ld r6, VCPU_VTB(r4)
705 mtspr SPRN_IC, r5
706 mtspr SPRN_VTB, r6
707#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
708 ld r5, VCPU_TFHAR(r4)
709 ld r6, VCPU_TFIAR(r4)
710 ld r7, VCPU_TEXASR(r4)
711 mtspr SPRN_TFHAR, r5
712 mtspr SPRN_TFIAR, r6
713 mtspr SPRN_TEXASR, r7
714#endif
715 ld r8, VCPU_EBBHR(r4)
716 mtspr SPRN_EBBHR, r8
717 ld r5, VCPU_EBBRR(r4)
718 ld r6, VCPU_BESCR(r4)
719 ld r7, VCPU_CSIGR(r4)
720 ld r8, VCPU_TACR(r4)
721 mtspr SPRN_EBBRR, r5
722 mtspr SPRN_BESCR, r6
723 mtspr SPRN_CSIGR, r7
724 mtspr SPRN_TACR, r8
725 ld r5, VCPU_TCSCR(r4)
726 ld r6, VCPU_ACOP(r4)
727 lwz r7, VCPU_GUEST_PID(r4)
728 ld r8, VCPU_WORT(r4)
729 mtspr SPRN_TCSCR, r5
730 mtspr SPRN_ACOP, r6
731 mtspr SPRN_PID, r7
732 mtspr SPRN_WORT, r8
7338:
734
735 /*
736 * Set the decrementer to the guest decrementer.
737 */
738 ld r8,VCPU_DEC_EXPIRES(r4)
739 mftb r7
740 subf r3,r7,r8
741 mtspr SPRN_DEC,r3
742 stw r3,VCPU_DEC(r4)
743
744 ld r5, VCPU_SPRG0(r4)
745 ld r6, VCPU_SPRG1(r4)
746 ld r7, VCPU_SPRG2(r4)
747 ld r8, VCPU_SPRG3(r4)
748 mtspr SPRN_SPRG0, r5
749 mtspr SPRN_SPRG1, r6
750 mtspr SPRN_SPRG2, r7
751 mtspr SPRN_SPRG3, r8
752
753 /* Load up DAR and DSISR */
754 ld r5, VCPU_DAR(r4)
755 lwz r6, VCPU_DSISR(r4)
756 mtspr SPRN_DAR, r5
757 mtspr SPRN_DSISR, r6
758
759BEGIN_FTR_SECTION
760 /* Restore AMR and UAMOR, set AMOR to all 1s */
761 ld r5,VCPU_AMR(r4)
762 ld r6,VCPU_UAMOR(r4)
763 li r7,-1
764 mtspr SPRN_AMR,r5
765 mtspr SPRN_UAMOR,r6
766 mtspr SPRN_AMOR,r7
767END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
635 768
636 /* Restore state of CTRL run bit; assume 1 on entry */ 769 /* Restore state of CTRL run bit; assume 1 on entry */
637 lwz r5,VCPU_CTRL(r4) 770 lwz r5,VCPU_CTRL(r4)
@@ -647,48 +780,53 @@ toc_tlbie_lock:
647 mtctr r6 780 mtctr r6
648 mtxer r7 781 mtxer r7
649 782
783kvmppc_cede_reentry: /* r4 = vcpu, r13 = paca */
650 ld r10, VCPU_PC(r4) 784 ld r10, VCPU_PC(r4)
651 ld r11, VCPU_MSR(r4) 785 ld r11, VCPU_MSR(r4)
652kvmppc_cede_reentry: /* r4 = vcpu, r13 = paca */
653 ld r6, VCPU_SRR0(r4) 786 ld r6, VCPU_SRR0(r4)
654 ld r7, VCPU_SRR1(r4) 787 ld r7, VCPU_SRR1(r4)
788 mtspr SPRN_SRR0, r6
789 mtspr SPRN_SRR1, r7
655 790
791deliver_guest_interrupt:
656 /* r11 = vcpu->arch.msr & ~MSR_HV */ 792 /* r11 = vcpu->arch.msr & ~MSR_HV */
657 rldicl r11, r11, 63 - MSR_HV_LG, 1 793 rldicl r11, r11, 63 - MSR_HV_LG, 1
658 rotldi r11, r11, 1 + MSR_HV_LG 794 rotldi r11, r11, 1 + MSR_HV_LG
659 ori r11, r11, MSR_ME 795 ori r11, r11, MSR_ME
660 796
661 /* Check if we can deliver an external or decrementer interrupt now */ 797 /* Check if we can deliver an external or decrementer interrupt now */
662 ld r0,VCPU_PENDING_EXC(r4) 798 ld r0, VCPU_PENDING_EXC(r4)
663 lis r8,(1 << BOOK3S_IRQPRIO_EXTERNAL_LEVEL)@h 799 rldicl r0, r0, 64 - BOOK3S_IRQPRIO_EXTERNAL_LEVEL, 63
664 and r0,r0,r8 800 cmpdi cr1, r0, 0
665 cmpdi cr1,r0,0 801 andi. r8, r11, MSR_EE
666 andi. r0,r11,MSR_EE
667 beq cr1,11f
668BEGIN_FTR_SECTION 802BEGIN_FTR_SECTION
669 mfspr r8,SPRN_LPCR 803 mfspr r8, SPRN_LPCR
670 ori r8,r8,LPCR_MER 804 /* Insert EXTERNAL_LEVEL bit into LPCR at the MER bit position */
671 mtspr SPRN_LPCR,r8 805 rldimi r8, r0, LPCR_MER_SH, 63 - LPCR_MER_SH
806 mtspr SPRN_LPCR, r8
672 isync 807 isync
673END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 808END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
674 beq 5f 809 beq 5f
675 li r0,BOOK3S_INTERRUPT_EXTERNAL 810 li r0, BOOK3S_INTERRUPT_EXTERNAL
67612: mr r6,r10 811 bne cr1, 12f
677 mr r10,r0 812 mfspr r0, SPRN_DEC
678 mr r7,r11 813 cmpwi r0, 0
679 li r11,(MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */ 814 li r0, BOOK3S_INTERRUPT_DECREMENTER
680 rotldi r11,r11,63 815 bge 5f
681 b 5f
68211: beq 5f
683 mfspr r0,SPRN_DEC
684 cmpwi r0,0
685 li r0,BOOK3S_INTERRUPT_DECREMENTER
686 blt 12b
687 816
688 /* Move SRR0 and SRR1 into the respective regs */ 81712: mtspr SPRN_SRR0, r10
6895: mtspr SPRN_SRR0, r6 818 mr r10,r0
690 mtspr SPRN_SRR1, r7 819 mtspr SPRN_SRR1, r11
820 ld r11, VCPU_INTR_MSR(r4)
8215:
691 822
823/*
824 * Required state:
825 * R4 = vcpu
826 * R10: value for HSRR0
827 * R11: value for HSRR1
828 * R13 = PACA
829 */
692fast_guest_return: 830fast_guest_return:
693 li r0,0 831 li r0,0
694 stb r0,VCPU_CEDED(r4) /* cancel cede */ 832 stb r0,VCPU_CEDED(r4) /* cancel cede */
@@ -868,39 +1006,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
868 /* External interrupt, first check for host_ipi. If this is 1006 /* External interrupt, first check for host_ipi. If this is
869 * set, we know the host wants us out so let's do it now 1007 * set, we know the host wants us out so let's do it now
870 */ 1008 */
871do_ext_interrupt:
872 bl kvmppc_read_intr 1009 bl kvmppc_read_intr
873 cmpdi r3, 0 1010 cmpdi r3, 0
874 bgt ext_interrupt_to_host 1011 bgt ext_interrupt_to_host
875 1012
876 /* Allright, looks like an IPI for the guest, we need to set MER */
877 /* Check if any CPU is heading out to the host, if so head out too */ 1013 /* Check if any CPU is heading out to the host, if so head out too */
878 ld r5, HSTATE_KVM_VCORE(r13) 1014 ld r5, HSTATE_KVM_VCORE(r13)
879 lwz r0, VCORE_ENTRY_EXIT(r5) 1015 lwz r0, VCORE_ENTRY_EXIT(r5)
880 cmpwi r0, 0x100 1016 cmpwi r0, 0x100
881 bge ext_interrupt_to_host 1017 bge ext_interrupt_to_host
882 1018
883 /* See if there is a pending interrupt for the guest */ 1019 /* Return to guest after delivering any pending interrupt */
884 mfspr r8, SPRN_LPCR 1020 mr r4, r9
885 ld r0, VCPU_PENDING_EXC(r9) 1021 b deliver_guest_interrupt
886 /* Insert EXTERNAL_LEVEL bit into LPCR at the MER bit position */
887 rldicl. r0, r0, 64 - BOOK3S_IRQPRIO_EXTERNAL_LEVEL, 63
888 rldimi r8, r0, LPCR_MER_SH, 63 - LPCR_MER_SH
889 beq 2f
890
891 /* And if the guest EE is set, we can deliver immediately, else
892 * we return to the guest with MER set
893 */
894 andi. r0, r11, MSR_EE
895 beq 2f
896 mtspr SPRN_SRR0, r10
897 mtspr SPRN_SRR1, r11
898 li r10, BOOK3S_INTERRUPT_EXTERNAL
899 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */
900 rotldi r11, r11, 63
9012: mr r4, r9
902 mtspr SPRN_LPCR, r8
903 b fast_guest_return
904 1022
905ext_interrupt_to_host: 1023ext_interrupt_to_host:
906 1024
@@ -975,13 +1093,194 @@ BEGIN_FTR_SECTION
975 mtspr SPRN_SPURR,r4 1093 mtspr SPRN_SPURR,r4
976END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_201) 1094END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_201)
977 1095
1096 /* Save DEC */
1097 mfspr r5,SPRN_DEC
1098 mftb r6
1099 extsw r5,r5
1100 add r5,r5,r6
1101 std r5,VCPU_DEC_EXPIRES(r9)
1102
1103BEGIN_FTR_SECTION
1104 b 8f
1105END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
1106 /* Turn on TM so we can access TFHAR/TFIAR/TEXASR */
1107 mfmsr r8
1108 li r0, 1
1109 rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG
1110 mtmsrd r8
1111
1112 /* Save POWER8-specific registers */
1113 mfspr r5, SPRN_IAMR
1114 mfspr r6, SPRN_PSPB
1115 mfspr r7, SPRN_FSCR
1116 std r5, VCPU_IAMR(r9)
1117 stw r6, VCPU_PSPB(r9)
1118 std r7, VCPU_FSCR(r9)
1119 mfspr r5, SPRN_IC
1120 mfspr r6, SPRN_VTB
1121 mfspr r7, SPRN_TAR
1122 std r5, VCPU_IC(r9)
1123 std r6, VCPU_VTB(r9)
1124 std r7, VCPU_TAR(r9)
1125#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1126 mfspr r5, SPRN_TFHAR
1127 mfspr r6, SPRN_TFIAR
1128 mfspr r7, SPRN_TEXASR
1129 std r5, VCPU_TFHAR(r9)
1130 std r6, VCPU_TFIAR(r9)
1131 std r7, VCPU_TEXASR(r9)
1132#endif
1133 mfspr r8, SPRN_EBBHR
1134 std r8, VCPU_EBBHR(r9)
1135 mfspr r5, SPRN_EBBRR
1136 mfspr r6, SPRN_BESCR
1137 mfspr r7, SPRN_CSIGR
1138 mfspr r8, SPRN_TACR
1139 std r5, VCPU_EBBRR(r9)
1140 std r6, VCPU_BESCR(r9)
1141 std r7, VCPU_CSIGR(r9)
1142 std r8, VCPU_TACR(r9)
1143 mfspr r5, SPRN_TCSCR
1144 mfspr r6, SPRN_ACOP
1145 mfspr r7, SPRN_PID
1146 mfspr r8, SPRN_WORT
1147 std r5, VCPU_TCSCR(r9)
1148 std r6, VCPU_ACOP(r9)
1149 stw r7, VCPU_GUEST_PID(r9)
1150 std r8, VCPU_WORT(r9)
11518:
1152
1153 /* Save and reset AMR and UAMOR before turning on the MMU */
1154BEGIN_FTR_SECTION
1155 mfspr r5,SPRN_AMR
1156 mfspr r6,SPRN_UAMOR
1157 std r5,VCPU_AMR(r9)
1158 std r6,VCPU_UAMOR(r9)
1159 li r6,0
1160 mtspr SPRN_AMR,r6
1161END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1162
1163 /* Switch DSCR back to host value */
1164BEGIN_FTR_SECTION
1165 mfspr r8, SPRN_DSCR
1166 ld r7, HSTATE_DSCR(r13)
1167 std r8, VCPU_DSCR(r9)
1168 mtspr SPRN_DSCR, r7
1169END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1170
1171 /* Save non-volatile GPRs */
1172 std r14, VCPU_GPR(R14)(r9)
1173 std r15, VCPU_GPR(R15)(r9)
1174 std r16, VCPU_GPR(R16)(r9)
1175 std r17, VCPU_GPR(R17)(r9)
1176 std r18, VCPU_GPR(R18)(r9)
1177 std r19, VCPU_GPR(R19)(r9)
1178 std r20, VCPU_GPR(R20)(r9)
1179 std r21, VCPU_GPR(R21)(r9)
1180 std r22, VCPU_GPR(R22)(r9)
1181 std r23, VCPU_GPR(R23)(r9)
1182 std r24, VCPU_GPR(R24)(r9)
1183 std r25, VCPU_GPR(R25)(r9)
1184 std r26, VCPU_GPR(R26)(r9)
1185 std r27, VCPU_GPR(R27)(r9)
1186 std r28, VCPU_GPR(R28)(r9)
1187 std r29, VCPU_GPR(R29)(r9)
1188 std r30, VCPU_GPR(R30)(r9)
1189 std r31, VCPU_GPR(R31)(r9)
1190
1191 /* Save SPRGs */
1192 mfspr r3, SPRN_SPRG0
1193 mfspr r4, SPRN_SPRG1
1194 mfspr r5, SPRN_SPRG2
1195 mfspr r6, SPRN_SPRG3
1196 std r3, VCPU_SPRG0(r9)
1197 std r4, VCPU_SPRG1(r9)
1198 std r5, VCPU_SPRG2(r9)
1199 std r6, VCPU_SPRG3(r9)
1200
1201 /* save FP state */
1202 mr r3, r9
1203 bl kvmppc_save_fp
1204
1205 /* Increment yield count if they have a VPA */
1206 ld r8, VCPU_VPA(r9) /* do they have a VPA? */
1207 cmpdi r8, 0
1208 beq 25f
1209 lwz r3, LPPACA_YIELDCOUNT(r8)
1210 addi r3, r3, 1
1211 stw r3, LPPACA_YIELDCOUNT(r8)
1212 li r3, 1
1213 stb r3, VCPU_VPA_DIRTY(r9)
121425:
1215 /* Save PMU registers if requested */
1216 /* r8 and cr0.eq are live here */
1217 li r3, 1
1218 sldi r3, r3, 31 /* MMCR0_FC (freeze counters) bit */
1219 mfspr r4, SPRN_MMCR0 /* save MMCR0 */
1220 mtspr SPRN_MMCR0, r3 /* freeze all counters, disable ints */
1221 mfspr r6, SPRN_MMCRA
1222BEGIN_FTR_SECTION
1223 /* On P7, clear MMCRA in order to disable SDAR updates */
1224 li r7, 0
1225 mtspr SPRN_MMCRA, r7
1226END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1227 isync
1228 beq 21f /* if no VPA, save PMU stuff anyway */
1229 lbz r7, LPPACA_PMCINUSE(r8)
1230 cmpwi r7, 0 /* did they ask for PMU stuff to be saved? */
1231 bne 21f
1232 std r3, VCPU_MMCR(r9) /* if not, set saved MMCR0 to FC */
1233 b 22f
123421: mfspr r5, SPRN_MMCR1
1235 mfspr r7, SPRN_SIAR
1236 mfspr r8, SPRN_SDAR
1237 std r4, VCPU_MMCR(r9)
1238 std r5, VCPU_MMCR + 8(r9)
1239 std r6, VCPU_MMCR + 16(r9)
1240 std r7, VCPU_SIAR(r9)
1241 std r8, VCPU_SDAR(r9)
1242 mfspr r3, SPRN_PMC1
1243 mfspr r4, SPRN_PMC2
1244 mfspr r5, SPRN_PMC3
1245 mfspr r6, SPRN_PMC4
1246 mfspr r7, SPRN_PMC5
1247 mfspr r8, SPRN_PMC6
1248BEGIN_FTR_SECTION
1249 mfspr r10, SPRN_PMC7
1250 mfspr r11, SPRN_PMC8
1251END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1252 stw r3, VCPU_PMC(r9)
1253 stw r4, VCPU_PMC + 4(r9)
1254 stw r5, VCPU_PMC + 8(r9)
1255 stw r6, VCPU_PMC + 12(r9)
1256 stw r7, VCPU_PMC + 16(r9)
1257 stw r8, VCPU_PMC + 20(r9)
1258BEGIN_FTR_SECTION
1259 stw r10, VCPU_PMC + 24(r9)
1260 stw r11, VCPU_PMC + 28(r9)
1261END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1262BEGIN_FTR_SECTION
1263 mfspr r4, SPRN_MMCR2
1264 mfspr r5, SPRN_SIER
1265 mfspr r6, SPRN_SPMC1
1266 mfspr r7, SPRN_SPMC2
1267 mfspr r8, SPRN_MMCRS
1268 std r4, VCPU_MMCR + 24(r9)
1269 std r5, VCPU_SIER(r9)
1270 stw r6, VCPU_PMC + 24(r9)
1271 stw r7, VCPU_PMC + 28(r9)
1272 std r8, VCPU_MMCR + 32(r9)
1273 lis r4, 0x8000
1274 mtspr SPRN_MMCRS, r4
1275END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
127622:
978 /* Clear out SLB */ 1277 /* Clear out SLB */
979 li r5,0 1278 li r5,0
980 slbmte r5,r5 1279 slbmte r5,r5
981 slbia 1280 slbia
982 ptesync 1281 ptesync
983 1282
984hdec_soon: /* r9 = vcpu, r12 = trap, r13 = paca */ 1283hdec_soon: /* r12 = trap, r13 = paca */
985BEGIN_FTR_SECTION 1284BEGIN_FTR_SECTION
986 b 32f 1285 b 32f
987END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) 1286END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
@@ -1014,8 +1313,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1014 */ 1313 */
1015 cmpwi r3,0x100 /* Are we the first here? */ 1314 cmpwi r3,0x100 /* Are we the first here? */
1016 bge 43f 1315 bge 43f
1017 cmpwi r3,1 /* Are any other threads in the guest? */
1018 ble 43f
1019 cmpwi r12,BOOK3S_INTERRUPT_HV_DECREMENTER 1316 cmpwi r12,BOOK3S_INTERRUPT_HV_DECREMENTER
1020 beq 40f 1317 beq 40f
1021 li r0,0 1318 li r0,0
@@ -1026,7 +1323,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1026 * doesn't wake CPUs up from nap. 1323 * doesn't wake CPUs up from nap.
1027 */ 1324 */
1028 lwz r3,VCORE_NAPPING_THREADS(r5) 1325 lwz r3,VCORE_NAPPING_THREADS(r5)
1029 lwz r4,VCPU_PTID(r9) 1326 lbz r4,HSTATE_PTID(r13)
1030 li r0,1 1327 li r0,1
1031 sld r0,r0,r4 1328 sld r0,r0,r4
1032 andc. r3,r3,r0 /* no sense IPI'ing ourselves */ 1329 andc. r3,r3,r0 /* no sense IPI'ing ourselves */
@@ -1045,10 +1342,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1045 addi r6,r6,PACA_SIZE 1342 addi r6,r6,PACA_SIZE
1046 bne 42b 1343 bne 42b
1047 1344
1345secondary_too_late:
1048 /* Secondary threads wait for primary to do partition switch */ 1346 /* Secondary threads wait for primary to do partition switch */
104943: ld r4,VCPU_KVM(r9) /* pointer to struct kvm */ 134743: ld r5,HSTATE_KVM_VCORE(r13)
1050 ld r5,HSTATE_KVM_VCORE(r13) 1348 ld r4,VCORE_KVM(r5) /* pointer to struct kvm */
1051 lwz r3,VCPU_PTID(r9) 1349 lbz r3,HSTATE_PTID(r13)
1052 cmpwi r3,0 1350 cmpwi r3,0
1053 beq 15f 1351 beq 15f
1054 HMT_LOW 1352 HMT_LOW
@@ -1076,6 +1374,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1076 mtspr SPRN_LPID,r7 1374 mtspr SPRN_LPID,r7
1077 isync 1375 isync
1078 1376
1377BEGIN_FTR_SECTION
1378 /* DPDES is shared between threads */
1379 mfspr r7, SPRN_DPDES
1380 std r7, VCORE_DPDES(r5)
1381 /* clear DPDES so we don't get guest doorbells in the host */
1382 li r8, 0
1383 mtspr SPRN_DPDES, r8
1384END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
1385
1079 /* Subtract timebase offset from timebase */ 1386 /* Subtract timebase offset from timebase */
1080 ld r8,VCORE_TB_OFFSET(r5) 1387 ld r8,VCORE_TB_OFFSET(r5)
1081 cmpdi r8,0 1388 cmpdi r8,0
@@ -1113,7 +1420,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1113 * We have to lock against concurrent tlbies, and 1420 * We have to lock against concurrent tlbies, and
1114 * we have to flush the whole TLB. 1421 * we have to flush the whole TLB.
1115 */ 1422 */
111632: ld r4,VCPU_KVM(r9) /* pointer to struct kvm */ 142332: ld r5,HSTATE_KVM_VCORE(r13)
1424 ld r4,VCORE_KVM(r5) /* pointer to struct kvm */
1117 1425
1118 /* Take the guest's tlbie_lock */ 1426 /* Take the guest's tlbie_lock */
1119#ifdef __BIG_ENDIAN__ 1427#ifdef __BIG_ENDIAN__
@@ -1203,6 +1511,56 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1203 add r5,r5,r6 1511 add r5,r5,r6
1204 std r5,VCPU_DEC_EXPIRES(r9) 1512 std r5,VCPU_DEC_EXPIRES(r9)
1205 1513
1514BEGIN_FTR_SECTION
1515 b 8f
1516END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
1517 /* Turn on TM so we can access TFHAR/TFIAR/TEXASR */
1518 mfmsr r8
1519 li r0, 1
1520 rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG
1521 mtmsrd r8
1522
1523 /* Save POWER8-specific registers */
1524 mfspr r5, SPRN_IAMR
1525 mfspr r6, SPRN_PSPB
1526 mfspr r7, SPRN_FSCR
1527 std r5, VCPU_IAMR(r9)
1528 stw r6, VCPU_PSPB(r9)
1529 std r7, VCPU_FSCR(r9)
1530 mfspr r5, SPRN_IC
1531 mfspr r6, SPRN_VTB
1532 mfspr r7, SPRN_TAR
1533 std r5, VCPU_IC(r9)
1534 std r6, VCPU_VTB(r9)
1535 std r7, VCPU_TAR(r9)
1536#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1537 mfspr r5, SPRN_TFHAR
1538 mfspr r6, SPRN_TFIAR
1539 mfspr r7, SPRN_TEXASR
1540 std r5, VCPU_TFHAR(r9)
1541 std r6, VCPU_TFIAR(r9)
1542 std r7, VCPU_TEXASR(r9)
1543#endif
1544 mfspr r8, SPRN_EBBHR
1545 std r8, VCPU_EBBHR(r9)
1546 mfspr r5, SPRN_EBBRR
1547 mfspr r6, SPRN_BESCR
1548 mfspr r7, SPRN_CSIGR
1549 mfspr r8, SPRN_TACR
1550 std r5, VCPU_EBBRR(r9)
1551 std r6, VCPU_BESCR(r9)
1552 std r7, VCPU_CSIGR(r9)
1553 std r8, VCPU_TACR(r9)
1554 mfspr r5, SPRN_TCSCR
1555 mfspr r6, SPRN_ACOP
1556 mfspr r7, SPRN_PID
1557 mfspr r8, SPRN_WORT
1558 std r5, VCPU_TCSCR(r9)
1559 std r6, VCPU_ACOP(r9)
1560 stw r7, VCPU_GUEST_PID(r9)
1561 std r8, VCPU_WORT(r9)
15628:
1563
1206 /* Save and reset AMR and UAMOR before turning on the MMU */ 1564 /* Save and reset AMR and UAMOR before turning on the MMU */
1207BEGIN_FTR_SECTION 1565BEGIN_FTR_SECTION
1208 mfspr r5,SPRN_AMR 1566 mfspr r5,SPRN_AMR
@@ -1217,130 +1575,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1217 li r0, KVM_GUEST_MODE_NONE 1575 li r0, KVM_GUEST_MODE_NONE
1218 stb r0, HSTATE_IN_GUEST(r13) 1576 stb r0, HSTATE_IN_GUEST(r13)
1219 1577
1220 /* Switch DSCR back to host value */
1221BEGIN_FTR_SECTION
1222 mfspr r8, SPRN_DSCR
1223 ld r7, HSTATE_DSCR(r13)
1224 std r8, VCPU_DSCR(r9)
1225 mtspr SPRN_DSCR, r7
1226END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1227
1228 /* Save non-volatile GPRs */
1229 std r14, VCPU_GPR(R14)(r9)
1230 std r15, VCPU_GPR(R15)(r9)
1231 std r16, VCPU_GPR(R16)(r9)
1232 std r17, VCPU_GPR(R17)(r9)
1233 std r18, VCPU_GPR(R18)(r9)
1234 std r19, VCPU_GPR(R19)(r9)
1235 std r20, VCPU_GPR(R20)(r9)
1236 std r21, VCPU_GPR(R21)(r9)
1237 std r22, VCPU_GPR(R22)(r9)
1238 std r23, VCPU_GPR(R23)(r9)
1239 std r24, VCPU_GPR(R24)(r9)
1240 std r25, VCPU_GPR(R25)(r9)
1241 std r26, VCPU_GPR(R26)(r9)
1242 std r27, VCPU_GPR(R27)(r9)
1243 std r28, VCPU_GPR(R28)(r9)
1244 std r29, VCPU_GPR(R29)(r9)
1245 std r30, VCPU_GPR(R30)(r9)
1246 std r31, VCPU_GPR(R31)(r9)
1247
1248 /* Save SPRGs */
1249 mfspr r3, SPRN_SPRG0
1250 mfspr r4, SPRN_SPRG1
1251 mfspr r5, SPRN_SPRG2
1252 mfspr r6, SPRN_SPRG3
1253 std r3, VCPU_SPRG0(r9)
1254 std r4, VCPU_SPRG1(r9)
1255 std r5, VCPU_SPRG2(r9)
1256 std r6, VCPU_SPRG3(r9)
1257
1258 /* save FP state */
1259 mr r3, r9
1260 bl .kvmppc_save_fp
1261
1262 /* Increment yield count if they have a VPA */
1263 ld r8, VCPU_VPA(r9) /* do they have a VPA? */
1264 cmpdi r8, 0
1265 beq 25f
1266 lwz r3, LPPACA_YIELDCOUNT(r8)
1267 addi r3, r3, 1
1268 stw r3, LPPACA_YIELDCOUNT(r8)
1269 li r3, 1
1270 stb r3, VCPU_VPA_DIRTY(r9)
127125:
1272 /* Save PMU registers if requested */
1273 /* r8 and cr0.eq are live here */
1274 li r3, 1
1275 sldi r3, r3, 31 /* MMCR0_FC (freeze counters) bit */
1276 mfspr r4, SPRN_MMCR0 /* save MMCR0 */
1277 mtspr SPRN_MMCR0, r3 /* freeze all counters, disable ints */
1278 mfspr r6, SPRN_MMCRA
1279BEGIN_FTR_SECTION
1280 /* On P7, clear MMCRA in order to disable SDAR updates */
1281 li r7, 0
1282 mtspr SPRN_MMCRA, r7
1283END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1284 isync
1285 beq 21f /* if no VPA, save PMU stuff anyway */
1286 lbz r7, LPPACA_PMCINUSE(r8)
1287 cmpwi r7, 0 /* did they ask for PMU stuff to be saved? */
1288 bne 21f
1289 std r3, VCPU_MMCR(r9) /* if not, set saved MMCR0 to FC */
1290 b 22f
129121: mfspr r5, SPRN_MMCR1
1292 mfspr r7, SPRN_SIAR
1293 mfspr r8, SPRN_SDAR
1294 std r4, VCPU_MMCR(r9)
1295 std r5, VCPU_MMCR + 8(r9)
1296 std r6, VCPU_MMCR + 16(r9)
1297 std r7, VCPU_SIAR(r9)
1298 std r8, VCPU_SDAR(r9)
1299 mfspr r3, SPRN_PMC1
1300 mfspr r4, SPRN_PMC2
1301 mfspr r5, SPRN_PMC3
1302 mfspr r6, SPRN_PMC4
1303 mfspr r7, SPRN_PMC5
1304 mfspr r8, SPRN_PMC6
1305BEGIN_FTR_SECTION
1306 mfspr r10, SPRN_PMC7
1307 mfspr r11, SPRN_PMC8
1308END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1309 stw r3, VCPU_PMC(r9)
1310 stw r4, VCPU_PMC + 4(r9)
1311 stw r5, VCPU_PMC + 8(r9)
1312 stw r6, VCPU_PMC + 12(r9)
1313 stw r7, VCPU_PMC + 16(r9)
1314 stw r8, VCPU_PMC + 20(r9)
1315BEGIN_FTR_SECTION
1316 stw r10, VCPU_PMC + 24(r9)
1317 stw r11, VCPU_PMC + 28(r9)
1318END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
131922:
1320 ld r0, 112+PPC_LR_STKOFF(r1) 1578 ld r0, 112+PPC_LR_STKOFF(r1)
1321 addi r1, r1, 112 1579 addi r1, r1, 112
1322 mtlr r0 1580 mtlr r0
1323 blr 1581 blr
1324secondary_too_late:
1325 ld r5,HSTATE_KVM_VCORE(r13)
1326 HMT_LOW
132713: lbz r3,VCORE_IN_GUEST(r5)
1328 cmpwi r3,0
1329 bne 13b
1330 HMT_MEDIUM
1331 li r0, KVM_GUEST_MODE_NONE
1332 stb r0, HSTATE_IN_GUEST(r13)
1333 ld r11,PACA_SLBSHADOWPTR(r13)
1334
1335 .rept SLB_NUM_BOLTED
1336 ld r5,SLBSHADOW_SAVEAREA(r11)
1337 ld r6,SLBSHADOW_SAVEAREA+8(r11)
1338 andis. r7,r5,SLB_ESID_V@h
1339 beq 1f
1340 slbmte r6,r5
13411: addi r11,r11,16
1342 .endr
1343 b 22b
1344 1582
1345/* 1583/*
1346 * Check whether an HDSI is an HPTE not found fault or something else. 1584 * Check whether an HDSI is an HPTE not found fault or something else.
@@ -1386,8 +1624,7 @@ kvmppc_hdsi:
1386 mtspr SPRN_SRR0, r10 1624 mtspr SPRN_SRR0, r10
1387 mtspr SPRN_SRR1, r11 1625 mtspr SPRN_SRR1, r11
1388 li r10, BOOK3S_INTERRUPT_DATA_STORAGE 1626 li r10, BOOK3S_INTERRUPT_DATA_STORAGE
1389 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */ 1627 ld r11, VCPU_INTR_MSR(r9)
1390 rotldi r11, r11, 63
1391fast_interrupt_c_return: 1628fast_interrupt_c_return:
13926: ld r7, VCPU_CTR(r9) 16296: ld r7, VCPU_CTR(r9)
1393 lwz r8, VCPU_XER(r9) 1630 lwz r8, VCPU_XER(r9)
@@ -1456,8 +1693,7 @@ kvmppc_hisi:
14561: mtspr SPRN_SRR0, r10 16931: mtspr SPRN_SRR0, r10
1457 mtspr SPRN_SRR1, r11 1694 mtspr SPRN_SRR1, r11
1458 li r10, BOOK3S_INTERRUPT_INST_STORAGE 1695 li r10, BOOK3S_INTERRUPT_INST_STORAGE
1459 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */ 1696 ld r11, VCPU_INTR_MSR(r9)
1460 rotldi r11, r11, 63
1461 b fast_interrupt_c_return 1697 b fast_interrupt_c_return
1462 1698
14633: ld r6, VCPU_KVM(r9) /* not relocated, use VRMA */ 16993: ld r6, VCPU_KVM(r9) /* not relocated, use VRMA */
@@ -1474,7 +1710,8 @@ kvmppc_hisi:
1474hcall_try_real_mode: 1710hcall_try_real_mode:
1475 ld r3,VCPU_GPR(R3)(r9) 1711 ld r3,VCPU_GPR(R3)(r9)
1476 andi. r0,r11,MSR_PR 1712 andi. r0,r11,MSR_PR
1477 bne guest_exit_cont 1713 /* sc 1 from userspace - reflect to guest syscall */
1714 bne sc_1_fast_return
1478 clrrdi r3,r3,2 1715 clrrdi r3,r3,2
1479 cmpldi r3,hcall_real_table_end - hcall_real_table 1716 cmpldi r3,hcall_real_table_end - hcall_real_table
1480 bge guest_exit_cont 1717 bge guest_exit_cont
@@ -1495,6 +1732,14 @@ hcall_try_real_mode:
1495 ld r11,VCPU_MSR(r4) 1732 ld r11,VCPU_MSR(r4)
1496 b fast_guest_return 1733 b fast_guest_return
1497 1734
1735sc_1_fast_return:
1736 mtspr SPRN_SRR0,r10
1737 mtspr SPRN_SRR1,r11
1738 li r10, BOOK3S_INTERRUPT_SYSCALL
1739 ld r11, VCPU_INTR_MSR(r9)
1740 mr r4,r9
1741 b fast_guest_return
1742
1498 /* We've attempted a real mode hcall, but it's punted it back 1743 /* We've attempted a real mode hcall, but it's punted it back
1499 * to userspace. We need to restore some clobbered volatiles 1744 * to userspace. We need to restore some clobbered volatiles
1500 * before resuming the pass-it-to-qemu path */ 1745 * before resuming the pass-it-to-qemu path */
@@ -1588,14 +1833,34 @@ hcall_real_table:
1588 .long 0 /* 0x11c */ 1833 .long 0 /* 0x11c */
1589 .long 0 /* 0x120 */ 1834 .long 0 /* 0x120 */
1590 .long .kvmppc_h_bulk_remove - hcall_real_table 1835 .long .kvmppc_h_bulk_remove - hcall_real_table
1836 .long 0 /* 0x128 */
1837 .long 0 /* 0x12c */
1838 .long 0 /* 0x130 */
1839 .long .kvmppc_h_set_xdabr - hcall_real_table
1591hcall_real_table_end: 1840hcall_real_table_end:
1592 1841
1593ignore_hdec: 1842ignore_hdec:
1594 mr r4,r9 1843 mr r4,r9
1595 b fast_guest_return 1844 b fast_guest_return
1596 1845
1846_GLOBAL(kvmppc_h_set_xdabr)
1847 andi. r0, r5, DABRX_USER | DABRX_KERNEL
1848 beq 6f
1849 li r0, DABRX_USER | DABRX_KERNEL | DABRX_BTI
1850 andc. r0, r5, r0
1851 beq 3f
18526: li r3, H_PARAMETER
1853 blr
1854
1597_GLOBAL(kvmppc_h_set_dabr) 1855_GLOBAL(kvmppc_h_set_dabr)
1856 li r5, DABRX_USER | DABRX_KERNEL
18573:
1858BEGIN_FTR_SECTION
1859 b 2f
1860END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
1598 std r4,VCPU_DABR(r3) 1861 std r4,VCPU_DABR(r3)
1862 stw r5, VCPU_DABRX(r3)
1863 mtspr SPRN_DABRX, r5
1599 /* Work around P7 bug where DABR can get corrupted on mtspr */ 1864 /* Work around P7 bug where DABR can get corrupted on mtspr */
16001: mtspr SPRN_DABR,r4 18651: mtspr SPRN_DABR,r4
1601 mfspr r5, SPRN_DABR 1866 mfspr r5, SPRN_DABR
@@ -1605,6 +1870,17 @@ _GLOBAL(kvmppc_h_set_dabr)
1605 li r3,0 1870 li r3,0
1606 blr 1871 blr
1607 1872
1873 /* Emulate H_SET_DABR/X on P8 for the sake of compat mode guests */
18742: rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
1875 rlwimi r5, r4, 1, DAWRX_WT
1876 clrrdi r4, r4, 3
1877 std r4, VCPU_DAWR(r3)
1878 std r5, VCPU_DAWRX(r3)
1879 mtspr SPRN_DAWR, r4
1880 mtspr SPRN_DAWRX, r5
1881 li r3, 0
1882 blr
1883
1608_GLOBAL(kvmppc_h_cede) 1884_GLOBAL(kvmppc_h_cede)
1609 ori r11,r11,MSR_EE 1885 ori r11,r11,MSR_EE
1610 std r11,VCPU_MSR(r3) 1886 std r11,VCPU_MSR(r3)
@@ -1628,7 +1904,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1628 * up to the host. 1904 * up to the host.
1629 */ 1905 */
1630 ld r5,HSTATE_KVM_VCORE(r13) 1906 ld r5,HSTATE_KVM_VCORE(r13)
1631 lwz r6,VCPU_PTID(r3) 1907 lbz r6,HSTATE_PTID(r13)
1632 lwz r8,VCORE_ENTRY_EXIT(r5) 1908 lwz r8,VCORE_ENTRY_EXIT(r5)
1633 clrldi r8,r8,56 1909 clrldi r8,r8,56
1634 li r0,1 1910 li r0,1
@@ -1643,9 +1919,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1643 bne 31b 1919 bne 31b
1644 /* order napping_threads update vs testing entry_exit_count */ 1920 /* order napping_threads update vs testing entry_exit_count */
1645 isync 1921 isync
1646 li r0,1 1922 li r0,NAPPING_CEDE
1647 stb r0,HSTATE_NAPPING(r13) 1923 stb r0,HSTATE_NAPPING(r13)
1648 mr r4,r3
1649 lwz r7,VCORE_ENTRY_EXIT(r5) 1924 lwz r7,VCORE_ENTRY_EXIT(r5)
1650 cmpwi r7,0x100 1925 cmpwi r7,0x100
1651 bge 33f /* another thread already exiting */ 1926 bge 33f /* another thread already exiting */
@@ -1677,16 +1952,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1677 std r31, VCPU_GPR(R31)(r3) 1952 std r31, VCPU_GPR(R31)(r3)
1678 1953
1679 /* save FP state */ 1954 /* save FP state */
1680 bl .kvmppc_save_fp 1955 bl kvmppc_save_fp
1681 1956
1682 /* 1957 /*
1683 * Take a nap until a decrementer or external interrupt occurs, 1958 * Take a nap until a decrementer or external or doobell interrupt
1684 * with PECE1 (wake on decr) and PECE0 (wake on external) set in LPCR 1959 * occurs, with PECE1, PECE0 and PECEDP set in LPCR
1685 */ 1960 */
1686 li r0,1 1961 li r0,1
1687 stb r0,HSTATE_HWTHREAD_REQ(r13) 1962 stb r0,HSTATE_HWTHREAD_REQ(r13)
1688 mfspr r5,SPRN_LPCR 1963 mfspr r5,SPRN_LPCR
1689 ori r5,r5,LPCR_PECE0 | LPCR_PECE1 1964 ori r5,r5,LPCR_PECE0 | LPCR_PECE1
1965BEGIN_FTR_SECTION
1966 oris r5,r5,LPCR_PECEDP@h
1967END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
1690 mtspr SPRN_LPCR,r5 1968 mtspr SPRN_LPCR,r5
1691 isync 1969 isync
1692 li r0, 0 1970 li r0, 0
@@ -1698,6 +1976,11 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1698 nap 1976 nap
1699 b . 1977 b .
1700 1978
197933: mr r4, r3
1980 li r3, 0
1981 li r12, 0
1982 b 34f
1983
1701kvm_end_cede: 1984kvm_end_cede:
1702 /* get vcpu pointer */ 1985 /* get vcpu pointer */
1703 ld r4, HSTATE_KVM_VCPU(r13) 1986 ld r4, HSTATE_KVM_VCPU(r13)
@@ -1727,12 +2010,15 @@ kvm_end_cede:
1727 ld r29, VCPU_GPR(R29)(r4) 2010 ld r29, VCPU_GPR(R29)(r4)
1728 ld r30, VCPU_GPR(R30)(r4) 2011 ld r30, VCPU_GPR(R30)(r4)
1729 ld r31, VCPU_GPR(R31)(r4) 2012 ld r31, VCPU_GPR(R31)(r4)
2013
2014 /* Check the wake reason in SRR1 to see why we got here */
2015 bl kvmppc_check_wake_reason
1730 2016
1731 /* clear our bit in vcore->napping_threads */ 2017 /* clear our bit in vcore->napping_threads */
173233: ld r5,HSTATE_KVM_VCORE(r13) 201834: ld r5,HSTATE_KVM_VCORE(r13)
1733 lwz r3,VCPU_PTID(r4) 2019 lbz r7,HSTATE_PTID(r13)
1734 li r0,1 2020 li r0,1
1735 sld r0,r0,r3 2021 sld r0,r0,r7
1736 addi r6,r5,VCORE_NAPPING_THREADS 2022 addi r6,r5,VCORE_NAPPING_THREADS
173732: lwarx r7,0,r6 202332: lwarx r7,0,r6
1738 andc r7,r7,r0 2024 andc r7,r7,r0
@@ -1741,23 +2027,18 @@ kvm_end_cede:
1741 li r0,0 2027 li r0,0
1742 stb r0,HSTATE_NAPPING(r13) 2028 stb r0,HSTATE_NAPPING(r13)
1743 2029
1744 /* Check the wake reason in SRR1 to see why we got here */ 2030 /* See if the wake reason means we need to exit */
1745 mfspr r3, SPRN_SRR1 2031 stw r12, VCPU_TRAP(r4)
1746 rlwinm r3, r3, 44-31, 0x7 /* extract wake reason field */
1747 cmpwi r3, 4 /* was it an external interrupt? */
1748 li r12, BOOK3S_INTERRUPT_EXTERNAL
1749 mr r9, r4 2032 mr r9, r4
1750 ld r10, VCPU_PC(r9) 2033 cmpdi r3, 0
1751 ld r11, VCPU_MSR(r9) 2034 bgt guest_exit_cont
1752 beq do_ext_interrupt /* if so */
1753 2035
1754 /* see if any other thread is already exiting */ 2036 /* see if any other thread is already exiting */
1755 lwz r0,VCORE_ENTRY_EXIT(r5) 2037 lwz r0,VCORE_ENTRY_EXIT(r5)
1756 cmpwi r0,0x100 2038 cmpwi r0,0x100
1757 blt kvmppc_cede_reentry /* if not go back to guest */ 2039 bge guest_exit_cont
1758 2040
1759 /* some threads are exiting, so go to the guest exit path */ 2041 b kvmppc_cede_reentry /* if not go back to guest */
1760 b hcall_real_fallback
1761 2042
1762 /* cede when already previously prodded case */ 2043 /* cede when already previously prodded case */
1763kvm_cede_prodded: 2044kvm_cede_prodded:
@@ -1783,11 +2064,48 @@ machine_check_realmode:
1783 beq mc_cont 2064 beq mc_cont
1784 /* If not, deliver a machine check. SRR0/1 are already set */ 2065 /* If not, deliver a machine check. SRR0/1 are already set */
1785 li r10, BOOK3S_INTERRUPT_MACHINE_CHECK 2066 li r10, BOOK3S_INTERRUPT_MACHINE_CHECK
1786 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */ 2067 ld r11, VCPU_INTR_MSR(r9)
1787 rotldi r11, r11, 63
1788 b fast_interrupt_c_return 2068 b fast_interrupt_c_return
1789 2069
1790/* 2070/*
2071 * Check the reason we woke from nap, and take appropriate action.
2072 * Returns:
2073 * 0 if nothing needs to be done
2074 * 1 if something happened that needs to be handled by the host
2075 * -1 if there was a guest wakeup (IPI)
2076 *
2077 * Also sets r12 to the interrupt vector for any interrupt that needs
2078 * to be handled now by the host (0x500 for external interrupt), or zero.
2079 */
2080kvmppc_check_wake_reason:
2081 mfspr r6, SPRN_SRR1
2082BEGIN_FTR_SECTION
2083 rlwinm r6, r6, 45-31, 0xf /* extract wake reason field (P8) */
2084FTR_SECTION_ELSE
2085 rlwinm r6, r6, 45-31, 0xe /* P7 wake reason field is 3 bits */
2086ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_207S)
2087 cmpwi r6, 8 /* was it an external interrupt? */
2088 li r12, BOOK3S_INTERRUPT_EXTERNAL
2089 beq kvmppc_read_intr /* if so, see what it was */
2090 li r3, 0
2091 li r12, 0
2092 cmpwi r6, 6 /* was it the decrementer? */
2093 beq 0f
2094BEGIN_FTR_SECTION
2095 cmpwi r6, 5 /* privileged doorbell? */
2096 beq 0f
2097 cmpwi r6, 3 /* hypervisor doorbell? */
2098 beq 3f
2099END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
2100 li r3, 1 /* anything else, return 1 */
21010: blr
2102
2103 /* hypervisor doorbell */
21043: li r12, BOOK3S_INTERRUPT_H_DOORBELL
2105 li r3, 1
2106 blr
2107
2108/*
1791 * Determine what sort of external interrupt is pending (if any). 2109 * Determine what sort of external interrupt is pending (if any).
1792 * Returns: 2110 * Returns:
1793 * 0 if no interrupt is pending 2111 * 0 if no interrupt is pending
@@ -1818,7 +2136,6 @@ kvmppc_read_intr:
1818 * interrupts directly to the guest 2136 * interrupts directly to the guest
1819 */ 2137 */
1820 cmpwi r3, XICS_IPI /* if there is, is it an IPI? */ 2138 cmpwi r3, XICS_IPI /* if there is, is it an IPI? */
1821 li r3, 1
1822 bne 42f 2139 bne 42f
1823 2140
1824 /* It's an IPI, clear the MFRR and EOI it */ 2141 /* It's an IPI, clear the MFRR and EOI it */
@@ -1844,19 +2161,25 @@ kvmppc_read_intr:
1844 * before exit, it will be picked up by the host ICP driver 2161 * before exit, it will be picked up by the host ICP driver
1845 */ 2162 */
1846 stw r0, HSTATE_SAVED_XIRR(r13) 2163 stw r0, HSTATE_SAVED_XIRR(r13)
2164 li r3, 1
1847 b 1b 2165 b 1b
1848 2166
184943: /* We raced with the host, we need to resend that IPI, bummer */ 216743: /* We raced with the host, we need to resend that IPI, bummer */
1850 li r0, IPI_PRIORITY 2168 li r0, IPI_PRIORITY
1851 stbcix r0, r6, r8 /* set the IPI */ 2169 stbcix r0, r6, r8 /* set the IPI */
1852 sync 2170 sync
2171 li r3, 1
1853 b 1b 2172 b 1b
1854 2173
1855/* 2174/*
1856 * Save away FP, VMX and VSX registers. 2175 * Save away FP, VMX and VSX registers.
1857 * r3 = vcpu pointer 2176 * r3 = vcpu pointer
2177 * N.B. r30 and r31 are volatile across this function,
2178 * thus it is not callable from C.
1858 */ 2179 */
1859_GLOBAL(kvmppc_save_fp) 2180kvmppc_save_fp:
2181 mflr r30
2182 mr r31,r3
1860 mfmsr r5 2183 mfmsr r5
1861 ori r8,r5,MSR_FP 2184 ori r8,r5,MSR_FP
1862#ifdef CONFIG_ALTIVEC 2185#ifdef CONFIG_ALTIVEC
@@ -1871,42 +2194,17 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1871#endif 2194#endif
1872 mtmsrd r8 2195 mtmsrd r8
1873 isync 2196 isync
1874#ifdef CONFIG_VSX 2197 addi r3,r3,VCPU_FPRS
1875BEGIN_FTR_SECTION 2198 bl .store_fp_state
1876 reg = 0
1877 .rept 32
1878 li r6,reg*16+VCPU_VSRS
1879 STXVD2X(reg,R6,R3)
1880 reg = reg + 1
1881 .endr
1882FTR_SECTION_ELSE
1883#endif
1884 reg = 0
1885 .rept 32
1886 stfd reg,reg*8+VCPU_FPRS(r3)
1887 reg = reg + 1
1888 .endr
1889#ifdef CONFIG_VSX
1890ALT_FTR_SECTION_END_IFSET(CPU_FTR_VSX)
1891#endif
1892 mffs fr0
1893 stfd fr0,VCPU_FPSCR(r3)
1894
1895#ifdef CONFIG_ALTIVEC 2199#ifdef CONFIG_ALTIVEC
1896BEGIN_FTR_SECTION 2200BEGIN_FTR_SECTION
1897 reg = 0 2201 addi r3,r31,VCPU_VRS
1898 .rept 32 2202 bl .store_vr_state
1899 li r6,reg*16+VCPU_VRS
1900 stvx reg,r6,r3
1901 reg = reg + 1
1902 .endr
1903 mfvscr vr0
1904 li r6,VCPU_VSCR
1905 stvx vr0,r6,r3
1906END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2203END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1907#endif 2204#endif
1908 mfspr r6,SPRN_VRSAVE 2205 mfspr r6,SPRN_VRSAVE
1909 stw r6,VCPU_VRSAVE(r3) 2206 stw r6,VCPU_VRSAVE(r3)
2207 mtlr r30
1910 mtmsrd r5 2208 mtmsrd r5
1911 isync 2209 isync
1912 blr 2210 blr
@@ -1914,9 +2212,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1914/* 2212/*
1915 * Load up FP, VMX and VSX registers 2213 * Load up FP, VMX and VSX registers
1916 * r4 = vcpu pointer 2214 * r4 = vcpu pointer
2215 * N.B. r30 and r31 are volatile across this function,
2216 * thus it is not callable from C.
1917 */ 2217 */
1918 .globl kvmppc_load_fp
1919kvmppc_load_fp: 2218kvmppc_load_fp:
2219 mflr r30
2220 mr r31,r4
1920 mfmsr r9 2221 mfmsr r9
1921 ori r8,r9,MSR_FP 2222 ori r8,r9,MSR_FP
1922#ifdef CONFIG_ALTIVEC 2223#ifdef CONFIG_ALTIVEC
@@ -1931,42 +2232,18 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1931#endif 2232#endif
1932 mtmsrd r8 2233 mtmsrd r8
1933 isync 2234 isync
1934 lfd fr0,VCPU_FPSCR(r4) 2235 addi r3,r4,VCPU_FPRS
1935 MTFSF_L(fr0) 2236 bl .load_fp_state
1936#ifdef CONFIG_VSX
1937BEGIN_FTR_SECTION
1938 reg = 0
1939 .rept 32
1940 li r7,reg*16+VCPU_VSRS
1941 LXVD2X(reg,R7,R4)
1942 reg = reg + 1
1943 .endr
1944FTR_SECTION_ELSE
1945#endif
1946 reg = 0
1947 .rept 32
1948 lfd reg,reg*8+VCPU_FPRS(r4)
1949 reg = reg + 1
1950 .endr
1951#ifdef CONFIG_VSX
1952ALT_FTR_SECTION_END_IFSET(CPU_FTR_VSX)
1953#endif
1954
1955#ifdef CONFIG_ALTIVEC 2237#ifdef CONFIG_ALTIVEC
1956BEGIN_FTR_SECTION 2238BEGIN_FTR_SECTION
1957 li r7,VCPU_VSCR 2239 addi r3,r31,VCPU_VRS
1958 lvx vr0,r7,r4 2240 bl .load_vr_state
1959 mtvscr vr0
1960 reg = 0
1961 .rept 32
1962 li r7,reg*16+VCPU_VRS
1963 lvx reg,r7,r4
1964 reg = reg + 1
1965 .endr
1966END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2241END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1967#endif 2242#endif
1968 lwz r7,VCPU_VRSAVE(r4) 2243 lwz r7,VCPU_VRSAVE(r4)
1969 mtspr SPRN_VRSAVE,r7 2244 mtspr SPRN_VRSAVE,r7
2245 mtlr r30
2246 mr r4,r31
1970 blr 2247 blr
1971 2248
1972/* 2249/*
diff --git a/arch/powerpc/kvm/book3s_paired_singles.c b/arch/powerpc/kvm/book3s_paired_singles.c
index a59a25a13218..c1abd95063f4 100644
--- a/arch/powerpc/kvm/book3s_paired_singles.c
+++ b/arch/powerpc/kvm/book3s_paired_singles.c
@@ -160,7 +160,7 @@
160 160
161static inline void kvmppc_sync_qpr(struct kvm_vcpu *vcpu, int rt) 161static inline void kvmppc_sync_qpr(struct kvm_vcpu *vcpu, int rt)
162{ 162{
163 kvm_cvt_df(&vcpu->arch.fpr[rt], &vcpu->arch.qpr[rt]); 163 kvm_cvt_df(&VCPU_FPR(vcpu, rt), &vcpu->arch.qpr[rt]);
164} 164}
165 165
166static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store) 166static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store)
@@ -207,11 +207,11 @@ static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
207 /* put in registers */ 207 /* put in registers */
208 switch (ls_type) { 208 switch (ls_type) {
209 case FPU_LS_SINGLE: 209 case FPU_LS_SINGLE:
210 kvm_cvt_fd((u32*)tmp, &vcpu->arch.fpr[rs]); 210 kvm_cvt_fd((u32*)tmp, &VCPU_FPR(vcpu, rs));
211 vcpu->arch.qpr[rs] = *((u32*)tmp); 211 vcpu->arch.qpr[rs] = *((u32*)tmp);
212 break; 212 break;
213 case FPU_LS_DOUBLE: 213 case FPU_LS_DOUBLE:
214 vcpu->arch.fpr[rs] = *((u64*)tmp); 214 VCPU_FPR(vcpu, rs) = *((u64*)tmp);
215 break; 215 break;
216 } 216 }
217 217
@@ -233,18 +233,18 @@ static int kvmppc_emulate_fpr_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
233 233
234 switch (ls_type) { 234 switch (ls_type) {
235 case FPU_LS_SINGLE: 235 case FPU_LS_SINGLE:
236 kvm_cvt_df(&vcpu->arch.fpr[rs], (u32*)tmp); 236 kvm_cvt_df(&VCPU_FPR(vcpu, rs), (u32*)tmp);
237 val = *((u32*)tmp); 237 val = *((u32*)tmp);
238 len = sizeof(u32); 238 len = sizeof(u32);
239 break; 239 break;
240 case FPU_LS_SINGLE_LOW: 240 case FPU_LS_SINGLE_LOW:
241 *((u32*)tmp) = vcpu->arch.fpr[rs]; 241 *((u32*)tmp) = VCPU_FPR(vcpu, rs);
242 val = vcpu->arch.fpr[rs] & 0xffffffff; 242 val = VCPU_FPR(vcpu, rs) & 0xffffffff;
243 len = sizeof(u32); 243 len = sizeof(u32);
244 break; 244 break;
245 case FPU_LS_DOUBLE: 245 case FPU_LS_DOUBLE:
246 *((u64*)tmp) = vcpu->arch.fpr[rs]; 246 *((u64*)tmp) = VCPU_FPR(vcpu, rs);
247 val = vcpu->arch.fpr[rs]; 247 val = VCPU_FPR(vcpu, rs);
248 len = sizeof(u64); 248 len = sizeof(u64);
249 break; 249 break;
250 default: 250 default:
@@ -301,7 +301,7 @@ static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
301 emulated = EMULATE_DONE; 301 emulated = EMULATE_DONE;
302 302
303 /* put in registers */ 303 /* put in registers */
304 kvm_cvt_fd(&tmp[0], &vcpu->arch.fpr[rs]); 304 kvm_cvt_fd(&tmp[0], &VCPU_FPR(vcpu, rs));
305 vcpu->arch.qpr[rs] = tmp[1]; 305 vcpu->arch.qpr[rs] = tmp[1];
306 306
307 dprintk(KERN_INFO "KVM: PSQ_LD [0x%x, 0x%x] at 0x%lx (%d)\n", tmp[0], 307 dprintk(KERN_INFO "KVM: PSQ_LD [0x%x, 0x%x] at 0x%lx (%d)\n", tmp[0],
@@ -319,7 +319,7 @@ static int kvmppc_emulate_psq_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
319 u32 tmp[2]; 319 u32 tmp[2];
320 int len = w ? sizeof(u32) : sizeof(u64); 320 int len = w ? sizeof(u32) : sizeof(u64);
321 321
322 kvm_cvt_df(&vcpu->arch.fpr[rs], &tmp[0]); 322 kvm_cvt_df(&VCPU_FPR(vcpu, rs), &tmp[0]);
323 tmp[1] = vcpu->arch.qpr[rs]; 323 tmp[1] = vcpu->arch.qpr[rs];
324 324
325 r = kvmppc_st(vcpu, &addr, len, tmp, true); 325 r = kvmppc_st(vcpu, &addr, len, tmp, true);
@@ -512,7 +512,6 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
512 u32 *src2, u32 *src3)) 512 u32 *src2, u32 *src3))
513{ 513{
514 u32 *qpr = vcpu->arch.qpr; 514 u32 *qpr = vcpu->arch.qpr;
515 u64 *fpr = vcpu->arch.fpr;
516 u32 ps0_out; 515 u32 ps0_out;
517 u32 ps0_in1, ps0_in2, ps0_in3; 516 u32 ps0_in1, ps0_in2, ps0_in3;
518 u32 ps1_in1, ps1_in2, ps1_in3; 517 u32 ps1_in1, ps1_in2, ps1_in3;
@@ -521,20 +520,20 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
521 WARN_ON(rc); 520 WARN_ON(rc);
522 521
523 /* PS0 */ 522 /* PS0 */
524 kvm_cvt_df(&fpr[reg_in1], &ps0_in1); 523 kvm_cvt_df(&VCPU_FPR(vcpu, reg_in1), &ps0_in1);
525 kvm_cvt_df(&fpr[reg_in2], &ps0_in2); 524 kvm_cvt_df(&VCPU_FPR(vcpu, reg_in2), &ps0_in2);
526 kvm_cvt_df(&fpr[reg_in3], &ps0_in3); 525 kvm_cvt_df(&VCPU_FPR(vcpu, reg_in3), &ps0_in3);
527 526
528 if (scalar & SCALAR_LOW) 527 if (scalar & SCALAR_LOW)
529 ps0_in2 = qpr[reg_in2]; 528 ps0_in2 = qpr[reg_in2];
530 529
531 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in1, &ps0_in2, &ps0_in3); 530 func(&vcpu->arch.fp.fpscr, &ps0_out, &ps0_in1, &ps0_in2, &ps0_in3);
532 531
533 dprintk(KERN_INFO "PS3 ps0 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n", 532 dprintk(KERN_INFO "PS3 ps0 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n",
534 ps0_in1, ps0_in2, ps0_in3, ps0_out); 533 ps0_in1, ps0_in2, ps0_in3, ps0_out);
535 534
536 if (!(scalar & SCALAR_NO_PS0)) 535 if (!(scalar & SCALAR_NO_PS0))
537 kvm_cvt_fd(&ps0_out, &fpr[reg_out]); 536 kvm_cvt_fd(&ps0_out, &VCPU_FPR(vcpu, reg_out));
538 537
539 /* PS1 */ 538 /* PS1 */
540 ps1_in1 = qpr[reg_in1]; 539 ps1_in1 = qpr[reg_in1];
@@ -545,7 +544,7 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
545 ps1_in2 = ps0_in2; 544 ps1_in2 = ps0_in2;
546 545
547 if (!(scalar & SCALAR_NO_PS1)) 546 if (!(scalar & SCALAR_NO_PS1))
548 func(&vcpu->arch.fpscr, &qpr[reg_out], &ps1_in1, &ps1_in2, &ps1_in3); 547 func(&vcpu->arch.fp.fpscr, &qpr[reg_out], &ps1_in1, &ps1_in2, &ps1_in3);
549 548
550 dprintk(KERN_INFO "PS3 ps1 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n", 549 dprintk(KERN_INFO "PS3 ps1 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n",
551 ps1_in1, ps1_in2, ps1_in3, qpr[reg_out]); 550 ps1_in1, ps1_in2, ps1_in3, qpr[reg_out]);
@@ -561,7 +560,6 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
561 u32 *src2)) 560 u32 *src2))
562{ 561{
563 u32 *qpr = vcpu->arch.qpr; 562 u32 *qpr = vcpu->arch.qpr;
564 u64 *fpr = vcpu->arch.fpr;
565 u32 ps0_out; 563 u32 ps0_out;
566 u32 ps0_in1, ps0_in2; 564 u32 ps0_in1, ps0_in2;
567 u32 ps1_out; 565 u32 ps1_out;
@@ -571,20 +569,20 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
571 WARN_ON(rc); 569 WARN_ON(rc);
572 570
573 /* PS0 */ 571 /* PS0 */
574 kvm_cvt_df(&fpr[reg_in1], &ps0_in1); 572 kvm_cvt_df(&VCPU_FPR(vcpu, reg_in1), &ps0_in1);
575 573
576 if (scalar & SCALAR_LOW) 574 if (scalar & SCALAR_LOW)
577 ps0_in2 = qpr[reg_in2]; 575 ps0_in2 = qpr[reg_in2];
578 else 576 else
579 kvm_cvt_df(&fpr[reg_in2], &ps0_in2); 577 kvm_cvt_df(&VCPU_FPR(vcpu, reg_in2), &ps0_in2);
580 578
581 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in1, &ps0_in2); 579 func(&vcpu->arch.fp.fpscr, &ps0_out, &ps0_in1, &ps0_in2);
582 580
583 if (!(scalar & SCALAR_NO_PS0)) { 581 if (!(scalar & SCALAR_NO_PS0)) {
584 dprintk(KERN_INFO "PS2 ps0 -> f(0x%x, 0x%x) = 0x%x\n", 582 dprintk(KERN_INFO "PS2 ps0 -> f(0x%x, 0x%x) = 0x%x\n",
585 ps0_in1, ps0_in2, ps0_out); 583 ps0_in1, ps0_in2, ps0_out);
586 584
587 kvm_cvt_fd(&ps0_out, &fpr[reg_out]); 585 kvm_cvt_fd(&ps0_out, &VCPU_FPR(vcpu, reg_out));
588 } 586 }
589 587
590 /* PS1 */ 588 /* PS1 */
@@ -594,7 +592,7 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
594 if (scalar & SCALAR_HIGH) 592 if (scalar & SCALAR_HIGH)
595 ps1_in2 = ps0_in2; 593 ps1_in2 = ps0_in2;
596 594
597 func(&vcpu->arch.fpscr, &ps1_out, &ps1_in1, &ps1_in2); 595 func(&vcpu->arch.fp.fpscr, &ps1_out, &ps1_in1, &ps1_in2);
598 596
599 if (!(scalar & SCALAR_NO_PS1)) { 597 if (!(scalar & SCALAR_NO_PS1)) {
600 qpr[reg_out] = ps1_out; 598 qpr[reg_out] = ps1_out;
@@ -612,7 +610,6 @@ static int kvmppc_ps_one_in(struct kvm_vcpu *vcpu, bool rc,
612 u32 *dst, u32 *src1)) 610 u32 *dst, u32 *src1))
613{ 611{
614 u32 *qpr = vcpu->arch.qpr; 612 u32 *qpr = vcpu->arch.qpr;
615 u64 *fpr = vcpu->arch.fpr;
616 u32 ps0_out, ps0_in; 613 u32 ps0_out, ps0_in;
617 u32 ps1_in; 614 u32 ps1_in;
618 615
@@ -620,17 +617,17 @@ static int kvmppc_ps_one_in(struct kvm_vcpu *vcpu, bool rc,
620 WARN_ON(rc); 617 WARN_ON(rc);
621 618
622 /* PS0 */ 619 /* PS0 */
623 kvm_cvt_df(&fpr[reg_in], &ps0_in); 620 kvm_cvt_df(&VCPU_FPR(vcpu, reg_in), &ps0_in);
624 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in); 621 func(&vcpu->arch.fp.fpscr, &ps0_out, &ps0_in);
625 622
626 dprintk(KERN_INFO "PS1 ps0 -> f(0x%x) = 0x%x\n", 623 dprintk(KERN_INFO "PS1 ps0 -> f(0x%x) = 0x%x\n",
627 ps0_in, ps0_out); 624 ps0_in, ps0_out);
628 625
629 kvm_cvt_fd(&ps0_out, &fpr[reg_out]); 626 kvm_cvt_fd(&ps0_out, &VCPU_FPR(vcpu, reg_out));
630 627
631 /* PS1 */ 628 /* PS1 */
632 ps1_in = qpr[reg_in]; 629 ps1_in = qpr[reg_in];
633 func(&vcpu->arch.fpscr, &qpr[reg_out], &ps1_in); 630 func(&vcpu->arch.fp.fpscr, &qpr[reg_out], &ps1_in);
634 631
635 dprintk(KERN_INFO "PS1 ps1 -> f(0x%x) = 0x%x\n", 632 dprintk(KERN_INFO "PS1 ps1 -> f(0x%x) = 0x%x\n",
636 ps1_in, qpr[reg_out]); 633 ps1_in, qpr[reg_out]);
@@ -649,10 +646,10 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
649 int ax_rc = inst_get_field(inst, 21, 25); 646 int ax_rc = inst_get_field(inst, 21, 25);
650 short full_d = inst_get_field(inst, 16, 31); 647 short full_d = inst_get_field(inst, 16, 31);
651 648
652 u64 *fpr_d = &vcpu->arch.fpr[ax_rd]; 649 u64 *fpr_d = &VCPU_FPR(vcpu, ax_rd);
653 u64 *fpr_a = &vcpu->arch.fpr[ax_ra]; 650 u64 *fpr_a = &VCPU_FPR(vcpu, ax_ra);
654 u64 *fpr_b = &vcpu->arch.fpr[ax_rb]; 651 u64 *fpr_b = &VCPU_FPR(vcpu, ax_rb);
655 u64 *fpr_c = &vcpu->arch.fpr[ax_rc]; 652 u64 *fpr_c = &VCPU_FPR(vcpu, ax_rc);
656 653
657 bool rcomp = (inst & 1) ? true : false; 654 bool rcomp = (inst & 1) ? true : false;
658 u32 cr = kvmppc_get_cr(vcpu); 655 u32 cr = kvmppc_get_cr(vcpu);
@@ -674,11 +671,11 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
674 /* Do we need to clear FE0 / FE1 here? Don't think so. */ 671 /* Do we need to clear FE0 / FE1 here? Don't think so. */
675 672
676#ifdef DEBUG 673#ifdef DEBUG
677 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) { 674 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fp.fpr); i++) {
678 u32 f; 675 u32 f;
679 kvm_cvt_df(&vcpu->arch.fpr[i], &f); 676 kvm_cvt_df(&VCPU_FPR(vcpu, i), &f);
680 dprintk(KERN_INFO "FPR[%d] = 0x%x / 0x%llx QPR[%d] = 0x%x\n", 677 dprintk(KERN_INFO "FPR[%d] = 0x%x / 0x%llx QPR[%d] = 0x%x\n",
681 i, f, vcpu->arch.fpr[i], i, vcpu->arch.qpr[i]); 678 i, f, VCPU_FPR(vcpu, i), i, vcpu->arch.qpr[i]);
682 } 679 }
683#endif 680#endif
684 681
@@ -764,8 +761,8 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
764 break; 761 break;
765 } 762 }
766 case OP_4X_PS_NEG: 763 case OP_4X_PS_NEG:
767 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_rb]; 764 VCPU_FPR(vcpu, ax_rd) = VCPU_FPR(vcpu, ax_rb);
768 vcpu->arch.fpr[ax_rd] ^= 0x8000000000000000ULL; 765 VCPU_FPR(vcpu, ax_rd) ^= 0x8000000000000000ULL;
769 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 766 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
770 vcpu->arch.qpr[ax_rd] ^= 0x80000000; 767 vcpu->arch.qpr[ax_rd] ^= 0x80000000;
771 break; 768 break;
@@ -775,7 +772,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
775 break; 772 break;
776 case OP_4X_PS_MR: 773 case OP_4X_PS_MR:
777 WARN_ON(rcomp); 774 WARN_ON(rcomp);
778 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_rb]; 775 VCPU_FPR(vcpu, ax_rd) = VCPU_FPR(vcpu, ax_rb);
779 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 776 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
780 break; 777 break;
781 case OP_4X_PS_CMPO1: 778 case OP_4X_PS_CMPO1:
@@ -784,44 +781,44 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
784 break; 781 break;
785 case OP_4X_PS_NABS: 782 case OP_4X_PS_NABS:
786 WARN_ON(rcomp); 783 WARN_ON(rcomp);
787 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_rb]; 784 VCPU_FPR(vcpu, ax_rd) = VCPU_FPR(vcpu, ax_rb);
788 vcpu->arch.fpr[ax_rd] |= 0x8000000000000000ULL; 785 VCPU_FPR(vcpu, ax_rd) |= 0x8000000000000000ULL;
789 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 786 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
790 vcpu->arch.qpr[ax_rd] |= 0x80000000; 787 vcpu->arch.qpr[ax_rd] |= 0x80000000;
791 break; 788 break;
792 case OP_4X_PS_ABS: 789 case OP_4X_PS_ABS:
793 WARN_ON(rcomp); 790 WARN_ON(rcomp);
794 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_rb]; 791 VCPU_FPR(vcpu, ax_rd) = VCPU_FPR(vcpu, ax_rb);
795 vcpu->arch.fpr[ax_rd] &= ~0x8000000000000000ULL; 792 VCPU_FPR(vcpu, ax_rd) &= ~0x8000000000000000ULL;
796 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 793 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
797 vcpu->arch.qpr[ax_rd] &= ~0x80000000; 794 vcpu->arch.qpr[ax_rd] &= ~0x80000000;
798 break; 795 break;
799 case OP_4X_PS_MERGE00: 796 case OP_4X_PS_MERGE00:
800 WARN_ON(rcomp); 797 WARN_ON(rcomp);
801 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_ra]; 798 VCPU_FPR(vcpu, ax_rd) = VCPU_FPR(vcpu, ax_ra);
802 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */ 799 /* vcpu->arch.qpr[ax_rd] = VCPU_FPR(vcpu, ax_rb); */
803 kvm_cvt_df(&vcpu->arch.fpr[ax_rb], 800 kvm_cvt_df(&VCPU_FPR(vcpu, ax_rb),
804 &vcpu->arch.qpr[ax_rd]); 801 &vcpu->arch.qpr[ax_rd]);
805 break; 802 break;
806 case OP_4X_PS_MERGE01: 803 case OP_4X_PS_MERGE01:
807 WARN_ON(rcomp); 804 WARN_ON(rcomp);
808 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_ra]; 805 VCPU_FPR(vcpu, ax_rd) = VCPU_FPR(vcpu, ax_ra);
809 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 806 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
810 break; 807 break;
811 case OP_4X_PS_MERGE10: 808 case OP_4X_PS_MERGE10:
812 WARN_ON(rcomp); 809 WARN_ON(rcomp);
813 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */ 810 /* VCPU_FPR(vcpu, ax_rd) = vcpu->arch.qpr[ax_ra]; */
814 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra], 811 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra],
815 &vcpu->arch.fpr[ax_rd]); 812 &VCPU_FPR(vcpu, ax_rd));
816 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */ 813 /* vcpu->arch.qpr[ax_rd] = VCPU_FPR(vcpu, ax_rb); */
817 kvm_cvt_df(&vcpu->arch.fpr[ax_rb], 814 kvm_cvt_df(&VCPU_FPR(vcpu, ax_rb),
818 &vcpu->arch.qpr[ax_rd]); 815 &vcpu->arch.qpr[ax_rd]);
819 break; 816 break;
820 case OP_4X_PS_MERGE11: 817 case OP_4X_PS_MERGE11:
821 WARN_ON(rcomp); 818 WARN_ON(rcomp);
822 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */ 819 /* VCPU_FPR(vcpu, ax_rd) = vcpu->arch.qpr[ax_ra]; */
823 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra], 820 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra],
824 &vcpu->arch.fpr[ax_rd]); 821 &VCPU_FPR(vcpu, ax_rd));
825 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 822 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
826 break; 823 break;
827 } 824 }
@@ -856,7 +853,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
856 case OP_4A_PS_SUM1: 853 case OP_4A_PS_SUM1:
857 emulated = kvmppc_ps_two_in(vcpu, rcomp, ax_rd, 854 emulated = kvmppc_ps_two_in(vcpu, rcomp, ax_rd,
858 ax_rb, ax_ra, SCALAR_NO_PS0 | SCALAR_HIGH, fps_fadds); 855 ax_rb, ax_ra, SCALAR_NO_PS0 | SCALAR_HIGH, fps_fadds);
859 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_rc]; 856 VCPU_FPR(vcpu, ax_rd) = VCPU_FPR(vcpu, ax_rc);
860 break; 857 break;
861 case OP_4A_PS_SUM0: 858 case OP_4A_PS_SUM0:
862 emulated = kvmppc_ps_two_in(vcpu, rcomp, ax_rd, 859 emulated = kvmppc_ps_two_in(vcpu, rcomp, ax_rd,
@@ -1106,45 +1103,45 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
1106 case 59: 1103 case 59:
1107 switch (inst_get_field(inst, 21, 30)) { 1104 switch (inst_get_field(inst, 21, 30)) {
1108 case OP_59_FADDS: 1105 case OP_59_FADDS:
1109 fpd_fadds(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_b); 1106 fpd_fadds(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_b);
1110 kvmppc_sync_qpr(vcpu, ax_rd); 1107 kvmppc_sync_qpr(vcpu, ax_rd);
1111 break; 1108 break;
1112 case OP_59_FSUBS: 1109 case OP_59_FSUBS:
1113 fpd_fsubs(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_b); 1110 fpd_fsubs(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_b);
1114 kvmppc_sync_qpr(vcpu, ax_rd); 1111 kvmppc_sync_qpr(vcpu, ax_rd);
1115 break; 1112 break;
1116 case OP_59_FDIVS: 1113 case OP_59_FDIVS:
1117 fpd_fdivs(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_b); 1114 fpd_fdivs(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_b);
1118 kvmppc_sync_qpr(vcpu, ax_rd); 1115 kvmppc_sync_qpr(vcpu, ax_rd);
1119 break; 1116 break;
1120 case OP_59_FRES: 1117 case OP_59_FRES:
1121 fpd_fres(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1118 fpd_fres(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1122 kvmppc_sync_qpr(vcpu, ax_rd); 1119 kvmppc_sync_qpr(vcpu, ax_rd);
1123 break; 1120 break;
1124 case OP_59_FRSQRTES: 1121 case OP_59_FRSQRTES:
1125 fpd_frsqrtes(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1122 fpd_frsqrtes(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1126 kvmppc_sync_qpr(vcpu, ax_rd); 1123 kvmppc_sync_qpr(vcpu, ax_rd);
1127 break; 1124 break;
1128 } 1125 }
1129 switch (inst_get_field(inst, 26, 30)) { 1126 switch (inst_get_field(inst, 26, 30)) {
1130 case OP_59_FMULS: 1127 case OP_59_FMULS:
1131 fpd_fmuls(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c); 1128 fpd_fmuls(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c);
1132 kvmppc_sync_qpr(vcpu, ax_rd); 1129 kvmppc_sync_qpr(vcpu, ax_rd);
1133 break; 1130 break;
1134 case OP_59_FMSUBS: 1131 case OP_59_FMSUBS:
1135 fpd_fmsubs(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1132 fpd_fmsubs(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1136 kvmppc_sync_qpr(vcpu, ax_rd); 1133 kvmppc_sync_qpr(vcpu, ax_rd);
1137 break; 1134 break;
1138 case OP_59_FMADDS: 1135 case OP_59_FMADDS:
1139 fpd_fmadds(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1136 fpd_fmadds(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1140 kvmppc_sync_qpr(vcpu, ax_rd); 1137 kvmppc_sync_qpr(vcpu, ax_rd);
1141 break; 1138 break;
1142 case OP_59_FNMSUBS: 1139 case OP_59_FNMSUBS:
1143 fpd_fnmsubs(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1140 fpd_fnmsubs(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1144 kvmppc_sync_qpr(vcpu, ax_rd); 1141 kvmppc_sync_qpr(vcpu, ax_rd);
1145 break; 1142 break;
1146 case OP_59_FNMADDS: 1143 case OP_59_FNMADDS:
1147 fpd_fnmadds(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1144 fpd_fnmadds(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1148 kvmppc_sync_qpr(vcpu, ax_rd); 1145 kvmppc_sync_qpr(vcpu, ax_rd);
1149 break; 1146 break;
1150 } 1147 }
@@ -1159,12 +1156,12 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
1159 break; 1156 break;
1160 case OP_63_MFFS: 1157 case OP_63_MFFS:
1161 /* XXX missing CR */ 1158 /* XXX missing CR */
1162 *fpr_d = vcpu->arch.fpscr; 1159 *fpr_d = vcpu->arch.fp.fpscr;
1163 break; 1160 break;
1164 case OP_63_MTFSF: 1161 case OP_63_MTFSF:
1165 /* XXX missing fm bits */ 1162 /* XXX missing fm bits */
1166 /* XXX missing CR */ 1163 /* XXX missing CR */
1167 vcpu->arch.fpscr = *fpr_b; 1164 vcpu->arch.fp.fpscr = *fpr_b;
1168 break; 1165 break;
1169 case OP_63_FCMPU: 1166 case OP_63_FCMPU:
1170 { 1167 {
@@ -1172,7 +1169,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
1172 u32 cr0_mask = 0xf0000000; 1169 u32 cr0_mask = 0xf0000000;
1173 u32 cr_shift = inst_get_field(inst, 6, 8) * 4; 1170 u32 cr_shift = inst_get_field(inst, 6, 8) * 4;
1174 1171
1175 fpd_fcmpu(&vcpu->arch.fpscr, &tmp_cr, fpr_a, fpr_b); 1172 fpd_fcmpu(&vcpu->arch.fp.fpscr, &tmp_cr, fpr_a, fpr_b);
1176 cr &= ~(cr0_mask >> cr_shift); 1173 cr &= ~(cr0_mask >> cr_shift);
1177 cr |= (cr & cr0_mask) >> cr_shift; 1174 cr |= (cr & cr0_mask) >> cr_shift;
1178 break; 1175 break;
@@ -1183,40 +1180,40 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
1183 u32 cr0_mask = 0xf0000000; 1180 u32 cr0_mask = 0xf0000000;
1184 u32 cr_shift = inst_get_field(inst, 6, 8) * 4; 1181 u32 cr_shift = inst_get_field(inst, 6, 8) * 4;
1185 1182
1186 fpd_fcmpo(&vcpu->arch.fpscr, &tmp_cr, fpr_a, fpr_b); 1183 fpd_fcmpo(&vcpu->arch.fp.fpscr, &tmp_cr, fpr_a, fpr_b);
1187 cr &= ~(cr0_mask >> cr_shift); 1184 cr &= ~(cr0_mask >> cr_shift);
1188 cr |= (cr & cr0_mask) >> cr_shift; 1185 cr |= (cr & cr0_mask) >> cr_shift;
1189 break; 1186 break;
1190 } 1187 }
1191 case OP_63_FNEG: 1188 case OP_63_FNEG:
1192 fpd_fneg(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1189 fpd_fneg(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1193 break; 1190 break;
1194 case OP_63_FMR: 1191 case OP_63_FMR:
1195 *fpr_d = *fpr_b; 1192 *fpr_d = *fpr_b;
1196 break; 1193 break;
1197 case OP_63_FABS: 1194 case OP_63_FABS:
1198 fpd_fabs(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1195 fpd_fabs(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1199 break; 1196 break;
1200 case OP_63_FCPSGN: 1197 case OP_63_FCPSGN:
1201 fpd_fcpsgn(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_b); 1198 fpd_fcpsgn(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_b);
1202 break; 1199 break;
1203 case OP_63_FDIV: 1200 case OP_63_FDIV:
1204 fpd_fdiv(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_b); 1201 fpd_fdiv(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_b);
1205 break; 1202 break;
1206 case OP_63_FADD: 1203 case OP_63_FADD:
1207 fpd_fadd(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_b); 1204 fpd_fadd(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_b);
1208 break; 1205 break;
1209 case OP_63_FSUB: 1206 case OP_63_FSUB:
1210 fpd_fsub(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_b); 1207 fpd_fsub(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_b);
1211 break; 1208 break;
1212 case OP_63_FCTIW: 1209 case OP_63_FCTIW:
1213 fpd_fctiw(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1210 fpd_fctiw(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1214 break; 1211 break;
1215 case OP_63_FCTIWZ: 1212 case OP_63_FCTIWZ:
1216 fpd_fctiwz(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1213 fpd_fctiwz(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1217 break; 1214 break;
1218 case OP_63_FRSP: 1215 case OP_63_FRSP:
1219 fpd_frsp(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1216 fpd_frsp(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1220 kvmppc_sync_qpr(vcpu, ax_rd); 1217 kvmppc_sync_qpr(vcpu, ax_rd);
1221 break; 1218 break;
1222 case OP_63_FRSQRTE: 1219 case OP_63_FRSQRTE:
@@ -1224,39 +1221,39 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
1224 double one = 1.0f; 1221 double one = 1.0f;
1225 1222
1226 /* fD = sqrt(fB) */ 1223 /* fD = sqrt(fB) */
1227 fpd_fsqrt(&vcpu->arch.fpscr, &cr, fpr_d, fpr_b); 1224 fpd_fsqrt(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_b);
1228 /* fD = 1.0f / fD */ 1225 /* fD = 1.0f / fD */
1229 fpd_fdiv(&vcpu->arch.fpscr, &cr, fpr_d, (u64*)&one, fpr_d); 1226 fpd_fdiv(&vcpu->arch.fp.fpscr, &cr, fpr_d, (u64*)&one, fpr_d);
1230 break; 1227 break;
1231 } 1228 }
1232 } 1229 }
1233 switch (inst_get_field(inst, 26, 30)) { 1230 switch (inst_get_field(inst, 26, 30)) {
1234 case OP_63_FMUL: 1231 case OP_63_FMUL:
1235 fpd_fmul(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c); 1232 fpd_fmul(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c);
1236 break; 1233 break;
1237 case OP_63_FSEL: 1234 case OP_63_FSEL:
1238 fpd_fsel(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1235 fpd_fsel(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1239 break; 1236 break;
1240 case OP_63_FMSUB: 1237 case OP_63_FMSUB:
1241 fpd_fmsub(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1238 fpd_fmsub(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1242 break; 1239 break;
1243 case OP_63_FMADD: 1240 case OP_63_FMADD:
1244 fpd_fmadd(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1241 fpd_fmadd(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1245 break; 1242 break;
1246 case OP_63_FNMSUB: 1243 case OP_63_FNMSUB:
1247 fpd_fnmsub(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1244 fpd_fnmsub(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1248 break; 1245 break;
1249 case OP_63_FNMADD: 1246 case OP_63_FNMADD:
1250 fpd_fnmadd(&vcpu->arch.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b); 1247 fpd_fnmadd(&vcpu->arch.fp.fpscr, &cr, fpr_d, fpr_a, fpr_c, fpr_b);
1251 break; 1248 break;
1252 } 1249 }
1253 break; 1250 break;
1254 } 1251 }
1255 1252
1256#ifdef DEBUG 1253#ifdef DEBUG
1257 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) { 1254 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fp.fpr); i++) {
1258 u32 f; 1255 u32 f;
1259 kvm_cvt_df(&vcpu->arch.fpr[i], &f); 1256 kvm_cvt_df(&VCPU_FPR(vcpu, i), &f);
1260 dprintk(KERN_INFO "FPR[%d] = 0x%x\n", i, f); 1257 dprintk(KERN_INFO "FPR[%d] = 0x%x\n", i, f);
1261 } 1258 }
1262#endif 1259#endif
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 5b9e9063cfaf..c5c052a9729c 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -41,6 +41,7 @@
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#include <linux/module.h>
44#include <linux/miscdevice.h>
44 45
45#include "book3s.h" 46#include "book3s.h"
46 47
@@ -566,12 +567,6 @@ static inline int get_fpr_index(int i)
566void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr) 567void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr)
567{ 568{
568 struct thread_struct *t = &current->thread; 569 struct thread_struct *t = &current->thread;
569 u64 *vcpu_fpr = vcpu->arch.fpr;
570#ifdef CONFIG_VSX
571 u64 *vcpu_vsx = vcpu->arch.vsr;
572#endif
573 u64 *thread_fpr = &t->fp_state.fpr[0][0];
574 int i;
575 570
576 /* 571 /*
577 * VSX instructions can access FP and vector registers, so if 572 * VSX instructions can access FP and vector registers, so if
@@ -594,26 +589,16 @@ void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr)
594 * both the traditional FP registers and the added VSX 589 * both the traditional FP registers and the added VSX
595 * registers into thread.fp_state.fpr[]. 590 * registers into thread.fp_state.fpr[].
596 */ 591 */
597 if (current->thread.regs->msr & MSR_FP) 592 if (t->regs->msr & MSR_FP)
598 giveup_fpu(current); 593 giveup_fpu(current);
599 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) 594 t->fp_save_area = NULL;
600 vcpu_fpr[i] = thread_fpr[get_fpr_index(i)];
601
602 vcpu->arch.fpscr = t->fp_state.fpscr;
603
604#ifdef CONFIG_VSX
605 if (cpu_has_feature(CPU_FTR_VSX))
606 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr) / 2; i++)
607 vcpu_vsx[i] = thread_fpr[get_fpr_index(i) + 1];
608#endif
609 } 595 }
610 596
611#ifdef CONFIG_ALTIVEC 597#ifdef CONFIG_ALTIVEC
612 if (msr & MSR_VEC) { 598 if (msr & MSR_VEC) {
613 if (current->thread.regs->msr & MSR_VEC) 599 if (current->thread.regs->msr & MSR_VEC)
614 giveup_altivec(current); 600 giveup_altivec(current);
615 memcpy(vcpu->arch.vr, t->vr_state.vr, sizeof(vcpu->arch.vr)); 601 t->vr_save_area = NULL;
616 vcpu->arch.vscr = t->vr_state.vscr;
617 } 602 }
618#endif 603#endif
619 604
@@ -661,12 +646,6 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
661 ulong msr) 646 ulong msr)
662{ 647{
663 struct thread_struct *t = &current->thread; 648 struct thread_struct *t = &current->thread;
664 u64 *vcpu_fpr = vcpu->arch.fpr;
665#ifdef CONFIG_VSX
666 u64 *vcpu_vsx = vcpu->arch.vsr;
667#endif
668 u64 *thread_fpr = &t->fp_state.fpr[0][0];
669 int i;
670 649
671 /* When we have paired singles, we emulate in software */ 650 /* When we have paired singles, we emulate in software */
672 if (vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE) 651 if (vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE)
@@ -704,27 +683,20 @@ static int kvmppc_handle_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr,
704#endif 683#endif
705 684
706 if (msr & MSR_FP) { 685 if (msr & MSR_FP) {
707 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) 686 enable_kernel_fp();
708 thread_fpr[get_fpr_index(i)] = vcpu_fpr[i]; 687 load_fp_state(&vcpu->arch.fp);
709#ifdef CONFIG_VSX 688 t->fp_save_area = &vcpu->arch.fp;
710 for (i = 0; i < ARRAY_SIZE(vcpu->arch.vsr) / 2; i++)
711 thread_fpr[get_fpr_index(i) + 1] = vcpu_vsx[i];
712#endif
713 t->fp_state.fpscr = vcpu->arch.fpscr;
714 t->fpexc_mode = 0;
715 kvmppc_load_up_fpu();
716 } 689 }
717 690
718 if (msr & MSR_VEC) { 691 if (msr & MSR_VEC) {
719#ifdef CONFIG_ALTIVEC 692#ifdef CONFIG_ALTIVEC
720 memcpy(t->vr_state.vr, vcpu->arch.vr, sizeof(vcpu->arch.vr)); 693 enable_kernel_altivec();
721 t->vr_state.vscr = vcpu->arch.vscr; 694 load_vr_state(&vcpu->arch.vr);
722 t->vrsave = -1; 695 t->vr_save_area = &vcpu->arch.vr;
723 kvmppc_load_up_altivec();
724#endif 696#endif
725 } 697 }
726 698
727 current->thread.regs->msr |= msr; 699 t->regs->msr |= msr;
728 vcpu->arch.guest_owned_ext |= msr; 700 vcpu->arch.guest_owned_ext |= msr;
729 kvmppc_recalc_shadow_msr(vcpu); 701 kvmppc_recalc_shadow_msr(vcpu);
730 702
@@ -743,11 +715,15 @@ static void kvmppc_handle_lost_ext(struct kvm_vcpu *vcpu)
743 if (!lost_ext) 715 if (!lost_ext)
744 return; 716 return;
745 717
746 if (lost_ext & MSR_FP) 718 if (lost_ext & MSR_FP) {
747 kvmppc_load_up_fpu(); 719 enable_kernel_fp();
720 load_fp_state(&vcpu->arch.fp);
721 }
748#ifdef CONFIG_ALTIVEC 722#ifdef CONFIG_ALTIVEC
749 if (lost_ext & MSR_VEC) 723 if (lost_ext & MSR_VEC) {
750 kvmppc_load_up_altivec(); 724 enable_kernel_altivec();
725 load_vr_state(&vcpu->arch.vr);
726 }
751#endif 727#endif
752 current->thread.regs->msr |= lost_ext; 728 current->thread.regs->msr |= lost_ext;
753} 729}
@@ -873,6 +849,7 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
873 /* We're good on these - the host merely wanted to get our attention */ 849 /* We're good on these - the host merely wanted to get our attention */
874 case BOOK3S_INTERRUPT_DECREMENTER: 850 case BOOK3S_INTERRUPT_DECREMENTER:
875 case BOOK3S_INTERRUPT_HV_DECREMENTER: 851 case BOOK3S_INTERRUPT_HV_DECREMENTER:
852 case BOOK3S_INTERRUPT_DOORBELL:
876 vcpu->stat.dec_exits++; 853 vcpu->stat.dec_exits++;
877 r = RESUME_GUEST; 854 r = RESUME_GUEST;
878 break; 855 break;
@@ -1045,14 +1022,14 @@ program_interrupt:
1045 * and if we really did time things so badly, then we just exit 1022 * and if we really did time things so badly, then we just exit
1046 * again due to a host external interrupt. 1023 * again due to a host external interrupt.
1047 */ 1024 */
1048 local_irq_disable();
1049 s = kvmppc_prepare_to_enter(vcpu); 1025 s = kvmppc_prepare_to_enter(vcpu);
1050 if (s <= 0) { 1026 if (s <= 0)
1051 local_irq_enable();
1052 r = s; 1027 r = s;
1053 } else { 1028 else {
1029 /* interrupts now hard-disabled */
1054 kvmppc_fix_ee_before_entry(); 1030 kvmppc_fix_ee_before_entry();
1055 } 1031 }
1032
1056 kvmppc_handle_lost_ext(vcpu); 1033 kvmppc_handle_lost_ext(vcpu);
1057 } 1034 }
1058 1035
@@ -1133,19 +1110,6 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
1133 case KVM_REG_PPC_HIOR: 1110 case KVM_REG_PPC_HIOR:
1134 *val = get_reg_val(id, to_book3s(vcpu)->hior); 1111 *val = get_reg_val(id, to_book3s(vcpu)->hior);
1135 break; 1112 break;
1136#ifdef CONFIG_VSX
1137 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: {
1138 long int i = id - KVM_REG_PPC_VSR0;
1139
1140 if (!cpu_has_feature(CPU_FTR_VSX)) {
1141 r = -ENXIO;
1142 break;
1143 }
1144 val->vsxval[0] = vcpu->arch.fpr[i];
1145 val->vsxval[1] = vcpu->arch.vsr[i];
1146 break;
1147 }
1148#endif /* CONFIG_VSX */
1149 default: 1113 default:
1150 r = -EINVAL; 1114 r = -EINVAL;
1151 break; 1115 break;
@@ -1164,19 +1128,6 @@ static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
1164 to_book3s(vcpu)->hior = set_reg_val(id, *val); 1128 to_book3s(vcpu)->hior = set_reg_val(id, *val);
1165 to_book3s(vcpu)->hior_explicit = true; 1129 to_book3s(vcpu)->hior_explicit = true;
1166 break; 1130 break;
1167#ifdef CONFIG_VSX
1168 case KVM_REG_PPC_VSR0 ... KVM_REG_PPC_VSR31: {
1169 long int i = id - KVM_REG_PPC_VSR0;
1170
1171 if (!cpu_has_feature(CPU_FTR_VSX)) {
1172 r = -ENXIO;
1173 break;
1174 }
1175 vcpu->arch.fpr[i] = val->vsxval[0];
1176 vcpu->arch.vsr[i] = val->vsxval[1];
1177 break;
1178 }
1179#endif /* CONFIG_VSX */
1180 default: 1131 default:
1181 r = -EINVAL; 1132 r = -EINVAL;
1182 break; 1133 break;
@@ -1274,17 +1225,9 @@ static void kvmppc_core_vcpu_free_pr(struct kvm_vcpu *vcpu)
1274static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 1225static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1275{ 1226{
1276 int ret; 1227 int ret;
1277 struct thread_fp_state fp;
1278 int fpexc_mode;
1279#ifdef CONFIG_ALTIVEC 1228#ifdef CONFIG_ALTIVEC
1280 struct thread_vr_state vr;
1281 unsigned long uninitialized_var(vrsave); 1229 unsigned long uninitialized_var(vrsave);
1282 int used_vr;
1283#endif 1230#endif
1284#ifdef CONFIG_VSX
1285 int used_vsr;
1286#endif
1287 ulong ext_msr;
1288 1231
1289 /* Check if we can run the vcpu at all */ 1232 /* Check if we can run the vcpu at all */
1290 if (!vcpu->arch.sane) { 1233 if (!vcpu->arch.sane) {
@@ -1299,40 +1242,27 @@ static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1299 * really did time things so badly, then we just exit again due to 1242 * really did time things so badly, then we just exit again due to
1300 * a host external interrupt. 1243 * a host external interrupt.
1301 */ 1244 */
1302 local_irq_disable();
1303 ret = kvmppc_prepare_to_enter(vcpu); 1245 ret = kvmppc_prepare_to_enter(vcpu);
1304 if (ret <= 0) { 1246 if (ret <= 0)
1305 local_irq_enable();
1306 goto out; 1247 goto out;
1307 } 1248 /* interrupts now hard-disabled */
1308 1249
1309 /* Save FPU state in stack */ 1250 /* Save FPU state in thread_struct */
1310 if (current->thread.regs->msr & MSR_FP) 1251 if (current->thread.regs->msr & MSR_FP)
1311 giveup_fpu(current); 1252 giveup_fpu(current);
1312 fp = current->thread.fp_state;
1313 fpexc_mode = current->thread.fpexc_mode;
1314 1253
1315#ifdef CONFIG_ALTIVEC 1254#ifdef CONFIG_ALTIVEC
1316 /* Save Altivec state in stack */ 1255 /* Save Altivec state in thread_struct */
1317 used_vr = current->thread.used_vr; 1256 if (current->thread.regs->msr & MSR_VEC)
1318 if (used_vr) { 1257 giveup_altivec(current);
1319 if (current->thread.regs->msr & MSR_VEC)
1320 giveup_altivec(current);
1321 vr = current->thread.vr_state;
1322 vrsave = current->thread.vrsave;
1323 }
1324#endif 1258#endif
1325 1259
1326#ifdef CONFIG_VSX 1260#ifdef CONFIG_VSX
1327 /* Save VSX state in stack */ 1261 /* Save VSX state in thread_struct */
1328 used_vsr = current->thread.used_vsr; 1262 if (current->thread.regs->msr & MSR_VSX)
1329 if (used_vsr && (current->thread.regs->msr & MSR_VSX))
1330 __giveup_vsx(current); 1263 __giveup_vsx(current);
1331#endif 1264#endif
1332 1265
1333 /* Remember the MSR with disabled extensions */
1334 ext_msr = current->thread.regs->msr;
1335
1336 /* Preload FPU if it's enabled */ 1266 /* Preload FPU if it's enabled */
1337 if (vcpu->arch.shared->msr & MSR_FP) 1267 if (vcpu->arch.shared->msr & MSR_FP)
1338 kvmppc_handle_ext(vcpu, BOOK3S_INTERRUPT_FP_UNAVAIL, MSR_FP); 1268 kvmppc_handle_ext(vcpu, BOOK3S_INTERRUPT_FP_UNAVAIL, MSR_FP);
@@ -1347,25 +1277,6 @@ static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1347 /* Make sure we save the guest FPU/Altivec/VSX state */ 1277 /* Make sure we save the guest FPU/Altivec/VSX state */
1348 kvmppc_giveup_ext(vcpu, MSR_FP | MSR_VEC | MSR_VSX); 1278 kvmppc_giveup_ext(vcpu, MSR_FP | MSR_VEC | MSR_VSX);
1349 1279
1350 current->thread.regs->msr = ext_msr;
1351
1352 /* Restore FPU/VSX state from stack */
1353 current->thread.fp_state = fp;
1354 current->thread.fpexc_mode = fpexc_mode;
1355
1356#ifdef CONFIG_ALTIVEC
1357 /* Restore Altivec state from stack */
1358 if (used_vr && current->thread.used_vr) {
1359 current->thread.vr_state = vr;
1360 current->thread.vrsave = vrsave;
1361 }
1362 current->thread.used_vr = used_vr;
1363#endif
1364
1365#ifdef CONFIG_VSX
1366 current->thread.used_vsr = used_vsr;
1367#endif
1368
1369out: 1280out:
1370 vcpu->mode = OUTSIDE_GUEST_MODE; 1281 vcpu->mode = OUTSIDE_GUEST_MODE;
1371 return ret; 1282 return ret;
@@ -1606,4 +1517,6 @@ module_init(kvmppc_book3s_init_pr);
1606module_exit(kvmppc_book3s_exit_pr); 1517module_exit(kvmppc_book3s_exit_pr);
1607 1518
1608MODULE_LICENSE("GPL"); 1519MODULE_LICENSE("GPL");
1520MODULE_ALIAS_MISCDEV(KVM_MINOR);
1521MODULE_ALIAS("devname:kvm");
1609#endif 1522#endif
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S
index c3c5231adade..9eec675220e6 100644
--- a/arch/powerpc/kvm/book3s_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_rmhandlers.S
@@ -162,51 +162,4 @@ _GLOBAL(kvmppc_entry_trampoline)
162 mtsrr1 r6 162 mtsrr1 r6
163 RFI 163 RFI
164 164
165#if defined(CONFIG_PPC_BOOK3S_32)
166#define STACK_LR INT_FRAME_SIZE+4
167
168/* load_up_xxx have to run with MSR_DR=0 on Book3S_32 */
169#define MSR_EXT_START \
170 PPC_STL r20, _NIP(r1); \
171 mfmsr r20; \
172 LOAD_REG_IMMEDIATE(r3, MSR_DR|MSR_EE); \
173 andc r3,r20,r3; /* Disable DR,EE */ \
174 mtmsr r3; \
175 sync
176
177#define MSR_EXT_END \
178 mtmsr r20; /* Enable DR,EE */ \
179 sync; \
180 PPC_LL r20, _NIP(r1)
181
182#elif defined(CONFIG_PPC_BOOK3S_64)
183#define STACK_LR _LINK
184#define MSR_EXT_START
185#define MSR_EXT_END
186#endif
187
188/*
189 * Activate current's external feature (FPU/Altivec/VSX)
190 */
191#define define_load_up(what) \
192 \
193_GLOBAL(kvmppc_load_up_ ## what); \
194 PPC_STLU r1, -INT_FRAME_SIZE(r1); \
195 mflr r3; \
196 PPC_STL r3, STACK_LR(r1); \
197 MSR_EXT_START; \
198 \
199 bl FUNC(load_up_ ## what); \
200 \
201 MSR_EXT_END; \
202 PPC_LL r3, STACK_LR(r1); \
203 mtlr r3; \
204 addi r1, r1, INT_FRAME_SIZE; \
205 blr
206
207define_load_up(fpu)
208#ifdef CONFIG_ALTIVEC
209define_load_up(altivec)
210#endif
211
212#include "book3s_segment.S" 165#include "book3s_segment.S"
diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S
index bc50c97751d3..1e0cc2adfd40 100644
--- a/arch/powerpc/kvm/book3s_segment.S
+++ b/arch/powerpc/kvm/book3s_segment.S
@@ -361,6 +361,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
361 beqa BOOK3S_INTERRUPT_DECREMENTER 361 beqa BOOK3S_INTERRUPT_DECREMENTER
362 cmpwi r12, BOOK3S_INTERRUPT_PERFMON 362 cmpwi r12, BOOK3S_INTERRUPT_PERFMON
363 beqa BOOK3S_INTERRUPT_PERFMON 363 beqa BOOK3S_INTERRUPT_PERFMON
364 cmpwi r12, BOOK3S_INTERRUPT_DOORBELL
365 beqa BOOK3S_INTERRUPT_DOORBELL
364 366
365 RFI 367 RFI
366kvmppc_handler_trampoline_exit_end: 368kvmppc_handler_trampoline_exit_end:
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index 02a17dcf1610..d1acd32a64c0 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1246,8 +1246,10 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
1246 kvm->arch.xics = xics; 1246 kvm->arch.xics = xics;
1247 mutex_unlock(&kvm->lock); 1247 mutex_unlock(&kvm->lock);
1248 1248
1249 if (ret) 1249 if (ret) {
1250 kfree(xics);
1250 return ret; 1251 return ret;
1252 }
1251 1253
1252 xics_debugfs_init(xics); 1254 xics_debugfs_init(xics);
1253 1255
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 0591e05db74b..ab62109fdfa3 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -643,7 +643,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
643 local_irq_enable(); 643 local_irq_enable();
644 kvm_vcpu_block(vcpu); 644 kvm_vcpu_block(vcpu);
645 clear_bit(KVM_REQ_UNHALT, &vcpu->requests); 645 clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
646 local_irq_disable(); 646 hard_irq_disable();
647 647
648 kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS); 648 kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS);
649 r = 1; 649 r = 1;
@@ -682,34 +682,22 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
682{ 682{
683 int ret, s; 683 int ret, s;
684 struct debug_reg debug; 684 struct debug_reg debug;
685#ifdef CONFIG_PPC_FPU
686 struct thread_fp_state fp;
687 int fpexc_mode;
688#endif
689 685
690 if (!vcpu->arch.sane) { 686 if (!vcpu->arch.sane) {
691 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 687 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
692 return -EINVAL; 688 return -EINVAL;
693 } 689 }
694 690
695 local_irq_disable();
696 s = kvmppc_prepare_to_enter(vcpu); 691 s = kvmppc_prepare_to_enter(vcpu);
697 if (s <= 0) { 692 if (s <= 0) {
698 local_irq_enable();
699 ret = s; 693 ret = s;
700 goto out; 694 goto out;
701 } 695 }
696 /* interrupts now hard-disabled */
702 697
703#ifdef CONFIG_PPC_FPU 698#ifdef CONFIG_PPC_FPU
704 /* Save userspace FPU state in stack */ 699 /* Save userspace FPU state in stack */
705 enable_kernel_fp(); 700 enable_kernel_fp();
706 fp = current->thread.fp_state;
707 fpexc_mode = current->thread.fpexc_mode;
708
709 /* Restore guest FPU state to thread */
710 memcpy(current->thread.fp_state.fpr, vcpu->arch.fpr,
711 sizeof(vcpu->arch.fpr));
712 current->thread.fp_state.fpscr = vcpu->arch.fpscr;
713 701
714 /* 702 /*
715 * Since we can't trap on MSR_FP in GS-mode, we consider the guest 703 * Since we can't trap on MSR_FP in GS-mode, we consider the guest
@@ -728,6 +716,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
728 debug = current->thread.debug; 716 debug = current->thread.debug;
729 current->thread.debug = vcpu->arch.shadow_dbg_reg; 717 current->thread.debug = vcpu->arch.shadow_dbg_reg;
730 718
719 vcpu->arch.pgdir = current->mm->pgd;
731 kvmppc_fix_ee_before_entry(); 720 kvmppc_fix_ee_before_entry();
732 721
733 ret = __kvmppc_vcpu_run(kvm_run, vcpu); 722 ret = __kvmppc_vcpu_run(kvm_run, vcpu);
@@ -743,15 +732,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
743 kvmppc_save_guest_fp(vcpu); 732 kvmppc_save_guest_fp(vcpu);
744 733
745 vcpu->fpu_active = 0; 734 vcpu->fpu_active = 0;
746
747 /* Save guest FPU state from thread */
748 memcpy(vcpu->arch.fpr, current->thread.fp_state.fpr,
749 sizeof(vcpu->arch.fpr));
750 vcpu->arch.fpscr = current->thread.fp_state.fpscr;
751
752 /* Restore userspace FPU state from stack */
753 current->thread.fp_state = fp;
754 current->thread.fpexc_mode = fpexc_mode;
755#endif 735#endif
756 736
757out: 737out:
@@ -898,17 +878,6 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
898 int s; 878 int s;
899 int idx; 879 int idx;
900 880
901#ifdef CONFIG_PPC64
902 WARN_ON(local_paca->irq_happened != 0);
903#endif
904
905 /*
906 * We enter with interrupts disabled in hardware, but
907 * we need to call hard_irq_disable anyway to ensure that
908 * the software state is kept in sync.
909 */
910 hard_irq_disable();
911
912 /* update before a new last_exit_type is rewritten */ 881 /* update before a new last_exit_type is rewritten */
913 kvmppc_update_timing_stats(vcpu); 882 kvmppc_update_timing_stats(vcpu);
914 883
@@ -1217,12 +1186,11 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1217 * aren't already exiting to userspace for some other reason. 1186 * aren't already exiting to userspace for some other reason.
1218 */ 1187 */
1219 if (!(r & RESUME_HOST)) { 1188 if (!(r & RESUME_HOST)) {
1220 local_irq_disable();
1221 s = kvmppc_prepare_to_enter(vcpu); 1189 s = kvmppc_prepare_to_enter(vcpu);
1222 if (s <= 0) { 1190 if (s <= 0)
1223 local_irq_enable();
1224 r = (s << 2) | RESUME_HOST | (r & RESUME_FLAG_NV); 1191 r = (s << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
1225 } else { 1192 else {
1193 /* interrupts now hard-disabled */
1226 kvmppc_fix_ee_before_entry(); 1194 kvmppc_fix_ee_before_entry();
1227 } 1195 }
1228 } 1196 }
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index 09bfd9bc7cf8..b632cd35919b 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -136,7 +136,9 @@ static inline void kvmppc_load_guest_fp(struct kvm_vcpu *vcpu)
136{ 136{
137#ifdef CONFIG_PPC_FPU 137#ifdef CONFIG_PPC_FPU
138 if (vcpu->fpu_active && !(current->thread.regs->msr & MSR_FP)) { 138 if (vcpu->fpu_active && !(current->thread.regs->msr & MSR_FP)) {
139 load_up_fpu(); 139 enable_kernel_fp();
140 load_fp_state(&vcpu->arch.fp);
141 current->thread.fp_save_area = &vcpu->arch.fp;
140 current->thread.regs->msr |= MSR_FP; 142 current->thread.regs->msr |= MSR_FP;
141 } 143 }
142#endif 144#endif
@@ -151,6 +153,7 @@ static inline void kvmppc_save_guest_fp(struct kvm_vcpu *vcpu)
151#ifdef CONFIG_PPC_FPU 153#ifdef CONFIG_PPC_FPU
152 if (vcpu->fpu_active && (current->thread.regs->msr & MSR_FP)) 154 if (vcpu->fpu_active && (current->thread.regs->msr & MSR_FP))
153 giveup_fpu(current); 155 giveup_fpu(current);
156 current->thread.fp_save_area = NULL;
154#endif 157#endif
155} 158}
156 159
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index e8ed7d659c55..e4185f6b3309 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -33,6 +33,8 @@
33 33
34#ifdef CONFIG_64BIT 34#ifdef CONFIG_64BIT
35#include <asm/exception-64e.h> 35#include <asm/exception-64e.h>
36#include <asm/hw_irq.h>
37#include <asm/irqflags.h>
36#else 38#else
37#include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */ 39#include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */
38#endif 40#endif
@@ -319,6 +321,8 @@ kvm_handler BOOKE_INTERRUPT_DEBUG, EX_PARAMS(DBG), \
319 SPRN_DSRR0, SPRN_DSRR1, 0 321 SPRN_DSRR0, SPRN_DSRR1, 0
320kvm_handler BOOKE_INTERRUPT_DEBUG, EX_PARAMS(CRIT), \ 322kvm_handler BOOKE_INTERRUPT_DEBUG, EX_PARAMS(CRIT), \
321 SPRN_CSRR0, SPRN_CSRR1, 0 323 SPRN_CSRR0, SPRN_CSRR1, 0
324kvm_handler BOOKE_INTERRUPT_LRAT_ERROR, EX_PARAMS(GEN), \
325 SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
322#else 326#else
323/* 327/*
324 * For input register values, see arch/powerpc/include/asm/kvm_booke_hv_asm.h 328 * For input register values, see arch/powerpc/include/asm/kvm_booke_hv_asm.h
@@ -465,6 +469,15 @@ _GLOBAL(kvmppc_resume_host)
465 mtspr SPRN_EPCR, r3 469 mtspr SPRN_EPCR, r3
466 isync 470 isync
467 471
472#ifdef CONFIG_64BIT
473 /*
474 * We enter with interrupts disabled in hardware, but
475 * we need to call RECONCILE_IRQ_STATE to ensure
476 * that the software state is kept in sync.
477 */
478 RECONCILE_IRQ_STATE(r3,r5)
479#endif
480
468 /* Switch to kernel stack and jump to handler. */ 481 /* Switch to kernel stack and jump to handler. */
469 PPC_LL r3, HOST_RUN(r1) 482 PPC_LL r3, HOST_RUN(r1)
470 mr r5, r14 /* intno */ 483 mr r5, r14 /* intno */
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index 497b142f651c..2e02ed849f36 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -16,6 +16,8 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/export.h> 18#include <linux/export.h>
19#include <linux/module.h>
20#include <linux/miscdevice.h>
19 21
20#include <asm/reg.h> 22#include <asm/reg.h>
21#include <asm/cputable.h> 23#include <asm/cputable.h>
@@ -573,3 +575,5 @@ static void __exit kvmppc_e500_exit(void)
573 575
574module_init(kvmppc_e500_init); 576module_init(kvmppc_e500_init);
575module_exit(kvmppc_e500_exit); 577module_exit(kvmppc_e500_exit);
578MODULE_ALIAS_MISCDEV(KVM_MINOR);
579MODULE_ALIAS("devname:kvm");
diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h
index 4fd9650eb018..a326178bdea5 100644
--- a/arch/powerpc/kvm/e500.h
+++ b/arch/powerpc/kvm/e500.h
@@ -31,11 +31,13 @@ enum vcpu_ftr {
31#define E500_TLB_NUM 2 31#define E500_TLB_NUM 2
32 32
33/* entry is mapped somewhere in host TLB */ 33/* entry is mapped somewhere in host TLB */
34#define E500_TLB_VALID (1 << 0) 34#define E500_TLB_VALID (1 << 31)
35/* TLB1 entry is mapped by host TLB1, tracked by bitmaps */ 35/* TLB1 entry is mapped by host TLB1, tracked by bitmaps */
36#define E500_TLB_BITMAP (1 << 1) 36#define E500_TLB_BITMAP (1 << 30)
37/* TLB1 entry is mapped by host TLB0 */ 37/* TLB1 entry is mapped by host TLB0 */
38#define E500_TLB_TLB0 (1 << 2) 38#define E500_TLB_TLB0 (1 << 29)
39/* bits [6-5] MAS2_X1 and MAS2_X0 and [4-0] bits for WIMGE */
40#define E500_TLB_MAS2_ATTR (0x7f)
39 41
40struct tlbe_ref { 42struct tlbe_ref {
41 pfn_t pfn; /* valid only for TLB0, except briefly */ 43 pfn_t pfn; /* valid only for TLB0, except briefly */
diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c
index ebca6b88ea5e..50860e919cb8 100644
--- a/arch/powerpc/kvm/e500_mmu.c
+++ b/arch/powerpc/kvm/e500_mmu.c
@@ -127,7 +127,7 @@ static int kvmppc_e500_tlb_index(struct kvmppc_vcpu_e500 *vcpu_e500,
127} 127}
128 128
129static inline void kvmppc_e500_deliver_tlb_miss(struct kvm_vcpu *vcpu, 129static inline void kvmppc_e500_deliver_tlb_miss(struct kvm_vcpu *vcpu,
130 unsigned int eaddr, int as) 130 gva_t eaddr, int as)
131{ 131{
132 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 132 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
133 unsigned int victim, tsized; 133 unsigned int victim, tsized;
diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index ecf2247b13be..dd2cc03f406f 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -65,15 +65,6 @@ static inline u32 e500_shadow_mas3_attrib(u32 mas3, int usermode)
65 return mas3; 65 return mas3;
66} 66}
67 67
68static inline u32 e500_shadow_mas2_attrib(u32 mas2, int usermode)
69{
70#ifdef CONFIG_SMP
71 return (mas2 & MAS2_ATTRIB_MASK) | MAS2_M;
72#else
73 return mas2 & MAS2_ATTRIB_MASK;
74#endif
75}
76
77/* 68/*
78 * writing shadow tlb entry to host TLB 69 * writing shadow tlb entry to host TLB
79 */ 70 */
@@ -231,15 +222,15 @@ void inval_gtlbe_on_host(struct kvmppc_vcpu_e500 *vcpu_e500, int tlbsel,
231 ref->flags &= ~(E500_TLB_TLB0 | E500_TLB_VALID); 222 ref->flags &= ~(E500_TLB_TLB0 | E500_TLB_VALID);
232 } 223 }
233 224
234 /* Already invalidated in between */ 225 /*
235 if (!(ref->flags & E500_TLB_VALID)) 226 * If TLB entry is still valid then it's a TLB0 entry, and thus
236 return; 227 * backed by at most one host tlbe per shadow pid
237 228 */
238 /* Guest tlbe is backed by at most one host tlbe per shadow pid. */ 229 if (ref->flags & E500_TLB_VALID)
239 kvmppc_e500_tlbil_one(vcpu_e500, gtlbe); 230 kvmppc_e500_tlbil_one(vcpu_e500, gtlbe);
240 231
241 /* Mark the TLB as not backed by the host anymore */ 232 /* Mark the TLB as not backed by the host anymore */
242 ref->flags &= ~E500_TLB_VALID; 233 ref->flags = 0;
243} 234}
244 235
245static inline int tlbe_is_writable(struct kvm_book3e_206_tlb_entry *tlbe) 236static inline int tlbe_is_writable(struct kvm_book3e_206_tlb_entry *tlbe)
@@ -249,10 +240,13 @@ static inline int tlbe_is_writable(struct kvm_book3e_206_tlb_entry *tlbe)
249 240
250static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref, 241static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
251 struct kvm_book3e_206_tlb_entry *gtlbe, 242 struct kvm_book3e_206_tlb_entry *gtlbe,
252 pfn_t pfn) 243 pfn_t pfn, unsigned int wimg)
253{ 244{
254 ref->pfn = pfn; 245 ref->pfn = pfn;
255 ref->flags |= E500_TLB_VALID; 246 ref->flags = E500_TLB_VALID;
247
248 /* Use guest supplied MAS2_G and MAS2_E */
249 ref->flags |= (gtlbe->mas2 & MAS2_ATTRIB_MASK) | wimg;
256 250
257 /* Mark the page accessed */ 251 /* Mark the page accessed */
258 kvm_set_pfn_accessed(pfn); 252 kvm_set_pfn_accessed(pfn);
@@ -316,8 +310,7 @@ static void kvmppc_e500_setup_stlbe(
316 310
317 /* Force IPROT=0 for all guest mappings. */ 311 /* Force IPROT=0 for all guest mappings. */
318 stlbe->mas1 = MAS1_TSIZE(tsize) | get_tlb_sts(gtlbe) | MAS1_VALID; 312 stlbe->mas1 = MAS1_TSIZE(tsize) | get_tlb_sts(gtlbe) | MAS1_VALID;
319 stlbe->mas2 = (gvaddr & MAS2_EPN) | 313 stlbe->mas2 = (gvaddr & MAS2_EPN) | (ref->flags & E500_TLB_MAS2_ATTR);
320 e500_shadow_mas2_attrib(gtlbe->mas2, pr);
321 stlbe->mas7_3 = ((u64)pfn << PAGE_SHIFT) | 314 stlbe->mas7_3 = ((u64)pfn << PAGE_SHIFT) |
322 e500_shadow_mas3_attrib(gtlbe->mas7_3, pr); 315 e500_shadow_mas3_attrib(gtlbe->mas7_3, pr);
323 316
@@ -339,6 +332,10 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
339 int ret = 0; 332 int ret = 0;
340 unsigned long mmu_seq; 333 unsigned long mmu_seq;
341 struct kvm *kvm = vcpu_e500->vcpu.kvm; 334 struct kvm *kvm = vcpu_e500->vcpu.kvm;
335 unsigned long tsize_pages = 0;
336 pte_t *ptep;
337 unsigned int wimg = 0;
338 pgd_t *pgdir;
342 339
343 /* used to check for invalidations in progress */ 340 /* used to check for invalidations in progress */
344 mmu_seq = kvm->mmu_notifier_seq; 341 mmu_seq = kvm->mmu_notifier_seq;
@@ -405,7 +402,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
405 */ 402 */
406 403
407 for (; tsize > BOOK3E_PAGESZ_4K; tsize -= 2) { 404 for (; tsize > BOOK3E_PAGESZ_4K; tsize -= 2) {
408 unsigned long gfn_start, gfn_end, tsize_pages; 405 unsigned long gfn_start, gfn_end;
409 tsize_pages = 1 << (tsize - 2); 406 tsize_pages = 1 << (tsize - 2);
410 407
411 gfn_start = gfn & ~(tsize_pages - 1); 408 gfn_start = gfn & ~(tsize_pages - 1);
@@ -447,11 +444,12 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
447 } 444 }
448 445
449 if (likely(!pfnmap)) { 446 if (likely(!pfnmap)) {
450 unsigned long tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT); 447 tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT);
451 pfn = gfn_to_pfn_memslot(slot, gfn); 448 pfn = gfn_to_pfn_memslot(slot, gfn);
452 if (is_error_noslot_pfn(pfn)) { 449 if (is_error_noslot_pfn(pfn)) {
453 printk(KERN_ERR "Couldn't get real page for gfn %lx!\n", 450 if (printk_ratelimit())
454 (long)gfn); 451 pr_err("%s: real page not found for gfn %lx\n",
452 __func__, (long)gfn);
455 return -EINVAL; 453 return -EINVAL;
456 } 454 }
457 455
@@ -466,7 +464,18 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
466 goto out; 464 goto out;
467 } 465 }
468 466
469 kvmppc_e500_ref_setup(ref, gtlbe, pfn); 467
468 pgdir = vcpu_e500->vcpu.arch.pgdir;
469 ptep = lookup_linux_ptep(pgdir, hva, &tsize_pages);
470 if (pte_present(*ptep))
471 wimg = (*ptep >> PTE_WIMGE_SHIFT) & MAS2_WIMGE_MASK;
472 else {
473 if (printk_ratelimit())
474 pr_err("%s: pte not present: gfn %lx, pfn %lx\n",
475 __func__, (long)gfn, pfn);
476 return -EINVAL;
477 }
478 kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg);
470 479
471 kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize, 480 kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,
472 ref, gvaddr, stlbe); 481 ref, gvaddr, stlbe);
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 4132cd2fc171..17e456279224 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -16,6 +16,8 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/export.h> 18#include <linux/export.h>
19#include <linux/miscdevice.h>
20#include <linux/module.h>
19 21
20#include <asm/reg.h> 22#include <asm/reg.h>
21#include <asm/cputable.h> 23#include <asm/cputable.h>
@@ -391,3 +393,5 @@ static void __exit kvmppc_e500mc_exit(void)
391 393
392module_init(kvmppc_e500mc_init); 394module_init(kvmppc_e500mc_init);
393module_exit(kvmppc_e500mc_exit); 395module_exit(kvmppc_e500mc_exit);
396MODULE_ALIAS_MISCDEV(KVM_MINOR);
397MODULE_ALIAS("devname:kvm");
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 2f9a0873b44f..c2b887be2c29 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -219,7 +219,6 @@ static int kvmppc_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
219 * lmw 219 * lmw
220 * stmw 220 * stmw
221 * 221 *
222 * XXX is_bigendian should depend on MMU mapping or MSR[LE]
223 */ 222 */
224/* XXX Should probably auto-generate instruction decoding for a particular core 223/* XXX Should probably auto-generate instruction decoding for a particular core
225 * from opcode tables in the future. */ 224 * from opcode tables in the future. */
diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
index 2861ae9eaae6..efbd9962a209 100644
--- a/arch/powerpc/kvm/mpic.c
+++ b/arch/powerpc/kvm/mpic.c
@@ -1635,6 +1635,7 @@ static void mpic_destroy(struct kvm_device *dev)
1635 1635
1636 dev->kvm->arch.mpic = NULL; 1636 dev->kvm->arch.mpic = NULL;
1637 kfree(opp); 1637 kfree(opp);
1638 kfree(dev);
1638} 1639}
1639 1640
1640static int mpic_set_default_irq_routing(struct openpic *opp) 1641static int mpic_set_default_irq_routing(struct openpic *opp)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 9ae97686e9f4..3cf541a53e2a 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -68,14 +68,16 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
68 */ 68 */
69int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu) 69int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
70{ 70{
71 int r = 1; 71 int r;
72
73 WARN_ON(irqs_disabled());
74 hard_irq_disable();
72 75
73 WARN_ON_ONCE(!irqs_disabled());
74 while (true) { 76 while (true) {
75 if (need_resched()) { 77 if (need_resched()) {
76 local_irq_enable(); 78 local_irq_enable();
77 cond_resched(); 79 cond_resched();
78 local_irq_disable(); 80 hard_irq_disable();
79 continue; 81 continue;
80 } 82 }
81 83
@@ -101,7 +103,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
101 local_irq_enable(); 103 local_irq_enable();
102 trace_kvm_check_requests(vcpu); 104 trace_kvm_check_requests(vcpu);
103 r = kvmppc_core_check_requests(vcpu); 105 r = kvmppc_core_check_requests(vcpu);
104 local_irq_disable(); 106 hard_irq_disable();
105 if (r > 0) 107 if (r > 0)
106 continue; 108 continue;
107 break; 109 break;
@@ -113,22 +115,12 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
113 continue; 115 continue;
114 } 116 }
115 117
116#ifdef CONFIG_PPC64
117 /* lazy EE magic */
118 hard_irq_disable();
119 if (lazy_irq_pending()) {
120 /* Got an interrupt in between, try again */
121 local_irq_enable();
122 local_irq_disable();
123 kvm_guest_exit();
124 continue;
125 }
126#endif
127
128 kvm_guest_enter(); 118 kvm_guest_enter();
129 break; 119 return 1;
130 } 120 }
131 121
122 /* return to host */
123 local_irq_enable();
132 return r; 124 return r;
133} 125}
134EXPORT_SYMBOL_GPL(kvmppc_prepare_to_enter); 126EXPORT_SYMBOL_GPL(kvmppc_prepare_to_enter);
@@ -656,14 +648,14 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
656 kvmppc_set_gpr(vcpu, vcpu->arch.io_gpr, gpr); 648 kvmppc_set_gpr(vcpu, vcpu->arch.io_gpr, gpr);
657 break; 649 break;
658 case KVM_MMIO_REG_FPR: 650 case KVM_MMIO_REG_FPR:
659 vcpu->arch.fpr[vcpu->arch.io_gpr & KVM_MMIO_REG_MASK] = gpr; 651 VCPU_FPR(vcpu, vcpu->arch.io_gpr & KVM_MMIO_REG_MASK) = gpr;
660 break; 652 break;
661#ifdef CONFIG_PPC_BOOK3S 653#ifdef CONFIG_PPC_BOOK3S
662 case KVM_MMIO_REG_QPR: 654 case KVM_MMIO_REG_QPR:
663 vcpu->arch.qpr[vcpu->arch.io_gpr & KVM_MMIO_REG_MASK] = gpr; 655 vcpu->arch.qpr[vcpu->arch.io_gpr & KVM_MMIO_REG_MASK] = gpr;
664 break; 656 break;
665 case KVM_MMIO_REG_FQPR: 657 case KVM_MMIO_REG_FQPR:
666 vcpu->arch.fpr[vcpu->arch.io_gpr & KVM_MMIO_REG_MASK] = gpr; 658 VCPU_FPR(vcpu, vcpu->arch.io_gpr & KVM_MMIO_REG_MASK) = gpr;
667 vcpu->arch.qpr[vcpu->arch.io_gpr & KVM_MMIO_REG_MASK] = gpr; 659 vcpu->arch.qpr[vcpu->arch.io_gpr & KVM_MMIO_REG_MASK] = gpr;
668 break; 660 break;
669#endif 661#endif
@@ -673,9 +665,19 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
673} 665}
674 666
675int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, 667int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
676 unsigned int rt, unsigned int bytes, int is_bigendian) 668 unsigned int rt, unsigned int bytes,
669 int is_default_endian)
677{ 670{
678 int idx, ret; 671 int idx, ret;
672 int is_bigendian;
673
674 if (kvmppc_need_byteswap(vcpu)) {
675 /* Default endianness is "little endian". */
676 is_bigendian = !is_default_endian;
677 } else {
678 /* Default endianness is "big endian". */
679 is_bigendian = is_default_endian;
680 }
679 681
680 if (bytes > sizeof(run->mmio.data)) { 682 if (bytes > sizeof(run->mmio.data)) {
681 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__, 683 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__,
@@ -711,21 +713,31 @@ EXPORT_SYMBOL_GPL(kvmppc_handle_load);
711 713
712/* Same as above, but sign extends */ 714/* Same as above, but sign extends */
713int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu, 715int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
714 unsigned int rt, unsigned int bytes, int is_bigendian) 716 unsigned int rt, unsigned int bytes,
717 int is_default_endian)
715{ 718{
716 int r; 719 int r;
717 720
718 vcpu->arch.mmio_sign_extend = 1; 721 vcpu->arch.mmio_sign_extend = 1;
719 r = kvmppc_handle_load(run, vcpu, rt, bytes, is_bigendian); 722 r = kvmppc_handle_load(run, vcpu, rt, bytes, is_default_endian);
720 723
721 return r; 724 return r;
722} 725}
723 726
724int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu, 727int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
725 u64 val, unsigned int bytes, int is_bigendian) 728 u64 val, unsigned int bytes, int is_default_endian)
726{ 729{
727 void *data = run->mmio.data; 730 void *data = run->mmio.data;
728 int idx, ret; 731 int idx, ret;
732 int is_bigendian;
733
734 if (kvmppc_need_byteswap(vcpu)) {
735 /* Default endianness is "little endian". */
736 is_bigendian = !is_default_endian;
737 } else {
738 /* Default endianness is "big endian". */
739 is_bigendian = is_default_endian;
740 }
729 741
730 if (bytes > sizeof(run->mmio.data)) { 742 if (bytes > sizeof(run->mmio.data)) {
731 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__, 743 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__,
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 17e5b2364312..d5edbeb8eb82 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -159,6 +159,21 @@ unsigned int translate_branch(const unsigned int *dest, const unsigned int *src)
159 return 0; 159 return 0;
160} 160}
161 161
162#ifdef CONFIG_PPC_BOOK3E_64
163void __patch_exception(int exc, unsigned long addr)
164{
165 extern unsigned int interrupt_base_book3e;
166 unsigned int *ibase = &interrupt_base_book3e;
167
168 /* Our exceptions vectors start with a NOP and -then- a branch
169 * to deal with single stepping from userspace which stops on
170 * the second instruction. Thus we need to patch the second
171 * instruction of the exception, not the first one
172 */
173
174 patch_branch(ibase + (exc / 4) + 1, addr, 0);
175}
176#endif
162 177
163#ifdef CONFIG_CODE_PATCHING_SELFTEST 178#ifdef CONFIG_CODE_PATCHING_SELFTEST
164 179
diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
index b2c68ce139ae..a5b30c71a8d3 100644
--- a/arch/powerpc/lib/crtsavres.S
+++ b/arch/powerpc/lib/crtsavres.S
@@ -231,6 +231,87 @@ _GLOBAL(_rest32gpr_31_x)
231 mr 1,11 231 mr 1,11
232 blr 232 blr
233 233
234#ifdef CONFIG_ALTIVEC
235/* Called with r0 pointing just beyond the end of the vector save area. */
236
237_GLOBAL(_savevr_20)
238 li r11,-192
239 stvx vr20,r11,r0
240_GLOBAL(_savevr_21)
241 li r11,-176
242 stvx vr21,r11,r0
243_GLOBAL(_savevr_22)
244 li r11,-160
245 stvx vr22,r11,r0
246_GLOBAL(_savevr_23)
247 li r11,-144
248 stvx vr23,r11,r0
249_GLOBAL(_savevr_24)
250 li r11,-128
251 stvx vr24,r11,r0
252_GLOBAL(_savevr_25)
253 li r11,-112
254 stvx vr25,r11,r0
255_GLOBAL(_savevr_26)
256 li r11,-96
257 stvx vr26,r11,r0
258_GLOBAL(_savevr_27)
259 li r11,-80
260 stvx vr27,r11,r0
261_GLOBAL(_savevr_28)
262 li r11,-64
263 stvx vr28,r11,r0
264_GLOBAL(_savevr_29)
265 li r11,-48
266 stvx vr29,r11,r0
267_GLOBAL(_savevr_30)
268 li r11,-32
269 stvx vr30,r11,r0
270_GLOBAL(_savevr_31)
271 li r11,-16
272 stvx vr31,r11,r0
273 blr
274
275_GLOBAL(_restvr_20)
276 li r11,-192
277 lvx vr20,r11,r0
278_GLOBAL(_restvr_21)
279 li r11,-176
280 lvx vr21,r11,r0
281_GLOBAL(_restvr_22)
282 li r11,-160
283 lvx vr22,r11,r0
284_GLOBAL(_restvr_23)
285 li r11,-144
286 lvx vr23,r11,r0
287_GLOBAL(_restvr_24)
288 li r11,-128
289 lvx vr24,r11,r0
290_GLOBAL(_restvr_25)
291 li r11,-112
292 lvx vr25,r11,r0
293_GLOBAL(_restvr_26)
294 li r11,-96
295 lvx vr26,r11,r0
296_GLOBAL(_restvr_27)
297 li r11,-80
298 lvx vr27,r11,r0
299_GLOBAL(_restvr_28)
300 li r11,-64
301 lvx vr28,r11,r0
302_GLOBAL(_restvr_29)
303 li r11,-48
304 lvx vr29,r11,r0
305_GLOBAL(_restvr_30)
306 li r11,-32
307 lvx vr30,r11,r0
308_GLOBAL(_restvr_31)
309 li r11,-16
310 lvx vr31,r11,r0
311 blr
312
313#endif /* CONFIG_ALTIVEC */
314
234#else /* CONFIG_PPC64 */ 315#else /* CONFIG_PPC64 */
235 316
236 .section ".text.save.restore","ax",@progbits 317 .section ".text.save.restore","ax",@progbits
@@ -356,6 +437,111 @@ _restgpr0_31:
356 mtlr r0 437 mtlr r0
357 blr 438 blr
358 439
440#ifdef CONFIG_ALTIVEC
441/* Called with r0 pointing just beyond the end of the vector save area. */
442
443.globl _savevr_20
444_savevr_20:
445 li r12,-192
446 stvx vr20,r12,r0
447.globl _savevr_21
448_savevr_21:
449 li r12,-176
450 stvx vr21,r12,r0
451.globl _savevr_22
452_savevr_22:
453 li r12,-160
454 stvx vr22,r12,r0
455.globl _savevr_23
456_savevr_23:
457 li r12,-144
458 stvx vr23,r12,r0
459.globl _savevr_24
460_savevr_24:
461 li r12,-128
462 stvx vr24,r12,r0
463.globl _savevr_25
464_savevr_25:
465 li r12,-112
466 stvx vr25,r12,r0
467.globl _savevr_26
468_savevr_26:
469 li r12,-96
470 stvx vr26,r12,r0
471.globl _savevr_27
472_savevr_27:
473 li r12,-80
474 stvx vr27,r12,r0
475.globl _savevr_28
476_savevr_28:
477 li r12,-64
478 stvx vr28,r12,r0
479.globl _savevr_29
480_savevr_29:
481 li r12,-48
482 stvx vr29,r12,r0
483.globl _savevr_30
484_savevr_30:
485 li r12,-32
486 stvx vr30,r12,r0
487.globl _savevr_31
488_savevr_31:
489 li r12,-16
490 stvx vr31,r12,r0
491 blr
492
493.globl _restvr_20
494_restvr_20:
495 li r12,-192
496 lvx vr20,r12,r0
497.globl _restvr_21
498_restvr_21:
499 li r12,-176
500 lvx vr21,r12,r0
501.globl _restvr_22
502_restvr_22:
503 li r12,-160
504 lvx vr22,r12,r0
505.globl _restvr_23
506_restvr_23:
507 li r12,-144
508 lvx vr23,r12,r0
509.globl _restvr_24
510_restvr_24:
511 li r12,-128
512 lvx vr24,r12,r0
513.globl _restvr_25
514_restvr_25:
515 li r12,-112
516 lvx vr25,r12,r0
517.globl _restvr_26
518_restvr_26:
519 li r12,-96
520 lvx vr26,r12,r0
521.globl _restvr_27
522_restvr_27:
523 li r12,-80
524 lvx vr27,r12,r0
525.globl _restvr_28
526_restvr_28:
527 li r12,-64
528 lvx vr28,r12,r0
529.globl _restvr_29
530_restvr_29:
531 li r12,-48
532 lvx vr29,r12,r0
533.globl _restvr_30
534_restvr_30:
535 li r12,-32
536 lvx vr30,r12,r0
537.globl _restvr_31
538_restvr_31:
539 li r12,-16
540 lvx vr31,r12,r0
541 blr
542
543#endif /* CONFIG_ALTIVEC */
544
359#endif /* CONFIG_PPC64 */ 545#endif /* CONFIG_PPC64 */
360 546
361#endif 547#endif
diff --git a/arch/powerpc/math-emu/math_efp.c b/arch/powerpc/math-emu/math_efp.c
index a73f0884d358..28337c9709ae 100644
--- a/arch/powerpc/math-emu/math_efp.c
+++ b/arch/powerpc/math-emu/math_efp.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/prctl.h>
23 24
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/reg.h> 26#include <asm/reg.h>
@@ -275,21 +276,13 @@ int do_spe_mathemu(struct pt_regs *regs)
275 276
276 case EFSCTSF: 277 case EFSCTSF:
277 case EFSCTUF: 278 case EFSCTUF:
278 if (!((vb.wp[1] >> 23) == 0xff && ((vb.wp[1] & 0x7fffff) > 0))) { 279 if (SB_c == FP_CLS_NAN) {
279 /* NaN */ 280 vc.wp[1] = 0;
280 if (((vb.wp[1] >> 23) & 0xff) == 0) { 281 FP_SET_EXCEPTION(FP_EX_INVALID);
281 /* denorm */ 282 } else {
282 vc.wp[1] = 0x0; 283 SB_e += (func == EFSCTSF ? 31 : 32);
283 } else if ((vb.wp[1] >> 31) == 0) { 284 FP_TO_INT_ROUND_S(vc.wp[1], SB, 32,
284 /* positive normal */ 285 (func == EFSCTSF));
285 vc.wp[1] = (func == EFSCTSF) ?
286 0x7fffffff : 0xffffffff;
287 } else { /* negative normal */
288 vc.wp[1] = (func == EFSCTSF) ?
289 0x80000000 : 0x0;
290 }
291 } else { /* rB is NaN */
292 vc.wp[1] = 0x0;
293 } 286 }
294 goto update_regs; 287 goto update_regs;
295 288
@@ -306,16 +299,25 @@ int do_spe_mathemu(struct pt_regs *regs)
306 } 299 }
307 300
308 case EFSCTSI: 301 case EFSCTSI:
309 case EFSCTSIZ:
310 case EFSCTUI: 302 case EFSCTUI:
303 if (SB_c == FP_CLS_NAN) {
304 vc.wp[1] = 0;
305 FP_SET_EXCEPTION(FP_EX_INVALID);
306 } else {
307 FP_TO_INT_ROUND_S(vc.wp[1], SB, 32,
308 ((func & 0x3) != 0));
309 }
310 goto update_regs;
311
312 case EFSCTSIZ:
311 case EFSCTUIZ: 313 case EFSCTUIZ:
312 if (func & 0x4) { 314 if (SB_c == FP_CLS_NAN) {
313 _FP_ROUND(1, SB); 315 vc.wp[1] = 0;
316 FP_SET_EXCEPTION(FP_EX_INVALID);
314 } else { 317 } else {
315 _FP_ROUND_ZERO(1, SB); 318 FP_TO_INT_S(vc.wp[1], SB, 32,
319 ((func & 0x3) != 0));
316 } 320 }
317 FP_TO_INT_S(vc.wp[1], SB, 32,
318 (((func & 0x3) != 0) || SB_s));
319 goto update_regs; 321 goto update_regs;
320 322
321 default: 323 default:
@@ -404,22 +406,13 @@ cmp_s:
404 406
405 case EFDCTSF: 407 case EFDCTSF:
406 case EFDCTUF: 408 case EFDCTUF:
407 if (!((vb.wp[0] >> 20) == 0x7ff && 409 if (DB_c == FP_CLS_NAN) {
408 ((vb.wp[0] & 0xfffff) > 0 || (vb.wp[1] > 0)))) { 410 vc.wp[1] = 0;
409 /* not a NaN */ 411 FP_SET_EXCEPTION(FP_EX_INVALID);
410 if (((vb.wp[0] >> 20) & 0x7ff) == 0) { 412 } else {
411 /* denorm */ 413 DB_e += (func == EFDCTSF ? 31 : 32);
412 vc.wp[1] = 0x0; 414 FP_TO_INT_ROUND_D(vc.wp[1], DB, 32,
413 } else if ((vb.wp[0] >> 31) == 0) { 415 (func == EFDCTSF));
414 /* positive normal */
415 vc.wp[1] = (func == EFDCTSF) ?
416 0x7fffffff : 0xffffffff;
417 } else { /* negative normal */
418 vc.wp[1] = (func == EFDCTSF) ?
419 0x80000000 : 0x0;
420 }
421 } else { /* NaN */
422 vc.wp[1] = 0x0;
423 } 416 }
424 goto update_regs; 417 goto update_regs;
425 418
@@ -437,21 +430,35 @@ cmp_s:
437 430
438 case EFDCTUIDZ: 431 case EFDCTUIDZ:
439 case EFDCTSIDZ: 432 case EFDCTSIDZ:
440 _FP_ROUND_ZERO(2, DB); 433 if (DB_c == FP_CLS_NAN) {
441 FP_TO_INT_D(vc.dp[0], DB, 64, ((func & 0x1) == 0)); 434 vc.dp[0] = 0;
435 FP_SET_EXCEPTION(FP_EX_INVALID);
436 } else {
437 FP_TO_INT_D(vc.dp[0], DB, 64,
438 ((func & 0x1) == 0));
439 }
442 goto update_regs; 440 goto update_regs;
443 441
444 case EFDCTUI: 442 case EFDCTUI:
445 case EFDCTSI: 443 case EFDCTSI:
444 if (DB_c == FP_CLS_NAN) {
445 vc.wp[1] = 0;
446 FP_SET_EXCEPTION(FP_EX_INVALID);
447 } else {
448 FP_TO_INT_ROUND_D(vc.wp[1], DB, 32,
449 ((func & 0x3) != 0));
450 }
451 goto update_regs;
452
446 case EFDCTUIZ: 453 case EFDCTUIZ:
447 case EFDCTSIZ: 454 case EFDCTSIZ:
448 if (func & 0x4) { 455 if (DB_c == FP_CLS_NAN) {
449 _FP_ROUND(2, DB); 456 vc.wp[1] = 0;
457 FP_SET_EXCEPTION(FP_EX_INVALID);
450 } else { 458 } else {
451 _FP_ROUND_ZERO(2, DB); 459 FP_TO_INT_D(vc.wp[1], DB, 32,
460 ((func & 0x3) != 0));
452 } 461 }
453 FP_TO_INT_D(vc.wp[1], DB, 32,
454 (((func & 0x3) != 0) || DB_s));
455 goto update_regs; 462 goto update_regs;
456 463
457 default: 464 default:
@@ -556,37 +563,60 @@ cmp_d:
556 cmp = -1; 563 cmp = -1;
557 goto cmp_vs; 564 goto cmp_vs;
558 565
559 case EVFSCTSF:
560 __asm__ __volatile__ ("mtspr 512, %4\n"
561 "efsctsf %0, %2\n"
562 "efsctsf %1, %3\n"
563 : "=r" (vc.wp[0]), "=r" (vc.wp[1])
564 : "r" (vb.wp[0]), "r" (vb.wp[1]), "r" (0));
565 goto update_regs;
566
567 case EVFSCTUF: 566 case EVFSCTUF:
568 __asm__ __volatile__ ("mtspr 512, %4\n" 567 case EVFSCTSF:
569 "efsctuf %0, %2\n" 568 if (SB0_c == FP_CLS_NAN) {
570 "efsctuf %1, %3\n" 569 vc.wp[0] = 0;
571 : "=r" (vc.wp[0]), "=r" (vc.wp[1]) 570 FP_SET_EXCEPTION(FP_EX_INVALID);
572 : "r" (vb.wp[0]), "r" (vb.wp[1]), "r" (0)); 571 } else {
572 SB0_e += (func == EVFSCTSF ? 31 : 32);
573 FP_TO_INT_ROUND_S(vc.wp[0], SB0, 32,
574 (func == EVFSCTSF));
575 }
576 if (SB1_c == FP_CLS_NAN) {
577 vc.wp[1] = 0;
578 FP_SET_EXCEPTION(FP_EX_INVALID);
579 } else {
580 SB1_e += (func == EVFSCTSF ? 31 : 32);
581 FP_TO_INT_ROUND_S(vc.wp[1], SB1, 32,
582 (func == EVFSCTSF));
583 }
573 goto update_regs; 584 goto update_regs;
574 585
575 case EVFSCTUI: 586 case EVFSCTUI:
576 case EVFSCTSI: 587 case EVFSCTSI:
588 if (SB0_c == FP_CLS_NAN) {
589 vc.wp[0] = 0;
590 FP_SET_EXCEPTION(FP_EX_INVALID);
591 } else {
592 FP_TO_INT_ROUND_S(vc.wp[0], SB0, 32,
593 ((func & 0x3) != 0));
594 }
595 if (SB1_c == FP_CLS_NAN) {
596 vc.wp[1] = 0;
597 FP_SET_EXCEPTION(FP_EX_INVALID);
598 } else {
599 FP_TO_INT_ROUND_S(vc.wp[1], SB1, 32,
600 ((func & 0x3) != 0));
601 }
602 goto update_regs;
603
577 case EVFSCTUIZ: 604 case EVFSCTUIZ:
578 case EVFSCTSIZ: 605 case EVFSCTSIZ:
579 if (func & 0x4) { 606 if (SB0_c == FP_CLS_NAN) {
580 _FP_ROUND(1, SB0); 607 vc.wp[0] = 0;
581 _FP_ROUND(1, SB1); 608 FP_SET_EXCEPTION(FP_EX_INVALID);
582 } else { 609 } else {
583 _FP_ROUND_ZERO(1, SB0); 610 FP_TO_INT_S(vc.wp[0], SB0, 32,
584 _FP_ROUND_ZERO(1, SB1); 611 ((func & 0x3) != 0));
612 }
613 if (SB1_c == FP_CLS_NAN) {
614 vc.wp[1] = 0;
615 FP_SET_EXCEPTION(FP_EX_INVALID);
616 } else {
617 FP_TO_INT_S(vc.wp[1], SB1, 32,
618 ((func & 0x3) != 0));
585 } 619 }
586 FP_TO_INT_S(vc.wp[0], SB0, 32,
587 (((func & 0x3) != 0) || SB0_s));
588 FP_TO_INT_S(vc.wp[1], SB1, 32,
589 (((func & 0x3) != 0) || SB1_s));
590 goto update_regs; 620 goto update_regs;
591 621
592 default: 622 default:
@@ -630,9 +660,27 @@ update_ccr:
630 regs->ccr |= (IR << ((7 - ((speinsn >> 23) & 0x7)) << 2)); 660 regs->ccr |= (IR << ((7 - ((speinsn >> 23) & 0x7)) << 2));
631 661
632update_regs: 662update_regs:
633 __FPU_FPSCR &= ~FP_EX_MASK; 663 /*
664 * If the "invalid" exception sticky bit was set by the
665 * processor for non-finite input, but was not set before the
666 * instruction being emulated, clear it. Likewise for the
667 * "underflow" bit, which may have been set by the processor
668 * for exact underflow, not just inexact underflow when the
669 * flag should be set for IEEE 754 semantics. Other sticky
670 * exceptions will only be set by the processor when they are
671 * correct according to IEEE 754 semantics, and we must not
672 * clear sticky bits that were already set before the emulated
673 * instruction as they represent the user-visible sticky
674 * exception status. "inexact" traps to kernel are not
675 * required for IEEE semantics and are not enabled by default,
676 * so the "inexact" sticky bit may have been set by a previous
677 * instruction without the kernel being aware of it.
678 */
679 __FPU_FPSCR
680 &= ~(FP_EX_INVALID | FP_EX_UNDERFLOW) | current->thread.spefscr_last;
634 __FPU_FPSCR |= (FP_CUR_EXCEPTIONS & FP_EX_MASK); 681 __FPU_FPSCR |= (FP_CUR_EXCEPTIONS & FP_EX_MASK);
635 mtspr(SPRN_SPEFSCR, __FPU_FPSCR); 682 mtspr(SPRN_SPEFSCR, __FPU_FPSCR);
683 current->thread.spefscr_last = __FPU_FPSCR;
636 684
637 current->thread.evr[fc] = vc.wp[0]; 685 current->thread.evr[fc] = vc.wp[0];
638 regs->gpr[fc] = vc.wp[1]; 686 regs->gpr[fc] = vc.wp[1];
@@ -644,6 +692,23 @@ update_regs:
644 pr_debug("va: %08x %08x\n", va.wp[0], va.wp[1]); 692 pr_debug("va: %08x %08x\n", va.wp[0], va.wp[1]);
645 pr_debug("vb: %08x %08x\n", vb.wp[0], vb.wp[1]); 693 pr_debug("vb: %08x %08x\n", vb.wp[0], vb.wp[1]);
646 694
695 if (current->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) {
696 if ((FP_CUR_EXCEPTIONS & FP_EX_DIVZERO)
697 && (current->thread.fpexc_mode & PR_FP_EXC_DIV))
698 return 1;
699 if ((FP_CUR_EXCEPTIONS & FP_EX_OVERFLOW)
700 && (current->thread.fpexc_mode & PR_FP_EXC_OVF))
701 return 1;
702 if ((FP_CUR_EXCEPTIONS & FP_EX_UNDERFLOW)
703 && (current->thread.fpexc_mode & PR_FP_EXC_UND))
704 return 1;
705 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT)
706 && (current->thread.fpexc_mode & PR_FP_EXC_RES))
707 return 1;
708 if ((FP_CUR_EXCEPTIONS & FP_EX_INVALID)
709 && (current->thread.fpexc_mode & PR_FP_EXC_INV))
710 return 1;
711 }
647 return 0; 712 return 0;
648 713
649illegal: 714illegal:
@@ -662,21 +727,28 @@ int speround_handler(struct pt_regs *regs)
662{ 727{
663 union dw_union fgpr; 728 union dw_union fgpr;
664 int s_lo, s_hi; 729 int s_lo, s_hi;
665 unsigned long speinsn, type, fc; 730 int lo_inexact, hi_inexact;
731 int fp_result;
732 unsigned long speinsn, type, fb, fc, fptype, func;
666 733
667 if (get_user(speinsn, (unsigned int __user *) regs->nip)) 734 if (get_user(speinsn, (unsigned int __user *) regs->nip))
668 return -EFAULT; 735 return -EFAULT;
669 if ((speinsn >> 26) != 4) 736 if ((speinsn >> 26) != 4)
670 return -EINVAL; /* not an spe instruction */ 737 return -EINVAL; /* not an spe instruction */
671 738
672 type = insn_type(speinsn & 0x7ff); 739 func = speinsn & 0x7ff;
740 type = insn_type(func);
673 if (type == XCR) return -ENOSYS; 741 if (type == XCR) return -ENOSYS;
674 742
675 __FPU_FPSCR = mfspr(SPRN_SPEFSCR); 743 __FPU_FPSCR = mfspr(SPRN_SPEFSCR);
676 pr_debug("speinsn:%08lx spefscr:%08lx\n", speinsn, __FPU_FPSCR); 744 pr_debug("speinsn:%08lx spefscr:%08lx\n", speinsn, __FPU_FPSCR);
677 745
746 fptype = (speinsn >> 5) & 0x7;
747
678 /* No need to round if the result is exact */ 748 /* No need to round if the result is exact */
679 if (!(__FPU_FPSCR & FP_EX_INEXACT)) 749 lo_inexact = __FPU_FPSCR & (SPEFSCR_FG | SPEFSCR_FX);
750 hi_inexact = __FPU_FPSCR & (SPEFSCR_FGH | SPEFSCR_FXH);
751 if (!(lo_inexact || (hi_inexact && fptype == VCT)))
680 return 0; 752 return 0;
681 753
682 fc = (speinsn >> 21) & 0x1f; 754 fc = (speinsn >> 21) & 0x1f;
@@ -685,9 +757,68 @@ int speround_handler(struct pt_regs *regs)
685 fgpr.wp[0] = current->thread.evr[fc]; 757 fgpr.wp[0] = current->thread.evr[fc];
686 fgpr.wp[1] = regs->gpr[fc]; 758 fgpr.wp[1] = regs->gpr[fc];
687 759
760 fb = (speinsn >> 11) & 0x1f;
761 switch (func) {
762 case EFSCTUIZ:
763 case EFSCTSIZ:
764 case EVFSCTUIZ:
765 case EVFSCTSIZ:
766 case EFDCTUIDZ:
767 case EFDCTSIDZ:
768 case EFDCTUIZ:
769 case EFDCTSIZ:
770 /*
771 * These instructions always round to zero,
772 * independent of the rounding mode.
773 */
774 return 0;
775
776 case EFSCTUI:
777 case EFSCTUF:
778 case EVFSCTUI:
779 case EVFSCTUF:
780 case EFDCTUI:
781 case EFDCTUF:
782 fp_result = 0;
783 s_lo = 0;
784 s_hi = 0;
785 break;
786
787 case EFSCTSI:
788 case EFSCTSF:
789 fp_result = 0;
790 /* Recover the sign of a zero result if possible. */
791 if (fgpr.wp[1] == 0)
792 s_lo = regs->gpr[fb] & SIGN_BIT_S;
793 break;
794
795 case EVFSCTSI:
796 case EVFSCTSF:
797 fp_result = 0;
798 /* Recover the sign of a zero result if possible. */
799 if (fgpr.wp[1] == 0)
800 s_lo = regs->gpr[fb] & SIGN_BIT_S;
801 if (fgpr.wp[0] == 0)
802 s_hi = current->thread.evr[fb] & SIGN_BIT_S;
803 break;
804
805 case EFDCTSI:
806 case EFDCTSF:
807 fp_result = 0;
808 s_hi = s_lo;
809 /* Recover the sign of a zero result if possible. */
810 if (fgpr.wp[1] == 0)
811 s_hi = current->thread.evr[fb] & SIGN_BIT_S;
812 break;
813
814 default:
815 fp_result = 1;
816 break;
817 }
818
688 pr_debug("round fgpr: %08x %08x\n", fgpr.wp[0], fgpr.wp[1]); 819 pr_debug("round fgpr: %08x %08x\n", fgpr.wp[0], fgpr.wp[1]);
689 820
690 switch ((speinsn >> 5) & 0x7) { 821 switch (fptype) {
691 /* Since SPE instructions on E500 core can handle round to nearest 822 /* Since SPE instructions on E500 core can handle round to nearest
692 * and round toward zero with IEEE-754 complied, we just need 823 * and round toward zero with IEEE-754 complied, we just need
693 * to handle round toward +Inf and round toward -Inf by software. 824 * to handle round toward +Inf and round toward -Inf by software.
@@ -696,25 +827,52 @@ int speround_handler(struct pt_regs *regs)
696 if ((FP_ROUNDMODE) == FP_RND_PINF) { 827 if ((FP_ROUNDMODE) == FP_RND_PINF) {
697 if (!s_lo) fgpr.wp[1]++; /* Z > 0, choose Z1 */ 828 if (!s_lo) fgpr.wp[1]++; /* Z > 0, choose Z1 */
698 } else { /* round to -Inf */ 829 } else { /* round to -Inf */
699 if (s_lo) fgpr.wp[1]++; /* Z < 0, choose Z2 */ 830 if (s_lo) {
831 if (fp_result)
832 fgpr.wp[1]++; /* Z < 0, choose Z2 */
833 else
834 fgpr.wp[1]--; /* Z < 0, choose Z2 */
835 }
700 } 836 }
701 break; 837 break;
702 838
703 case DPFP: 839 case DPFP:
704 if (FP_ROUNDMODE == FP_RND_PINF) { 840 if (FP_ROUNDMODE == FP_RND_PINF) {
705 if (!s_hi) fgpr.dp[0]++; /* Z > 0, choose Z1 */ 841 if (!s_hi) {
842 if (fp_result)
843 fgpr.dp[0]++; /* Z > 0, choose Z1 */
844 else
845 fgpr.wp[1]++; /* Z > 0, choose Z1 */
846 }
706 } else { /* round to -Inf */ 847 } else { /* round to -Inf */
707 if (s_hi) fgpr.dp[0]++; /* Z < 0, choose Z2 */ 848 if (s_hi) {
849 if (fp_result)
850 fgpr.dp[0]++; /* Z < 0, choose Z2 */
851 else
852 fgpr.wp[1]--; /* Z < 0, choose Z2 */
853 }
708 } 854 }
709 break; 855 break;
710 856
711 case VCT: 857 case VCT:
712 if (FP_ROUNDMODE == FP_RND_PINF) { 858 if (FP_ROUNDMODE == FP_RND_PINF) {
713 if (!s_lo) fgpr.wp[1]++; /* Z_low > 0, choose Z1 */ 859 if (lo_inexact && !s_lo)
714 if (!s_hi) fgpr.wp[0]++; /* Z_high word > 0, choose Z1 */ 860 fgpr.wp[1]++; /* Z_low > 0, choose Z1 */
861 if (hi_inexact && !s_hi)
862 fgpr.wp[0]++; /* Z_high word > 0, choose Z1 */
715 } else { /* round to -Inf */ 863 } else { /* round to -Inf */
716 if (s_lo) fgpr.wp[1]++; /* Z_low < 0, choose Z2 */ 864 if (lo_inexact && s_lo) {
717 if (s_hi) fgpr.wp[0]++; /* Z_high < 0, choose Z2 */ 865 if (fp_result)
866 fgpr.wp[1]++; /* Z_low < 0, choose Z2 */
867 else
868 fgpr.wp[1]--; /* Z_low < 0, choose Z2 */
869 }
870 if (hi_inexact && s_hi) {
871 if (fp_result)
872 fgpr.wp[0]++; /* Z_high < 0, choose Z2 */
873 else
874 fgpr.wp[0]--; /* Z_high < 0, choose Z2 */
875 }
718 } 876 }
719 break; 877 break;
720 878
@@ -727,6 +885,8 @@ int speround_handler(struct pt_regs *regs)
727 885
728 pr_debug(" to fgpr: %08x %08x\n", fgpr.wp[0], fgpr.wp[1]); 886 pr_debug(" to fgpr: %08x %08x\n", fgpr.wp[0], fgpr.wp[1]);
729 887
888 if (current->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE)
889 return (current->thread.fpexc_mode & PR_FP_EXC_RES) ? 1 : 0;
730 return 0; 890 return 0;
731} 891}
732 892
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 07ba45b0f07c..94cd728166d3 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -52,6 +52,7 @@
52#include <asm/smp.h> 52#include <asm/smp.h>
53#include <asm/machdep.h> 53#include <asm/machdep.h>
54#include <asm/setup.h> 54#include <asm/setup.h>
55#include <asm/paca.h>
55 56
56#include "mmu_decl.h" 57#include "mmu_decl.h"
57 58
@@ -171,11 +172,10 @@ unsigned long calc_cam_sz(unsigned long ram, unsigned long virt,
171 return 1UL << camsize; 172 return 1UL << camsize;
172} 173}
173 174
174unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx) 175static unsigned long map_mem_in_cams_addr(phys_addr_t phys, unsigned long virt,
176 unsigned long ram, int max_cam_idx)
175{ 177{
176 int i; 178 int i;
177 unsigned long virt = PAGE_OFFSET;
178 phys_addr_t phys = memstart_addr;
179 unsigned long amount_mapped = 0; 179 unsigned long amount_mapped = 0;
180 180
181 /* Calculate CAM values */ 181 /* Calculate CAM values */
@@ -192,9 +192,23 @@ unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx)
192 } 192 }
193 tlbcam_index = i; 193 tlbcam_index = i;
194 194
195#ifdef CONFIG_PPC64
196 get_paca()->tcd.esel_next = i;
197 get_paca()->tcd.esel_max = mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY;
198 get_paca()->tcd.esel_first = i;
199#endif
200
195 return amount_mapped; 201 return amount_mapped;
196} 202}
197 203
204unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx)
205{
206 unsigned long virt = PAGE_OFFSET;
207 phys_addr_t phys = memstart_addr;
208
209 return map_mem_in_cams_addr(phys, virt, ram, max_cam_idx);
210}
211
198#ifdef CONFIG_PPC32 212#ifdef CONFIG_PPC32
199 213
200#if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS) 214#if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS)
@@ -222,7 +236,9 @@ void __init adjust_total_lowmem(void)
222 /* adjust lowmem size to __max_low_memory */ 236 /* adjust lowmem size to __max_low_memory */
223 ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem); 237 ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem);
224 238
239 i = switch_to_as1();
225 __max_low_memory = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM); 240 __max_low_memory = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM);
241 restore_to_as0(i, 0, 0, 1);
226 242
227 pr_info("Memory CAM mapping: "); 243 pr_info("Memory CAM mapping: ");
228 for (i = 0; i < tlbcam_index - 1; i++) 244 for (i = 0; i < tlbcam_index - 1; i++)
@@ -241,4 +257,62 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
241 /* 64M mapped initially according to head_fsl_booke.S */ 257 /* 64M mapped initially according to head_fsl_booke.S */
242 memblock_set_current_limit(min_t(u64, limit, 0x04000000)); 258 memblock_set_current_limit(min_t(u64, limit, 0x04000000));
243} 259}
260
261#ifdef CONFIG_RELOCATABLE
262int __initdata is_second_reloc;
263notrace void __init relocate_init(u64 dt_ptr, phys_addr_t start)
264{
265 unsigned long base = KERNELBASE;
266
267 kernstart_addr = start;
268 if (is_second_reloc) {
269 virt_phys_offset = PAGE_OFFSET - memstart_addr;
270 return;
271 }
272
273 /*
274 * Relocatable kernel support based on processing of dynamic
275 * relocation entries. Before we get the real memstart_addr,
276 * We will compute the virt_phys_offset like this:
277 * virt_phys_offset = stext.run - kernstart_addr
278 *
279 * stext.run = (KERNELBASE & ~0x3ffffff) +
280 * (kernstart_addr & 0x3ffffff)
281 * When we relocate, we have :
282 *
283 * (kernstart_addr & 0x3ffffff) = (stext.run & 0x3ffffff)
284 *
285 * hence:
286 * virt_phys_offset = (KERNELBASE & ~0x3ffffff) -
287 * (kernstart_addr & ~0x3ffffff)
288 *
289 */
290 start &= ~0x3ffffff;
291 base &= ~0x3ffffff;
292 virt_phys_offset = base - start;
293 early_get_first_memblock_info(__va(dt_ptr), NULL);
294 /*
295 * We now get the memstart_addr, then we should check if this
296 * address is the same as what the PAGE_OFFSET map to now. If
297 * not we have to change the map of PAGE_OFFSET to memstart_addr
298 * and do a second relocation.
299 */
300 if (start != memstart_addr) {
301 int n;
302 long offset = start - memstart_addr;
303
304 is_second_reloc = 1;
305 n = switch_to_as1();
306 /* map a 64M area for the second relocation */
307 if (memstart_addr > start)
308 map_mem_in_cams(0x4000000, CONFIG_LOWMEM_CAM_NUM);
309 else
310 map_mem_in_cams_addr(start, PAGE_OFFSET + offset,
311 0x4000000, CONFIG_LOWMEM_CAM_NUM);
312 restore_to_as0(n, offset, __va(dt_ptr), 1);
313 /* We should never reach here */
314 panic("Relocation error");
315 }
316}
317#endif
244#endif 318#endif
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index d3cbda62857b..1136d26a95ae 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -148,7 +148,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
148 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/ 148 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
149 andc r0,r30,r0 /* r0 = pte & ~r0 */ 149 andc r0,r30,r0 /* r0 = pte & ~r0 */
150 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */ 150 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
151 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */ 151 /*
152 * Always add "C" bit for perf. Memory coherence is always enabled
153 */
154 ori r3,r3,HPTE_R_C | HPTE_R_M
152 155
153 /* We eventually do the icache sync here (maybe inline that 156 /* We eventually do the icache sync here (maybe inline that
154 * code rather than call a C function...) 157 * code rather than call a C function...)
@@ -457,7 +460,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
457 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/ 460 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
458 andc r0,r3,r0 /* r0 = pte & ~r0 */ 461 andc r0,r3,r0 /* r0 = pte & ~r0 */
459 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */ 462 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
460 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */ 463 /*
464 * Always add "C" bit for perf. Memory coherence is always enabled
465 */
466 ori r3,r3,HPTE_R_C | HPTE_R_M
461 467
462 /* We eventually do the icache sync here (maybe inline that 468 /* We eventually do the icache sync here (maybe inline that
463 * code rather than call a C function...) 469 * code rather than call a C function...)
@@ -795,7 +801,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
795 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/ 801 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
796 andc r0,r30,r0 /* r0 = pte & ~r0 */ 802 andc r0,r30,r0 /* r0 = pte & ~r0 */
797 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */ 803 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
798 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */ 804 /*
805 * Always add "C" bit for perf. Memory coherence is always enabled
806 */
807 ori r3,r3,HPTE_R_C | HPTE_R_M
799 808
800 /* We eventually do the icache sync here (maybe inline that 809 /* We eventually do the icache sync here (maybe inline that
801 * code rather than call a C function...) 810 * code rather than call a C function...)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 6176b3cdf579..de6881259aef 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -169,9 +169,10 @@ static unsigned long htab_convert_pte_flags(unsigned long pteflags)
169 if ((pteflags & _PAGE_USER) && !((pteflags & _PAGE_RW) && 169 if ((pteflags & _PAGE_USER) && !((pteflags & _PAGE_RW) &&
170 (pteflags & _PAGE_DIRTY))) 170 (pteflags & _PAGE_DIRTY)))
171 rflags |= 1; 171 rflags |= 1;
172 172 /*
173 /* Always add C */ 173 * Always add "C" bit for perf. Memory coherence is always enabled
174 return rflags | HPTE_R_C; 174 */
175 return rflags | HPTE_R_C | HPTE_R_M;
175} 176}
176 177
177int htab_bolt_mapping(unsigned long vstart, unsigned long vend, 178int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c
index 34de9e0cdc34..826893fcb3a7 100644
--- a/arch/powerpc/mm/hugepage-hash64.c
+++ b/arch/powerpc/mm/hugepage-hash64.c
@@ -127,7 +127,11 @@ repeat:
127 127
128 /* Add in WIMG bits */ 128 /* Add in WIMG bits */
129 rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | 129 rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
130 _PAGE_COHERENT | _PAGE_GUARDED)); 130 _PAGE_GUARDED));
131 /*
132 * enable the memory coherence always
133 */
134 rflags |= HPTE_R_M;
131 135
132 /* Insert into the hash table, primary slot */ 136 /* Insert into the hash table, primary slot */
133 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0, 137 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
diff --git a/arch/powerpc/mm/hugetlbpage-book3e.c b/arch/powerpc/mm/hugetlbpage-book3e.c
index 74551b5e41e5..5e4ee2573903 100644
--- a/arch/powerpc/mm/hugetlbpage-book3e.c
+++ b/arch/powerpc/mm/hugetlbpage-book3e.c
@@ -8,6 +8,44 @@
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/hugetlb.h> 9#include <linux/hugetlb.h>
10 10
11#ifdef CONFIG_PPC_FSL_BOOK3E
12#ifdef CONFIG_PPC64
13static inline int tlb1_next(void)
14{
15 struct paca_struct *paca = get_paca();
16 struct tlb_core_data *tcd;
17 int this, next;
18
19 tcd = paca->tcd_ptr;
20 this = tcd->esel_next;
21
22 next = this + 1;
23 if (next >= tcd->esel_max)
24 next = tcd->esel_first;
25
26 tcd->esel_next = next;
27 return this;
28}
29#else
30static inline int tlb1_next(void)
31{
32 int index, ncams;
33
34 ncams = mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY;
35
36 index = __get_cpu_var(next_tlbcam_idx);
37
38 /* Just round-robin the entries and wrap when we hit the end */
39 if (unlikely(index == ncams - 1))
40 __get_cpu_var(next_tlbcam_idx) = tlbcam_index;
41 else
42 __get_cpu_var(next_tlbcam_idx)++;
43
44 return index;
45}
46#endif /* !PPC64 */
47#endif /* FSL */
48
11static inline int mmu_get_tsize(int psize) 49static inline int mmu_get_tsize(int psize)
12{ 50{
13 return mmu_psize_defs[psize].enc; 51 return mmu_psize_defs[psize].enc;
@@ -47,7 +85,7 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea,
47 struct mm_struct *mm; 85 struct mm_struct *mm;
48 86
49#ifdef CONFIG_PPC_FSL_BOOK3E 87#ifdef CONFIG_PPC_FSL_BOOK3E
50 int index, ncams; 88 int index;
51#endif 89#endif
52 90
53 if (unlikely(is_kernel_addr(ea))) 91 if (unlikely(is_kernel_addr(ea)))
@@ -77,18 +115,11 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea,
77 } 115 }
78 116
79#ifdef CONFIG_PPC_FSL_BOOK3E 117#ifdef CONFIG_PPC_FSL_BOOK3E
80 ncams = mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY;
81
82 /* We have to use the CAM(TLB1) on FSL parts for hugepages */ 118 /* We have to use the CAM(TLB1) on FSL parts for hugepages */
83 index = __get_cpu_var(next_tlbcam_idx); 119 index = tlb1_next();
84 mtspr(SPRN_MAS0, MAS0_ESEL(index) | MAS0_TLBSEL(1)); 120 mtspr(SPRN_MAS0, MAS0_ESEL(index) | MAS0_TLBSEL(1));
85
86 /* Just round-robin the entries and wrap when we hit the end */
87 if (unlikely(index == ncams - 1))
88 __get_cpu_var(next_tlbcam_idx) = tlbcam_index;
89 else
90 __get_cpu_var(next_tlbcam_idx)++;
91#endif 121#endif
122
92 mas1 = MAS1_VALID | MAS1_TID(mm->context.id) | MAS1_TSIZE(tsize); 123 mas1 = MAS1_VALID | MAS1_TID(mm->context.id) | MAS1_TSIZE(tsize);
93 mas2 = ea & ~((1UL << shift) - 1); 124 mas2 = ea & ~((1UL << shift) - 1);
94 mas2 |= (pte_val(pte) >> PTE_WIMGE_SHIFT) & MAS2_WIMGE_MASK; 125 mas2 |= (pte_val(pte) >> PTE_WIMGE_SHIFT) & MAS2_WIMGE_MASK;
@@ -103,7 +134,8 @@ void book3e_hugetlb_preload(struct vm_area_struct *vma, unsigned long ea,
103 if (mmu_has_feature(MMU_FTR_USE_PAIRED_MAS)) { 134 if (mmu_has_feature(MMU_FTR_USE_PAIRED_MAS)) {
104 mtspr(SPRN_MAS7_MAS3, mas7_3); 135 mtspr(SPRN_MAS7_MAS3, mas7_3);
105 } else { 136 } else {
106 mtspr(SPRN_MAS7, upper_32_bits(mas7_3)); 137 if (mmu_has_feature(MMU_FTR_BIG_PHYS))
138 mtspr(SPRN_MAS7, upper_32_bits(mas7_3));
107 mtspr(SPRN_MAS3, lower_32_bits(mas7_3)); 139 mtspr(SPRN_MAS3, lower_32_bits(mas7_3));
108 } 140 }
109 141
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index 0b7fb6761015..a5bcf9301196 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -99,6 +99,10 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
99 /* Add in WIMG bits */ 99 /* Add in WIMG bits */
100 rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | 100 rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
101 _PAGE_COHERENT | _PAGE_GUARDED)); 101 _PAGE_COHERENT | _PAGE_GUARDED));
102 /*
103 * enable the memory coherence always
104 */
105 rflags |= HPTE_R_M;
102 106
103 slot = hpte_insert_repeating(hash, vpn, pa, rflags, 0, 107 slot = hpte_insert_repeating(hash, vpn, pa, rflags, 0,
104 mmu_psize, ssize); 108 mmu_psize, ssize);
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 90bb6d9409bf..eb923654ba80 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -472,12 +472,13 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
472{ 472{
473 struct hugepd_freelist **batchp; 473 struct hugepd_freelist **batchp;
474 474
475 batchp = &__get_cpu_var(hugepd_freelist_cur); 475 batchp = &get_cpu_var(hugepd_freelist_cur);
476 476
477 if (atomic_read(&tlb->mm->mm_users) < 2 || 477 if (atomic_read(&tlb->mm->mm_users) < 2 ||
478 cpumask_equal(mm_cpumask(tlb->mm), 478 cpumask_equal(mm_cpumask(tlb->mm),
479 cpumask_of(smp_processor_id()))) { 479 cpumask_of(smp_processor_id()))) {
480 kmem_cache_free(hugepte_cache, hugepte); 480 kmem_cache_free(hugepte_cache, hugepte);
481 put_cpu_var(hugepd_freelist_cur);
481 return; 482 return;
482 } 483 }
483 484
@@ -491,6 +492,7 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
491 call_rcu_sched(&(*batchp)->rcu, hugepd_free_rcu_callback); 492 call_rcu_sched(&(*batchp)->rcu, hugepd_free_rcu_callback);
492 *batchp = NULL; 493 *batchp = NULL;
493 } 494 }
495 put_cpu_var(hugepd_freelist_cur);
494} 496}
495#endif 497#endif
496 498
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 3fa93dc7fe75..4b5cd5c2594d 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -209,7 +209,7 @@ void __init do_init_bootmem(void)
209 /* Place all memblock_regions in the same node and merge contiguous 209 /* Place all memblock_regions in the same node and merge contiguous
210 * memblock_regions 210 * memblock_regions
211 */ 211 */
212 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 212 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
213 213
214 /* Add all physical memory to the bootmem map, mark each area 214 /* Add all physical memory to the bootmem map, mark each area
215 * present. 215 * present.
@@ -307,6 +307,12 @@ static void __init register_page_bootmem_info(void)
307 307
308void __init mem_init(void) 308void __init mem_init(void)
309{ 309{
310 /*
311 * book3s is limited to 16 page sizes due to encoding this in
312 * a 4-bit field for slices.
313 */
314 BUILD_BUG_ON(MMU_PAGE_COUNT > 16);
315
310#ifdef CONFIG_SWIOTLB 316#ifdef CONFIG_SWIOTLB
311 swiotlb_init(0); 317 swiotlb_init(0);
312#endif 318#endif
@@ -507,7 +513,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
507 * System memory should not be in /proc/iomem but various tools expect it 513 * System memory should not be in /proc/iomem but various tools expect it
508 * (eg kdump). 514 * (eg kdump).
509 */ 515 */
510static int add_system_ram_resources(void) 516static int __init add_system_ram_resources(void)
511{ 517{
512 struct memblock_region *reg; 518 struct memblock_region *reg;
513 519
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 83eb5d5f53d5..9615d82919b8 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -148,6 +148,8 @@ extern unsigned long calc_cam_sz(unsigned long ram, unsigned long virt,
148extern void MMU_init_hw(void); 148extern void MMU_init_hw(void);
149extern unsigned long mmu_mapin_ram(unsigned long top); 149extern unsigned long mmu_mapin_ram(unsigned long top);
150extern void adjust_total_lowmem(void); 150extern void adjust_total_lowmem(void);
151extern int switch_to_as1(void);
152extern void restore_to_as0(int esel, int offset, void *dt_ptr, int bootcpu);
151#endif 153#endif
152extern void loadcam_entry(unsigned int index); 154extern void loadcam_entry(unsigned int index);
153 155
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 078d3e00a616..30a42e24bf14 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -31,6 +31,8 @@
31#include <asm/sparsemem.h> 31#include <asm/sparsemem.h>
32#include <asm/prom.h> 32#include <asm/prom.h>
33#include <asm/smp.h> 33#include <asm/smp.h>
34#include <asm/cputhreads.h>
35#include <asm/topology.h>
34#include <asm/firmware.h> 36#include <asm/firmware.h>
35#include <asm/paca.h> 37#include <asm/paca.h>
36#include <asm/hvcall.h> 38#include <asm/hvcall.h>
@@ -152,9 +154,22 @@ static void __init get_node_active_region(unsigned long pfn,
152 } 154 }
153} 155}
154 156
155static void map_cpu_to_node(int cpu, int node) 157static void reset_numa_cpu_lookup_table(void)
158{
159 unsigned int cpu;
160
161 for_each_possible_cpu(cpu)
162 numa_cpu_lookup_table[cpu] = -1;
163}
164
165static void update_numa_cpu_lookup_table(unsigned int cpu, int node)
156{ 166{
157 numa_cpu_lookup_table[cpu] = node; 167 numa_cpu_lookup_table[cpu] = node;
168}
169
170static void map_cpu_to_node(int cpu, int node)
171{
172 update_numa_cpu_lookup_table(cpu, node);
158 173
159 dbg("adding cpu %d to node %d\n", cpu, node); 174 dbg("adding cpu %d to node %d\n", cpu, node);
160 175
@@ -522,11 +537,24 @@ static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
522 */ 537 */
523static int numa_setup_cpu(unsigned long lcpu) 538static int numa_setup_cpu(unsigned long lcpu)
524{ 539{
525 int nid = 0; 540 int nid;
526 struct device_node *cpu = of_get_cpu_node(lcpu, NULL); 541 struct device_node *cpu;
542
543 /*
544 * If a valid cpu-to-node mapping is already available, use it
545 * directly instead of querying the firmware, since it represents
546 * the most recent mapping notified to us by the platform (eg: VPHN).
547 */
548 if ((nid = numa_cpu_lookup_table[lcpu]) >= 0) {
549 map_cpu_to_node(lcpu, nid);
550 return nid;
551 }
552
553 cpu = of_get_cpu_node(lcpu, NULL);
527 554
528 if (!cpu) { 555 if (!cpu) {
529 WARN_ON(1); 556 WARN_ON(1);
557 nid = 0;
530 goto out; 558 goto out;
531 } 559 }
532 560
@@ -542,16 +570,38 @@ out:
542 return nid; 570 return nid;
543} 571}
544 572
573static void verify_cpu_node_mapping(int cpu, int node)
574{
575 int base, sibling, i;
576
577 /* Verify that all the threads in the core belong to the same node */
578 base = cpu_first_thread_sibling(cpu);
579
580 for (i = 0; i < threads_per_core; i++) {
581 sibling = base + i;
582
583 if (sibling == cpu || cpu_is_offline(sibling))
584 continue;
585
586 if (cpu_to_node(sibling) != node) {
587 WARN(1, "CPU thread siblings %d and %d don't belong"
588 " to the same node!\n", cpu, sibling);
589 break;
590 }
591 }
592}
593
545static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action, 594static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action,
546 void *hcpu) 595 void *hcpu)
547{ 596{
548 unsigned long lcpu = (unsigned long)hcpu; 597 unsigned long lcpu = (unsigned long)hcpu;
549 int ret = NOTIFY_DONE; 598 int ret = NOTIFY_DONE, nid;
550 599
551 switch (action) { 600 switch (action) {
552 case CPU_UP_PREPARE: 601 case CPU_UP_PREPARE:
553 case CPU_UP_PREPARE_FROZEN: 602 case CPU_UP_PREPARE_FROZEN:
554 numa_setup_cpu(lcpu); 603 nid = numa_setup_cpu(lcpu);
604 verify_cpu_node_mapping((int)lcpu, nid);
555 ret = NOTIFY_OK; 605 ret = NOTIFY_OK;
556 break; 606 break;
557#ifdef CONFIG_HOTPLUG_CPU 607#ifdef CONFIG_HOTPLUG_CPU
@@ -670,7 +720,8 @@ static void __init parse_drconf_memory(struct device_node *memory)
670 node_set_online(nid); 720 node_set_online(nid);
671 sz = numa_enforce_memory_limit(base, size); 721 sz = numa_enforce_memory_limit(base, size);
672 if (sz) 722 if (sz)
673 memblock_set_node(base, sz, nid); 723 memblock_set_node(base, sz,
724 &memblock.memory, nid);
674 } while (--ranges); 725 } while (--ranges);
675 } 726 }
676} 727}
@@ -760,7 +811,7 @@ new_range:
760 continue; 811 continue;
761 } 812 }
762 813
763 memblock_set_node(start, size, nid); 814 memblock_set_node(start, size, &memblock.memory, nid);
764 815
765 if (--ranges) 816 if (--ranges)
766 goto new_range; 817 goto new_range;
@@ -797,7 +848,8 @@ static void __init setup_nonnuma(void)
797 848
798 fake_numa_create_new_node(end_pfn, &nid); 849 fake_numa_create_new_node(end_pfn, &nid);
799 memblock_set_node(PFN_PHYS(start_pfn), 850 memblock_set_node(PFN_PHYS(start_pfn),
800 PFN_PHYS(end_pfn - start_pfn), nid); 851 PFN_PHYS(end_pfn - start_pfn),
852 &memblock.memory, nid);
801 node_set_online(nid); 853 node_set_online(nid);
802 } 854 }
803} 855}
@@ -1067,6 +1119,7 @@ void __init do_init_bootmem(void)
1067 */ 1119 */
1068 setup_node_to_cpumask_map(); 1120 setup_node_to_cpumask_map();
1069 1121
1122 reset_numa_cpu_lookup_table();
1070 register_cpu_notifier(&ppc64_numa_nb); 1123 register_cpu_notifier(&ppc64_numa_nb);
1071 cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE, 1124 cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE,
1072 (void *)(unsigned long)boot_cpuid); 1125 (void *)(unsigned long)boot_cpuid);
@@ -1445,6 +1498,33 @@ static int update_cpu_topology(void *data)
1445 return 0; 1498 return 0;
1446} 1499}
1447 1500
1501static int update_lookup_table(void *data)
1502{
1503 struct topology_update_data *update;
1504
1505 if (!data)
1506 return -EINVAL;
1507
1508 /*
1509 * Upon topology update, the numa-cpu lookup table needs to be updated
1510 * for all threads in the core, including offline CPUs, to ensure that
1511 * future hotplug operations respect the cpu-to-node associativity
1512 * properly.
1513 */
1514 for (update = data; update; update = update->next) {
1515 int nid, base, j;
1516
1517 nid = update->new_nid;
1518 base = cpu_first_thread_sibling(update->cpu);
1519
1520 for (j = 0; j < threads_per_core; j++) {
1521 update_numa_cpu_lookup_table(base + j, nid);
1522 }
1523 }
1524
1525 return 0;
1526}
1527
1448/* 1528/*
1449 * Update the node maps and sysfs entries for each cpu whose home node 1529 * Update the node maps and sysfs entries for each cpu whose home node
1450 * has changed. Returns 1 when the topology has changed, and 0 otherwise. 1530 * has changed. Returns 1 when the topology has changed, and 0 otherwise.
@@ -1513,6 +1593,14 @@ int arch_update_cpu_topology(void)
1513 1593
1514 stop_machine(update_cpu_topology, &updates[0], &updated_cpus); 1594 stop_machine(update_cpu_topology, &updates[0], &updated_cpus);
1515 1595
1596 /*
1597 * Update the numa-cpu lookup table with the new mappings, even for
1598 * offline CPUs. It is best to perform this update from the stop-
1599 * machine context.
1600 */
1601 stop_machine(update_lookup_table, &updates[0],
1602 cpumask_of(raw_smp_processor_id()));
1603
1516 for (ud = &updates[0]; ud; ud = ud->next) { 1604 for (ud = &updates[0]; ud; ud = ud->next) {
1517 unregister_cpu_under_node(ud->cpu, ud->old_nid); 1605 unregister_cpu_under_node(ud->cpu, ud->old_nid);
1518 register_cpu_under_node(ud->cpu, ud->new_nid); 1606 register_cpu_under_node(ud->cpu, ud->new_nid);
@@ -1697,7 +1785,7 @@ static const struct file_operations topology_ops = {
1697static int topology_update_init(void) 1785static int topology_update_init(void)
1698{ 1786{
1699 start_topology_update(); 1787 start_topology_update();
1700 proc_create("powerpc/topology_updates", 644, NULL, &topology_ops); 1788 proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops);
1701 1789
1702 return 0; 1790 return 0;
1703} 1791}
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 841e0d00863c..c695943a513c 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -24,7 +24,6 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/gfp.h> 25#include <linux/gfp.h>
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/init.h>
28#include <linux/percpu.h> 27#include <linux/percpu.h>
29#include <linux/hardirq.h> 28#include <linux/hardirq.h>
30#include <linux/hugetlb.h> 29#include <linux/hugetlb.h>
@@ -174,7 +173,7 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
174 pte_t pte) 173 pte_t pte)
175{ 174{
176#ifdef CONFIG_DEBUG_VM 175#ifdef CONFIG_DEBUG_VM
177 WARN_ON(pte_present(*ptep)); 176 WARN_ON(pte_val(*ptep) & _PAGE_PRESENT);
178#endif 177#endif
179 /* Note: mm->context.id might not yet have been assigned as 178 /* Note: mm->context.id might not yet have been assigned as
180 * this context might not have been activated yet when this 179 * this context might not have been activated yet when this
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 5b9601715289..343a87fa78b5 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -299,6 +299,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
299 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, 299 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT,
300 __pgprot(flags))); 300 __pgprot(flags)));
301 } 301 }
302 smp_wmb();
302 return err; 303 return err;
303} 304}
304 305
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 9d95786aa80f..65b7b65e8708 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -33,7 +33,6 @@
33#include <linux/swap.h> 33#include <linux/swap.h>
34#include <linux/stddef.h> 34#include <linux/stddef.h>
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <linux/init.h>
37#include <linux/bootmem.h> 36#include <linux/bootmem.h>
38#include <linux/memblock.h> 37#include <linux/memblock.h>
39#include <linux/slab.h> 38#include <linux/slab.h>
@@ -153,6 +152,18 @@ int map_kernel_page(unsigned long ea, unsigned long pa, int flags)
153 } 152 }
154#endif /* !CONFIG_PPC_MMU_NOHASH */ 153#endif /* !CONFIG_PPC_MMU_NOHASH */
155 } 154 }
155
156#ifdef CONFIG_PPC_BOOK3E_64
157 /*
158 * With hardware tablewalk, a sync is needed to ensure that
159 * subsequent accesses see the PTE we just wrote. Unlike userspace
160 * mappings, we can't tolerate spurious faults, so make sure
161 * the new PTE will be seen the first time.
162 */
163 mb();
164#else
165 smp_wmb();
166#endif
156 return 0; 167 return 0;
157} 168}
158 169
@@ -687,7 +698,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
687 pmd_t *pmdp, pmd_t pmd) 698 pmd_t *pmdp, pmd_t pmd)
688{ 699{
689#ifdef CONFIG_DEBUG_VM 700#ifdef CONFIG_DEBUG_VM
690 WARN_ON(!pmd_none(*pmdp)); 701 WARN_ON(pmd_val(*pmdp) & _PAGE_PRESENT);
691 assert_spin_locked(&mm->page_table_lock); 702 assert_spin_locked(&mm->page_table_lock);
692 WARN_ON(!pmd_trans_huge(pmd)); 703 WARN_ON(!pmd_trans_huge(pmd));
693#endif 704#endif
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 7ce9cf3b6988..b0c75cc15efc 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -408,7 +408,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
408 if (fixed && (addr & ((1ul << pshift) - 1))) 408 if (fixed && (addr & ((1ul << pshift) - 1)))
409 return -EINVAL; 409 return -EINVAL;
410 if (fixed && addr > (mm->task_size - len)) 410 if (fixed && addr > (mm->task_size - len))
411 return -EINVAL; 411 return -ENOMEM;
412 412
413 /* If hint, make sure it matches our alignment restrictions */ 413 /* If hint, make sure it matches our alignment restrictions */
414 if (!fixed && addr) { 414 if (!fixed && addr) {
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index 36e44b4260eb..c99f6510a0b2 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -23,7 +23,6 @@
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/init.h>
27#include <linux/percpu.h> 26#include <linux/percpu.h>
28#include <linux/hardirq.h> 27#include <linux/hardirq.h>
29#include <asm/pgalloc.h> 28#include <asm/pgalloc.h>
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index b4113bf86353..c95eb323e9ae 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -136,7 +136,7 @@ BEGIN_MMU_FTR_SECTION
136 */ 136 */
137 PPC_TLBSRX_DOT(0,R16) 137 PPC_TLBSRX_DOT(0,R16)
138 ldx r14,r14,r15 /* grab pgd entry */ 138 ldx r14,r14,r15 /* grab pgd entry */
139 beq normal_tlb_miss_done /* tlb exists already, bail */ 139 beq tlb_miss_done_bolted /* tlb exists already, bail */
140MMU_FTR_SECTION_ELSE 140MMU_FTR_SECTION_ELSE
141 ldx r14,r14,r15 /* grab pgd entry */ 141 ldx r14,r14,r15 /* grab pgd entry */
142ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV) 142ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV)
@@ -192,6 +192,7 @@ ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV)
192 mtspr SPRN_MAS7_MAS3,r15 192 mtspr SPRN_MAS7_MAS3,r15
193 tlbwe 193 tlbwe
194 194
195tlb_miss_done_bolted:
195 TLB_MISS_STATS_X(MMSTAT_TLB_MISS_NORM_OK) 196 TLB_MISS_STATS_X(MMSTAT_TLB_MISS_NORM_OK)
196 tlb_epilog_bolted 197 tlb_epilog_bolted
197 rfi 198 rfi
@@ -239,6 +240,178 @@ itlb_miss_fault_bolted:
239 beq tlb_miss_common_bolted 240 beq tlb_miss_common_bolted
240 b itlb_miss_kernel_bolted 241 b itlb_miss_kernel_bolted
241 242
243#ifdef CONFIG_PPC_FSL_BOOK3E
244/*
245 * TLB miss handling for e6500 and derivatives, using hardware tablewalk.
246 *
247 * Linear mapping is bolted: no virtual page table or nested TLB misses
248 * Indirect entries in TLB1, hardware loads resulting direct entries
249 * into TLB0
250 * No HES or NV hint on TLB1, so we need to do software round-robin
251 * No tlbsrx. so we need a spinlock, and we have to deal
252 * with MAS-damage caused by tlbsx
253 * 4K pages only
254 */
255
256 START_EXCEPTION(instruction_tlb_miss_e6500)
257 tlb_prolog_bolted BOOKE_INTERRUPT_ITLB_MISS SPRN_SRR0
258
259 ld r11,PACA_TCD_PTR(r13)
260 srdi. r15,r16,60 /* get region */
261 ori r16,r16,1
262
263 TLB_MISS_STATS_SAVE_INFO_BOLTED
264 bne tlb_miss_kernel_e6500 /* user/kernel test */
265
266 b tlb_miss_common_e6500
267
268 START_EXCEPTION(data_tlb_miss_e6500)
269 tlb_prolog_bolted BOOKE_INTERRUPT_DTLB_MISS SPRN_DEAR
270
271 ld r11,PACA_TCD_PTR(r13)
272 srdi. r15,r16,60 /* get region */
273 rldicr r16,r16,0,62
274
275 TLB_MISS_STATS_SAVE_INFO_BOLTED
276 bne tlb_miss_kernel_e6500 /* user vs kernel check */
277
278/*
279 * This is the guts of the TLB miss handler for e6500 and derivatives.
280 * We are entered with:
281 *
282 * r16 = page of faulting address (low bit 0 if data, 1 if instruction)
283 * r15 = crap (free to use)
284 * r14 = page table base
285 * r13 = PACA
286 * r11 = tlb_per_core ptr
287 * r10 = crap (free to use)
288 */
289tlb_miss_common_e6500:
290 /*
291 * Search if we already have an indirect entry for that virtual
292 * address, and if we do, bail out.
293 *
294 * MAS6:IND should be already set based on MAS4
295 */
296 addi r10,r11,TCD_LOCK
2971: lbarx r15,0,r10
298 cmpdi r15,0
299 bne 2f
300 li r15,1
301 stbcx. r15,0,r10
302 bne 1b
303 .subsection 1
3042: lbz r15,0(r10)
305 cmpdi r15,0
306 bne 2b
307 b 1b
308 .previous
309
310 mfspr r15,SPRN_MAS2
311
312 tlbsx 0,r16
313 mfspr r10,SPRN_MAS1
314 andis. r10,r10,MAS1_VALID@h
315 bne tlb_miss_done_e6500
316
317 /* Undo MAS-damage from the tlbsx */
318 mfspr r10,SPRN_MAS1
319 oris r10,r10,MAS1_VALID@h
320 mtspr SPRN_MAS1,r10
321 mtspr SPRN_MAS2,r15
322
323 /* Now, we need to walk the page tables. First check if we are in
324 * range.
325 */
326 rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4
327 bne- tlb_miss_fault_e6500
328
329 rldicl r15,r16,64-PGDIR_SHIFT+3,64-PGD_INDEX_SIZE-3
330 cmpldi cr0,r14,0
331 clrrdi r15,r15,3
332 beq- tlb_miss_fault_e6500 /* No PGDIR, bail */
333 ldx r14,r14,r15 /* grab pgd entry */
334
335 rldicl r15,r16,64-PUD_SHIFT+3,64-PUD_INDEX_SIZE-3
336 clrrdi r15,r15,3
337 cmpdi cr0,r14,0
338 bge tlb_miss_fault_e6500 /* Bad pgd entry or hugepage; bail */
339 ldx r14,r14,r15 /* grab pud entry */
340
341 rldicl r15,r16,64-PMD_SHIFT+3,64-PMD_INDEX_SIZE-3
342 clrrdi r15,r15,3
343 cmpdi cr0,r14,0
344 bge tlb_miss_fault_e6500
345 ldx r14,r14,r15 /* Grab pmd entry */
346
347 mfspr r10,SPRN_MAS0
348 cmpdi cr0,r14,0
349 bge tlb_miss_fault_e6500
350
351 /* Now we build the MAS for a 2M indirect page:
352 *
353 * MAS 0 : ESEL needs to be filled by software round-robin
354 * MAS 1 : Fully set up
355 * - PID already updated by caller if necessary
356 * - TSIZE for now is base ind page size always
357 * - TID already cleared if necessary
358 * MAS 2 : Default not 2M-aligned, need to be redone
359 * MAS 3+7 : Needs to be done
360 */
361
362 ori r14,r14,(BOOK3E_PAGESZ_4K << MAS3_SPSIZE_SHIFT)
363 mtspr SPRN_MAS7_MAS3,r14
364
365 clrrdi r15,r16,21 /* make EA 2M-aligned */
366 mtspr SPRN_MAS2,r15
367
368 lbz r15,TCD_ESEL_NEXT(r11)
369 lbz r16,TCD_ESEL_MAX(r11)
370 lbz r14,TCD_ESEL_FIRST(r11)
371 rlwimi r10,r15,16,0x00ff0000 /* insert esel_next into MAS0 */
372 addi r15,r15,1 /* increment esel_next */
373 mtspr SPRN_MAS0,r10
374 cmpw r15,r16
375 iseleq r15,r14,r15 /* if next == last use first */
376 stb r15,TCD_ESEL_NEXT(r11)
377
378 tlbwe
379
380tlb_miss_done_e6500:
381 .macro tlb_unlock_e6500
382 li r15,0
383 isync
384 stb r15,TCD_LOCK(r11)
385 .endm
386
387 tlb_unlock_e6500
388 TLB_MISS_STATS_X(MMSTAT_TLB_MISS_NORM_OK)
389 tlb_epilog_bolted
390 rfi
391
392tlb_miss_kernel_e6500:
393 mfspr r10,SPRN_MAS1
394 ld r14,PACA_KERNELPGD(r13)
395 cmpldi cr0,r15,8 /* Check for vmalloc region */
396 rlwinm r10,r10,0,16,1 /* Clear TID */
397 mtspr SPRN_MAS1,r10
398 beq+ tlb_miss_common_e6500
399
400tlb_miss_fault_e6500:
401 tlb_unlock_e6500
402 /* We need to check if it was an instruction miss */
403 andi. r16,r16,1
404 bne itlb_miss_fault_e6500
405dtlb_miss_fault_e6500:
406 TLB_MISS_STATS_D(MMSTAT_TLB_MISS_NORM_FAULT)
407 tlb_epilog_bolted
408 b exc_data_storage_book3e
409itlb_miss_fault_e6500:
410 TLB_MISS_STATS_I(MMSTAT_TLB_MISS_NORM_FAULT)
411 tlb_epilog_bolted
412 b exc_instruction_storage_book3e
413#endif /* CONFIG_PPC_FSL_BOOK3E */
414
242/********************************************************************** 415/**********************************************************************
243 * * 416 * *
244 * TLB miss handling for Book3E with TLB reservation and HES support * 417 * TLB miss handling for Book3E with TLB reservation and HES support *
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 358d74303138..b37a58e1c92d 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -43,6 +43,7 @@
43#include <asm/tlb.h> 43#include <asm/tlb.h>
44#include <asm/code-patching.h> 44#include <asm/code-patching.h>
45#include <asm/hugetlb.h> 45#include <asm/hugetlb.h>
46#include <asm/paca.h>
46 47
47#include "mmu_decl.h" 48#include "mmu_decl.h"
48 49
@@ -58,6 +59,10 @@ struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = {
58 .shift = 12, 59 .shift = 12,
59 .enc = BOOK3E_PAGESZ_4K, 60 .enc = BOOK3E_PAGESZ_4K,
60 }, 61 },
62 [MMU_PAGE_2M] = {
63 .shift = 21,
64 .enc = BOOK3E_PAGESZ_2M,
65 },
61 [MMU_PAGE_4M] = { 66 [MMU_PAGE_4M] = {
62 .shift = 22, 67 .shift = 22,
63 .enc = BOOK3E_PAGESZ_4M, 68 .enc = BOOK3E_PAGESZ_4M,
@@ -136,7 +141,7 @@ static inline int mmu_get_tsize(int psize)
136int mmu_linear_psize; /* Page size used for the linear mapping */ 141int mmu_linear_psize; /* Page size used for the linear mapping */
137int mmu_pte_psize; /* Page size used for PTE pages */ 142int mmu_pte_psize; /* Page size used for PTE pages */
138int mmu_vmemmap_psize; /* Page size used for the virtual mem map */ 143int mmu_vmemmap_psize; /* Page size used for the virtual mem map */
139int book3e_htw_enabled; /* Is HW tablewalk enabled ? */ 144int book3e_htw_mode; /* HW tablewalk? Value is PPC_HTW_* */
140unsigned long linear_map_top; /* Top of linear mapping */ 145unsigned long linear_map_top; /* Top of linear mapping */
141 146
142#endif /* CONFIG_PPC64 */ 147#endif /* CONFIG_PPC64 */
@@ -377,7 +382,7 @@ void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address)
377{ 382{
378 int tsize = mmu_psize_defs[mmu_pte_psize].enc; 383 int tsize = mmu_psize_defs[mmu_pte_psize].enc;
379 384
380 if (book3e_htw_enabled) { 385 if (book3e_htw_mode != PPC_HTW_NONE) {
381 unsigned long start = address & PMD_MASK; 386 unsigned long start = address & PMD_MASK;
382 unsigned long end = address + PMD_SIZE; 387 unsigned long end = address + PMD_SIZE;
383 unsigned long size = 1UL << mmu_psize_defs[mmu_pte_psize].shift; 388 unsigned long size = 1UL << mmu_psize_defs[mmu_pte_psize].shift;
@@ -430,7 +435,7 @@ static void setup_page_sizes(void)
430 def = &mmu_psize_defs[psize]; 435 def = &mmu_psize_defs[psize];
431 shift = def->shift; 436 shift = def->shift;
432 437
433 if (shift == 0) 438 if (shift == 0 || shift & 1)
434 continue; 439 continue;
435 440
436 /* adjust to be in terms of 4^shift Kb */ 441 /* adjust to be in terms of 4^shift Kb */
@@ -440,21 +445,40 @@ static void setup_page_sizes(void)
440 def->flags |= MMU_PAGE_SIZE_DIRECT; 445 def->flags |= MMU_PAGE_SIZE_DIRECT;
441 } 446 }
442 447
443 goto no_indirect; 448 goto out;
444 } 449 }
445 450
446 if (fsl_mmu && (mmucfg & MMUCFG_MAVN) == MMUCFG_MAVN_V2) { 451 if (fsl_mmu && (mmucfg & MMUCFG_MAVN) == MMUCFG_MAVN_V2) {
447 u32 tlb1ps = mfspr(SPRN_TLB1PS); 452 u32 tlb1cfg, tlb1ps;
453
454 tlb0cfg = mfspr(SPRN_TLB0CFG);
455 tlb1cfg = mfspr(SPRN_TLB1CFG);
456 tlb1ps = mfspr(SPRN_TLB1PS);
457 eptcfg = mfspr(SPRN_EPTCFG);
458
459 if ((tlb1cfg & TLBnCFG_IND) && (tlb0cfg & TLBnCFG_PT))
460 book3e_htw_mode = PPC_HTW_E6500;
461
462 /*
463 * We expect 4K subpage size and unrestricted indirect size.
464 * The lack of a restriction on indirect size is a Freescale
465 * extension, indicated by PSn = 0 but SPSn != 0.
466 */
467 if (eptcfg != 2)
468 book3e_htw_mode = PPC_HTW_NONE;
448 469
449 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { 470 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
450 struct mmu_psize_def *def = &mmu_psize_defs[psize]; 471 struct mmu_psize_def *def = &mmu_psize_defs[psize];
451 472
452 if (tlb1ps & (1U << (def->shift - 10))) { 473 if (tlb1ps & (1U << (def->shift - 10))) {
453 def->flags |= MMU_PAGE_SIZE_DIRECT; 474 def->flags |= MMU_PAGE_SIZE_DIRECT;
475
476 if (book3e_htw_mode && psize == MMU_PAGE_2M)
477 def->flags |= MMU_PAGE_SIZE_INDIRECT;
454 } 478 }
455 } 479 }
456 480
457 goto no_indirect; 481 goto out;
458 } 482 }
459#endif 483#endif
460 484
@@ -471,8 +495,11 @@ static void setup_page_sizes(void)
471 } 495 }
472 496
473 /* Indirect page sizes supported ? */ 497 /* Indirect page sizes supported ? */
474 if ((tlb0cfg & TLBnCFG_IND) == 0) 498 if ((tlb0cfg & TLBnCFG_IND) == 0 ||
475 goto no_indirect; 499 (tlb0cfg & TLBnCFG_PT) == 0)
500 goto out;
501
502 book3e_htw_mode = PPC_HTW_IBM;
476 503
477 /* Now, we only deal with one IND page size for each 504 /* Now, we only deal with one IND page size for each
478 * direct size. Hopefully all implementations today are 505 * direct size. Hopefully all implementations today are
@@ -497,8 +524,8 @@ static void setup_page_sizes(void)
497 def->ind = ps + 10; 524 def->ind = ps + 10;
498 } 525 }
499 } 526 }
500 no_indirect:
501 527
528out:
502 /* Cleanup array and print summary */ 529 /* Cleanup array and print summary */
503 pr_info("MMU: Supported page sizes\n"); 530 pr_info("MMU: Supported page sizes\n");
504 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { 531 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
@@ -518,44 +545,27 @@ static void setup_page_sizes(void)
518 } 545 }
519} 546}
520 547
521static void __patch_exception(int exc, unsigned long addr)
522{
523 extern unsigned int interrupt_base_book3e;
524 unsigned int *ibase = &interrupt_base_book3e;
525
526 /* Our exceptions vectors start with a NOP and -then- a branch
527 * to deal with single stepping from userspace which stops on
528 * the second instruction. Thus we need to patch the second
529 * instruction of the exception, not the first one
530 */
531
532 patch_branch(ibase + (exc / 4) + 1, addr, 0);
533}
534
535#define patch_exception(exc, name) do { \
536 extern unsigned int name; \
537 __patch_exception((exc), (unsigned long)&name); \
538} while (0)
539
540static void setup_mmu_htw(void) 548static void setup_mmu_htw(void)
541{ 549{
542 /* Check if HW tablewalk is present, and if yes, enable it by: 550 /*
543 * 551 * If we want to use HW tablewalk, enable it by patching the TLB miss
544 * - patching the TLB miss handlers to branch to the 552 * handlers to branch to the one dedicated to it.
545 * one dedicates to it 553 */
546 *
547 * - setting the global book3e_htw_enabled
548 */
549 unsigned int tlb0cfg = mfspr(SPRN_TLB0CFG);
550 554
551 if ((tlb0cfg & TLBnCFG_IND) && 555 switch (book3e_htw_mode) {
552 (tlb0cfg & TLBnCFG_PT)) { 556 case PPC_HTW_IBM:
553 patch_exception(0x1c0, exc_data_tlb_miss_htw_book3e); 557 patch_exception(0x1c0, exc_data_tlb_miss_htw_book3e);
554 patch_exception(0x1e0, exc_instruction_tlb_miss_htw_book3e); 558 patch_exception(0x1e0, exc_instruction_tlb_miss_htw_book3e);
555 book3e_htw_enabled = 1; 559 break;
560#ifdef CONFIG_PPC_FSL_BOOK3E
561 case PPC_HTW_E6500:
562 patch_exception(0x1c0, exc_data_tlb_miss_e6500_book3e);
563 patch_exception(0x1e0, exc_instruction_tlb_miss_e6500_book3e);
564 break;
565#endif
556 } 566 }
557 pr_info("MMU: Book3E HW tablewalk %s\n", 567 pr_info("MMU: Book3E HW tablewalk %s\n",
558 book3e_htw_enabled ? "enabled" : "not supported"); 568 book3e_htw_mode != PPC_HTW_NONE ? "enabled" : "not supported");
559} 569}
560 570
561/* 571/*
@@ -595,8 +605,16 @@ static void __early_init_mmu(int boot_cpu)
595 /* Set MAS4 based on page table setting */ 605 /* Set MAS4 based on page table setting */
596 606
597 mas4 = 0x4 << MAS4_WIMGED_SHIFT; 607 mas4 = 0x4 << MAS4_WIMGED_SHIFT;
598 if (book3e_htw_enabled) { 608 switch (book3e_htw_mode) {
599 mas4 |= mas4 | MAS4_INDD; 609 case PPC_HTW_E6500:
610 mas4 |= MAS4_INDD;
611 mas4 |= BOOK3E_PAGESZ_2M << MAS4_TSIZED_SHIFT;
612 mas4 |= MAS4_TLBSELD(1);
613 mmu_pte_psize = MMU_PAGE_2M;
614 break;
615
616 case PPC_HTW_IBM:
617 mas4 |= MAS4_INDD;
600#ifdef CONFIG_PPC_64K_PAGES 618#ifdef CONFIG_PPC_64K_PAGES
601 mas4 |= BOOK3E_PAGESZ_256M << MAS4_TSIZED_SHIFT; 619 mas4 |= BOOK3E_PAGESZ_256M << MAS4_TSIZED_SHIFT;
602 mmu_pte_psize = MMU_PAGE_256M; 620 mmu_pte_psize = MMU_PAGE_256M;
@@ -604,13 +622,16 @@ static void __early_init_mmu(int boot_cpu)
604 mas4 |= BOOK3E_PAGESZ_1M << MAS4_TSIZED_SHIFT; 622 mas4 |= BOOK3E_PAGESZ_1M << MAS4_TSIZED_SHIFT;
605 mmu_pte_psize = MMU_PAGE_1M; 623 mmu_pte_psize = MMU_PAGE_1M;
606#endif 624#endif
607 } else { 625 break;
626
627 case PPC_HTW_NONE:
608#ifdef CONFIG_PPC_64K_PAGES 628#ifdef CONFIG_PPC_64K_PAGES
609 mas4 |= BOOK3E_PAGESZ_64K << MAS4_TSIZED_SHIFT; 629 mas4 |= BOOK3E_PAGESZ_64K << MAS4_TSIZED_SHIFT;
610#else 630#else
611 mas4 |= BOOK3E_PAGESZ_4K << MAS4_TSIZED_SHIFT; 631 mas4 |= BOOK3E_PAGESZ_4K << MAS4_TSIZED_SHIFT;
612#endif 632#endif
613 mmu_pte_psize = mmu_virtual_psize; 633 mmu_pte_psize = mmu_virtual_psize;
634 break;
614 } 635 }
615 mtspr(SPRN_MAS4, mas4); 636 mtspr(SPRN_MAS4, mas4);
616 637
@@ -630,8 +651,11 @@ static void __early_init_mmu(int boot_cpu)
630 /* limit memory so we dont have linear faults */ 651 /* limit memory so we dont have linear faults */
631 memblock_enforce_memory_limit(linear_map_top); 652 memblock_enforce_memory_limit(linear_map_top);
632 653
633 patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e); 654 if (book3e_htw_mode == PPC_HTW_NONE) {
634 patch_exception(0x1e0, exc_instruction_tlb_miss_bolted_book3e); 655 patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e);
656 patch_exception(0x1e0,
657 exc_instruction_tlb_miss_bolted_book3e);
658 }
635 } 659 }
636#endif 660#endif
637 661
diff --git a/arch/powerpc/mm/tlb_nohash_low.S b/arch/powerpc/mm/tlb_nohash_low.S
index 626ad081639f..43ff3c797fbf 100644
--- a/arch/powerpc/mm/tlb_nohash_low.S
+++ b/arch/powerpc/mm/tlb_nohash_low.S
@@ -402,7 +402,9 @@ _GLOBAL(set_context)
402 * Load TLBCAM[index] entry in to the L2 CAM MMU 402 * Load TLBCAM[index] entry in to the L2 CAM MMU
403 */ 403 */
404_GLOBAL(loadcam_entry) 404_GLOBAL(loadcam_entry)
405 LOAD_REG_ADDR(r4, TLBCAM) 405 mflr r5
406 LOAD_REG_ADDR_PIC(r4, TLBCAM)
407 mtlr r5
406 mulli r5,r3,TLBCAM_SIZE 408 mulli r5,r3,TLBCAM_SIZE
407 add r3,r5,r4 409 add r3,r5,r4
408 lwz r4,TLBCAM_MAS0(r3) 410 lwz r4,TLBCAM_MAS0(r3)
diff --git a/arch/powerpc/oprofile/op_model_7450.c b/arch/powerpc/oprofile/op_model_7450.c
index ff617246d128..d29b6e4e5e72 100644
--- a/arch/powerpc/oprofile/op_model_7450.c
+++ b/arch/powerpc/oprofile/op_model_7450.c
@@ -16,7 +16,6 @@
16 */ 16 */
17 17
18#include <linux/oprofile.h> 18#include <linux/oprofile.h>
19#include <linux/init.h>
20#include <linux/smp.h> 19#include <linux/smp.h>
21#include <asm/ptrace.h> 20#include <asm/ptrace.h>
22#include <asm/processor.h> 21#include <asm/processor.h>
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
index b9589c19ccda..1f0ebdeea5f7 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -16,7 +16,6 @@
16 16
17#include <linux/cpufreq.h> 17#include <linux/cpufreq.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/init.h>
20#include <linux/jiffies.h> 19#include <linux/jiffies.h>
21#include <linux/kthread.h> 20#include <linux/kthread.h>
22#include <linux/oprofile.h> 21#include <linux/oprofile.h>
diff --git a/arch/powerpc/oprofile/op_model_fsl_emb.c b/arch/powerpc/oprofile/op_model_fsl_emb.c
index 2a82d3ed464d..14cf86fdddab 100644
--- a/arch/powerpc/oprofile/op_model_fsl_emb.c
+++ b/arch/powerpc/oprofile/op_model_fsl_emb.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <linux/oprofile.h> 16#include <linux/oprofile.h>
17#include <linux/init.h>
18#include <linux/smp.h> 17#include <linux/smp.h>
19#include <asm/ptrace.h> 18#include <asm/ptrace.h>
20#include <asm/processor.h> 19#include <asm/processor.h>
diff --git a/arch/powerpc/oprofile/op_model_pa6t.c b/arch/powerpc/oprofile/op_model_pa6t.c
index 42f778dff919..a114a7c22d40 100644
--- a/arch/powerpc/oprofile/op_model_pa6t.c
+++ b/arch/powerpc/oprofile/op_model_pa6t.c
@@ -22,7 +22,6 @@
22 */ 22 */
23 23
24#include <linux/oprofile.h> 24#include <linux/oprofile.h>
25#include <linux/init.h>
26#include <linux/smp.h> 25#include <linux/smp.h>
27#include <linux/percpu.h> 26#include <linux/percpu.h>
28#include <asm/processor.h> 27#include <asm/processor.h>
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index f444b94935f5..962fe7b3e3fb 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/oprofile.h> 12#include <linux/oprofile.h>
13#include <linux/init.h>
14#include <linux/smp.h> 13#include <linux/smp.h>
15#include <asm/firmware.h> 14#include <asm/firmware.h>
16#include <asm/ptrace.h> 15#include <asm/ptrace.h>
diff --git a/arch/powerpc/oprofile/op_model_rs64.c b/arch/powerpc/oprofile/op_model_rs64.c
index 9b801b8c8c5a..7e5b8ed3a1b7 100644
--- a/arch/powerpc/oprofile/op_model_rs64.c
+++ b/arch/powerpc/oprofile/op_model_rs64.c
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10#include <linux/oprofile.h> 10#include <linux/oprofile.h>
11#include <linux/init.h>
12#include <linux/smp.h> 11#include <linux/smp.h>
13#include <asm/ptrace.h> 12#include <asm/ptrace.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index fc9c1cbfcb1d..5aa3f4b5332c 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -1,9 +1,9 @@
1config PPC_MPC512x 1config PPC_MPC512x
2 bool "512x-based boards" 2 bool "512x-based boards"
3 depends on 6xx 3 depends on 6xx
4 select COMMON_CLK
4 select FSL_SOC 5 select FSL_SOC
5 select IPIC 6 select IPIC
6 select PPC_CLOCK
7 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
8 select FSL_PCI if PCI 8 select FSL_PCI if PCI
9 select ARCH_WANT_OPTIONAL_GPIOLIB 9 select ARCH_WANT_OPTIONAL_GPIOLIB
diff --git a/arch/powerpc/platforms/512x/Makefile b/arch/powerpc/platforms/512x/Makefile
index 72fb9340e09f..01693121a2b1 100644
--- a/arch/powerpc/platforms/512x/Makefile
+++ b/arch/powerpc/platforms/512x/Makefile
@@ -1,7 +1,8 @@
1# 1#
2# Makefile for the Freescale PowerPC 512x linux kernel. 2# Makefile for the Freescale PowerPC 512x linux kernel.
3# 3#
4obj-y += clock.o mpc512x_shared.o 4obj-$(CONFIG_COMMON_CLK) += clock-commonclk.o
5obj-y += mpc512x_shared.o
5obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o 6obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o
6obj-$(CONFIG_MPC512x_GENERIC) += mpc512x_generic.o 7obj-$(CONFIG_MPC512x_GENERIC) += mpc512x_generic.o
7obj-$(CONFIG_PDM360NG) += pdm360ng.o 8obj-$(CONFIG_PDM360NG) += pdm360ng.o
diff --git a/arch/powerpc/platforms/512x/clock-commonclk.c b/arch/powerpc/platforms/512x/clock-commonclk.c
new file mode 100644
index 000000000000..6eb614a271fb
--- /dev/null
+++ b/arch/powerpc/platforms/512x/clock-commonclk.c
@@ -0,0 +1,1221 @@
1/*
2 * Copyright (C) 2013 DENX Software Engineering
3 *
4 * Gerhard Sittig, <gsi@denx.de>
5 *
6 * common clock driver support for the MPC512x platform
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/bitops.h>
15#include <linux/clk-provider.h>
16#include <linux/clkdev.h>
17#include <linux/device.h>
18#include <linux/errno.h>
19#include <linux/io.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22
23#include <asm/mpc5121.h>
24#include <dt-bindings/clock/mpc512x-clock.h>
25
26#include "mpc512x.h" /* our public mpc5121_clk_init() API */
27
28/* helpers to keep the MCLK intermediates "somewhere" in our table */
29enum {
30 MCLK_IDX_MUX0,
31 MCLK_IDX_EN0,
32 MCLK_IDX_DIV0,
33 MCLK_MAX_IDX,
34};
35
36#define NR_PSCS 12
37#define NR_MSCANS 4
38#define NR_SPDIFS 1
39#define NR_OUTCLK 4
40#define NR_MCLKS (NR_PSCS + NR_MSCANS + NR_SPDIFS + NR_OUTCLK)
41
42/* extend the public set of clocks by adding internal slots for management */
43enum {
44 /* arrange for adjacent numbers after the public set */
45 MPC512x_CLK_START_PRIVATE = MPC512x_CLK_LAST_PUBLIC,
46 /* clocks which aren't announced to the public */
47 MPC512x_CLK_DDR,
48 MPC512x_CLK_MEM,
49 MPC512x_CLK_IIM,
50 /* intermediates in div+gate combos or fractional dividers */
51 MPC512x_CLK_DDR_UG,
52 MPC512x_CLK_SDHC_x4,
53 MPC512x_CLK_SDHC_UG,
54 MPC512x_CLK_SDHC2_UG,
55 MPC512x_CLK_DIU_x4,
56 MPC512x_CLK_DIU_UG,
57 MPC512x_CLK_MBX_BUS_UG,
58 MPC512x_CLK_MBX_UG,
59 MPC512x_CLK_MBX_3D_UG,
60 MPC512x_CLK_PCI_UG,
61 MPC512x_CLK_NFC_UG,
62 MPC512x_CLK_LPC_UG,
63 MPC512x_CLK_SPDIF_TX_IN,
64 /* intermediates for the mux+gate+div+mux MCLK generation */
65 MPC512x_CLK_MCLKS_FIRST,
66 MPC512x_CLK_MCLKS_LAST = MPC512x_CLK_MCLKS_FIRST
67 + NR_MCLKS * MCLK_MAX_IDX,
68 /* internal, symbolic spec for the number of slots */
69 MPC512x_CLK_LAST_PRIVATE,
70};
71
72/* data required for the OF clock provider registration */
73static struct clk *clks[MPC512x_CLK_LAST_PRIVATE];
74static struct clk_onecell_data clk_data;
75
76/* CCM register access */
77static struct mpc512x_ccm __iomem *clkregs;
78static DEFINE_SPINLOCK(clklock);
79
80/* SoC variants {{{ */
81
82/*
83 * tell SoC variants apart as they are rather similar yet not identical,
84 * cache the result in an enum to not repeatedly run the expensive OF test
85 *
86 * MPC5123 is an MPC5121 without the MBX graphics accelerator
87 *
88 * MPC5125 has many more differences: no MBX, no AXE, no VIU, no SPDIF,
89 * no PATA, no SATA, no PCI, two FECs (of different compatibility name),
90 * only 10 PSCs (of different compatibility name), two SDHCs, different
91 * NFC IP block, output clocks, system PLL status query, different CPMF
92 * interpretation, no CFM, different fourth PSC/CAN mux0 input -- yet
93 * those differences can get folded into this clock provider support
94 * code and don't warrant a separate highly redundant implementation
95 */
96
97static enum soc_type {
98 MPC512x_SOC_MPC5121,
99 MPC512x_SOC_MPC5123,
100 MPC512x_SOC_MPC5125,
101} soc;
102
103static void mpc512x_clk_determine_soc(void)
104{
105 if (of_machine_is_compatible("fsl,mpc5121")) {
106 soc = MPC512x_SOC_MPC5121;
107 return;
108 }
109 if (of_machine_is_compatible("fsl,mpc5123")) {
110 soc = MPC512x_SOC_MPC5123;
111 return;
112 }
113 if (of_machine_is_compatible("fsl,mpc5125")) {
114 soc = MPC512x_SOC_MPC5125;
115 return;
116 }
117}
118
119static bool soc_has_mbx(void)
120{
121 if (soc == MPC512x_SOC_MPC5121)
122 return true;
123 return false;
124}
125
126static bool soc_has_axe(void)
127{
128 if (soc == MPC512x_SOC_MPC5125)
129 return false;
130 return true;
131}
132
133static bool soc_has_viu(void)
134{
135 if (soc == MPC512x_SOC_MPC5125)
136 return false;
137 return true;
138}
139
140static bool soc_has_spdif(void)
141{
142 if (soc == MPC512x_SOC_MPC5125)
143 return false;
144 return true;
145}
146
147static bool soc_has_pata(void)
148{
149 if (soc == MPC512x_SOC_MPC5125)
150 return false;
151 return true;
152}
153
154static bool soc_has_sata(void)
155{
156 if (soc == MPC512x_SOC_MPC5125)
157 return false;
158 return true;
159}
160
161static bool soc_has_pci(void)
162{
163 if (soc == MPC512x_SOC_MPC5125)
164 return false;
165 return true;
166}
167
168static bool soc_has_fec2(void)
169{
170 if (soc == MPC512x_SOC_MPC5125)
171 return true;
172 return false;
173}
174
175static int soc_max_pscnum(void)
176{
177 if (soc == MPC512x_SOC_MPC5125)
178 return 10;
179 return 12;
180}
181
182static bool soc_has_sdhc2(void)
183{
184 if (soc == MPC512x_SOC_MPC5125)
185 return true;
186 return false;
187}
188
189static bool soc_has_nfc_5125(void)
190{
191 if (soc == MPC512x_SOC_MPC5125)
192 return true;
193 return false;
194}
195
196static bool soc_has_outclk(void)
197{
198 if (soc == MPC512x_SOC_MPC5125)
199 return true;
200 return false;
201}
202
203static bool soc_has_cpmf_0_bypass(void)
204{
205 if (soc == MPC512x_SOC_MPC5125)
206 return true;
207 return false;
208}
209
210static bool soc_has_mclk_mux0_canin(void)
211{
212 if (soc == MPC512x_SOC_MPC5125)
213 return true;
214 return false;
215}
216
217/* }}} SoC variants */
218/* common clk API wrappers {{{ */
219
220/* convenience wrappers around the common clk API */
221static inline struct clk *mpc512x_clk_fixed(const char *name, int rate)
222{
223 return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
224}
225
226static inline struct clk *mpc512x_clk_factor(
227 const char *name, const char *parent_name,
228 int mul, int div)
229{
230 int clkflags;
231
232 clkflags = CLK_SET_RATE_PARENT;
233 return clk_register_fixed_factor(NULL, name, parent_name, clkflags,
234 mul, div);
235}
236
237static inline struct clk *mpc512x_clk_divider(
238 const char *name, const char *parent_name, u8 clkflags,
239 u32 __iomem *reg, u8 pos, u8 len, int divflags)
240{
241 return clk_register_divider(NULL, name, parent_name, clkflags,
242 reg, pos, len, divflags, &clklock);
243}
244
245static inline struct clk *mpc512x_clk_divtable(
246 const char *name, const char *parent_name,
247 u32 __iomem *reg, u8 pos, u8 len,
248 const struct clk_div_table *divtab)
249{
250 u8 divflags;
251
252 divflags = 0;
253 return clk_register_divider_table(NULL, name, parent_name, 0,
254 reg, pos, len, divflags,
255 divtab, &clklock);
256}
257
258static inline struct clk *mpc512x_clk_gated(
259 const char *name, const char *parent_name,
260 u32 __iomem *reg, u8 pos)
261{
262 int clkflags;
263
264 clkflags = CLK_SET_RATE_PARENT;
265 return clk_register_gate(NULL, name, parent_name, clkflags,
266 reg, pos, 0, &clklock);
267}
268
269static inline struct clk *mpc512x_clk_muxed(const char *name,
270 const char **parent_names, int parent_count,
271 u32 __iomem *reg, u8 pos, u8 len)
272{
273 int clkflags;
274 u8 muxflags;
275
276 clkflags = CLK_SET_RATE_PARENT;
277 muxflags = 0;
278 return clk_register_mux(NULL, name,
279 parent_names, parent_count, clkflags,
280 reg, pos, len, muxflags, &clklock);
281}
282
283/* }}} common clk API wrappers */
284
285/* helper to isolate a bit field from a register */
286static inline int get_bit_field(uint32_t __iomem *reg, uint8_t pos, uint8_t len)
287{
288 uint32_t val;
289
290 val = in_be32(reg);
291 val >>= pos;
292 val &= (1 << len) - 1;
293 return val;
294}
295
296/* get the SPMF and translate it into the "sys pll" multiplier */
297static int get_spmf_mult(void)
298{
299 static int spmf_to_mult[] = {
300 68, 1, 12, 16, 20, 24, 28, 32,
301 36, 40, 44, 48, 52, 56, 60, 64,
302 };
303 int spmf;
304
305 spmf = get_bit_field(&clkregs->spmr, 24, 4);
306 return spmf_to_mult[spmf];
307}
308
309/*
310 * get the SYS_DIV value and translate it into a divide factor
311 *
312 * values returned from here are a multiple of the real factor since the
313 * divide ratio is fractional
314 */
315static int get_sys_div_x2(void)
316{
317 static int sysdiv_code_to_x2[] = {
318 4, 5, 6, 7, 8, 9, 10, 14,
319 12, 16, 18, 22, 20, 24, 26, 30,
320 28, 32, 34, 38, 36, 40, 42, 46,
321 44, 48, 50, 54, 52, 56, 58, 62,
322 60, 64, 66,
323 };
324 int divcode;
325
326 divcode = get_bit_field(&clkregs->scfr2, 26, 6);
327 return sysdiv_code_to_x2[divcode];
328}
329
330/*
331 * get the CPMF value and translate it into a multiplier factor
332 *
333 * values returned from here are a multiple of the real factor since the
334 * multiplier ratio is fractional
335 */
336static int get_cpmf_mult_x2(void)
337{
338 static int cpmf_to_mult_x36[] = {
339 /* 0b000 is "times 36" */
340 72, 2, 2, 3, 4, 5, 6, 7,
341 };
342 static int cpmf_to_mult_0by[] = {
343 /* 0b000 is "bypass" */
344 2, 2, 2, 3, 4, 5, 6, 7,
345 };
346
347 int *cpmf_to_mult;
348 int cpmf;
349
350 cpmf = get_bit_field(&clkregs->spmr, 16, 4);
351 if (soc_has_cpmf_0_bypass())
352 cpmf_to_mult = cpmf_to_mult_0by;
353 else
354 cpmf_to_mult = cpmf_to_mult_x36;
355 return cpmf_to_mult[cpmf];
356}
357
358/*
359 * some of the clock dividers do scale in a linear way, yet not all of
360 * their bit combinations are legal; use a divider table to get a
361 * resulting set of applicable divider values
362 */
363
364/* applies to the IPS_DIV, and PCI_DIV values */
365static struct clk_div_table divtab_2346[] = {
366 { .val = 2, .div = 2, },
367 { .val = 3, .div = 3, },
368 { .val = 4, .div = 4, },
369 { .val = 6, .div = 6, },
370 { .div = 0, },
371};
372
373/* applies to the MBX_DIV, LPC_DIV, and NFC_DIV values */
374static struct clk_div_table divtab_1234[] = {
375 { .val = 1, .div = 1, },
376 { .val = 2, .div = 2, },
377 { .val = 3, .div = 3, },
378 { .val = 4, .div = 4, },
379 { .div = 0, },
380};
381
382static int get_freq_from_dt(char *propname)
383{
384 struct device_node *np;
385 const unsigned int *prop;
386 int val;
387
388 val = 0;
389 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-immr");
390 if (np) {
391 prop = of_get_property(np, propname, NULL);
392 if (prop)
393 val = *prop;
394 of_node_put(np);
395 }
396 return val;
397}
398
399static void mpc512x_clk_preset_data(void)
400{
401 size_t i;
402
403 for (i = 0; i < ARRAY_SIZE(clks); i++)
404 clks[i] = ERR_PTR(-ENODEV);
405}
406
407/*
408 * - receives the "bus frequency" from the caller (that's the IPS clock
409 * rate, the historical source of clock information)
410 * - fetches the system PLL multiplier and divider values as well as the
411 * IPS divider value from hardware
412 * - determines the REF clock rate either from the XTAL/OSC spec (if
413 * there is a device tree node describing the oscillator) or from the
414 * IPS bus clock (supported for backwards compatibility, such that
415 * setups without XTAL/OSC specs keep working)
416 * - creates the "ref" clock item in the clock tree, such that
417 * subsequent code can create the remainder of the hierarchy (REF ->
418 * SYS -> CSB -> IPS) from the REF clock rate and the returned mul/div
419 * values
420 */
421static void mpc512x_clk_setup_ref_clock(struct device_node *np, int bus_freq,
422 int *sys_mul, int *sys_div,
423 int *ips_div)
424{
425 struct clk *osc_clk;
426 int calc_freq;
427
428 /* fetch mul/div factors from the hardware */
429 *sys_mul = get_spmf_mult();
430 *sys_mul *= 2; /* compensate for the fractional divider */
431 *sys_div = get_sys_div_x2();
432 *ips_div = get_bit_field(&clkregs->scfr1, 23, 3);
433
434 /* lookup the oscillator clock for its rate */
435 osc_clk = of_clk_get_by_name(np, "osc");
436
437 /*
438 * either descend from OSC to REF (and in bypassing verify the
439 * IPS rate), or backtrack from IPS and multiplier values that
440 * were fetched from hardware to REF and thus to the OSC value
441 *
442 * in either case the REF clock gets created here and the
443 * remainder of the clock tree can get spanned from there
444 */
445 if (!IS_ERR(osc_clk)) {
446 clks[MPC512x_CLK_REF] = mpc512x_clk_factor("ref", "osc", 1, 1);
447 calc_freq = clk_get_rate(clks[MPC512x_CLK_REF]);
448 calc_freq *= *sys_mul;
449 calc_freq /= *sys_div;
450 calc_freq /= 2;
451 calc_freq /= *ips_div;
452 if (bus_freq && calc_freq != bus_freq)
453 pr_warn("calc rate %d != OF spec %d\n",
454 calc_freq, bus_freq);
455 } else {
456 calc_freq = bus_freq; /* start with IPS */
457 calc_freq *= *ips_div; /* IPS -> CSB */
458 calc_freq *= 2; /* CSB -> SYS */
459 calc_freq *= *sys_div; /* SYS -> PLL out */
460 calc_freq /= *sys_mul; /* PLL out -> REF == OSC */
461 clks[MPC512x_CLK_REF] = mpc512x_clk_fixed("ref", calc_freq);
462 }
463}
464
465/* MCLK helpers {{{ */
466
467/*
468 * helper code for the MCLK subtree setup
469 *
470 * the overview in section 5.2.4 of the MPC5121e Reference Manual rev4
471 * suggests that all instances of the "PSC clock generation" are equal,
472 * and that one might re-use the PSC setup for MSCAN clock generation
473 * (section 5.2.5) as well, at least the logic if not the data for
474 * description
475 *
476 * the details (starting at page 5-20) show differences in the specific
477 * inputs of the first mux stage ("can clk in", "spdif tx"), and the
478 * factual non-availability of the second mux stage (it's present yet
479 * only one input is valid)
480 *
481 * the MSCAN clock related registers (starting at page 5-35) all
482 * reference "spdif clk" at the first mux stage and don't mention any
483 * "can clk" at all, which somehow is unexpected
484 *
485 * TODO re-check the document, and clarify whether the RM is correct in
486 * the overview or in the details, and whether the difference is a
487 * clipboard induced error or results from chip revisions
488 *
489 * it turns out that the RM rev4 as of 2012-06 talks about "can" for the
490 * PSCs while RM rev3 as of 2008-10 talks about "spdif", so I guess that
491 * first a doc update is required which better reflects reality in the
492 * SoC before the implementation should follow while no questions remain
493 */
494
495/*
496 * note that this declaration raises a checkpatch warning, but
497 * it's the very data type dictated by <linux/clk-provider.h>,
498 * "fixing" this warning will break compilation
499 */
500static const char *parent_names_mux0_spdif[] = {
501 "sys", "ref", "psc-mclk-in", "spdif-tx",
502};
503
504static const char *parent_names_mux0_canin[] = {
505 "sys", "ref", "psc-mclk-in", "can-clk-in",
506};
507
508enum mclk_type {
509 MCLK_TYPE_PSC,
510 MCLK_TYPE_MSCAN,
511 MCLK_TYPE_SPDIF,
512 MCLK_TYPE_OUTCLK,
513};
514
515struct mclk_setup_data {
516 enum mclk_type type;
517 bool has_mclk1;
518 const char *name_mux0;
519 const char *name_en0;
520 const char *name_div0;
521 const char *parent_names_mux1[2];
522 const char *name_mclk;
523};
524
525#define MCLK_SETUP_DATA_PSC(id) { \
526 MCLK_TYPE_PSC, 0, \
527 "psc" #id "-mux0", \
528 "psc" #id "-en0", \
529 "psc" #id "_mclk_div", \
530 { "psc" #id "_mclk_div", "dummy", }, \
531 "psc" #id "_mclk", \
532}
533
534#define MCLK_SETUP_DATA_MSCAN(id) { \
535 MCLK_TYPE_MSCAN, 0, \
536 "mscan" #id "-mux0", \
537 "mscan" #id "-en0", \
538 "mscan" #id "_mclk_div", \
539 { "mscan" #id "_mclk_div", "dummy", }, \
540 "mscan" #id "_mclk", \
541}
542
543#define MCLK_SETUP_DATA_SPDIF { \
544 MCLK_TYPE_SPDIF, 1, \
545 "spdif-mux0", \
546 "spdif-en0", \
547 "spdif_mclk_div", \
548 { "spdif_mclk_div", "spdif-rx", }, \
549 "spdif_mclk", \
550}
551
552#define MCLK_SETUP_DATA_OUTCLK(id) { \
553 MCLK_TYPE_OUTCLK, 0, \
554 "out" #id "-mux0", \
555 "out" #id "-en0", \
556 "out" #id "_mclk_div", \
557 { "out" #id "_mclk_div", "dummy", }, \
558 "out" #id "_clk", \
559}
560
561static struct mclk_setup_data mclk_psc_data[] = {
562 MCLK_SETUP_DATA_PSC(0),
563 MCLK_SETUP_DATA_PSC(1),
564 MCLK_SETUP_DATA_PSC(2),
565 MCLK_SETUP_DATA_PSC(3),
566 MCLK_SETUP_DATA_PSC(4),
567 MCLK_SETUP_DATA_PSC(5),
568 MCLK_SETUP_DATA_PSC(6),
569 MCLK_SETUP_DATA_PSC(7),
570 MCLK_SETUP_DATA_PSC(8),
571 MCLK_SETUP_DATA_PSC(9),
572 MCLK_SETUP_DATA_PSC(10),
573 MCLK_SETUP_DATA_PSC(11),
574};
575
576static struct mclk_setup_data mclk_mscan_data[] = {
577 MCLK_SETUP_DATA_MSCAN(0),
578 MCLK_SETUP_DATA_MSCAN(1),
579 MCLK_SETUP_DATA_MSCAN(2),
580 MCLK_SETUP_DATA_MSCAN(3),
581};
582
583static struct mclk_setup_data mclk_spdif_data[] = {
584 MCLK_SETUP_DATA_SPDIF,
585};
586
587static struct mclk_setup_data mclk_outclk_data[] = {
588 MCLK_SETUP_DATA_OUTCLK(0),
589 MCLK_SETUP_DATA_OUTCLK(1),
590 MCLK_SETUP_DATA_OUTCLK(2),
591 MCLK_SETUP_DATA_OUTCLK(3),
592};
593
594/* setup the MCLK clock subtree of an individual PSC/MSCAN/SPDIF */
595static void mpc512x_clk_setup_mclk(struct mclk_setup_data *entry, size_t idx)
596{
597 size_t clks_idx_pub, clks_idx_int;
598 u32 __iomem *mccr_reg; /* MCLK control register (mux, en, div) */
599 int div;
600
601 /* derive a few parameters from the component type and index */
602 switch (entry->type) {
603 case MCLK_TYPE_PSC:
604 clks_idx_pub = MPC512x_CLK_PSC0_MCLK + idx;
605 clks_idx_int = MPC512x_CLK_MCLKS_FIRST
606 + (idx) * MCLK_MAX_IDX;
607 mccr_reg = &clkregs->psc_ccr[idx];
608 break;
609 case MCLK_TYPE_MSCAN:
610 clks_idx_pub = MPC512x_CLK_MSCAN0_MCLK + idx;
611 clks_idx_int = MPC512x_CLK_MCLKS_FIRST
612 + (NR_PSCS + idx) * MCLK_MAX_IDX;
613 mccr_reg = &clkregs->mscan_ccr[idx];
614 break;
615 case MCLK_TYPE_SPDIF:
616 clks_idx_pub = MPC512x_CLK_SPDIF_MCLK;
617 clks_idx_int = MPC512x_CLK_MCLKS_FIRST
618 + (NR_PSCS + NR_MSCANS) * MCLK_MAX_IDX;
619 mccr_reg = &clkregs->spccr;
620 break;
621 case MCLK_TYPE_OUTCLK:
622 clks_idx_pub = MPC512x_CLK_OUT0_CLK + idx;
623 clks_idx_int = MPC512x_CLK_MCLKS_FIRST
624 + (NR_PSCS + NR_MSCANS + NR_SPDIFS + idx)
625 * MCLK_MAX_IDX;
626 mccr_reg = &clkregs->out_ccr[idx];
627 break;
628 default:
629 return;
630 }
631
632 /*
633 * this was grabbed from the PPC_CLOCK implementation, which
634 * enforced a specific MCLK divider while the clock was gated
635 * during setup (that's a documented hardware requirement)
636 *
637 * the PPC_CLOCK implementation might even have violated the
638 * "MCLK <= IPS" constraint, the fixed divider value of 1
639 * results in a divider of 2 and thus MCLK = SYS/2 which equals
640 * CSB which is greater than IPS; the serial port setup may have
641 * adjusted the divider which the clock setup might have left in
642 * an undesirable state
643 *
644 * initial setup is:
645 * - MCLK 0 from SYS
646 * - MCLK DIV such to not exceed the IPS clock
647 * - MCLK 0 enabled
648 * - MCLK 1 from MCLK DIV
649 */
650 div = clk_get_rate(clks[MPC512x_CLK_SYS]);
651 div /= clk_get_rate(clks[MPC512x_CLK_IPS]);
652 out_be32(mccr_reg, (0 << 16));
653 out_be32(mccr_reg, (0 << 16) | ((div - 1) << 17));
654 out_be32(mccr_reg, (1 << 16) | ((div - 1) << 17));
655
656 /*
657 * create the 'struct clk' items of the MCLK's clock subtree
658 *
659 * note that by design we always create all nodes and won't take
660 * shortcuts here, because
661 * - the "internal" MCLK_DIV and MCLK_OUT signal in turn are
662 * selectable inputs to the CFM while those who "actually use"
663 * the PSC/MSCAN/SPDIF (serial drivers et al) need the MCLK
664 * for their bitrate
665 * - in the absence of "aliases" for clocks we need to create
666 * individial 'struct clk' items for whatever might get
667 * referenced or looked up, even if several of those items are
668 * identical from the logical POV (their rate value)
669 * - for easier future maintenance and for better reflection of
670 * the SoC's documentation, it appears appropriate to generate
671 * clock items even for those muxers which actually are NOPs
672 * (those with two inputs of which one is reserved)
673 */
674 clks[clks_idx_int + MCLK_IDX_MUX0] = mpc512x_clk_muxed(
675 entry->name_mux0,
676 soc_has_mclk_mux0_canin()
677 ? &parent_names_mux0_canin[0]
678 : &parent_names_mux0_spdif[0],
679 ARRAY_SIZE(parent_names_mux0_spdif),
680 mccr_reg, 14, 2);
681 clks[clks_idx_int + MCLK_IDX_EN0] = mpc512x_clk_gated(
682 entry->name_en0, entry->name_mux0,
683 mccr_reg, 16);
684 clks[clks_idx_int + MCLK_IDX_DIV0] = mpc512x_clk_divider(
685 entry->name_div0,
686 entry->name_en0, CLK_SET_RATE_GATE,
687 mccr_reg, 17, 15, 0);
688 if (entry->has_mclk1) {
689 clks[clks_idx_pub] = mpc512x_clk_muxed(
690 entry->name_mclk,
691 &entry->parent_names_mux1[0],
692 ARRAY_SIZE(entry->parent_names_mux1),
693 mccr_reg, 7, 1);
694 } else {
695 clks[clks_idx_pub] = mpc512x_clk_factor(
696 entry->name_mclk,
697 entry->parent_names_mux1[0],
698 1, 1);
699 }
700}
701
702/* }}} MCLK helpers */
703
704static void mpc512x_clk_setup_clock_tree(struct device_node *np, int busfreq)
705{
706 int sys_mul, sys_div, ips_div;
707 int mul, div;
708 size_t mclk_idx;
709 int freq;
710
711 /*
712 * developer's notes:
713 * - consider whether to handle clocks which have both gates and
714 * dividers via intermediates or by means of composites
715 * - fractional dividers appear to not map well to composites
716 * since they can be seen as a fixed multiplier and an
717 * adjustable divider, while composites can only combine at
718 * most one of a mux, div, and gate each into one 'struct clk'
719 * item
720 * - PSC/MSCAN/SPDIF clock generation OTOH already is very
721 * specific and cannot get mapped to componsites (at least not
722 * a single one, maybe two of them, but then some of these
723 * intermediate clock signals get referenced elsewhere (e.g.
724 * in the clock frequency measurement, CFM) and thus need
725 * publicly available names
726 * - the current source layout appropriately reflects the
727 * hardware setup, and it works, so it's questionable whether
728 * further changes will result in big enough a benefit
729 */
730
731 /* regardless of whether XTAL/OSC exists, have REF created */
732 mpc512x_clk_setup_ref_clock(np, busfreq, &sys_mul, &sys_div, &ips_div);
733
734 /* now setup the REF -> SYS -> CSB -> IPS hierarchy */
735 clks[MPC512x_CLK_SYS] = mpc512x_clk_factor("sys", "ref",
736 sys_mul, sys_div);
737 clks[MPC512x_CLK_CSB] = mpc512x_clk_factor("csb", "sys", 1, 2);
738 clks[MPC512x_CLK_IPS] = mpc512x_clk_divtable("ips", "csb",
739 &clkregs->scfr1, 23, 3,
740 divtab_2346);
741 /* now setup anything below SYS and CSB and IPS */
742
743 clks[MPC512x_CLK_DDR_UG] = mpc512x_clk_factor("ddr-ug", "sys", 1, 2);
744
745 /*
746 * the Reference Manual discusses that for SDHC only even divide
747 * ratios are supported because clock domain synchronization
748 * between 'per' and 'ipg' is broken;
749 * keep the divider's bit 0 cleared (per reset value), and only
750 * allow to setup the divider's bits 7:1, which results in that
751 * only even divide ratios can get configured upon rate changes;
752 * keep the "x4" name because this bit shift hack is an internal
753 * implementation detail, the "fractional divider with quarters"
754 * semantics remains
755 */
756 clks[MPC512x_CLK_SDHC_x4] = mpc512x_clk_factor("sdhc-x4", "csb", 2, 1);
757 clks[MPC512x_CLK_SDHC_UG] = mpc512x_clk_divider("sdhc-ug", "sdhc-x4", 0,
758 &clkregs->scfr2, 1, 7,
759 CLK_DIVIDER_ONE_BASED);
760 if (soc_has_sdhc2()) {
761 clks[MPC512x_CLK_SDHC2_UG] = mpc512x_clk_divider(
762 "sdhc2-ug", "sdhc-x4", 0, &clkregs->scfr2,
763 9, 7, CLK_DIVIDER_ONE_BASED);
764 }
765
766 clks[MPC512x_CLK_DIU_x4] = mpc512x_clk_factor("diu-x4", "csb", 4, 1);
767 clks[MPC512x_CLK_DIU_UG] = mpc512x_clk_divider("diu-ug", "diu-x4", 0,
768 &clkregs->scfr1, 0, 8,
769 CLK_DIVIDER_ONE_BASED);
770
771 /*
772 * the "power architecture PLL" was setup from data which was
773 * sampled from the reset config word, at this point in time the
774 * configuration can be considered fixed and read only (i.e. no
775 * longer adjustable, or no longer in need of adjustment), which
776 * is why we don't register a PLL here but assume fixed factors
777 */
778 mul = get_cpmf_mult_x2();
779 div = 2; /* compensate for the fractional factor */
780 clks[MPC512x_CLK_E300] = mpc512x_clk_factor("e300", "csb", mul, div);
781
782 if (soc_has_mbx()) {
783 clks[MPC512x_CLK_MBX_BUS_UG] = mpc512x_clk_factor(
784 "mbx-bus-ug", "csb", 1, 2);
785 clks[MPC512x_CLK_MBX_UG] = mpc512x_clk_divtable(
786 "mbx-ug", "mbx-bus-ug", &clkregs->scfr1,
787 14, 3, divtab_1234);
788 clks[MPC512x_CLK_MBX_3D_UG] = mpc512x_clk_factor(
789 "mbx-3d-ug", "mbx-ug", 1, 1);
790 }
791 if (soc_has_pci()) {
792 clks[MPC512x_CLK_PCI_UG] = mpc512x_clk_divtable(
793 "pci-ug", "csb", &clkregs->scfr1,
794 20, 3, divtab_2346);
795 }
796 if (soc_has_nfc_5125()) {
797 /*
798 * XXX TODO implement 5125 NFC clock setup logic,
799 * with high/low period counters in clkregs->scfr3,
800 * currently there are no users so it's ENOIMPL
801 */
802 clks[MPC512x_CLK_NFC_UG] = ERR_PTR(-ENOTSUPP);
803 } else {
804 clks[MPC512x_CLK_NFC_UG] = mpc512x_clk_divtable(
805 "nfc-ug", "ips", &clkregs->scfr1,
806 8, 3, divtab_1234);
807 }
808 clks[MPC512x_CLK_LPC_UG] = mpc512x_clk_divtable("lpc-ug", "ips",
809 &clkregs->scfr1, 11, 3,
810 divtab_1234);
811
812 clks[MPC512x_CLK_LPC] = mpc512x_clk_gated("lpc", "lpc-ug",
813 &clkregs->sccr1, 30);
814 clks[MPC512x_CLK_NFC] = mpc512x_clk_gated("nfc", "nfc-ug",
815 &clkregs->sccr1, 29);
816 if (soc_has_pata()) {
817 clks[MPC512x_CLK_PATA] = mpc512x_clk_gated(
818 "pata", "ips", &clkregs->sccr1, 28);
819 }
820 /* for PSCs there is a "registers" gate and a bitrate MCLK subtree */
821 for (mclk_idx = 0; mclk_idx < soc_max_pscnum(); mclk_idx++) {
822 char name[12];
823 snprintf(name, sizeof(name), "psc%d", mclk_idx);
824 clks[MPC512x_CLK_PSC0 + mclk_idx] = mpc512x_clk_gated(
825 name, "ips", &clkregs->sccr1, 27 - mclk_idx);
826 mpc512x_clk_setup_mclk(&mclk_psc_data[mclk_idx], mclk_idx);
827 }
828 clks[MPC512x_CLK_PSC_FIFO] = mpc512x_clk_gated("psc-fifo", "ips",
829 &clkregs->sccr1, 15);
830 if (soc_has_sata()) {
831 clks[MPC512x_CLK_SATA] = mpc512x_clk_gated(
832 "sata", "ips", &clkregs->sccr1, 14);
833 }
834 clks[MPC512x_CLK_FEC] = mpc512x_clk_gated("fec", "ips",
835 &clkregs->sccr1, 13);
836 if (soc_has_pci()) {
837 clks[MPC512x_CLK_PCI] = mpc512x_clk_gated(
838 "pci", "pci-ug", &clkregs->sccr1, 11);
839 }
840 clks[MPC512x_CLK_DDR] = mpc512x_clk_gated("ddr", "ddr-ug",
841 &clkregs->sccr1, 10);
842 if (soc_has_fec2()) {
843 clks[MPC512x_CLK_FEC2] = mpc512x_clk_gated(
844 "fec2", "ips", &clkregs->sccr1, 9);
845 }
846
847 clks[MPC512x_CLK_DIU] = mpc512x_clk_gated("diu", "diu-ug",
848 &clkregs->sccr2, 31);
849 if (soc_has_axe()) {
850 clks[MPC512x_CLK_AXE] = mpc512x_clk_gated(
851 "axe", "csb", &clkregs->sccr2, 30);
852 }
853 clks[MPC512x_CLK_MEM] = mpc512x_clk_gated("mem", "ips",
854 &clkregs->sccr2, 29);
855 clks[MPC512x_CLK_USB1] = mpc512x_clk_gated("usb1", "csb",
856 &clkregs->sccr2, 28);
857 clks[MPC512x_CLK_USB2] = mpc512x_clk_gated("usb2", "csb",
858 &clkregs->sccr2, 27);
859 clks[MPC512x_CLK_I2C] = mpc512x_clk_gated("i2c", "ips",
860 &clkregs->sccr2, 26);
861 /* MSCAN differs from PSC with just one gate for multiple components */
862 clks[MPC512x_CLK_BDLC] = mpc512x_clk_gated("bdlc", "ips",
863 &clkregs->sccr2, 25);
864 for (mclk_idx = 0; mclk_idx < ARRAY_SIZE(mclk_mscan_data); mclk_idx++)
865 mpc512x_clk_setup_mclk(&mclk_mscan_data[mclk_idx], mclk_idx);
866 clks[MPC512x_CLK_SDHC] = mpc512x_clk_gated("sdhc", "sdhc-ug",
867 &clkregs->sccr2, 24);
868 /* there is only one SPDIF component, which shares MCLK support code */
869 if (soc_has_spdif()) {
870 clks[MPC512x_CLK_SPDIF] = mpc512x_clk_gated(
871 "spdif", "ips", &clkregs->sccr2, 23);
872 mpc512x_clk_setup_mclk(&mclk_spdif_data[0], 0);
873 }
874 if (soc_has_mbx()) {
875 clks[MPC512x_CLK_MBX_BUS] = mpc512x_clk_gated(
876 "mbx-bus", "mbx-bus-ug", &clkregs->sccr2, 22);
877 clks[MPC512x_CLK_MBX] = mpc512x_clk_gated(
878 "mbx", "mbx-ug", &clkregs->sccr2, 21);
879 clks[MPC512x_CLK_MBX_3D] = mpc512x_clk_gated(
880 "mbx-3d", "mbx-3d-ug", &clkregs->sccr2, 20);
881 }
882 clks[MPC512x_CLK_IIM] = mpc512x_clk_gated("iim", "csb",
883 &clkregs->sccr2, 19);
884 if (soc_has_viu()) {
885 clks[MPC512x_CLK_VIU] = mpc512x_clk_gated(
886 "viu", "csb", &clkregs->sccr2, 18);
887 }
888 if (soc_has_sdhc2()) {
889 clks[MPC512x_CLK_SDHC2] = mpc512x_clk_gated(
890 "sdhc-2", "sdhc2-ug", &clkregs->sccr2, 17);
891 }
892
893 if (soc_has_outclk()) {
894 size_t idx; /* used as mclk_idx, just to trim line length */
895 for (idx = 0; idx < ARRAY_SIZE(mclk_outclk_data); idx++)
896 mpc512x_clk_setup_mclk(&mclk_outclk_data[idx], idx);
897 }
898
899 /*
900 * externally provided clocks (when implemented in hardware,
901 * device tree may specify values which otherwise were unknown)
902 */
903 freq = get_freq_from_dt("psc_mclk_in");
904 if (!freq)
905 freq = 25000000;
906 clks[MPC512x_CLK_PSC_MCLK_IN] = mpc512x_clk_fixed("psc_mclk_in", freq);
907 if (soc_has_mclk_mux0_canin()) {
908 freq = get_freq_from_dt("can_clk_in");
909 clks[MPC512x_CLK_CAN_CLK_IN] = mpc512x_clk_fixed(
910 "can_clk_in", freq);
911 } else {
912 freq = get_freq_from_dt("spdif_tx_in");
913 clks[MPC512x_CLK_SPDIF_TX_IN] = mpc512x_clk_fixed(
914 "spdif_tx_in", freq);
915 freq = get_freq_from_dt("spdif_rx_in");
916 clks[MPC512x_CLK_SPDIF_TX_IN] = mpc512x_clk_fixed(
917 "spdif_rx_in", freq);
918 }
919
920 /* fixed frequency for AC97, always 24.567MHz */
921 clks[MPC512x_CLK_AC97] = mpc512x_clk_fixed("ac97", 24567000);
922
923 /*
924 * pre-enable those "internal" clock items which never get
925 * claimed by any peripheral driver, to not have the clock
926 * subsystem disable them late at startup
927 */
928 clk_prepare_enable(clks[MPC512x_CLK_DUMMY]);
929 clk_prepare_enable(clks[MPC512x_CLK_E300]); /* PowerPC CPU */
930 clk_prepare_enable(clks[MPC512x_CLK_DDR]); /* DRAM */
931 clk_prepare_enable(clks[MPC512x_CLK_MEM]); /* SRAM */
932 clk_prepare_enable(clks[MPC512x_CLK_IPS]); /* SoC periph */
933 clk_prepare_enable(clks[MPC512x_CLK_LPC]); /* boot media */
934}
935
936/*
937 * registers the set of public clocks (those listed in the dt-bindings/
938 * header file) for OF lookups, keeps the intermediates private to us
939 */
940static void mpc5121_clk_register_of_provider(struct device_node *np)
941{
942 clk_data.clks = clks;
943 clk_data.clk_num = MPC512x_CLK_LAST_PUBLIC + 1; /* _not_ ARRAY_SIZE() */
944 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
945}
946
947/*
948 * temporary support for the period of time between introduction of CCF
949 * support and the adjustment of peripheral drivers to OF based lookups
950 */
951static void mpc5121_clk_provide_migration_support(void)
952{
953
954 /*
955 * pre-enable those clock items which are not yet appropriately
956 * acquired by their peripheral driver
957 *
958 * the PCI clock cannot get acquired by its peripheral driver,
959 * because for this platform the driver won't probe(), instead
960 * initialization is done from within the .setup_arch() routine
961 * at a point in time where the clock provider has not been
962 * setup yet and thus isn't available yet
963 *
964 * so we "pre-enable" the clock here, to not have the clock
965 * subsystem automatically disable this item in a late init call
966 *
967 * this PCI clock pre-enable workaround only applies when there
968 * are device tree nodes for PCI and thus the peripheral driver
969 * has attached to bridges, otherwise the PCI clock remains
970 * unused and so it gets disabled
971 */
972 clk_prepare_enable(clks[MPC512x_CLK_PSC3_MCLK]);/* serial console */
973 if (of_find_compatible_node(NULL, "pci", "fsl,mpc5121-pci"))
974 clk_prepare_enable(clks[MPC512x_CLK_PCI]);
975}
976
977/*
978 * those macros are not exactly pretty, but they encapsulate a lot
979 * of copy'n'paste heavy code which is even more ugly, and reduce
980 * the potential for inconsistencies in those many code copies
981 */
982#define FOR_NODES(compatname) \
983 for_each_compatible_node(np, NULL, compatname)
984
985#define NODE_PREP do { \
986 of_address_to_resource(np, 0, &res); \
987 snprintf(devname, sizeof(devname), "%08x.%s", res.start, np->name); \
988} while (0)
989
990#define NODE_CHK(clkname, clkitem, regnode, regflag) do { \
991 struct clk *clk; \
992 clk = of_clk_get_by_name(np, clkname); \
993 if (IS_ERR(clk)) { \
994 clk = clkitem; \
995 clk_register_clkdev(clk, clkname, devname); \
996 if (regnode) \
997 clk_register_clkdev(clk, clkname, np->name); \
998 did_register |= DID_REG_ ## regflag; \
999 pr_debug("clock alias name '%s' for dev '%s' pointer %p\n", \
1000 clkname, devname, clk); \
1001 } else { \
1002 clk_put(clk); \
1003 } \
1004} while (0)
1005
1006/*
1007 * register source code provided fallback results for clock lookups,
1008 * these get consulted when OF based clock lookup fails (that is in the
1009 * case of not yet adjusted device tree data, where clock related specs
1010 * are missing)
1011 */
1012static void mpc5121_clk_provide_backwards_compat(void)
1013{
1014 enum did_reg_flags {
1015 DID_REG_PSC = BIT(0),
1016 DID_REG_PSCFIFO = BIT(1),
1017 DID_REG_NFC = BIT(2),
1018 DID_REG_CAN = BIT(3),
1019 DID_REG_I2C = BIT(4),
1020 DID_REG_DIU = BIT(5),
1021 DID_REG_VIU = BIT(6),
1022 DID_REG_FEC = BIT(7),
1023 DID_REG_USB = BIT(8),
1024 DID_REG_PATA = BIT(9),
1025 };
1026
1027 int did_register;
1028 struct device_node *np;
1029 struct resource res;
1030 int idx;
1031 char devname[32];
1032
1033 did_register = 0;
1034
1035 FOR_NODES(mpc512x_select_psc_compat()) {
1036 NODE_PREP;
1037 idx = (res.start >> 8) & 0xf;
1038 NODE_CHK("ipg", clks[MPC512x_CLK_PSC0 + idx], 0, PSC);
1039 NODE_CHK("mclk", clks[MPC512x_CLK_PSC0_MCLK + idx], 0, PSC);
1040 }
1041
1042 FOR_NODES("fsl,mpc5121-psc-fifo") {
1043 NODE_PREP;
1044 NODE_CHK("ipg", clks[MPC512x_CLK_PSC_FIFO], 1, PSCFIFO);
1045 }
1046
1047 FOR_NODES("fsl,mpc5121-nfc") {
1048 NODE_PREP;
1049 NODE_CHK("ipg", clks[MPC512x_CLK_NFC], 0, NFC);
1050 }
1051
1052 FOR_NODES("fsl,mpc5121-mscan") {
1053 NODE_PREP;
1054 idx = 0;
1055 idx += (res.start & 0x2000) ? 2 : 0;
1056 idx += (res.start & 0x0080) ? 1 : 0;
1057 NODE_CHK("ipg", clks[MPC512x_CLK_BDLC], 0, CAN);
1058 NODE_CHK("mclk", clks[MPC512x_CLK_MSCAN0_MCLK + idx], 0, CAN);
1059 }
1060
1061 /*
1062 * do register the 'ips', 'sys', and 'ref' names globally
1063 * instead of inside each individual CAN node, as there is no
1064 * potential for a name conflict (in contrast to 'ipg' and 'mclk')
1065 */
1066 if (did_register & DID_REG_CAN) {
1067 clk_register_clkdev(clks[MPC512x_CLK_IPS], "ips", NULL);
1068 clk_register_clkdev(clks[MPC512x_CLK_SYS], "sys", NULL);
1069 clk_register_clkdev(clks[MPC512x_CLK_REF], "ref", NULL);
1070 }
1071
1072 FOR_NODES("fsl,mpc5121-i2c") {
1073 NODE_PREP;
1074 NODE_CHK("ipg", clks[MPC512x_CLK_I2C], 0, I2C);
1075 }
1076
1077 /*
1078 * workaround for the fact that the I2C driver does an "anonymous"
1079 * lookup (NULL name spec, which yields the first clock spec) for
1080 * which we cannot register an alias -- a _global_ 'ipg' alias that
1081 * is not bound to any device name and returns the I2C clock item
1082 * is not a good idea
1083 *
1084 * so we have the lookup in the peripheral driver fail, which is
1085 * silent and non-fatal, and pre-enable the clock item here such
1086 * that register access is possible
1087 *
1088 * see commit b3bfce2b "i2c: mpc: cleanup clock API use" for
1089 * details, adjusting s/NULL/"ipg"/ in i2c-mpc.c would make this
1090 * workaround obsolete
1091 */
1092 if (did_register & DID_REG_I2C)
1093 clk_prepare_enable(clks[MPC512x_CLK_I2C]);
1094
1095 FOR_NODES("fsl,mpc5121-diu") {
1096 NODE_PREP;
1097 NODE_CHK("ipg", clks[MPC512x_CLK_DIU], 1, DIU);
1098 }
1099
1100 FOR_NODES("fsl,mpc5121-viu") {
1101 NODE_PREP;
1102 NODE_CHK("ipg", clks[MPC512x_CLK_VIU], 0, VIU);
1103 }
1104
1105 /*
1106 * note that 2771399a "fs_enet: cleanup clock API use" did use the
1107 * "per" string for the clock lookup in contrast to the "ipg" name
1108 * which most other nodes are using -- this is not a fatal thing
1109 * but just something to keep in mind when doing compatibility
1110 * registration, it's a non-issue with up-to-date device tree data
1111 */
1112 FOR_NODES("fsl,mpc5121-fec") {
1113 NODE_PREP;
1114 NODE_CHK("per", clks[MPC512x_CLK_FEC], 0, FEC);
1115 }
1116 FOR_NODES("fsl,mpc5121-fec-mdio") {
1117 NODE_PREP;
1118 NODE_CHK("per", clks[MPC512x_CLK_FEC], 0, FEC);
1119 }
1120 /*
1121 * MPC5125 has two FECs: FEC1 at 0x2800, FEC2 at 0x4800;
1122 * the clock items don't "form an array" since FEC2 was
1123 * added only later and was not allowed to shift all other
1124 * clock item indices, so the numbers aren't adjacent
1125 */
1126 FOR_NODES("fsl,mpc5125-fec") {
1127 NODE_PREP;
1128 if (res.start & 0x4000)
1129 idx = MPC512x_CLK_FEC2;
1130 else
1131 idx = MPC512x_CLK_FEC;
1132 NODE_CHK("per", clks[idx], 0, FEC);
1133 }
1134
1135 FOR_NODES("fsl,mpc5121-usb2-dr") {
1136 NODE_PREP;
1137 idx = (res.start & 0x4000) ? 1 : 0;
1138 NODE_CHK("ipg", clks[MPC512x_CLK_USB1 + idx], 0, USB);
1139 }
1140
1141 FOR_NODES("fsl,mpc5121-pata") {
1142 NODE_PREP;
1143 NODE_CHK("ipg", clks[MPC512x_CLK_PATA], 0, PATA);
1144 }
1145
1146 /*
1147 * try to collapse diagnostics into a single line of output yet
1148 * provide a full list of what is missing, to avoid noise in the
1149 * absence of up-to-date device tree data -- backwards
1150 * compatibility to old DTBs is a requirement, updates may be
1151 * desirable or preferrable but are not at all mandatory
1152 */
1153 if (did_register) {
1154 pr_notice("device tree lacks clock specs, adding fallbacks (0x%x,%s%s%s%s%s%s%s%s%s%s)\n",
1155 did_register,
1156 (did_register & DID_REG_PSC) ? " PSC" : "",
1157 (did_register & DID_REG_PSCFIFO) ? " PSCFIFO" : "",
1158 (did_register & DID_REG_NFC) ? " NFC" : "",
1159 (did_register & DID_REG_CAN) ? " CAN" : "",
1160 (did_register & DID_REG_I2C) ? " I2C" : "",
1161 (did_register & DID_REG_DIU) ? " DIU" : "",
1162 (did_register & DID_REG_VIU) ? " VIU" : "",
1163 (did_register & DID_REG_FEC) ? " FEC" : "",
1164 (did_register & DID_REG_USB) ? " USB" : "",
1165 (did_register & DID_REG_PATA) ? " PATA" : "");
1166 } else {
1167 pr_debug("device tree has clock specs, no fallbacks added\n");
1168 }
1169}
1170
1171int __init mpc5121_clk_init(void)
1172{
1173 struct device_node *clk_np;
1174 int busfreq;
1175
1176 /* map the clock control registers */
1177 clk_np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
1178 if (!clk_np)
1179 return -ENODEV;
1180 clkregs = of_iomap(clk_np, 0);
1181 WARN_ON(!clkregs);
1182
1183 /* determine the SoC variant we run on */
1184 mpc512x_clk_determine_soc();
1185
1186 /* invalidate all not yet registered clock slots */
1187 mpc512x_clk_preset_data();
1188
1189 /*
1190 * have the device tree scanned for "fixed-clock" nodes (which
1191 * includes the oscillator node if the board's DT provides one)
1192 */
1193 of_clk_init(NULL);
1194
1195 /*
1196 * add a dummy clock for those situations where a clock spec is
1197 * required yet no real clock is involved
1198 */
1199 clks[MPC512x_CLK_DUMMY] = mpc512x_clk_fixed("dummy", 0);
1200
1201 /*
1202 * have all the real nodes in the clock tree populated from REF
1203 * down to all leaves, either starting from the OSC node or from
1204 * a REF root that was created from the IPS bus clock input
1205 */
1206 busfreq = get_freq_from_dt("bus-frequency");
1207 mpc512x_clk_setup_clock_tree(clk_np, busfreq);
1208
1209 /* register as an OF clock provider */
1210 mpc5121_clk_register_of_provider(clk_np);
1211
1212 /*
1213 * unbreak not yet adjusted peripheral drivers during migration
1214 * towards fully operational common clock support, and allow
1215 * operation in the absence of clock related device tree specs
1216 */
1217 mpc5121_clk_provide_migration_support();
1218 mpc5121_clk_provide_backwards_compat();
1219
1220 return 0;
1221}
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
deleted file mode 100644
index fd8a37653417..000000000000
--- a/arch/powerpc/platforms/512x/clock.c
+++ /dev/null
@@ -1,754 +0,0 @@
1/*
2 * Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved.
3 *
4 * Author: John Rigby <jrigby@freescale.com>
5 *
6 * Implements the clk api defined in include/linux/clk.h
7 *
8 * Original based on linux/arch/arm/mach-integrator/clock.c
9 *
10 * Copyright (C) 2004 ARM Limited.
11 * Written by Deep Blue Solutions Limited.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/errno.h>
20#include <linux/err.h>
21#include <linux/module.h>
22#include <linux/string.h>
23#include <linux/clk.h>
24#include <linux/mutex.h>
25#include <linux/io.h>
26
27#include <linux/of_address.h>
28#include <linux/of_platform.h>
29#include <asm/mpc5xxx.h>
30#include <asm/mpc5121.h>
31#include <asm/clk_interface.h>
32
33#include "mpc512x.h"
34
35#undef CLK_DEBUG
36
37static int clocks_initialized;
38
39#define CLK_HAS_RATE 0x1 /* has rate in MHz */
40#define CLK_HAS_CTRL 0x2 /* has control reg and bit */
41
42struct clk {
43 struct list_head node;
44 char name[32];
45 int flags;
46 struct device *dev;
47 unsigned long rate;
48 struct module *owner;
49 void (*calc) (struct clk *);
50 struct clk *parent;
51 int reg, bit; /* CLK_HAS_CTRL */
52 int div_shift; /* only used by generic_div_clk_calc */
53};
54
55static LIST_HEAD(clocks);
56static DEFINE_MUTEX(clocks_mutex);
57
58static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
59{
60 struct clk *p, *clk = ERR_PTR(-ENOENT);
61 int dev_match;
62 int id_match;
63
64 if (dev == NULL || id == NULL)
65 return clk;
66
67 mutex_lock(&clocks_mutex);
68 list_for_each_entry(p, &clocks, node) {
69 dev_match = id_match = 0;
70
71 if (dev == p->dev)
72 dev_match++;
73 if (strcmp(id, p->name) == 0)
74 id_match++;
75 if ((dev_match || id_match) && try_module_get(p->owner)) {
76 clk = p;
77 break;
78 }
79 }
80 mutex_unlock(&clocks_mutex);
81
82 return clk;
83}
84
85#ifdef CLK_DEBUG
86static void dump_clocks(void)
87{
88 struct clk *p;
89
90 mutex_lock(&clocks_mutex);
91 printk(KERN_INFO "CLOCKS:\n");
92 list_for_each_entry(p, &clocks, node) {
93 pr_info(" %s=%ld", p->name, p->rate);
94 if (p->parent)
95 pr_cont(" %s=%ld", p->parent->name,
96 p->parent->rate);
97 if (p->flags & CLK_HAS_CTRL)
98 pr_cont(" reg/bit=%d/%d", p->reg, p->bit);
99 pr_cont("\n");
100 }
101 mutex_unlock(&clocks_mutex);
102}
103#define DEBUG_CLK_DUMP() dump_clocks()
104#else
105#define DEBUG_CLK_DUMP()
106#endif
107
108
109static void mpc5121_clk_put(struct clk *clk)
110{
111 module_put(clk->owner);
112}
113
114#define NRPSC 12
115
116struct mpc512x_clockctl {
117 u32 spmr; /* System PLL Mode Reg */
118 u32 sccr[2]; /* System Clk Ctrl Reg 1 & 2 */
119 u32 scfr1; /* System Clk Freq Reg 1 */
120 u32 scfr2; /* System Clk Freq Reg 2 */
121 u32 reserved;
122 u32 bcr; /* Bread Crumb Reg */
123 u32 pccr[NRPSC]; /* PSC Clk Ctrl Reg 0-11 */
124 u32 spccr; /* SPDIF Clk Ctrl Reg */
125 u32 cccr; /* CFM Clk Ctrl Reg */
126 u32 dccr; /* DIU Clk Cnfg Reg */
127};
128
129static struct mpc512x_clockctl __iomem *clockctl;
130
131static int mpc5121_clk_enable(struct clk *clk)
132{
133 unsigned int mask;
134
135 if (clk->flags & CLK_HAS_CTRL) {
136 mask = in_be32(&clockctl->sccr[clk->reg]);
137 mask |= 1 << clk->bit;
138 out_be32(&clockctl->sccr[clk->reg], mask);
139 }
140 return 0;
141}
142
143static void mpc5121_clk_disable(struct clk *clk)
144{
145 unsigned int mask;
146
147 if (clk->flags & CLK_HAS_CTRL) {
148 mask = in_be32(&clockctl->sccr[clk->reg]);
149 mask &= ~(1 << clk->bit);
150 out_be32(&clockctl->sccr[clk->reg], mask);
151 }
152}
153
154static unsigned long mpc5121_clk_get_rate(struct clk *clk)
155{
156 if (clk->flags & CLK_HAS_RATE)
157 return clk->rate;
158 else
159 return 0;
160}
161
162static long mpc5121_clk_round_rate(struct clk *clk, unsigned long rate)
163{
164 return rate;
165}
166
167static int mpc5121_clk_set_rate(struct clk *clk, unsigned long rate)
168{
169 return 0;
170}
171
172static int clk_register(struct clk *clk)
173{
174 mutex_lock(&clocks_mutex);
175 list_add(&clk->node, &clocks);
176 mutex_unlock(&clocks_mutex);
177 return 0;
178}
179
180static unsigned long spmf_mult(void)
181{
182 /*
183 * Convert spmf to multiplier
184 */
185 static int spmf_to_mult[] = {
186 68, 1, 12, 16,
187 20, 24, 28, 32,
188 36, 40, 44, 48,
189 52, 56, 60, 64
190 };
191 int spmf = (in_be32(&clockctl->spmr) >> 24) & 0xf;
192 return spmf_to_mult[spmf];
193}
194
195static unsigned long sysdiv_div_x_2(void)
196{
197 /*
198 * Convert sysdiv to divisor x 2
199 * Some divisors have fractional parts so
200 * multiply by 2 then divide by this value
201 */
202 static int sysdiv_to_div_x_2[] = {
203 4, 5, 6, 7,
204 8, 9, 10, 14,
205 12, 16, 18, 22,
206 20, 24, 26, 30,
207 28, 32, 34, 38,
208 36, 40, 42, 46,
209 44, 48, 50, 54,
210 52, 56, 58, 62,
211 60, 64, 66,
212 };
213 int sysdiv = (in_be32(&clockctl->scfr2) >> 26) & 0x3f;
214 return sysdiv_to_div_x_2[sysdiv];
215}
216
217static unsigned long ref_to_sys(unsigned long rate)
218{
219 rate *= spmf_mult();
220 rate *= 2;
221 rate /= sysdiv_div_x_2();
222
223 return rate;
224}
225
226static unsigned long sys_to_ref(unsigned long rate)
227{
228 rate *= sysdiv_div_x_2();
229 rate /= 2;
230 rate /= spmf_mult();
231
232 return rate;
233}
234
235static long ips_to_ref(unsigned long rate)
236{
237 int ips_div = (in_be32(&clockctl->scfr1) >> 23) & 0x7;
238
239 rate *= ips_div; /* csb_clk = ips_clk * ips_div */
240 rate *= 2; /* sys_clk = csb_clk * 2 */
241 return sys_to_ref(rate);
242}
243
244static unsigned long devtree_getfreq(char *clockname)
245{
246 struct device_node *np;
247 const unsigned int *prop;
248 unsigned int val = 0;
249
250 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-immr");
251 if (np) {
252 prop = of_get_property(np, clockname, NULL);
253 if (prop)
254 val = *prop;
255 of_node_put(np);
256 }
257 return val;
258}
259
260static void ref_clk_calc(struct clk *clk)
261{
262 unsigned long rate;
263
264 rate = devtree_getfreq("bus-frequency");
265 if (rate == 0) {
266 printk(KERN_ERR "No bus-frequency in dev tree\n");
267 clk->rate = 0;
268 return;
269 }
270 clk->rate = ips_to_ref(rate);
271}
272
273static struct clk ref_clk = {
274 .name = "ref_clk",
275 .calc = ref_clk_calc,
276};
277
278
279static void sys_clk_calc(struct clk *clk)
280{
281 clk->rate = ref_to_sys(ref_clk.rate);
282}
283
284static struct clk sys_clk = {
285 .name = "sys_clk",
286 .calc = sys_clk_calc,
287};
288
289static void diu_clk_calc(struct clk *clk)
290{
291 int diudiv_x_2 = in_be32(&clockctl->scfr1) & 0xff;
292 unsigned long rate;
293
294 rate = sys_clk.rate;
295
296 rate *= 2;
297 rate /= diudiv_x_2;
298
299 clk->rate = rate;
300}
301
302static void viu_clk_calc(struct clk *clk)
303{
304 unsigned long rate;
305
306 rate = sys_clk.rate;
307 rate /= 2;
308 clk->rate = rate;
309}
310
311static void half_clk_calc(struct clk *clk)
312{
313 clk->rate = clk->parent->rate / 2;
314}
315
316static void generic_div_clk_calc(struct clk *clk)
317{
318 int div = (in_be32(&clockctl->scfr1) >> clk->div_shift) & 0x7;
319
320 clk->rate = clk->parent->rate / div;
321}
322
323static void unity_clk_calc(struct clk *clk)
324{
325 clk->rate = clk->parent->rate;
326}
327
328static struct clk csb_clk = {
329 .name = "csb_clk",
330 .calc = half_clk_calc,
331 .parent = &sys_clk,
332};
333
334static void e300_clk_calc(struct clk *clk)
335{
336 int spmf = (in_be32(&clockctl->spmr) >> 16) & 0xf;
337 int ratex2 = clk->parent->rate * spmf;
338
339 clk->rate = ratex2 / 2;
340}
341
342static struct clk e300_clk = {
343 .name = "e300_clk",
344 .calc = e300_clk_calc,
345 .parent = &csb_clk,
346};
347
348static struct clk ips_clk = {
349 .name = "ips_clk",
350 .calc = generic_div_clk_calc,
351 .parent = &csb_clk,
352 .div_shift = 23,
353};
354
355/*
356 * Clocks controlled by SCCR1 (.reg = 0)
357 */
358static struct clk lpc_clk = {
359 .name = "lpc_clk",
360 .flags = CLK_HAS_CTRL,
361 .reg = 0,
362 .bit = 30,
363 .calc = generic_div_clk_calc,
364 .parent = &ips_clk,
365 .div_shift = 11,
366};
367
368static struct clk nfc_clk = {
369 .name = "nfc_clk",
370 .flags = CLK_HAS_CTRL,
371 .reg = 0,
372 .bit = 29,
373 .calc = generic_div_clk_calc,
374 .parent = &ips_clk,
375 .div_shift = 8,
376};
377
378static struct clk pata_clk = {
379 .name = "pata_clk",
380 .flags = CLK_HAS_CTRL,
381 .reg = 0,
382 .bit = 28,
383 .calc = unity_clk_calc,
384 .parent = &ips_clk,
385};
386
387/*
388 * PSC clocks (bits 27 - 16)
389 * are setup elsewhere
390 */
391
392static struct clk sata_clk = {
393 .name = "sata_clk",
394 .flags = CLK_HAS_CTRL,
395 .reg = 0,
396 .bit = 14,
397 .calc = unity_clk_calc,
398 .parent = &ips_clk,
399};
400
401static struct clk fec_clk = {
402 .name = "fec_clk",
403 .flags = CLK_HAS_CTRL,
404 .reg = 0,
405 .bit = 13,
406 .calc = unity_clk_calc,
407 .parent = &ips_clk,
408};
409
410static struct clk pci_clk = {
411 .name = "pci_clk",
412 .flags = CLK_HAS_CTRL,
413 .reg = 0,
414 .bit = 11,
415 .calc = generic_div_clk_calc,
416 .parent = &csb_clk,
417 .div_shift = 20,
418};
419
420/*
421 * Clocks controlled by SCCR2 (.reg = 1)
422 */
423static struct clk diu_clk = {
424 .name = "diu_clk",
425 .flags = CLK_HAS_CTRL,
426 .reg = 1,
427 .bit = 31,
428 .calc = diu_clk_calc,
429};
430
431static struct clk viu_clk = {
432 .name = "viu_clk",
433 .flags = CLK_HAS_CTRL,
434 .reg = 1,
435 .bit = 18,
436 .calc = viu_clk_calc,
437};
438
439static struct clk axe_clk = {
440 .name = "axe_clk",
441 .flags = CLK_HAS_CTRL,
442 .reg = 1,
443 .bit = 30,
444 .calc = unity_clk_calc,
445 .parent = &csb_clk,
446};
447
448static struct clk usb1_clk = {
449 .name = "usb1_clk",
450 .flags = CLK_HAS_CTRL,
451 .reg = 1,
452 .bit = 28,
453 .calc = unity_clk_calc,
454 .parent = &csb_clk,
455};
456
457static struct clk usb2_clk = {
458 .name = "usb2_clk",
459 .flags = CLK_HAS_CTRL,
460 .reg = 1,
461 .bit = 27,
462 .calc = unity_clk_calc,
463 .parent = &csb_clk,
464};
465
466static struct clk i2c_clk = {
467 .name = "i2c_clk",
468 .flags = CLK_HAS_CTRL,
469 .reg = 1,
470 .bit = 26,
471 .calc = unity_clk_calc,
472 .parent = &ips_clk,
473};
474
475static struct clk mscan_clk = {
476 .name = "mscan_clk",
477 .flags = CLK_HAS_CTRL,
478 .reg = 1,
479 .bit = 25,
480 .calc = unity_clk_calc,
481 .parent = &ips_clk,
482};
483
484static struct clk sdhc_clk = {
485 .name = "sdhc_clk",
486 .flags = CLK_HAS_CTRL,
487 .reg = 1,
488 .bit = 24,
489 .calc = unity_clk_calc,
490 .parent = &ips_clk,
491};
492
493static struct clk mbx_bus_clk = {
494 .name = "mbx_bus_clk",
495 .flags = CLK_HAS_CTRL,
496 .reg = 1,
497 .bit = 22,
498 .calc = half_clk_calc,
499 .parent = &csb_clk,
500};
501
502static struct clk mbx_clk = {
503 .name = "mbx_clk",
504 .flags = CLK_HAS_CTRL,
505 .reg = 1,
506 .bit = 21,
507 .calc = unity_clk_calc,
508 .parent = &csb_clk,
509};
510
511static struct clk mbx_3d_clk = {
512 .name = "mbx_3d_clk",
513 .flags = CLK_HAS_CTRL,
514 .reg = 1,
515 .bit = 20,
516 .calc = generic_div_clk_calc,
517 .parent = &mbx_bus_clk,
518 .div_shift = 14,
519};
520
521static void psc_mclk_in_calc(struct clk *clk)
522{
523 clk->rate = devtree_getfreq("psc_mclk_in");
524 if (!clk->rate)
525 clk->rate = 25000000;
526}
527
528static struct clk psc_mclk_in = {
529 .name = "psc_mclk_in",
530 .calc = psc_mclk_in_calc,
531};
532
533static struct clk spdif_txclk = {
534 .name = "spdif_txclk",
535 .flags = CLK_HAS_CTRL,
536 .reg = 1,
537 .bit = 23,
538};
539
540static struct clk spdif_rxclk = {
541 .name = "spdif_rxclk",
542 .flags = CLK_HAS_CTRL,
543 .reg = 1,
544 .bit = 23,
545};
546
547static void ac97_clk_calc(struct clk *clk)
548{
549 /* ac97 bit clock is always 24.567 MHz */
550 clk->rate = 24567000;
551}
552
553static struct clk ac97_clk = {
554 .name = "ac97_clk_in",
555 .calc = ac97_clk_calc,
556};
557
558static struct clk *rate_clks[] = {
559 &ref_clk,
560 &sys_clk,
561 &diu_clk,
562 &viu_clk,
563 &csb_clk,
564 &e300_clk,
565 &ips_clk,
566 &fec_clk,
567 &sata_clk,
568 &pata_clk,
569 &nfc_clk,
570 &lpc_clk,
571 &mbx_bus_clk,
572 &mbx_clk,
573 &mbx_3d_clk,
574 &axe_clk,
575 &usb1_clk,
576 &usb2_clk,
577 &i2c_clk,
578 &mscan_clk,
579 &sdhc_clk,
580 &pci_clk,
581 &psc_mclk_in,
582 &spdif_txclk,
583 &spdif_rxclk,
584 &ac97_clk,
585 NULL
586};
587
588static void rate_clk_init(struct clk *clk)
589{
590 if (clk->calc) {
591 clk->calc(clk);
592 clk->flags |= CLK_HAS_RATE;
593 clk_register(clk);
594 } else {
595 printk(KERN_WARNING
596 "Could not initialize clk %s without a calc routine\n",
597 clk->name);
598 }
599}
600
601static void rate_clks_init(void)
602{
603 struct clk **cpp, *clk;
604
605 cpp = rate_clks;
606 while ((clk = *cpp++))
607 rate_clk_init(clk);
608}
609
610/*
611 * There are two clk enable registers with 32 enable bits each
612 * psc clocks and device clocks are all stored in dev_clks
613 */
614static struct clk dev_clks[2][32];
615
616/*
617 * Given a psc number return the dev_clk
618 * associated with it
619 */
620static struct clk *psc_dev_clk(int pscnum)
621{
622 int reg, bit;
623 struct clk *clk;
624
625 reg = 0;
626 bit = 27 - pscnum;
627
628 clk = &dev_clks[reg][bit];
629 clk->reg = 0;
630 clk->bit = bit;
631 return clk;
632}
633
634/*
635 * PSC clock rate calculation
636 */
637static void psc_calc_rate(struct clk *clk, int pscnum, struct device_node *np)
638{
639 unsigned long mclk_src = sys_clk.rate;
640 unsigned long mclk_div;
641
642 /*
643 * Can only change value of mclk divider
644 * when the divider is disabled.
645 *
646 * Zero is not a valid divider so minimum
647 * divider is 1
648 *
649 * disable/set divider/enable
650 */
651 out_be32(&clockctl->pccr[pscnum], 0);
652 out_be32(&clockctl->pccr[pscnum], 0x00020000);
653 out_be32(&clockctl->pccr[pscnum], 0x00030000);
654
655 if (in_be32(&clockctl->pccr[pscnum]) & 0x80) {
656 clk->rate = spdif_rxclk.rate;
657 return;
658 }
659
660 switch ((in_be32(&clockctl->pccr[pscnum]) >> 14) & 0x3) {
661 case 0:
662 mclk_src = sys_clk.rate;
663 break;
664 case 1:
665 mclk_src = ref_clk.rate;
666 break;
667 case 2:
668 mclk_src = psc_mclk_in.rate;
669 break;
670 case 3:
671 mclk_src = spdif_txclk.rate;
672 break;
673 }
674
675 mclk_div = ((in_be32(&clockctl->pccr[pscnum]) >> 17) & 0x7fff) + 1;
676 clk->rate = mclk_src / mclk_div;
677}
678
679/*
680 * Find all psc nodes in device tree and assign a clock
681 * with name "psc%d_mclk" and dev pointing at the device
682 * returned from of_find_device_by_node
683 */
684static void psc_clks_init(void)
685{
686 struct device_node *np;
687 struct platform_device *ofdev;
688 u32 reg;
689 const char *psc_compat;
690
691 psc_compat = mpc512x_select_psc_compat();
692 if (!psc_compat)
693 return;
694
695 for_each_compatible_node(np, NULL, psc_compat) {
696 if (!of_property_read_u32(np, "reg", &reg)) {
697 int pscnum = (reg & 0xf00) >> 8;
698 struct clk *clk = psc_dev_clk(pscnum);
699
700 clk->flags = CLK_HAS_RATE | CLK_HAS_CTRL;
701 ofdev = of_find_device_by_node(np);
702 clk->dev = &ofdev->dev;
703 /*
704 * AC97 is special rate clock does
705 * not go through normal path
706 */
707 if (of_device_is_compatible(np, "fsl,mpc5121-psc-ac97"))
708 clk->rate = ac97_clk.rate;
709 else
710 psc_calc_rate(clk, pscnum, np);
711 sprintf(clk->name, "psc%d_mclk", pscnum);
712 clk_register(clk);
713 clk_enable(clk);
714 }
715 }
716}
717
718static struct clk_interface mpc5121_clk_functions = {
719 .clk_get = mpc5121_clk_get,
720 .clk_enable = mpc5121_clk_enable,
721 .clk_disable = mpc5121_clk_disable,
722 .clk_get_rate = mpc5121_clk_get_rate,
723 .clk_put = mpc5121_clk_put,
724 .clk_round_rate = mpc5121_clk_round_rate,
725 .clk_set_rate = mpc5121_clk_set_rate,
726 .clk_set_parent = NULL,
727 .clk_get_parent = NULL,
728};
729
730int __init mpc5121_clk_init(void)
731{
732 struct device_node *np;
733
734 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
735 if (np) {
736 clockctl = of_iomap(np, 0);
737 of_node_put(np);
738 }
739
740 if (!clockctl) {
741 printk(KERN_ERR "Could not map clock control registers\n");
742 return 0;
743 }
744
745 rate_clks_init();
746 psc_clks_init();
747
748 /* leave clockctl mapped forever */
749 /*iounmap(clockctl); */
750 DEBUG_CLK_DUMP();
751 clocks_initialized++;
752 clk_functions = mpc5121_clk_functions;
753 return 0;
754}
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 36b5652aada2..adb95f03d4d4 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -12,6 +12,7 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/clk.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <linux/irq.h> 18#include <linux/irq.h>
@@ -68,98 +69,112 @@ struct fsl_diu_shared_fb {
68 bool in_use; 69 bool in_use;
69}; 70};
70 71
71#define DIU_DIV_MASK 0x000000ff 72/* receives a pixel clock spec in pico seconds, adjusts the DIU clock rate */
72static void mpc512x_set_pixel_clock(unsigned int pixclock) 73static void mpc512x_set_pixel_clock(unsigned int pixclock)
73{ 74{
74 unsigned long bestval, bestfreq, speed, busfreq;
75 unsigned long minpixclock, maxpixclock, pixval;
76 struct mpc512x_ccm __iomem *ccm;
77 struct device_node *np; 75 struct device_node *np;
78 u32 temp; 76 struct clk *clk_diu;
79 long err; 77 unsigned long epsilon, minpixclock, maxpixclock;
80 int i; 78 unsigned long offset, want, got, delta;
81 79
82 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock"); 80 /* lookup and enable the DIU clock */
81 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-diu");
83 if (!np) { 82 if (!np) {
84 pr_err("Can't find clock control module.\n"); 83 pr_err("Could not find DIU device tree node.\n");
85 return; 84 return;
86 } 85 }
87 86 clk_diu = of_clk_get(np, 0);
88 ccm = of_iomap(np, 0); 87 if (IS_ERR(clk_diu)) {
88 /* backwards compat with device trees that lack clock specs */
89 clk_diu = clk_get_sys(np->name, "ipg");
90 }
89 of_node_put(np); 91 of_node_put(np);
90 if (!ccm) { 92 if (IS_ERR(clk_diu)) {
91 pr_err("Can't map clock control module reg.\n"); 93 pr_err("Could not lookup DIU clock.\n");
92 return; 94 return;
93 } 95 }
94 96 if (clk_prepare_enable(clk_diu)) {
95 np = of_find_node_by_type(NULL, "cpu"); 97 pr_err("Could not enable DIU clock.\n");
96 if (np) {
97 const unsigned int *prop =
98 of_get_property(np, "bus-frequency", NULL);
99
100 of_node_put(np);
101 if (prop) {
102 busfreq = *prop;
103 } else {
104 pr_err("Can't get bus-frequency property\n");
105 return;
106 }
107 } else {
108 pr_err("Can't find 'cpu' node.\n");
109 return; 98 return;
110 } 99 }
111 100
112 /* Pixel Clock configuration */ 101 /*
113 pr_debug("DIU: Bus Frequency = %lu\n", busfreq); 102 * convert the picoseconds spec into the desired clock rate,
114 speed = busfreq * 4; /* DIU_DIV ratio is 4 * CSB_CLK / DIU_CLK */ 103 * determine the acceptable clock range for the monitor (+/- 5%),
115 104 * do the calculation in steps to avoid integer overflow
116 /* Calculate the pixel clock with the smallest error */ 105 */
117 /* calculate the following in steps to avoid overflow */ 106 pr_debug("DIU pixclock in ps - %u\n", pixclock);
118 pr_debug("DIU pixclock in ps - %d\n", pixclock); 107 pixclock = (1000000000 / pixclock) * 1000;
119 temp = (1000000000 / pixclock) * 1000; 108 pr_debug("DIU pixclock freq - %u\n", pixclock);
120 pixclock = temp; 109 epsilon = pixclock / 20; /* pixclock * 0.05 */
121 pr_debug("DIU pixclock freq - %u\n", pixclock); 110 pr_debug("DIU deviation - %lu\n", epsilon);
122 111 minpixclock = pixclock - epsilon;
123 temp = temp / 20; /* pixclock * 0.05 */ 112 maxpixclock = pixclock + epsilon;
124 pr_debug("deviation = %d\n", temp); 113 pr_debug("DIU minpixclock - %lu\n", minpixclock);
125 minpixclock = pixclock - temp; 114 pr_debug("DIU maxpixclock - %lu\n", maxpixclock);
126 maxpixclock = pixclock + temp; 115
127 pr_debug("DIU minpixclock - %lu\n", minpixclock); 116 /*
128 pr_debug("DIU maxpixclock - %lu\n", maxpixclock); 117 * check whether the DIU supports the desired pixel clock
129 pixval = speed/pixclock; 118 *
130 pr_debug("DIU pixval = %lu\n", pixval); 119 * - simply request the desired clock and see what the
131 120 * platform's clock driver will make of it, assuming that it
132 err = LONG_MAX; 121 * will setup the best approximation of the requested value
133 bestval = pixval; 122 * - try other candidate frequencies in the order of decreasing
134 pr_debug("DIU bestval = %lu\n", bestval); 123 * preference (i.e. with increasing distance from the desired
135 124 * pixel clock, and checking the lower frequency before the
136 bestfreq = 0; 125 * higher frequency to not overload the hardware) until the
137 for (i = -1; i <= 1; i++) { 126 * first match is found -- any potential subsequent match
138 temp = speed / (pixval+i); 127 * would only be as good as the former match or typically
139 pr_debug("DIU test pixval i=%d, pixval=%lu, temp freq. = %u\n", 128 * would be less preferrable
140 i, pixval, temp); 129 *
141 if ((temp < minpixclock) || (temp > maxpixclock)) 130 * the offset increment of pixelclock divided by 64 is an
142 pr_debug("DIU exceeds monitor range (%lu to %lu)\n", 131 * arbitrary choice -- it's simple to calculate, in the typical
143 minpixclock, maxpixclock); 132 * case we expect the first check to succeed already, in the
144 else if (abs(temp - pixclock) < err) { 133 * worst case seven frequencies get tested (the exact center and
145 pr_debug("Entered the else if block %d\n", i); 134 * three more values each to the left and to the right) before
146 err = abs(temp - pixclock); 135 * the 5% tolerance window is exceeded, resulting in fast enough
147 bestval = pixval + i; 136 * execution yet high enough probability of finding a suitable
148 bestfreq = temp; 137 * value, while the error rate will be in the order of single
149 } 138 * percents
139 */
140 for (offset = 0; offset <= epsilon; offset += pixclock / 64) {
141 want = pixclock - offset;
142 pr_debug("DIU checking clock - %lu\n", want);
143 clk_set_rate(clk_diu, want);
144 got = clk_get_rate(clk_diu);
145 delta = abs(pixclock - got);
146 if (delta < epsilon)
147 break;
148 if (!offset)
149 continue;
150 want = pixclock + offset;
151 pr_debug("DIU checking clock - %lu\n", want);
152 clk_set_rate(clk_diu, want);
153 got = clk_get_rate(clk_diu);
154 delta = abs(pixclock - got);
155 if (delta < epsilon)
156 break;
150 } 157 }
158 if (offset <= epsilon) {
159 pr_debug("DIU clock accepted - %lu\n", want);
160 pr_debug("DIU pixclock want %u, got %lu, delta %lu, eps %lu\n",
161 pixclock, got, delta, epsilon);
162 return;
163 }
164 pr_warn("DIU pixclock auto search unsuccessful\n");
151 165
152 pr_debug("DIU chose = %lx\n", bestval); 166 /*
153 pr_debug("DIU error = %ld\n NomPixClk ", err); 167 * what is the most appropriate action to take when the search
154 pr_debug("DIU: Best Freq = %lx\n", bestfreq); 168 * for an available pixel clock which is acceptable to the
155 /* Modify DIU_DIV in CCM SCFR1 */ 169 * monitor has failed? disable the DIU (clock) or just provide
156 temp = in_be32(&ccm->scfr1); 170 * a "best effort"? we go with the latter
157 pr_debug("DIU: Current value of SCFR1: 0x%08x\n", temp); 171 */
158 temp &= ~DIU_DIV_MASK; 172 pr_warn("DIU pixclock best effort fallback (backend's choice)\n");
159 temp |= (bestval & DIU_DIV_MASK); 173 clk_set_rate(clk_diu, pixclock);
160 out_be32(&ccm->scfr1, temp); 174 got = clk_get_rate(clk_diu);
161 pr_debug("DIU: Modified value of SCFR1: 0x%08x\n", temp); 175 delta = abs(pixclock - got);
162 iounmap(ccm); 176 pr_debug("DIU pixclock want %u, got %lu, delta %lu, eps %lu\n",
177 pixclock, got, delta, epsilon);
163} 178}
164 179
165static enum fsl_diu_monitor_port 180static enum fsl_diu_monitor_port
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig
index af54174801f7..b625a2c6f4f2 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -1,7 +1,7 @@
1config PPC_MPC52xx 1config PPC_MPC52xx
2 bool "52xx-based boards" 2 bool "52xx-based boards"
3 depends on 6xx 3 depends on 6xx
4 select PPC_CLOCK 4 select COMMON_CLK
5 select PPC_PCI_CHOICE 5 select PPC_PCI_CHOICE
6 6
7config PPC_MPC5200_SIMPLE 7config PPC_MPC5200_SIMPLE
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index be7b1aa4d54c..37f7a89c10f2 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -245,7 +245,7 @@ static irqreturn_t mpc52xx_lpbfifo_irq(int irq, void *dev_id)
245 245
246 if (dma && !write) { 246 if (dma && !write) {
247 spin_unlock_irqrestore(&lpbfifo.lock, flags); 247 spin_unlock_irqrestore(&lpbfifo.lock, flags);
248 pr_err("bogus LPBFIFO IRQ (dma and not writting)\n"); 248 pr_err("bogus LPBFIFO IRQ (dma and not writing)\n");
249 return IRQ_HANDLED; 249 return IRQ_HANDLED;
250 } 250 }
251 251
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index 670a033264c0..2bdc8c862c46 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -99,7 +99,6 @@ config SBC834x
99config ASP834x 99config ASP834x
100 bool "Analogue & Micro ASP 834x" 100 bool "Analogue & Micro ASP 834x"
101 select PPC_MPC834x 101 select PPC_MPC834x
102 select REDBOOT
103 help 102 help
104 This enables support for the Analogue & Micro ASP 83xx 103 This enables support for the Analogue & Micro ASP 83xx
105 board. 104 board.
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index fd71cfdf2380..e238b6a55b15 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -11,7 +11,6 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#include <linux/init.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/device.h> 16#include <linux/device.h>
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 3d9716ccd327..4b4c081df94d 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -10,7 +10,6 @@
10 * by the Free Software Foundation. 10 * by the Free Software Foundation.
11 */ 11 */
12 12
13#include <linux/init.h>
14#include <linux/pm.h> 13#include <linux/pm.h>
15#include <linux/types.h> 14#include <linux/types.h>
16#include <linux/ioport.h> 15#include <linux/ioport.h>
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 4d4634958cfb..c17aae80e7ff 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -123,6 +123,12 @@ config P1023_RDS
123 help 123 help
124 This option enables support for the P1023 RDS and RDB boards 124 This option enables support for the P1023 RDS and RDB boards
125 125
126config TWR_P102x
127 bool "Freescale TWR-P102x"
128 select DEFAULT_UIMAGE
129 help
130 This option enables support for the TWR-P1025 board.
131
126config SOCRATES 132config SOCRATES
127 bool "Socrates" 133 bool "Socrates"
128 select DEFAULT_UIMAGE 134 select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index dd4c0b59577b..25cebe74ac46 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -18,6 +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_TWR_P102x) += twr_p102x.o
21obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o 22obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o
22obj-$(CONFIG_STX_GP3) += stx_gp3.o 23obj-$(CONFIG_STX_GP3) += stx_gp3.o
23obj-$(CONFIG_TQM85xx) += tqm85xx.o 24obj-$(CONFIG_TQM85xx) += tqm85xx.o
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index eba78c85303f..3b085c7ee539 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -9,6 +9,7 @@
9#include <linux/of_irq.h> 9#include <linux/of_irq.h>
10#include <linux/of_platform.h> 10#include <linux/of_platform.h>
11 11
12#include <asm/qe.h>
12#include <sysdev/cpm2_pic.h> 13#include <sysdev/cpm2_pic.h>
13 14
14#include "mpc85xx.h" 15#include "mpc85xx.h"
@@ -82,3 +83,40 @@ void __init mpc85xx_cpm2_pic_init(void)
82 irq_set_chained_handler(irq, cpm2_cascade); 83 irq_set_chained_handler(irq, cpm2_cascade);
83} 84}
84#endif 85#endif
86
87#ifdef CONFIG_QUICC_ENGINE
88void __init mpc85xx_qe_init(void)
89{
90 struct device_node *np;
91
92 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
93 if (!np) {
94 np = of_find_node_by_name(NULL, "qe");
95 if (!np) {
96 pr_err("%s: Could not find Quicc Engine node\n",
97 __func__);
98 return;
99 }
100 }
101
102 if (!of_device_is_available(np)) {
103 of_node_put(np);
104 return;
105 }
106
107 qe_reset();
108 of_node_put(np);
109
110 np = of_find_node_by_name(NULL, "par_io");
111 if (np) {
112 struct device_node *ucc;
113
114 par_io_init(np);
115 of_node_put(np);
116
117 for_each_node_by_name(ucc, "ucc")
118 par_io_of_config(ucc);
119
120 }
121}
122#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h
index 2aa7c5dc2c7f..fc51dd4092e5 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx.h
+++ b/arch/powerpc/platforms/85xx/mpc85xx.h
@@ -8,4 +8,10 @@ extern void mpc85xx_cpm2_pic_init(void);
8static inline void __init mpc85xx_cpm2_pic_init(void) {} 8static inline void __init mpc85xx_cpm2_pic_init(void) {}
9#endif /* CONFIG_CPM2 */ 9#endif /* CONFIG_CPM2 */
10 10
11#ifdef CONFIG_QUICC_ENGINE
12extern void mpc85xx_qe_init(void);
13#else
14static inline void __init mpc85xx_qe_init(void) {}
15#endif
16
11#endif 17#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index a7b3621a8df5..34f3c5eb3bee 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2010, 2012 Freescale Semiconductor, Inc. 2 * Copyright (C) 2006-2010, 2012-2013 Freescale Semiconductor, Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Author: Andy Fleming <afleming@freescale.com> 5 * Author: Andy Fleming <afleming@freescale.com>
@@ -238,32 +238,7 @@ static void __init mpc85xx_mds_qe_init(void)
238{ 238{
239 struct device_node *np; 239 struct device_node *np;
240 240
241 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 241 mpc85xx_qe_init();
242 if (!np) {
243 np = of_find_node_by_name(NULL, "qe");
244 if (!np)
245 return;
246 }
247
248 if (!of_device_is_available(np)) {
249 of_node_put(np);
250 return;
251 }
252
253 qe_reset();
254 of_node_put(np);
255
256 np = of_find_node_by_name(NULL, "par_io");
257 if (np) {
258 struct device_node *ucc;
259
260 par_io_init(np);
261 of_node_put(np);
262
263 for_each_node_by_name(ucc, "ucc")
264 par_io_of_config(ucc);
265 }
266
267 mpc85xx_mds_reset_ucc_phys(); 242 mpc85xx_mds_reset_ucc_phys();
268 243
269 if (machine_is(p1021_mds)) { 244 if (machine_is(p1021_mds)) {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 53b6fb0a3d56..e15bdd18fdb2 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC85xx RDB Board Setup 2 * MPC85xx RDB Board Setup
3 * 3 *
4 * Copyright 2009,2012 Freescale Semiconductor Inc. 4 * Copyright 2009,2012-2013 Freescale Semiconductor Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 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 7 * under the terms of the GNU General Public License as published by the
@@ -98,26 +98,7 @@ static void __init mpc85xx_rdb_setup_arch(void)
98 fsl_pci_assign_primary(); 98 fsl_pci_assign_primary();
99 99
100#ifdef CONFIG_QUICC_ENGINE 100#ifdef CONFIG_QUICC_ENGINE
101 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 101 mpc85xx_qe_init();
102 if (!np) {
103 pr_err("%s: Could not find Quicc Engine node\n", __func__);
104 goto qe_fail;
105 }
106
107 qe_reset();
108 of_node_put(np);
109
110 np = of_find_node_by_name(NULL, "par_io");
111 if (np) {
112 struct device_node *ucc;
113
114 par_io_init(np);
115 of_node_put(np);
116
117 for_each_node_by_name(ucc, "ucc")
118 par_io_of_config(ucc);
119
120 }
121#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) 102#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
122 if (machine_is(p1025_rdb)) { 103 if (machine_is(p1025_rdb)) {
123 104
@@ -148,8 +129,6 @@ static void __init mpc85xx_rdb_setup_arch(void)
148 129
149 } 130 }
150#endif 131#endif
151
152qe_fail:
153#endif /* CONFIG_QUICC_ENGINE */ 132#endif /* CONFIG_QUICC_ENGINE */
154 133
155 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); 134 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index b9197cea1854..bb75add67084 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -14,7 +14,6 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h>
18#include <linux/of_gpio.h> 17#include <linux/of_gpio.h>
19#include <linux/of_irq.h> 18#include <linux/of_irq.h>
20#include <linux/workqueue.h> 19#include <linux/workqueue.h>
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 393f975ab397..6382098d6f8d 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -389,15 +389,18 @@ static void mpc85xx_smp_machine_kexec(struct kimage *image)
389} 389}
390#endif /* CONFIG_KEXEC */ 390#endif /* CONFIG_KEXEC */
391 391
392static void smp_85xx_setup_cpu(int cpu_nr) 392static void smp_85xx_basic_setup(int cpu_nr)
393{ 393{
394 if (smp_85xx_ops.probe == smp_mpic_probe)
395 mpic_setup_this_cpu();
396
397 if (cpu_has_feature(CPU_FTR_DBELL)) 394 if (cpu_has_feature(CPU_FTR_DBELL))
398 doorbell_setup_this_cpu(); 395 doorbell_setup_this_cpu();
399} 396}
400 397
398static void smp_85xx_setup_cpu(int cpu_nr)
399{
400 mpic_setup_this_cpu();
401 smp_85xx_basic_setup(cpu_nr);
402}
403
401static const struct of_device_id mpc85xx_smp_guts_ids[] = { 404static const struct of_device_id mpc85xx_smp_guts_ids[] = {
402 { .compatible = "fsl,mpc8572-guts", }, 405 { .compatible = "fsl,mpc8572-guts", },
403 { .compatible = "fsl,p1020-guts", }, 406 { .compatible = "fsl,p1020-guts", },
@@ -412,13 +415,14 @@ void __init mpc85xx_smp_init(void)
412{ 415{
413 struct device_node *np; 416 struct device_node *np;
414 417
415 smp_85xx_ops.setup_cpu = smp_85xx_setup_cpu;
416 418
417 np = of_find_node_by_type(NULL, "open-pic"); 419 np = of_find_node_by_type(NULL, "open-pic");
418 if (np) { 420 if (np) {
419 smp_85xx_ops.probe = smp_mpic_probe; 421 smp_85xx_ops.probe = smp_mpic_probe;
422 smp_85xx_ops.setup_cpu = smp_85xx_setup_cpu;
420 smp_85xx_ops.message_pass = smp_mpic_message_pass; 423 smp_85xx_ops.message_pass = smp_mpic_message_pass;
421 } 424 } else
425 smp_85xx_ops.setup_cpu = smp_85xx_basic_setup;
422 426
423 if (cpu_has_feature(CPU_FTR_DBELL)) { 427 if (cpu_has_feature(CPU_FTR_DBELL)) {
424 /* 428 /*
@@ -427,6 +431,7 @@ void __init mpc85xx_smp_init(void)
427 */ 431 */
428 smp_85xx_ops.message_pass = NULL; 432 smp_85xx_ops.message_pass = NULL;
429 smp_85xx_ops.cause_ipi = doorbell_cause_ipi; 433 smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
434 smp_85xx_ops.probe = NULL;
430 } 435 }
431 436
432 np = of_find_matching_node(NULL, mpc85xx_smp_guts_ids); 437 np = of_find_matching_node(NULL, mpc85xx_smp_guts_ids);
diff --git a/arch/powerpc/platforms/85xx/twr_p102x.c b/arch/powerpc/platforms/85xx/twr_p102x.c
new file mode 100644
index 000000000000..c25ff10f05ee
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/twr_p102x.c
@@ -0,0 +1,147 @@
1/*
2 * Copyright 2010-2011, 2013 Freescale Semiconductor, Inc.
3 *
4 * Author: Michael Johnston <michael.johnston@freescale.com>
5 *
6 * Description:
7 * TWR-P102x Board Setup
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/errno.h>
18#include <linux/pci.h>
19#include <linux/of_platform.h>
20
21#include <asm/pci-bridge.h>
22#include <asm/udbg.h>
23#include <asm/mpic.h>
24#include <asm/qe.h>
25#include <asm/qe_ic.h>
26#include <asm/fsl_guts.h>
27
28#include <sysdev/fsl_soc.h>
29#include <sysdev/fsl_pci.h>
30#include "smp.h"
31
32#include "mpc85xx.h"
33
34static void __init twr_p1025_pic_init(void)
35{
36 struct mpic *mpic;
37
38#ifdef CONFIG_QUICC_ENGINE
39 struct device_node *np;
40#endif
41
42 mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
43 MPIC_SINGLE_DEST_CPU,
44 0, 256, " OpenPIC ");
45
46 BUG_ON(mpic == NULL);
47 mpic_init(mpic);
48
49#ifdef CONFIG_QUICC_ENGINE
50 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
51 if (np) {
52 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
53 qe_ic_cascade_high_mpic);
54 of_node_put(np);
55 } else
56 pr_err("Could not find qe-ic node\n");
57#endif
58}
59
60/* ************************************************************************
61 *
62 * Setup the architecture
63 *
64 */
65static void __init twr_p1025_setup_arch(void)
66{
67#ifdef CONFIG_QUICC_ENGINE
68 struct device_node *np;
69#endif
70
71 if (ppc_md.progress)
72 ppc_md.progress("twr_p1025_setup_arch()", 0);
73
74 mpc85xx_smp_init();
75
76 fsl_pci_assign_primary();
77
78#ifdef CONFIG_QUICC_ENGINE
79 mpc85xx_qe_init();
80
81#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
82 if (machine_is(twr_p1025)) {
83 struct ccsr_guts __iomem *guts;
84
85 np = of_find_compatible_node(NULL, NULL, "fsl,p1021-guts");
86 if (np) {
87 guts = of_iomap(np, 0);
88 if (!guts)
89 pr_err("twr_p1025: could not map global utilities register\n");
90 else {
91 /* P1025 has pins muxed for QE and other functions. To
92 * enable QE UEC mode, we need to set bit QE0 for UCC1
93 * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9
94 * and QE12 for QE MII management signals in PMUXCR
95 * register.
96 * Set QE mux bits in PMUXCR */
97 setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) |
98 MPC85xx_PMUXCR_QE(3) |
99 MPC85xx_PMUXCR_QE(9) |
100 MPC85xx_PMUXCR_QE(12));
101 iounmap(guts);
102
103#if defined(CONFIG_SERIAL_QE)
104 /* On P1025TWR board, the UCC7 acted as UART port.
105 * However, The UCC7's CTS pin is low level in default,
106 * it will impact the transmission in full duplex
107 * communication. So disable the Flow control pin PA18.
108 * The UCC7 UART just can use RXD and TXD pins.
109 */
110 par_io_config_pin(0, 18, 0, 0, 0, 0);
111#endif
112 /* Drive PB29 to CPLD low - CPLD will then change
113 * muxing from LBC to QE */
114 par_io_config_pin(1, 29, 1, 0, 0, 0);
115 par_io_data_set(1, 29, 0);
116 }
117 of_node_put(np);
118 }
119 }
120#endif
121#endif /* CONFIG_QUICC_ENGINE */
122
123 pr_info("TWR-P1025 board from Freescale Semiconductor\n");
124}
125
126machine_arch_initcall(twr_p1025, mpc85xx_common_publish_devices);
127
128static int __init twr_p1025_probe(void)
129{
130 unsigned long root = of_get_flat_dt_root();
131
132 return of_flat_dt_is_compatible(root, "fsl,TWR-P1025");
133}
134
135define_machine(twr_p1025) {
136 .name = "TWR-P1025",
137 .probe = twr_p1025_probe,
138 .setup_arch = twr_p1025_setup_arch,
139 .init_IRQ = twr_p1025_pic_init,
140#ifdef CONFIG_PCI
141 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
142#endif
143 .get_irq = mpic_get_irq,
144 .restart = fsl_rstcr_restart,
145 .calibrate_decr = generic_calibrate_decr,
146 .progress = udbg_progress,
147};
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index 8dec3c0911ad..bd6f1a1cf922 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -45,7 +45,6 @@ config PPC_EP88XC
45config PPC_ADDER875 45config PPC_ADDER875
46 bool "Analogue & Micro Adder 875" 46 bool "Analogue & Micro Adder 875"
47 select CPM1 47 select CPM1
48 select REDBOOT
49 help 48 help
50 This enables support for the Analogue & Micro Adder 875 49 This enables support for the Analogue & Micro Adder 875
51 board. 50 board.
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index bca2465a9c34..434fda39bf8b 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -72,6 +72,7 @@ config PPC_BOOK3S_64
72 select PPC_HAVE_PMU_SUPPORT 72 select PPC_HAVE_PMU_SUPPORT
73 select SYS_SUPPORTS_HUGETLBFS 73 select SYS_SUPPORTS_HUGETLBFS
74 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES 74 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES
75 select ARCH_SUPPORTS_NUMA_BALANCING
75 76
76config PPC_BOOK3E_64 77config PPC_BOOK3E_64
77 bool "Embedded processors" 78 bool "Embedded processors"
diff --git a/arch/powerpc/platforms/cell/beat_htab.c b/arch/powerpc/platforms/cell/beat_htab.c
index c34ee4e60873..d4d245c0d787 100644
--- a/arch/powerpc/platforms/cell/beat_htab.c
+++ b/arch/powerpc/platforms/cell/beat_htab.c
@@ -111,7 +111,7 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
111 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); 111 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
112 112
113 if (rflags & _PAGE_NO_CACHE) 113 if (rflags & _PAGE_NO_CACHE)
114 hpte_r &= ~_PAGE_COHERENT; 114 hpte_r &= ~HPTE_R_M;
115 115
116 raw_spin_lock(&beat_htab_lock); 116 raw_spin_lock(&beat_htab_lock);
117 lpar_rc = beat_read_mask(hpte_group); 117 lpar_rc = beat_read_mask(hpte_group);
@@ -337,7 +337,7 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
337 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); 337 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
338 338
339 if (rflags & _PAGE_NO_CACHE) 339 if (rflags & _PAGE_NO_CACHE)
340 hpte_r &= ~_PAGE_COHERENT; 340 hpte_r &= ~HPTE_R_M;
341 341
342 /* insert into not-volted entry */ 342 /* insert into not-volted entry */
343 lpar_rc = beat_insert_htab_entry3(0, hpte_group, hpte_v, hpte_r, 343 lpar_rc = beat_insert_htab_entry3(0, hpte_group, hpte_v, hpte_r,
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index b53560660b72..2b90ff8a93be 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -197,7 +197,7 @@ static int tce_build_cell(struct iommu_table *tbl, long index, long npages,
197 197
198 io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset); 198 io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
199 199
200 for (i = 0; i < npages; i++, uaddr += IOMMU_PAGE_SIZE) 200 for (i = 0; i < npages; i++, uaddr += tbl->it_page_shift)
201 io_pte[i] = base_pte | (__pa(uaddr) & CBE_IOPTE_RPN_Mask); 201 io_pte[i] = base_pte | (__pa(uaddr) & CBE_IOPTE_RPN_Mask);
202 202
203 mb(); 203 mb();
@@ -430,7 +430,7 @@ static void cell_iommu_setup_hardware(struct cbe_iommu *iommu,
430{ 430{
431 cell_iommu_setup_stab(iommu, base, size, 0, 0); 431 cell_iommu_setup_stab(iommu, base, size, 0, 0);
432 iommu->ptab = cell_iommu_alloc_ptab(iommu, base, size, 0, 0, 432 iommu->ptab = cell_iommu_alloc_ptab(iommu, base, size, 0, 0,
433 IOMMU_PAGE_SHIFT); 433 IOMMU_PAGE_SHIFT_4K);
434 cell_iommu_enable_hardware(iommu); 434 cell_iommu_enable_hardware(iommu);
435} 435}
436 436
@@ -487,8 +487,10 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
487 window->table.it_blocksize = 16; 487 window->table.it_blocksize = 16;
488 window->table.it_base = (unsigned long)iommu->ptab; 488 window->table.it_base = (unsigned long)iommu->ptab;
489 window->table.it_index = iommu->nid; 489 window->table.it_index = iommu->nid;
490 window->table.it_offset = (offset >> IOMMU_PAGE_SHIFT) + pte_offset; 490 window->table.it_page_shift = IOMMU_PAGE_SHIFT_4K;
491 window->table.it_size = size >> IOMMU_PAGE_SHIFT; 491 window->table.it_offset =
492 (offset >> window->table.it_page_shift) + pte_offset;
493 window->table.it_size = size >> window->table.it_page_shift;
492 494
493 iommu_init_table(&window->table, iommu->nid); 495 iommu_init_table(&window->table, iommu->nid);
494 496
@@ -773,7 +775,7 @@ static void __init cell_iommu_init_one(struct device_node *np,
773 775
774 /* Setup the iommu_table */ 776 /* Setup the iommu_table */
775 cell_iommu_setup_window(iommu, np, base, size, 777 cell_iommu_setup_window(iommu, np, base, size,
776 offset >> IOMMU_PAGE_SHIFT); 778 offset >> IOMMU_PAGE_SHIFT_4K);
777} 779}
778 780
779static void __init cell_disable_iommus(void) 781static void __init cell_disable_iommus(void)
@@ -1122,7 +1124,7 @@ static int __init cell_iommu_fixed_mapping_init(void)
1122 1124
1123 cell_iommu_setup_stab(iommu, dbase, dsize, fbase, fsize); 1125 cell_iommu_setup_stab(iommu, dbase, dsize, fbase, fsize);
1124 iommu->ptab = cell_iommu_alloc_ptab(iommu, dbase, dsize, 0, 0, 1126 iommu->ptab = cell_iommu_alloc_ptab(iommu, dbase, dsize, 0, 0,
1125 IOMMU_PAGE_SHIFT); 1127 IOMMU_PAGE_SHIFT_4K);
1126 cell_iommu_setup_fixed_ptab(iommu, np, dbase, dsize, 1128 cell_iommu_setup_fixed_ptab(iommu, np, dbase, dsize,
1127 fbase, fsize); 1129 fbase, fsize);
1128 cell_iommu_enable_hardware(iommu); 1130 cell_iommu_enable_hardware(iommu);
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c
index dead91b177b9..b6c9a0dcc924 100644
--- a/arch/powerpc/platforms/chrp/smp.c
+++ b/arch/powerpc/platforms/chrp/smp.c
@@ -14,7 +14,6 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/kernel_stat.h> 15#include <linux/kernel_stat.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/spinlock.h> 17#include <linux/spinlock.h>
19 18
20#include <asm/ptrace.h> 19#include <asm/ptrace.h>
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 302ba43d73a1..6d3c7a9fd047 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -67,6 +67,18 @@ config PPC_C2K
67 This option enables support for the GE Fanuc C2K board (formerly 67 This option enables support for the GE Fanuc C2K board (formerly
68 an SBS board). 68 an SBS board).
69 69
70config MVME5100
71 bool "Motorola/Emerson MVME5100"
72 depends on EMBEDDED6xx
73 select MPIC
74 select PCI
75 select PPC_INDIRECT_PCI
76 select PPC_I8259
77 select PPC_NATIVE
78 help
79 This option enables support for the Motorola (now Emerson) MVME5100
80 board.
81
70config TSI108_BRIDGE 82config TSI108_BRIDGE
71 bool 83 bool
72 select PCI 84 select PCI
@@ -113,4 +125,3 @@ config WII
113 help 125 help
114 Select WII if configuring for the Nintendo Wii. 126 Select WII if configuring for the Nintendo Wii.
115 More information at: <http://gc-linux.sourceforge.net/> 127 More information at: <http://gc-linux.sourceforge.net/>
116
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index 66c23e423f40..cdd48d402b93 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_USBGECKO_UDBG) += usbgecko_udbg.o
11obj-$(CONFIG_GAMECUBE_COMMON) += flipper-pic.o 11obj-$(CONFIG_GAMECUBE_COMMON) += flipper-pic.o
12obj-$(CONFIG_GAMECUBE) += gamecube.o 12obj-$(CONFIG_GAMECUBE) += gamecube.o
13obj-$(CONFIG_WII) += wii.o hlwd-pic.o 13obj-$(CONFIG_WII) += wii.o hlwd-pic.o
14obj-$(CONFIG_MVME5100) += mvme5100.o
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index 6c03034dbbd3..c269caee58f9 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -15,7 +15,6 @@
15#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt 15#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/irq.h> 18#include <linux/irq.h>
20#include <linux/of.h> 19#include <linux/of.h>
21#include <linux/of_address.h> 20#include <linux/of_address.h>
diff --git a/arch/powerpc/platforms/embedded6xx/mvme5100.c b/arch/powerpc/platforms/embedded6xx/mvme5100.c
new file mode 100644
index 000000000000..25e3bfb64efb
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/mvme5100.c
@@ -0,0 +1,221 @@
1/*
2 * Board setup routines for the Motorola/Emerson MVME5100.
3 *
4 * Copyright 2013 CSC Australia Pty. Ltd.
5 *
6 * Based on earlier code by:
7 *
8 * Matt Porter, MontaVista Software Inc.
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * Author: Stephen Chivers <schivers@csc.com>
17 *
18 */
19
20#include <linux/of_platform.h>
21
22#include <asm/i8259.h>
23#include <asm/pci-bridge.h>
24#include <asm/mpic.h>
25#include <asm/prom.h>
26#include <mm/mmu_decl.h>
27#include <asm/udbg.h>
28
29#define HAWK_MPIC_SIZE 0x00040000U
30#define MVME5100_PCI_MEM_OFFSET 0x00000000
31
32/* Board register addresses. */
33#define BOARD_STATUS_REG 0xfef88080
34#define BOARD_MODFAIL_REG 0xfef88090
35#define BOARD_MODRST_REG 0xfef880a0
36#define BOARD_TBEN_REG 0xfef880c0
37#define BOARD_SW_READ_REG 0xfef880e0
38#define BOARD_GEO_ADDR_REG 0xfef880e8
39#define BOARD_EXT_FEATURE1_REG 0xfef880f0
40#define BOARD_EXT_FEATURE2_REG 0xfef88100
41
42static phys_addr_t pci_membase;
43static u_char *restart;
44
45static void mvme5100_8259_cascade(unsigned int irq, struct irq_desc *desc)
46{
47 struct irq_chip *chip = irq_desc_get_chip(desc);
48 unsigned int cascade_irq = i8259_irq();
49
50 if (cascade_irq != NO_IRQ)
51 generic_handle_irq(cascade_irq);
52
53 chip->irq_eoi(&desc->irq_data);
54}
55
56static void __init mvme5100_pic_init(void)
57{
58 struct mpic *mpic;
59 struct device_node *np;
60 struct device_node *cp = NULL;
61 unsigned int cirq;
62 unsigned long intack = 0;
63 const u32 *prop = NULL;
64
65 np = of_find_node_by_type(NULL, "open-pic");
66 if (!np) {
67 pr_err("Could not find open-pic node\n");
68 return;
69 }
70
71 mpic = mpic_alloc(np, pci_membase, 0, 16, 256, " OpenPIC ");
72
73 BUG_ON(mpic == NULL);
74 of_node_put(np);
75
76 mpic_assign_isu(mpic, 0, pci_membase + 0x10000);
77
78 mpic_init(mpic);
79
80 cp = of_find_compatible_node(NULL, NULL, "chrp,iic");
81 if (cp == NULL) {
82 pr_warn("mvme5100_pic_init: couldn't find i8259\n");
83 return;
84 }
85
86 cirq = irq_of_parse_and_map(cp, 0);
87 if (cirq == NO_IRQ) {
88 pr_warn("mvme5100_pic_init: no cascade interrupt?\n");
89 return;
90 }
91
92 np = of_find_compatible_node(NULL, "pci", "mpc10x-pci");
93 if (np) {
94 prop = of_get_property(np, "8259-interrupt-acknowledge", NULL);
95
96 if (prop)
97 intack = prop[0];
98
99 of_node_put(np);
100 }
101
102 if (intack)
103 pr_debug("mvme5100_pic_init: PCI 8259 intack at 0x%016lx\n",
104 intack);
105
106 i8259_init(cp, intack);
107 of_node_put(cp);
108 irq_set_chained_handler(cirq, mvme5100_8259_cascade);
109}
110
111static int __init mvme5100_add_bridge(struct device_node *dev)
112{
113 const int *bus_range;
114 int len;
115 struct pci_controller *hose;
116 unsigned short devid;
117
118 pr_info("Adding PCI host bridge %s\n", dev->full_name);
119
120 bus_range = of_get_property(dev, "bus-range", &len);
121
122 hose = pcibios_alloc_controller(dev);
123 if (hose == NULL)
124 return -ENOMEM;
125
126 hose->first_busno = bus_range ? bus_range[0] : 0;
127 hose->last_busno = bus_range ? bus_range[1] : 0xff;
128
129 setup_indirect_pci(hose, 0xfe000cf8, 0xfe000cfc, 0);
130
131 pci_process_bridge_OF_ranges(hose, dev, 1);
132
133 early_read_config_word(hose, 0, 0, PCI_DEVICE_ID, &devid);
134
135 if (devid != PCI_DEVICE_ID_MOTOROLA_HAWK) {
136 pr_err("HAWK PHB not present?\n");
137 return 0;
138 }
139
140 early_read_config_dword(hose, 0, 0, PCI_BASE_ADDRESS_1, &pci_membase);
141
142 if (pci_membase == 0) {
143 pr_err("HAWK PHB mibar not correctly set?\n");
144 return 0;
145 }
146
147 pr_info("mvme5100_pic_init: pci_membase: %x\n", pci_membase);
148
149 return 0;
150}
151
152static struct of_device_id mvme5100_of_bus_ids[] __initdata = {
153 { .compatible = "hawk-bridge", },
154 {},
155};
156
157/*
158 * Setup the architecture
159 */
160static void __init mvme5100_setup_arch(void)
161{
162 struct device_node *np;
163
164 if (ppc_md.progress)
165 ppc_md.progress("mvme5100_setup_arch()", 0);
166
167 for_each_compatible_node(np, "pci", "hawk-pci")
168 mvme5100_add_bridge(np);
169
170 restart = ioremap(BOARD_MODRST_REG, 4);
171}
172
173
174static void mvme5100_show_cpuinfo(struct seq_file *m)
175{
176 seq_puts(m, "Vendor\t\t: Motorola/Emerson\n");
177 seq_puts(m, "Machine\t\t: MVME5100\n");
178}
179
180static void mvme5100_restart(char *cmd)
181{
182
183 local_irq_disable();
184 mtmsr(mfmsr() | MSR_IP);
185
186 out_8((u_char *) restart, 0x01);
187
188 while (1)
189 ;
190}
191
192/*
193 * Called very early, device-tree isn't unflattened
194 */
195static int __init mvme5100_probe(void)
196{
197 unsigned long root = of_get_flat_dt_root();
198
199 return of_flat_dt_is_compatible(root, "MVME5100");
200}
201
202static int __init probe_of_platform_devices(void)
203{
204
205 of_platform_bus_probe(NULL, mvme5100_of_bus_ids, NULL);
206 return 0;
207}
208
209machine_device_initcall(mvme5100, probe_of_platform_devices);
210
211define_machine(mvme5100) {
212 .name = "MVME5100",
213 .probe = mvme5100_probe,
214 .setup_arch = mvme5100_setup_arch,
215 .init_IRQ = mvme5100_pic_init,
216 .show_cpuinfo = mvme5100_show_cpuinfo,
217 .get_irq = mpic_get_irq,
218 .restart = mvme5100_restart,
219 .calibrate_decr = generic_calibrate_decr,
220 .progress = udbg_progress,
221};
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index f3defd8a2806..aafa01ba062f 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -18,7 +18,6 @@
18 */ 18 */
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/export.h> 21#include <linux/export.h>
23#include <linux/pci.h> 22#include <linux/pci.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 7d2d036754b5..2e576f2ae442 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -138,8 +138,11 @@ static void iommu_table_iobmap_setup(void)
138 pr_debug(" -> %s\n", __func__); 138 pr_debug(" -> %s\n", __func__);
139 iommu_table_iobmap.it_busno = 0; 139 iommu_table_iobmap.it_busno = 0;
140 iommu_table_iobmap.it_offset = 0; 140 iommu_table_iobmap.it_offset = 0;
141 iommu_table_iobmap.it_page_shift = IOBMAP_PAGE_SHIFT;
142
141 /* it_size is in number of entries */ 143 /* it_size is in number of entries */
142 iommu_table_iobmap.it_size = 0x80000000 >> IOBMAP_PAGE_SHIFT; 144 iommu_table_iobmap.it_size =
145 0x80000000 >> iommu_table_iobmap.it_page_shift;
143 146
144 /* Initialize the common IOMMU code */ 147 /* Initialize the common IOMMU code */
145 iommu_table_iobmap.it_base = (unsigned long)iob_l2_base; 148 iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index d588e48dff74..43075081721f 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -5,7 +5,6 @@
5 * FIXME: LOCKING !!! 5 * FIXME: LOCKING !!!
6 */ 6 */
7 7
8#include <linux/init.h>
9#include <linux/delay.h> 8#include <linux/delay.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/spinlock.h> 10#include <linux/spinlock.h>
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 9fced3f6d2dc..895e8a20a3fc 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -13,11 +13,6 @@ config PPC_POWERNV
13 select ARCH_RANDOM 13 select ARCH_RANDOM
14 default y 14 default y
15 15
16config POWERNV_MSI
17 bool "Support PCI MSI on PowerNV platform"
18 depends on PCI_MSI
19 default y
20
21config PPC_POWERNV_RTAS 16config PPC_POWERNV_RTAS
22 depends on PPC_POWERNV 17 depends on PPC_POWERNV
23 bool "Support for RTAS based PowerNV platforms such as BML" 18 bool "Support for RTAS based PowerNV platforms such as BML"
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index 873fa1370dc4..8d767fde5a6a 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_SMP) += smp.o
6obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o 6obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o
7obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o 7obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o
8obj-$(CONFIG_PPC_SCOM) += opal-xscom.o 8obj-$(CONFIG_PPC_SCOM) += opal-xscom.o
9obj-$(CONFIG_MEMORY_FAILURE) += opal-memory-errors.o
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index d7ddcee7feb8..e1e71618b70c 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -14,7 +14,6 @@
14#include <linux/bootmem.h> 14#include <linux/bootmem.h>
15#include <linux/debugfs.h> 15#include <linux/debugfs.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/io.h> 17#include <linux/io.h>
19#include <linux/irq.h> 18#include <linux/irq.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -578,11 +577,8 @@ static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
578 return -EIO; 577 return -EIO;
579 } 578 }
580 579
581 /* 580 /* The PHB diag-data is always indicative */
582 * FIXME: We probably need log the error in somewhere. 581 pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);
583 * Lets make it up in future.
584 */
585 /* pr_info("%s", phb->diag.blob); */
586 582
587 spin_unlock_irqrestore(&phb->lock, flags); 583 spin_unlock_irqrestore(&phb->lock, flags);
588 584
@@ -670,143 +666,9 @@ static void ioda_eeh_hub_diag(struct pci_controller *hose)
670 } 666 }
671} 667}
672 668
673static void ioda_eeh_p7ioc_phb_diag(struct pci_controller *hose,
674 struct OpalIoPhbErrorCommon *common)
675{
676 struct OpalIoP7IOCPhbErrorData *data;
677 int i;
678
679 data = (struct OpalIoP7IOCPhbErrorData *)common;
680
681 pr_info("P7IOC PHB#%x Diag-data (Version: %d)\n\n",
682 hose->global_number, common->version);
683
684 pr_info(" brdgCtl: %08x\n", data->brdgCtl);
685
686 pr_info(" portStatusReg: %08x\n", data->portStatusReg);
687 pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus);
688 pr_info(" busAgentStatus: %08x\n", data->busAgentStatus);
689
690 pr_info(" deviceStatus: %08x\n", data->deviceStatus);
691 pr_info(" slotStatus: %08x\n", data->slotStatus);
692 pr_info(" linkStatus: %08x\n", data->linkStatus);
693 pr_info(" devCmdStatus: %08x\n", data->devCmdStatus);
694 pr_info(" devSecStatus: %08x\n", data->devSecStatus);
695
696 pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus);
697 pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus);
698 pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus);
699 pr_info(" tlpHdr1: %08x\n", data->tlpHdr1);
700 pr_info(" tlpHdr2: %08x\n", data->tlpHdr2);
701 pr_info(" tlpHdr3: %08x\n", data->tlpHdr3);
702 pr_info(" tlpHdr4: %08x\n", data->tlpHdr4);
703 pr_info(" sourceId: %08x\n", data->sourceId);
704
705 pr_info(" errorClass: %016llx\n", data->errorClass);
706 pr_info(" correlator: %016llx\n", data->correlator);
707 pr_info(" p7iocPlssr: %016llx\n", data->p7iocPlssr);
708 pr_info(" p7iocCsr: %016llx\n", data->p7iocCsr);
709 pr_info(" lemFir: %016llx\n", data->lemFir);
710 pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask);
711 pr_info(" lemWOF: %016llx\n", data->lemWOF);
712 pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus);
713 pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus);
714 pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0);
715 pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1);
716 pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus);
717 pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
718 pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0);
719 pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1);
720 pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus);
721 pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
722 pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0);
723 pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1);
724 pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus);
725 pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
726 pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0);
727 pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1);
728
729 for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) {
730 if ((data->pestA[i] >> 63) == 0 &&
731 (data->pestB[i] >> 63) == 0)
732 continue;
733
734 pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]);
735 pr_info(" PESTB: %016llx\n", data->pestB[i]);
736 }
737}
738
739static void ioda_eeh_phb3_phb_diag(struct pci_controller *hose,
740 struct OpalIoPhbErrorCommon *common)
741{
742 struct OpalIoPhb3ErrorData *data;
743 int i;
744
745 data = (struct OpalIoPhb3ErrorData*)common;
746 pr_info("PHB3 PHB#%x Diag-data (Version: %d)\n\n",
747 hose->global_number, common->version);
748
749 pr_info(" brdgCtl: %08x\n", data->brdgCtl);
750
751 pr_info(" portStatusReg: %08x\n", data->portStatusReg);
752 pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus);
753 pr_info(" busAgentStatus: %08x\n", data->busAgentStatus);
754
755 pr_info(" deviceStatus: %08x\n", data->deviceStatus);
756 pr_info(" slotStatus: %08x\n", data->slotStatus);
757 pr_info(" linkStatus: %08x\n", data->linkStatus);
758 pr_info(" devCmdStatus: %08x\n", data->devCmdStatus);
759 pr_info(" devSecStatus: %08x\n", data->devSecStatus);
760
761 pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus);
762 pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus);
763 pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus);
764 pr_info(" tlpHdr1: %08x\n", data->tlpHdr1);
765 pr_info(" tlpHdr2: %08x\n", data->tlpHdr2);
766 pr_info(" tlpHdr3: %08x\n", data->tlpHdr3);
767 pr_info(" tlpHdr4: %08x\n", data->tlpHdr4);
768 pr_info(" sourceId: %08x\n", data->sourceId);
769 pr_info(" errorClass: %016llx\n", data->errorClass);
770 pr_info(" correlator: %016llx\n", data->correlator);
771 pr_info(" nFir: %016llx\n", data->nFir);
772 pr_info(" nFirMask: %016llx\n", data->nFirMask);
773 pr_info(" nFirWOF: %016llx\n", data->nFirWOF);
774 pr_info(" PhbPlssr: %016llx\n", data->phbPlssr);
775 pr_info(" PhbCsr: %016llx\n", data->phbCsr);
776 pr_info(" lemFir: %016llx\n", data->lemFir);
777 pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask);
778 pr_info(" lemWOF: %016llx\n", data->lemWOF);
779 pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus);
780 pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus);
781 pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0);
782 pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1);
783 pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus);
784 pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
785 pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0);
786 pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1);
787 pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus);
788 pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
789 pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0);
790 pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1);
791 pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus);
792 pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
793 pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0);
794 pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1);
795
796 for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) {
797 if ((data->pestA[i] >> 63) == 0 &&
798 (data->pestB[i] >> 63) == 0)
799 continue;
800
801 pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]);
802 pr_info(" PESTB: %016llx\n", data->pestB[i]);
803 }
804}
805
806static void ioda_eeh_phb_diag(struct pci_controller *hose) 669static void ioda_eeh_phb_diag(struct pci_controller *hose)
807{ 670{
808 struct pnv_phb *phb = hose->private_data; 671 struct pnv_phb *phb = hose->private_data;
809 struct OpalIoPhbErrorCommon *common;
810 long rc; 672 long rc;
811 673
812 rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, 674 rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
@@ -817,18 +679,7 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose)
817 return; 679 return;
818 } 680 }
819 681
820 common = (struct OpalIoPhbErrorCommon *)phb->diag.blob; 682 pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);
821 switch (common->ioType) {
822 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
823 ioda_eeh_p7ioc_phb_diag(hose, common);
824 break;
825 case OPAL_PHB_ERROR_DATA_TYPE_PHB3:
826 ioda_eeh_phb3_phb_diag(hose, common);
827 break;
828 default:
829 pr_warning("%s: Unrecognized I/O chip %d\n",
830 __func__, common->ioType);
831 }
832} 683}
833 684
834static int ioda_eeh_get_phb_pe(struct pci_controller *hose, 685static int ioda_eeh_get_phb_pe(struct pci_controller *hose,
@@ -862,11 +713,7 @@ static int ioda_eeh_get_pe(struct pci_controller *hose,
862 dev.phb = hose; 713 dev.phb = hose;
863 dev.pe_config_addr = pe_no; 714 dev.pe_config_addr = pe_no;
864 dev_pe = eeh_pe_get(&dev); 715 dev_pe = eeh_pe_get(&dev);
865 if (!dev_pe) { 716 if (!dev_pe) return -EEXIST;
866 pr_warning("%s: Can't find PE for PHB#%x - PE#%x\n",
867 __func__, hose->global_number, pe_no);
868 return -EEXIST;
869 }
870 717
871 *pe = dev_pe; 718 *pe = dev_pe;
872 return 0; 719 return 0;
@@ -884,12 +731,12 @@ static int ioda_eeh_get_pe(struct pci_controller *hose,
884 */ 731 */
885static int ioda_eeh_next_error(struct eeh_pe **pe) 732static int ioda_eeh_next_error(struct eeh_pe **pe)
886{ 733{
887 struct pci_controller *hose, *tmp; 734 struct pci_controller *hose;
888 struct pnv_phb *phb; 735 struct pnv_phb *phb;
889 u64 frozen_pe_no; 736 u64 frozen_pe_no;
890 u16 err_type, severity; 737 u16 err_type, severity;
891 long rc; 738 long rc;
892 int ret = 1; 739 int ret = EEH_NEXT_ERR_NONE;
893 740
894 /* 741 /*
895 * While running here, it's safe to purge the event queue. 742 * While running here, it's safe to purge the event queue.
@@ -899,7 +746,7 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
899 eeh_remove_event(NULL); 746 eeh_remove_event(NULL);
900 opal_notifier_update_evt(OPAL_EVENT_PCI_ERROR, 0x0ul); 747 opal_notifier_update_evt(OPAL_EVENT_PCI_ERROR, 0x0ul);
901 748
902 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 749 list_for_each_entry(hose, &hose_list, list_node) {
903 /* 750 /*
904 * If the subordinate PCI buses of the PHB has been 751 * If the subordinate PCI buses of the PHB has been
905 * removed, we needn't take care of it any more. 752 * removed, we needn't take care of it any more.
@@ -938,19 +785,19 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
938 switch (err_type) { 785 switch (err_type) {
939 case OPAL_EEH_IOC_ERROR: 786 case OPAL_EEH_IOC_ERROR:
940 if (severity == OPAL_EEH_SEV_IOC_DEAD) { 787 if (severity == OPAL_EEH_SEV_IOC_DEAD) {
941 list_for_each_entry_safe(hose, tmp, 788 list_for_each_entry(hose, &hose_list,
942 &hose_list, list_node) { 789 list_node) {
943 phb = hose->private_data; 790 phb = hose->private_data;
944 phb->eeh_state |= PNV_EEH_STATE_REMOVED; 791 phb->eeh_state |= PNV_EEH_STATE_REMOVED;
945 } 792 }
946 793
947 pr_err("EEH: dead IOC detected\n"); 794 pr_err("EEH: dead IOC detected\n");
948 ret = 4; 795 ret = EEH_NEXT_ERR_DEAD_IOC;
949 goto out;
950 } else if (severity == OPAL_EEH_SEV_INF) { 796 } else if (severity == OPAL_EEH_SEV_INF) {
951 pr_info("EEH: IOC informative error " 797 pr_info("EEH: IOC informative error "
952 "detected\n"); 798 "detected\n");
953 ioda_eeh_hub_diag(hose); 799 ioda_eeh_hub_diag(hose);
800 ret = EEH_NEXT_ERR_NONE;
954 } 801 }
955 802
956 break; 803 break;
@@ -962,37 +809,61 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
962 pr_err("EEH: dead PHB#%x detected\n", 809 pr_err("EEH: dead PHB#%x detected\n",
963 hose->global_number); 810 hose->global_number);
964 phb->eeh_state |= PNV_EEH_STATE_REMOVED; 811 phb->eeh_state |= PNV_EEH_STATE_REMOVED;
965 ret = 3; 812 ret = EEH_NEXT_ERR_DEAD_PHB;
966 goto out;
967 } else if (severity == OPAL_EEH_SEV_PHB_FENCED) { 813 } else if (severity == OPAL_EEH_SEV_PHB_FENCED) {
968 if (ioda_eeh_get_phb_pe(hose, pe)) 814 if (ioda_eeh_get_phb_pe(hose, pe))
969 break; 815 break;
970 816
971 pr_err("EEH: fenced PHB#%x detected\n", 817 pr_err("EEH: fenced PHB#%x detected\n",
972 hose->global_number); 818 hose->global_number);
973 ret = 2; 819 ret = EEH_NEXT_ERR_FENCED_PHB;
974 goto out;
975 } else if (severity == OPAL_EEH_SEV_INF) { 820 } else if (severity == OPAL_EEH_SEV_INF) {
976 pr_info("EEH: PHB#%x informative error " 821 pr_info("EEH: PHB#%x informative error "
977 "detected\n", 822 "detected\n",
978 hose->global_number); 823 hose->global_number);
979 ioda_eeh_phb_diag(hose); 824 ioda_eeh_phb_diag(hose);
825 ret = EEH_NEXT_ERR_NONE;
980 } 826 }
981 827
982 break; 828 break;
983 case OPAL_EEH_PE_ERROR: 829 case OPAL_EEH_PE_ERROR:
984 if (ioda_eeh_get_pe(hose, frozen_pe_no, pe)) 830 /*
985 break; 831 * If we can't find the corresponding PE, the
832 * PEEV / PEST would be messy. So we force an
833 * fenced PHB so that it can be recovered.
834 */
835 if (ioda_eeh_get_pe(hose, frozen_pe_no, pe)) {
836 if (!ioda_eeh_get_phb_pe(hose, pe)) {
837 pr_err("EEH: Escalated fenced PHB#%x "
838 "detected for PE#%llx\n",
839 hose->global_number,
840 frozen_pe_no);
841 ret = EEH_NEXT_ERR_FENCED_PHB;
842 } else {
843 ret = EEH_NEXT_ERR_NONE;
844 }
845 } else {
846 pr_err("EEH: Frozen PE#%x on PHB#%x detected\n",
847 (*pe)->addr, (*pe)->phb->global_number);
848 ret = EEH_NEXT_ERR_FROZEN_PE;
849 }
986 850
987 pr_err("EEH: Frozen PE#%x on PHB#%x detected\n", 851 break;
988 (*pe)->addr, (*pe)->phb->global_number); 852 default:
989 ret = 1; 853 pr_warn("%s: Unexpected error type %d\n",
990 goto out; 854 __func__, err_type);
991 } 855 }
856
857 /*
858 * If we have no errors on the specific PHB or only
859 * informative error there, we continue poking it.
860 * Otherwise, we need actions to be taken by upper
861 * layer.
862 */
863 if (ret > EEH_NEXT_ERR_INF)
864 break;
992 } 865 }
993 866
994 ret = 0;
995out:
996 return ret; 867 return ret;
997} 868}
998 869
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 73b981438cc5..a79fddc5e74e 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -344,6 +344,27 @@ static int powernv_eeh_next_error(struct eeh_pe **pe)
344 return -EEXIST; 344 return -EEXIST;
345} 345}
346 346
347static int powernv_eeh_restore_config(struct device_node *dn)
348{
349 struct eeh_dev *edev = of_node_to_eeh_dev(dn);
350 struct pnv_phb *phb;
351 s64 ret;
352
353 if (!edev)
354 return -EEXIST;
355
356 phb = edev->phb->private_data;
357 ret = opal_pci_reinit(phb->opal_id,
358 OPAL_REINIT_PCI_DEV, edev->config_addr);
359 if (ret) {
360 pr_warn("%s: Can't reinit PCI dev 0x%x (%lld)\n",
361 __func__, edev->config_addr, ret);
362 return -EIO;
363 }
364
365 return 0;
366}
367
347static struct eeh_ops powernv_eeh_ops = { 368static struct eeh_ops powernv_eeh_ops = {
348 .name = "powernv", 369 .name = "powernv",
349 .init = powernv_eeh_init, 370 .init = powernv_eeh_init,
@@ -359,7 +380,8 @@ static struct eeh_ops powernv_eeh_ops = {
359 .configure_bridge = powernv_eeh_configure_bridge, 380 .configure_bridge = powernv_eeh_configure_bridge,
360 .read_config = pnv_pci_cfg_read, 381 .read_config = pnv_pci_cfg_read,
361 .write_config = pnv_pci_cfg_write, 382 .write_config = pnv_pci_cfg_write,
362 .next_error = powernv_eeh_next_error 383 .next_error = powernv_eeh_next_error,
384 .restore_config = powernv_eeh_restore_config
363}; 385};
364 386
365/** 387/**
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index 6ffa6b1ec5b7..714ef972406b 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -76,8 +76,8 @@
76/* Validate buffer size */ 76/* Validate buffer size */
77#define VALIDATE_BUF_SIZE 4096 77#define VALIDATE_BUF_SIZE 4096
78 78
79/* XXX: Assume candidate image size is <= 256MB */ 79/* XXX: Assume candidate image size is <= 1GB */
80#define MAX_IMAGE_SIZE 0x10000000 80#define MAX_IMAGE_SIZE 0x40000000
81 81
82/* Flash sg list version */ 82/* Flash sg list version */
83#define SG_LIST_VERSION (1UL) 83#define SG_LIST_VERSION (1UL)
@@ -103,30 +103,9 @@ struct image_header_t {
103 uint32_t size; 103 uint32_t size;
104}; 104};
105 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 { 106struct validate_flash_t {
128 int status; /* Return status */ 107 int status; /* Return status */
129 void *buf; /* Candiate image buffer */ 108 void *buf; /* Candidate image buffer */
130 uint32_t buf_size; /* Image size */ 109 uint32_t buf_size; /* Image size */
131 uint32_t result; /* Update results token */ 110 uint32_t result; /* Update results token */
132}; 111};
@@ -333,7 +312,7 @@ static struct opal_sg_list *image_data_to_sglist(void)
333 addr = image_data.data; 312 addr = image_data.data;
334 size = image_data.size; 313 size = image_data.size;
335 314
336 sg1 = kzalloc((sizeof(struct opal_sg_list)), GFP_KERNEL); 315 sg1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
337 if (!sg1) 316 if (!sg1)
338 return NULL; 317 return NULL;
339 318
@@ -351,8 +330,7 @@ static struct opal_sg_list *image_data_to_sglist(void)
351 330
352 sg1->num_entries++; 331 sg1->num_entries++;
353 if (sg1->num_entries >= SG_ENTRIES_PER_NODE) { 332 if (sg1->num_entries >= SG_ENTRIES_PER_NODE) {
354 sg1->next = kzalloc((sizeof(struct opal_sg_list)), 333 sg1->next = kzalloc(PAGE_SIZE, GFP_KERNEL);
355 GFP_KERNEL);
356 if (!sg1->next) { 334 if (!sg1->next) {
357 pr_err("%s : Failed to allocate memory\n", 335 pr_err("%s : Failed to allocate memory\n",
358 __func__); 336 __func__);
@@ -402,7 +380,10 @@ static int opal_flash_update(int op)
402 else 380 else
403 sg->next = NULL; 381 sg->next = NULL;
404 382
405 /* Make num_entries into the version/length field */ 383 /*
384 * Convert num_entries to version/length format
385 * to satisfy OPAL.
386 */
406 sg->num_entries = (SG_LIST_VERSION << 56) | 387 sg->num_entries = (SG_LIST_VERSION << 56) |
407 (sg->num_entries * sizeof(struct opal_sg_entry) + 16); 388 (sg->num_entries * sizeof(struct opal_sg_entry) + 16);
408 } 389 }
@@ -500,7 +481,7 @@ static int alloc_image_buf(char *buffer, size_t count)
500 481
501 memcpy(&image_header, (void *)buffer, sizeof(struct image_header_t)); 482 memcpy(&image_header, (void *)buffer, sizeof(struct image_header_t));
502 image_data.size = be32_to_cpu(image_header.size); 483 image_data.size = be32_to_cpu(image_header.size);
503 pr_debug("FLASH: Candiate image size = %u\n", image_data.size); 484 pr_debug("FLASH: Candidate image size = %u\n", image_data.size);
504 485
505 if (image_data.size > MAX_IMAGE_SIZE) { 486 if (image_data.size > MAX_IMAGE_SIZE) {
506 pr_warn("FLASH: Too large image\n"); 487 pr_warn("FLASH: Too large image\n");
diff --git a/arch/powerpc/platforms/powernv/opal-memory-errors.c b/arch/powerpc/platforms/powernv/opal-memory-errors.c
new file mode 100644
index 000000000000..ec4132239cdf
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c
@@ -0,0 +1,146 @@
1/*
2 * OPAL asynchronus Memory error handling support in PowreNV.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright 2013 IBM Corporation
19 * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
20 */
21
22#undef DEBUG
23
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/of.h>
27#include <linux/mm.h>
28#include <linux/slab.h>
29
30#include <asm/opal.h>
31#include <asm/cputable.h>
32
33static int opal_mem_err_nb_init;
34static LIST_HEAD(opal_memory_err_list);
35static DEFINE_SPINLOCK(opal_mem_err_lock);
36
37struct OpalMsgNode {
38 struct list_head list;
39 struct opal_msg msg;
40};
41
42static void handle_memory_error_event(struct OpalMemoryErrorData *merr_evt)
43{
44 uint64_t paddr_start, paddr_end;
45
46 pr_debug("%s: Retrived memory error event, type: 0x%x\n",
47 __func__, merr_evt->type);
48 switch (merr_evt->type) {
49 case OPAL_MEM_ERR_TYPE_RESILIENCE:
50 paddr_start = merr_evt->u.resilience.physical_address_start;
51 paddr_end = merr_evt->u.resilience.physical_address_end;
52 break;
53 case OPAL_MEM_ERR_TYPE_DYN_DALLOC:
54 paddr_start = merr_evt->u.dyn_dealloc.physical_address_start;
55 paddr_end = merr_evt->u.dyn_dealloc.physical_address_end;
56 break;
57 default:
58 return;
59 }
60
61 for (; paddr_start < paddr_end; paddr_start += PAGE_SIZE) {
62 memory_failure(paddr_start >> PAGE_SHIFT, 0, 0);
63 }
64}
65
66static void handle_memory_error(void)
67{
68 unsigned long flags;
69 struct OpalMemoryErrorData *merr_evt;
70 struct OpalMsgNode *msg_node;
71
72 spin_lock_irqsave(&opal_mem_err_lock, flags);
73 while (!list_empty(&opal_memory_err_list)) {
74 msg_node = list_entry(opal_memory_err_list.next,
75 struct OpalMsgNode, list);
76 list_del(&msg_node->list);
77 spin_unlock_irqrestore(&opal_mem_err_lock, flags);
78
79 merr_evt = (struct OpalMemoryErrorData *)
80 &msg_node->msg.params[0];
81 handle_memory_error_event(merr_evt);
82 kfree(msg_node);
83 spin_lock_irqsave(&opal_mem_err_lock, flags);
84 }
85 spin_unlock_irqrestore(&opal_mem_err_lock, flags);
86}
87
88static void mem_error_handler(struct work_struct *work)
89{
90 handle_memory_error();
91}
92
93static DECLARE_WORK(mem_error_work, mem_error_handler);
94
95/*
96 * opal_memory_err_event - notifier handler that queues up the opal message
97 * to be preocessed later.
98 */
99static int opal_memory_err_event(struct notifier_block *nb,
100 unsigned long msg_type, void *msg)
101{
102 unsigned long flags;
103 struct OpalMsgNode *msg_node;
104
105 if (msg_type != OPAL_MSG_MEM_ERR)
106 return 0;
107
108 msg_node = kzalloc(sizeof(*msg_node), GFP_ATOMIC);
109 if (!msg_node) {
110 pr_err("MEMORY_ERROR: out of memory, Opal message event not"
111 "handled\n");
112 return -ENOMEM;
113 }
114 memcpy(&msg_node->msg, msg, sizeof(struct opal_msg));
115
116 spin_lock_irqsave(&opal_mem_err_lock, flags);
117 list_add(&msg_node->list, &opal_memory_err_list);
118 spin_unlock_irqrestore(&opal_mem_err_lock, flags);
119
120 schedule_work(&mem_error_work);
121 return 0;
122}
123
124static struct notifier_block opal_mem_err_nb = {
125 .notifier_call = opal_memory_err_event,
126 .next = NULL,
127 .priority = 0,
128};
129
130static int __init opal_mem_err_init(void)
131{
132 int ret;
133
134 if (!opal_mem_err_nb_init) {
135 ret = opal_message_notifier_register(
136 OPAL_MSG_MEM_ERR, &opal_mem_err_nb);
137 if (ret) {
138 pr_err("%s: Can't register OPAL event notifier (%d)\n",
139 __func__, ret);
140 return ret;
141 }
142 opal_mem_err_nb_init = 1;
143 }
144 return 0;
145}
146subsys_initcall(opal_mem_err_init);
diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c
index 7d07c7e80ec0..b1885db8fdf3 100644
--- a/arch/powerpc/platforms/powernv/opal-rtc.c
+++ b/arch/powerpc/platforms/powernv/opal-rtc.c
@@ -18,6 +18,7 @@
18 18
19#include <asm/opal.h> 19#include <asm/opal.h>
20#include <asm/firmware.h> 20#include <asm/firmware.h>
21#include <asm/machdep.h>
21 22
22static void opal_to_tm(u32 y_m_d, u64 h_m_s_ms, struct rtc_time *tm) 23static void opal_to_tm(u32 y_m_d, u64 h_m_s_ms, struct rtc_time *tm)
23{ 24{
@@ -48,8 +49,11 @@ unsigned long __init opal_get_boot_time(void)
48 else 49 else
49 mdelay(10); 50 mdelay(10);
50 } 51 }
51 if (rc != OPAL_SUCCESS) 52 if (rc != OPAL_SUCCESS) {
53 ppc_md.get_rtc_time = NULL;
54 ppc_md.set_rtc_time = NULL;
52 return 0; 55 return 0;
56 }
53 y_m_d = be32_to_cpu(__y_m_d); 57 y_m_d = be32_to_cpu(__y_m_d);
54 h_m_s_ms = be64_to_cpu(__h_m_s_ms); 58 h_m_s_ms = be64_to_cpu(__h_m_s_ms);
55 opal_to_tm(y_m_d, h_m_s_ms, &tm); 59 opal_to_tm(y_m_d, h_m_s_ms, &tm);
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index e7806504e976..3e8829c40fbb 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -126,3 +126,6 @@ OPAL_CALL(opal_return_cpu, OPAL_RETURN_CPU);
126OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE); 126OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE);
127OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE); 127OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE);
128OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE); 128OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE);
129OPAL_CALL(opal_get_msg, OPAL_GET_MSG);
130OPAL_CALL(opal_check_completion, OPAL_CHECK_ASYNC_COMPLETION);
131OPAL_CALL(opal_sync_host_reboot, OPAL_SYNC_HOST_REBOOT);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 1c798cd55372..65499adaecff 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -18,9 +18,12 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/sched.h>
21#include <linux/kobject.h> 22#include <linux/kobject.h>
23#include <linux/delay.h>
22#include <asm/opal.h> 24#include <asm/opal.h>
23#include <asm/firmware.h> 25#include <asm/firmware.h>
26#include <asm/mce.h>
24 27
25#include "powernv.h" 28#include "powernv.h"
26 29
@@ -38,6 +41,7 @@ extern u64 opal_mc_secondary_handler[];
38static unsigned int *opal_irqs; 41static unsigned int *opal_irqs;
39static unsigned int opal_irq_count; 42static unsigned int opal_irq_count;
40static ATOMIC_NOTIFIER_HEAD(opal_notifier_head); 43static ATOMIC_NOTIFIER_HEAD(opal_notifier_head);
44static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX];
41static DEFINE_SPINLOCK(opal_notifier_lock); 45static DEFINE_SPINLOCK(opal_notifier_lock);
42static uint64_t last_notified_mask = 0x0ul; 46static uint64_t last_notified_mask = 0x0ul;
43static atomic_t opal_notifier_hold = ATOMIC_INIT(0); 47static atomic_t opal_notifier_hold = ATOMIC_INIT(0);
@@ -88,14 +92,10 @@ static int __init opal_register_exception_handlers(void)
88 if (!(powerpc_firmware_features & FW_FEATURE_OPAL)) 92 if (!(powerpc_firmware_features & FW_FEATURE_OPAL))
89 return -ENODEV; 93 return -ENODEV;
90 94
91 /* Hookup some exception handlers. We use the fwnmi area at 0x7000 95 /* Hookup some exception handlers except machine check. We use the
92 * to provide the glue space to OPAL 96 * fwnmi area at 0x7000 to provide the glue space to OPAL
93 */ 97 */
94 glue = 0x7000; 98 glue = 0x7000;
95 opal_register_exception_handler(OPAL_MACHINE_CHECK_HANDLER,
96 __pa(opal_mc_secondary_handler[0]),
97 glue);
98 glue += 128;
99 opal_register_exception_handler(OPAL_HYPERVISOR_MAINTENANCE_HANDLER, 99 opal_register_exception_handler(OPAL_HYPERVISOR_MAINTENANCE_HANDLER,
100 0, glue); 100 0, glue);
101 glue += 128; 101 glue += 128;
@@ -169,6 +169,95 @@ void opal_notifier_disable(void)
169 atomic_set(&opal_notifier_hold, 1); 169 atomic_set(&opal_notifier_hold, 1);
170} 170}
171 171
172/*
173 * Opal message notifier based on message type. Allow subscribers to get
174 * notified for specific messgae type.
175 */
176int opal_message_notifier_register(enum OpalMessageType msg_type,
177 struct notifier_block *nb)
178{
179 if (!nb) {
180 pr_warning("%s: Invalid argument (%p)\n",
181 __func__, nb);
182 return -EINVAL;
183 }
184 if (msg_type > OPAL_MSG_TYPE_MAX) {
185 pr_warning("%s: Invalid message type argument (%d)\n",
186 __func__, msg_type);
187 return -EINVAL;
188 }
189 return atomic_notifier_chain_register(
190 &opal_msg_notifier_head[msg_type], nb);
191}
192
193static void opal_message_do_notify(uint32_t msg_type, void *msg)
194{
195 /* notify subscribers */
196 atomic_notifier_call_chain(&opal_msg_notifier_head[msg_type],
197 msg_type, msg);
198}
199
200static void opal_handle_message(void)
201{
202 s64 ret;
203 /*
204 * TODO: pre-allocate a message buffer depending on opal-msg-size
205 * value in /proc/device-tree.
206 */
207 static struct opal_msg msg;
208
209 ret = opal_get_msg(__pa(&msg), sizeof(msg));
210 /* No opal message pending. */
211 if (ret == OPAL_RESOURCE)
212 return;
213
214 /* check for errors. */
215 if (ret) {
216 pr_warning("%s: Failed to retrive opal message, err=%lld\n",
217 __func__, ret);
218 return;
219 }
220
221 /* Sanity check */
222 if (msg.msg_type > OPAL_MSG_TYPE_MAX) {
223 pr_warning("%s: Unknown message type: %u\n",
224 __func__, msg.msg_type);
225 return;
226 }
227 opal_message_do_notify(msg.msg_type, (void *)&msg);
228}
229
230static int opal_message_notify(struct notifier_block *nb,
231 unsigned long events, void *change)
232{
233 if (events & OPAL_EVENT_MSG_PENDING)
234 opal_handle_message();
235 return 0;
236}
237
238static struct notifier_block opal_message_nb = {
239 .notifier_call = opal_message_notify,
240 .next = NULL,
241 .priority = 0,
242};
243
244static int __init opal_message_init(void)
245{
246 int ret, i;
247
248 for (i = 0; i < OPAL_MSG_TYPE_MAX; i++)
249 ATOMIC_INIT_NOTIFIER_HEAD(&opal_msg_notifier_head[i]);
250
251 ret = opal_notifier_register(&opal_message_nb);
252 if (ret) {
253 pr_err("%s: Can't register OPAL event notifier (%d)\n",
254 __func__, ret);
255 return ret;
256 }
257 return 0;
258}
259early_initcall(opal_message_init);
260
172int opal_get_chars(uint32_t vtermno, char *buf, int count) 261int opal_get_chars(uint32_t vtermno, char *buf, int count)
173{ 262{
174 s64 rc; 263 s64 rc;
@@ -254,119 +343,62 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
254 return written; 343 return written;
255} 344}
256 345
346static int opal_recover_mce(struct pt_regs *regs,
347 struct machine_check_event *evt)
348{
349 int recovered = 0;
350 uint64_t ea = get_mce_fault_addr(evt);
351
352 if (!(regs->msr & MSR_RI)) {
353 /* If MSR_RI isn't set, we cannot recover */
354 recovered = 0;
355 } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) {
356 /* Platform corrected itself */
357 recovered = 1;
358 } else if (ea && !is_kernel_addr(ea)) {
359 /*
360 * Faulting address is not in kernel text. We should be fine.
361 * We need to find which process uses this address.
362 * For now, kill the task if we have received exception when
363 * in userspace.
364 *
365 * TODO: Queue up this address for hwpoisioning later.
366 */
367 if (user_mode(regs) && !is_global_init(current)) {
368 _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
369 recovered = 1;
370 } else
371 recovered = 0;
372 } else if (user_mode(regs) && !is_global_init(current) &&
373 evt->severity == MCE_SEV_ERROR_SYNC) {
374 /*
375 * If we have received a synchronous error when in userspace
376 * kill the task.
377 */
378 _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
379 recovered = 1;
380 }
381 return recovered;
382}
383
257int opal_machine_check(struct pt_regs *regs) 384int opal_machine_check(struct pt_regs *regs)
258{ 385{
259 struct opal_machine_check_event *opal_evt = get_paca()->opal_mc_evt; 386 struct machine_check_event evt;
260 struct opal_machine_check_event evt; 387
261 const char *level, *sevstr, *subtype; 388 if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
262 static const char *opal_mc_ue_types[] = { 389 return 0;
263 "Indeterminate",
264 "Instruction fetch",
265 "Page table walk ifetch",
266 "Load/Store",
267 "Page table walk Load/Store",
268 };
269 static const char *opal_mc_slb_types[] = {
270 "Indeterminate",
271 "Parity",
272 "Multihit",
273 };
274 static const char *opal_mc_erat_types[] = {
275 "Indeterminate",
276 "Parity",
277 "Multihit",
278 };
279 static const char *opal_mc_tlb_types[] = {
280 "Indeterminate",
281 "Parity",
282 "Multihit",
283 };
284
285 /* Copy the event structure and release the original */
286 evt = *opal_evt;
287 opal_evt->in_use = 0;
288 390
289 /* Print things out */ 391 /* Print things out */
290 if (evt.version != OpalMCE_V1) { 392 if (evt.version != MCE_V1) {
291 pr_err("Machine Check Exception, Unknown event version %d !\n", 393 pr_err("Machine Check Exception, Unknown event version %d !\n",
292 evt.version); 394 evt.version);
293 return 0; 395 return 0;
294 } 396 }
295 switch(evt.severity) { 397 machine_check_print_event_info(&evt);
296 case OpalMCE_SEV_NO_ERROR:
297 level = KERN_INFO;
298 sevstr = "Harmless";
299 break;
300 case OpalMCE_SEV_WARNING:
301 level = KERN_WARNING;
302 sevstr = "";
303 break;
304 case OpalMCE_SEV_ERROR_SYNC:
305 level = KERN_ERR;
306 sevstr = "Severe";
307 break;
308 case OpalMCE_SEV_FATAL:
309 default:
310 level = KERN_ERR;
311 sevstr = "Fatal";
312 break;
313 }
314 398
315 printk("%s%s Machine check interrupt [%s]\n", level, sevstr, 399 if (opal_recover_mce(regs, &evt))
316 evt.disposition == OpalMCE_DISPOSITION_RECOVERED ? 400 return 1;
317 "Recovered" : "[Not recovered"); 401 return 0;
318 printk("%s Initiator: %s\n", level,
319 evt.initiator == OpalMCE_INITIATOR_CPU ? "CPU" : "Unknown");
320 switch(evt.error_type) {
321 case OpalMCE_ERROR_TYPE_UE:
322 subtype = evt.u.ue_error.ue_error_type <
323 ARRAY_SIZE(opal_mc_ue_types) ?
324 opal_mc_ue_types[evt.u.ue_error.ue_error_type]
325 : "Unknown";
326 printk("%s Error type: UE [%s]\n", level, subtype);
327 if (evt.u.ue_error.effective_address_provided)
328 printk("%s Effective address: %016llx\n",
329 level, evt.u.ue_error.effective_address);
330 if (evt.u.ue_error.physical_address_provided)
331 printk("%s Physial address: %016llx\n",
332 level, evt.u.ue_error.physical_address);
333 break;
334 case OpalMCE_ERROR_TYPE_SLB:
335 subtype = evt.u.slb_error.slb_error_type <
336 ARRAY_SIZE(opal_mc_slb_types) ?
337 opal_mc_slb_types[evt.u.slb_error.slb_error_type]
338 : "Unknown";
339 printk("%s Error type: SLB [%s]\n", level, subtype);
340 if (evt.u.slb_error.effective_address_provided)
341 printk("%s Effective address: %016llx\n",
342 level, evt.u.slb_error.effective_address);
343 break;
344 case OpalMCE_ERROR_TYPE_ERAT:
345 subtype = evt.u.erat_error.erat_error_type <
346 ARRAY_SIZE(opal_mc_erat_types) ?
347 opal_mc_erat_types[evt.u.erat_error.erat_error_type]
348 : "Unknown";
349 printk("%s Error type: ERAT [%s]\n", level, subtype);
350 if (evt.u.erat_error.effective_address_provided)
351 printk("%s Effective address: %016llx\n",
352 level, evt.u.erat_error.effective_address);
353 break;
354 case OpalMCE_ERROR_TYPE_TLB:
355 subtype = evt.u.tlb_error.tlb_error_type <
356 ARRAY_SIZE(opal_mc_tlb_types) ?
357 opal_mc_tlb_types[evt.u.tlb_error.tlb_error_type]
358 : "Unknown";
359 printk("%s Error type: TLB [%s]\n", level, subtype);
360 if (evt.u.tlb_error.effective_address_provided)
361 printk("%s Effective address: %016llx\n",
362 level, evt.u.tlb_error.effective_address);
363 break;
364 default:
365 case OpalMCE_ERROR_TYPE_UNKNOWN:
366 printk("%s Error type: Unknown\n", level);
367 break;
368 }
369 return evt.severity == OpalMCE_SEV_FATAL ? 0 : 1;
370} 402}
371 403
372static irqreturn_t opal_interrupt(int irq, void *data) 404static irqreturn_t opal_interrupt(int irq, void *data)
@@ -451,10 +483,25 @@ subsys_initcall(opal_init);
451void opal_shutdown(void) 483void opal_shutdown(void)
452{ 484{
453 unsigned int i; 485 unsigned int i;
486 long rc = OPAL_BUSY;
454 487
488 /* First free interrupts, which will also mask them */
455 for (i = 0; i < opal_irq_count; i++) { 489 for (i = 0; i < opal_irq_count; i++) {
456 if (opal_irqs[i]) 490 if (opal_irqs[i])
457 free_irq(opal_irqs[i], NULL); 491 free_irq(opal_irqs[i], NULL);
458 opal_irqs[i] = 0; 492 opal_irqs[i] = 0;
459 } 493 }
494
495 /*
496 * Then sync with OPAL which ensure anything that can
497 * potentially write to our memory has completed such
498 * as an ongoing dump retrieval
499 */
500 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
501 rc = opal_sync_host_reboot();
502 if (rc == OPAL_BUSY)
503 opal_poll_events(NULL);
504 else
505 mdelay(10);
506 }
460} 507}
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 2c6d173842b2..7d6dcc6d5fa9 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -460,7 +460,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
460 return; 460 return;
461 461
462 pe = &phb->ioda.pe_array[pdn->pe_number]; 462 pe = &phb->ioda.pe_array[pdn->pe_number];
463 set_iommu_table_base(&pdev->dev, &pe->tce32_table); 463 set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table);
464} 464}
465 465
466static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) 466static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
@@ -468,7 +468,7 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
468 struct pci_dev *dev; 468 struct pci_dev *dev;
469 469
470 list_for_each_entry(dev, &bus->devices, bus_list) { 470 list_for_each_entry(dev, &bus->devices, bus_list) {
471 set_iommu_table_base(&dev->dev, &pe->tce32_table); 471 set_iommu_table_base_and_group(&dev->dev, &pe->tce32_table);
472 if (dev->subordinate) 472 if (dev->subordinate)
473 pnv_ioda_setup_bus_dma(pe, dev->subordinate); 473 pnv_ioda_setup_bus_dma(pe, dev->subordinate);
474 } 474 }
@@ -644,7 +644,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
644 iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number); 644 iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
645 645
646 if (pe->pdev) 646 if (pe->pdev)
647 set_iommu_table_base(&pe->pdev->dev, tbl); 647 set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
648 else 648 else
649 pnv_ioda_setup_bus_dma(pe, pe->pbus); 649 pnv_ioda_setup_bus_dma(pe, pe->pbus);
650 650
@@ -723,7 +723,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
723 iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number); 723 iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
724 724
725 if (pe->pdev) 725 if (pe->pdev)
726 set_iommu_table_base(&pe->pdev->dev, tbl); 726 set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
727 else 727 else
728 pnv_ioda_setup_bus_dma(pe, pe->pbus); 728 pnv_ioda_setup_bus_dma(pe, pe->pbus);
729 729
@@ -1144,7 +1144,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1144{ 1144{
1145 struct pci_controller *hose; 1145 struct pci_controller *hose;
1146 struct pnv_phb *phb; 1146 struct pnv_phb *phb;
1147 unsigned long size, m32map_off, iomap_off, pemap_off; 1147 unsigned long size, m32map_off, pemap_off, iomap_off = 0;
1148 const __be64 *prop64; 1148 const __be64 *prop64;
1149 const __be32 *prop32; 1149 const __be32 *prop32;
1150 int len; 1150 int len;
@@ -1231,7 +1231,6 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1231 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long)); 1231 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long));
1232 m32map_off = size; 1232 m32map_off = size;
1233 size += phb->ioda.total_pe * sizeof(phb->ioda.m32_segmap[0]); 1233 size += phb->ioda.total_pe * sizeof(phb->ioda.m32_segmap[0]);
1234 iomap_off = size;
1235 if (phb->type == PNV_PHB_IODA1) { 1234 if (phb->type == PNV_PHB_IODA1) {
1236 iomap_off = size; 1235 iomap_off = size;
1237 size += phb->ioda.total_pe * sizeof(phb->ioda.io_segmap[0]); 1236 size += phb->ioda.total_pe * sizeof(phb->ioda.io_segmap[0]);
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index f8b4bd8afb2e..e3807d69393e 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -92,7 +92,7 @@ static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb,
92 pci_domain_nr(phb->hose->bus), phb->opal_id); 92 pci_domain_nr(phb->hose->bus), phb->opal_id);
93 } 93 }
94 94
95 set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table); 95 set_iommu_table_base_and_group(&pdev->dev, &phb->p5ioc2.iommu_table);
96} 96}
97 97
98static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id, 98static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 4eb33a9ed532..b555ebc57ef5 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -124,77 +124,157 @@ static void pnv_teardown_msi_irqs(struct pci_dev *pdev)
124} 124}
125#endif /* CONFIG_PCI_MSI */ 125#endif /* CONFIG_PCI_MSI */
126 126
127static void pnv_pci_dump_p7ioc_diag_data(struct pnv_phb *phb) 127static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose,
128 struct OpalIoPhbErrorCommon *common)
128{ 129{
129 struct OpalIoP7IOCPhbErrorData *data = &phb->diag.p7ioc; 130 struct OpalIoP7IOCPhbErrorData *data;
130 int i; 131 int i;
131 132
132 pr_info("PHB %d diagnostic data:\n", phb->hose->global_number); 133 data = (struct OpalIoP7IOCPhbErrorData *)common;
133 134 pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n\n",
134 pr_info(" brdgCtl = 0x%08x\n", data->brdgCtl); 135 hose->global_number, common->version);
135 136
136 pr_info(" portStatusReg = 0x%08x\n", data->portStatusReg); 137 pr_info(" brdgCtl: %08x\n", data->brdgCtl);
137 pr_info(" rootCmplxStatus = 0x%08x\n", data->rootCmplxStatus); 138
138 pr_info(" busAgentStatus = 0x%08x\n", data->busAgentStatus); 139 pr_info(" portStatusReg: %08x\n", data->portStatusReg);
139 140 pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus);
140 pr_info(" deviceStatus = 0x%08x\n", data->deviceStatus); 141 pr_info(" busAgentStatus: %08x\n", data->busAgentStatus);
141 pr_info(" slotStatus = 0x%08x\n", data->slotStatus); 142
142 pr_info(" linkStatus = 0x%08x\n", data->linkStatus); 143 pr_info(" deviceStatus: %08x\n", data->deviceStatus);
143 pr_info(" devCmdStatus = 0x%08x\n", data->devCmdStatus); 144 pr_info(" slotStatus: %08x\n", data->slotStatus);
144 pr_info(" devSecStatus = 0x%08x\n", data->devSecStatus); 145 pr_info(" linkStatus: %08x\n", data->linkStatus);
145 146 pr_info(" devCmdStatus: %08x\n", data->devCmdStatus);
146 pr_info(" rootErrorStatus = 0x%08x\n", data->rootErrorStatus); 147 pr_info(" devSecStatus: %08x\n", data->devSecStatus);
147 pr_info(" uncorrErrorStatus = 0x%08x\n", data->uncorrErrorStatus); 148
148 pr_info(" corrErrorStatus = 0x%08x\n", data->corrErrorStatus); 149 pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus);
149 pr_info(" tlpHdr1 = 0x%08x\n", data->tlpHdr1); 150 pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus);
150 pr_info(" tlpHdr2 = 0x%08x\n", data->tlpHdr2); 151 pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus);
151 pr_info(" tlpHdr3 = 0x%08x\n", data->tlpHdr3); 152 pr_info(" tlpHdr1: %08x\n", data->tlpHdr1);
152 pr_info(" tlpHdr4 = 0x%08x\n", data->tlpHdr4); 153 pr_info(" tlpHdr2: %08x\n", data->tlpHdr2);
153 pr_info(" sourceId = 0x%08x\n", data->sourceId); 154 pr_info(" tlpHdr3: %08x\n", data->tlpHdr3);
154 155 pr_info(" tlpHdr4: %08x\n", data->tlpHdr4);
155 pr_info(" errorClass = 0x%016llx\n", data->errorClass); 156 pr_info(" sourceId: %08x\n", data->sourceId);
156 pr_info(" correlator = 0x%016llx\n", data->correlator); 157 pr_info(" errorClass: %016llx\n", data->errorClass);
157 158 pr_info(" correlator: %016llx\n", data->correlator);
158 pr_info(" p7iocPlssr = 0x%016llx\n", data->p7iocPlssr); 159 pr_info(" p7iocPlssr: %016llx\n", data->p7iocPlssr);
159 pr_info(" p7iocCsr = 0x%016llx\n", data->p7iocCsr); 160 pr_info(" p7iocCsr: %016llx\n", data->p7iocCsr);
160 pr_info(" lemFir = 0x%016llx\n", data->lemFir); 161 pr_info(" lemFir: %016llx\n", data->lemFir);
161 pr_info(" lemErrorMask = 0x%016llx\n", data->lemErrorMask); 162 pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask);
162 pr_info(" lemWOF = 0x%016llx\n", data->lemWOF); 163 pr_info(" lemWOF: %016llx\n", data->lemWOF);
163 pr_info(" phbErrorStatus = 0x%016llx\n", data->phbErrorStatus); 164 pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus);
164 pr_info(" phbFirstErrorStatus = 0x%016llx\n", data->phbFirstErrorStatus); 165 pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus);
165 pr_info(" phbErrorLog0 = 0x%016llx\n", data->phbErrorLog0); 166 pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0);
166 pr_info(" phbErrorLog1 = 0x%016llx\n", data->phbErrorLog1); 167 pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1);
167 pr_info(" mmioErrorStatus = 0x%016llx\n", data->mmioErrorStatus); 168 pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus);
168 pr_info(" mmioFirstErrorStatus = 0x%016llx\n", data->mmioFirstErrorStatus); 169 pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
169 pr_info(" mmioErrorLog0 = 0x%016llx\n", data->mmioErrorLog0); 170 pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0);
170 pr_info(" mmioErrorLog1 = 0x%016llx\n", data->mmioErrorLog1); 171 pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1);
171 pr_info(" dma0ErrorStatus = 0x%016llx\n", data->dma0ErrorStatus); 172 pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus);
172 pr_info(" dma0FirstErrorStatus = 0x%016llx\n", data->dma0FirstErrorStatus); 173 pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
173 pr_info(" dma0ErrorLog0 = 0x%016llx\n", data->dma0ErrorLog0); 174 pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0);
174 pr_info(" dma0ErrorLog1 = 0x%016llx\n", data->dma0ErrorLog1); 175 pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1);
175 pr_info(" dma1ErrorStatus = 0x%016llx\n", data->dma1ErrorStatus); 176 pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus);
176 pr_info(" dma1FirstErrorStatus = 0x%016llx\n", data->dma1FirstErrorStatus); 177 pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
177 pr_info(" dma1ErrorLog0 = 0x%016llx\n", data->dma1ErrorLog0); 178 pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0);
178 pr_info(" dma1ErrorLog1 = 0x%016llx\n", data->dma1ErrorLog1); 179 pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1);
179 180
180 for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) { 181 for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) {
181 if ((data->pestA[i] >> 63) == 0 && 182 if ((data->pestA[i] >> 63) == 0 &&
182 (data->pestB[i] >> 63) == 0) 183 (data->pestB[i] >> 63) == 0)
183 continue; 184 continue;
184 pr_info(" PE[%3d] PESTA = 0x%016llx\n", i, data->pestA[i]); 185
185 pr_info(" PESTB = 0x%016llx\n", data->pestB[i]); 186 pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]);
187 pr_info(" PESTB: %016llx\n", data->pestB[i]);
188 }
189}
190
191static void pnv_pci_dump_phb3_diag_data(struct pci_controller *hose,
192 struct OpalIoPhbErrorCommon *common)
193{
194 struct OpalIoPhb3ErrorData *data;
195 int i;
196
197 data = (struct OpalIoPhb3ErrorData*)common;
198 pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n\n",
199 hose->global_number, common->version);
200
201 pr_info(" brdgCtl: %08x\n", data->brdgCtl);
202
203 pr_info(" portStatusReg: %08x\n", data->portStatusReg);
204 pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus);
205 pr_info(" busAgentStatus: %08x\n", data->busAgentStatus);
206
207 pr_info(" deviceStatus: %08x\n", data->deviceStatus);
208 pr_info(" slotStatus: %08x\n", data->slotStatus);
209 pr_info(" linkStatus: %08x\n", data->linkStatus);
210 pr_info(" devCmdStatus: %08x\n", data->devCmdStatus);
211 pr_info(" devSecStatus: %08x\n", data->devSecStatus);
212
213 pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus);
214 pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus);
215 pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus);
216 pr_info(" tlpHdr1: %08x\n", data->tlpHdr1);
217 pr_info(" tlpHdr2: %08x\n", data->tlpHdr2);
218 pr_info(" tlpHdr3: %08x\n", data->tlpHdr3);
219 pr_info(" tlpHdr4: %08x\n", data->tlpHdr4);
220 pr_info(" sourceId: %08x\n", data->sourceId);
221 pr_info(" errorClass: %016llx\n", data->errorClass);
222 pr_info(" correlator: %016llx\n", data->correlator);
223
224 pr_info(" nFir: %016llx\n", data->nFir);
225 pr_info(" nFirMask: %016llx\n", data->nFirMask);
226 pr_info(" nFirWOF: %016llx\n", data->nFirWOF);
227 pr_info(" PhbPlssr: %016llx\n", data->phbPlssr);
228 pr_info(" PhbCsr: %016llx\n", data->phbCsr);
229 pr_info(" lemFir: %016llx\n", data->lemFir);
230 pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask);
231 pr_info(" lemWOF: %016llx\n", data->lemWOF);
232 pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus);
233 pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus);
234 pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0);
235 pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1);
236 pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus);
237 pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
238 pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0);
239 pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1);
240 pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus);
241 pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
242 pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0);
243 pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1);
244 pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus);
245 pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
246 pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0);
247 pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1);
248
249 for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) {
250 if ((data->pestA[i] >> 63) == 0 &&
251 (data->pestB[i] >> 63) == 0)
252 continue;
253
254 pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]);
255 pr_info(" PESTB: %016llx\n", data->pestB[i]);
186 } 256 }
187} 257}
188 258
189static void pnv_pci_dump_phb_diag_data(struct pnv_phb *phb) 259void pnv_pci_dump_phb_diag_data(struct pci_controller *hose,
260 unsigned char *log_buff)
190{ 261{
191 switch(phb->model) { 262 struct OpalIoPhbErrorCommon *common;
192 case PNV_PHB_MODEL_P7IOC: 263
193 pnv_pci_dump_p7ioc_diag_data(phb); 264 if (!hose || !log_buff)
265 return;
266
267 common = (struct OpalIoPhbErrorCommon *)log_buff;
268 switch (common->ioType) {
269 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
270 pnv_pci_dump_p7ioc_diag_data(hose, common);
271 break;
272 case OPAL_PHB_ERROR_DATA_TYPE_PHB3:
273 pnv_pci_dump_phb3_diag_data(hose, common);
194 break; 274 break;
195 default: 275 default:
196 pr_warning("PCI %d: Can't decode this PHB diag data\n", 276 pr_warn("%s: Unrecognized ioType %d\n",
197 phb->hose->global_number); 277 __func__, common->ioType);
198 } 278 }
199} 279}
200 280
@@ -222,7 +302,7 @@ static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no)
222 * with the normal errors generated when probing empty slots 302 * with the normal errors generated when probing empty slots
223 */ 303 */
224 if (has_diag) 304 if (has_diag)
225 pnv_pci_dump_phb_diag_data(phb); 305 pnv_pci_dump_phb_diag_data(phb->hose, phb->diag.blob);
226 else 306 else
227 pr_warning("PCI %d: No diag data available\n", 307 pr_warning("PCI %d: No diag data available\n",
228 phb->hose->global_number); 308 phb->hose->global_number);
@@ -484,7 +564,8 @@ void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
484{ 564{
485 tbl->it_blocksize = 16; 565 tbl->it_blocksize = 16;
486 tbl->it_base = (unsigned long)tce_mem; 566 tbl->it_base = (unsigned long)tce_mem;
487 tbl->it_offset = dma_offset >> IOMMU_PAGE_SHIFT; 567 tbl->it_page_shift = IOMMU_PAGE_SHIFT_4K;
568 tbl->it_offset = dma_offset >> tbl->it_page_shift;
488 tbl->it_index = 0; 569 tbl->it_index = 0;
489 tbl->it_size = tce_size >> 3; 570 tbl->it_size = tce_size >> 3;
490 tbl->it_busno = 0; 571 tbl->it_busno = 0;
@@ -536,7 +617,7 @@ static void pnv_pci_dma_fallback_setup(struct pci_controller *hose,
536 pdn->iommu_table = pnv_pci_setup_bml_iommu(hose); 617 pdn->iommu_table = pnv_pci_setup_bml_iommu(hose);
537 if (!pdn->iommu_table) 618 if (!pdn->iommu_table)
538 return; 619 return;
539 set_iommu_table_base(&pdev->dev, pdn->iommu_table); 620 set_iommu_table_base_and_group(&pdev->dev, pdn->iommu_table);
540} 621}
541 622
542static void pnv_pci_dma_dev_setup(struct pci_dev *pdev) 623static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
@@ -657,3 +738,32 @@ void __init pnv_pci_init(void)
657 ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs; 738 ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs;
658#endif 739#endif
659} 740}
741
742static int tce_iommu_bus_notifier(struct notifier_block *nb,
743 unsigned long action, void *data)
744{
745 struct device *dev = data;
746
747 switch (action) {
748 case BUS_NOTIFY_ADD_DEVICE:
749 return iommu_add_device(dev);
750 case BUS_NOTIFY_DEL_DEVICE:
751 if (dev->iommu_group)
752 iommu_del_device(dev);
753 return 0;
754 default:
755 return 0;
756 }
757}
758
759static struct notifier_block tce_iommu_bus_nb = {
760 .notifier_call = tce_iommu_bus_notifier,
761};
762
763static int __init tce_iommu_bus_notifier_init(void)
764{
765 bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
766 return 0;
767}
768
769subsys_initcall_sync(tce_iommu_bus_notifier_init);
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 1ed8d5f40f5a..13f1942a9a5f 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -176,6 +176,7 @@ struct pnv_phb {
176 union { 176 union {
177 unsigned char blob[PNV_PCI_DIAG_BUF_SIZE]; 177 unsigned char blob[PNV_PCI_DIAG_BUF_SIZE];
178 struct OpalIoP7IOCPhbErrorData p7ioc; 178 struct OpalIoP7IOCPhbErrorData p7ioc;
179 struct OpalIoPhb3ErrorData phb3;
179 struct OpalIoP7IOCErrorData hub_diag; 180 struct OpalIoP7IOCErrorData hub_diag;
180 } diag; 181 } diag;
181 182
@@ -186,6 +187,8 @@ extern struct pci_ops pnv_pci_ops;
186extern struct pnv_eeh_ops ioda_eeh_ops; 187extern struct pnv_eeh_ops ioda_eeh_ops;
187#endif 188#endif
188 189
190void pnv_pci_dump_phb_diag_data(struct pci_controller *hose,
191 unsigned char *log_buff);
189int pnv_pci_cfg_read(struct device_node *dn, 192int pnv_pci_cfg_read(struct device_node *dn,
190 int where, int size, u32 *val); 193 int where, int size, u32 *val);
191int pnv_pci_cfg_write(struct device_node *dn, 194int pnv_pci_cfg_write(struct device_node *dn,
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 19884b2a51b4..21166f65c97c 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -26,6 +26,7 @@
26#include <linux/of_fdt.h> 26#include <linux/of_fdt.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/bug.h> 28#include <linux/bug.h>
29#include <linux/cpuidle.h>
29 30
30#include <asm/machdep.h> 31#include <asm/machdep.h>
31#include <asm/firmware.h> 32#include <asm/firmware.h>
@@ -145,8 +146,10 @@ static void pnv_shutdown(void)
145 /* Let the PCI code clear up IODA tables */ 146 /* Let the PCI code clear up IODA tables */
146 pnv_pci_shutdown(); 147 pnv_pci_shutdown();
147 148
148 /* And unregister all OPAL interrupts so they don't fire 149 /*
149 * up while we kexec 150 * Stop OPAL activity: Unregister all OPAL interrupts so they
151 * don't fire up while we kexec and make sure all potentially
152 * DMA'ing ops are complete (such as dump retrieval).
150 */ 153 */
151 opal_shutdown(); 154 opal_shutdown();
152} 155}
@@ -214,6 +217,16 @@ static int __init pnv_probe(void)
214 return 1; 217 return 1;
215} 218}
216 219
220void powernv_idle(void)
221{
222 /* Hook to cpuidle framework if available, else
223 * call on default platform idle code
224 */
225 if (cpuidle_idle_call()) {
226 power7_idle();
227 }
228}
229
217define_machine(powernv) { 230define_machine(powernv) {
218 .name = "PowerNV", 231 .name = "PowerNV",
219 .probe = pnv_probe, 232 .probe = pnv_probe,
@@ -223,7 +236,7 @@ define_machine(powernv) {
223 .show_cpuinfo = pnv_show_cpuinfo, 236 .show_cpuinfo = pnv_show_cpuinfo,
224 .progress = pnv_progress, 237 .progress = pnv_progress,
225 .machine_shutdown = pnv_shutdown, 238 .machine_shutdown = pnv_shutdown,
226 .power_save = power7_idle, 239 .power_save = powernv_idle,
227 .calibrate_decr = generic_calibrate_decr, 240 .calibrate_decr = generic_calibrate_decr,
228#ifdef CONFIG_KEXEC 241#ifdef CONFIG_KEXEC
229 .kexec_cpu_down = pnv_kexec_cpu_down, 242 .kexec_cpu_down = pnv_kexec_cpu_down,
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index e17fa1432d80..a0bca05e26b0 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -143,7 +143,7 @@ static void _dump_areas(unsigned int spe_id, unsigned long priv2,
143 pr_debug("%s:%d: shadow: %lxh\n", func, line, shadow); 143 pr_debug("%s:%d: shadow: %lxh\n", func, line, shadow);
144} 144}
145 145
146inline u64 ps3_get_spe_id(void *arg) 146u64 ps3_get_spe_id(void *arg)
147{ 147{
148 return spu_pdata(arg)->spe_id; 148 return spu_pdata(arg)->spe_id;
149} 149}
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 62b4f8025de0..37300f6ee244 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -34,7 +34,7 @@ config PPC_SPLPAR
34 34
35config PSERIES_MSI 35config PSERIES_MSI
36 bool 36 bool
37 depends on PCI_MSI && EEH 37 depends on PCI_MSI && PPC_PSERIES && EEH
38 default y 38 default y
39 39
40config PSERIES_ENERGY 40config PSERIES_ENERGY
@@ -119,12 +119,3 @@ config DTL
119 which are accessible through a debugfs file. 119 which are accessible through a debugfs file.
120 120
121 Say N if you are unsure. 121 Say N if you are unsure.
122
123config PSERIES_IDLE
124 bool "Cpuidle driver for pSeries platforms"
125 depends on CPU_IDLE
126 depends on PPC_PSERIES
127 default y
128 help
129 Select this option to enable processor idle state management
130 through cpuidle subsystem.
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index fbccac9cd2dc..03480796af9a 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -21,7 +21,6 @@ obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
21obj-$(CONFIG_CMM) += cmm.o 21obj-$(CONFIG_CMM) += cmm.o
22obj-$(CONFIG_DTL) += dtl.o 22obj-$(CONFIG_DTL) += dtl.o
23obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o 23obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o
24obj-$(CONFIG_PSERIES_IDLE) += processor_idle.o
25obj-$(CONFIG_LPARCFG) += lparcfg.o 24obj-$(CONFIG_LPARCFG) += lparcfg.o
26 25
27ifeq ($(CONFIG_PPC_PSERIES),y) 26ifeq ($(CONFIG_PPC_PSERIES),y)
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 1e561bef459b..2d8bf15879fd 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -25,7 +25,6 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/gfp.h> 27#include <linux/gfp.h>
28#include <linux/init.h>
29#include <linux/kthread.h> 28#include <linux/kthread.h>
30#include <linux/module.h> 29#include <linux/module.h>
31#include <linux/oom.h> 30#include <linux/oom.h>
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index 5db66f1fbc26..7d61498e45c0 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -20,7 +20,6 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23#include <linux/init.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <linux/debugfs.h> 24#include <linux/debugfs.h>
26#include <linux/spinlock.h> 25#include <linux/spinlock.h>
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index ccb633e077b1..9ef3cc8ebc11 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -689,7 +689,9 @@ static struct eeh_ops pseries_eeh_ops = {
689 .get_log = pseries_eeh_get_log, 689 .get_log = pseries_eeh_get_log,
690 .configure_bridge = pseries_eeh_configure_bridge, 690 .configure_bridge = pseries_eeh_configure_bridge,
691 .read_config = pseries_eeh_read_config, 691 .read_config = pseries_eeh_read_config,
692 .write_config = pseries_eeh_write_config 692 .write_config = pseries_eeh_write_config,
693 .next_error = NULL,
694 .restore_config = NULL
693}; 695};
694 696
695/** 697/**
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index f253361552ae..33b552ffbe57 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -486,9 +486,10 @@ static void iommu_table_setparms(struct pci_controller *phb,
486 memset((void *)tbl->it_base, 0, *sizep); 486 memset((void *)tbl->it_base, 0, *sizep);
487 487
488 tbl->it_busno = phb->bus->number; 488 tbl->it_busno = phb->bus->number;
489 tbl->it_page_shift = IOMMU_PAGE_SHIFT_4K;
489 490
490 /* Units of tce entries */ 491 /* Units of tce entries */
491 tbl->it_offset = phb->dma_window_base_cur >> IOMMU_PAGE_SHIFT; 492 tbl->it_offset = phb->dma_window_base_cur >> tbl->it_page_shift;
492 493
493 /* Test if we are going over 2GB of DMA space */ 494 /* Test if we are going over 2GB of DMA space */
494 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) { 495 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) {
@@ -499,7 +500,7 @@ static void iommu_table_setparms(struct pci_controller *phb,
499 phb->dma_window_base_cur += phb->dma_window_size; 500 phb->dma_window_base_cur += phb->dma_window_size;
500 501
501 /* Set the tce table size - measured in entries */ 502 /* Set the tce table size - measured in entries */
502 tbl->it_size = phb->dma_window_size >> IOMMU_PAGE_SHIFT; 503 tbl->it_size = phb->dma_window_size >> tbl->it_page_shift;
503 504
504 tbl->it_index = 0; 505 tbl->it_index = 0;
505 tbl->it_blocksize = 16; 506 tbl->it_blocksize = 16;
@@ -537,11 +538,12 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb,
537 of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size); 538 of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size);
538 539
539 tbl->it_busno = phb->bus->number; 540 tbl->it_busno = phb->bus->number;
541 tbl->it_page_shift = IOMMU_PAGE_SHIFT_4K;
540 tbl->it_base = 0; 542 tbl->it_base = 0;
541 tbl->it_blocksize = 16; 543 tbl->it_blocksize = 16;
542 tbl->it_type = TCE_PCI; 544 tbl->it_type = TCE_PCI;
543 tbl->it_offset = offset >> IOMMU_PAGE_SHIFT; 545 tbl->it_offset = offset >> tbl->it_page_shift;
544 tbl->it_size = size >> IOMMU_PAGE_SHIFT; 546 tbl->it_size = size >> tbl->it_page_shift;
545} 547}
546 548
547static void pci_dma_bus_setup_pSeries(struct pci_bus *bus) 549static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
@@ -687,7 +689,8 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
687 iommu_table_setparms(phb, dn, tbl); 689 iommu_table_setparms(phb, dn, tbl);
688 PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node); 690 PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node);
689 iommu_register_group(tbl, pci_domain_nr(phb->bus), 0); 691 iommu_register_group(tbl, pci_domain_nr(phb->bus), 0);
690 set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table); 692 set_iommu_table_base_and_group(&dev->dev,
693 PCI_DN(dn)->iommu_table);
691 return; 694 return;
692 } 695 }
693 696
@@ -699,7 +702,8 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
699 dn = dn->parent; 702 dn = dn->parent;
700 703
701 if (dn && PCI_DN(dn)) 704 if (dn && PCI_DN(dn))
702 set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table); 705 set_iommu_table_base_and_group(&dev->dev,
706 PCI_DN(dn)->iommu_table);
703 else 707 else
704 printk(KERN_WARNING "iommu: Device %s has no iommu table\n", 708 printk(KERN_WARNING "iommu: Device %s has no iommu table\n",
705 pci_name(dev)); 709 pci_name(dev));
@@ -717,21 +721,6 @@ static int __init disable_ddw_setup(char *str)
717 721
718early_param("disable_ddw", disable_ddw_setup); 722early_param("disable_ddw", disable_ddw_setup);
719 723
720static inline void __remove_ddw(struct device_node *np, const u32 *ddw_avail, u64 liobn)
721{
722 int ret;
723
724 ret = rtas_call(ddw_avail[2], 1, 1, NULL, liobn);
725 if (ret)
726 pr_warning("%s: failed to remove DMA window: rtas returned "
727 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
728 np->full_name, ret, ddw_avail[2], liobn);
729 else
730 pr_debug("%s: successfully removed DMA window: rtas returned "
731 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
732 np->full_name, ret, ddw_avail[2], liobn);
733}
734
735static void remove_ddw(struct device_node *np) 724static void remove_ddw(struct device_node *np)
736{ 725{
737 struct dynamic_dma_window_prop *dwp; 726 struct dynamic_dma_window_prop *dwp;
@@ -761,7 +750,15 @@ static void remove_ddw(struct device_node *np)
761 pr_debug("%s successfully cleared tces in window.\n", 750 pr_debug("%s successfully cleared tces in window.\n",
762 np->full_name); 751 np->full_name);
763 752
764 __remove_ddw(np, ddw_avail, liobn); 753 ret = rtas_call(ddw_avail[2], 1, 1, NULL, liobn);
754 if (ret)
755 pr_warning("%s: failed to remove direct window: rtas returned "
756 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
757 np->full_name, ret, ddw_avail[2], liobn);
758 else
759 pr_debug("%s: successfully removed direct window: rtas returned "
760 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
761 np->full_name, ret, ddw_avail[2], liobn);
765 762
766delprop: 763delprop:
767 ret = of_remove_property(np, win64); 764 ret = of_remove_property(np, win64);
@@ -790,68 +787,33 @@ static u64 find_existing_ddw(struct device_node *pdn)
790 return dma_addr; 787 return dma_addr;
791} 788}
792 789
793static void __restore_default_window(struct eeh_dev *edev,
794 u32 ddw_restore_token)
795{
796 u32 cfg_addr;
797 u64 buid;
798 int ret;
799
800 /*
801 * Get the config address and phb buid of the PE window.
802 * Rely on eeh to retrieve this for us.
803 * Retrieve them from the pci device, not the node with the
804 * dma-window property
805 */
806 cfg_addr = edev->config_addr;
807 if (edev->pe_config_addr)
808 cfg_addr = edev->pe_config_addr;
809 buid = edev->phb->buid;
810
811 do {
812 ret = rtas_call(ddw_restore_token, 3, 1, NULL, cfg_addr,
813 BUID_HI(buid), BUID_LO(buid));
814 } while (rtas_busy_delay(ret));
815 pr_info("ibm,reset-pe-dma-windows(%x) %x %x %x returned %d\n",
816 ddw_restore_token, cfg_addr, BUID_HI(buid), BUID_LO(buid), ret);
817}
818
819static int find_existing_ddw_windows(void) 790static int find_existing_ddw_windows(void)
820{ 791{
792 int len;
821 struct device_node *pdn; 793 struct device_node *pdn;
794 struct direct_window *window;
822 const struct dynamic_dma_window_prop *direct64; 795 const struct dynamic_dma_window_prop *direct64;
823 const u32 *ddw_extensions;
824 796
825 if (!firmware_has_feature(FW_FEATURE_LPAR)) 797 if (!firmware_has_feature(FW_FEATURE_LPAR))
826 return 0; 798 return 0;
827 799
828 for_each_node_with_property(pdn, DIRECT64_PROPNAME) { 800 for_each_node_with_property(pdn, DIRECT64_PROPNAME) {
829 direct64 = of_get_property(pdn, DIRECT64_PROPNAME, NULL); 801 direct64 = of_get_property(pdn, DIRECT64_PROPNAME, &len);
830 if (!direct64) 802 if (!direct64)
831 continue; 803 continue;
832 804
833 /* 805 window = kzalloc(sizeof(*window), GFP_KERNEL);
834 * We need to ensure the IOMMU table is active when we 806 if (!window || len < sizeof(struct dynamic_dma_window_prop)) {
835 * return from the IOMMU setup so that the common code 807 kfree(window);
836 * can clear the table or find the holes. To that end, 808 remove_ddw(pdn);
837 * first, remove any existing DDW configuration. 809 continue;
838 */ 810 }
839 remove_ddw(pdn);
840 811
841 /* 812 window->device = pdn;
842 * Second, if we are running on a new enough level of 813 window->prop = direct64;
843 * firmware where the restore API is present, use it to 814 spin_lock(&direct_window_list_lock);
844 * restore the 32-bit window, which was removed in 815 list_add(&window->list, &direct_window_list);
845 * create_ddw. 816 spin_unlock(&direct_window_list_lock);
846 * If the API is not present, then create_ddw couldn't
847 * have removed the 32-bit window in the first place, so
848 * removing the DDW configuration should be sufficient.
849 */
850 ddw_extensions = of_get_property(pdn, "ibm,ddw-extensions",
851 NULL);
852 if (ddw_extensions && ddw_extensions[0] > 0)
853 __restore_default_window(of_node_to_eeh_dev(pdn),
854 ddw_extensions[1]);
855 } 817 }
856 818
857 return 0; 819 return 0;
@@ -921,12 +883,6 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
921 return ret; 883 return ret;
922} 884}
923 885
924static void restore_default_window(struct pci_dev *dev,
925 u32 ddw_restore_token)
926{
927 __restore_default_window(pci_dev_to_eeh_dev(dev), ddw_restore_token);
928}
929
930struct failed_ddw_pdn { 886struct failed_ddw_pdn {
931 struct device_node *pdn; 887 struct device_node *pdn;
932 struct list_head list; 888 struct list_head list;
@@ -954,13 +910,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
954 u64 dma_addr, max_addr; 910 u64 dma_addr, max_addr;
955 struct device_node *dn; 911 struct device_node *dn;
956 const u32 *uninitialized_var(ddw_avail); 912 const u32 *uninitialized_var(ddw_avail);
957 const u32 *uninitialized_var(ddw_extensions);
958 u32 ddw_restore_token = 0;
959 struct direct_window *window; 913 struct direct_window *window;
960 struct property *win64; 914 struct property *win64;
961 struct dynamic_dma_window_prop *ddwprop; 915 struct dynamic_dma_window_prop *ddwprop;
962 const void *dma_window = NULL;
963 unsigned long liobn, offset, size;
964 struct failed_ddw_pdn *fpdn; 916 struct failed_ddw_pdn *fpdn;
965 917
966 mutex_lock(&direct_window_init_mutex); 918 mutex_lock(&direct_window_init_mutex);
@@ -991,42 +943,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
991 */ 943 */
992 ddw_avail = of_get_property(pdn, "ibm,ddw-applicable", &len); 944 ddw_avail = of_get_property(pdn, "ibm,ddw-applicable", &len);
993 if (!ddw_avail || len < 3 * sizeof(u32)) 945 if (!ddw_avail || len < 3 * sizeof(u32))
994 goto out_unlock; 946 goto out_failed;
995
996 /*
997 * the extensions property is only required to exist in certain
998 * levels of firmware and later
999 * the ibm,ddw-extensions property is a list with the first
1000 * element containing the number of extensions and each
1001 * subsequent entry is a value corresponding to that extension
1002 */
1003 ddw_extensions = of_get_property(pdn, "ibm,ddw-extensions", &len);
1004 if (ddw_extensions) {
1005 /*
1006 * each new defined extension length should be added to
1007 * the top of the switch so the "earlier" entries also
1008 * get picked up
1009 */
1010 switch (ddw_extensions[0]) {
1011 /* ibm,reset-pe-dma-windows */
1012 case 1:
1013 ddw_restore_token = ddw_extensions[1];
1014 break;
1015 }
1016 }
1017
1018 /*
1019 * Only remove the existing DMA window if we can restore back to
1020 * the default state. Removing the existing window maximizes the
1021 * resources available to firmware for dynamic window creation.
1022 */
1023 if (ddw_restore_token) {
1024 dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
1025 of_parse_dma_window(pdn, dma_window, &liobn, &offset, &size);
1026 __remove_ddw(pdn, ddw_avail, liobn);
1027 }
1028 947
1029 /* 948 /*
1030 * Query if there is a second window of size to map the 949 * Query if there is a second window of size to map the
1031 * whole partition. Query returns number of windows, largest 950 * whole partition. Query returns number of windows, largest
1032 * block assigned to PE (partition endpoint), and two bitmasks 951 * block assigned to PE (partition endpoint), and two bitmasks
@@ -1035,7 +954,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1035 dn = pci_device_to_OF_node(dev); 954 dn = pci_device_to_OF_node(dev);
1036 ret = query_ddw(dev, ddw_avail, &query); 955 ret = query_ddw(dev, ddw_avail, &query);
1037 if (ret != 0) 956 if (ret != 0)
1038 goto out_restore_window; 957 goto out_failed;
1039 958
1040 if (query.windows_available == 0) { 959 if (query.windows_available == 0) {
1041 /* 960 /*
@@ -1044,7 +963,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1044 * trading in for a larger page size. 963 * trading in for a larger page size.
1045 */ 964 */
1046 dev_dbg(&dev->dev, "no free dynamic windows"); 965 dev_dbg(&dev->dev, "no free dynamic windows");
1047 goto out_restore_window; 966 goto out_failed;
1048 } 967 }
1049 if (be32_to_cpu(query.page_size) & 4) { 968 if (be32_to_cpu(query.page_size) & 4) {
1050 page_shift = 24; /* 16MB */ 969 page_shift = 24; /* 16MB */
@@ -1055,7 +974,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1055 } else { 974 } else {
1056 dev_dbg(&dev->dev, "no supported direct page size in mask %x", 975 dev_dbg(&dev->dev, "no supported direct page size in mask %x",
1057 query.page_size); 976 query.page_size);
1058 goto out_restore_window; 977 goto out_failed;
1059 } 978 }
1060 /* verify the window * number of ptes will map the partition */ 979 /* verify the window * number of ptes will map the partition */
1061 /* check largest block * page size > max memory hotplug addr */ 980 /* check largest block * page size > max memory hotplug addr */
@@ -1064,14 +983,14 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1064 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u " 983 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u "
1065 "%llu-sized pages\n", max_addr, query.largest_available_block, 984 "%llu-sized pages\n", max_addr, query.largest_available_block,
1066 1ULL << page_shift); 985 1ULL << page_shift);
1067 goto out_restore_window; 986 goto out_failed;
1068 } 987 }
1069 len = order_base_2(max_addr); 988 len = order_base_2(max_addr);
1070 win64 = kzalloc(sizeof(struct property), GFP_KERNEL); 989 win64 = kzalloc(sizeof(struct property), GFP_KERNEL);
1071 if (!win64) { 990 if (!win64) {
1072 dev_info(&dev->dev, 991 dev_info(&dev->dev,
1073 "couldn't allocate property for 64bit dma window\n"); 992 "couldn't allocate property for 64bit dma window\n");
1074 goto out_restore_window; 993 goto out_failed;
1075 } 994 }
1076 win64->name = kstrdup(DIRECT64_PROPNAME, GFP_KERNEL); 995 win64->name = kstrdup(DIRECT64_PROPNAME, GFP_KERNEL);
1077 win64->value = ddwprop = kmalloc(sizeof(*ddwprop), GFP_KERNEL); 996 win64->value = ddwprop = kmalloc(sizeof(*ddwprop), GFP_KERNEL);
@@ -1133,9 +1052,7 @@ out_free_prop:
1133 kfree(win64->value); 1052 kfree(win64->value);
1134 kfree(win64); 1053 kfree(win64);
1135 1054
1136out_restore_window: 1055out_failed:
1137 if (ddw_restore_token)
1138 restore_default_window(dev, ddw_restore_token);
1139 1056
1140 fpdn = kzalloc(sizeof(*fpdn), GFP_KERNEL); 1057 fpdn = kzalloc(sizeof(*fpdn), GFP_KERNEL);
1141 if (!fpdn) 1058 if (!fpdn)
@@ -1193,7 +1110,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
1193 pr_debug(" found DMA window, table: %p\n", pci->iommu_table); 1110 pr_debug(" found DMA window, table: %p\n", pci->iommu_table);
1194 } 1111 }
1195 1112
1196 set_iommu_table_base(&dev->dev, pci->iommu_table); 1113 set_iommu_table_base_and_group(&dev->dev, pci->iommu_table);
1197} 1114}
1198 1115
1199static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask) 1116static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 4fca3def9db9..b02af9ef3ff6 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -92,7 +92,7 @@ void vpa_init(int cpu)
92 * PAPR says this feature is SLB-Buffer but firmware never 92 * PAPR says this feature is SLB-Buffer but firmware never
93 * reports that. All SPLPAR support SLB shadow buffer. 93 * reports that. All SPLPAR support SLB shadow buffer.
94 */ 94 */
95 addr = __pa(&slb_shadow[cpu]); 95 addr = __pa(paca[cpu].slb_shadow_ptr);
96 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 96 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
97 ret = register_slb_shadow(hwcpu, addr); 97 ret = register_slb_shadow(hwcpu, addr);
98 if (ret) 98 if (ret)
@@ -153,7 +153,8 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
153 153
154 /* Make pHyp happy */ 154 /* Make pHyp happy */
155 if ((rflags & _PAGE_NO_CACHE) && !(rflags & _PAGE_WRITETHRU)) 155 if ((rflags & _PAGE_NO_CACHE) && !(rflags & _PAGE_WRITETHRU))
156 hpte_r &= ~_PAGE_COHERENT; 156 hpte_r &= ~HPTE_R_M;
157
157 if (firmware_has_feature(FW_FEATURE_XCMO) && !(hpte_r & HPTE_R_N)) 158 if (firmware_has_feature(FW_FEATURE_XCMO) && !(hpte_r & HPTE_R_N))
158 flags |= H_COALESCE_CAND; 159 flags |= H_COALESCE_CAND;
159 160
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
deleted file mode 100644
index a166e38bd683..000000000000
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ /dev/null
@@ -1,364 +0,0 @@
1/*
2 * processor_idle - idle state cpuidle driver.
3 * Adapted from drivers/idle/intel_idle.c and
4 * drivers/acpi/processor_idle.c
5 *
6 */
7
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/moduleparam.h>
12#include <linux/cpuidle.h>
13#include <linux/cpu.h>
14#include <linux/notifier.h>
15
16#include <asm/paca.h>
17#include <asm/reg.h>
18#include <asm/machdep.h>
19#include <asm/firmware.h>
20#include <asm/runlatch.h>
21#include <asm/plpar_wrappers.h>
22
23struct cpuidle_driver pseries_idle_driver = {
24 .name = "pseries_idle",
25 .owner = THIS_MODULE,
26};
27
28#define MAX_IDLE_STATE_COUNT 2
29
30static int max_idle_state = MAX_IDLE_STATE_COUNT - 1;
31static struct cpuidle_device __percpu *pseries_cpuidle_devices;
32static struct cpuidle_state *cpuidle_state_table;
33
34static inline void idle_loop_prolog(unsigned long *in_purr)
35{
36 *in_purr = mfspr(SPRN_PURR);
37 /*
38 * Indicate to the HV that we are idle. Now would be
39 * a good time to find other work to dispatch.
40 */
41 get_lppaca()->idle = 1;
42}
43
44static inline void idle_loop_epilog(unsigned long in_purr)
45{
46 u64 wait_cycles;
47
48 wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
49 wait_cycles += mfspr(SPRN_PURR) - in_purr;
50 get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
51 get_lppaca()->idle = 0;
52}
53
54static int snooze_loop(struct cpuidle_device *dev,
55 struct cpuidle_driver *drv,
56 int index)
57{
58 unsigned long in_purr;
59 int cpu = dev->cpu;
60
61 idle_loop_prolog(&in_purr);
62 local_irq_enable();
63 set_thread_flag(TIF_POLLING_NRFLAG);
64
65 while ((!need_resched()) && cpu_online(cpu)) {
66 ppc64_runlatch_off();
67 HMT_low();
68 HMT_very_low();
69 }
70
71 HMT_medium();
72 clear_thread_flag(TIF_POLLING_NRFLAG);
73 smp_mb();
74
75 idle_loop_epilog(in_purr);
76
77 return index;
78}
79
80static void check_and_cede_processor(void)
81{
82 /*
83 * Ensure our interrupt state is properly tracked,
84 * also checks if no interrupt has occurred while we
85 * were soft-disabled
86 */
87 if (prep_irq_for_idle()) {
88 cede_processor();
89#ifdef CONFIG_TRACE_IRQFLAGS
90 /* Ensure that H_CEDE returns with IRQs on */
91 if (WARN_ON(!(mfmsr() & MSR_EE)))
92 __hard_irq_enable();
93#endif
94 }
95}
96
97static int dedicated_cede_loop(struct cpuidle_device *dev,
98 struct cpuidle_driver *drv,
99 int index)
100{
101 unsigned long in_purr;
102
103 idle_loop_prolog(&in_purr);
104 get_lppaca()->donate_dedicated_cpu = 1;
105
106 ppc64_runlatch_off();
107 HMT_medium();
108 check_and_cede_processor();
109
110 get_lppaca()->donate_dedicated_cpu = 0;
111
112 idle_loop_epilog(in_purr);
113
114 return index;
115}
116
117static int shared_cede_loop(struct cpuidle_device *dev,
118 struct cpuidle_driver *drv,
119 int index)
120{
121 unsigned long in_purr;
122
123 idle_loop_prolog(&in_purr);
124
125 /*
126 * Yield the processor to the hypervisor. We return if
127 * an external interrupt occurs (which are driven prior
128 * to returning here) or if a prod occurs from another
129 * processor. When returning here, external interrupts
130 * are enabled.
131 */
132 check_and_cede_processor();
133
134 idle_loop_epilog(in_purr);
135
136 return index;
137}
138
139/*
140 * States for dedicated partition case.
141 */
142static struct cpuidle_state dedicated_states[MAX_IDLE_STATE_COUNT] = {
143 { /* Snooze */
144 .name = "snooze",
145 .desc = "snooze",
146 .flags = CPUIDLE_FLAG_TIME_VALID,
147 .exit_latency = 0,
148 .target_residency = 0,
149 .enter = &snooze_loop },
150 { /* CEDE */
151 .name = "CEDE",
152 .desc = "CEDE",
153 .flags = CPUIDLE_FLAG_TIME_VALID,
154 .exit_latency = 10,
155 .target_residency = 100,
156 .enter = &dedicated_cede_loop },
157};
158
159/*
160 * States for shared partition case.
161 */
162static struct cpuidle_state shared_states[MAX_IDLE_STATE_COUNT] = {
163 { /* Shared Cede */
164 .name = "Shared Cede",
165 .desc = "Shared Cede",
166 .flags = CPUIDLE_FLAG_TIME_VALID,
167 .exit_latency = 0,
168 .target_residency = 0,
169 .enter = &shared_cede_loop },
170};
171
172void update_smt_snooze_delay(int cpu, int residency)
173{
174 struct cpuidle_driver *drv = cpuidle_get_driver();
175 struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);
176
177 if (cpuidle_state_table != dedicated_states)
178 return;
179
180 if (residency < 0) {
181 /* Disable the Nap state on that cpu */
182 if (dev)
183 dev->states_usage[1].disable = 1;
184 } else
185 if (drv)
186 drv->states[1].target_residency = residency;
187}
188
189static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n,
190 unsigned long action, void *hcpu)
191{
192 int hotcpu = (unsigned long)hcpu;
193 struct cpuidle_device *dev =
194 per_cpu_ptr(pseries_cpuidle_devices, hotcpu);
195
196 if (dev && cpuidle_get_driver()) {
197 switch (action) {
198 case CPU_ONLINE:
199 case CPU_ONLINE_FROZEN:
200 cpuidle_pause_and_lock();
201 cpuidle_enable_device(dev);
202 cpuidle_resume_and_unlock();
203 break;
204
205 case CPU_DEAD:
206 case CPU_DEAD_FROZEN:
207 cpuidle_pause_and_lock();
208 cpuidle_disable_device(dev);
209 cpuidle_resume_and_unlock();
210 break;
211
212 default:
213 return NOTIFY_DONE;
214 }
215 }
216 return NOTIFY_OK;
217}
218
219static struct notifier_block setup_hotplug_notifier = {
220 .notifier_call = pseries_cpuidle_add_cpu_notifier,
221};
222
223/*
224 * pseries_cpuidle_driver_init()
225 */
226static int pseries_cpuidle_driver_init(void)
227{
228 int idle_state;
229 struct cpuidle_driver *drv = &pseries_idle_driver;
230
231 drv->state_count = 0;
232
233 for (idle_state = 0; idle_state < MAX_IDLE_STATE_COUNT; ++idle_state) {
234
235 if (idle_state > max_idle_state)
236 break;
237
238 /* is the state not enabled? */
239 if (cpuidle_state_table[idle_state].enter == NULL)
240 continue;
241
242 drv->states[drv->state_count] = /* structure copy */
243 cpuidle_state_table[idle_state];
244
245 drv->state_count += 1;
246 }
247
248 return 0;
249}
250
251/* pseries_idle_devices_uninit(void)
252 * unregister cpuidle devices and de-allocate memory
253 */
254static void pseries_idle_devices_uninit(void)
255{
256 int i;
257 struct cpuidle_device *dev;
258
259 for_each_possible_cpu(i) {
260 dev = per_cpu_ptr(pseries_cpuidle_devices, i);
261 cpuidle_unregister_device(dev);
262 }
263
264 free_percpu(pseries_cpuidle_devices);
265 return;
266}
267
268/* pseries_idle_devices_init()
269 * allocate, initialize and register cpuidle device
270 */
271static int pseries_idle_devices_init(void)
272{
273 int i;
274 struct cpuidle_driver *drv = &pseries_idle_driver;
275 struct cpuidle_device *dev;
276
277 pseries_cpuidle_devices = alloc_percpu(struct cpuidle_device);
278 if (pseries_cpuidle_devices == NULL)
279 return -ENOMEM;
280
281 for_each_possible_cpu(i) {
282 dev = per_cpu_ptr(pseries_cpuidle_devices, i);
283 dev->state_count = drv->state_count;
284 dev->cpu = i;
285 if (cpuidle_register_device(dev)) {
286 printk(KERN_DEBUG \
287 "cpuidle_register_device %d failed!\n", i);
288 return -EIO;
289 }
290 }
291
292 return 0;
293}
294
295/*
296 * pseries_idle_probe()
297 * Choose state table for shared versus dedicated partition
298 */
299static int pseries_idle_probe(void)
300{
301
302 if (!firmware_has_feature(FW_FEATURE_SPLPAR))
303 return -ENODEV;
304
305 if (cpuidle_disable != IDLE_NO_OVERRIDE)
306 return -ENODEV;
307
308 if (max_idle_state == 0) {
309 printk(KERN_DEBUG "pseries processor idle disabled.\n");
310 return -EPERM;
311 }
312
313 if (lppaca_shared_proc(get_lppaca()))
314 cpuidle_state_table = shared_states;
315 else
316 cpuidle_state_table = dedicated_states;
317
318 return 0;
319}
320
321static int __init pseries_processor_idle_init(void)
322{
323 int retval;
324
325 retval = pseries_idle_probe();
326 if (retval)
327 return retval;
328
329 pseries_cpuidle_driver_init();
330 retval = cpuidle_register_driver(&pseries_idle_driver);
331 if (retval) {
332 printk(KERN_DEBUG "Registration of pseries driver failed.\n");
333 return retval;
334 }
335
336 retval = pseries_idle_devices_init();
337 if (retval) {
338 pseries_idle_devices_uninit();
339 cpuidle_unregister_driver(&pseries_idle_driver);
340 return retval;
341 }
342
343 register_cpu_notifier(&setup_hotplug_notifier);
344 printk(KERN_DEBUG "pseries_idle_driver registered\n");
345
346 return 0;
347}
348
349static void __exit pseries_processor_idle_exit(void)
350{
351
352 unregister_cpu_notifier(&setup_hotplug_notifier);
353 pseries_idle_devices_uninit();
354 cpuidle_unregister_driver(&pseries_idle_driver);
355
356 return;
357}
358
359module_init(pseries_processor_idle_init);
360module_exit(pseries_processor_idle_exit);
361
362MODULE_AUTHOR("Deepthi Dharwar <deepthi@linux.vnet.ibm.com>");
363MODULE_DESCRIPTION("Cpuidle driver for POWER");
364MODULE_LICENSE("GPL");
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 6f76ae417f47..8e639d7cbda7 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -72,7 +72,7 @@
72 72
73int CMO_PrPSP = -1; 73int CMO_PrPSP = -1;
74int CMO_SecPSP = -1; 74int CMO_SecPSP = -1;
75unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT); 75unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT_4K);
76EXPORT_SYMBOL(CMO_PageSize); 76EXPORT_SYMBOL(CMO_PageSize);
77 77
78int fwnmi_active; /* TRUE if an FWNMI handler is present */ 78int fwnmi_active; /* TRUE if an FWNMI handler is present */
@@ -569,7 +569,7 @@ void pSeries_cmo_feature_init(void)
569{ 569{
570 char *ptr, *key, *value, *end; 570 char *ptr, *key, *value, *end;
571 int call_status; 571 int call_status;
572 int page_order = IOMMU_PAGE_SHIFT; 572 int page_order = IOMMU_PAGE_SHIFT_4K;
573 573
574 pr_debug(" -> fw_cmo_feature_init()\n"); 574 pr_debug(" -> fw_cmo_feature_init()\n");
575 spin_lock(&rtas_data_buf_lock); 575 spin_lock(&rtas_data_buf_lock);
diff --git a/arch/powerpc/platforms/wsp/wsp_pci.c b/arch/powerpc/platforms/wsp/wsp_pci.c
index 62cb527493e7..9a15e5b39bb8 100644
--- a/arch/powerpc/platforms/wsp/wsp_pci.c
+++ b/arch/powerpc/platforms/wsp/wsp_pci.c
@@ -260,7 +260,7 @@ static int tce_build_wsp(struct iommu_table *tbl, long index, long npages,
260 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; 260 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
261 261
262 dma_debug("[DMA] TCE %p set to 0x%016llx (dma addr: 0x%lx)\n", 262 dma_debug("[DMA] TCE %p set to 0x%016llx (dma addr: 0x%lx)\n",
263 tcep, *tcep, (tbl->it_offset + index) << IOMMU_PAGE_SHIFT); 263 tcep, *tcep, (tbl->it_offset + index) << IOMMU_PAGE_SHIFT_4K);
264 264
265 uaddr += TCE_PAGE_SIZE; 265 uaddr += TCE_PAGE_SIZE;
266 index++; 266 index++;
@@ -381,8 +381,9 @@ static struct wsp_dma_table *wsp_pci_create_dma32_table(struct wsp_phb *phb,
381 381
382 /* Init bits and pieces */ 382 /* Init bits and pieces */
383 tbl->table.it_blocksize = 16; 383 tbl->table.it_blocksize = 16;
384 tbl->table.it_offset = addr >> IOMMU_PAGE_SHIFT; 384 tbl->table.it_page_shift = IOMMU_PAGE_SHIFT_4K;
385 tbl->table.it_size = size >> IOMMU_PAGE_SHIFT; 385 tbl->table.it_offset = addr >> tbl->table.it_page_shift;
386 tbl->table.it_size = size >> tbl->table.it_page_shift;
386 387
387 /* 388 /*
388 * It's already blank but we clear it anyway. 389 * It's already blank but we clear it anyway.
@@ -449,8 +450,8 @@ static void wsp_pci_dma_dev_setup(struct pci_dev *pdev)
449 if (table) { 450 if (table) {
450 pr_info("%s: Setup iommu: 32-bit DMA region 0x%08lx..0x%08lx\n", 451 pr_info("%s: Setup iommu: 32-bit DMA region 0x%08lx..0x%08lx\n",
451 pci_name(pdev), 452 pci_name(pdev),
452 table->table.it_offset << IOMMU_PAGE_SHIFT, 453 table->table.it_offset << IOMMU_PAGE_SHIFT_4K,
453 (table->table.it_offset << IOMMU_PAGE_SHIFT) 454 (table->table.it_offset << IOMMU_PAGE_SHIFT_4K)
454 + phb->dma32_region_size - 1); 455 + phb->dma32_region_size - 1);
455 archdata->dma_data.iommu_table_base = &table->table; 456 archdata->dma_data.iommu_table_base = &table->table;
456 return; 457 return;
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index 13ec968be4c7..7baa70d6dc01 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -19,7 +19,7 @@ config PPC_MSI_BITMAP
19 default y if MPIC 19 default y if MPIC
20 default y if FSL_PCI 20 default y if FSL_PCI
21 default y if PPC4xx_MSI 21 default y if PPC4xx_MSI
22 default y if POWERNV_MSI 22 default y if PPC_POWERNV
23 23
24source "arch/powerpc/sysdev/xics/Kconfig" 24source "arch/powerpc/sysdev/xics/Kconfig"
25 25
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 1c16141c031c..47b6b9f81d43 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -109,27 +109,28 @@ axon_ram_make_request(struct request_queue *queue, struct bio *bio)
109 struct axon_ram_bank *bank = bio->bi_bdev->bd_disk->private_data; 109 struct axon_ram_bank *bank = bio->bi_bdev->bd_disk->private_data;
110 unsigned long phys_mem, phys_end; 110 unsigned long phys_mem, phys_end;
111 void *user_mem; 111 void *user_mem;
112 struct bio_vec *vec; 112 struct bio_vec vec;
113 unsigned int transfered; 113 unsigned int transfered;
114 unsigned short idx; 114 struct bvec_iter iter;
115 115
116 phys_mem = bank->io_addr + (bio->bi_sector << AXON_RAM_SECTOR_SHIFT); 116 phys_mem = bank->io_addr + (bio->bi_iter.bi_sector <<
117 AXON_RAM_SECTOR_SHIFT);
117 phys_end = bank->io_addr + bank->size; 118 phys_end = bank->io_addr + bank->size;
118 transfered = 0; 119 transfered = 0;
119 bio_for_each_segment(vec, bio, idx) { 120 bio_for_each_segment(vec, bio, iter) {
120 if (unlikely(phys_mem + vec->bv_len > phys_end)) { 121 if (unlikely(phys_mem + vec.bv_len > phys_end)) {
121 bio_io_error(bio); 122 bio_io_error(bio);
122 return; 123 return;
123 } 124 }
124 125
125 user_mem = page_address(vec->bv_page) + vec->bv_offset; 126 user_mem = page_address(vec.bv_page) + vec.bv_offset;
126 if (bio_data_dir(bio) == READ) 127 if (bio_data_dir(bio) == READ)
127 memcpy(user_mem, (void *) phys_mem, vec->bv_len); 128 memcpy(user_mem, (void *) phys_mem, vec.bv_len);
128 else 129 else
129 memcpy((void *) phys_mem, user_mem, vec->bv_len); 130 memcpy((void *) phys_mem, user_mem, vec.bv_len);
130 131
131 phys_mem += vec->bv_len; 132 phys_mem += vec.bv_len;
132 transfered += vec->bv_len; 133 transfered += vec.bv_len;
133 } 134 }
134 bio_endio(bio, 0); 135 bio_endio(bio, 0);
135} 136}
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index 10386b676d87..a11bd1d433ad 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -27,7 +27,6 @@
27 */ 27 */
28 28
29#include <linux/stddef.h> 29#include <linux/stddef.h>
30#include <linux/init.h>
31#include <linux/sched.h> 30#include <linux/sched.h>
32#include <linux/signal.h> 31#include <linux/signal.h>
33#include <linux/irq.h> 32#include <linux/irq.h>
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index bd968a43a48b..62c47bb76517 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -292,6 +292,7 @@ static void iommu_table_dart_setup(void)
292 iommu_table_dart.it_offset = 0; 292 iommu_table_dart.it_offset = 0;
293 /* it_size is in number of entries */ 293 /* it_size is in number of entries */
294 iommu_table_dart.it_size = dart_tablesize / sizeof(u32); 294 iommu_table_dart.it_size = dart_tablesize / sizeof(u32);
295 iommu_table_dart.it_page_shift = IOMMU_PAGE_SHIFT_4K;
295 296
296 /* Initialize the common IOMMU code */ 297 /* Initialize the common IOMMU code */
297 iommu_table_dart.it_base = (unsigned long)dart_vbase; 298 iommu_table_dart.it_base = (unsigned long)dart_vbase;
diff --git a/arch/powerpc/sysdev/fsl_ifc.c b/arch/powerpc/sysdev/fsl_ifc.c
index d7fc72239144..fbc885b31946 100644
--- a/arch/powerpc/sysdev/fsl_ifc.c
+++ b/arch/powerpc/sysdev/fsl_ifc.c
@@ -19,7 +19,6 @@
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22#include <linux/init.h>
23#include <linux/module.h> 22#include <linux/module.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/compiler.h> 24#include <linux/compiler.h>
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index 6bc5a546d49f..d631022ffb4b 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -214,10 +214,14 @@ static irqreturn_t fsl_lbc_ctrl_irq(int irqno, void *data)
214 struct fsl_lbc_ctrl *ctrl = data; 214 struct fsl_lbc_ctrl *ctrl = data;
215 struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 215 struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
216 u32 status; 216 u32 status;
217 unsigned long flags;
217 218
219 spin_lock_irqsave(&fsl_lbc_lock, flags);
218 status = in_be32(&lbc->ltesr); 220 status = in_be32(&lbc->ltesr);
219 if (!status) 221 if (!status) {
222 spin_unlock_irqrestore(&fsl_lbc_lock, flags);
220 return IRQ_NONE; 223 return IRQ_NONE;
224 }
221 225
222 out_be32(&lbc->ltesr, LTESR_CLEAR); 226 out_be32(&lbc->ltesr, LTESR_CLEAR);
223 out_be32(&lbc->lteatr, 0); 227 out_be32(&lbc->lteatr, 0);
@@ -260,6 +264,7 @@ static irqreturn_t fsl_lbc_ctrl_irq(int irqno, void *data)
260 if (status & ~LTESR_MASK) 264 if (status & ~LTESR_MASK)
261 dev_err(ctrl->dev, "Unknown error: " 265 dev_err(ctrl->dev, "Unknown error: "
262 "LTESR 0x%08X\n", status); 266 "LTESR 0x%08X\n", status);
267 spin_unlock_irqrestore(&fsl_lbc_lock, flags);
263 return IRQ_HANDLED; 268 return IRQ_HANDLED;
264} 269}
265 270
@@ -298,8 +303,8 @@ static int fsl_lbc_ctrl_probe(struct platform_device *dev)
298 goto err; 303 goto err;
299 } 304 }
300 305
301 fsl_lbc_ctrl_dev->irq = irq_of_parse_and_map(dev->dev.of_node, 0); 306 fsl_lbc_ctrl_dev->irq[0] = irq_of_parse_and_map(dev->dev.of_node, 0);
302 if (fsl_lbc_ctrl_dev->irq == NO_IRQ) { 307 if (!fsl_lbc_ctrl_dev->irq[0]) {
303 dev_err(&dev->dev, "failed to get irq resource\n"); 308 dev_err(&dev->dev, "failed to get irq resource\n");
304 ret = -ENODEV; 309 ret = -ENODEV;
305 goto err; 310 goto err;
@@ -311,20 +316,34 @@ static int fsl_lbc_ctrl_probe(struct platform_device *dev)
311 if (ret < 0) 316 if (ret < 0)
312 goto err; 317 goto err;
313 318
314 ret = request_irq(fsl_lbc_ctrl_dev->irq, fsl_lbc_ctrl_irq, 0, 319 ret = request_irq(fsl_lbc_ctrl_dev->irq[0], fsl_lbc_ctrl_irq, 0,
315 "fsl-lbc", fsl_lbc_ctrl_dev); 320 "fsl-lbc", fsl_lbc_ctrl_dev);
316 if (ret != 0) { 321 if (ret != 0) {
317 dev_err(&dev->dev, "failed to install irq (%d)\n", 322 dev_err(&dev->dev, "failed to install irq (%d)\n",
318 fsl_lbc_ctrl_dev->irq); 323 fsl_lbc_ctrl_dev->irq[0]);
319 ret = fsl_lbc_ctrl_dev->irq; 324 ret = fsl_lbc_ctrl_dev->irq[0];
320 goto err; 325 goto err;
321 } 326 }
322 327
328 fsl_lbc_ctrl_dev->irq[1] = irq_of_parse_and_map(dev->dev.of_node, 1);
329 if (fsl_lbc_ctrl_dev->irq[1]) {
330 ret = request_irq(fsl_lbc_ctrl_dev->irq[1], fsl_lbc_ctrl_irq,
331 IRQF_SHARED, "fsl-lbc-err", fsl_lbc_ctrl_dev);
332 if (ret) {
333 dev_err(&dev->dev, "failed to install irq (%d)\n",
334 fsl_lbc_ctrl_dev->irq[1]);
335 ret = fsl_lbc_ctrl_dev->irq[1];
336 goto err1;
337 }
338 }
339
323 /* Enable interrupts for any detected events */ 340 /* Enable interrupts for any detected events */
324 out_be32(&fsl_lbc_ctrl_dev->regs->lteir, LTEIR_ENABLE); 341 out_be32(&fsl_lbc_ctrl_dev->regs->lteir, LTEIR_ENABLE);
325 342
326 return 0; 343 return 0;
327 344
345err1:
346 free_irq(fsl_lbc_ctrl_dev->irq[0], fsl_lbc_ctrl_dev);
328err: 347err:
329 iounmap(fsl_lbc_ctrl_dev->regs); 348 iounmap(fsl_lbc_ctrl_dev->regs);
330 kfree(fsl_lbc_ctrl_dev); 349 kfree(fsl_lbc_ctrl_dev);
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 4dfd61df8aba..a625dcf26b2b 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -122,7 +122,7 @@ static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask)
122 * address width of the SoC such that we can address any internal 122 * address width of the SoC such that we can address any internal
123 * SoC address from across PCI if needed 123 * SoC address from across PCI if needed
124 */ 124 */
125 if ((dev->bus == &pci_bus_type) && 125 if ((dev_is_pci(dev)) &&
126 dma_mask >= DMA_BIT_MASK(MAX_PHYS_ADDR_BITS)) { 126 dma_mask >= DMA_BIT_MASK(MAX_PHYS_ADDR_BITS)) {
127 set_dma_ops(dev, &dma_direct_ops); 127 set_dma_ops(dev, &dma_direct_ops);
128 set_dma_offset(dev, pci64_dma_offset); 128 set_dma_offset(dev, pci64_dma_offset);
@@ -454,7 +454,7 @@ void fsl_pcibios_fixup_bus(struct pci_bus *bus)
454 } 454 }
455} 455}
456 456
457int __init fsl_add_bridge(struct platform_device *pdev, int is_primary) 457int fsl_add_bridge(struct platform_device *pdev, int is_primary)
458{ 458{
459 int len; 459 int len;
460 struct pci_controller *hose; 460 struct pci_controller *hose;
@@ -1035,6 +1035,7 @@ static const struct of_device_id pci_ids[] = {
1035 { .compatible = "fsl,mpc8548-pcie", }, 1035 { .compatible = "fsl,mpc8548-pcie", },
1036 { .compatible = "fsl,mpc8610-pci", }, 1036 { .compatible = "fsl,mpc8610-pci", },
1037 { .compatible = "fsl,mpc8641-pcie", }, 1037 { .compatible = "fsl,mpc8641-pcie", },
1038 { .compatible = "fsl,qoriq-pcie", },
1038 { .compatible = "fsl,qoriq-pcie-v2.1", }, 1039 { .compatible = "fsl,qoriq-pcie-v2.1", },
1039 { .compatible = "fsl,qoriq-pcie-v2.2", }, 1040 { .compatible = "fsl,qoriq-pcie-v2.2", },
1040 { .compatible = "fsl,qoriq-pcie-v2.3", }, 1041 { .compatible = "fsl,qoriq-pcie-v2.3", },
diff --git a/arch/powerpc/sysdev/ge/ge_pic.h b/arch/powerpc/sysdev/ge/ge_pic.h
index 6149916da3f4..908dbd9826b6 100644
--- a/arch/powerpc/sysdev/ge/ge_pic.h
+++ b/arch/powerpc/sysdev/ge/ge_pic.h
@@ -1,7 +1,6 @@
1#ifndef __GEF_PIC_H__ 1#ifndef __GEF_PIC_H__
2#define __GEF_PIC_H__ 2#define __GEF_PIC_H__
3 3
4#include <linux/init.h>
5 4
6void gef_pic_cascade(unsigned int, struct irq_desc *); 5void gef_pic_cascade(unsigned int, struct irq_desc *);
7unsigned int gef_pic_get_irq(void); 6unsigned int gef_pic_get_irq(void);
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index 997df6a7ab5d..45598da0b321 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -8,7 +8,6 @@
8 */ 8 */
9#undef DEBUG 9#undef DEBUG
10 10
11#include <linux/init.h>
12#include <linux/ioport.h> 11#include <linux/ioport.h>
13#include <linux/interrupt.h> 12#include <linux/interrupt.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
index c6c8b526a4f6..1f6c570d66d4 100644
--- a/arch/powerpc/sysdev/indirect_pci.c
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -152,10 +152,8 @@ static struct pci_ops indirect_pci_ops =
152 .write = indirect_write_config, 152 .write = indirect_write_config,
153}; 153};
154 154
155void __init 155void setup_indirect_pci(struct pci_controller *hose, resource_size_t cfg_addr,
156setup_indirect_pci(struct pci_controller* hose, 156 resource_size_t cfg_data, u32 flags)
157 resource_size_t cfg_addr,
158 resource_size_t cfg_data, u32 flags)
159{ 157{
160 resource_size_t base = cfg_addr & PAGE_MASK; 158 resource_size_t base = cfg_addr & PAGE_MASK;
161 void __iomem *mbase; 159 void __iomem *mbase;
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c
index b724622c3a0b..c4828c0be5bd 100644
--- a/arch/powerpc/sysdev/mpc8xx_pic.c
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -1,6 +1,5 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/stddef.h> 2#include <linux/stddef.h>
3#include <linux/init.h>
4#include <linux/sched.h> 3#include <linux/sched.h>
5#include <linux/signal.h> 4#include <linux/signal.h>
6#include <linux/irq.h> 5#include <linux/irq.h>
diff --git a/arch/powerpc/sysdev/mpic_timer.c b/arch/powerpc/sysdev/mpic_timer.c
index 22d7d57eead9..9d9b06217f8b 100644
--- a/arch/powerpc/sysdev/mpic_timer.c
+++ b/arch/powerpc/sysdev/mpic_timer.c
@@ -41,6 +41,7 @@
41#define MPIC_TIMER_TCR_ROVR_OFFSET 24 41#define MPIC_TIMER_TCR_ROVR_OFFSET 24
42 42
43#define TIMER_STOP 0x80000000 43#define TIMER_STOP 0x80000000
44#define GTCCR_TOG 0x80000000
44#define TIMERS_PER_GROUP 4 45#define TIMERS_PER_GROUP 4
45#define MAX_TICKS (~0U >> 1) 46#define MAX_TICKS (~0U >> 1)
46#define MAX_TICKS_CASCADE (~0U) 47#define MAX_TICKS_CASCADE (~0U)
@@ -96,8 +97,11 @@ static void convert_ticks_to_time(struct timer_group_priv *priv,
96 time->tv_sec = (__kernel_time_t)div_u64(ticks, priv->timerfreq); 97 time->tv_sec = (__kernel_time_t)div_u64(ticks, priv->timerfreq);
97 tmp_sec = (u64)time->tv_sec * (u64)priv->timerfreq; 98 tmp_sec = (u64)time->tv_sec * (u64)priv->timerfreq;
98 99
99 time->tv_usec = (__kernel_suseconds_t) 100 time->tv_usec = 0;
100 div_u64((ticks - tmp_sec) * 1000000, priv->timerfreq); 101
102 if (tmp_sec <= ticks)
103 time->tv_usec = (__kernel_suseconds_t)
104 div_u64((ticks - tmp_sec) * 1000000, priv->timerfreq);
101 105
102 return; 106 return;
103} 107}
@@ -327,11 +331,13 @@ void mpic_get_remain_time(struct mpic_timer *handle, struct timeval *time)
327 casc_priv = priv->timer[handle->num].cascade_handle; 331 casc_priv = priv->timer[handle->num].cascade_handle;
328 if (casc_priv) { 332 if (casc_priv) {
329 tmp_ticks = in_be32(&priv->regs[handle->num].gtccr); 333 tmp_ticks = in_be32(&priv->regs[handle->num].gtccr);
334 tmp_ticks &= ~GTCCR_TOG;
330 ticks = ((u64)tmp_ticks & UINT_MAX) * (u64)MAX_TICKS_CASCADE; 335 ticks = ((u64)tmp_ticks & UINT_MAX) * (u64)MAX_TICKS_CASCADE;
331 tmp_ticks = in_be32(&priv->regs[handle->num - 1].gtccr); 336 tmp_ticks = in_be32(&priv->regs[handle->num - 1].gtccr);
332 ticks += tmp_ticks; 337 ticks += tmp_ticks;
333 } else { 338 } else {
334 ticks = in_be32(&priv->regs[handle->num].gtccr); 339 ticks = in_be32(&priv->regs[handle->num].gtccr);
340 ticks &= ~GTCCR_TOG;
335 } 341 }
336 342
337 convert_ticks_to_time(priv, ticks, time); 343 convert_ticks_to_time(priv, ticks, time);
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index a3a8fad8537d..c2dba7db71ad 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -448,7 +448,7 @@ static int __init mv64x60_device_setup(void)
448 int err; 448 int err;
449 449
450 id = 0; 450 id = 0;
451 for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc") { 451 for_each_compatible_node(np, NULL, "marvell,mv64360-mpsc") {
452 err = mv64x60_mpsc_device_setup(np, id++); 452 err = mv64x60_mpsc_device_setup(np, id++);
453 if (err) 453 if (err)
454 printk(KERN_ERR "Failed to initialize MV64x60 " 454 printk(KERN_ERR "Failed to initialize MV64x60 "
diff --git a/arch/powerpc/sysdev/mv64x60_udbg.c b/arch/powerpc/sysdev/mv64x60_udbg.c
index 50a81387e9b1..3b8734b870e9 100644
--- a/arch/powerpc/sysdev/mv64x60_udbg.c
+++ b/arch/powerpc/sysdev/mv64x60_udbg.c
@@ -85,7 +85,7 @@ static void mv64x60_udbg_init(void)
85 if (!stdout) 85 if (!stdout)
86 return; 86 return;
87 87
88 for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc") { 88 for_each_compatible_node(np, NULL, "marvell,mv64360-mpsc") {
89 if (np == stdout) 89 if (np == stdout)
90 break; 90 break;
91 } 91 }
diff --git a/arch/powerpc/sysdev/qe_lib/qe_io.c b/arch/powerpc/sysdev/qe_lib/qe_io.c
index a88807b3dd57..d09994164daf 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_io.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_io.c
@@ -16,7 +16,6 @@
16 16
17#include <linux/stddef.h> 17#include <linux/stddef.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/errno.h> 19#include <linux/errno.h>
21#include <linux/module.h> 20#include <linux/module.h>
22#include <linux/ioport.h> 21#include <linux/ioport.h>
diff --git a/arch/powerpc/sysdev/qe_lib/ucc.c b/arch/powerpc/sysdev/qe_lib/ucc.c
index 134b07d29435..621575b7e84a 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc.c
@@ -14,7 +14,6 @@
14 * option) any later version. 14 * option) any later version.
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/stddef.h> 18#include <linux/stddef.h>
20#include <linux/spinlock.h> 19#include <linux/spinlock.h>
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index cceb2e366738..65aaf15032ae 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -13,7 +13,6 @@
13 * option) any later version. 13 * option) any later version.
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/errno.h> 16#include <linux/errno.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/stddef.h> 18#include <linux/stddef.h>
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
index 1c062f48f1ac..befaf1123f7f 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
@@ -13,7 +13,6 @@
13 * option) any later version. 13 * option) any later version.
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/errno.h> 16#include <linux/errno.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/stddef.h> 18#include <linux/stddef.h>
diff --git a/arch/powerpc/sysdev/udbg_memcons.c b/arch/powerpc/sysdev/udbg_memcons.c
index ce5a7b489e4b..9998c0de12d0 100644
--- a/arch/powerpc/sysdev/udbg_memcons.c
+++ b/arch/powerpc/sysdev/udbg_memcons.c
@@ -18,7 +18,6 @@
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20 20
21#include <linux/init.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <asm/barrier.h> 22#include <asm/barrier.h>
24#include <asm/page.h> 23#include <asm/page.h>
diff --git a/arch/powerpc/sysdev/xics/icp-hv.c b/arch/powerpc/sysdev/xics/icp-hv.c
index df0fc5821469..c1917cf67c3d 100644
--- a/arch/powerpc/sysdev/xics/icp-hv.c
+++ b/arch/powerpc/sysdev/xics/icp-hv.c
@@ -12,7 +12,6 @@
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/init.h>
16#include <linux/cpu.h> 15#include <linux/cpu.h>
17#include <linux/of.h> 16#include <linux/of.h>
18 17
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index af9d3469fb99..a90731b3d44a 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2051,6 +2051,10 @@ static void dump_one_paca(int cpu)
2051 DUMP(p, stab_addr, "lx"); 2051 DUMP(p, stab_addr, "lx");
2052#endif 2052#endif
2053 DUMP(p, emergency_sp, "p"); 2053 DUMP(p, emergency_sp, "p");
2054#ifdef CONFIG_PPC_BOOK3S_64
2055 DUMP(p, mc_emergency_sp, "p");
2056 DUMP(p, in_mce, "x");
2057#endif
2054 DUMP(p, data_offset, "lx"); 2058 DUMP(p, data_offset, "lx");
2055 DUMP(p, hw_cpu_id, "x"); 2059 DUMP(p, hw_cpu_id, "x");
2056 DUMP(p, cpu_start, "x"); 2060 DUMP(p, cpu_start, "x");
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index e9f312532526..65a07750f4f9 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -334,10 +334,10 @@ config SMP
334 a system with only one CPU, like most personal computers, say N. If 334 a system with only one CPU, like most personal computers, say N. If
335 you have a system with more than one CPU, say Y. 335 you have a system with more than one CPU, say Y.
336 336
337 If you say N here, the kernel will run on single and multiprocessor 337 If you say N here, the kernel will run on uni- and multiprocessor
338 machines, but will use only one CPU of a multiprocessor machine. If 338 machines, but will use only one CPU of a multiprocessor machine. If
339 you say Y here, the kernel will run on many, but not all, 339 you say Y here, the kernel will run on many, but not all,
340 singleprocessor machines. On a singleprocessor machine, the kernel 340 uniprocessor machines. On a uniprocessor machine, the kernel
341 will run faster if you say N here. 341 will run faster if you say N here.
342 342
343 See also the SMP-HOWTO available at 343 See also the SMP-HOWTO available at
@@ -596,7 +596,7 @@ config CRASH_DUMP
596config ZFCPDUMP 596config ZFCPDUMP
597 def_bool n 597 def_bool n
598 prompt "zfcpdump support" 598 prompt "zfcpdump support"
599 depends on SMP 599 depends on 64BIT && SMP
600 help 600 help
601 Select this option if you want to build an zfcpdump enabled kernel. 601 Select this option if you want to build an zfcpdump enabled kernel.
602 Refer to <file:Documentation/s390/zfcpdump.txt> for more details on this. 602 Refer to <file:Documentation/s390/zfcpdump.txt> for more details on this.
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index bcca01c9989d..200f2a1b599d 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -237,9 +237,9 @@ static int des3_setkey(struct crypto_tfm *tfm, const u8 *key,
237 struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm); 237 struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);
238 u32 *flags = &tfm->crt_flags; 238 u32 *flags = &tfm->crt_flags;
239 239
240 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && 240 if (!(crypto_memneq(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
241 memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], 241 crypto_memneq(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
242 DES_KEY_SIZE)) && 242 DES_KEY_SIZE)) &&
243 (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { 243 (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
244 *flags |= CRYPTO_TFM_RES_WEAK_KEY; 244 *flags |= CRYPTO_TFM_RES_WEAK_KEY;
245 return -EINVAL; 245 return -EINVAL;
diff --git a/arch/s390/hypfs/Makefile b/arch/s390/hypfs/Makefile
index 2e671d5004ca..06f8d95a16cd 100644
--- a/arch/s390/hypfs/Makefile
+++ b/arch/s390/hypfs/Makefile
@@ -4,4 +4,4 @@
4 4
5obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o 5obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o
6 6
7s390_hypfs-objs := inode.o hypfs_diag.o hypfs_vm.o hypfs_dbfs.o 7s390_hypfs-objs := inode.o hypfs_diag.o hypfs_vm.o hypfs_dbfs.o hypfs_sprp.o
diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h
index 79f2ac55253f..b34b5ab90a31 100644
--- a/arch/s390/hypfs/hypfs.h
+++ b/arch/s390/hypfs/hypfs.h
@@ -13,6 +13,7 @@
13#include <linux/debugfs.h> 13#include <linux/debugfs.h>
14#include <linux/workqueue.h> 14#include <linux/workqueue.h>
15#include <linux/kref.h> 15#include <linux/kref.h>
16#include <asm/hypfs.h>
16 17
17#define REG_FILE_MODE 0440 18#define REG_FILE_MODE 0440
18#define UPDATE_FILE_MODE 0220 19#define UPDATE_FILE_MODE 0220
@@ -36,6 +37,10 @@ extern int hypfs_vm_init(void);
36extern void hypfs_vm_exit(void); 37extern void hypfs_vm_exit(void);
37extern int hypfs_vm_create_files(struct dentry *root); 38extern int hypfs_vm_create_files(struct dentry *root);
38 39
40/* Set Partition-Resource Parameter */
41int hypfs_sprp_init(void);
42void hypfs_sprp_exit(void);
43
39/* debugfs interface */ 44/* debugfs interface */
40struct hypfs_dbfs_file; 45struct hypfs_dbfs_file;
41 46
@@ -52,6 +57,8 @@ struct hypfs_dbfs_file {
52 int (*data_create)(void **data, void **data_free_ptr, 57 int (*data_create)(void **data, void **data_free_ptr,
53 size_t *size); 58 size_t *size);
54 void (*data_free)(const void *buf_free_ptr); 59 void (*data_free)(const void *buf_free_ptr);
60 long (*unlocked_ioctl) (struct file *, unsigned int,
61 unsigned long);
55 62
56 /* Private data for hypfs_dbfs.c */ 63 /* Private data for hypfs_dbfs.c */
57 struct hypfs_dbfs_data *data; 64 struct hypfs_dbfs_data *data;
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c
index 17ab8b7b53cc..2badf2bf9cd7 100644
--- a/arch/s390/hypfs/hypfs_dbfs.c
+++ b/arch/s390/hypfs/hypfs_dbfs.c
@@ -81,9 +81,25 @@ static ssize_t dbfs_read(struct file *file, char __user *buf,
81 return rc; 81 return rc;
82} 82}
83 83
84static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
85{
86 struct hypfs_dbfs_file *df;
87 long rc;
88
89 df = file->f_path.dentry->d_inode->i_private;
90 mutex_lock(&df->lock);
91 if (df->unlocked_ioctl)
92 rc = df->unlocked_ioctl(file, cmd, arg);
93 else
94 rc = -ENOTTY;
95 mutex_unlock(&df->lock);
96 return rc;
97}
98
84static const struct file_operations dbfs_ops = { 99static const struct file_operations dbfs_ops = {
85 .read = dbfs_read, 100 .read = dbfs_read,
86 .llseek = no_llseek, 101 .llseek = no_llseek,
102 .unlocked_ioctl = dbfs_ioctl,
87}; 103};
88 104
89int hypfs_dbfs_create_file(struct hypfs_dbfs_file *df) 105int hypfs_dbfs_create_file(struct hypfs_dbfs_file *df)
diff --git a/arch/s390/hypfs/hypfs_sprp.c b/arch/s390/hypfs/hypfs_sprp.c
new file mode 100644
index 000000000000..f043c3c7e73c
--- /dev/null
+++ b/arch/s390/hypfs/hypfs_sprp.c
@@ -0,0 +1,141 @@
1/*
2 * Hypervisor filesystem for Linux on s390.
3 * Set Partition-Resource Parameter interface.
4 *
5 * Copyright IBM Corp. 2013
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8
9#include <linux/compat.h>
10#include <linux/errno.h>
11#include <linux/gfp.h>
12#include <linux/string.h>
13#include <linux/types.h>
14#include <linux/uaccess.h>
15#include <asm/compat.h>
16#include <asm/sclp.h>
17#include "hypfs.h"
18
19#define DIAG304_SET_WEIGHTS 0
20#define DIAG304_QUERY_PRP 1
21#define DIAG304_SET_CAPPING 2
22
23#define DIAG304_CMD_MAX 2
24
25static unsigned long hypfs_sprp_diag304(void *data, unsigned long cmd)
26{
27 register unsigned long _data asm("2") = (unsigned long) data;
28 register unsigned long _rc asm("3");
29 register unsigned long _cmd asm("4") = cmd;
30
31 asm volatile("diag %1,%2,0x304\n"
32 : "=d" (_rc) : "d" (_data), "d" (_cmd) : "memory");
33
34 return _rc;
35}
36
37static void hypfs_sprp_free(const void *data)
38{
39 free_page((unsigned long) data);
40}
41
42static int hypfs_sprp_create(void **data_ptr, void **free_ptr, size_t *size)
43{
44 unsigned long rc;
45 void *data;
46
47 data = (void *) get_zeroed_page(GFP_KERNEL);
48 if (!data)
49 return -ENOMEM;
50 rc = hypfs_sprp_diag304(data, DIAG304_QUERY_PRP);
51 if (rc != 1) {
52 *data_ptr = *free_ptr = NULL;
53 *size = 0;
54 free_page((unsigned long) data);
55 return -EIO;
56 }
57 *data_ptr = *free_ptr = data;
58 *size = PAGE_SIZE;
59 return 0;
60}
61
62static int __hypfs_sprp_ioctl(void __user *user_area)
63{
64 struct hypfs_diag304 diag304;
65 unsigned long cmd;
66 void __user *udata;
67 void *data;
68 int rc;
69
70 if (copy_from_user(&diag304, user_area, sizeof(diag304)))
71 return -EFAULT;
72 if ((diag304.args[0] >> 8) != 0 || diag304.args[1] > DIAG304_CMD_MAX)
73 return -EINVAL;
74
75 data = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
76 if (!data)
77 return -ENOMEM;
78
79 udata = (void __user *)(unsigned long) diag304.data;
80 if (diag304.args[1] == DIAG304_SET_WEIGHTS ||
81 diag304.args[1] == DIAG304_SET_CAPPING)
82 if (copy_from_user(data, udata, PAGE_SIZE)) {
83 rc = -EFAULT;
84 goto out;
85 }
86
87 cmd = *(unsigned long *) &diag304.args[0];
88 diag304.rc = hypfs_sprp_diag304(data, cmd);
89
90 if (diag304.args[1] == DIAG304_QUERY_PRP)
91 if (copy_to_user(udata, data, PAGE_SIZE)) {
92 rc = -EFAULT;
93 goto out;
94 }
95
96 rc = copy_to_user(user_area, &diag304, sizeof(diag304)) ? -EFAULT : 0;
97out:
98 free_page((unsigned long) data);
99 return rc;
100}
101
102static long hypfs_sprp_ioctl(struct file *file, unsigned int cmd,
103 unsigned long arg)
104{
105 void __user *argp;
106
107 if (!capable(CAP_SYS_ADMIN))
108 return -EACCES;
109 if (is_compat_task())
110 argp = compat_ptr(arg);
111 else
112 argp = (void __user *) arg;
113 switch (cmd) {
114 case HYPFS_DIAG304:
115 return __hypfs_sprp_ioctl(argp);
116 default: /* unknown ioctl number */
117 return -ENOTTY;
118 }
119 return 0;
120}
121
122static struct hypfs_dbfs_file hypfs_sprp_file = {
123 .name = "diag_304",
124 .data_create = hypfs_sprp_create,
125 .data_free = hypfs_sprp_free,
126 .unlocked_ioctl = hypfs_sprp_ioctl,
127};
128
129int hypfs_sprp_init(void)
130{
131 if (!sclp_has_sprp())
132 return 0;
133 return hypfs_dbfs_create_file(&hypfs_sprp_file);
134}
135
136void hypfs_sprp_exit(void)
137{
138 if (!sclp_has_sprp())
139 return;
140 hypfs_dbfs_remove_file(&hypfs_sprp_file);
141}
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index ddfe09b45134..c952b981e4f2 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -478,10 +478,14 @@ static int __init hypfs_init(void)
478 rc = -ENODATA; 478 rc = -ENODATA;
479 goto fail_hypfs_diag_exit; 479 goto fail_hypfs_diag_exit;
480 } 480 }
481 if (hypfs_sprp_init()) {
482 rc = -ENODATA;
483 goto fail_hypfs_vm_exit;
484 }
481 s390_kobj = kobject_create_and_add("s390", hypervisor_kobj); 485 s390_kobj = kobject_create_and_add("s390", hypervisor_kobj);
482 if (!s390_kobj) { 486 if (!s390_kobj) {
483 rc = -ENOMEM; 487 rc = -ENOMEM;
484 goto fail_hypfs_vm_exit; 488 goto fail_hypfs_sprp_exit;
485 } 489 }
486 rc = register_filesystem(&hypfs_type); 490 rc = register_filesystem(&hypfs_type);
487 if (rc) 491 if (rc)
@@ -490,6 +494,8 @@ static int __init hypfs_init(void)
490 494
491fail_filesystem: 495fail_filesystem:
492 kobject_put(s390_kobj); 496 kobject_put(s390_kobj);
497fail_hypfs_sprp_exit:
498 hypfs_sprp_exit();
493fail_hypfs_vm_exit: 499fail_hypfs_vm_exit:
494 hypfs_vm_exit(); 500 hypfs_vm_exit();
495fail_hypfs_diag_exit: 501fail_hypfs_diag_exit:
@@ -502,11 +508,12 @@ fail_dbfs_exit:
502 508
503static void __exit hypfs_exit(void) 509static void __exit hypfs_exit(void)
504{ 510{
505 hypfs_diag_exit();
506 hypfs_vm_exit();
507 hypfs_dbfs_exit();
508 unregister_filesystem(&hypfs_type); 511 unregister_filesystem(&hypfs_type);
509 kobject_put(s390_kobj); 512 kobject_put(s390_kobj);
513 hypfs_sprp_exit();
514 hypfs_vm_exit();
515 hypfs_diag_exit();
516 hypfs_dbfs_exit();
510} 517}
511 518
512module_init(hypfs_init) 519module_init(hypfs_init)
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index 7a5288f3479a..8386a4a1f19a 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -3,3 +3,4 @@
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += trace_clock.h 4generic-y += trace_clock.h
5generic-y += preempt.h 5generic-y += preempt.h
6generic-y += hash.h
diff --git a/arch/s390/include/asm/cmpxchg.h b/arch/s390/include/asm/cmpxchg.h
index 0f636cbdf342..4236408070e5 100644
--- a/arch/s390/include/asm/cmpxchg.h
+++ b/arch/s390/include/asm/cmpxchg.h
@@ -185,11 +185,12 @@ static inline unsigned long long __cmpxchg64(void *ptr,
185{ 185{
186 register_pair rp_old = {.pair = old}; 186 register_pair rp_old = {.pair = old};
187 register_pair rp_new = {.pair = new}; 187 register_pair rp_new = {.pair = new};
188 unsigned long long *ullptr = ptr;
188 189
189 asm volatile( 190 asm volatile(
190 " cds %0,%2,%1" 191 " cds %0,%2,%1"
191 : "+&d" (rp_old), "=Q" (ptr) 192 : "+d" (rp_old), "+Q" (*ullptr)
192 : "d" (rp_new), "Q" (ptr) 193 : "d" (rp_new)
193 : "memory", "cc"); 194 : "memory", "cc");
194 return rp_old.pair; 195 return rp_old.pair;
195} 196}
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index d5bc3750616e..eef3dd3fd9a9 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -106,9 +106,22 @@ struct kvm_s390_sie_block {
106 __u64 gbea; /* 0x0180 */ 106 __u64 gbea; /* 0x0180 */
107 __u8 reserved188[24]; /* 0x0188 */ 107 __u8 reserved188[24]; /* 0x0188 */
108 __u32 fac; /* 0x01a0 */ 108 __u32 fac; /* 0x01a0 */
109 __u8 reserved1a4[92]; /* 0x01a4 */ 109 __u8 reserved1a4[68]; /* 0x01a4 */
110 __u64 itdba; /* 0x01e8 */
111 __u8 reserved1f0[16]; /* 0x01f0 */
110} __attribute__((packed)); 112} __attribute__((packed));
111 113
114struct kvm_s390_itdb {
115 __u8 data[256];
116} __packed;
117
118struct sie_page {
119 struct kvm_s390_sie_block sie_block;
120 __u8 reserved200[1024]; /* 0x0200 */
121 struct kvm_s390_itdb itdb; /* 0x0600 */
122 __u8 reserved700[2304]; /* 0x0700 */
123} __packed;
124
112struct kvm_vcpu_stat { 125struct kvm_vcpu_stat {
113 u32 exit_userspace; 126 u32 exit_userspace;
114 u32 exit_null; 127 u32 exit_null;
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
index 220e171413f8..abaca2275c7a 100644
--- a/arch/s390/include/asm/sclp.h
+++ b/arch/s390/include/asm/sclp.h
@@ -54,6 +54,7 @@ int sclp_chp_read_info(struct sclp_chp_info *info);
54void sclp_get_ipl_info(struct sclp_ipl_info *info); 54void sclp_get_ipl_info(struct sclp_ipl_info *info);
55bool __init sclp_has_linemode(void); 55bool __init sclp_has_linemode(void);
56bool __init sclp_has_vt220(void); 56bool __init sclp_has_vt220(void);
57bool sclp_has_sprp(void);
57int sclp_pci_configure(u32 fid); 58int sclp_pci_configure(u32 fid);
58int sclp_pci_deconfigure(u32 fid); 59int sclp_pci_deconfigure(u32 fid);
59int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode); 60int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode);
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h
index 5a87d16d3e7c..d091aa1aaf11 100644
--- a/arch/s390/include/asm/sigp.h
+++ b/arch/s390/include/asm/sigp.h
@@ -5,6 +5,7 @@
5#define SIGP_SENSE 1 5#define SIGP_SENSE 1
6#define SIGP_EXTERNAL_CALL 2 6#define SIGP_EXTERNAL_CALL 2
7#define SIGP_EMERGENCY_SIGNAL 3 7#define SIGP_EMERGENCY_SIGNAL 3
8#define SIGP_START 4
8#define SIGP_STOP 5 9#define SIGP_STOP 5
9#define SIGP_RESTART 6 10#define SIGP_RESTART 6
10#define SIGP_STOP_AND_STORE_STATUS 9 11#define SIGP_STOP_AND_STORE_STATUS 9
@@ -12,6 +13,7 @@
12#define SIGP_SET_PREFIX 13 13#define SIGP_SET_PREFIX 13
13#define SIGP_STORE_STATUS_AT_ADDRESS 14 14#define SIGP_STORE_STATUS_AT_ADDRESS 14
14#define SIGP_SET_ARCHITECTURE 18 15#define SIGP_SET_ARCHITECTURE 18
16#define SIGP_COND_EMERGENCY_SIGNAL 19
15#define SIGP_SENSE_RUNNING 21 17#define SIGP_SENSE_RUNNING 21
16 18
17/* SIGP condition codes */ 19/* SIGP condition codes */
diff --git a/arch/s390/include/uapi/asm/hypfs.h b/arch/s390/include/uapi/asm/hypfs.h
new file mode 100644
index 000000000000..37998b449531
--- /dev/null
+++ b/arch/s390/include/uapi/asm/hypfs.h
@@ -0,0 +1,25 @@
1/*
2 * IOCTL interface for hypfs
3 *
4 * Copyright IBM Corp. 2013
5 *
6 * Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8
9#ifndef _ASM_HYPFS_CTL_H
10#define _ASM_HYPFS_CTL_H
11
12#include <linux/types.h>
13
14struct hypfs_diag304 {
15 __u32 args[2];
16 __u64 data;
17 __u64 rc;
18} __attribute__((packed));
19
20#define HYPFS_IOCTL_MAGIC 0x10
21
22#define HYPFS_DIAG304 \
23 _IOWR(HYPFS_IOCTL_MAGIC, 0x20, struct hypfs_diag304)
24
25#endif
diff --git a/arch/s390/include/uapi/asm/socket.h b/arch/s390/include/uapi/asm/socket.h
index c286c2e868f0..e031332096d7 100644
--- a/arch/s390/include/uapi/asm/socket.h
+++ b/arch/s390/include/uapi/asm/socket.h
@@ -84,4 +84,6 @@
84 84
85#define SO_MAX_PACING_RATE 47 85#define SO_MAX_PACING_RATE 47
86 86
87#define SO_BPF_EXTENSIONS 48
88
87#endif /* _ASM_SOCKET_H */ 89#endif /* _ASM_SOCKET_H */
diff --git a/arch/s390/include/uapi/asm/statfs.h b/arch/s390/include/uapi/asm/statfs.h
index a61d538756f2..471eb09184d4 100644
--- a/arch/s390/include/uapi/asm/statfs.h
+++ b/arch/s390/include/uapi/asm/statfs.h
@@ -35,11 +35,11 @@ struct statfs {
35struct statfs64 { 35struct statfs64 {
36 unsigned int f_type; 36 unsigned int f_type;
37 unsigned int f_bsize; 37 unsigned int f_bsize;
38 unsigned long f_blocks; 38 unsigned long long f_blocks;
39 unsigned long f_bfree; 39 unsigned long long f_bfree;
40 unsigned long f_bavail; 40 unsigned long long f_bavail;
41 unsigned long f_files; 41 unsigned long long f_files;
42 unsigned long f_ffree; 42 unsigned long long f_ffree;
43 __kernel_fsid_t f_fsid; 43 __kernel_fsid_t f_fsid;
44 unsigned int f_namelen; 44 unsigned int f_namelen;
45 unsigned int f_frsize; 45 unsigned int f_frsize;
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h
index 864f693c237f..5eb5c9ddb120 100644
--- a/arch/s390/include/uapi/asm/unistd.h
+++ b/arch/s390/include/uapi/asm/unistd.h
@@ -280,6 +280,8 @@
280#define __NR_s390_runtime_instr 342 280#define __NR_s390_runtime_instr 342
281#define __NR_kcmp 343 281#define __NR_kcmp 343
282#define __NR_finit_module 344 282#define __NR_finit_module 344
283#define __NR_sched_setattr 345
284#define __NR_sched_getattr 346
283#define NR_syscalls 345 285#define NR_syscalls 345
284 286
285/* 287/*
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index e030d2bdec1b..db02052bd137 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -286,8 +286,8 @@ asmlinkage long sys32_getegid16(void)
286} 286}
287 287
288#ifdef CONFIG_SYSVIPC 288#ifdef CONFIG_SYSVIPC
289COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second, 289COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second,
290 unsigned long, third, compat_uptr_t, ptr) 290 compat_ulong_t, third, compat_uptr_t, ptr)
291{ 291{
292 if (call >> 16) /* hack for backward compatibility */ 292 if (call >> 16) /* hack for backward compatibility */
293 return -EINVAL; 293 return -EINVAL;
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 9cb1b975b353..59c8efce1b99 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1412,3 +1412,14 @@ ENTRY(sys_finit_module_wrapper)
1412 llgtr %r3,%r3 # const char __user * 1412 llgtr %r3,%r3 # const char __user *
1413 lgfr %r4,%r4 # int 1413 lgfr %r4,%r4 # int
1414 jg sys_finit_module 1414 jg sys_finit_module
1415
1416ENTRY(sys_sched_setattr_wrapper)
1417 lgfr %r2,%r2 # pid_t
1418 llgtr %r3,%r3 # struct sched_attr __user *
1419 jg sys_sched_setattr
1420
1421ENTRY(sys_sched_getattr_wrapper)
1422 lgfr %r2,%r2 # pid_t
1423 llgtr %r3,%r3 # const char __user *
1424 llgfr %r3,%r3 # unsigned int
1425 jg sys_sched_getattr
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 913410bd74a3..143992152ec9 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -353,3 +353,5 @@ SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev
353SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,sys_s390_runtime_instr_wrapper) 353SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,sys_s390_runtime_instr_wrapper)
354SYSCALL(sys_kcmp,sys_kcmp,sys_kcmp_wrapper) 354SYSCALL(sys_kcmp,sys_kcmp,sys_kcmp_wrapper)
355SYSCALL(sys_finit_module,sys_finit_module,sys_finit_module_wrapper) 355SYSCALL(sys_finit_module,sys_finit_module,sys_finit_module_wrapper)
356SYSCALL(sys_sched_setattr,sys_sched_setattr,sys_sched_setattr_wrapper) /* 345 */
357SYSCALL(sys_sched_getattr,sys_sched_getattr,sys_sched_getattr_wrapper)
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 78d967f180f4..8216c0e0b2e2 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -121,7 +121,7 @@ static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu)
121 * - gpr 4 contains the index on the bus (optionally) 121 * - gpr 4 contains the index on the bus (optionally)
122 */ 122 */
123 ret = kvm_io_bus_write_cookie(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS, 123 ret = kvm_io_bus_write_cookie(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS,
124 vcpu->run->s.regs.gprs[2], 124 vcpu->run->s.regs.gprs[2] & 0xffffffff,
125 8, &vcpu->run->s.regs.gprs[3], 125 8, &vcpu->run->s.regs.gprs[3],
126 vcpu->run->s.regs.gprs[4]); 126 vcpu->run->s.regs.gprs[4]);
127 127
@@ -137,7 +137,7 @@ static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu)
137 137
138int kvm_s390_handle_diag(struct kvm_vcpu *vcpu) 138int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
139{ 139{
140 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; 140 int code = kvm_s390_get_base_disp_rs(vcpu) & 0xffff;
141 141
142 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 142 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
143 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 143 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 5ddbbde6f65c..eeb1ac7d8fa4 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -112,6 +112,17 @@ static int handle_instruction(struct kvm_vcpu *vcpu)
112static int handle_prog(struct kvm_vcpu *vcpu) 112static int handle_prog(struct kvm_vcpu *vcpu)
113{ 113{
114 vcpu->stat.exit_program_interruption++; 114 vcpu->stat.exit_program_interruption++;
115
116 /* Restore ITDB to Program-Interruption TDB in guest memory */
117 if (IS_TE_ENABLED(vcpu) &&
118 !(current->thread.per_flags & PER_FLAG_NO_TE) &&
119 IS_ITDB_VALID(vcpu)) {
120 copy_to_guest(vcpu, TDB_ADDR, vcpu->arch.sie_block->itdba,
121 sizeof(struct kvm_s390_itdb));
122 memset((void *) vcpu->arch.sie_block->itdba, 0,
123 sizeof(struct kvm_s390_itdb));
124 }
125
115 trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc); 126 trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc);
116 return kvm_s390_inject_program_int(vcpu, vcpu->arch.sie_block->iprcc); 127 return kvm_s390_inject_program_int(vcpu, vcpu->arch.sie_block->iprcc);
117} 128}
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 569494e01ec6..e0676f390d57 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -395,6 +395,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
395 CPUSTAT_STOPPED | 395 CPUSTAT_STOPPED |
396 CPUSTAT_GED); 396 CPUSTAT_GED);
397 vcpu->arch.sie_block->ecb = 6; 397 vcpu->arch.sie_block->ecb = 6;
398 if (test_vfacility(50) && test_vfacility(73))
399 vcpu->arch.sie_block->ecb |= 0x10;
400
398 vcpu->arch.sie_block->ecb2 = 8; 401 vcpu->arch.sie_block->ecb2 = 8;
399 vcpu->arch.sie_block->eca = 0xC1002001U; 402 vcpu->arch.sie_block->eca = 0xC1002001U;
400 vcpu->arch.sie_block->fac = (int) (long) vfacilities; 403 vcpu->arch.sie_block->fac = (int) (long) vfacilities;
@@ -411,6 +414,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
411 unsigned int id) 414 unsigned int id)
412{ 415{
413 struct kvm_vcpu *vcpu; 416 struct kvm_vcpu *vcpu;
417 struct sie_page *sie_page;
414 int rc = -EINVAL; 418 int rc = -EINVAL;
415 419
416 if (id >= KVM_MAX_VCPUS) 420 if (id >= KVM_MAX_VCPUS)
@@ -422,12 +426,13 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
422 if (!vcpu) 426 if (!vcpu)
423 goto out; 427 goto out;
424 428
425 vcpu->arch.sie_block = (struct kvm_s390_sie_block *) 429 sie_page = (struct sie_page *) get_zeroed_page(GFP_KERNEL);
426 get_zeroed_page(GFP_KERNEL); 430 if (!sie_page)
427
428 if (!vcpu->arch.sie_block)
429 goto out_free_cpu; 431 goto out_free_cpu;
430 432
433 vcpu->arch.sie_block = &sie_page->sie_block;
434 vcpu->arch.sie_block->itdba = (unsigned long) &sie_page->itdb;
435
431 vcpu->arch.sie_block->icpua = id; 436 vcpu->arch.sie_block->icpua = id;
432 if (!kvm_is_ucontrol(kvm)) { 437 if (!kvm_is_ucontrol(kvm)) {
433 if (!kvm->arch.sca) { 438 if (!kvm->arch.sca) {
@@ -732,14 +737,16 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
732 737
733 if (exit_reason >= 0) { 738 if (exit_reason >= 0) {
734 rc = 0; 739 rc = 0;
740 } else if (kvm_is_ucontrol(vcpu->kvm)) {
741 vcpu->run->exit_reason = KVM_EXIT_S390_UCONTROL;
742 vcpu->run->s390_ucontrol.trans_exc_code =
743 current->thread.gmap_addr;
744 vcpu->run->s390_ucontrol.pgm_code = 0x10;
745 rc = -EREMOTE;
735 } else { 746 } else {
736 if (kvm_is_ucontrol(vcpu->kvm)) { 747 VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction");
737 rc = SIE_INTERCEPT_UCONTROL; 748 trace_kvm_s390_sie_fault(vcpu);
738 } else { 749 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
739 VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction");
740 trace_kvm_s390_sie_fault(vcpu);
741 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
742 }
743 } 750 }
744 751
745 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); 752 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
@@ -833,16 +840,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
833 rc = -EINTR; 840 rc = -EINTR;
834 } 841 }
835 842
836#ifdef CONFIG_KVM_S390_UCONTROL
837 if (rc == SIE_INTERCEPT_UCONTROL) {
838 kvm_run->exit_reason = KVM_EXIT_S390_UCONTROL;
839 kvm_run->s390_ucontrol.trans_exc_code =
840 current->thread.gmap_addr;
841 kvm_run->s390_ucontrol.pgm_code = 0x10;
842 rc = 0;
843 }
844#endif
845
846 if (rc == -EOPNOTSUPP) { 843 if (rc == -EOPNOTSUPP) {
847 /* intercept cannot be handled in-kernel, prepare kvm-run */ 844 /* intercept cannot be handled in-kernel, prepare kvm-run */
848 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC; 845 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC;
@@ -885,10 +882,11 @@ static int __guestcopy(struct kvm_vcpu *vcpu, u64 guestdest, void *from,
885 * KVM_S390_STORE_STATUS_NOADDR: -> 0x1200 on 64 bit 882 * KVM_S390_STORE_STATUS_NOADDR: -> 0x1200 on 64 bit
886 * KVM_S390_STORE_STATUS_PREFIXED: -> prefix 883 * KVM_S390_STORE_STATUS_PREFIXED: -> prefix
887 */ 884 */
888int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) 885int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long addr)
889{ 886{
890 unsigned char archmode = 1; 887 unsigned char archmode = 1;
891 int prefix; 888 int prefix;
889 u64 clkcomp;
892 890
893 if (addr == KVM_S390_STORE_STATUS_NOADDR) { 891 if (addr == KVM_S390_STORE_STATUS_NOADDR) {
894 if (copy_to_guest_absolute(vcpu, 163ul, &archmode, 1)) 892 if (copy_to_guest_absolute(vcpu, 163ul, &archmode, 1))
@@ -903,15 +901,6 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
903 } else 901 } else
904 prefix = 0; 902 prefix = 0;
905 903
906 /*
907 * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy
908 * copying in vcpu load/put. Lets update our copies before we save
909 * it into the save area
910 */
911 save_fp_ctl(&vcpu->arch.guest_fpregs.fpc);
912 save_fp_regs(vcpu->arch.guest_fpregs.fprs);
913 save_access_regs(vcpu->run->s.regs.acrs);
914
915 if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs), 904 if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
916 vcpu->arch.guest_fpregs.fprs, 128, prefix)) 905 vcpu->arch.guest_fpregs.fprs, 128, prefix))
917 return -EFAULT; 906 return -EFAULT;
@@ -941,8 +930,9 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
941 &vcpu->arch.sie_block->cputm, 8, prefix)) 930 &vcpu->arch.sie_block->cputm, 8, prefix))
942 return -EFAULT; 931 return -EFAULT;
943 932
933 clkcomp = vcpu->arch.sie_block->ckc >> 8;
944 if (__guestcopy(vcpu, addr + offsetof(struct save_area, clk_cmp), 934 if (__guestcopy(vcpu, addr + offsetof(struct save_area, clk_cmp),
945 &vcpu->arch.sie_block->ckc, 8, prefix)) 935 &clkcomp, 8, prefix))
946 return -EFAULT; 936 return -EFAULT;
947 937
948 if (__guestcopy(vcpu, addr + offsetof(struct save_area, acc_regs), 938 if (__guestcopy(vcpu, addr + offsetof(struct save_area, acc_regs),
@@ -956,6 +946,20 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
956 return 0; 946 return 0;
957} 947}
958 948
949int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
950{
951 /*
952 * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy
953 * copying in vcpu load/put. Lets update our copies before we save
954 * it into the save area
955 */
956 save_fp_ctl(&vcpu->arch.guest_fpregs.fpc);
957 save_fp_regs(vcpu->arch.guest_fpregs.fprs);
958 save_access_regs(vcpu->run->s.regs.acrs);
959
960 return kvm_s390_store_status_unloaded(vcpu, addr);
961}
962
959static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, 963static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
960 struct kvm_enable_cap *cap) 964 struct kvm_enable_cap *cap)
961{ 965{
@@ -1183,8 +1187,8 @@ static int __init kvm_s390_init(void)
1183 return -ENOMEM; 1187 return -ENOMEM;
1184 } 1188 }
1185 memcpy(vfacilities, S390_lowcore.stfle_fac_list, 16); 1189 memcpy(vfacilities, S390_lowcore.stfle_fac_list, 16);
1186 vfacilities[0] &= 0xff82fff3f47c0000UL; 1190 vfacilities[0] &= 0xff82fff3f4fc2000UL;
1187 vfacilities[1] &= 0x001c000000000000UL; 1191 vfacilities[1] &= 0x005c000000000000UL;
1188 return 0; 1192 return 0;
1189} 1193}
1190 1194
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index b44912a32949..f9559b0bd620 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -19,18 +19,19 @@
19#include <linux/kvm.h> 19#include <linux/kvm.h>
20#include <linux/kvm_host.h> 20#include <linux/kvm_host.h>
21 21
22/* The current code can have up to 256 pages for virtio */
23#define VIRTIODESCSPACE (256ul * 4096ul)
24
25typedef int (*intercept_handler_t)(struct kvm_vcpu *vcpu); 22typedef int (*intercept_handler_t)(struct kvm_vcpu *vcpu);
26 23
27/* declare vfacilities extern */ 24/* declare vfacilities extern */
28extern unsigned long *vfacilities; 25extern unsigned long *vfacilities;
29 26
30/* negativ values are error codes, positive values for internal conditions */
31#define SIE_INTERCEPT_UCONTROL (1<<0)
32int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu); 27int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu);
33 28
29/* Transactional Memory Execution related macros */
30#define IS_TE_ENABLED(vcpu) ((vcpu->arch.sie_block->ecb & 0x10))
31#define TDB_ADDR 0x1800UL
32#define TDB_FORMAT1 1
33#define IS_ITDB_VALID(vcpu) ((*(char *)vcpu->arch.sie_block->itdba == TDB_FORMAT1))
34
34#define VM_EVENT(d_kvm, d_loglevel, d_string, d_args...)\ 35#define VM_EVENT(d_kvm, d_loglevel, d_string, d_args...)\
35do { \ 36do { \
36 debug_sprintf_event(d_kvm->arch.dbf, d_loglevel, d_string "\n", \ 37 debug_sprintf_event(d_kvm->arch.dbf, d_loglevel, d_string "\n", \
@@ -133,7 +134,6 @@ int __must_check kvm_s390_inject_vm(struct kvm *kvm,
133int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu, 134int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
134 struct kvm_s390_interrupt *s390int); 135 struct kvm_s390_interrupt *s390int);
135int __must_check kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code); 136int __must_check kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code);
136int __must_check kvm_s390_inject_sigp_stop(struct kvm_vcpu *vcpu, int action);
137struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm, 137struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
138 u64 cr6, u64 schid); 138 u64 cr6, u64 schid);
139 139
@@ -150,8 +150,8 @@ int kvm_s390_handle_eb(struct kvm_vcpu *vcpu);
150int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu); 150int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu);
151 151
152/* implemented in kvm-s390.c */ 152/* implemented in kvm-s390.c */
153int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, 153int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long addr);
154 unsigned long addr); 154int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr);
155void s390_vcpu_block(struct kvm_vcpu *vcpu); 155void s390_vcpu_block(struct kvm_vcpu *vcpu);
156void s390_vcpu_unblock(struct kvm_vcpu *vcpu); 156void s390_vcpu_unblock(struct kvm_vcpu *vcpu);
157void exit_sie(struct kvm_vcpu *vcpu); 157void exit_sie(struct kvm_vcpu *vcpu);
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index d101dae62771..75beea632a10 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -197,7 +197,7 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
197 if (addr & 3) 197 if (addr & 3)
198 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 198 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
199 cc = 0; 199 cc = 0;
200 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0); 200 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->arch.sie_block->gcr[6], 0);
201 if (!inti) 201 if (!inti)
202 goto no_interrupt; 202 goto no_interrupt;
203 cc = 1; 203 cc = 1;
@@ -638,7 +638,6 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
638 638
639static const intercept_handler_t b9_handlers[256] = { 639static const intercept_handler_t b9_handlers[256] = {
640 [0x8d] = handle_epsw, 640 [0x8d] = handle_epsw,
641 [0x9c] = handle_io_inst,
642 [0xaf] = handle_pfmf, 641 [0xaf] = handle_pfmf,
643}; 642};
644 643
@@ -731,7 +730,6 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)
731 730
732static const intercept_handler_t eb_handlers[256] = { 731static const intercept_handler_t eb_handlers[256] = {
733 [0x2f] = handle_lctlg, 732 [0x2f] = handle_lctlg,
734 [0x8a] = handle_io_inst,
735}; 733};
736 734
737int kvm_s390_handle_eb(struct kvm_vcpu *vcpu) 735int kvm_s390_handle_eb(struct kvm_vcpu *vcpu)
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index bec398c57acf..87c2b3a3bd3e 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * handling interprocessor communication 2 * handling interprocessor communication
3 * 3 *
4 * Copyright IBM Corp. 2008, 2009 4 * Copyright IBM Corp. 2008, 2013
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only) 7 * it under the terms of the GNU General Public License (version 2 only)
@@ -89,6 +89,37 @@ unlock:
89 return rc; 89 return rc;
90} 90}
91 91
92static int __sigp_conditional_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr,
93 u16 asn, u64 *reg)
94{
95 struct kvm_vcpu *dst_vcpu = NULL;
96 const u64 psw_int_mask = PSW_MASK_IO | PSW_MASK_EXT;
97 u16 p_asn, s_asn;
98 psw_t *psw;
99 u32 flags;
100
101 if (cpu_addr < KVM_MAX_VCPUS)
102 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
103 if (!dst_vcpu)
104 return SIGP_CC_NOT_OPERATIONAL;
105 flags = atomic_read(&dst_vcpu->arch.sie_block->cpuflags);
106 psw = &dst_vcpu->arch.sie_block->gpsw;
107 p_asn = dst_vcpu->arch.sie_block->gcr[4] & 0xffff; /* Primary ASN */
108 s_asn = dst_vcpu->arch.sie_block->gcr[3] & 0xffff; /* Secondary ASN */
109
110 /* Deliver the emergency signal? */
111 if (!(flags & CPUSTAT_STOPPED)
112 || (psw->mask & psw_int_mask) != psw_int_mask
113 || ((flags & CPUSTAT_WAIT) && psw->addr != 0)
114 || (!(flags & CPUSTAT_WAIT) && (asn == p_asn || asn == s_asn))) {
115 return __sigp_emergency(vcpu, cpu_addr);
116 } else {
117 *reg &= 0xffffffff00000000UL;
118 *reg |= SIGP_STATUS_INCORRECT_STATE;
119 return SIGP_CC_STATUS_STORED;
120 }
121}
122
92static int __sigp_external_call(struct kvm_vcpu *vcpu, u16 cpu_addr) 123static int __sigp_external_call(struct kvm_vcpu *vcpu, u16 cpu_addr)
93{ 124{
94 struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; 125 struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
@@ -130,6 +161,7 @@ unlock:
130static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action) 161static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action)
131{ 162{
132 struct kvm_s390_interrupt_info *inti; 163 struct kvm_s390_interrupt_info *inti;
164 int rc = SIGP_CC_ORDER_CODE_ACCEPTED;
133 165
134 inti = kzalloc(sizeof(*inti), GFP_ATOMIC); 166 inti = kzalloc(sizeof(*inti), GFP_ATOMIC);
135 if (!inti) 167 if (!inti)
@@ -139,6 +171,8 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action)
139 spin_lock_bh(&li->lock); 171 spin_lock_bh(&li->lock);
140 if ((atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) { 172 if ((atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
141 kfree(inti); 173 kfree(inti);
174 if ((action & ACTION_STORE_ON_STOP) != 0)
175 rc = -ESHUTDOWN;
142 goto out; 176 goto out;
143 } 177 }
144 list_add_tail(&inti->list, &li->list); 178 list_add_tail(&inti->list, &li->list);
@@ -150,7 +184,7 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action)
150out: 184out:
151 spin_unlock_bh(&li->lock); 185 spin_unlock_bh(&li->lock);
152 186
153 return SIGP_CC_ORDER_CODE_ACCEPTED; 187 return rc;
154} 188}
155 189
156static int __sigp_stop(struct kvm_vcpu *vcpu, u16 cpu_addr, int action) 190static int __sigp_stop(struct kvm_vcpu *vcpu, u16 cpu_addr, int action)
@@ -174,13 +208,17 @@ static int __sigp_stop(struct kvm_vcpu *vcpu, u16 cpu_addr, int action)
174unlock: 208unlock:
175 spin_unlock(&fi->lock); 209 spin_unlock(&fi->lock);
176 VCPU_EVENT(vcpu, 4, "sent sigp stop to cpu %x", cpu_addr); 210 VCPU_EVENT(vcpu, 4, "sent sigp stop to cpu %x", cpu_addr);
177 return rc;
178}
179 211
180int kvm_s390_inject_sigp_stop(struct kvm_vcpu *vcpu, int action) 212 if ((action & ACTION_STORE_ON_STOP) != 0 && rc == -ESHUTDOWN) {
181{ 213 /* If the CPU has already been stopped, we still have
182 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; 214 * to save the status when doing stop-and-store. This
183 return __inject_sigp_stop(li, action); 215 * has to be done after unlocking all spinlocks. */
216 struct kvm_vcpu *dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
217 rc = kvm_s390_store_status_unloaded(dst_vcpu,
218 KVM_S390_STORE_STATUS_NOADDR);
219 }
220
221 return rc;
184} 222}
185 223
186static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter) 224static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter)
@@ -262,6 +300,37 @@ out_fi:
262 return rc; 300 return rc;
263} 301}
264 302
303static int __sigp_store_status_at_addr(struct kvm_vcpu *vcpu, u16 cpu_id,
304 u32 addr, u64 *reg)
305{
306 struct kvm_vcpu *dst_vcpu = NULL;
307 int flags;
308 int rc;
309
310 if (cpu_id < KVM_MAX_VCPUS)
311 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_id);
312 if (!dst_vcpu)
313 return SIGP_CC_NOT_OPERATIONAL;
314
315 spin_lock_bh(&dst_vcpu->arch.local_int.lock);
316 flags = atomic_read(dst_vcpu->arch.local_int.cpuflags);
317 spin_unlock_bh(&dst_vcpu->arch.local_int.lock);
318 if (!(flags & CPUSTAT_STOPPED)) {
319 *reg &= 0xffffffff00000000UL;
320 *reg |= SIGP_STATUS_INCORRECT_STATE;
321 return SIGP_CC_STATUS_STORED;
322 }
323
324 addr &= 0x7ffffe00;
325 rc = kvm_s390_store_status_unloaded(dst_vcpu, addr);
326 if (rc == -EFAULT) {
327 *reg &= 0xffffffff00000000UL;
328 *reg |= SIGP_STATUS_INVALID_PARAMETER;
329 rc = SIGP_CC_STATUS_STORED;
330 }
331 return rc;
332}
333
265static int __sigp_sense_running(struct kvm_vcpu *vcpu, u16 cpu_addr, 334static int __sigp_sense_running(struct kvm_vcpu *vcpu, u16 cpu_addr,
266 u64 *reg) 335 u64 *reg)
267{ 336{
@@ -294,7 +363,8 @@ static int __sigp_sense_running(struct kvm_vcpu *vcpu, u16 cpu_addr,
294 return rc; 363 return rc;
295} 364}
296 365
297static int __sigp_restart(struct kvm_vcpu *vcpu, u16 cpu_addr) 366/* Test whether the destination CPU is available and not busy */
367static int sigp_check_callable(struct kvm_vcpu *vcpu, u16 cpu_addr)
298{ 368{
299 struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; 369 struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
300 struct kvm_s390_local_interrupt *li; 370 struct kvm_s390_local_interrupt *li;
@@ -313,9 +383,6 @@ static int __sigp_restart(struct kvm_vcpu *vcpu, u16 cpu_addr)
313 spin_lock_bh(&li->lock); 383 spin_lock_bh(&li->lock);
314 if (li->action_bits & ACTION_STOP_ON_STOP) 384 if (li->action_bits & ACTION_STOP_ON_STOP)
315 rc = SIGP_CC_BUSY; 385 rc = SIGP_CC_BUSY;
316 else
317 VCPU_EVENT(vcpu, 4, "sigp restart %x to handle userspace",
318 cpu_addr);
319 spin_unlock_bh(&li->lock); 386 spin_unlock_bh(&li->lock);
320out: 387out:
321 spin_unlock(&fi->lock); 388 spin_unlock(&fi->lock);
@@ -366,6 +433,10 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu)
366 rc = __sigp_stop(vcpu, cpu_addr, ACTION_STORE_ON_STOP | 433 rc = __sigp_stop(vcpu, cpu_addr, ACTION_STORE_ON_STOP |
367 ACTION_STOP_ON_STOP); 434 ACTION_STOP_ON_STOP);
368 break; 435 break;
436 case SIGP_STORE_STATUS_AT_ADDRESS:
437 rc = __sigp_store_status_at_addr(vcpu, cpu_addr, parameter,
438 &vcpu->run->s.regs.gprs[r1]);
439 break;
369 case SIGP_SET_ARCHITECTURE: 440 case SIGP_SET_ARCHITECTURE:
370 vcpu->stat.instruction_sigp_arch++; 441 vcpu->stat.instruction_sigp_arch++;
371 rc = __sigp_set_arch(vcpu, parameter); 442 rc = __sigp_set_arch(vcpu, parameter);
@@ -375,17 +446,31 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu)
375 rc = __sigp_set_prefix(vcpu, cpu_addr, parameter, 446 rc = __sigp_set_prefix(vcpu, cpu_addr, parameter,
376 &vcpu->run->s.regs.gprs[r1]); 447 &vcpu->run->s.regs.gprs[r1]);
377 break; 448 break;
449 case SIGP_COND_EMERGENCY_SIGNAL:
450 rc = __sigp_conditional_emergency(vcpu, cpu_addr, parameter,
451 &vcpu->run->s.regs.gprs[r1]);
452 break;
378 case SIGP_SENSE_RUNNING: 453 case SIGP_SENSE_RUNNING:
379 vcpu->stat.instruction_sigp_sense_running++; 454 vcpu->stat.instruction_sigp_sense_running++;
380 rc = __sigp_sense_running(vcpu, cpu_addr, 455 rc = __sigp_sense_running(vcpu, cpu_addr,
381 &vcpu->run->s.regs.gprs[r1]); 456 &vcpu->run->s.regs.gprs[r1]);
382 break; 457 break;
458 case SIGP_START:
459 rc = sigp_check_callable(vcpu, cpu_addr);
460 if (rc == SIGP_CC_ORDER_CODE_ACCEPTED)
461 rc = -EOPNOTSUPP; /* Handle START in user space */
462 break;
383 case SIGP_RESTART: 463 case SIGP_RESTART:
384 vcpu->stat.instruction_sigp_restart++; 464 vcpu->stat.instruction_sigp_restart++;
385 rc = __sigp_restart(vcpu, cpu_addr); 465 rc = sigp_check_callable(vcpu, cpu_addr);
386 if (rc == SIGP_CC_BUSY) 466 if (rc == SIGP_CC_ORDER_CODE_ACCEPTED) {
387 break; 467 VCPU_EVENT(vcpu, 4,
388 /* user space must know about restart */ 468 "sigp restart %x to handle userspace",
469 cpu_addr);
470 /* user space must know about restart */
471 rc = -EOPNOTSUPP;
472 }
473 break;
389 default: 474 default:
390 return -EOPNOTSUPP; 475 return -EOPNOTSUPP;
391 } 476 }
@@ -393,7 +478,6 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu)
393 if (rc < 0) 478 if (rc < 0)
394 return rc; 479 return rc;
395 480
396 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); 481 kvm_s390_set_psw_cc(vcpu, rc);
397 vcpu->arch.sie_block->gpsw.mask |= (rc & 3ul) << 44;
398 return 0; 482 return 0;
399} 483}
diff --git a/arch/s390/kvm/trace.h b/arch/s390/kvm/trace.h
index 0c991c6748ab..3db76b2daed7 100644
--- a/arch/s390/kvm/trace.h
+++ b/arch/s390/kvm/trace.h
@@ -175,6 +175,7 @@ TRACE_EVENT(kvm_s390_intercept_validity,
175 {SIGP_STOP_AND_STORE_STATUS, "stop and store status"}, \ 175 {SIGP_STOP_AND_STORE_STATUS, "stop and store status"}, \
176 {SIGP_SET_ARCHITECTURE, "set architecture"}, \ 176 {SIGP_SET_ARCHITECTURE, "set architecture"}, \
177 {SIGP_SET_PREFIX, "set prefix"}, \ 177 {SIGP_SET_PREFIX, "set prefix"}, \
178 {SIGP_STORE_STATUS_AT_ADDRESS, "store status at addr"}, \
178 {SIGP_SENSE_RUNNING, "sense running"}, \ 179 {SIGP_SENSE_RUNNING, "sense running"}, \
179 {SIGP_RESTART, "restart"} 180 {SIGP_RESTART, "restart"}
180 181
diff --git a/arch/s390/lib/uaccess.h b/arch/s390/lib/uaccess.h
index 315dbe09983e..b1a22173d027 100644
--- a/arch/s390/lib/uaccess.h
+++ b/arch/s390/lib/uaccess.h
@@ -6,15 +6,6 @@
6#ifndef __ARCH_S390_LIB_UACCESS_H 6#ifndef __ARCH_S390_LIB_UACCESS_H
7#define __ARCH_S390_LIB_UACCESS_H 7#define __ARCH_S390_LIB_UACCESS_H
8 8
9extern size_t copy_from_user_std(size_t, const void __user *, void *);
10extern size_t copy_to_user_std(size_t, void __user *, const void *);
11extern size_t strnlen_user_std(size_t, const char __user *);
12extern size_t strncpy_from_user_std(size_t, const char __user *, char *);
13extern int futex_atomic_cmpxchg_std(u32 *, u32 __user *, u32, u32);
14extern int futex_atomic_op_std(int, u32 __user *, int, int *);
15
16extern size_t copy_from_user_pt(size_t, const void __user *, void *);
17extern size_t copy_to_user_pt(size_t, void __user *, const void *);
18extern int futex_atomic_op_pt(int, u32 __user *, int, int *); 9extern int futex_atomic_op_pt(int, u32 __user *, int, int *);
19extern int futex_atomic_cmpxchg_pt(u32 *, u32 __user *, u32, u32); 10extern int futex_atomic_cmpxchg_pt(u32 *, u32 __user *, u32, u32);
20 11
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index 0632dc50da78..61ebcc9ccb34 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -153,6 +153,8 @@ static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr,
153 unsigned long offset, done, size, kaddr; 153 unsigned long offset, done, size, kaddr;
154 void *from, *to; 154 void *from, *to;
155 155
156 if (!mm)
157 return n;
156 done = 0; 158 done = 0;
157retry: 159retry:
158 spin_lock(&mm->page_table_lock); 160 spin_lock(&mm->page_table_lock);
@@ -209,7 +211,7 @@ fault:
209 return 0; 211 return 0;
210} 212}
211 213
212size_t copy_from_user_pt(size_t n, const void __user *from, void *to) 214static size_t copy_from_user_pt(size_t n, const void __user *from, void *to)
213{ 215{
214 size_t rc; 216 size_t rc;
215 217
@@ -221,7 +223,7 @@ size_t copy_from_user_pt(size_t n, const void __user *from, void *to)
221 return rc; 223 return rc;
222} 224}
223 225
224size_t copy_to_user_pt(size_t n, void __user *to, const void *from) 226static size_t copy_to_user_pt(size_t n, void __user *to, const void *from)
225{ 227{
226 if (segment_eq(get_fs(), KERNEL_DS)) 228 if (segment_eq(get_fs(), KERNEL_DS))
227 return copy_in_kernel(n, to, (void __user *) from); 229 return copy_in_kernel(n, to, (void __user *) from);
@@ -262,6 +264,8 @@ static size_t strnlen_user_pt(size_t count, const char __user *src)
262 return 0; 264 return 0;
263 if (segment_eq(get_fs(), KERNEL_DS)) 265 if (segment_eq(get_fs(), KERNEL_DS))
264 return strnlen_kernel(count, src); 266 return strnlen_kernel(count, src);
267 if (!mm)
268 return 0;
265 done = 0; 269 done = 0;
266retry: 270retry:
267 spin_lock(&mm->page_table_lock); 271 spin_lock(&mm->page_table_lock);
@@ -323,6 +327,8 @@ static size_t copy_in_user_pt(size_t n, void __user *to,
323 327
324 if (segment_eq(get_fs(), KERNEL_DS)) 328 if (segment_eq(get_fs(), KERNEL_DS))
325 return copy_in_kernel(n, to, from); 329 return copy_in_kernel(n, to, from);
330 if (!mm)
331 return n;
326 done = 0; 332 done = 0;
327retry: 333retry:
328 spin_lock(&mm->page_table_lock); 334 spin_lock(&mm->page_table_lock);
@@ -411,6 +417,8 @@ int futex_atomic_op_pt(int op, u32 __user *uaddr, int oparg, int *old)
411 417
412 if (segment_eq(get_fs(), KERNEL_DS)) 418 if (segment_eq(get_fs(), KERNEL_DS))
413 return __futex_atomic_op_pt(op, uaddr, oparg, old); 419 return __futex_atomic_op_pt(op, uaddr, oparg, old);
420 if (unlikely(!current->mm))
421 return -EFAULT;
414 spin_lock(&current->mm->page_table_lock); 422 spin_lock(&current->mm->page_table_lock);
415 uaddr = (u32 __force __user *) 423 uaddr = (u32 __force __user *)
416 __dat_user_addr((__force unsigned long) uaddr, 1); 424 __dat_user_addr((__force unsigned long) uaddr, 1);
@@ -448,6 +456,8 @@ int futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr,
448 456
449 if (segment_eq(get_fs(), KERNEL_DS)) 457 if (segment_eq(get_fs(), KERNEL_DS))
450 return __futex_atomic_cmpxchg_pt(uval, uaddr, oldval, newval); 458 return __futex_atomic_cmpxchg_pt(uval, uaddr, oldval, newval);
459 if (unlikely(!current->mm))
460 return -EFAULT;
451 spin_lock(&current->mm->page_table_lock); 461 spin_lock(&current->mm->page_table_lock);
452 uaddr = (u32 __force __user *) 462 uaddr = (u32 __force __user *)
453 __dat_user_addr((__force unsigned long) uaddr, 1); 463 __dat_user_addr((__force unsigned long) uaddr, 1);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0820362c7b0f..66670ff262a0 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -407,8 +407,8 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
407 struct msi_msg msg; 407 struct msi_msg msg;
408 int rc; 408 int rc;
409 409
410 if (type != PCI_CAP_ID_MSIX && type != PCI_CAP_ID_MSI) 410 if (type == PCI_CAP_ID_MSI && nvec > 1)
411 return -EINVAL; 411 return 1;
412 msi_vecs = min(nvec, ZPCI_MSI_VEC_MAX); 412 msi_vecs = min(nvec, ZPCI_MSI_VEC_MAX);
413 msi_vecs = min_t(unsigned int, msi_vecs, CONFIG_PCI_NR_MSI); 413 msi_vecs = min_t(unsigned int, msi_vecs, CONFIG_PCI_NR_MSI);
414 414
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index 305f7ee1f382..c75d06aa27c3 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -2,7 +2,6 @@ menu "Machine selection"
2 2
3config SCORE 3config SCORE
4 def_bool y 4 def_bool y
5 select HAVE_GENERIC_HARDIRQS
6 select GENERIC_IRQ_SHOW 5 select GENERIC_IRQ_SHOW
7 select GENERIC_IOMAP 6 select GENERIC_IOMAP
8 select GENERIC_ATOMIC64 7 select GENERIC_ATOMIC64
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index fe7471eb0167..146b9d5e89f8 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -3,6 +3,8 @@ header-y +=
3 3
4generic-y += barrier.h 4generic-y += barrier.h
5generic-y += clkdev.h 5generic-y += clkdev.h
6generic-y += hash.h
6generic-y += trace_clock.h 7generic-y += trace_clock.h
7generic-y += xor.h 8generic-y += xor.h
8generic-y += preempt.h 9generic-y += preempt.h
10
diff --git a/arch/score/lib/checksum.S b/arch/score/lib/checksum.S
index 706157edc7d5..1141f2b4a501 100644
--- a/arch/score/lib/checksum.S
+++ b/arch/score/lib/checksum.S
@@ -137,7 +137,7 @@ ENTRY(csum_partial)
137 ldi r25, 0 137 ldi r25, 0
138 mv r10, r5 138 mv r10, r5
139 cmpi.c r5, 0x8 139 cmpi.c r5, 0x8
140 blt small_csumcpy /* < 8(singed) bytes to copy */ 140 blt small_csumcpy /* < 8(signed) bytes to copy */
141 cmpi.c r5, 0x0 141 cmpi.c r5, 0x0
142 beq out 142 beq out
143 andri.c r25, src, 0x1 /* odd buffer? */ 143 andri.c r25, src, 0x1 /* odd buffer? */
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index ce298317a73e..6357710753d5 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -701,13 +701,13 @@ config SMP
701 depends on SYS_SUPPORTS_SMP 701 depends on SYS_SUPPORTS_SMP
702 ---help--- 702 ---help---
703 This enables support for systems with more than one CPU. If you have 703 This enables support for systems with more than one CPU. If you have
704 a system with only one CPU, like most personal computers, say N. If 704 a system with only one CPU, say N. If you have a system with more
705 you have a system with more than one CPU, say Y. 705 than one CPU, say Y.
706 706
707 If you say N here, the kernel will run on single and multiprocessor 707 If you say N here, the kernel will run on uni- and multiprocessor
708 machines, but will use only one CPU of a multiprocessor machine. If 708 machines, but will use only one CPU of a multiprocessor machine. If
709 you say Y here, the kernel will run on many, but not all, 709 you say Y here, the kernel will run on many, but not all,
710 singleprocessor machines. On a singleprocessor machine, the kernel 710 uniprocessor machines. On a uniprocessor machine, the kernel
711 will run faster if you say N here. 711 will run faster if you say N here.
712 712
713 People using multiprocessor machines who say Y here should also say 713 People using multiprocessor machines who say Y here should also say
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index fb5805745ace..eb1cf84231a2 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -321,6 +321,7 @@ config SH_CAYMAN
321 bool "Hitachi Cayman" 321 bool "Hitachi Cayman"
322 depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103 322 depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
323 select SYS_SUPPORTS_PCI 323 select SYS_SUPPORTS_PCI
324 select ARCH_MIGHT_HAVE_PC_SERIO
324 325
325config SH_POLARIS 326config SH_POLARIS
326 bool "SMSC Polaris" 327 bool "SMSC Polaris"
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 122f737a901f..5bc3a15465c7 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -502,7 +502,7 @@ static struct platform_device keysc_device = {
502/* TouchScreen */ 502/* TouchScreen */
503#define IRQ0 evt2irq(0x600) 503#define IRQ0 evt2irq(0x600)
504 504
505static int ts_get_pendown_state(void) 505static int ts_get_pendown_state(struct device *dev)
506{ 506{
507 int val = 0; 507 int val = 0;
508 gpio_free(GPIO_FN_INTC_IRQ0); 508 gpio_free(GPIO_FN_INTC_IRQ0);
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 231efbb68108..0cd7198a4524 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -35,3 +35,4 @@ generic-y += trace_clock.h
35generic-y += ucontext.h 35generic-y += ucontext.h
36generic-y += xor.h 36generic-y += xor.h
37generic-y += preempt.h 37generic-y += preempt.h
38generic-y += hash.h
diff --git a/arch/sh/include/asm/clkdev.h b/arch/sh/include/asm/clkdev.h
index 6ba91868201c..c41901465fb0 100644
--- a/arch/sh/include/asm/clkdev.h
+++ b/arch/sh/include/asm/clkdev.h
@@ -25,7 +25,9 @@ static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
25 return kzalloc(size, GFP_KERNEL); 25 return kzalloc(size, GFP_KERNEL);
26} 26}
27 27
28#ifndef CONFIG_COMMON_CLK
28#define __clk_put(clk) 29#define __clk_put(clk)
29#define __clk_get(clk) ({ 1; }) 30#define __clk_get(clk) ({ 1; })
31#endif
30 32
31#endif /* __CLKDEV_H__ */ 33#endif /* __CLKDEV_H__ */
diff --git a/arch/sh/include/asm/fixmap.h b/arch/sh/include/asm/fixmap.h
index cbe0186b6794..4daf91c3b725 100644
--- a/arch/sh/include/asm/fixmap.h
+++ b/arch/sh/include/asm/fixmap.h
@@ -79,13 +79,6 @@ extern void __set_fixmap(enum fixed_addresses idx,
79 unsigned long phys, pgprot_t flags); 79 unsigned long phys, pgprot_t flags);
80extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags); 80extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags);
81 81
82#define set_fixmap(idx, phys) \
83 __set_fixmap(idx, phys, PAGE_KERNEL)
84/*
85 * Some hardware wants to get fixmapped without caching.
86 */
87#define set_fixmap_nocache(idx, phys) \
88 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
89/* 82/*
90 * used by vmalloc.c. 83 * used by vmalloc.c.
91 * 84 *
@@ -101,36 +94,8 @@ extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags);
101#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 94#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
102#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 95#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
103 96
104#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) 97#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE
105#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
106
107extern void __this_fixmap_does_not_exist(void);
108
109/*
110 * 'index to address' translation. If anyone tries to use the idx
111 * directly without tranlation, we catch the bug with a NULL-deference
112 * kernel oops. Illegal ranges of incoming indices are caught too.
113 */
114static inline unsigned long fix_to_virt(const unsigned int idx)
115{
116 /*
117 * this branch gets completely eliminated after inlining,
118 * except when someone tries to use fixaddr indices in an
119 * illegal way. (such as mixing up address types or using
120 * out-of-range indices).
121 *
122 * If it doesn't get removed, the linker will complain
123 * loudly with a reasonably clear error message..
124 */
125 if (idx >= __end_of_fixed_addresses)
126 __this_fixmap_does_not_exist();
127 98
128 return __fix_to_virt(idx); 99#include <asm-generic/fixmap.h>
129}
130 100
131static inline unsigned long virt_to_fix(const unsigned long vaddr)
132{
133 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
134 return __virt_to_fix(vaddr);
135}
136#endif 101#endif
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
index 4df4d4ffe39b..3860b0be56c7 100644
--- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
@@ -61,51 +61,63 @@ static DECLARE_INTC_DESC(intc_desc, "sh7619", vectors, NULL,
61 NULL, prio_registers, NULL); 61 NULL, prio_registers, NULL);
62 62
63static struct plat_sci_port scif0_platform_data = { 63static struct plat_sci_port scif0_platform_data = {
64 .mapbase = 0xf8400000,
65 .flags = UPF_BOOT_AUTOCONF, 64 .flags = UPF_BOOT_AUTOCONF,
66 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 65 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
67 .scbrr_algo_id = SCBRR_ALGO_2,
68 .type = PORT_SCIF, 66 .type = PORT_SCIF,
69 .irqs = SCIx_IRQ_MUXED(88), 67};
68
69static struct resource scif0_resources[] = {
70 DEFINE_RES_MEM(0xf8400000, 0x100),
71 DEFINE_RES_IRQ(88),
70}; 72};
71 73
72static struct platform_device scif0_device = { 74static struct platform_device scif0_device = {
73 .name = "sh-sci", 75 .name = "sh-sci",
74 .id = 0, 76 .id = 0,
77 .resource = scif0_resources,
78 .num_resources = ARRAY_SIZE(scif0_resources),
75 .dev = { 79 .dev = {
76 .platform_data = &scif0_platform_data, 80 .platform_data = &scif0_platform_data,
77 }, 81 },
78}; 82};
79 83
80static struct plat_sci_port scif1_platform_data = { 84static struct plat_sci_port scif1_platform_data = {
81 .mapbase = 0xf8410000,
82 .flags = UPF_BOOT_AUTOCONF, 85 .flags = UPF_BOOT_AUTOCONF,
83 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 86 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
84 .scbrr_algo_id = SCBRR_ALGO_2,
85 .type = PORT_SCIF, 87 .type = PORT_SCIF,
86 .irqs = SCIx_IRQ_MUXED(92), 88};
89
90static struct resource scif1_resources[] = {
91 DEFINE_RES_MEM(0xf8410000, 0x100),
92 DEFINE_RES_IRQ(92),
87}; 93};
88 94
89static struct platform_device scif1_device = { 95static struct platform_device scif1_device = {
90 .name = "sh-sci", 96 .name = "sh-sci",
91 .id = 1, 97 .id = 1,
98 .resource = scif1_resources,
99 .num_resources = ARRAY_SIZE(scif1_resources),
92 .dev = { 100 .dev = {
93 .platform_data = &scif1_platform_data, 101 .platform_data = &scif1_platform_data,
94 }, 102 },
95}; 103};
96 104
97static struct plat_sci_port scif2_platform_data = { 105static struct plat_sci_port scif2_platform_data = {
98 .mapbase = 0xf8420000,
99 .flags = UPF_BOOT_AUTOCONF, 106 .flags = UPF_BOOT_AUTOCONF,
100 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 107 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
101 .scbrr_algo_id = SCBRR_ALGO_2,
102 .type = PORT_SCIF, 108 .type = PORT_SCIF,
103 .irqs = SCIx_IRQ_MUXED(96), 109};
110
111static struct resource scif2_resources[] = {
112 DEFINE_RES_MEM(0xf8420000, 0x100),
113 DEFINE_RES_IRQ(96),
104}; 114};
105 115
106static struct platform_device scif2_device = { 116static struct platform_device scif2_device = {
107 .name = "sh-sci", 117 .name = "sh-sci",
108 .id = 2, 118 .id = 2,
119 .resource = scif2_resources,
120 .num_resources = ARRAY_SIZE(scif2_resources),
109 .dev = { 121 .dev = {
110 .platform_data = &scif2_platform_data, 122 .platform_data = &scif2_platform_data,
111 }, 123 },
diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
index f7f1cf2af302..63e996f9a7ed 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
@@ -199,17 +199,21 @@ static struct platform_device mtu2_2_device = {
199}; 199};
200 200
201static struct plat_sci_port scif0_platform_data = { 201static struct plat_sci_port scif0_platform_data = {
202 .mapbase = 0xff804000,
203 .flags = UPF_BOOT_AUTOCONF, 202 .flags = UPF_BOOT_AUTOCONF,
204 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 203 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
205 .scbrr_algo_id = SCBRR_ALGO_2,
206 .type = PORT_SCIF, 204 .type = PORT_SCIF,
207 .irqs = SCIx_IRQ_MUXED(220), 205};
206
207static struct resource scif0_resources[] = {
208 DEFINE_RES_MEM(0xff804000, 0x100),
209 DEFINE_RES_IRQ(220),
208}; 210};
209 211
210static struct platform_device scif0_device = { 212static struct platform_device scif0_device = {
211 .name = "sh-sci", 213 .name = "sh-sci",
212 .id = 0, 214 .id = 0,
215 .resource = scif0_resources,
216 .num_resources = ARRAY_SIZE(scif0_resources),
213 .dev = { 217 .dev = {
214 .platform_data = &scif0_platform_data, 218 .platform_data = &scif0_platform_data,
215 }, 219 },
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
index 7b84785b8962..2c6874461536 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
@@ -178,136 +178,168 @@ static DECLARE_INTC_DESC(intc_desc, "sh7201", vectors, groups,
178 mask_registers, prio_registers, NULL); 178 mask_registers, prio_registers, NULL);
179 179
180static struct plat_sci_port scif0_platform_data = { 180static struct plat_sci_port scif0_platform_data = {
181 .mapbase = 0xfffe8000,
182 .flags = UPF_BOOT_AUTOCONF, 181 .flags = UPF_BOOT_AUTOCONF,
183 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 182 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
184 .scbrr_algo_id = SCBRR_ALGO_2,
185 .type = PORT_SCIF, 183 .type = PORT_SCIF,
186 .irqs = SCIx_IRQ_MUXED(180), 184};
185
186static struct resource scif0_resources[] = {
187 DEFINE_RES_MEM(0xfffe8000, 0x100),
188 DEFINE_RES_IRQ(180),
187}; 189};
188 190
189static struct platform_device scif0_device = { 191static struct platform_device scif0_device = {
190 .name = "sh-sci", 192 .name = "sh-sci",
191 .id = 0, 193 .id = 0,
194 .resource = scif0_resources,
195 .num_resources = ARRAY_SIZE(scif0_resources),
192 .dev = { 196 .dev = {
193 .platform_data = &scif0_platform_data, 197 .platform_data = &scif0_platform_data,
194 }, 198 },
195}; 199};
196 200
197static struct plat_sci_port scif1_platform_data = { 201static struct plat_sci_port scif1_platform_data = {
198 .mapbase = 0xfffe8800,
199 .flags = UPF_BOOT_AUTOCONF, 202 .flags = UPF_BOOT_AUTOCONF,
200 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 203 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
201 .scbrr_algo_id = SCBRR_ALGO_2,
202 .type = PORT_SCIF, 204 .type = PORT_SCIF,
203 .irqs = SCIx_IRQ_MUXED(184), 205};
206
207static struct resource scif1_resources[] = {
208 DEFINE_RES_MEM(0xfffe8800, 0x100),
209 DEFINE_RES_IRQ(184),
204}; 210};
205 211
206static struct platform_device scif1_device = { 212static struct platform_device scif1_device = {
207 .name = "sh-sci", 213 .name = "sh-sci",
208 .id = 1, 214 .id = 1,
215 .resource = scif1_resources,
216 .num_resources = ARRAY_SIZE(scif1_resources),
209 .dev = { 217 .dev = {
210 .platform_data = &scif1_platform_data, 218 .platform_data = &scif1_platform_data,
211 }, 219 },
212}; 220};
213 221
214static struct plat_sci_port scif2_platform_data = { 222static struct plat_sci_port scif2_platform_data = {
215 .mapbase = 0xfffe9000,
216 .flags = UPF_BOOT_AUTOCONF, 223 .flags = UPF_BOOT_AUTOCONF,
217 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 224 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
218 .scbrr_algo_id = SCBRR_ALGO_2,
219 .type = PORT_SCIF, 225 .type = PORT_SCIF,
220 .irqs = SCIx_IRQ_MUXED(188), 226};
227
228static struct resource scif2_resources[] = {
229 DEFINE_RES_MEM(0xfffe9000, 0x100),
230 DEFINE_RES_IRQ(188),
221}; 231};
222 232
223static struct platform_device scif2_device = { 233static struct platform_device scif2_device = {
224 .name = "sh-sci", 234 .name = "sh-sci",
225 .id = 2, 235 .id = 2,
236 .resource = scif2_resources,
237 .num_resources = ARRAY_SIZE(scif2_resources),
226 .dev = { 238 .dev = {
227 .platform_data = &scif2_platform_data, 239 .platform_data = &scif2_platform_data,
228 }, 240 },
229}; 241};
230 242
231static struct plat_sci_port scif3_platform_data = { 243static struct plat_sci_port scif3_platform_data = {
232 .mapbase = 0xfffe9800,
233 .flags = UPF_BOOT_AUTOCONF, 244 .flags = UPF_BOOT_AUTOCONF,
234 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 245 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
235 .scbrr_algo_id = SCBRR_ALGO_2,
236 .type = PORT_SCIF, 246 .type = PORT_SCIF,
237 .irqs = SCIx_IRQ_MUXED(192), 247};
248
249static struct resource scif3_resources[] = {
250 DEFINE_RES_MEM(0xfffe9800, 0x100),
251 DEFINE_RES_IRQ(192),
238}; 252};
239 253
240static struct platform_device scif3_device = { 254static struct platform_device scif3_device = {
241 .name = "sh-sci", 255 .name = "sh-sci",
242 .id = 3, 256 .id = 3,
257 .resource = scif3_resources,
258 .num_resources = ARRAY_SIZE(scif3_resources),
243 .dev = { 259 .dev = {
244 .platform_data = &scif3_platform_data, 260 .platform_data = &scif3_platform_data,
245 }, 261 },
246}; 262};
247 263
248static struct plat_sci_port scif4_platform_data = { 264static struct plat_sci_port scif4_platform_data = {
249 .mapbase = 0xfffea000,
250 .flags = UPF_BOOT_AUTOCONF, 265 .flags = UPF_BOOT_AUTOCONF,
251 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 266 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
252 .scbrr_algo_id = SCBRR_ALGO_2,
253 .type = PORT_SCIF, 267 .type = PORT_SCIF,
254 .irqs = SCIx_IRQ_MUXED(196), 268};
269
270static struct resource scif4_resources[] = {
271 DEFINE_RES_MEM(0xfffea000, 0x100),
272 DEFINE_RES_IRQ(196),
255}; 273};
256 274
257static struct platform_device scif4_device = { 275static struct platform_device scif4_device = {
258 .name = "sh-sci", 276 .name = "sh-sci",
259 .id = 4, 277 .id = 4,
278 .resource = scif4_resources,
279 .num_resources = ARRAY_SIZE(scif4_resources),
260 .dev = { 280 .dev = {
261 .platform_data = &scif4_platform_data, 281 .platform_data = &scif4_platform_data,
262 }, 282 },
263}; 283};
264 284
265static struct plat_sci_port scif5_platform_data = { 285static struct plat_sci_port scif5_platform_data = {
266 .mapbase = 0xfffea800,
267 .flags = UPF_BOOT_AUTOCONF, 286 .flags = UPF_BOOT_AUTOCONF,
268 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 287 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
269 .scbrr_algo_id = SCBRR_ALGO_2,
270 .type = PORT_SCIF, 288 .type = PORT_SCIF,
271 .irqs = SCIx_IRQ_MUXED(200), 289};
290
291static struct resource scif5_resources[] = {
292 DEFINE_RES_MEM(0xfffea800, 0x100),
293 DEFINE_RES_IRQ(200),
272}; 294};
273 295
274static struct platform_device scif5_device = { 296static struct platform_device scif5_device = {
275 .name = "sh-sci", 297 .name = "sh-sci",
276 .id = 5, 298 .id = 5,
299 .resource = scif5_resources,
300 .num_resources = ARRAY_SIZE(scif5_resources),
277 .dev = { 301 .dev = {
278 .platform_data = &scif5_platform_data, 302 .platform_data = &scif5_platform_data,
279 }, 303 },
280}; 304};
281 305
282static struct plat_sci_port scif6_platform_data = { 306static struct plat_sci_port scif6_platform_data = {
283 .mapbase = 0xfffeb000,
284 .flags = UPF_BOOT_AUTOCONF, 307 .flags = UPF_BOOT_AUTOCONF,
285 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 308 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
286 .scbrr_algo_id = SCBRR_ALGO_2,
287 .type = PORT_SCIF, 309 .type = PORT_SCIF,
288 .irqs = SCIx_IRQ_MUXED(204), 310};
311
312static struct resource scif6_resources[] = {
313 DEFINE_RES_MEM(0xfffeb000, 0x100),
314 DEFINE_RES_IRQ(204),
289}; 315};
290 316
291static struct platform_device scif6_device = { 317static struct platform_device scif6_device = {
292 .name = "sh-sci", 318 .name = "sh-sci",
293 .id = 6, 319 .id = 6,
320 .resource = scif6_resources,
321 .num_resources = ARRAY_SIZE(scif6_resources),
294 .dev = { 322 .dev = {
295 .platform_data = &scif6_platform_data, 323 .platform_data = &scif6_platform_data,
296 }, 324 },
297}; 325};
298 326
299static struct plat_sci_port scif7_platform_data = { 327static struct plat_sci_port scif7_platform_data = {
300 .mapbase = 0xfffeb800,
301 .flags = UPF_BOOT_AUTOCONF, 328 .flags = UPF_BOOT_AUTOCONF,
302 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 329 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
303 .scbrr_algo_id = SCBRR_ALGO_2,
304 .type = PORT_SCIF, 330 .type = PORT_SCIF,
305 .irqs = SCIx_IRQ_MUXED(208), 331};
332
333static struct resource scif7_resources[] = {
334 DEFINE_RES_MEM(0xfffeb800, 0x100),
335 DEFINE_RES_IRQ(208),
306}; 336};
307 337
308static struct platform_device scif7_device = { 338static struct platform_device scif7_device = {
309 .name = "sh-sci", 339 .name = "sh-sci",
310 .id = 7, 340 .id = 7,
341 .resource = scif7_resources,
342 .num_resources = ARRAY_SIZE(scif7_resources),
311 .dev = { 343 .dev = {
312 .platform_data = &scif7_platform_data, 344 .platform_data = &scif7_platform_data,
313 }, 345 },
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
index bfc33f6a28c3..d55a0f30ada3 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
@@ -174,76 +174,92 @@ static DECLARE_INTC_DESC(intc_desc, "sh7203", vectors, groups,
174 mask_registers, prio_registers, NULL); 174 mask_registers, prio_registers, NULL);
175 175
176static struct plat_sci_port scif0_platform_data = { 176static struct plat_sci_port scif0_platform_data = {
177 .mapbase = 0xfffe8000,
178 .flags = UPF_BOOT_AUTOCONF, 177 .flags = UPF_BOOT_AUTOCONF,
179 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 178 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
180 SCSCR_REIE, 179 SCSCR_REIE,
181 .scbrr_algo_id = SCBRR_ALGO_2,
182 .type = PORT_SCIF, 180 .type = PORT_SCIF,
183 .irqs = SCIx_IRQ_MUXED(192),
184 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 181 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
185}; 182};
186 183
184static struct resource scif0_resources[] = {
185 DEFINE_RES_MEM(0xfffe8000, 0x100),
186 DEFINE_RES_IRQ(192),
187};
188
187static struct platform_device scif0_device = { 189static struct platform_device scif0_device = {
188 .name = "sh-sci", 190 .name = "sh-sci",
189 .id = 0, 191 .id = 0,
192 .resource = scif0_resources,
193 .num_resources = ARRAY_SIZE(scif0_resources),
190 .dev = { 194 .dev = {
191 .platform_data = &scif0_platform_data, 195 .platform_data = &scif0_platform_data,
192 }, 196 },
193}; 197};
194 198
195static struct plat_sci_port scif1_platform_data = { 199static struct plat_sci_port scif1_platform_data = {
196 .mapbase = 0xfffe8800,
197 .flags = UPF_BOOT_AUTOCONF, 200 .flags = UPF_BOOT_AUTOCONF,
198 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 201 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
199 SCSCR_REIE, 202 SCSCR_REIE,
200 .scbrr_algo_id = SCBRR_ALGO_2,
201 .type = PORT_SCIF, 203 .type = PORT_SCIF,
202 .irqs = SCIx_IRQ_MUXED(196),
203 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 204 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
204}; 205};
205 206
207static struct resource scif1_resources[] = {
208 DEFINE_RES_MEM(0xfffe8800, 0x100),
209 DEFINE_RES_IRQ(196),
210};
211
206static struct platform_device scif1_device = { 212static struct platform_device scif1_device = {
207 .name = "sh-sci", 213 .name = "sh-sci",
208 .id = 1, 214 .id = 1,
215 .resource = scif1_resources,
216 .num_resources = ARRAY_SIZE(scif1_resources),
209 .dev = { 217 .dev = {
210 .platform_data = &scif1_platform_data, 218 .platform_data = &scif1_platform_data,
211 }, 219 },
212}; 220};
213 221
214static struct plat_sci_port scif2_platform_data = { 222static struct plat_sci_port scif2_platform_data = {
215 .mapbase = 0xfffe9000,
216 .flags = UPF_BOOT_AUTOCONF, 223 .flags = UPF_BOOT_AUTOCONF,
217 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 224 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
218 SCSCR_REIE, 225 SCSCR_REIE,
219 .scbrr_algo_id = SCBRR_ALGO_2,
220 .type = PORT_SCIF, 226 .type = PORT_SCIF,
221 .irqs = SCIx_IRQ_MUXED(200),
222 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 227 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
223}; 228};
224 229
230static struct resource scif2_resources[] = {
231 DEFINE_RES_MEM(0xfffe9000, 0x100),
232 DEFINE_RES_IRQ(200),
233};
234
225static struct platform_device scif2_device = { 235static struct platform_device scif2_device = {
226 .name = "sh-sci", 236 .name = "sh-sci",
227 .id = 2, 237 .id = 2,
238 .resource = scif2_resources,
239 .num_resources = ARRAY_SIZE(scif2_resources),
228 .dev = { 240 .dev = {
229 .platform_data = &scif2_platform_data, 241 .platform_data = &scif2_platform_data,
230 }, 242 },
231}; 243};
232 244
233static struct plat_sci_port scif3_platform_data = { 245static struct plat_sci_port scif3_platform_data = {
234 .mapbase = 0xfffe9800,
235 .flags = UPF_BOOT_AUTOCONF, 246 .flags = UPF_BOOT_AUTOCONF,
236 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 247 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
237 SCSCR_REIE, 248 SCSCR_REIE,
238 .scbrr_algo_id = SCBRR_ALGO_2,
239 .type = PORT_SCIF, 249 .type = PORT_SCIF,
240 .irqs = SCIx_IRQ_MUXED(204),
241 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 250 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
242}; 251};
243 252
253static struct resource scif3_resources[] = {
254 DEFINE_RES_MEM(0xfffe9800, 0x100),
255 DEFINE_RES_IRQ(204),
256};
257
244static struct platform_device scif3_device = { 258static struct platform_device scif3_device = {
245 .name = "sh-sci", 259 .name = "sh-sci",
246 .id = 3, 260 .id = 3,
261 .resource = scif3_resources,
262 .num_resources = ARRAY_SIZE(scif3_resources),
247 .dev = { 263 .dev = {
248 .platform_data = &scif3_platform_data, 264 .platform_data = &scif3_platform_data,
249 }, 265 },
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
index a5010741de85..241e745e3ced 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
@@ -134,68 +134,84 @@ static DECLARE_INTC_DESC(intc_desc, "sh7206", vectors, groups,
134 mask_registers, prio_registers, NULL); 134 mask_registers, prio_registers, NULL);
135 135
136static struct plat_sci_port scif0_platform_data = { 136static struct plat_sci_port scif0_platform_data = {
137 .mapbase = 0xfffe8000,
138 .flags = UPF_BOOT_AUTOCONF, 137 .flags = UPF_BOOT_AUTOCONF,
139 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 138 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
140 .scbrr_algo_id = SCBRR_ALGO_2,
141 .type = PORT_SCIF, 139 .type = PORT_SCIF,
142 .irqs = SCIx_IRQ_MUXED(240), 140};
141
142static struct resource scif0_resources[] = {
143 DEFINE_RES_MEM(0xfffe8000, 0x100),
144 DEFINE_RES_IRQ(240),
143}; 145};
144 146
145static struct platform_device scif0_device = { 147static struct platform_device scif0_device = {
146 .name = "sh-sci", 148 .name = "sh-sci",
147 .id = 0, 149 .id = 0,
150 .resource = scif0_resources,
151 .num_resources = ARRAY_SIZE(scif0_resources),
148 .dev = { 152 .dev = {
149 .platform_data = &scif0_platform_data, 153 .platform_data = &scif0_platform_data,
150 }, 154 },
151}; 155};
152 156
153static struct plat_sci_port scif1_platform_data = { 157static struct plat_sci_port scif1_platform_data = {
154 .mapbase = 0xfffe8800,
155 .flags = UPF_BOOT_AUTOCONF, 158 .flags = UPF_BOOT_AUTOCONF,
156 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 159 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
157 .scbrr_algo_id = SCBRR_ALGO_2,
158 .type = PORT_SCIF, 160 .type = PORT_SCIF,
159 .irqs = SCIx_IRQ_MUXED(244), 161};
162
163static struct resource scif1_resources[] = {
164 DEFINE_RES_MEM(0xfffe8800, 0x100),
165 DEFINE_RES_IRQ(244),
160}; 166};
161 167
162static struct platform_device scif1_device = { 168static struct platform_device scif1_device = {
163 .name = "sh-sci", 169 .name = "sh-sci",
164 .id = 1, 170 .id = 1,
171 .resource = scif1_resources,
172 .num_resources = ARRAY_SIZE(scif1_resources),
165 .dev = { 173 .dev = {
166 .platform_data = &scif1_platform_data, 174 .platform_data = &scif1_platform_data,
167 }, 175 },
168}; 176};
169 177
170static struct plat_sci_port scif2_platform_data = { 178static struct plat_sci_port scif2_platform_data = {
171 .mapbase = 0xfffe9000,
172 .flags = UPF_BOOT_AUTOCONF, 179 .flags = UPF_BOOT_AUTOCONF,
173 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 180 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
174 .scbrr_algo_id = SCBRR_ALGO_2,
175 .type = PORT_SCIF, 181 .type = PORT_SCIF,
176 .irqs = SCIx_IRQ_MUXED(248), 182};
183
184static struct resource scif2_resources[] = {
185 DEFINE_RES_MEM(0xfffe9000, 0x100),
186 DEFINE_RES_IRQ(248),
177}; 187};
178 188
179static struct platform_device scif2_device = { 189static struct platform_device scif2_device = {
180 .name = "sh-sci", 190 .name = "sh-sci",
181 .id = 2, 191 .id = 2,
192 .resource = scif2_resources,
193 .num_resources = ARRAY_SIZE(scif2_resources),
182 .dev = { 194 .dev = {
183 .platform_data = &scif2_platform_data, 195 .platform_data = &scif2_platform_data,
184 }, 196 },
185}; 197};
186 198
187static struct plat_sci_port scif3_platform_data = { 199static struct plat_sci_port scif3_platform_data = {
188 .mapbase = 0xfffe9800,
189 .flags = UPF_BOOT_AUTOCONF, 200 .flags = UPF_BOOT_AUTOCONF,
190 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 201 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
191 .scbrr_algo_id = SCBRR_ALGO_2,
192 .type = PORT_SCIF, 202 .type = PORT_SCIF,
193 .irqs = SCIx_IRQ_MUXED(252), 203};
204
205static struct resource scif3_resources[] = {
206 DEFINE_RES_MEM(0xfffe9800, 0x100),
207 DEFINE_RES_IRQ(252),
194}; 208};
195 209
196static struct platform_device scif3_device = { 210static struct platform_device scif3_device = {
197 .name = "sh-sci", 211 .name = "sh-sci",
198 .id = 3, 212 .id = 3,
213 .resource = scif3_resources,
214 .num_resources = ARRAY_SIZE(scif3_resources),
199 .dev = { 215 .dev = {
200 .platform_data = &scif3_platform_data, 216 .platform_data = &scif3_platform_data,
201 }, 217 },
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
index ce5c1b5aebfa..ad5b0f429882 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
@@ -226,152 +226,208 @@ static DECLARE_INTC_DESC(intc_desc, "sh7264", vectors, groups,
226 mask_registers, prio_registers, NULL); 226 mask_registers, prio_registers, NULL);
227 227
228static struct plat_sci_port scif0_platform_data = { 228static struct plat_sci_port scif0_platform_data = {
229 .mapbase = 0xfffe8000,
230 .flags = UPF_BOOT_AUTOCONF, 229 .flags = UPF_BOOT_AUTOCONF,
231 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 230 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
232 SCSCR_REIE | SCSCR_TOIE, 231 SCSCR_REIE | SCSCR_TOIE,
233 .scbrr_algo_id = SCBRR_ALGO_2,
234 .type = PORT_SCIF, 232 .type = PORT_SCIF,
235 .irqs = { 233, 234, 235, 232 },
236 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 233 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
237}; 234};
238 235
236static struct resource scif0_resources[] = {
237 DEFINE_RES_MEM(0xfffe8000, 0x100),
238 DEFINE_RES_IRQ(233),
239 DEFINE_RES_IRQ(234),
240 DEFINE_RES_IRQ(235),
241 DEFINE_RES_IRQ(232),
242};
243
239static struct platform_device scif0_device = { 244static struct platform_device scif0_device = {
240 .name = "sh-sci", 245 .name = "sh-sci",
241 .id = 0, 246 .id = 0,
247 .resource = scif0_resources,
248 .num_resources = ARRAY_SIZE(scif0_resources),
242 .dev = { 249 .dev = {
243 .platform_data = &scif0_platform_data, 250 .platform_data = &scif0_platform_data,
244 }, 251 },
245}; 252};
246 253
247static struct plat_sci_port scif1_platform_data = { 254static struct plat_sci_port scif1_platform_data = {
248 .mapbase = 0xfffe8800,
249 .flags = UPF_BOOT_AUTOCONF, 255 .flags = UPF_BOOT_AUTOCONF,
250 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 256 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
251 SCSCR_REIE | SCSCR_TOIE, 257 SCSCR_REIE | SCSCR_TOIE,
252 .scbrr_algo_id = SCBRR_ALGO_2,
253 .type = PORT_SCIF, 258 .type = PORT_SCIF,
254 .irqs = { 237, 238, 239, 236 },
255 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 259 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
256}; 260};
257 261
262static struct resource scif1_resources[] = {
263 DEFINE_RES_MEM(0xfffe8800, 0x100),
264 DEFINE_RES_IRQ(237),
265 DEFINE_RES_IRQ(238),
266 DEFINE_RES_IRQ(239),
267 DEFINE_RES_IRQ(236),
268};
269
258static struct platform_device scif1_device = { 270static struct platform_device scif1_device = {
259 .name = "sh-sci", 271 .name = "sh-sci",
260 .id = 1, 272 .id = 1,
273 .resource = scif1_resources,
274 .num_resources = ARRAY_SIZE(scif1_resources),
261 .dev = { 275 .dev = {
262 .platform_data = &scif1_platform_data, 276 .platform_data = &scif1_platform_data,
263 }, 277 },
264}; 278};
265 279
266static struct plat_sci_port scif2_platform_data = { 280static struct plat_sci_port scif2_platform_data = {
267 .mapbase = 0xfffe9000,
268 .flags = UPF_BOOT_AUTOCONF, 281 .flags = UPF_BOOT_AUTOCONF,
269 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 282 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
270 SCSCR_REIE | SCSCR_TOIE, 283 SCSCR_REIE | SCSCR_TOIE,
271 .scbrr_algo_id = SCBRR_ALGO_2,
272 .type = PORT_SCIF, 284 .type = PORT_SCIF,
273 .irqs = { 241, 242, 243, 240 },
274 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 285 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
275}; 286};
276 287
288static struct resource scif2_resources[] = {
289 DEFINE_RES_MEM(0xfffe9000, 0x100),
290 DEFINE_RES_IRQ(241),
291 DEFINE_RES_IRQ(242),
292 DEFINE_RES_IRQ(243),
293 DEFINE_RES_IRQ(240),
294};
295
277static struct platform_device scif2_device = { 296static struct platform_device scif2_device = {
278 .name = "sh-sci", 297 .name = "sh-sci",
279 .id = 2, 298 .id = 2,
299 .resource = scif2_resources,
300 .num_resources = ARRAY_SIZE(scif2_resources),
280 .dev = { 301 .dev = {
281 .platform_data = &scif2_platform_data, 302 .platform_data = &scif2_platform_data,
282 }, 303 },
283}; 304};
284 305
285static struct plat_sci_port scif3_platform_data = { 306static struct plat_sci_port scif3_platform_data = {
286 .mapbase = 0xfffe9800,
287 .flags = UPF_BOOT_AUTOCONF, 307 .flags = UPF_BOOT_AUTOCONF,
288 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 308 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
289 SCSCR_REIE | SCSCR_TOIE, 309 SCSCR_REIE | SCSCR_TOIE,
290 .scbrr_algo_id = SCBRR_ALGO_2,
291 .type = PORT_SCIF, 310 .type = PORT_SCIF,
292 .irqs = { 245, 246, 247, 244 },
293 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 311 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
294}; 312};
295 313
314static struct resource scif3_resources[] = {
315 DEFINE_RES_MEM(0xfffe9800, 0x100),
316 DEFINE_RES_IRQ(245),
317 DEFINE_RES_IRQ(246),
318 DEFINE_RES_IRQ(247),
319 DEFINE_RES_IRQ(244),
320};
321
296static struct platform_device scif3_device = { 322static struct platform_device scif3_device = {
297 .name = "sh-sci", 323 .name = "sh-sci",
298 .id = 3, 324 .id = 3,
325 .resource = scif3_resources,
326 .num_resources = ARRAY_SIZE(scif3_resources),
299 .dev = { 327 .dev = {
300 .platform_data = &scif3_platform_data, 328 .platform_data = &scif3_platform_data,
301 }, 329 },
302}; 330};
303 331
304static struct plat_sci_port scif4_platform_data = { 332static struct plat_sci_port scif4_platform_data = {
305 .mapbase = 0xfffea000,
306 .flags = UPF_BOOT_AUTOCONF, 333 .flags = UPF_BOOT_AUTOCONF,
307 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 334 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
308 SCSCR_REIE | SCSCR_TOIE, 335 SCSCR_REIE | SCSCR_TOIE,
309 .scbrr_algo_id = SCBRR_ALGO_2,
310 .type = PORT_SCIF, 336 .type = PORT_SCIF,
311 .irqs = { 249, 250, 251, 248 },
312 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 337 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
313}; 338};
314 339
340static struct resource scif4_resources[] = {
341 DEFINE_RES_MEM(0xfffea000, 0x100),
342 DEFINE_RES_IRQ(249),
343 DEFINE_RES_IRQ(250),
344 DEFINE_RES_IRQ(251),
345 DEFINE_RES_IRQ(248),
346};
347
315static struct platform_device scif4_device = { 348static struct platform_device scif4_device = {
316 .name = "sh-sci", 349 .name = "sh-sci",
317 .id = 4, 350 .id = 4,
351 .resource = scif4_resources,
352 .num_resources = ARRAY_SIZE(scif4_resources),
318 .dev = { 353 .dev = {
319 .platform_data = &scif4_platform_data, 354 .platform_data = &scif4_platform_data,
320 }, 355 },
321}; 356};
322 357
323static struct plat_sci_port scif5_platform_data = { 358static struct plat_sci_port scif5_platform_data = {
324 .mapbase = 0xfffea800,
325 .flags = UPF_BOOT_AUTOCONF, 359 .flags = UPF_BOOT_AUTOCONF,
326 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 360 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
327 SCSCR_REIE | SCSCR_TOIE, 361 SCSCR_REIE | SCSCR_TOIE,
328 .scbrr_algo_id = SCBRR_ALGO_2,
329 .type = PORT_SCIF, 362 .type = PORT_SCIF,
330 .irqs = { 253, 254, 255, 252 },
331 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 363 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
332}; 364};
333 365
366static struct resource scif5_resources[] = {
367 DEFINE_RES_MEM(0xfffea800, 0x100),
368 DEFINE_RES_IRQ(253),
369 DEFINE_RES_IRQ(254),
370 DEFINE_RES_IRQ(255),
371 DEFINE_RES_IRQ(252),
372};
373
334static struct platform_device scif5_device = { 374static struct platform_device scif5_device = {
335 .name = "sh-sci", 375 .name = "sh-sci",
336 .id = 5, 376 .id = 5,
377 .resource = scif5_resources,
378 .num_resources = ARRAY_SIZE(scif5_resources),
337 .dev = { 379 .dev = {
338 .platform_data = &scif5_platform_data, 380 .platform_data = &scif5_platform_data,
339 }, 381 },
340}; 382};
341 383
342static struct plat_sci_port scif6_platform_data = { 384static struct plat_sci_port scif6_platform_data = {
343 .mapbase = 0xfffeb000,
344 .flags = UPF_BOOT_AUTOCONF, 385 .flags = UPF_BOOT_AUTOCONF,
345 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 386 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
346 SCSCR_REIE | SCSCR_TOIE, 387 SCSCR_REIE | SCSCR_TOIE,
347 .scbrr_algo_id = SCBRR_ALGO_2,
348 .type = PORT_SCIF, 388 .type = PORT_SCIF,
349 .irqs = { 257, 258, 259, 256 },
350 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 389 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
351}; 390};
352 391
392static struct resource scif6_resources[] = {
393 DEFINE_RES_MEM(0xfffeb000, 0x100),
394 DEFINE_RES_IRQ(257),
395 DEFINE_RES_IRQ(258),
396 DEFINE_RES_IRQ(259),
397 DEFINE_RES_IRQ(256),
398};
399
353static struct platform_device scif6_device = { 400static struct platform_device scif6_device = {
354 .name = "sh-sci", 401 .name = "sh-sci",
355 .id = 6, 402 .id = 6,
403 .resource = scif6_resources,
404 .num_resources = ARRAY_SIZE(scif6_resources),
356 .dev = { 405 .dev = {
357 .platform_data = &scif6_platform_data, 406 .platform_data = &scif6_platform_data,
358 }, 407 },
359}; 408};
360 409
361static struct plat_sci_port scif7_platform_data = { 410static struct plat_sci_port scif7_platform_data = {
362 .mapbase = 0xfffeb800,
363 .flags = UPF_BOOT_AUTOCONF, 411 .flags = UPF_BOOT_AUTOCONF,
364 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 412 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
365 SCSCR_REIE | SCSCR_TOIE, 413 SCSCR_REIE | SCSCR_TOIE,
366 .scbrr_algo_id = SCBRR_ALGO_2,
367 .type = PORT_SCIF, 414 .type = PORT_SCIF,
368 .irqs = { 261, 262, 263, 260 },
369 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 415 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
370}; 416};
371 417
418static struct resource scif7_resources[] = {
419 DEFINE_RES_MEM(0xfffeb800, 0x100),
420 DEFINE_RES_IRQ(261),
421 DEFINE_RES_IRQ(262),
422 DEFINE_RES_IRQ(263),
423 DEFINE_RES_IRQ(260),
424};
425
372static struct platform_device scif7_device = { 426static struct platform_device scif7_device = {
373 .name = "sh-sci", 427 .name = "sh-sci",
374 .id = 7, 428 .id = 7,
429 .resource = scif7_resources,
430 .num_resources = ARRAY_SIZE(scif7_resources),
375 .dev = { 431 .dev = {
376 .platform_data = &scif7_platform_data, 432 .platform_data = &scif7_platform_data,
377 }, 433 },
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
index e82ae9d8d3bc..3995119f65dc 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
@@ -248,152 +248,208 @@ static DECLARE_INTC_DESC(intc_desc, "sh7269", vectors, groups,
248 mask_registers, prio_registers, NULL); 248 mask_registers, prio_registers, NULL);
249 249
250static struct plat_sci_port scif0_platform_data = { 250static struct plat_sci_port scif0_platform_data = {
251 .mapbase = 0xe8007000,
252 .flags = UPF_BOOT_AUTOCONF, 251 .flags = UPF_BOOT_AUTOCONF,
253 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 252 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
254 SCSCR_REIE | SCSCR_TOIE, 253 SCSCR_REIE | SCSCR_TOIE,
255 .scbrr_algo_id = SCBRR_ALGO_2,
256 .type = PORT_SCIF, 254 .type = PORT_SCIF,
257 .irqs = { 259, 260, 261, 258 },
258 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 255 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
259}; 256};
260 257
258static struct resource scif0_resources[] = {
259 DEFINE_RES_MEM(0xe8007000, 0x100),
260 DEFINE_RES_IRQ(259),
261 DEFINE_RES_IRQ(260),
262 DEFINE_RES_IRQ(261),
263 DEFINE_RES_IRQ(258),
264};
265
261static struct platform_device scif0_device = { 266static struct platform_device scif0_device = {
262 .name = "sh-sci", 267 .name = "sh-sci",
263 .id = 0, 268 .id = 0,
269 .resource = scif0_resources,
270 .num_resources = ARRAY_SIZE(scif0_resources),
264 .dev = { 271 .dev = {
265 .platform_data = &scif0_platform_data, 272 .platform_data = &scif0_platform_data,
266 }, 273 },
267}; 274};
268 275
269static struct plat_sci_port scif1_platform_data = { 276static struct plat_sci_port scif1_platform_data = {
270 .mapbase = 0xe8007800,
271 .flags = UPF_BOOT_AUTOCONF, 277 .flags = UPF_BOOT_AUTOCONF,
272 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 278 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
273 SCSCR_REIE | SCSCR_TOIE, 279 SCSCR_REIE | SCSCR_TOIE,
274 .scbrr_algo_id = SCBRR_ALGO_2,
275 .type = PORT_SCIF, 280 .type = PORT_SCIF,
276 .irqs = { 263, 264, 265, 262 },
277 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 281 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
278}; 282};
279 283
284static struct resource scif1_resources[] = {
285 DEFINE_RES_MEM(0xe8007800, 0x100),
286 DEFINE_RES_IRQ(263),
287 DEFINE_RES_IRQ(264),
288 DEFINE_RES_IRQ(265),
289 DEFINE_RES_IRQ(262),
290};
291
280static struct platform_device scif1_device = { 292static struct platform_device scif1_device = {
281 .name = "sh-sci", 293 .name = "sh-sci",
282 .id = 1, 294 .id = 1,
295 .resource = scif1_resources,
296 .num_resources = ARRAY_SIZE(scif1_resources),
283 .dev = { 297 .dev = {
284 .platform_data = &scif1_platform_data, 298 .platform_data = &scif1_platform_data,
285 }, 299 },
286}; 300};
287 301
288static struct plat_sci_port scif2_platform_data = { 302static struct plat_sci_port scif2_platform_data = {
289 .mapbase = 0xe8008000,
290 .flags = UPF_BOOT_AUTOCONF, 303 .flags = UPF_BOOT_AUTOCONF,
291 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 304 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
292 SCSCR_REIE | SCSCR_TOIE, 305 SCSCR_REIE | SCSCR_TOIE,
293 .scbrr_algo_id = SCBRR_ALGO_2,
294 .type = PORT_SCIF, 306 .type = PORT_SCIF,
295 .irqs = { 267, 268, 269, 266 },
296 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 307 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
297}; 308};
298 309
310static struct resource scif2_resources[] = {
311 DEFINE_RES_MEM(0xe8008000, 0x100),
312 DEFINE_RES_IRQ(267),
313 DEFINE_RES_IRQ(268),
314 DEFINE_RES_IRQ(269),
315 DEFINE_RES_IRQ(266),
316};
317
299static struct platform_device scif2_device = { 318static struct platform_device scif2_device = {
300 .name = "sh-sci", 319 .name = "sh-sci",
301 .id = 2, 320 .id = 2,
321 .resource = scif2_resources,
322 .num_resources = ARRAY_SIZE(scif2_resources),
302 .dev = { 323 .dev = {
303 .platform_data = &scif2_platform_data, 324 .platform_data = &scif2_platform_data,
304 }, 325 },
305}; 326};
306 327
307static struct plat_sci_port scif3_platform_data = { 328static struct plat_sci_port scif3_platform_data = {
308 .mapbase = 0xe8008800,
309 .flags = UPF_BOOT_AUTOCONF, 329 .flags = UPF_BOOT_AUTOCONF,
310 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 330 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
311 SCSCR_REIE | SCSCR_TOIE, 331 SCSCR_REIE | SCSCR_TOIE,
312 .scbrr_algo_id = SCBRR_ALGO_2,
313 .type = PORT_SCIF, 332 .type = PORT_SCIF,
314 .irqs = { 271, 272, 273, 270 },
315 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 333 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
316}; 334};
317 335
336static struct resource scif3_resources[] = {
337 DEFINE_RES_MEM(0xe8008800, 0x100),
338 DEFINE_RES_IRQ(271),
339 DEFINE_RES_IRQ(272),
340 DEFINE_RES_IRQ(273),
341 DEFINE_RES_IRQ(270),
342};
343
318static struct platform_device scif3_device = { 344static struct platform_device scif3_device = {
319 .name = "sh-sci", 345 .name = "sh-sci",
320 .id = 3, 346 .id = 3,
347 .resource = scif3_resources,
348 .num_resources = ARRAY_SIZE(scif3_resources),
321 .dev = { 349 .dev = {
322 .platform_data = &scif3_platform_data, 350 .platform_data = &scif3_platform_data,
323 }, 351 },
324}; 352};
325 353
326static struct plat_sci_port scif4_platform_data = { 354static struct plat_sci_port scif4_platform_data = {
327 .mapbase = 0xe8009000,
328 .flags = UPF_BOOT_AUTOCONF, 355 .flags = UPF_BOOT_AUTOCONF,
329 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 356 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
330 SCSCR_REIE | SCSCR_TOIE, 357 SCSCR_REIE | SCSCR_TOIE,
331 .scbrr_algo_id = SCBRR_ALGO_2,
332 .type = PORT_SCIF, 358 .type = PORT_SCIF,
333 .irqs = { 275, 276, 277, 274 },
334 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 359 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
335}; 360};
336 361
362static struct resource scif4_resources[] = {
363 DEFINE_RES_MEM(0xe8009000, 0x100),
364 DEFINE_RES_IRQ(275),
365 DEFINE_RES_IRQ(276),
366 DEFINE_RES_IRQ(277),
367 DEFINE_RES_IRQ(274),
368};
369
337static struct platform_device scif4_device = { 370static struct platform_device scif4_device = {
338 .name = "sh-sci", 371 .name = "sh-sci",
339 .id = 4, 372 .id = 4,
373 .resource = scif4_resources,
374 .num_resources = ARRAY_SIZE(scif4_resources),
340 .dev = { 375 .dev = {
341 .platform_data = &scif4_platform_data, 376 .platform_data = &scif4_platform_data,
342 }, 377 },
343}; 378};
344 379
345static struct plat_sci_port scif5_platform_data = { 380static struct plat_sci_port scif5_platform_data = {
346 .mapbase = 0xe8009800,
347 .flags = UPF_BOOT_AUTOCONF, 381 .flags = UPF_BOOT_AUTOCONF,
348 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 382 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
349 SCSCR_REIE | SCSCR_TOIE, 383 SCSCR_REIE | SCSCR_TOIE,
350 .scbrr_algo_id = SCBRR_ALGO_2,
351 .type = PORT_SCIF, 384 .type = PORT_SCIF,
352 .irqs = { 279, 280, 281, 278 },
353 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 385 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
354}; 386};
355 387
388static struct resource scif5_resources[] = {
389 DEFINE_RES_MEM(0xe8009800, 0x100),
390 DEFINE_RES_IRQ(279),
391 DEFINE_RES_IRQ(280),
392 DEFINE_RES_IRQ(281),
393 DEFINE_RES_IRQ(278),
394};
395
356static struct platform_device scif5_device = { 396static struct platform_device scif5_device = {
357 .name = "sh-sci", 397 .name = "sh-sci",
358 .id = 5, 398 .id = 5,
399 .resource = scif5_resources,
400 .num_resources = ARRAY_SIZE(scif5_resources),
359 .dev = { 401 .dev = {
360 .platform_data = &scif5_platform_data, 402 .platform_data = &scif5_platform_data,
361 }, 403 },
362}; 404};
363 405
364static struct plat_sci_port scif6_platform_data = { 406static struct plat_sci_port scif6_platform_data = {
365 .mapbase = 0xe800a000,
366 .flags = UPF_BOOT_AUTOCONF, 407 .flags = UPF_BOOT_AUTOCONF,
367 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 408 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
368 SCSCR_REIE | SCSCR_TOIE, 409 SCSCR_REIE | SCSCR_TOIE,
369 .scbrr_algo_id = SCBRR_ALGO_2,
370 .type = PORT_SCIF, 410 .type = PORT_SCIF,
371 .irqs = { 283, 284, 285, 282 },
372 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 411 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
373}; 412};
374 413
414static struct resource scif6_resources[] = {
415 DEFINE_RES_MEM(0xe800a000, 0x100),
416 DEFINE_RES_IRQ(283),
417 DEFINE_RES_IRQ(284),
418 DEFINE_RES_IRQ(285),
419 DEFINE_RES_IRQ(282),
420};
421
375static struct platform_device scif6_device = { 422static struct platform_device scif6_device = {
376 .name = "sh-sci", 423 .name = "sh-sci",
377 .id = 6, 424 .id = 6,
425 .resource = scif6_resources,
426 .num_resources = ARRAY_SIZE(scif6_resources),
378 .dev = { 427 .dev = {
379 .platform_data = &scif6_platform_data, 428 .platform_data = &scif6_platform_data,
380 }, 429 },
381}; 430};
382 431
383static struct plat_sci_port scif7_platform_data = { 432static struct plat_sci_port scif7_platform_data = {
384 .mapbase = 0xe800a800,
385 .flags = UPF_BOOT_AUTOCONF, 433 .flags = UPF_BOOT_AUTOCONF,
386 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | 434 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
387 SCSCR_REIE | SCSCR_TOIE, 435 SCSCR_REIE | SCSCR_TOIE,
388 .scbrr_algo_id = SCBRR_ALGO_2,
389 .type = PORT_SCIF, 436 .type = PORT_SCIF,
390 .irqs = { 287, 288, 289, 286 },
391 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, 437 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
392}; 438};
393 439
440static struct resource scif7_resources[] = {
441 DEFINE_RES_MEM(0xe800a800, 0x100),
442 DEFINE_RES_IRQ(287),
443 DEFINE_RES_IRQ(288),
444 DEFINE_RES_IRQ(289),
445 DEFINE_RES_IRQ(286),
446};
447
394static struct platform_device scif7_device = { 448static struct platform_device scif7_device = {
395 .name = "sh-sci", 449 .name = "sh-sci",
396 .id = 7, 450 .id = 7,
451 .resource = scif7_resources,
452 .num_resources = ARRAY_SIZE(scif7_resources),
397 .dev = { 453 .dev = {
398 .platform_data = &scif7_platform_data, 454 .platform_data = &scif7_platform_data,
399 }, 455 },
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
index 03e4c96f2b11..c76b2543b85f 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
@@ -70,39 +70,47 @@ static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, NULL,
70 NULL, prio_registers, NULL); 70 NULL, prio_registers, NULL);
71 71
72static struct plat_sci_port scif0_platform_data = { 72static struct plat_sci_port scif0_platform_data = {
73 .mapbase = 0xa4410000,
74 .flags = UPF_BOOT_AUTOCONF, 73 .flags = UPF_BOOT_AUTOCONF,
75 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE | 74 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE |
76 SCSCR_RE | SCSCR_CKE1 | SCSCR_CKE0, 75 SCSCR_RE | SCSCR_CKE1 | SCSCR_CKE0,
77 .scbrr_algo_id = SCBRR_ALGO_4,
78 .type = PORT_SCIF, 76 .type = PORT_SCIF,
79 .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)),
80 .ops = &sh770x_sci_port_ops, 77 .ops = &sh770x_sci_port_ops,
81 .regtype = SCIx_SH7705_SCIF_REGTYPE, 78 .regtype = SCIx_SH7705_SCIF_REGTYPE,
82}; 79};
83 80
81static struct resource scif0_resources[] = {
82 DEFINE_RES_MEM(0xa4410000, 0x100),
83 DEFINE_RES_IRQ(evt2irq(0x900)),
84};
85
84static struct platform_device scif0_device = { 86static struct platform_device scif0_device = {
85 .name = "sh-sci", 87 .name = "sh-sci",
86 .id = 0, 88 .id = 0,
89 .resource = scif0_resources,
90 .num_resources = ARRAY_SIZE(scif0_resources),
87 .dev = { 91 .dev = {
88 .platform_data = &scif0_platform_data, 92 .platform_data = &scif0_platform_data,
89 }, 93 },
90}; 94};
91 95
92static struct plat_sci_port scif1_platform_data = { 96static struct plat_sci_port scif1_platform_data = {
93 .mapbase = 0xa4400000,
94 .flags = UPF_BOOT_AUTOCONF, 97 .flags = UPF_BOOT_AUTOCONF,
95 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE | SCSCR_RE, 98 .scscr = SCSCR_TIE | SCSCR_RIE | SCSCR_TE | SCSCR_RE,
96 .scbrr_algo_id = SCBRR_ALGO_4,
97 .type = PORT_SCIF, 99 .type = PORT_SCIF,
98 .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)),
99 .ops = &sh770x_sci_port_ops, 100 .ops = &sh770x_sci_port_ops,
100 .regtype = SCIx_SH7705_SCIF_REGTYPE, 101 .regtype = SCIx_SH7705_SCIF_REGTYPE,
101}; 102};
102 103
104static struct resource scif1_resources[] = {
105 DEFINE_RES_MEM(0xa4400000, 0x100),
106 DEFINE_RES_IRQ(evt2irq(0x880)),
107};
108
103static struct platform_device scif1_device = { 109static struct platform_device scif1_device = {
104 .name = "sh-sci", 110 .name = "sh-sci",
105 .id = 1, 111 .id = 1,
112 .resource = scif1_resources,
113 .num_resources = ARRAY_SIZE(scif1_resources),
106 .dev = { 114 .dev = {
107 .platform_data = &scif1_platform_data, 115 .platform_data = &scif1_platform_data,
108 }, 116 },
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
index ba26cd9ce69b..ff1465c0519c 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
@@ -109,20 +109,24 @@ static struct platform_device rtc_device = {
109}; 109};
110 110
111static struct plat_sci_port scif0_platform_data = { 111static struct plat_sci_port scif0_platform_data = {
112 .mapbase = 0xfffffe80,
113 .port_reg = 0xa4000136, 112 .port_reg = 0xa4000136,
114 .flags = UPF_BOOT_AUTOCONF, 113 .flags = UPF_BOOT_AUTOCONF,
115 .scscr = SCSCR_TE | SCSCR_RE, 114 .scscr = SCSCR_TE | SCSCR_RE,
116 .scbrr_algo_id = SCBRR_ALGO_2,
117 .type = PORT_SCI, 115 .type = PORT_SCI,
118 .irqs = SCIx_IRQ_MUXED(evt2irq(0x4e0)),
119 .ops = &sh770x_sci_port_ops, 116 .ops = &sh770x_sci_port_ops,
120 .regshift = 1, 117 .regshift = 1,
121}; 118};
122 119
120static struct resource scif0_resources[] = {
121 DEFINE_RES_MEM(0xfffffe80, 0x100),
122 DEFINE_RES_IRQ(evt2irq(0x4e0)),
123};
124
123static struct platform_device scif0_device = { 125static struct platform_device scif0_device = {
124 .name = "sh-sci", 126 .name = "sh-sci",
125 .id = 0, 127 .id = 0,
128 .resource = scif0_resources,
129 .num_resources = ARRAY_SIZE(scif0_resources),
126 .dev = { 130 .dev = {
127 .platform_data = &scif0_platform_data, 131 .platform_data = &scif0_platform_data,
128 }, 132 },
@@ -131,19 +135,23 @@ static struct platform_device scif0_device = {
131 defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 135 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
132 defined(CONFIG_CPU_SUBTYPE_SH7709) 136 defined(CONFIG_CPU_SUBTYPE_SH7709)
133static struct plat_sci_port scif1_platform_data = { 137static struct plat_sci_port scif1_platform_data = {
134 .mapbase = 0xa4000150,
135 .flags = UPF_BOOT_AUTOCONF, 138 .flags = UPF_BOOT_AUTOCONF,
136 .scscr = SCSCR_TE | SCSCR_RE, 139 .scscr = SCSCR_TE | SCSCR_RE,
137 .scbrr_algo_id = SCBRR_ALGO_2,
138 .type = PORT_SCIF, 140 .type = PORT_SCIF,
139 .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)),
140 .ops = &sh770x_sci_port_ops, 141 .ops = &sh770x_sci_port_ops,
141 .regtype = SCIx_SH3_SCIF_REGTYPE, 142 .regtype = SCIx_SH3_SCIF_REGTYPE,
142}; 143};
143 144
145static struct resource scif1_resources[] = {
146 DEFINE_RES_MEM(0xa4000150, 0x100),
147 DEFINE_RES_IRQ(evt2irq(0x900)),
148};
149
144static struct platform_device scif1_device = { 150static struct platform_device scif1_device = {
145 .name = "sh-sci", 151 .name = "sh-sci",
146 .id = 1, 152 .id = 1,
153 .resource = scif1_resources,
154 .num_resources = ARRAY_SIZE(scif1_resources),
147 .dev = { 155 .dev = {
148 .platform_data = &scif1_platform_data, 156 .platform_data = &scif1_platform_data,
149 }, 157 },
@@ -152,20 +160,24 @@ static struct platform_device scif1_device = {
152#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 160#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
153 defined(CONFIG_CPU_SUBTYPE_SH7709) 161 defined(CONFIG_CPU_SUBTYPE_SH7709)
154static struct plat_sci_port scif2_platform_data = { 162static struct plat_sci_port scif2_platform_data = {
155 .mapbase = 0xa4000140,
156 .port_reg = SCIx_NOT_SUPPORTED, 163 .port_reg = SCIx_NOT_SUPPORTED,
157 .flags = UPF_BOOT_AUTOCONF, 164 .flags = UPF_BOOT_AUTOCONF,
158 .scscr = SCSCR_TE | SCSCR_RE, 165 .scscr = SCSCR_TE | SCSCR_RE,
159 .scbrr_algo_id = SCBRR_ALGO_2,
160 .type = PORT_IRDA, 166 .type = PORT_IRDA,
161 .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)),
162 .ops = &sh770x_sci_port_ops, 167 .ops = &sh770x_sci_port_ops,
163 .regshift = 1, 168 .regshift = 1,
164}; 169};
165 170
171static struct resource scif2_resources[] = {
172 DEFINE_RES_MEM(0xa4000140, 0x100),
173 DEFINE_RES_IRQ(evt2irq(0x880)),
174};
175
166static struct platform_device scif2_device = { 176static struct platform_device scif2_device = {
167 .name = "sh-sci", 177 .name = "sh-sci",
168 .id = 2, 178 .id = 2,
179 .resource = scif2_resources,
180 .num_resources = ARRAY_SIZE(scif2_resources),
169 .dev = { 181 .dev = {
170 .platform_data = &scif2_platform_data, 182 .platform_data = &scif2_platform_data,
171 }, 183 },
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
index 93c9c5e24a7a..e2ce9360ed5a 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
@@ -98,36 +98,44 @@ static struct platform_device rtc_device = {
98}; 98};
99 99
100static struct plat_sci_port scif0_platform_data = { 100static struct plat_sci_port scif0_platform_data = {
101 .mapbase = 0xa4400000,
102 .flags = UPF_BOOT_AUTOCONF, 101 .flags = UPF_BOOT_AUTOCONF,
103 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE | 102 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE |
104 SCSCR_CKE1 | SCSCR_CKE0, 103 SCSCR_CKE1 | SCSCR_CKE0,
105 .scbrr_algo_id = SCBRR_ALGO_2,
106 .type = PORT_SCIF, 104 .type = PORT_SCIF,
107 .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)), 105};
106
107static struct resource scif0_resources[] = {
108 DEFINE_RES_MEM(0xa4400000, 0x100),
109 DEFINE_RES_IRQ(evt2irq(0x880)),
108}; 110};
109 111
110static struct platform_device scif0_device = { 112static struct platform_device scif0_device = {
111 .name = "sh-sci", 113 .name = "sh-sci",
112 .id = 0, 114 .id = 0,
115 .resource = scif0_resources,
116 .num_resources = ARRAY_SIZE(scif0_resources),
113 .dev = { 117 .dev = {
114 .platform_data = &scif0_platform_data, 118 .platform_data = &scif0_platform_data,
115 }, 119 },
116}; 120};
117 121
118static struct plat_sci_port scif1_platform_data = { 122static struct plat_sci_port scif1_platform_data = {
119 .mapbase = 0xa4410000,
120 .flags = UPF_BOOT_AUTOCONF, 123 .flags = UPF_BOOT_AUTOCONF,
121 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE | 124 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE |
122 SCSCR_CKE1 | SCSCR_CKE0, 125 SCSCR_CKE1 | SCSCR_CKE0,
123 .scbrr_algo_id = SCBRR_ALGO_2,
124 .type = PORT_SCIF, 126 .type = PORT_SCIF,
125 .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 127};
128
129static struct resource scif1_resources[] = {
130 DEFINE_RES_MEM(0xa4410000, 0x100),
131 DEFINE_RES_IRQ(evt2irq(0x900)),
126}; 132};
127 133
128static struct platform_device scif1_device = { 134static struct platform_device scif1_device = {
129 .name = "sh-sci", 135 .name = "sh-sci",
130 .id = 1, 136 .id = 1,
137 .resource = scif1_resources,
138 .num_resources = ARRAY_SIZE(scif1_resources),
131 .dev = { 139 .dev = {
132 .platform_data = &scif1_platform_data, 140 .platform_data = &scif1_platform_data,
133 }, 141 },
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
index 42d991f632b1..1d5729dc0724 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
@@ -52,38 +52,46 @@ static struct platform_device rtc_device = {
52}; 52};
53 53
54static struct plat_sci_port scif0_platform_data = { 54static struct plat_sci_port scif0_platform_data = {
55 .mapbase = 0xa4430000,
56 .flags = UPF_BOOT_AUTOCONF, 55 .flags = UPF_BOOT_AUTOCONF,
57 .scscr = SCSCR_RE | SCSCR_TE, 56 .scscr = SCSCR_RE | SCSCR_TE,
58 .scbrr_algo_id = SCBRR_ALGO_4,
59 .type = PORT_SCIF, 57 .type = PORT_SCIF,
60 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)),
61 .ops = &sh7720_sci_port_ops, 58 .ops = &sh7720_sci_port_ops,
62 .regtype = SCIx_SH7705_SCIF_REGTYPE, 59 .regtype = SCIx_SH7705_SCIF_REGTYPE,
63}; 60};
64 61
62static struct resource scif0_resources[] = {
63 DEFINE_RES_MEM(0xa4430000, 0x100),
64 DEFINE_RES_IRQ(evt2irq(0xc00)),
65};
66
65static struct platform_device scif0_device = { 67static struct platform_device scif0_device = {
66 .name = "sh-sci", 68 .name = "sh-sci",
67 .id = 0, 69 .id = 0,
70 .resource = scif0_resources,
71 .num_resources = ARRAY_SIZE(scif0_resources),
68 .dev = { 72 .dev = {
69 .platform_data = &scif0_platform_data, 73 .platform_data = &scif0_platform_data,
70 }, 74 },
71}; 75};
72 76
73static struct plat_sci_port scif1_platform_data = { 77static struct plat_sci_port scif1_platform_data = {
74 .mapbase = 0xa4438000,
75 .flags = UPF_BOOT_AUTOCONF, 78 .flags = UPF_BOOT_AUTOCONF,
76 .scscr = SCSCR_RE | SCSCR_TE, 79 .scscr = SCSCR_RE | SCSCR_TE,
77 .scbrr_algo_id = SCBRR_ALGO_4,
78 .type = PORT_SCIF, 80 .type = PORT_SCIF,
79 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)),
80 .ops = &sh7720_sci_port_ops, 81 .ops = &sh7720_sci_port_ops,
81 .regtype = SCIx_SH7705_SCIF_REGTYPE, 82 .regtype = SCIx_SH7705_SCIF_REGTYPE,
82}; 83};
83 84
85static struct resource scif1_resources[] = {
86 DEFINE_RES_MEM(0xa4438000, 0x100),
87 DEFINE_RES_IRQ(evt2irq(0xc20)),
88};
89
84static struct platform_device scif1_device = { 90static struct platform_device scif1_device = {
85 .name = "sh-sci", 91 .name = "sh-sci",
86 .id = 1, 92 .id = 1,
93 .resource = scif1_resources,
94 .num_resources = ARRAY_SIZE(scif1_resources),
87 .dev = { 95 .dev = {
88 .platform_data = &scif1_platform_data, 96 .platform_data = &scif1_platform_data,
89 }, 97 },
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
index 2a5320aa73bb..a8bd778d5ac8 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
@@ -17,20 +17,24 @@
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19static struct plat_sci_port scif0_platform_data = { 19static struct plat_sci_port scif0_platform_data = {
20 .mapbase = 0xffe80000,
21 .flags = UPF_BOOT_AUTOCONF, 20 .flags = UPF_BOOT_AUTOCONF,
22 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 21 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
23 .scbrr_algo_id = SCBRR_ALGO_2,
24 .type = PORT_SCIF, 22 .type = PORT_SCIF,
25 .irqs = { evt2irq(0x700), 23};
26 evt2irq(0x720), 24
27 evt2irq(0x760), 25static struct resource scif0_resources[] = {
28 evt2irq(0x740) }, 26 DEFINE_RES_MEM(0xffe80000, 0x100),
27 DEFINE_RES_IRQ(evt2irq(0x700)),
28 DEFINE_RES_IRQ(evt2irq(0x720)),
29 DEFINE_RES_IRQ(evt2irq(0x760)),
30 DEFINE_RES_IRQ(evt2irq(0x740)),
29}; 31};
30 32
31static struct platform_device scif0_device = { 33static struct platform_device scif0_device = {
32 .name = "sh-sci", 34 .name = "sh-sci",
33 .id = 0, 35 .id = 0,
36 .resource = scif0_resources,
37 .num_resources = ARRAY_SIZE(scif0_resources),
34 .dev = { 38 .dev = {
35 .platform_data = &scif0_platform_data, 39 .platform_data = &scif0_platform_data,
36 }, 40 },
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index 04a45512596f..a447a248491f 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -38,36 +38,44 @@ static struct platform_device rtc_device = {
38}; 38};
39 39
40static struct plat_sci_port sci_platform_data = { 40static struct plat_sci_port sci_platform_data = {
41 .mapbase = 0xffe00000,
42 .port_reg = 0xffe0001C, 41 .port_reg = 0xffe0001C,
43 .flags = UPF_BOOT_AUTOCONF, 42 .flags = UPF_BOOT_AUTOCONF,
44 .scscr = SCSCR_TE | SCSCR_RE, 43 .scscr = SCSCR_TE | SCSCR_RE,
45 .scbrr_algo_id = SCBRR_ALGO_2,
46 .type = PORT_SCI, 44 .type = PORT_SCI,
47 .irqs = SCIx_IRQ_MUXED(evt2irq(0x4e0)),
48 .regshift = 2, 45 .regshift = 2,
49}; 46};
50 47
48static struct resource sci_resources[] = {
49 DEFINE_RES_MEM(0xffe00000, 0x100),
50 DEFINE_RES_IRQ(evt2irq(0x4e0)),
51};
52
51static struct platform_device sci_device = { 53static struct platform_device sci_device = {
52 .name = "sh-sci", 54 .name = "sh-sci",
53 .id = 0, 55 .id = 0,
56 .resource = sci_resources,
57 .num_resources = ARRAY_SIZE(sci_resources),
54 .dev = { 58 .dev = {
55 .platform_data = &sci_platform_data, 59 .platform_data = &sci_platform_data,
56 }, 60 },
57}; 61};
58 62
59static struct plat_sci_port scif_platform_data = { 63static struct plat_sci_port scif_platform_data = {
60 .mapbase = 0xffe80000,
61 .flags = UPF_BOOT_AUTOCONF, 64 .flags = UPF_BOOT_AUTOCONF,
62 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE, 65 .scscr = SCSCR_TE | SCSCR_RE | SCSCR_REIE,
63 .scbrr_algo_id = SCBRR_ALGO_2,
64 .type = PORT_SCIF, 66 .type = PORT_SCIF,
65 .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)), 67};
68
69static struct resource scif_resources[] = {
70 DEFINE_RES_MEM(0xffe80000, 0x100),
71 DEFINE_RES_IRQ(evt2irq(0x700)),
66}; 72};
67 73
68static struct platform_device scif_device = { 74static struct platform_device scif_device = {
69 .name = "sh-sci", 75 .name = "sh-sci",
70 .id = 1, 76 .id = 1,
77 .resource = scif_resources,
78 .num_resources = ARRAY_SIZE(scif_resources),
71 .dev = { 79 .dev = {
72 .platform_data = &scif_platform_data, 80 .platform_data = &scif_platform_data,
73 }, 81 },
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
index 98e075ada44e..1abd9fb4a386 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
@@ -128,83 +128,99 @@ static DECLARE_INTC_DESC(intc_desc_irq, "sh7760-irq", vectors_irq, groups,
128 mask_registers, prio_registers, NULL); 128 mask_registers, prio_registers, NULL);
129 129
130static struct plat_sci_port scif0_platform_data = { 130static struct plat_sci_port scif0_platform_data = {
131 .mapbase = 0xfe600000,
132 .flags = UPF_BOOT_AUTOCONF, 131 .flags = UPF_BOOT_AUTOCONF,
133 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 132 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
134 .scbrr_algo_id = SCBRR_ALGO_2,
135 .type = PORT_SCIF, 133 .type = PORT_SCIF,
136 .irqs = { evt2irq(0x880),
137 evt2irq(0x8a0),
138 evt2irq(0x8e0),
139 evt2irq(0x8c0) },
140 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 134 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
141}; 135};
142 136
137static struct resource scif0_resources[] = {
138 DEFINE_RES_MEM(0xfe600000, 0x100),
139 DEFINE_RES_IRQ(evt2irq(0x880)),
140 DEFINE_RES_IRQ(evt2irq(0x8a0)),
141 DEFINE_RES_IRQ(evt2irq(0x8e0)),
142 DEFINE_RES_IRQ(evt2irq(0x8c0)),
143};
144
143static struct platform_device scif0_device = { 145static struct platform_device scif0_device = {
144 .name = "sh-sci", 146 .name = "sh-sci",
145 .id = 0, 147 .id = 0,
148 .resource = scif0_resources,
149 .num_resources = ARRAY_SIZE(scif0_resources),
146 .dev = { 150 .dev = {
147 .platform_data = &scif0_platform_data, 151 .platform_data = &scif0_platform_data,
148 }, 152 },
149}; 153};
150 154
151static struct plat_sci_port scif1_platform_data = { 155static struct plat_sci_port scif1_platform_data = {
152 .mapbase = 0xfe610000,
153 .flags = UPF_BOOT_AUTOCONF, 156 .flags = UPF_BOOT_AUTOCONF,
154 .type = PORT_SCIF, 157 .type = PORT_SCIF,
155 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 158 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
156 .scbrr_algo_id = SCBRR_ALGO_2,
157 .irqs = { evt2irq(0xb00),
158 evt2irq(0xb20),
159 evt2irq(0xb60),
160 evt2irq(0xb40) },
161 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 159 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
162}; 160};
163 161
162static struct resource scif1_resources[] = {
163 DEFINE_RES_MEM(0xfe610000, 0x100),
164 DEFINE_RES_IRQ(evt2irq(0xb00)),
165 DEFINE_RES_IRQ(evt2irq(0xb20)),
166 DEFINE_RES_IRQ(evt2irq(0xb60)),
167 DEFINE_RES_IRQ(evt2irq(0xb40)),
168};
169
164static struct platform_device scif1_device = { 170static struct platform_device scif1_device = {
165 .name = "sh-sci", 171 .name = "sh-sci",
166 .id = 1, 172 .id = 1,
173 .resource = scif1_resources,
174 .num_resources = ARRAY_SIZE(scif1_resources),
167 .dev = { 175 .dev = {
168 .platform_data = &scif1_platform_data, 176 .platform_data = &scif1_platform_data,
169 }, 177 },
170}; 178};
171 179
172static struct plat_sci_port scif2_platform_data = { 180static struct plat_sci_port scif2_platform_data = {
173 .mapbase = 0xfe620000,
174 .flags = UPF_BOOT_AUTOCONF, 181 .flags = UPF_BOOT_AUTOCONF,
175 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 182 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
176 .scbrr_algo_id = SCBRR_ALGO_2,
177 .type = PORT_SCIF, 183 .type = PORT_SCIF,
178 .irqs = { evt2irq(0xb80),
179 evt2irq(0xba0),
180 evt2irq(0xbe0),
181 evt2irq(0xbc0) },
182 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 184 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
183}; 185};
184 186
187static struct resource scif2_resources[] = {
188 DEFINE_RES_MEM(0xfe620000, 0x100),
189 DEFINE_RES_IRQ(evt2irq(0xb80)),
190 DEFINE_RES_IRQ(evt2irq(0xba0)),
191 DEFINE_RES_IRQ(evt2irq(0xbe0)),
192 DEFINE_RES_IRQ(evt2irq(0xbc0)),
193};
194
185static struct platform_device scif2_device = { 195static struct platform_device scif2_device = {
186 .name = "sh-sci", 196 .name = "sh-sci",
187 .id = 2, 197 .id = 2,
198 .resource = scif2_resources,
199 .num_resources = ARRAY_SIZE(scif2_resources),
188 .dev = { 200 .dev = {
189 .platform_data = &scif2_platform_data, 201 .platform_data = &scif2_platform_data,
190 }, 202 },
191}; 203};
192 204
193static struct plat_sci_port scif3_platform_data = { 205static struct plat_sci_port scif3_platform_data = {
194 .mapbase = 0xfe480000,
195 .flags = UPF_BOOT_AUTOCONF, 206 .flags = UPF_BOOT_AUTOCONF,
196 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 207 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
197 .scbrr_algo_id = SCBRR_ALGO_2,
198 .type = PORT_SCI, 208 .type = PORT_SCI,
199 .irqs = { evt2irq(0xc00),
200 evt2irq(0xc20),
201 evt2irq(0xc40), },
202 .regshift = 2, 209 .regshift = 2,
203}; 210};
204 211
212static struct resource scif3_resources[] = {
213 DEFINE_RES_MEM(0xfe480000, 0x100),
214 DEFINE_RES_IRQ(evt2irq(0xc00)),
215 DEFINE_RES_IRQ(evt2irq(0xc20)),
216 DEFINE_RES_IRQ(evt2irq(0xc40)),
217};
218
205static struct platform_device scif3_device = { 219static struct platform_device scif3_device = {
206 .name = "sh-sci", 220 .name = "sh-sci",
207 .id = 3, 221 .id = 3,
222 .resource = scif3_resources,
223 .num_resources = ARRAY_SIZE(scif3_resources),
208 .dev = { 224 .dev = {
209 .platform_data = &scif3_platform_data, 225 .platform_data = &scif3_platform_data,
210 }, 226 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
index b91ea8300a3e..245d19254489 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
@@ -18,68 +18,84 @@
18 18
19/* Serial */ 19/* Serial */
20static struct plat_sci_port scif0_platform_data = { 20static struct plat_sci_port scif0_platform_data = {
21 .mapbase = 0xffe00000,
22 .flags = UPF_BOOT_AUTOCONF, 21 .flags = UPF_BOOT_AUTOCONF,
23 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 22 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
24 .scbrr_algo_id = SCBRR_ALGO_2,
25 .type = PORT_SCIF, 23 .type = PORT_SCIF,
26 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 24};
25
26static struct resource scif0_resources[] = {
27 DEFINE_RES_MEM(0xffe00000, 0x100),
28 DEFINE_RES_IRQ(evt2irq(0xc00)),
27}; 29};
28 30
29static struct platform_device scif0_device = { 31static struct platform_device scif0_device = {
30 .name = "sh-sci", 32 .name = "sh-sci",
31 .id = 0, 33 .id = 0,
34 .resource = scif0_resources,
35 .num_resources = ARRAY_SIZE(scif0_resources),
32 .dev = { 36 .dev = {
33 .platform_data = &scif0_platform_data, 37 .platform_data = &scif0_platform_data,
34 }, 38 },
35}; 39};
36 40
37static struct plat_sci_port scif1_platform_data = { 41static struct plat_sci_port scif1_platform_data = {
38 .mapbase = 0xffe10000,
39 .flags = UPF_BOOT_AUTOCONF, 42 .flags = UPF_BOOT_AUTOCONF,
40 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 43 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
41 .scbrr_algo_id = SCBRR_ALGO_2,
42 .type = PORT_SCIF, 44 .type = PORT_SCIF,
43 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)), 45};
46
47static struct resource scif1_resources[] = {
48 DEFINE_RES_MEM(0xffe10000, 0x100),
49 DEFINE_RES_IRQ(evt2irq(0xc20)),
44}; 50};
45 51
46static struct platform_device scif1_device = { 52static struct platform_device scif1_device = {
47 .name = "sh-sci", 53 .name = "sh-sci",
48 .id = 1, 54 .id = 1,
55 .resource = scif1_resources,
56 .num_resources = ARRAY_SIZE(scif1_resources),
49 .dev = { 57 .dev = {
50 .platform_data = &scif1_platform_data, 58 .platform_data = &scif1_platform_data,
51 }, 59 },
52}; 60};
53 61
54static struct plat_sci_port scif2_platform_data = { 62static struct plat_sci_port scif2_platform_data = {
55 .mapbase = 0xffe20000,
56 .flags = UPF_BOOT_AUTOCONF, 63 .flags = UPF_BOOT_AUTOCONF,
57 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 64 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
58 .scbrr_algo_id = SCBRR_ALGO_2,
59 .type = PORT_SCIF, 65 .type = PORT_SCIF,
60 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)), 66};
67
68static struct resource scif2_resources[] = {
69 DEFINE_RES_MEM(0xffe20000, 0x100),
70 DEFINE_RES_IRQ(evt2irq(0xc40)),
61}; 71};
62 72
63static struct platform_device scif2_device = { 73static struct platform_device scif2_device = {
64 .name = "sh-sci", 74 .name = "sh-sci",
65 .id = 2, 75 .id = 2,
76 .resource = scif2_resources,
77 .num_resources = ARRAY_SIZE(scif2_resources),
66 .dev = { 78 .dev = {
67 .platform_data = &scif2_platform_data, 79 .platform_data = &scif2_platform_data,
68 }, 80 },
69}; 81};
70 82
71static struct plat_sci_port scif3_platform_data = { 83static struct plat_sci_port scif3_platform_data = {
72 .mapbase = 0xffe30000,
73 .flags = UPF_BOOT_AUTOCONF, 84 .flags = UPF_BOOT_AUTOCONF,
74 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 85 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
75 .scbrr_algo_id = SCBRR_ALGO_2,
76 .type = PORT_SCIF, 86 .type = PORT_SCIF,
77 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc60)), 87};
88
89static struct resource scif3_resources[] = {
90 DEFINE_RES_MEM(0xffe30000, 0x100),
91 DEFINE_RES_IRQ(evt2irq(0xc60)),
78}; 92};
79 93
80static struct platform_device scif3_device = { 94static struct platform_device scif3_device = {
81 .name = "sh-sci", 95 .name = "sh-sci",
82 .id = 3, 96 .id = 3,
97 .resource = scif3_resources,
98 .num_resources = ARRAY_SIZE(scif3_resources),
83 .dev = { 99 .dev = {
84 .platform_data = &scif3_platform_data, 100 .platform_data = &scif3_platform_data,
85 }, 101 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index 0bd09d51419f..6f56cbd76b20 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -20,18 +20,22 @@
20#include <asm/clock.h> 20#include <asm/clock.h>
21 21
22static struct plat_sci_port scif0_platform_data = { 22static struct plat_sci_port scif0_platform_data = {
23 .mapbase = 0xffe00000,
24 .port_reg = 0xa405013e, 23 .port_reg = 0xa405013e,
25 .flags = UPF_BOOT_AUTOCONF, 24 .flags = UPF_BOOT_AUTOCONF,
26 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 25 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
27 .scbrr_algo_id = SCBRR_ALGO_2,
28 .type = PORT_SCIF, 26 .type = PORT_SCIF,
29 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)), 27};
28
29static struct resource scif0_resources[] = {
30 DEFINE_RES_MEM(0xffe00000, 0x100),
31 DEFINE_RES_IRQ(evt2irq(0xc00)),
30}; 32};
31 33
32static struct platform_device scif0_device = { 34static struct platform_device scif0_device = {
33 .name = "sh-sci", 35 .name = "sh-sci",
34 .id = 0, 36 .id = 0,
37 .resource = scif0_resources,
38 .num_resources = ARRAY_SIZE(scif0_resources),
35 .dev = { 39 .dev = {
36 .platform_data = &scif0_platform_data, 40 .platform_data = &scif0_platform_data,
37 }, 41 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 6a868b091c2d..5a94efc8d4ce 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -179,57 +179,69 @@ struct platform_device dma_device = {
179 179
180/* Serial */ 180/* Serial */
181static struct plat_sci_port scif0_platform_data = { 181static struct plat_sci_port scif0_platform_data = {
182 .mapbase = 0xffe00000,
183 .flags = UPF_BOOT_AUTOCONF, 182 .flags = UPF_BOOT_AUTOCONF,
184 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 183 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
185 .scbrr_algo_id = SCBRR_ALGO_2,
186 .type = PORT_SCIF, 184 .type = PORT_SCIF,
187 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)),
188 .ops = &sh7722_sci_port_ops, 185 .ops = &sh7722_sci_port_ops,
189 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 186 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
190}; 187};
191 188
189static struct resource scif0_resources[] = {
190 DEFINE_RES_MEM(0xffe00000, 0x100),
191 DEFINE_RES_IRQ(evt2irq(0xc00)),
192};
193
192static struct platform_device scif0_device = { 194static struct platform_device scif0_device = {
193 .name = "sh-sci", 195 .name = "sh-sci",
194 .id = 0, 196 .id = 0,
197 .resource = scif0_resources,
198 .num_resources = ARRAY_SIZE(scif0_resources),
195 .dev = { 199 .dev = {
196 .platform_data = &scif0_platform_data, 200 .platform_data = &scif0_platform_data,
197 }, 201 },
198}; 202};
199 203
200static struct plat_sci_port scif1_platform_data = { 204static struct plat_sci_port scif1_platform_data = {
201 .mapbase = 0xffe10000,
202 .flags = UPF_BOOT_AUTOCONF, 205 .flags = UPF_BOOT_AUTOCONF,
203 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 206 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
204 .scbrr_algo_id = SCBRR_ALGO_2,
205 .type = PORT_SCIF, 207 .type = PORT_SCIF,
206 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)),
207 .ops = &sh7722_sci_port_ops, 208 .ops = &sh7722_sci_port_ops,
208 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 209 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
209}; 210};
210 211
212static struct resource scif1_resources[] = {
213 DEFINE_RES_MEM(0xffe10000, 0x100),
214 DEFINE_RES_IRQ(evt2irq(0xc20)),
215};
216
211static struct platform_device scif1_device = { 217static struct platform_device scif1_device = {
212 .name = "sh-sci", 218 .name = "sh-sci",
213 .id = 1, 219 .id = 1,
220 .resource = scif1_resources,
221 .num_resources = ARRAY_SIZE(scif1_resources),
214 .dev = { 222 .dev = {
215 .platform_data = &scif1_platform_data, 223 .platform_data = &scif1_platform_data,
216 }, 224 },
217}; 225};
218 226
219static struct plat_sci_port scif2_platform_data = { 227static struct plat_sci_port scif2_platform_data = {
220 .mapbase = 0xffe20000,
221 .flags = UPF_BOOT_AUTOCONF, 228 .flags = UPF_BOOT_AUTOCONF,
222 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 229 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
223 .scbrr_algo_id = SCBRR_ALGO_2,
224 .type = PORT_SCIF, 230 .type = PORT_SCIF,
225 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)),
226 .ops = &sh7722_sci_port_ops, 231 .ops = &sh7722_sci_port_ops,
227 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 232 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
228}; 233};
229 234
235static struct resource scif2_resources[] = {
236 DEFINE_RES_MEM(0xffe20000, 0x100),
237 DEFINE_RES_IRQ(evt2irq(0xc40)),
238};
239
230static struct platform_device scif2_device = { 240static struct platform_device scif2_device = {
231 .name = "sh-sci", 241 .name = "sh-sci",
232 .id = 2, 242 .id = 2,
243 .resource = scif2_resources,
244 .num_resources = ARRAY_SIZE(scif2_resources),
233 .dev = { 245 .dev = {
234 .platform_data = &scif2_platform_data, 246 .platform_data = &scif2_platform_data,
235 }, 247 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index 28d6fd835fe0..3c5eb0993a75 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -23,111 +23,138 @@
23 23
24/* Serial */ 24/* Serial */
25static struct plat_sci_port scif0_platform_data = { 25static struct plat_sci_port scif0_platform_data = {
26 .mapbase = 0xffe00000,
27 .port_reg = 0xa4050160, 26 .port_reg = 0xa4050160,
28 .flags = UPF_BOOT_AUTOCONF, 27 .flags = UPF_BOOT_AUTOCONF,
29 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 28 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
30 .scbrr_algo_id = SCBRR_ALGO_2,
31 .type = PORT_SCIF, 29 .type = PORT_SCIF,
32 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)),
33 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 30 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
34}; 31};
35 32
33static struct resource scif0_resources[] = {
34 DEFINE_RES_MEM(0xffe00000, 0x100),
35 DEFINE_RES_IRQ(evt2irq(0xc00)),
36};
37
36static struct platform_device scif0_device = { 38static struct platform_device scif0_device = {
37 .name = "sh-sci", 39 .name = "sh-sci",
38 .id = 0, 40 .id = 0,
41 .resource = scif0_resources,
42 .num_resources = ARRAY_SIZE(scif0_resources),
39 .dev = { 43 .dev = {
40 .platform_data = &scif0_platform_data, 44 .platform_data = &scif0_platform_data,
41 }, 45 },
42}; 46};
43 47
44static struct plat_sci_port scif1_platform_data = { 48static struct plat_sci_port scif1_platform_data = {
45 .mapbase = 0xffe10000,
46 .port_reg = SCIx_NOT_SUPPORTED, 49 .port_reg = SCIx_NOT_SUPPORTED,
47 .flags = UPF_BOOT_AUTOCONF, 50 .flags = UPF_BOOT_AUTOCONF,
48 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 51 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
49 .scbrr_algo_id = SCBRR_ALGO_2,
50 .type = PORT_SCIF, 52 .type = PORT_SCIF,
51 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)),
52 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 53 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
53}; 54};
54 55
56static struct resource scif1_resources[] = {
57 DEFINE_RES_MEM(0xffe10000, 0x100),
58 DEFINE_RES_IRQ(evt2irq(0xc20)),
59};
60
55static struct platform_device scif1_device = { 61static struct platform_device scif1_device = {
56 .name = "sh-sci", 62 .name = "sh-sci",
57 .id = 1, 63 .id = 1,
64 .resource = scif1_resources,
65 .num_resources = ARRAY_SIZE(scif1_resources),
58 .dev = { 66 .dev = {
59 .platform_data = &scif1_platform_data, 67 .platform_data = &scif1_platform_data,
60 }, 68 },
61}; 69};
62 70
63static struct plat_sci_port scif2_platform_data = { 71static struct plat_sci_port scif2_platform_data = {
64 .mapbase = 0xffe20000,
65 .port_reg = SCIx_NOT_SUPPORTED, 72 .port_reg = SCIx_NOT_SUPPORTED,
66 .flags = UPF_BOOT_AUTOCONF, 73 .flags = UPF_BOOT_AUTOCONF,
67 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 74 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
68 .scbrr_algo_id = SCBRR_ALGO_2,
69 .type = PORT_SCIF, 75 .type = PORT_SCIF,
70 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)),
71 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 76 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
72}; 77};
73 78
79static struct resource scif2_resources[] = {
80 DEFINE_RES_MEM(0xffe20000, 0x100),
81 DEFINE_RES_IRQ(evt2irq(0xc40)),
82};
83
74static struct platform_device scif2_device = { 84static struct platform_device scif2_device = {
75 .name = "sh-sci", 85 .name = "sh-sci",
76 .id = 2, 86 .id = 2,
87 .resource = scif2_resources,
88 .num_resources = ARRAY_SIZE(scif2_resources),
77 .dev = { 89 .dev = {
78 .platform_data = &scif2_platform_data, 90 .platform_data = &scif2_platform_data,
79 }, 91 },
80}; 92};
81 93
82static struct plat_sci_port scif3_platform_data = { 94static struct plat_sci_port scif3_platform_data = {
83 .mapbase = 0xa4e30000,
84 .flags = UPF_BOOT_AUTOCONF, 95 .flags = UPF_BOOT_AUTOCONF,
85 .port_reg = SCIx_NOT_SUPPORTED, 96 .port_reg = SCIx_NOT_SUPPORTED,
86 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 97 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
87 .scbrr_algo_id = SCBRR_ALGO_3, 98 .sampling_rate = 8,
88 .type = PORT_SCIFA, 99 .type = PORT_SCIFA,
89 .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 100};
101
102static struct resource scif3_resources[] = {
103 DEFINE_RES_MEM(0xa4e30000, 0x100),
104 DEFINE_RES_IRQ(evt2irq(0x900)),
90}; 105};
91 106
92static struct platform_device scif3_device = { 107static struct platform_device scif3_device = {
93 .name = "sh-sci", 108 .name = "sh-sci",
94 .id = 3, 109 .id = 3,
110 .resource = scif3_resources,
111 .num_resources = ARRAY_SIZE(scif3_resources),
95 .dev = { 112 .dev = {
96 .platform_data = &scif3_platform_data, 113 .platform_data = &scif3_platform_data,
97 }, 114 },
98}; 115};
99 116
100static struct plat_sci_port scif4_platform_data = { 117static struct plat_sci_port scif4_platform_data = {
101 .mapbase = 0xa4e40000,
102 .port_reg = SCIx_NOT_SUPPORTED, 118 .port_reg = SCIx_NOT_SUPPORTED,
103 .flags = UPF_BOOT_AUTOCONF, 119 .flags = UPF_BOOT_AUTOCONF,
104 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 120 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
105 .scbrr_algo_id = SCBRR_ALGO_3, 121 .sampling_rate = 8,
106 .type = PORT_SCIFA, 122 .type = PORT_SCIFA,
107 .irqs = SCIx_IRQ_MUXED(evt2irq(0xd00)), 123};
124
125static struct resource scif4_resources[] = {
126 DEFINE_RES_MEM(0xa4e40000, 0x100),
127 DEFINE_RES_IRQ(evt2irq(0xd00)),
108}; 128};
109 129
110static struct platform_device scif4_device = { 130static struct platform_device scif4_device = {
111 .name = "sh-sci", 131 .name = "sh-sci",
112 .id = 4, 132 .id = 4,
133 .resource = scif4_resources,
134 .num_resources = ARRAY_SIZE(scif4_resources),
113 .dev = { 135 .dev = {
114 .platform_data = &scif4_platform_data, 136 .platform_data = &scif4_platform_data,
115 }, 137 },
116}; 138};
117 139
118static struct plat_sci_port scif5_platform_data = { 140static struct plat_sci_port scif5_platform_data = {
119 .mapbase = 0xa4e50000,
120 .port_reg = SCIx_NOT_SUPPORTED, 141 .port_reg = SCIx_NOT_SUPPORTED,
121 .flags = UPF_BOOT_AUTOCONF, 142 .flags = UPF_BOOT_AUTOCONF,
122 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 143 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
123 .scbrr_algo_id = SCBRR_ALGO_3, 144 .sampling_rate = 8,
124 .type = PORT_SCIFA, 145 .type = PORT_SCIFA,
125 .irqs = SCIx_IRQ_MUXED(evt2irq(0xfa0)), 146};
147
148static struct resource scif5_resources[] = {
149 DEFINE_RES_MEM(0xa4e50000, 0x100),
150 DEFINE_RES_IRQ(evt2irq(0xfa0)),
126}; 151};
127 152
128static struct platform_device scif5_device = { 153static struct platform_device scif5_device = {
129 .name = "sh-sci", 154 .name = "sh-sci",
130 .id = 5, 155 .id = 5,
156 .resource = scif5_resources,
157 .num_resources = ARRAY_SIZE(scif5_resources),
131 .dev = { 158 .dev = {
132 .platform_data = &scif5_platform_data, 159 .platform_data = &scif5_platform_data,
133 }, 160 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 26b74c2f9496..60ebbc6842ff 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -290,111 +290,138 @@ static struct platform_device dma1_device = {
290 290
291/* Serial */ 291/* Serial */
292static struct plat_sci_port scif0_platform_data = { 292static struct plat_sci_port scif0_platform_data = {
293 .mapbase = 0xffe00000,
294 .port_reg = SCIx_NOT_SUPPORTED, 293 .port_reg = SCIx_NOT_SUPPORTED,
295 .flags = UPF_BOOT_AUTOCONF, 294 .flags = UPF_BOOT_AUTOCONF,
296 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 295 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
297 .scbrr_algo_id = SCBRR_ALGO_2,
298 .type = PORT_SCIF, 296 .type = PORT_SCIF,
299 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc00)),
300 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 297 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
301}; 298};
302 299
300static struct resource scif0_resources[] = {
301 DEFINE_RES_MEM(0xffe00000, 0x100),
302 DEFINE_RES_IRQ(evt2irq(0xc00)),
303};
304
303static struct platform_device scif0_device = { 305static struct platform_device scif0_device = {
304 .name = "sh-sci", 306 .name = "sh-sci",
305 .id = 0, 307 .id = 0,
308 .resource = scif0_resources,
309 .num_resources = ARRAY_SIZE(scif0_resources),
306 .dev = { 310 .dev = {
307 .platform_data = &scif0_platform_data, 311 .platform_data = &scif0_platform_data,
308 }, 312 },
309}; 313};
310 314
311static struct plat_sci_port scif1_platform_data = { 315static struct plat_sci_port scif1_platform_data = {
312 .mapbase = 0xffe10000,
313 .port_reg = SCIx_NOT_SUPPORTED, 316 .port_reg = SCIx_NOT_SUPPORTED,
314 .flags = UPF_BOOT_AUTOCONF, 317 .flags = UPF_BOOT_AUTOCONF,
315 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 318 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
316 .scbrr_algo_id = SCBRR_ALGO_2,
317 .type = PORT_SCIF, 319 .type = PORT_SCIF,
318 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc20)),
319 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 320 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
320}; 321};
321 322
323static struct resource scif1_resources[] = {
324 DEFINE_RES_MEM(0xffe10000, 0x100),
325 DEFINE_RES_IRQ(evt2irq(0xc20)),
326};
327
322static struct platform_device scif1_device = { 328static struct platform_device scif1_device = {
323 .name = "sh-sci", 329 .name = "sh-sci",
324 .id = 1, 330 .id = 1,
331 .resource = scif1_resources,
332 .num_resources = ARRAY_SIZE(scif1_resources),
325 .dev = { 333 .dev = {
326 .platform_data = &scif1_platform_data, 334 .platform_data = &scif1_platform_data,
327 }, 335 },
328}; 336};
329 337
330static struct plat_sci_port scif2_platform_data = { 338static struct plat_sci_port scif2_platform_data = {
331 .mapbase = 0xffe20000,
332 .port_reg = SCIx_NOT_SUPPORTED, 339 .port_reg = SCIx_NOT_SUPPORTED,
333 .flags = UPF_BOOT_AUTOCONF, 340 .flags = UPF_BOOT_AUTOCONF,
334 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 341 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
335 .scbrr_algo_id = SCBRR_ALGO_2,
336 .type = PORT_SCIF, 342 .type = PORT_SCIF,
337 .irqs = SCIx_IRQ_MUXED(evt2irq(0xc40)),
338 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 343 .regtype = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
339}; 344};
340 345
346static struct resource scif2_resources[] = {
347 DEFINE_RES_MEM(0xffe20000, 0x100),
348 DEFINE_RES_IRQ(evt2irq(0xc40)),
349};
350
341static struct platform_device scif2_device = { 351static struct platform_device scif2_device = {
342 .name = "sh-sci", 352 .name = "sh-sci",
343 .id = 2, 353 .id = 2,
354 .resource = scif2_resources,
355 .num_resources = ARRAY_SIZE(scif2_resources),
344 .dev = { 356 .dev = {
345 .platform_data = &scif2_platform_data, 357 .platform_data = &scif2_platform_data,
346 }, 358 },
347}; 359};
348 360
349static struct plat_sci_port scif3_platform_data = { 361static struct plat_sci_port scif3_platform_data = {
350 .mapbase = 0xa4e30000,
351 .port_reg = SCIx_NOT_SUPPORTED, 362 .port_reg = SCIx_NOT_SUPPORTED,
352 .flags = UPF_BOOT_AUTOCONF, 363 .flags = UPF_BOOT_AUTOCONF,
353 .scscr = SCSCR_RE | SCSCR_TE, 364 .scscr = SCSCR_RE | SCSCR_TE,
354 .scbrr_algo_id = SCBRR_ALGO_3, 365 .sampling_rate = 8,
355 .type = PORT_SCIFA, 366 .type = PORT_SCIFA,
356 .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)), 367};
368
369static struct resource scif3_resources[] = {
370 DEFINE_RES_MEM(0xa4e30000, 0x100),
371 DEFINE_RES_IRQ(evt2irq(0x900)),
357}; 372};
358 373
359static struct platform_device scif3_device = { 374static struct platform_device scif3_device = {
360 .name = "sh-sci", 375 .name = "sh-sci",
361 .id = 3, 376 .id = 3,
377 .resource = scif3_resources,
378 .num_resources = ARRAY_SIZE(scif3_resources),
362 .dev = { 379 .dev = {
363 .platform_data = &scif3_platform_data, 380 .platform_data = &scif3_platform_data,
364 }, 381 },
365}; 382};
366 383
367static struct plat_sci_port scif4_platform_data = { 384static struct plat_sci_port scif4_platform_data = {
368 .mapbase = 0xa4e40000,
369 .port_reg = SCIx_NOT_SUPPORTED, 385 .port_reg = SCIx_NOT_SUPPORTED,
370 .flags = UPF_BOOT_AUTOCONF, 386 .flags = UPF_BOOT_AUTOCONF,
371 .scscr = SCSCR_RE | SCSCR_TE, 387 .scscr = SCSCR_RE | SCSCR_TE,
372 .scbrr_algo_id = SCBRR_ALGO_3, 388 .sampling_rate = 8,
373 .type = PORT_SCIFA, 389 .type = PORT_SCIFA,
374 .irqs = SCIx_IRQ_MUXED(evt2irq(0xd00)), 390};
391
392static struct resource scif4_resources[] = {
393 DEFINE_RES_MEM(0xa4e40000, 0x100),
394 DEFINE_RES_IRQ(evt2irq(0xd00)),
375}; 395};
376 396
377static struct platform_device scif4_device = { 397static struct platform_device scif4_device = {
378 .name = "sh-sci", 398 .name = "sh-sci",
379 .id = 4, 399 .id = 4,
400 .resource = scif4_resources,
401 .num_resources = ARRAY_SIZE(scif4_resources),
380 .dev = { 402 .dev = {
381 .platform_data = &scif4_platform_data, 403 .platform_data = &scif4_platform_data,
382 }, 404 },
383}; 405};
384 406
385static struct plat_sci_port scif5_platform_data = { 407static struct plat_sci_port scif5_platform_data = {
386 .mapbase = 0xa4e50000,
387 .port_reg = SCIx_NOT_SUPPORTED, 408 .port_reg = SCIx_NOT_SUPPORTED,
388 .flags = UPF_BOOT_AUTOCONF, 409 .flags = UPF_BOOT_AUTOCONF,
389 .scscr = SCSCR_RE | SCSCR_TE, 410 .scscr = SCSCR_RE | SCSCR_TE,
390 .scbrr_algo_id = SCBRR_ALGO_3, 411 .sampling_rate = 8,
391 .type = PORT_SCIFA, 412 .type = PORT_SCIFA,
392 .irqs = SCIx_IRQ_MUXED(evt2irq(0xfa0)), 413};
414
415static struct resource scif5_resources[] = {
416 DEFINE_RES_MEM(0xa4e50000, 0x100),
417 DEFINE_RES_IRQ(evt2irq(0xfa0)),
393}; 418};
394 419
395static struct platform_device scif5_device = { 420static struct platform_device scif5_device = {
396 .name = "sh-sci", 421 .name = "sh-sci",
397 .id = 5, 422 .id = 5,
423 .resource = scif5_resources,
424 .num_resources = ARRAY_SIZE(scif5_resources),
398 .dev = { 425 .dev = {
399 .platform_data = &scif5_platform_data, 426 .platform_data = &scif5_platform_data,
400 }, 427 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7734.c b/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
index f799971d453c..dad4ed1b2f94 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
@@ -25,108 +25,132 @@
25 25
26/* SCIF */ 26/* SCIF */
27static struct plat_sci_port scif0_platform_data = { 27static struct plat_sci_port scif0_platform_data = {
28 .mapbase = 0xFFE40000,
29 .flags = UPF_BOOT_AUTOCONF, 28 .flags = UPF_BOOT_AUTOCONF,
30 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 29 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
31 .scbrr_algo_id = SCBRR_ALGO_2,
32 .type = PORT_SCIF, 30 .type = PORT_SCIF,
33 .irqs = SCIx_IRQ_MUXED(evt2irq(0x8C0)),
34 .regtype = SCIx_SH4_SCIF_REGTYPE, 31 .regtype = SCIx_SH4_SCIF_REGTYPE,
35}; 32};
36 33
34static struct resource scif0_resources[] = {
35 DEFINE_RES_MEM(0xffe40000, 0x100),
36 DEFINE_RES_IRQ(evt2irq(0x8c0)),
37};
38
37static struct platform_device scif0_device = { 39static struct platform_device scif0_device = {
38 .name = "sh-sci", 40 .name = "sh-sci",
39 .id = 0, 41 .id = 0,
42 .resource = scif0_resources,
43 .num_resources = ARRAY_SIZE(scif0_resources),
40 .dev = { 44 .dev = {
41 .platform_data = &scif0_platform_data, 45 .platform_data = &scif0_platform_data,
42 }, 46 },
43}; 47};
44 48
45static struct plat_sci_port scif1_platform_data = { 49static struct plat_sci_port scif1_platform_data = {
46 .mapbase = 0xFFE41000,
47 .flags = UPF_BOOT_AUTOCONF, 50 .flags = UPF_BOOT_AUTOCONF,
48 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 51 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
49 .scbrr_algo_id = SCBRR_ALGO_2,
50 .type = PORT_SCIF, 52 .type = PORT_SCIF,
51 .irqs = SCIx_IRQ_MUXED(evt2irq(0x8E0)),
52 .regtype = SCIx_SH4_SCIF_REGTYPE, 53 .regtype = SCIx_SH4_SCIF_REGTYPE,
53}; 54};
54 55
56static struct resource scif1_resources[] = {
57 DEFINE_RES_MEM(0xffe41000, 0x100),
58 DEFINE_RES_IRQ(evt2irq(0x8e0)),
59};
60
55static struct platform_device scif1_device = { 61static struct platform_device scif1_device = {
56 .name = "sh-sci", 62 .name = "sh-sci",
57 .id = 1, 63 .id = 1,
64 .resource = scif1_resources,
65 .num_resources = ARRAY_SIZE(scif1_resources),
58 .dev = { 66 .dev = {
59 .platform_data = &scif1_platform_data, 67 .platform_data = &scif1_platform_data,
60 }, 68 },
61}; 69};
62 70
63static struct plat_sci_port scif2_platform_data = { 71static struct plat_sci_port scif2_platform_data = {
64 .mapbase = 0xFFE42000,
65 .flags = UPF_BOOT_AUTOCONF, 72 .flags = UPF_BOOT_AUTOCONF,
66 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 73 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
67 .scbrr_algo_id = SCBRR_ALGO_2,
68 .type = PORT_SCIF, 74 .type = PORT_SCIF,
69 .irqs = SCIx_IRQ_MUXED(evt2irq(0x900)),
70 .regtype = SCIx_SH4_SCIF_REGTYPE, 75 .regtype = SCIx_SH4_SCIF_REGTYPE,
71}; 76};
72 77
78static struct resource scif2_resources[] = {
79 DEFINE_RES_MEM(0xffe42000, 0x100),
80 DEFINE_RES_IRQ(evt2irq(0x900)),
81};
82
73static struct platform_device scif2_device = { 83static struct platform_device scif2_device = {
74 .name = "sh-sci", 84 .name = "sh-sci",
75 .id = 2, 85 .id = 2,
86 .resource = scif2_resources,
87 .num_resources = ARRAY_SIZE(scif2_resources),
76 .dev = { 88 .dev = {
77 .platform_data = &scif2_platform_data, 89 .platform_data = &scif2_platform_data,
78 }, 90 },
79}; 91};
80 92
81static struct plat_sci_port scif3_platform_data = { 93static struct plat_sci_port scif3_platform_data = {
82 .mapbase = 0xFFE43000,
83 .flags = UPF_BOOT_AUTOCONF, 94 .flags = UPF_BOOT_AUTOCONF,
84 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 95 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
85 .scbrr_algo_id = SCBRR_ALGO_2,
86 .type = PORT_SCIF, 96 .type = PORT_SCIF,
87 .irqs = SCIx_IRQ_MUXED(evt2irq(0x920)),
88 .regtype = SCIx_SH4_SCIF_REGTYPE, 97 .regtype = SCIx_SH4_SCIF_REGTYPE,
89}; 98};
90 99
100static struct resource scif3_resources[] = {
101 DEFINE_RES_MEM(0xffe43000, 0x100),
102 DEFINE_RES_IRQ(evt2irq(0x920)),
103};
104
91static struct platform_device scif3_device = { 105static struct platform_device scif3_device = {
92 .name = "sh-sci", 106 .name = "sh-sci",
93 .id = 3, 107 .id = 3,
108 .resource = scif3_resources,
109 .num_resources = ARRAY_SIZE(scif3_resources),
94 .dev = { 110 .dev = {
95 .platform_data = &scif3_platform_data, 111 .platform_data = &scif3_platform_data,
96 }, 112 },
97}; 113};
98 114
99static struct plat_sci_port scif4_platform_data = { 115static struct plat_sci_port scif4_platform_data = {
100 .mapbase = 0xFFE44000,
101 .flags = UPF_BOOT_AUTOCONF, 116 .flags = UPF_BOOT_AUTOCONF,
102 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 117 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
103 .scbrr_algo_id = SCBRR_ALGO_2,
104 .type = PORT_SCIF, 118 .type = PORT_SCIF,
105 .irqs = SCIx_IRQ_MUXED(evt2irq(0x940)),
106 .regtype = SCIx_SH4_SCIF_REGTYPE, 119 .regtype = SCIx_SH4_SCIF_REGTYPE,
107}; 120};
108 121
122static struct resource scif4_resources[] = {
123 DEFINE_RES_MEM(0xffe44000, 0x100),
124 DEFINE_RES_IRQ(evt2irq(0x940)),
125};
126
109static struct platform_device scif4_device = { 127static struct platform_device scif4_device = {
110 .name = "sh-sci", 128 .name = "sh-sci",
111 .id = 4, 129 .id = 4,
130 .resource = scif4_resources,
131 .num_resources = ARRAY_SIZE(scif4_resources),
112 .dev = { 132 .dev = {
113 .platform_data = &scif4_platform_data, 133 .platform_data = &scif4_platform_data,
114 }, 134 },
115}; 135};
116 136
117static struct plat_sci_port scif5_platform_data = { 137static struct plat_sci_port scif5_platform_data = {
118 .mapbase = 0xFFE43000,
119 .flags = UPF_BOOT_AUTOCONF, 138 .flags = UPF_BOOT_AUTOCONF,
120 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 139 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
121 .scbrr_algo_id = SCBRR_ALGO_2,
122 .type = PORT_SCIF, 140 .type = PORT_SCIF,
123 .irqs = SCIx_IRQ_MUXED(evt2irq(0x960)),
124 .regtype = SCIx_SH4_SCIF_REGTYPE, 141 .regtype = SCIx_SH4_SCIF_REGTYPE,
125}; 142};
126 143
144static struct resource scif5_resources[] = {
145 DEFINE_RES_MEM(0xffe43000, 0x100),
146 DEFINE_RES_IRQ(evt2irq(0x960)),
147};
148
127static struct platform_device scif5_device = { 149static struct platform_device scif5_device = {
128 .name = "sh-sci", 150 .name = "sh-sci",
129 .id = 5, 151 .id = 5,
152 .resource = scif5_resources,
153 .num_resources = ARRAY_SIZE(scif5_resources),
130 .dev = { 154 .dev = {
131 .platform_data = &scif5_platform_data, 155 .platform_data = &scif5_platform_data,
132 }, 156 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 9079a0f9ea9b..e43e5db53913 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -24,51 +24,63 @@
24#include <cpu/sh7757.h> 24#include <cpu/sh7757.h>
25 25
26static struct plat_sci_port scif2_platform_data = { 26static struct plat_sci_port scif2_platform_data = {
27 .mapbase = 0xfe4b0000, /* SCIF2 */
28 .flags = UPF_BOOT_AUTOCONF, 27 .flags = UPF_BOOT_AUTOCONF,
29 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 28 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
30 .scbrr_algo_id = SCBRR_ALGO_2,
31 .type = PORT_SCIF, 29 .type = PORT_SCIF,
32 .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)), 30};
31
32static struct resource scif2_resources[] = {
33 DEFINE_RES_MEM(0xfe4b0000, 0x100), /* SCIF2 */
34 DEFINE_RES_IRQ(evt2irq(0x700)),
33}; 35};
34 36
35static struct platform_device scif2_device = { 37static struct platform_device scif2_device = {
36 .name = "sh-sci", 38 .name = "sh-sci",
37 .id = 0, 39 .id = 0,
40 .resource = scif2_resources,
41 .num_resources = ARRAY_SIZE(scif2_resources),
38 .dev = { 42 .dev = {
39 .platform_data = &scif2_platform_data, 43 .platform_data = &scif2_platform_data,
40 }, 44 },
41}; 45};
42 46
43static struct plat_sci_port scif3_platform_data = { 47static struct plat_sci_port scif3_platform_data = {
44 .mapbase = 0xfe4c0000, /* SCIF3 */
45 .flags = UPF_BOOT_AUTOCONF, 48 .flags = UPF_BOOT_AUTOCONF,
46 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 49 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
47 .scbrr_algo_id = SCBRR_ALGO_2,
48 .type = PORT_SCIF, 50 .type = PORT_SCIF,
49 .irqs = SCIx_IRQ_MUXED(evt2irq(0xb80)), 51};
52
53static struct resource scif3_resources[] = {
54 DEFINE_RES_MEM(0xfe4c0000, 0x100), /* SCIF3 */
55 DEFINE_RES_IRQ(evt2irq(0xb80)),
50}; 56};
51 57
52static struct platform_device scif3_device = { 58static struct platform_device scif3_device = {
53 .name = "sh-sci", 59 .name = "sh-sci",
54 .id = 1, 60 .id = 1,
61 .resource = scif3_resources,
62 .num_resources = ARRAY_SIZE(scif3_resources),
55 .dev = { 63 .dev = {
56 .platform_data = &scif3_platform_data, 64 .platform_data = &scif3_platform_data,
57 }, 65 },
58}; 66};
59 67
60static struct plat_sci_port scif4_platform_data = { 68static struct plat_sci_port scif4_platform_data = {
61 .mapbase = 0xfe4d0000, /* SCIF4 */
62 .flags = UPF_BOOT_AUTOCONF, 69 .flags = UPF_BOOT_AUTOCONF,
63 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 70 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
64 .scbrr_algo_id = SCBRR_ALGO_2,
65 .type = PORT_SCIF, 71 .type = PORT_SCIF,
66 .irqs = SCIx_IRQ_MUXED(evt2irq(0xF00)), 72};
73
74static struct resource scif4_resources[] = {
75 DEFINE_RES_MEM(0xfe4d0000, 0x100), /* SCIF4 */
76 DEFINE_RES_IRQ(evt2irq(0xf00)),
67}; 77};
68 78
69static struct platform_device scif4_device = { 79static struct platform_device scif4_device = {
70 .name = "sh-sci", 80 .name = "sh-sci",
71 .id = 2, 81 .id = 2,
82 .resource = scif4_resources,
83 .num_resources = ARRAY_SIZE(scif4_resources),
72 .dev = { 84 .dev = {
73 .platform_data = &scif4_platform_data, 85 .platform_data = &scif4_platform_data,
74 }, 86 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index 1686acaaf45a..5eebbd7f4c21 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -19,54 +19,66 @@
19#include <linux/usb/ohci_pdriver.h> 19#include <linux/usb/ohci_pdriver.h>
20 20
21static struct plat_sci_port scif0_platform_data = { 21static struct plat_sci_port scif0_platform_data = {
22 .mapbase = 0xffe00000,
23 .flags = UPF_BOOT_AUTOCONF, 22 .flags = UPF_BOOT_AUTOCONF,
24 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 23 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
25 .scbrr_algo_id = SCBRR_ALGO_2,
26 .type = PORT_SCIF, 24 .type = PORT_SCIF,
27 .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)),
28 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 25 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
29}; 26};
30 27
28static struct resource scif0_resources[] = {
29 DEFINE_RES_MEM(0xffe00000, 0x100),
30 DEFINE_RES_IRQ(evt2irq(0x700)),
31};
32
31static struct platform_device scif0_device = { 33static struct platform_device scif0_device = {
32 .name = "sh-sci", 34 .name = "sh-sci",
33 .id = 0, 35 .id = 0,
36 .resource = scif0_resources,
37 .num_resources = ARRAY_SIZE(scif0_resources),
34 .dev = { 38 .dev = {
35 .platform_data = &scif0_platform_data, 39 .platform_data = &scif0_platform_data,
36 }, 40 },
37}; 41};
38 42
39static struct plat_sci_port scif1_platform_data = { 43static struct plat_sci_port scif1_platform_data = {
40 .mapbase = 0xffe08000,
41 .flags = UPF_BOOT_AUTOCONF, 44 .flags = UPF_BOOT_AUTOCONF,
42 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 45 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
43 .scbrr_algo_id = SCBRR_ALGO_2,
44 .type = PORT_SCIF, 46 .type = PORT_SCIF,
45 .irqs = SCIx_IRQ_MUXED(evt2irq(0xb80)),
46 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 47 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
47}; 48};
48 49
50static struct resource scif1_resources[] = {
51 DEFINE_RES_MEM(0xffe08000, 0x100),
52 DEFINE_RES_IRQ(evt2irq(0xb80)),
53};
54
49static struct platform_device scif1_device = { 55static struct platform_device scif1_device = {
50 .name = "sh-sci", 56 .name = "sh-sci",
51 .id = 1, 57 .id = 1,
58 .resource = scif1_resources,
59 .num_resources = ARRAY_SIZE(scif1_resources),
52 .dev = { 60 .dev = {
53 .platform_data = &scif1_platform_data, 61 .platform_data = &scif1_platform_data,
54 }, 62 },
55}; 63};
56 64
57static struct plat_sci_port scif2_platform_data = { 65static struct plat_sci_port scif2_platform_data = {
58 .mapbase = 0xffe10000,
59 .flags = UPF_BOOT_AUTOCONF, 66 .flags = UPF_BOOT_AUTOCONF,
60 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 67 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
61 .scbrr_algo_id = SCBRR_ALGO_2,
62 .type = PORT_SCIF, 68 .type = PORT_SCIF,
63 .irqs = SCIx_IRQ_MUXED(evt2irq(0xf00)),
64 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 69 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
65}; 70};
66 71
72static struct resource scif2_resources[] = {
73 DEFINE_RES_MEM(0xffe10000, 0x100),
74 DEFINE_RES_IRQ(evt2irq(0xf00)),
75};
76
67static struct platform_device scif2_device = { 77static struct platform_device scif2_device = {
68 .name = "sh-sci", 78 .name = "sh-sci",
69 .id = 2, 79 .id = 2,
80 .resource = scif2_resources,
81 .num_resources = ARRAY_SIZE(scif2_resources),
70 .dev = { 82 .dev = {
71 .platform_data = &scif2_platform_data, 83 .platform_data = &scif2_platform_data,
72 }, 84 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
index 256ea7a45164..e1ba8cb74e5a 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
@@ -16,170 +16,210 @@
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18static struct plat_sci_port scif0_platform_data = { 18static struct plat_sci_port scif0_platform_data = {
19 .mapbase = 0xff923000,
20 .flags = UPF_BOOT_AUTOCONF, 19 .flags = UPF_BOOT_AUTOCONF,
21 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 20 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
22 .scbrr_algo_id = SCBRR_ALGO_2,
23 .type = PORT_SCIF, 21 .type = PORT_SCIF,
24 .irqs = SCIx_IRQ_MUXED(evt2irq(0x9a0)), 22};
23
24static struct resource scif0_resources[] = {
25 DEFINE_RES_MEM(0xff923000, 0x100),
26 DEFINE_RES_IRQ(evt2irq(0x9a0)),
25}; 27};
26 28
27static struct platform_device scif0_device = { 29static struct platform_device scif0_device = {
28 .name = "sh-sci", 30 .name = "sh-sci",
29 .id = 0, 31 .id = 0,
32 .resource = scif0_resources,
33 .num_resources = ARRAY_SIZE(scif0_resources),
30 .dev = { 34 .dev = {
31 .platform_data = &scif0_platform_data, 35 .platform_data = &scif0_platform_data,
32 }, 36 },
33}; 37};
34 38
35static struct plat_sci_port scif1_platform_data = { 39static struct plat_sci_port scif1_platform_data = {
36 .mapbase = 0xff924000,
37 .flags = UPF_BOOT_AUTOCONF, 40 .flags = UPF_BOOT_AUTOCONF,
38 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 41 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
39 .scbrr_algo_id = SCBRR_ALGO_2,
40 .type = PORT_SCIF, 42 .type = PORT_SCIF,
41 .irqs = SCIx_IRQ_MUXED(evt2irq(0x9c0)), 43};
44
45static struct resource scif1_resources[] = {
46 DEFINE_RES_MEM(0xff924000, 0x100),
47 DEFINE_RES_IRQ(evt2irq(0x9c0)),
42}; 48};
43 49
44static struct platform_device scif1_device = { 50static struct platform_device scif1_device = {
45 .name = "sh-sci", 51 .name = "sh-sci",
46 .id = 1, 52 .id = 1,
53 .resource = scif1_resources,
54 .num_resources = ARRAY_SIZE(scif1_resources),
47 .dev = { 55 .dev = {
48 .platform_data = &scif1_platform_data, 56 .platform_data = &scif1_platform_data,
49 }, 57 },
50}; 58};
51 59
52static struct plat_sci_port scif2_platform_data = { 60static struct plat_sci_port scif2_platform_data = {
53 .mapbase = 0xff925000,
54 .flags = UPF_BOOT_AUTOCONF, 61 .flags = UPF_BOOT_AUTOCONF,
55 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 62 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
56 .scbrr_algo_id = SCBRR_ALGO_2,
57 .type = PORT_SCIF, 63 .type = PORT_SCIF,
58 .irqs = SCIx_IRQ_MUXED(evt2irq(0x9e0)), 64};
65
66static struct resource scif2_resources[] = {
67 DEFINE_RES_MEM(0xff925000, 0x100),
68 DEFINE_RES_IRQ(evt2irq(0x9e0)),
59}; 69};
60 70
61static struct platform_device scif2_device = { 71static struct platform_device scif2_device = {
62 .name = "sh-sci", 72 .name = "sh-sci",
63 .id = 2, 73 .id = 2,
74 .resource = scif2_resources,
75 .num_resources = ARRAY_SIZE(scif2_resources),
64 .dev = { 76 .dev = {
65 .platform_data = &scif2_platform_data, 77 .platform_data = &scif2_platform_data,
66 }, 78 },
67}; 79};
68 80
69static struct plat_sci_port scif3_platform_data = { 81static struct plat_sci_port scif3_platform_data = {
70 .mapbase = 0xff926000,
71 .flags = UPF_BOOT_AUTOCONF, 82 .flags = UPF_BOOT_AUTOCONF,
72 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 83 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
73 .scbrr_algo_id = SCBRR_ALGO_2,
74 .type = PORT_SCIF, 84 .type = PORT_SCIF,
75 .irqs = SCIx_IRQ_MUXED(evt2irq(0xa00)), 85};
86
87static struct resource scif3_resources[] = {
88 DEFINE_RES_MEM(0xff926000, 0x100),
89 DEFINE_RES_IRQ(evt2irq(0xa00)),
76}; 90};
77 91
78static struct platform_device scif3_device = { 92static struct platform_device scif3_device = {
79 .name = "sh-sci", 93 .name = "sh-sci",
80 .id = 3, 94 .id = 3,
95 .resource = scif3_resources,
96 .num_resources = ARRAY_SIZE(scif3_resources),
81 .dev = { 97 .dev = {
82 .platform_data = &scif3_platform_data, 98 .platform_data = &scif3_platform_data,
83 }, 99 },
84}; 100};
85 101
86static struct plat_sci_port scif4_platform_data = { 102static struct plat_sci_port scif4_platform_data = {
87 .mapbase = 0xff927000,
88 .flags = UPF_BOOT_AUTOCONF, 103 .flags = UPF_BOOT_AUTOCONF,
89 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 104 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
90 .scbrr_algo_id = SCBRR_ALGO_2,
91 .type = PORT_SCIF, 105 .type = PORT_SCIF,
92 .irqs = SCIx_IRQ_MUXED(evt2irq(0xa20)), 106};
107
108static struct resource scif4_resources[] = {
109 DEFINE_RES_MEM(0xff927000, 0x100),
110 DEFINE_RES_IRQ(evt2irq(0xa20)),
93}; 111};
94 112
95static struct platform_device scif4_device = { 113static struct platform_device scif4_device = {
96 .name = "sh-sci", 114 .name = "sh-sci",
97 .id = 4, 115 .id = 4,
116 .resource = scif4_resources,
117 .num_resources = ARRAY_SIZE(scif4_resources),
98 .dev = { 118 .dev = {
99 .platform_data = &scif4_platform_data, 119 .platform_data = &scif4_platform_data,
100 }, 120 },
101}; 121};
102 122
103static struct plat_sci_port scif5_platform_data = { 123static struct plat_sci_port scif5_platform_data = {
104 .mapbase = 0xff928000,
105 .flags = UPF_BOOT_AUTOCONF, 124 .flags = UPF_BOOT_AUTOCONF,
106 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 125 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
107 .scbrr_algo_id = SCBRR_ALGO_2,
108 .type = PORT_SCIF, 126 .type = PORT_SCIF,
109 .irqs = SCIx_IRQ_MUXED(evt2irq(0xa40)), 127};
128
129static struct resource scif5_resources[] = {
130 DEFINE_RES_MEM(0xff928000, 0x100),
131 DEFINE_RES_IRQ(evt2irq(0xa40)),
110}; 132};
111 133
112static struct platform_device scif5_device = { 134static struct platform_device scif5_device = {
113 .name = "sh-sci", 135 .name = "sh-sci",
114 .id = 5, 136 .id = 5,
137 .resource = scif5_resources,
138 .num_resources = ARRAY_SIZE(scif5_resources),
115 .dev = { 139 .dev = {
116 .platform_data = &scif5_platform_data, 140 .platform_data = &scif5_platform_data,
117 }, 141 },
118}; 142};
119 143
120static struct plat_sci_port scif6_platform_data = { 144static struct plat_sci_port scif6_platform_data = {
121 .mapbase = 0xff929000,
122 .flags = UPF_BOOT_AUTOCONF, 145 .flags = UPF_BOOT_AUTOCONF,
123 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 146 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
124 .scbrr_algo_id = SCBRR_ALGO_2,
125 .type = PORT_SCIF, 147 .type = PORT_SCIF,
126 .irqs = SCIx_IRQ_MUXED(evt2irq(0xa60)), 148};
149
150static struct resource scif6_resources[] = {
151 DEFINE_RES_MEM(0xff929000, 0x100),
152 DEFINE_RES_IRQ(evt2irq(0xa60)),
127}; 153};
128 154
129static struct platform_device scif6_device = { 155static struct platform_device scif6_device = {
130 .name = "sh-sci", 156 .name = "sh-sci",
131 .id = 6, 157 .id = 6,
158 .resource = scif6_resources,
159 .num_resources = ARRAY_SIZE(scif6_resources),
132 .dev = { 160 .dev = {
133 .platform_data = &scif6_platform_data, 161 .platform_data = &scif6_platform_data,
134 }, 162 },
135}; 163};
136 164
137static struct plat_sci_port scif7_platform_data = { 165static struct plat_sci_port scif7_platform_data = {
138 .mapbase = 0xff92a000,
139 .flags = UPF_BOOT_AUTOCONF, 166 .flags = UPF_BOOT_AUTOCONF,
140 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 167 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
141 .scbrr_algo_id = SCBRR_ALGO_2,
142 .type = PORT_SCIF, 168 .type = PORT_SCIF,
143 .irqs = SCIx_IRQ_MUXED(evt2irq(0xa80)), 169};
170
171static struct resource scif7_resources[] = {
172 DEFINE_RES_MEM(0xff92a000, 0x100),
173 DEFINE_RES_IRQ(evt2irq(0xa80)),
144}; 174};
145 175
146static struct platform_device scif7_device = { 176static struct platform_device scif7_device = {
147 .name = "sh-sci", 177 .name = "sh-sci",
148 .id = 7, 178 .id = 7,
179 .resource = scif7_resources,
180 .num_resources = ARRAY_SIZE(scif7_resources),
149 .dev = { 181 .dev = {
150 .platform_data = &scif7_platform_data, 182 .platform_data = &scif7_platform_data,
151 }, 183 },
152}; 184};
153 185
154static struct plat_sci_port scif8_platform_data = { 186static struct plat_sci_port scif8_platform_data = {
155 .mapbase = 0xff92b000,
156 .flags = UPF_BOOT_AUTOCONF, 187 .flags = UPF_BOOT_AUTOCONF,
157 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 188 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
158 .scbrr_algo_id = SCBRR_ALGO_2,
159 .type = PORT_SCIF, 189 .type = PORT_SCIF,
160 .irqs = SCIx_IRQ_MUXED(evt2irq(0xaa0)), 190};
191
192static struct resource scif8_resources[] = {
193 DEFINE_RES_MEM(0xff92b000, 0x100),
194 DEFINE_RES_IRQ(evt2irq(0xaa0)),
161}; 195};
162 196
163static struct platform_device scif8_device = { 197static struct platform_device scif8_device = {
164 .name = "sh-sci", 198 .name = "sh-sci",
165 .id = 8, 199 .id = 8,
200 .resource = scif8_resources,
201 .num_resources = ARRAY_SIZE(scif8_resources),
166 .dev = { 202 .dev = {
167 .platform_data = &scif8_platform_data, 203 .platform_data = &scif8_platform_data,
168 }, 204 },
169}; 205};
170 206
171static struct plat_sci_port scif9_platform_data = { 207static struct plat_sci_port scif9_platform_data = {
172 .mapbase = 0xff92c000,
173 .flags = UPF_BOOT_AUTOCONF, 208 .flags = UPF_BOOT_AUTOCONF,
174 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE, 209 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
175 .scbrr_algo_id = SCBRR_ALGO_2,
176 .type = PORT_SCIF, 210 .type = PORT_SCIF,
177 .irqs = SCIx_IRQ_MUXED(evt2irq(0xac0)), 211};
212
213static struct resource scif9_resources[] = {
214 DEFINE_RES_MEM(0xff92c000, 0x100),
215 DEFINE_RES_IRQ(evt2irq(0xac0)),
178}; 216};
179 217
180static struct platform_device scif9_device = { 218static struct platform_device scif9_device = {
181 .name = "sh-sci", 219 .name = "sh-sci",
182 .id = 9, 220 .id = 9,
221 .resource = scif9_resources,
222 .num_resources = ARRAY_SIZE(scif9_resources),
183 .dev = { 223 .dev = {
184 .platform_data = &scif9_platform_data, 224 .platform_data = &scif9_platform_data,
185 }, 225 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
index de45b704687a..668e54bafa86 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
@@ -18,36 +18,44 @@
18#include <cpu/dma-register.h> 18#include <cpu/dma-register.h>
19 19
20static struct plat_sci_port scif0_platform_data = { 20static struct plat_sci_port scif0_platform_data = {
21 .mapbase = 0xffe00000,
22 .flags = UPF_BOOT_AUTOCONF, 21 .flags = UPF_BOOT_AUTOCONF,
23 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 22 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
24 .scbrr_algo_id = SCBRR_ALGO_1,
25 .type = PORT_SCIF, 23 .type = PORT_SCIF,
26 .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)),
27 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 24 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
28}; 25};
29 26
27static struct resource scif0_resources[] = {
28 DEFINE_RES_MEM(0xffe00000, 0x100),
29 DEFINE_RES_IRQ(evt2irq(0x700)),
30};
31
30static struct platform_device scif0_device = { 32static struct platform_device scif0_device = {
31 .name = "sh-sci", 33 .name = "sh-sci",
32 .id = 0, 34 .id = 0,
35 .resource = scif0_resources,
36 .num_resources = ARRAY_SIZE(scif0_resources),
33 .dev = { 37 .dev = {
34 .platform_data = &scif0_platform_data, 38 .platform_data = &scif0_platform_data,
35 }, 39 },
36}; 40};
37 41
38static struct plat_sci_port scif1_platform_data = { 42static struct plat_sci_port scif1_platform_data = {
39 .mapbase = 0xffe10000,
40 .flags = UPF_BOOT_AUTOCONF, 43 .flags = UPF_BOOT_AUTOCONF,
41 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 44 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
42 .scbrr_algo_id = SCBRR_ALGO_1,
43 .type = PORT_SCIF, 45 .type = PORT_SCIF,
44 .irqs = SCIx_IRQ_MUXED(evt2irq(0xb80)),
45 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 46 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
46}; 47};
47 48
49static struct resource scif1_resources[] = {
50 DEFINE_RES_MEM(0xffe10000, 0x100),
51 DEFINE_RES_IRQ(evt2irq(0xb80)),
52};
53
48static struct platform_device scif1_device = { 54static struct platform_device scif1_device = {
49 .name = "sh-sci", 55 .name = "sh-sci",
50 .id = 1, 56 .id = 1,
57 .resource = scif1_resources,
58 .num_resources = ARRAY_SIZE(scif1_resources),
51 .dev = { 59 .dev = {
52 .platform_data = &scif1_platform_data, 60 .platform_data = &scif1_platform_data,
53 }, 61 },
@@ -409,9 +417,7 @@ void __init plat_early_device_setup(void)
409{ 417{
410 if (mach_is_sh2007()) { 418 if (mach_is_sh2007()) {
411 scif0_platform_data.scscr &= ~SCSCR_CKE1; 419 scif0_platform_data.scscr &= ~SCSCR_CKE1;
412 scif0_platform_data.scbrr_algo_id = SCBRR_ALGO_2;
413 scif1_platform_data.scscr &= ~SCSCR_CKE1; 420 scif1_platform_data.scscr &= ~SCSCR_CKE1;
414 scif1_platform_data.scbrr_algo_id = SCBRR_ALGO_2;
415 } 421 }
416 422
417 early_platform_add_devices(sh7780_early_devices, 423 early_platform_add_devices(sh7780_early_devices,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index 0968ecb962e6..4aa679140209 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -20,108 +20,132 @@
20#include <cpu/dma-register.h> 20#include <cpu/dma-register.h>
21 21
22static struct plat_sci_port scif0_platform_data = { 22static struct plat_sci_port scif0_platform_data = {
23 .mapbase = 0xffea0000,
24 .flags = UPF_BOOT_AUTOCONF, 23 .flags = UPF_BOOT_AUTOCONF,
25 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 24 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
26 .scbrr_algo_id = SCBRR_ALGO_1,
27 .type = PORT_SCIF, 25 .type = PORT_SCIF,
28 .irqs = SCIx_IRQ_MUXED(evt2irq(0x700)),
29 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 26 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
30}; 27};
31 28
29static struct resource scif0_resources[] = {
30 DEFINE_RES_MEM(0xffea0000, 0x100),
31 DEFINE_RES_IRQ(evt2irq(0x700)),
32};
33
32static struct platform_device scif0_device = { 34static struct platform_device scif0_device = {
33 .name = "sh-sci", 35 .name = "sh-sci",
34 .id = 0, 36 .id = 0,
37 .resource = scif0_resources,
38 .num_resources = ARRAY_SIZE(scif0_resources),
35 .dev = { 39 .dev = {
36 .platform_data = &scif0_platform_data, 40 .platform_data = &scif0_platform_data,
37 }, 41 },
38}; 42};
39 43
40static struct plat_sci_port scif1_platform_data = { 44static struct plat_sci_port scif1_platform_data = {
41 .mapbase = 0xffeb0000,
42 .flags = UPF_BOOT_AUTOCONF, 45 .flags = UPF_BOOT_AUTOCONF,
43 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 46 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
44 .scbrr_algo_id = SCBRR_ALGO_1,
45 .type = PORT_SCIF, 47 .type = PORT_SCIF,
46 .irqs = SCIx_IRQ_MUXED(evt2irq(0x780)),
47 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 48 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
48}; 49};
49 50
51static struct resource scif1_resources[] = {
52 DEFINE_RES_MEM(0xffeb0000, 0x100),
53 DEFINE_RES_IRQ(evt2irq(0x780)),
54};
55
50static struct platform_device scif1_device = { 56static struct platform_device scif1_device = {
51 .name = "sh-sci", 57 .name = "sh-sci",
52 .id = 1, 58 .id = 1,
59 .resource = scif1_resources,
60 .num_resources = ARRAY_SIZE(scif1_resources),
53 .dev = { 61 .dev = {
54 .platform_data = &scif1_platform_data, 62 .platform_data = &scif1_platform_data,
55 }, 63 },
56}; 64};
57 65
58static struct plat_sci_port scif2_platform_data = { 66static struct plat_sci_port scif2_platform_data = {
59 .mapbase = 0xffec0000,
60 .flags = UPF_BOOT_AUTOCONF, 67 .flags = UPF_BOOT_AUTOCONF,
61 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 68 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
62 .scbrr_algo_id = SCBRR_ALGO_1,
63 .type = PORT_SCIF, 69 .type = PORT_SCIF,
64 .irqs = SCIx_IRQ_MUXED(evt2irq(0x980)),
65 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 70 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
66}; 71};
67 72
73static struct resource scif2_resources[] = {
74 DEFINE_RES_MEM(0xffec0000, 0x100),
75 DEFINE_RES_IRQ(evt2irq(0x980)),
76};
77
68static struct platform_device scif2_device = { 78static struct platform_device scif2_device = {
69 .name = "sh-sci", 79 .name = "sh-sci",
70 .id = 2, 80 .id = 2,
81 .resource = scif2_resources,
82 .num_resources = ARRAY_SIZE(scif2_resources),
71 .dev = { 83 .dev = {
72 .platform_data = &scif2_platform_data, 84 .platform_data = &scif2_platform_data,
73 }, 85 },
74}; 86};
75 87
76static struct plat_sci_port scif3_platform_data = { 88static struct plat_sci_port scif3_platform_data = {
77 .mapbase = 0xffed0000,
78 .flags = UPF_BOOT_AUTOCONF, 89 .flags = UPF_BOOT_AUTOCONF,
79 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 90 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
80 .scbrr_algo_id = SCBRR_ALGO_1,
81 .type = PORT_SCIF, 91 .type = PORT_SCIF,
82 .irqs = SCIx_IRQ_MUXED(evt2irq(0x9a0)),
83 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 92 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
84}; 93};
85 94
95static struct resource scif3_resources[] = {
96 DEFINE_RES_MEM(0xffed0000, 0x100),
97 DEFINE_RES_IRQ(evt2irq(0x9a0)),
98};
99
86static struct platform_device scif3_device = { 100static struct platform_device scif3_device = {
87 .name = "sh-sci", 101 .name = "sh-sci",
88 .id = 3, 102 .id = 3,
103 .resource = scif3_resources,
104 .num_resources = ARRAY_SIZE(scif3_resources),
89 .dev = { 105 .dev = {
90 .platform_data = &scif3_platform_data, 106 .platform_data = &scif3_platform_data,
91 }, 107 },
92}; 108};
93 109
94static struct plat_sci_port scif4_platform_data = { 110static struct plat_sci_port scif4_platform_data = {
95 .mapbase = 0xffee0000,
96 .flags = UPF_BOOT_AUTOCONF, 111 .flags = UPF_BOOT_AUTOCONF,
97 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 112 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
98 .scbrr_algo_id = SCBRR_ALGO_1,
99 .type = PORT_SCIF, 113 .type = PORT_SCIF,
100 .irqs = SCIx_IRQ_MUXED(evt2irq(0x9c0)),
101 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 114 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
102}; 115};
103 116
117static struct resource scif4_resources[] = {
118 DEFINE_RES_MEM(0xffee0000, 0x100),
119 DEFINE_RES_IRQ(evt2irq(0x9c0)),
120};
121
104static struct platform_device scif4_device = { 122static struct platform_device scif4_device = {
105 .name = "sh-sci", 123 .name = "sh-sci",
106 .id = 4, 124 .id = 4,
125 .resource = scif4_resources,
126 .num_resources = ARRAY_SIZE(scif4_resources),
107 .dev = { 127 .dev = {
108 .platform_data = &scif4_platform_data, 128 .platform_data = &scif4_platform_data,
109 }, 129 },
110}; 130};
111 131
112static struct plat_sci_port scif5_platform_data = { 132static struct plat_sci_port scif5_platform_data = {
113 .mapbase = 0xffef0000,
114 .flags = UPF_BOOT_AUTOCONF, 133 .flags = UPF_BOOT_AUTOCONF,
115 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 134 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
116 .scbrr_algo_id = SCBRR_ALGO_1,
117 .type = PORT_SCIF, 135 .type = PORT_SCIF,
118 .irqs = SCIx_IRQ_MUXED(evt2irq(0x9e0)),
119 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 136 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
120}; 137};
121 138
139static struct resource scif5_resources[] = {
140 DEFINE_RES_MEM(0xffef0000, 0x100),
141 DEFINE_RES_IRQ(evt2irq(0x9e0)),
142};
143
122static struct platform_device scif5_device = { 144static struct platform_device scif5_device = {
123 .name = "sh-sci", 145 .name = "sh-sci",
124 .id = 5, 146 .id = 5,
147 .resource = scif5_resources,
148 .num_resources = ARRAY_SIZE(scif5_resources),
125 .dev = { 149 .dev = {
126 .platform_data = &scif5_platform_data, 150 .platform_data = &scif5_platform_data,
127 }, 151 },
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index ab52d4d4484d..5d619a551a3b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -28,21 +28,25 @@
28#include <asm/mmzone.h> 28#include <asm/mmzone.h>
29 29
30static struct plat_sci_port scif0_platform_data = { 30static struct plat_sci_port scif0_platform_data = {
31 .mapbase = 0xffea0000,
32 .flags = UPF_BOOT_AUTOCONF, 31 .flags = UPF_BOOT_AUTOCONF,
33 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 32 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
34 .scbrr_algo_id = SCBRR_ALGO_1,
35 .type = PORT_SCIF, 33 .type = PORT_SCIF,
36 .irqs = { evt2irq(0x700),
37 evt2irq(0x720),
38 evt2irq(0x760),
39 evt2irq(0x740) },
40 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 34 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
41}; 35};
42 36
37static struct resource scif0_resources[] = {
38 DEFINE_RES_MEM(0xffea0000, 0x100),
39 DEFINE_RES_IRQ(evt2irq(0x700)),
40 DEFINE_RES_IRQ(evt2irq(0x720)),
41 DEFINE_RES_IRQ(evt2irq(0x760)),
42 DEFINE_RES_IRQ(evt2irq(0x740)),
43};
44
43static struct platform_device scif0_device = { 45static struct platform_device scif0_device = {
44 .name = "sh-sci", 46 .name = "sh-sci",
45 .id = 0, 47 .id = 0,
48 .resource = scif0_resources,
49 .num_resources = ARRAY_SIZE(scif0_resources),
46 .dev = { 50 .dev = {
47 .platform_data = &scif0_platform_data, 51 .platform_data = &scif0_platform_data,
48 }, 52 },
@@ -52,90 +56,119 @@ static struct platform_device scif0_device = {
52 * The rest of these all have multiplexed IRQs 56 * The rest of these all have multiplexed IRQs
53 */ 57 */
54static struct plat_sci_port scif1_platform_data = { 58static struct plat_sci_port scif1_platform_data = {
55 .mapbase = 0xffeb0000,
56 .flags = UPF_BOOT_AUTOCONF, 59 .flags = UPF_BOOT_AUTOCONF,
57 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 60 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
58 .scbrr_algo_id = SCBRR_ALGO_1,
59 .type = PORT_SCIF, 61 .type = PORT_SCIF,
60 .irqs = SCIx_IRQ_MUXED(evt2irq(0x780)),
61 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 62 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
62}; 63};
63 64
65static struct resource scif1_resources[] = {
66 DEFINE_RES_MEM(0xffeb0000, 0x100),
67 DEFINE_RES_IRQ(evt2irq(0x780)),
68};
69
70static struct resource scif1_demux_resources[] = {
71 DEFINE_RES_MEM(0xffeb0000, 0x100),
72 /* Placeholders, see sh7786_devices_setup() */
73 DEFINE_RES_IRQ(0),
74 DEFINE_RES_IRQ(0),
75 DEFINE_RES_IRQ(0),
76 DEFINE_RES_IRQ(0),
77};
78
64static struct platform_device scif1_device = { 79static struct platform_device scif1_device = {
65 .name = "sh-sci", 80 .name = "sh-sci",
66 .id = 1, 81 .id = 1,
82 .resource = scif1_resources,
83 .num_resources = ARRAY_SIZE(scif1_resources),
67 .dev = { 84 .dev = {
68 .platform_data = &scif1_platform_data, 85 .platform_data = &scif1_platform_data,
69 }, 86 },
70}; 87};
71 88
72static struct plat_sci_port scif2_platform_data = { 89static struct plat_sci_port scif2_platform_data = {
73 .mapbase = 0xffec0000,
74 .flags = UPF_BOOT_AUTOCONF, 90 .flags = UPF_BOOT_AUTOCONF,
75 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 91 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
76 .scbrr_algo_id = SCBRR_ALGO_1,
77 .type = PORT_SCIF, 92 .type = PORT_SCIF,
78 .irqs = SCIx_IRQ_MUXED(evt2irq(0x840)),
79 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 93 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
80}; 94};
81 95
96static struct resource scif2_resources[] = {
97 DEFINE_RES_MEM(0xffec0000, 0x100),
98 DEFINE_RES_IRQ(evt2irq(0x840)),
99};
100
82static struct platform_device scif2_device = { 101static struct platform_device scif2_device = {
83 .name = "sh-sci", 102 .name = "sh-sci",
84 .id = 2, 103 .id = 2,
104 .resource = scif2_resources,
105 .num_resources = ARRAY_SIZE(scif2_resources),
85 .dev = { 106 .dev = {
86 .platform_data = &scif2_platform_data, 107 .platform_data = &scif2_platform_data,
87 }, 108 },
88}; 109};
89 110
90static struct plat_sci_port scif3_platform_data = { 111static struct plat_sci_port scif3_platform_data = {
91 .mapbase = 0xffed0000,
92 .flags = UPF_BOOT_AUTOCONF, 112 .flags = UPF_BOOT_AUTOCONF,
93 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 113 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
94 .scbrr_algo_id = SCBRR_ALGO_1,
95 .type = PORT_SCIF, 114 .type = PORT_SCIF,
96 .irqs = SCIx_IRQ_MUXED(evt2irq(0x860)),
97 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 115 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
98}; 116};
99 117
118static struct resource scif3_resources[] = {
119 DEFINE_RES_MEM(0xffed0000, 0x100),
120 DEFINE_RES_IRQ(evt2irq(0x860)),
121};
122
100static struct platform_device scif3_device = { 123static struct platform_device scif3_device = {
101 .name = "sh-sci", 124 .name = "sh-sci",
102 .id = 3, 125 .id = 3,
126 .resource = scif3_resources,
127 .num_resources = ARRAY_SIZE(scif3_resources),
103 .dev = { 128 .dev = {
104 .platform_data = &scif3_platform_data, 129 .platform_data = &scif3_platform_data,
105 }, 130 },
106}; 131};
107 132
108static struct plat_sci_port scif4_platform_data = { 133static struct plat_sci_port scif4_platform_data = {
109 .mapbase = 0xffee0000,
110 .flags = UPF_BOOT_AUTOCONF, 134 .flags = UPF_BOOT_AUTOCONF,
111 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 135 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
112 .scbrr_algo_id = SCBRR_ALGO_1,
113 .type = PORT_SCIF, 136 .type = PORT_SCIF,
114 .irqs = SCIx_IRQ_MUXED(evt2irq(0x880)),
115 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 137 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
116}; 138};
117 139
140static struct resource scif4_resources[] = {
141 DEFINE_RES_MEM(0xffee0000, 0x100),
142 DEFINE_RES_IRQ(evt2irq(0x880)),
143};
144
118static struct platform_device scif4_device = { 145static struct platform_device scif4_device = {
119 .name = "sh-sci", 146 .name = "sh-sci",
120 .id = 4, 147 .id = 4,
148 .resource = scif4_resources,
149 .num_resources = ARRAY_SIZE(scif4_resources),
121 .dev = { 150 .dev = {
122 .platform_data = &scif4_platform_data, 151 .platform_data = &scif4_platform_data,
123 }, 152 },
124}; 153};
125 154
126static struct plat_sci_port scif5_platform_data = { 155static struct plat_sci_port scif5_platform_data = {
127 .mapbase = 0xffef0000,
128 .flags = UPF_BOOT_AUTOCONF, 156 .flags = UPF_BOOT_AUTOCONF,
129 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1, 157 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
130 .scbrr_algo_id = SCBRR_ALGO_1,
131 .type = PORT_SCIF, 158 .type = PORT_SCIF,
132 .irqs = SCIx_IRQ_MUXED(evt2irq(0x8a0)),
133 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE, 159 .regtype = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
134}; 160};
135 161
162static struct resource scif5_resources[] = {
163 DEFINE_RES_MEM(0xffef0000, 0x100),
164 DEFINE_RES_IRQ(evt2irq(0x8a0)),
165};
166
136static struct platform_device scif5_device = { 167static struct platform_device scif5_device = {
137 .name = "sh-sci", 168 .name = "sh-sci",
138 .id = 5, 169 .id = 5,
170 .resource = scif5_resources,
171 .num_resources = ARRAY_SIZE(scif5_resources),
139 .dev = { 172 .dev = {
140 .platform_data = &scif5_platform_data, 173 .platform_data = &scif5_platform_data,
141 }, 174 },
@@ -1037,13 +1070,16 @@ static int __init sh7786_devices_setup(void)
1037 */ 1070 */
1038 irq = intc_irq_lookup(sh7786_intc_desc.name, TXI1); 1071 irq = intc_irq_lookup(sh7786_intc_desc.name, TXI1);
1039 if (irq > 0) { 1072 if (irq > 0) {
1040 scif1_platform_data.irqs[SCIx_TXI_IRQ] = irq; 1073 scif1_demux_resources[1].start =
1041 scif1_platform_data.irqs[SCIx_ERI_IRQ] =
1042 intc_irq_lookup(sh7786_intc_desc.name, ERI1); 1074 intc_irq_lookup(sh7786_intc_desc.name, ERI1);
1043 scif1_platform_data.irqs[SCIx_BRI_IRQ] = 1075 scif1_demux_resources[2].start =
1044 intc_irq_lookup(sh7786_intc_desc.name, BRI1);
1045 scif1_platform_data.irqs[SCIx_RXI_IRQ] =
1046 intc_irq_lookup(sh7786_intc_desc.name, RXI1); 1076 intc_irq_lookup(sh7786_intc_desc.name, RXI1);
1077 scif1_demux_resources[3].start = irq;
1078 scif1_demux_resources[4].start =
1079 intc_irq_lookup(sh7786_intc_desc.name, BRI1);
1080
1081 scif1_device.resource = scif1_demux_resources;
1082 scif1_device.num_resources = ARRAY_SIZE(scif1_demux_resources);
1047 } 1083 }
1048 1084
1049 ret = platform_add_devices(sh7786_early_devices, 1085 ret = platform_add_devices(sh7786_early_devices,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
index 688f7ed1bab1..0856bcbb1da0 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
@@ -28,60 +28,72 @@
28 * all rather than adding infrastructure to hack around it. 28 * all rather than adding infrastructure to hack around it.
29 */ 29 */
30static struct plat_sci_port scif0_platform_data = { 30static struct plat_sci_port scif0_platform_data = {
31 .mapbase = 0xffc30000,
32 .flags = UPF_BOOT_AUTOCONF, 31 .flags = UPF_BOOT_AUTOCONF,
33 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 32 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
34 .scbrr_algo_id = SCBRR_ALGO_2,
35 .type = PORT_SCIF, 33 .type = PORT_SCIF,
36 .irqs = { evt2irq(0x700), 34};
37 evt2irq(0x720), 35
38 evt2irq(0x760), 36static struct resource scif0_resources[] = {
39 evt2irq(0x740) }, 37 DEFINE_RES_MEM(0xffc30000, 0x100),
38 DEFINE_RES_IRQ(evt2irq(0x700)),
39 DEFINE_RES_IRQ(evt2irq(0x720)),
40 DEFINE_RES_IRQ(evt2irq(0x760)),
41 DEFINE_RES_IRQ(evt2irq(0x740)),
40}; 42};
41 43
42static struct platform_device scif0_device = { 44static struct platform_device scif0_device = {
43 .name = "sh-sci", 45 .name = "sh-sci",
44 .id = 0, 46 .id = 0,
47 .resource = scif0_resources,
48 .num_resources = ARRAY_SIZE(scif0_resources),
45 .dev = { 49 .dev = {
46 .platform_data = &scif0_platform_data, 50 .platform_data = &scif0_platform_data,
47 }, 51 },
48}; 52};
49 53
50static struct plat_sci_port scif1_platform_data = { 54static struct plat_sci_port scif1_platform_data = {
51 .mapbase = 0xffc40000,
52 .flags = UPF_BOOT_AUTOCONF, 55 .flags = UPF_BOOT_AUTOCONF,
53 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 56 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
54 .scbrr_algo_id = SCBRR_ALGO_2,
55 .type = PORT_SCIF, 57 .type = PORT_SCIF,
56 .irqs = { evt2irq(0x780), 58};
57 evt2irq(0x7a0), 59
58 evt2irq(0x7e0), 60static struct resource scif1_resources[] = {
59 evt2irq(0x7c0) }, 61 DEFINE_RES_MEM(0xffc40000, 0x100),
62 DEFINE_RES_IRQ(evt2irq(0x780)),
63 DEFINE_RES_IRQ(evt2irq(0x7a0)),
64 DEFINE_RES_IRQ(evt2irq(0x7e0)),
65 DEFINE_RES_IRQ(evt2irq(0x7c0)),
60}; 66};
61 67
62static struct platform_device scif1_device = { 68static struct platform_device scif1_device = {
63 .name = "sh-sci", 69 .name = "sh-sci",
64 .id = 1, 70 .id = 1,
71 .resource = scif1_resources,
72 .num_resources = ARRAY_SIZE(scif1_resources),
65 .dev = { 73 .dev = {
66 .platform_data = &scif1_platform_data, 74 .platform_data = &scif1_platform_data,
67 }, 75 },
68}; 76};
69 77
70static struct plat_sci_port scif2_platform_data = { 78static struct plat_sci_port scif2_platform_data = {
71 .mapbase = 0xffc60000,
72 .flags = UPF_BOOT_AUTOCONF, 79 .flags = UPF_BOOT_AUTOCONF,
73 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 80 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
74 .scbrr_algo_id = SCBRR_ALGO_2,
75 .type = PORT_SCIF, 81 .type = PORT_SCIF,
76 .irqs = { evt2irq(0x880), 82};
77 evt2irq(0x8a0), 83
78 evt2irq(0x8e0), 84static struct resource scif2_resources[] = {
79 evt2irq(0x8c0) }, 85 DEFINE_RES_MEM(0xffc60000, 0x100),
86 DEFINE_RES_IRQ(evt2irq(0x880)),
87 DEFINE_RES_IRQ(evt2irq(0x8a0)),
88 DEFINE_RES_IRQ(evt2irq(0x8e0)),
89 DEFINE_RES_IRQ(evt2irq(0x8c0)),
80}; 90};
81 91
82static struct platform_device scif2_device = { 92static struct platform_device scif2_device = {
83 .name = "sh-sci", 93 .name = "sh-sci",
84 .id = 2, 94 .id = 2,
95 .resource = scif2_resources,
96 .num_resources = ARRAY_SIZE(scif2_resources),
85 .dev = { 97 .dev = {
86 .platform_data = &scif2_platform_data, 98 .platform_data = &scif2_platform_data,
87 }, 99 },
diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c
index 18419f1de963..14d68213d16b 100644
--- a/arch/sh/kernel/cpu/sh5/setup-sh5.c
+++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c
@@ -17,17 +17,23 @@
17#include <asm/addrspace.h> 17#include <asm/addrspace.h>
18 18
19static struct plat_sci_port scif0_platform_data = { 19static struct plat_sci_port scif0_platform_data = {
20 .mapbase = PHYS_PERIPHERAL_BLOCK + 0x01030000,
21 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 20 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
22 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE, 21 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
23 .scbrr_algo_id = SCBRR_ALGO_2,
24 .type = PORT_SCIF, 22 .type = PORT_SCIF,
25 .irqs = { 39, 40, 42, 0 }, 23};
24
25static struct resource scif0_resources[] = {
26 DEFINE_RES_MEM(PHYS_PERIPHERAL_BLOCK + 0x01030000, 0x100),
27 DEFINE_RES_IRQ(39),
28 DEFINE_RES_IRQ(40),
29 DEFINE_RES_IRQ(42),
26}; 30};
27 31
28static struct platform_device scif0_device = { 32static struct platform_device scif0_device = {
29 .name = "sh-sci", 33 .name = "sh-sci",
30 .id = 0, 34 .id = 0,
35 .resource = scif0_resources,
36 .num_resources = ARRAY_SIZE(scif0_resources),
31 .dev = { 37 .dev = {
32 .platform_data = &scif0_platform_data, 38 .platform_data = &scif0_platform_data,
33 }, 39 },
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 49c09c7d5b77..67a049e75ec1 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -995,29 +995,19 @@ static struct unwinder dwarf_unwinder = {
995 995
996static void dwarf_unwinder_cleanup(void) 996static void dwarf_unwinder_cleanup(void)
997{ 997{
998 struct rb_node **fde_rb_node = &fde_root.rb_node; 998 struct dwarf_fde *fde, *next_fde;
999 struct rb_node **cie_rb_node = &cie_root.rb_node; 999 struct dwarf_cie *cie, *next_cie;
1000 1000
1001 /* 1001 /*
1002 * Deallocate all the memory allocated for the DWARF unwinder. 1002 * Deallocate all the memory allocated for the DWARF unwinder.
1003 * Traverse all the FDE/CIE lists and remove and free all the 1003 * Traverse all the FDE/CIE lists and remove and free all the
1004 * memory associated with those data structures. 1004 * memory associated with those data structures.
1005 */ 1005 */
1006 while (*fde_rb_node) { 1006 rbtree_postorder_for_each_entry_safe(fde, next_fde, &fde_root, node)
1007 struct dwarf_fde *fde;
1008
1009 fde = rb_entry(*fde_rb_node, struct dwarf_fde, node);
1010 rb_erase(*fde_rb_node, &fde_root);
1011 kfree(fde); 1007 kfree(fde);
1012 }
1013 1008
1014 while (*cie_rb_node) { 1009 rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node)
1015 struct dwarf_cie *cie;
1016
1017 cie = rb_entry(*cie_rb_node, struct dwarf_cie, node);
1018 rb_erase(*cie_rb_node, &cie_root);
1019 kfree(cie); 1010 kfree(cie);
1020 }
1021 1011
1022 kmem_cache_destroy(dwarf_reg_cachep); 1012 kmem_cache_destroy(dwarf_reg_cachep);
1023 kmem_cache_destroy(dwarf_frame_cachep); 1013 kmem_cache_destroy(dwarf_frame_cachep);
diff --git a/arch/sh/kernel/kgdb.c b/arch/sh/kernel/kgdb.c
index 38b313909ac9..adad46e41a1d 100644
--- a/arch/sh/kernel/kgdb.c
+++ b/arch/sh/kernel/kgdb.c
@@ -13,6 +13,7 @@
13#include <linux/kdebug.h> 13#include <linux/kdebug.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/sched.h>
16#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
17#include <asm/traps.h> 18#include <asm/traps.h>
18 19
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 1cf90e947dbf..de19cfa768f2 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -230,8 +230,8 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
230 pmb_bolt_mapping((unsigned long)__va(start), start, end - start, 230 pmb_bolt_mapping((unsigned long)__va(start), start, end - start,
231 PAGE_KERNEL); 231 PAGE_KERNEL);
232 232
233 memblock_set_node(PFN_PHYS(start_pfn), 233 memblock_set_node(PFN_PHYS(start_pfn), PFN_PHYS(end_pfn - start_pfn),
234 PFN_PHYS(end_pfn - start_pfn), nid); 234 &memblock.memory, nid);
235} 235}
236 236
237void __init __weak plat_early_device_setup(void) 237void __init __weak plat_early_device_setup(void)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index d4f7a6a163dc..c51efdcd07a2 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -13,6 +13,7 @@ config SPARC
13 bool 13 bool
14 default y 14 default y
15 select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI 15 select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
16 select ARCH_MIGHT_HAVE_PC_SERIO
16 select OF 17 select OF
17 select OF_PROMTREE 18 select OF_PROMTREE
18 select HAVE_IDE 19 select HAVE_IDE
@@ -152,10 +153,10 @@ config SMP
152 a system with only one CPU, say N. If you have a system with more 153 a system with only one CPU, say N. If you have a system with more
153 than one CPU, say Y. 154 than one CPU, say Y.
154 155
155 If you say N here, the kernel will run on single and multiprocessor 156 If you say N here, the kernel will run on uni- and multiprocessor
156 machines, but will use only one CPU of a multiprocessor machine. If 157 machines, but will use only one CPU of a multiprocessor machine. If
157 you say Y here, the kernel will run on many, but not all, 158 you say Y here, the kernel will run on many, but not all,
158 singleprocessor machines. On a singleprocessor machine, the kernel 159 uniprocessor machines. On a uniprocessor machine, the kernel
159 will run faster if you say N here. 160 will run faster if you say N here.
160 161
161 People using multiprocessor machines who say Y here should also say 162 People using multiprocessor machines who say Y here should also say
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index bf390667657a..4b60a0c325ec 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -17,3 +17,4 @@ generic-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 19generic-y += preempt.h
20generic-y += hash.h
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index 0f21e9a5ca18..54d9608681b6 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -74,6 +74,8 @@
74 74
75#define SO_MAX_PACING_RATE 0x0031 75#define SO_MAX_PACING_RATE 0x0031
76 76
77#define SO_BPF_EXTENSIONS 0x0032
78
77/* Security levels - as per NRL IPv6 - don't actually do anything */ 79/* Security levels - as per NRL IPv6 - don't actually do anything */
78#define SO_SECURITY_AUTHENTICATION 0x5001 80#define SO_SECURITY_AUTHENTICATION 0x5001
79#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 81#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h
index 62ced589bcf7..b73274fb961a 100644
--- a/arch/sparc/include/uapi/asm/unistd.h
+++ b/arch/sparc/include/uapi/asm/unistd.h
@@ -408,8 +408,10 @@
408#define __NR_kern_features 340 408#define __NR_kern_features 340
409#define __NR_kcmp 341 409#define __NR_kcmp 341
410#define __NR_finit_module 342 410#define __NR_finit_module 342
411#define __NR_sched_setattr 343
412#define __NR_sched_getattr 344
411 413
412#define NR_syscalls 343 414#define NR_syscalls 345
413 415
414/* Bitmask values returned from kern_features system call. */ 416/* Bitmask values returned from kern_features system call. */
415#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 417#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index cb5d272d658a..de1c844dfabc 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -6,7 +6,6 @@
6#include <linux/export.h> 6#include <linux/export.h>
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/cpumask.h> 9#include <linux/cpumask.h>
11#include <linux/spinlock.h> 10#include <linux/spinlock.h>
12#include <asm/cpudata.h> 11#include <asm/cpudata.h>
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index e306fb08ee5e..acf8314cec48 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -7,7 +7,6 @@
7#include <linux/export.h> 7#include <linux/export.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/init.h>
11#include <linux/interrupt.h> 10#include <linux/interrupt.h>
12#include <linux/delay.h> 11#include <linux/delay.h>
13 12
diff --git a/arch/sparc/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S
index 4eb1a5a1d544..b7ddcdd1dea9 100644
--- a/arch/sparc/kernel/hvtramp.S
+++ b/arch/sparc/kernel/hvtramp.S
@@ -3,7 +3,6 @@
3 * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
4 */ 4 */
5 5
6#include <linux/init.h>
7 6
8#include <asm/thread_info.h> 7#include <asm/thread_info.h>
9#include <asm/hypervisor.h> 8#include <asm/hypervisor.h>
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index de199bf0cb05..3241f56331c2 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -1,7 +1,6 @@
1#include <linux/string.h> 1#include <linux/string.h>
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/of.h> 3#include <linux/of.h>
4#include <linux/init.h>
5#include <linux/export.h> 4#include <linux/export.h>
6#include <linux/mod_devicetable.h> 5#include <linux/mod_devicetable.h>
7#include <linux/errno.h> 6#include <linux/errno.h>
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index cb021453de2a..1555bbcae1ee 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -392,7 +392,7 @@ static void apb_fake_ranges(struct pci_dev *dev,
392 res->flags = IORESOURCE_IO; 392 res->flags = IORESOURCE_IO;
393 region.start = (first << 21); 393 region.start = (first << 21);
394 region.end = (last << 21) + ((1 << 21) - 1); 394 region.end = (last << 21) + ((1 << 21) - 1);
395 pcibios_bus_to_resource(dev, res, &region); 395 pcibios_bus_to_resource(dev->bus, res, &region);
396 396
397 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); 397 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map);
398 apb_calc_first_last(map, &first, &last); 398 apb_calc_first_last(map, &first, &last);
@@ -400,7 +400,7 @@ static void apb_fake_ranges(struct pci_dev *dev,
400 res->flags = IORESOURCE_MEM; 400 res->flags = IORESOURCE_MEM;
401 region.start = (first << 29); 401 region.start = (first << 29);
402 region.end = (last << 29) + ((1 << 29) - 1); 402 region.end = (last << 29) + ((1 << 29) - 1);
403 pcibios_bus_to_resource(dev, res, &region); 403 pcibios_bus_to_resource(dev->bus, res, &region);
404} 404}
405 405
406static void pci_of_scan_bus(struct pci_pbm_info *pbm, 406static void pci_of_scan_bus(struct pci_pbm_info *pbm,
@@ -491,7 +491,7 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
491 res->flags = flags; 491 res->flags = flags;
492 region.start = GET_64BIT(ranges, 1); 492 region.start = GET_64BIT(ranges, 1);
493 region.end = region.start + size - 1; 493 region.end = region.start + size - 1;
494 pcibios_bus_to_resource(dev, res, &region); 494 pcibios_bus_to_resource(dev->bus, res, &region);
495 } 495 }
496after_ranges: 496after_ranges:
497 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 497 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
@@ -1005,6 +1005,5 @@ static int __init of_pci_slot_init(void)
1005 1005
1006 return 0; 1006 return 0;
1007} 1007}
1008 1008device_initcall(of_pci_slot_init);
1009module_init(of_pci_slot_init);
1010#endif 1009#endif
diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index a6895987fb70..944a06536ecc 100644
--- a/arch/sparc/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
@@ -5,7 +5,6 @@
5 5
6#include <linux/string.h> 6#include <linux/string.h>
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/init.h>
9#include <linux/pci.h> 8#include <linux/pci.h>
10#include <linux/device.h> 9#include <linux/device.h>
11#include <linux/of_device.h> 10#include <linux/of_device.h>
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index fdd819dfdacf..510baec1b69b 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -22,7 +22,6 @@
22#include <linux/reboot.h> 22#include <linux/reboot.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/init.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27 26
28#include <asm/auxio.h> 27#include <asm/auxio.h>
diff --git a/arch/sparc/kernel/sparc_ksyms_32.c b/arch/sparc/kernel/sparc_ksyms_32.c
index e521c54560f9..bf4ccb10a78c 100644
--- a/arch/sparc/kernel/sparc_ksyms_32.c
+++ b/arch/sparc/kernel/sparc_ksyms_32.c
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/init.h>
10 9
11#include <asm/pgtable.h> 10#include <asm/pgtable.h>
12#include <asm/uaccess.h> 11#include <asm/uaccess.h>
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c
index 9f5e24ddcc70..a92d5d2c46a3 100644
--- a/arch/sparc/kernel/sparc_ksyms_64.c
+++ b/arch/sparc/kernel/sparc_ksyms_64.c
@@ -7,7 +7,6 @@
7 7
8#include <linux/export.h> 8#include <linux/export.h>
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/init.h>
11#include <linux/bitops.h> 10#include <linux/bitops.h>
12 11
13#include <asm/cpudata.h> 12#include <asm/cpudata.h>
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 7b87171ecf1e..151ace8766cc 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -85,4 +85,4 @@ sys_call_table:
85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
88/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module 88/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 6d81597064b6..4bd4e2bb26cf 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -86,7 +86,7 @@ sys_call_table32:
86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init 86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init
87/*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime 87/*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev 88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
89/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module 89/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
90 90
91#endif /* CONFIG_COMPAT */ 91#endif /* CONFIG_COMPAT */
92 92
@@ -164,4 +164,4 @@ sys_call_table:
164 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 164 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
165/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 165/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
166 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 166 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
167/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module 167/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
diff --git a/arch/sparc/kernel/trampoline_32.S b/arch/sparc/kernel/trampoline_32.S
index 76dcbd3c988a..3eed99fc6989 100644
--- a/arch/sparc/kernel/trampoline_32.S
+++ b/arch/sparc/kernel/trampoline_32.S
@@ -5,7 +5,6 @@
5 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 5 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */ 6 */
7 7
8#include <linux/init.h>
9#include <asm/head.h> 8#include <asm/head.h>
10#include <asm/psr.h> 9#include <asm/psr.h>
11#include <asm/page.h> 10#include <asm/page.h>
diff --git a/arch/sparc/kernel/trampoline_64.S b/arch/sparc/kernel/trampoline_64.S
index ad4bde3bb61e..737f8cbc7d56 100644
--- a/arch/sparc/kernel/trampoline_64.S
+++ b/arch/sparc/kernel/trampoline_64.S
@@ -4,7 +4,6 @@
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
5 */ 5 */
6 6
7#include <linux/init.h>
8 7
9#include <asm/head.h> 8#include <asm/head.h>
10#include <asm/asi.h> 9#include <asm/asi.h>
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index 30963178d7e9..9bd9ce80bf77 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -4,7 +4,6 @@
4 * Copyright (C) 2002, 2003, 2006 David S. Miller (davem@davemloft.net) 4 * Copyright (C) 2002, 2003, 2006 David S. Miller (davem@davemloft.net)
5 */ 5 */
6 6
7#include <linux/init.h>
8#include <linux/fs.h> 7#include <linux/fs.h>
9#include <linux/mm.h> 8#include <linux/mm.h>
10#include <linux/hugetlb.h> 9#include <linux/hugetlb.h>
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 5322e530d09c..eafbc65c9c47 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1021,7 +1021,8 @@ static void __init add_node_ranges(void)
1021 "start[%lx] end[%lx]\n", 1021 "start[%lx] end[%lx]\n",
1022 nid, start, this_end); 1022 nid, start, this_end);
1023 1023
1024 memblock_set_node(start, this_end - start, nid); 1024 memblock_set_node(start, this_end - start,
1025 &memblock.memory, nid);
1025 start = this_end; 1026 start = this_end;
1026 } 1027 }
1027 } 1028 }
@@ -1325,7 +1326,7 @@ static void __init bootmem_init_nonnuma(void)
1325 (top_of_ram - total_ram) >> 20); 1326 (top_of_ram - total_ram) >> 20);
1326 1327
1327 init_node_masks_nonnuma(); 1328 init_node_masks_nonnuma();
1328 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 1329 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
1329 allocate_node_data(0); 1330 allocate_node_data(0);
1330 node_set_online(0); 1331 node_set_online(0);
1331} 1332}
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index ad3bf4b4324d..b12cb5e72812 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -4,7 +4,6 @@
4 */ 4 */
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/init.h>
8#include <linux/percpu.h> 7#include <linux/percpu.h>
9#include <linux/mm.h> 8#include <linux/mm.h>
10#include <linux/swap.h> 9#include <linux/swap.h>
diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c
index 04a4540509dd..e58b81726319 100644
--- a/arch/sparc/prom/p1275.c
+++ b/arch/sparc/prom/p1275.c
@@ -5,7 +5,6 @@
5 */ 5 */
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/sched.h> 8#include <linux/sched.h>
10#include <linux/smp.h> 9#include <linux/smp.h>
11#include <linux/string.h> 10#include <linux/string.h>
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 22f3bd147fa7..3793c75e45d9 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -39,3 +39,4 @@ generic-y += trace_clock.h
39generic-y += types.h 39generic-y += types.h
40generic-y += xor.h 40generic-y += xor.h
41generic-y += preempt.h 41generic-y += preempt.h
42generic-y += hash.h
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h
index 78f1f2ded86c..ffd4493efc78 100644
--- a/arch/tile/include/asm/compat.h
+++ b/arch/tile/include/asm/compat.h
@@ -281,7 +281,6 @@ long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count,
281 u32 dummy, u32 low, u32 high); 281 u32 dummy, u32 low, u32 high);
282long compat_sys_pwrite64(unsigned int fd, char __user *ubuf, size_t count, 282long compat_sys_pwrite64(unsigned int fd, char __user *ubuf, size_t count,
283 u32 dummy, u32 low, u32 high); 283 u32 dummy, u32 low, u32 high);
284long compat_sys_lookup_dcookie(u32 low, u32 high, char __user *buf, size_t len);
285long compat_sys_sync_file_range2(int fd, unsigned int flags, 284long compat_sys_sync_file_range2(int fd, unsigned int flags,
286 u32 offset_lo, u32 offset_hi, 285 u32 offset_lo, u32 offset_hi,
287 u32 nbytes_lo, u32 nbytes_hi); 286 u32 nbytes_lo, u32 nbytes_hi);
diff --git a/arch/tile/include/asm/fixmap.h b/arch/tile/include/asm/fixmap.h
index c6b9c1b38fd1..ffe2637aeb31 100644
--- a/arch/tile/include/asm/fixmap.h
+++ b/arch/tile/include/asm/fixmap.h
@@ -25,9 +25,6 @@
25#include <asm/kmap_types.h> 25#include <asm/kmap_types.h>
26#endif 26#endif
27 27
28#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
29#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
30
31/* 28/*
32 * Here we define all the compile-time 'special' virtual 29 * Here we define all the compile-time 'special' virtual
33 * addresses. The point is to have a constant address at 30 * addresses. The point is to have a constant address at
@@ -83,35 +80,7 @@ enum fixed_addresses {
83#define FIXADDR_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_SIZE) 80#define FIXADDR_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_SIZE)
84#define FIXADDR_BOOT_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_BOOT_SIZE) 81#define FIXADDR_BOOT_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_BOOT_SIZE)
85 82
86extern void __this_fixmap_does_not_exist(void); 83#include <asm-generic/fixmap.h>
87
88/*
89 * 'index to address' translation. If anyone tries to use the idx
90 * directly without tranlation, we catch the bug with a NULL-deference
91 * kernel oops. Illegal ranges of incoming indices are caught too.
92 */
93static __always_inline unsigned long fix_to_virt(const unsigned int idx)
94{
95 /*
96 * this branch gets completely eliminated after inlining,
97 * except when someone tries to use fixaddr indices in an
98 * illegal way. (such as mixing up address types or using
99 * out-of-range indices).
100 *
101 * If it doesn't get removed, the linker will complain
102 * loudly with a reasonably clear error message..
103 */
104 if (idx >= __end_of_fixed_addresses)
105 __this_fixmap_does_not_exist();
106
107 return __fix_to_virt(idx);
108}
109
110static inline unsigned long virt_to_fix(const unsigned long vaddr)
111{
112 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
113 return __virt_to_fix(vaddr);
114}
115 84
116#endif /* !__ASSEMBLY__ */ 85#endif /* !__ASSEMBLY__ */
117 86
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index fdde187e6087..88a330dcdede 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -4,3 +4,5 @@ generic-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 6generic-y += preempt.h
7generic-y += hash.h
8generic-y += barrier.h
diff --git a/arch/um/include/asm/fixmap.h b/arch/um/include/asm/fixmap.h
index 21a423bae5e8..3094ea3c73b0 100644
--- a/arch/um/include/asm/fixmap.h
+++ b/arch/um/include/asm/fixmap.h
@@ -43,13 +43,6 @@ enum fixed_addresses {
43extern void __set_fixmap (enum fixed_addresses idx, 43extern void __set_fixmap (enum fixed_addresses idx,
44 unsigned long phys, pgprot_t flags); 44 unsigned long phys, pgprot_t flags);
45 45
46#define set_fixmap(idx, phys) \
47 __set_fixmap(idx, phys, PAGE_KERNEL)
48/*
49 * Some hardware wants to get fixmapped without caching.
50 */
51#define set_fixmap_nocache(idx, phys) \
52 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
53/* 46/*
54 * used by vmalloc.c. 47 * used by vmalloc.c.
55 * 48 *
@@ -62,37 +55,6 @@ extern void __set_fixmap (enum fixed_addresses idx,
62#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 55#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
63#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 56#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
64 57
65#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) 58#include <asm-generic/fixmap.h>
66#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
67
68extern void __this_fixmap_does_not_exist(void);
69
70/*
71 * 'index to address' translation. If anyone tries to use the idx
72 * directly without tranlation, we catch the bug with a NULL-deference
73 * kernel oops. Illegal ranges of incoming indices are caught too.
74 */
75static inline unsigned long fix_to_virt(const unsigned int idx)
76{
77 /*
78 * this branch gets completely eliminated after inlining,
79 * except when someone tries to use fixaddr indices in an
80 * illegal way. (such as mixing up address types or using
81 * out-of-range indices).
82 *
83 * If it doesn't get removed, the linker will complain
84 * loudly with a reasonably clear error message..
85 */
86 if (idx >= __end_of_fixed_addresses)
87 __this_fixmap_does_not_exist();
88
89 return __fix_to_virt(idx);
90}
91
92static inline unsigned long virt_to_fix(const unsigned long vaddr)
93{
94 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
95 return __virt_to_fix(vaddr);
96}
97 59
98#endif 60#endif
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index d89b02bb6262..cbc5edd5a901 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -25,10 +25,8 @@ struct thread_struct {
25 void *fault_addr; 25 void *fault_addr;
26 jmp_buf *fault_catcher; 26 jmp_buf *fault_catcher;
27 struct task_struct *prev_sched; 27 struct task_struct *prev_sched;
28 unsigned long temp_stack;
29 struct arch_thread arch; 28 struct arch_thread arch;
30 jmp_buf switch_buf; 29 jmp_buf switch_buf;
31 int mm_count;
32 struct { 30 struct {
33 int op; 31 int op;
34 union { 32 union {
@@ -52,7 +50,6 @@ struct thread_struct {
52 .regs = EMPTY_REGS, \ 50 .regs = EMPTY_REGS, \
53 .fault_addr = NULL, \ 51 .fault_addr = NULL, \
54 .prev_sched = NULL, \ 52 .prev_sched = NULL, \
55 .temp_stack = 0, \
56 .arch = INIT_ARCH_THREAD, \ 53 .arch = INIT_ARCH_THREAD, \
57 .request = { 0 } \ 54 .request = { 0 } \
58} 55}
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index a7ba27b2752b..25c0dba508cc 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -1,6 +1,7 @@
1config UNICORE32 1config UNICORE32
2 def_bool y 2 def_bool y
3 select ARCH_MIGHT_HAVE_PC_PARPORT 3 select ARCH_MIGHT_HAVE_PC_PARPORT
4 select ARCH_MIGHT_HAVE_PC_SERIO
4 select HAVE_MEMBLOCK 5 select HAVE_MEMBLOCK
5 select HAVE_GENERIC_DMA_COHERENT 6 select HAVE_GENERIC_DMA_COHERENT
6 select HAVE_DMA_ATTRS 7 select HAVE_DMA_ATTRS
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index 00045cbe5c63..3ef4f9d9bf5d 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -61,3 +61,4 @@ generic-y += user.h
61generic-y += vga.h 61generic-y += vga.h
62generic-y += xor.h 62generic-y += xor.h
63generic-y += preempt.h 63generic-y += preempt.h
64generic-y += hash.h
diff --git a/arch/unicore32/kernel/early_printk.c b/arch/unicore32/kernel/early_printk.c
index 9be0d5d02a9a..f2f6323c8d64 100644
--- a/arch/unicore32/kernel/early_printk.c
+++ b/arch/unicore32/kernel/early_printk.c
@@ -35,17 +35,11 @@ static struct console early_ocd_console = {
35 35
36static int __init setup_early_printk(char *buf) 36static int __init setup_early_printk(char *buf)
37{ 37{
38 int keep_early;
39
40 if (!buf || early_console) 38 if (!buf || early_console)
41 return 0; 39 return 0;
42 40
43 if (strstr(buf, "keep"))
44 keep_early = 1;
45
46 early_console = &early_ocd_console; 41 early_console = &early_ocd_console;
47 42 if (strstr(buf, "keep"))
48 if (keep_early)
49 early_console->flags &= ~CON_BOOT; 43 early_console->flags &= ~CON_BOOT;
50 else 44 else
51 early_console->flags |= CON_BOOT; 45 early_console->flags |= CON_BOOT;
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index ae6bc036db92..be2bde9b07cf 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -66,9 +66,6 @@ void show_mem(unsigned int filter)
66 printk(KERN_DEFAULT "Mem-info:\n"); 66 printk(KERN_DEFAULT "Mem-info:\n");
67 show_free_areas(filter); 67 show_free_areas(filter);
68 68
69 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
70 return;
71
72 for_each_bank(i, mi) { 69 for_each_bank(i, mi) {
73 struct membank *bank = &mi->bank[i]; 70 struct membank *bank = &mi->bank[i];
74 unsigned int pfn1, pfn2; 71 unsigned int pfn1, pfn2;
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3b6922ebf170..0af5250d914f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -23,6 +23,7 @@ config X86
23 def_bool y 23 def_bool y
24 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 24 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
25 select ARCH_MIGHT_HAVE_PC_PARPORT 25 select ARCH_MIGHT_HAVE_PC_PARPORT
26 select ARCH_MIGHT_HAVE_PC_SERIO
26 select HAVE_AOUT if X86_32 27 select HAVE_AOUT if X86_32
27 select HAVE_UNSTABLE_SCHED_CLOCK 28 select HAVE_UNSTABLE_SCHED_CLOCK
28 select ARCH_SUPPORTS_NUMA_BALANCING 29 select ARCH_SUPPORTS_NUMA_BALANCING
@@ -279,13 +280,13 @@ config SMP
279 bool "Symmetric multi-processing support" 280 bool "Symmetric multi-processing support"
280 ---help--- 281 ---help---
281 This enables support for systems with more than one CPU. If you have 282 This enables support for systems with more than one CPU. If you have
282 a system with only one CPU, like most personal computers, say N. If 283 a system with only one CPU, say N. If you have a system with more
283 you have a system with more than one CPU, say Y. 284 than one CPU, say Y.
284 285
285 If you say N here, the kernel will run on single and multiprocessor 286 If you say N here, the kernel will run on uni- and multiprocessor
286 machines, but will use only one CPU of a multiprocessor machine. If 287 machines, but will use only one CPU of a multiprocessor machine. If
287 you say Y here, the kernel will run on many, but not all, 288 you say Y here, the kernel will run on many, but not all,
288 singleprocessor machines. On a singleprocessor machine, the kernel 289 uniprocessor machines. On a uniprocessor machine, the kernel
289 will run faster if you say N here. 290 will run faster if you say N here.
290 291
291 Note that if you say Y here and choose architecture "586" or 292 Note that if you say Y here and choose architecture "586" or
@@ -732,6 +733,7 @@ config APB_TIMER
732# The code disables itself when not needed. 733# The code disables itself when not needed.
733config DMI 734config DMI
734 default y 735 default y
736 select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
735 bool "Enable DMI scanning" if EXPERT 737 bool "Enable DMI scanning" if EXPERT
736 ---help--- 738 ---help---
737 Enabled scanning of DMI to identify machine quirks. Say Y 739 Enabled scanning of DMI to identify machine quirks. Say Y
@@ -939,7 +941,7 @@ config X86_ANCIENT_MCE
939 depends on X86_32 && X86_MCE 941 depends on X86_32 && X86_MCE
940 ---help--- 942 ---help---
941 Include support for machine check handling on old Pentium 5 or WinChip 943 Include support for machine check handling on old Pentium 5 or WinChip
942 systems. These typically need to be enabled explicitely on the command 944 systems. These typically need to be enabled explicitly on the command
943 line. 945 line.
944 946
945config X86_MCE_THRESHOLD 947config X86_MCE_THRESHOLD
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 13b22e0f681d..eeda43abed6e 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -11,6 +11,28 @@ else
11 KBUILD_DEFCONFIG := $(ARCH)_defconfig 11 KBUILD_DEFCONFIG := $(ARCH)_defconfig
12endif 12endif
13 13
14# How to compile the 16-bit code. Note we always compile for -march=i386;
15# that way we can complain to the user if the CPU is insufficient.
16#
17# The -m16 option is supported by GCC >= 4.9 and clang >= 3.5. For
18# older versions of GCC, we need to play evil and unreliable tricks to
19# attempt to ensure that our asm(".code16gcc") is first in the asm
20# output.
21CODE16GCC_CFLAGS := -m32 -include $(srctree)/arch/x86/boot/code16gcc.h \
22 $(call cc-option, -fno-toplevel-reorder,\
23 $(call cc-option, -fno-unit-at-a-time))
24M16_CFLAGS := $(call cc-option, -m16, $(CODE16GCC_CFLAGS))
25
26REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -D__KERNEL__ \
27 -DDISABLE_BRANCH_PROFILING \
28 -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
29 -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
30 -mno-mmx -mno-sse \
31 $(call cc-option, -ffreestanding) \
32 $(call cc-option, -fno-stack-protector) \
33 $(call cc-option, -mpreferred-stack-boundary=2)
34export REALMODE_CFLAGS
35
14# BITS is used as extension for files which are available in a 32 bit 36# BITS is used as extension for files which are available in a 32 bit
15# and a 64 bit version to simplify shared Makefiles. 37# and a 64 bit version to simplify shared Makefiles.
16# e.g.: obj-y += foo_$(BITS).o 38# e.g.: obj-y += foo_$(BITS).o
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index de7066918005..878df7e88cd4 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -51,20 +51,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE
51 51
52# --------------------------------------------------------------------------- 52# ---------------------------------------------------------------------------
53 53
54# How to compile the 16-bit code. Note we always compile for -march=i386, 54KBUILD_CFLAGS := $(USERINCLUDE) $(REALMODE_CFLAGS) -D_SETUP
55# that way we can complain to the user if the CPU is insufficient.
56KBUILD_CFLAGS := $(USERINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \
57 -DDISABLE_BRANCH_PROFILING \
58 -Wall -Wstrict-prototypes \
59 -march=i386 -mregparm=3 \
60 -include $(srctree)/$(src)/code16gcc.h \
61 -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
62 -mno-mmx -mno-sse \
63 $(call cc-option, -ffreestanding) \
64 $(call cc-option, -fno-toplevel-reorder,\
65 $(call cc-option, -fno-unit-at-a-time)) \
66 $(call cc-option, -fno-stack-protector) \
67 $(call cc-option, -mpreferred-stack-boundary=2)
68KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 55KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
69GCOV_PROFILE := n 56GCOV_PROFILE := n
70 57
diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c
index a9fcb7cfb241..431fa5f84537 100644
--- a/arch/x86/boot/cpuflags.c
+++ b/arch/x86/boot/cpuflags.c
@@ -28,20 +28,35 @@ static int has_fpu(void)
28 return fsw == 0 && (fcw & 0x103f) == 0x003f; 28 return fsw == 0 && (fcw & 0x103f) == 0x003f;
29} 29}
30 30
31/*
32 * For building the 16-bit code we want to explicitly specify 32-bit
33 * push/pop operations, rather than just saying 'pushf' or 'popf' and
34 * letting the compiler choose. But this is also included from the
35 * compressed/ directory where it may be 64-bit code, and thus needs
36 * to be 'pushfq' or 'popfq' in that case.
37 */
38#ifdef __x86_64__
39#define PUSHF "pushfq"
40#define POPF "popfq"
41#else
42#define PUSHF "pushfl"
43#define POPF "popfl"
44#endif
45
31int has_eflag(unsigned long mask) 46int has_eflag(unsigned long mask)
32{ 47{
33 unsigned long f0, f1; 48 unsigned long f0, f1;
34 49
35 asm volatile("pushf \n\t" 50 asm volatile(PUSHF " \n\t"
36 "pushf \n\t" 51 PUSHF " \n\t"
37 "pop %0 \n\t" 52 "pop %0 \n\t"
38 "mov %0,%1 \n\t" 53 "mov %0,%1 \n\t"
39 "xor %2,%1 \n\t" 54 "xor %2,%1 \n\t"
40 "push %1 \n\t" 55 "push %1 \n\t"
41 "popf \n\t" 56 POPF " \n\t"
42 "pushf \n\t" 57 PUSHF " \n\t"
43 "pop %1 \n\t" 58 "pop %1 \n\t"
44 "popf" 59 POPF
45 : "=&r" (f0), "=&r" (f1) 60 : "=&r" (f0), "=&r" (f1)
46 : "ri" (mask)); 61 : "ri" (mask));
47 62
diff --git a/arch/x86/boot/video.h b/arch/x86/boot/video.h
index ff339c5db311..0bb25491262d 100644
--- a/arch/x86/boot/video.h
+++ b/arch/x86/boot/video.h
@@ -80,7 +80,7 @@ struct card_info {
80 u16 xmode_n; /* Size of unprobed mode range */ 80 u16 xmode_n; /* Size of unprobed mode range */
81}; 81};
82 82
83#define __videocard struct card_info __attribute__((section(".videocards"))) 83#define __videocard struct card_info __attribute__((used,section(".videocards")))
84extern struct card_info video_cards[], video_cards_end[]; 84extern struct card_info video_cards[], video_cards_end[];
85 85
86int mode_defined(u16 mode); /* video.c */ 86int mode_defined(u16 mode); /* video.c */
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index e0fc24db234a..6ba54d640383 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -76,6 +76,7 @@ ifeq ($(avx2_supported),yes)
76endif 76endif
77 77
78aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o 78aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
79aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx-x86_64.o
79ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o 80ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
80sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o 81sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o
81crc32c-intel-y := crc32c-intel_glue.o 82crc32c-intel-y := crc32c-intel_glue.o
diff --git a/arch/x86/crypto/aesni-intel_avx-x86_64.S b/arch/x86/crypto/aesni-intel_avx-x86_64.S
new file mode 100644
index 000000000000..522ab68d1c88
--- /dev/null
+++ b/arch/x86/crypto/aesni-intel_avx-x86_64.S
@@ -0,0 +1,2811 @@
1########################################################################
2# Copyright (c) 2013, Intel Corporation
3#
4# This software is available to you under a choice of one of two
5# licenses. You may choose to be licensed under the terms of the GNU
6# General Public License (GPL) Version 2, available from the file
7# COPYING in the main directory of this source tree, or the
8# OpenIB.org BSD license below:
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions are
12# met:
13#
14# * Redistributions of source code must retain the above copyright
15# notice, this list of conditions and the following disclaimer.
16#
17# * Redistributions in binary form must reproduce the above copyright
18# notice, this list of conditions and the following disclaimer in the
19# documentation and/or other materials provided with the
20# distribution.
21#
22# * Neither the name of the Intel Corporation nor the names of its
23# contributors may be used to endorse or promote products derived from
24# this software without specific prior written permission.
25#
26#
27# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY
28# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR
31# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES# LOSS OF USE, DATA, OR
34# PROFITS# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38########################################################################
39##
40## Authors:
41## Erdinc Ozturk <erdinc.ozturk@intel.com>
42## Vinodh Gopal <vinodh.gopal@intel.com>
43## James Guilford <james.guilford@intel.com>
44## Tim Chen <tim.c.chen@linux.intel.com>
45##
46## References:
47## This code was derived and highly optimized from the code described in paper:
48## Vinodh Gopal et. al. Optimized Galois-Counter-Mode Implementation
49## on Intel Architecture Processors. August, 2010
50## The details of the implementation is explained in:
51## Erdinc Ozturk et. al. Enabling High-Performance Galois-Counter-Mode
52## on Intel Architecture Processors. October, 2012.
53##
54## Assumptions:
55##
56##
57##
58## iv:
59## 0 1 2 3
60## 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
61## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62## | Salt (From the SA) |
63## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
64## | Initialization Vector |
65## | (This is the sequence number from IPSec header) |
66## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
67## | 0x1 |
68## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
69##
70##
71##
72## AAD:
73## AAD padded to 128 bits with 0
74## for example, assume AAD is a u32 vector
75##
76## if AAD is 8 bytes:
77## AAD[3] = {A0, A1}#
78## padded AAD in xmm register = {A1 A0 0 0}
79##
80## 0 1 2 3
81## 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
82## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
83## | SPI (A1) |
84## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
85## | 32-bit Sequence Number (A0) |
86## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
87## | 0x0 |
88## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
89##
90## AAD Format with 32-bit Sequence Number
91##
92## if AAD is 12 bytes:
93## AAD[3] = {A0, A1, A2}#
94## padded AAD in xmm register = {A2 A1 A0 0}
95##
96## 0 1 2 3
97## 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
98## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
99## | SPI (A2) |
100## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
101## | 64-bit Extended Sequence Number {A1,A0} |
102## | |
103## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
104## | 0x0 |
105## +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
106##
107## AAD Format with 64-bit Extended Sequence Number
108##
109##
110## aadLen:
111## from the definition of the spec, aadLen can only be 8 or 12 bytes.
112## The code additionally supports aadLen of length 16 bytes.
113##
114## TLen:
115## from the definition of the spec, TLen can only be 8, 12 or 16 bytes.
116##
117## poly = x^128 + x^127 + x^126 + x^121 + 1
118## throughout the code, one tab and two tab indentations are used. one tab is
119## for GHASH part, two tabs is for AES part.
120##
121
122#include <linux/linkage.h>
123#include <asm/inst.h>
124
125.data
126.align 16
127
128POLY: .octa 0xC2000000000000000000000000000001
129POLY2: .octa 0xC20000000000000000000001C2000000
130TWOONE: .octa 0x00000001000000000000000000000001
131
132# order of these constants should not change.
133# more specifically, ALL_F should follow SHIFT_MASK, and ZERO should follow ALL_F
134
135SHUF_MASK: .octa 0x000102030405060708090A0B0C0D0E0F
136SHIFT_MASK: .octa 0x0f0e0d0c0b0a09080706050403020100
137ALL_F: .octa 0xffffffffffffffffffffffffffffffff
138ZERO: .octa 0x00000000000000000000000000000000
139ONE: .octa 0x00000000000000000000000000000001
140ONEf: .octa 0x01000000000000000000000000000000
141
142.text
143
144
145##define the fields of the gcm aes context
146#{
147# u8 expanded_keys[16*11] store expanded keys
148# u8 shifted_hkey_1[16] store HashKey <<1 mod poly here
149# u8 shifted_hkey_2[16] store HashKey^2 <<1 mod poly here
150# u8 shifted_hkey_3[16] store HashKey^3 <<1 mod poly here
151# u8 shifted_hkey_4[16] store HashKey^4 <<1 mod poly here
152# u8 shifted_hkey_5[16] store HashKey^5 <<1 mod poly here
153# u8 shifted_hkey_6[16] store HashKey^6 <<1 mod poly here
154# u8 shifted_hkey_7[16] store HashKey^7 <<1 mod poly here
155# u8 shifted_hkey_8[16] store HashKey^8 <<1 mod poly here
156# u8 shifted_hkey_1_k[16] store XOR HashKey <<1 mod poly here (for Karatsuba purposes)
157# u8 shifted_hkey_2_k[16] store XOR HashKey^2 <<1 mod poly here (for Karatsuba purposes)
158# u8 shifted_hkey_3_k[16] store XOR HashKey^3 <<1 mod poly here (for Karatsuba purposes)
159# u8 shifted_hkey_4_k[16] store XOR HashKey^4 <<1 mod poly here (for Karatsuba purposes)
160# u8 shifted_hkey_5_k[16] store XOR HashKey^5 <<1 mod poly here (for Karatsuba purposes)
161# u8 shifted_hkey_6_k[16] store XOR HashKey^6 <<1 mod poly here (for Karatsuba purposes)
162# u8 shifted_hkey_7_k[16] store XOR HashKey^7 <<1 mod poly here (for Karatsuba purposes)
163# u8 shifted_hkey_8_k[16] store XOR HashKey^8 <<1 mod poly here (for Karatsuba purposes)
164#} gcm_ctx#
165
166HashKey = 16*11 # store HashKey <<1 mod poly here
167HashKey_2 = 16*12 # store HashKey^2 <<1 mod poly here
168HashKey_3 = 16*13 # store HashKey^3 <<1 mod poly here
169HashKey_4 = 16*14 # store HashKey^4 <<1 mod poly here
170HashKey_5 = 16*15 # store HashKey^5 <<1 mod poly here
171HashKey_6 = 16*16 # store HashKey^6 <<1 mod poly here
172HashKey_7 = 16*17 # store HashKey^7 <<1 mod poly here
173HashKey_8 = 16*18 # store HashKey^8 <<1 mod poly here
174HashKey_k = 16*19 # store XOR of HashKey <<1 mod poly here (for Karatsuba purposes)
175HashKey_2_k = 16*20 # store XOR of HashKey^2 <<1 mod poly here (for Karatsuba purposes)
176HashKey_3_k = 16*21 # store XOR of HashKey^3 <<1 mod poly here (for Karatsuba purposes)
177HashKey_4_k = 16*22 # store XOR of HashKey^4 <<1 mod poly here (for Karatsuba purposes)
178HashKey_5_k = 16*23 # store XOR of HashKey^5 <<1 mod poly here (for Karatsuba purposes)
179HashKey_6_k = 16*24 # store XOR of HashKey^6 <<1 mod poly here (for Karatsuba purposes)
180HashKey_7_k = 16*25 # store XOR of HashKey^7 <<1 mod poly here (for Karatsuba purposes)
181HashKey_8_k = 16*26 # store XOR of HashKey^8 <<1 mod poly here (for Karatsuba purposes)
182
183#define arg1 %rdi
184#define arg2 %rsi
185#define arg3 %rdx
186#define arg4 %rcx
187#define arg5 %r8
188#define arg6 %r9
189#define arg7 STACK_OFFSET+8*1(%r14)
190#define arg8 STACK_OFFSET+8*2(%r14)
191#define arg9 STACK_OFFSET+8*3(%r14)
192
193i = 0
194j = 0
195
196out_order = 0
197in_order = 1
198DEC = 0
199ENC = 1
200
201.macro define_reg r n
202reg_\r = %xmm\n
203.endm
204
205.macro setreg
206.altmacro
207define_reg i %i
208define_reg j %j
209.noaltmacro
210.endm
211
212# need to push 4 registers into stack to maintain
213STACK_OFFSET = 8*4
214
215TMP1 = 16*0 # Temporary storage for AAD
216TMP2 = 16*1 # Temporary storage for AES State 2 (State 1 is stored in an XMM register)
217TMP3 = 16*2 # Temporary storage for AES State 3
218TMP4 = 16*3 # Temporary storage for AES State 4
219TMP5 = 16*4 # Temporary storage for AES State 5
220TMP6 = 16*5 # Temporary storage for AES State 6
221TMP7 = 16*6 # Temporary storage for AES State 7
222TMP8 = 16*7 # Temporary storage for AES State 8
223
224VARIABLE_OFFSET = 16*8
225
226################################
227# Utility Macros
228################################
229
230# Encryption of a single block
231.macro ENCRYPT_SINGLE_BLOCK XMM0
232 vpxor (arg1), \XMM0, \XMM0
233 i = 1
234 setreg
235.rep 9
236 vaesenc 16*i(arg1), \XMM0, \XMM0
237 i = (i+1)
238 setreg
239.endr
240 vaesenclast 16*10(arg1), \XMM0, \XMM0
241.endm
242
243#ifdef CONFIG_AS_AVX
244###############################################################################
245# GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0)
246# Input: A and B (128-bits each, bit-reflected)
247# Output: C = A*B*x mod poly, (i.e. >>1 )
248# To compute GH = GH*HashKey mod poly, give HK = HashKey<<1 mod poly as input
249# GH = GH * HK * x mod poly which is equivalent to GH*HashKey mod poly.
250###############################################################################
251.macro GHASH_MUL_AVX GH HK T1 T2 T3 T4 T5
252
253 vpshufd $0b01001110, \GH, \T2
254 vpshufd $0b01001110, \HK, \T3
255 vpxor \GH , \T2, \T2 # T2 = (a1+a0)
256 vpxor \HK , \T3, \T3 # T3 = (b1+b0)
257
258 vpclmulqdq $0x11, \HK, \GH, \T1 # T1 = a1*b1
259 vpclmulqdq $0x00, \HK, \GH, \GH # GH = a0*b0
260 vpclmulqdq $0x00, \T3, \T2, \T2 # T2 = (a1+a0)*(b1+b0)
261 vpxor \GH, \T2,\T2
262 vpxor \T1, \T2,\T2 # T2 = a0*b1+a1*b0
263
264 vpslldq $8, \T2,\T3 # shift-L T3 2 DWs
265 vpsrldq $8, \T2,\T2 # shift-R T2 2 DWs
266 vpxor \T3, \GH, \GH
267 vpxor \T2, \T1, \T1 # <T1:GH> = GH x HK
268
269 #first phase of the reduction
270 vpslld $31, \GH, \T2 # packed right shifting << 31
271 vpslld $30, \GH, \T3 # packed right shifting shift << 30
272 vpslld $25, \GH, \T4 # packed right shifting shift << 25
273
274 vpxor \T3, \T2, \T2 # xor the shifted versions
275 vpxor \T4, \T2, \T2
276
277 vpsrldq $4, \T2, \T5 # shift-R T5 1 DW
278
279 vpslldq $12, \T2, \T2 # shift-L T2 3 DWs
280 vpxor \T2, \GH, \GH # first phase of the reduction complete
281
282 #second phase of the reduction
283
284 vpsrld $1,\GH, \T2 # packed left shifting >> 1
285 vpsrld $2,\GH, \T3 # packed left shifting >> 2
286 vpsrld $7,\GH, \T4 # packed left shifting >> 7
287 vpxor \T3, \T2, \T2 # xor the shifted versions
288 vpxor \T4, \T2, \T2
289
290 vpxor \T5, \T2, \T2
291 vpxor \T2, \GH, \GH
292 vpxor \T1, \GH, \GH # the result is in GH
293
294
295.endm
296
297.macro PRECOMPUTE_AVX HK T1 T2 T3 T4 T5 T6
298
299 # Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
300 vmovdqa \HK, \T5
301
302 vpshufd $0b01001110, \T5, \T1
303 vpxor \T5, \T1, \T1
304 vmovdqa \T1, HashKey_k(arg1)
305
306 GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^2<<1 mod poly
307 vmovdqa \T5, HashKey_2(arg1) # [HashKey_2] = HashKey^2<<1 mod poly
308 vpshufd $0b01001110, \T5, \T1
309 vpxor \T5, \T1, \T1
310 vmovdqa \T1, HashKey_2_k(arg1)
311
312 GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^3<<1 mod poly
313 vmovdqa \T5, HashKey_3(arg1)
314 vpshufd $0b01001110, \T5, \T1
315 vpxor \T5, \T1, \T1
316 vmovdqa \T1, HashKey_3_k(arg1)
317
318 GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^4<<1 mod poly
319 vmovdqa \T5, HashKey_4(arg1)
320 vpshufd $0b01001110, \T5, \T1
321 vpxor \T5, \T1, \T1
322 vmovdqa \T1, HashKey_4_k(arg1)
323
324 GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^5<<1 mod poly
325 vmovdqa \T5, HashKey_5(arg1)
326 vpshufd $0b01001110, \T5, \T1
327 vpxor \T5, \T1, \T1
328 vmovdqa \T1, HashKey_5_k(arg1)
329
330 GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^6<<1 mod poly
331 vmovdqa \T5, HashKey_6(arg1)
332 vpshufd $0b01001110, \T5, \T1
333 vpxor \T5, \T1, \T1
334 vmovdqa \T1, HashKey_6_k(arg1)
335
336 GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^7<<1 mod poly
337 vmovdqa \T5, HashKey_7(arg1)
338 vpshufd $0b01001110, \T5, \T1
339 vpxor \T5, \T1, \T1
340 vmovdqa \T1, HashKey_7_k(arg1)
341
342 GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^8<<1 mod poly
343 vmovdqa \T5, HashKey_8(arg1)
344 vpshufd $0b01001110, \T5, \T1
345 vpxor \T5, \T1, \T1
346 vmovdqa \T1, HashKey_8_k(arg1)
347
348.endm
349
350## if a = number of total plaintext bytes
351## b = floor(a/16)
352## num_initial_blocks = b mod 4#
353## encrypt the initial num_initial_blocks blocks and apply ghash on the ciphertext
354## r10, r11, r12, rax are clobbered
355## arg1, arg2, arg3, r14 are used as a pointer only, not modified
356
357.macro INITIAL_BLOCKS_AVX num_initial_blocks T1 T2 T3 T4 T5 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T6 T_key ENC_DEC
358 i = (8-\num_initial_blocks)
359 setreg
360
361 mov arg6, %r10 # r10 = AAD
362 mov arg7, %r12 # r12 = aadLen
363
364
365 mov %r12, %r11
366
367 vpxor reg_i, reg_i, reg_i
368_get_AAD_loop\@:
369 vmovd (%r10), \T1
370 vpslldq $12, \T1, \T1
371 vpsrldq $4, reg_i, reg_i
372 vpxor \T1, reg_i, reg_i
373
374 add $4, %r10
375 sub $4, %r12
376 jg _get_AAD_loop\@
377
378
379 cmp $16, %r11
380 je _get_AAD_loop2_done\@
381 mov $16, %r12
382
383_get_AAD_loop2\@:
384 vpsrldq $4, reg_i, reg_i
385 sub $4, %r12
386 cmp %r11, %r12
387 jg _get_AAD_loop2\@
388
389_get_AAD_loop2_done\@:
390
391 #byte-reflect the AAD data
392 vpshufb SHUF_MASK(%rip), reg_i, reg_i
393
394 # initialize the data pointer offset as zero
395 xor %r11, %r11
396
397 # start AES for num_initial_blocks blocks
398 mov arg5, %rax # rax = *Y0
399 vmovdqu (%rax), \CTR # CTR = Y0
400 vpshufb SHUF_MASK(%rip), \CTR, \CTR
401
402
403 i = (9-\num_initial_blocks)
404 setreg
405.rep \num_initial_blocks
406 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
407 vmovdqa \CTR, reg_i
408 vpshufb SHUF_MASK(%rip), reg_i, reg_i # perform a 16Byte swap
409 i = (i+1)
410 setreg
411.endr
412
413 vmovdqa (arg1), \T_key
414 i = (9-\num_initial_blocks)
415 setreg
416.rep \num_initial_blocks
417 vpxor \T_key, reg_i, reg_i
418 i = (i+1)
419 setreg
420.endr
421
422 j = 1
423 setreg
424.rep 9
425 vmovdqa 16*j(arg1), \T_key
426 i = (9-\num_initial_blocks)
427 setreg
428.rep \num_initial_blocks
429 vaesenc \T_key, reg_i, reg_i
430 i = (i+1)
431 setreg
432.endr
433
434 j = (j+1)
435 setreg
436.endr
437
438
439 vmovdqa 16*10(arg1), \T_key
440 i = (9-\num_initial_blocks)
441 setreg
442.rep \num_initial_blocks
443 vaesenclast \T_key, reg_i, reg_i
444 i = (i+1)
445 setreg
446.endr
447
448 i = (9-\num_initial_blocks)
449 setreg
450.rep \num_initial_blocks
451 vmovdqu (arg3, %r11), \T1
452 vpxor \T1, reg_i, reg_i
453 vmovdqu reg_i, (arg2 , %r11) # write back ciphertext for num_initial_blocks blocks
454 add $16, %r11
455.if \ENC_DEC == DEC
456 vmovdqa \T1, reg_i
457.endif
458 vpshufb SHUF_MASK(%rip), reg_i, reg_i # prepare ciphertext for GHASH computations
459 i = (i+1)
460 setreg
461.endr
462
463
464 i = (8-\num_initial_blocks)
465 j = (9-\num_initial_blocks)
466 setreg
467 GHASH_MUL_AVX reg_i, \T2, \T1, \T3, \T4, \T5, \T6
468
469.rep \num_initial_blocks
470 vpxor reg_i, reg_j, reg_j
471 GHASH_MUL_AVX reg_j, \T2, \T1, \T3, \T4, \T5, \T6 # apply GHASH on num_initial_blocks blocks
472 i = (i+1)
473 j = (j+1)
474 setreg
475.endr
476 # XMM8 has the combined result here
477
478 vmovdqa \XMM8, TMP1(%rsp)
479 vmovdqa \XMM8, \T3
480
481 cmp $128, %r13
482 jl _initial_blocks_done\@ # no need for precomputed constants
483
484###############################################################################
485# Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
486 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
487 vmovdqa \CTR, \XMM1
488 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
489
490 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
491 vmovdqa \CTR, \XMM2
492 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
493
494 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
495 vmovdqa \CTR, \XMM3
496 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
497
498 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
499 vmovdqa \CTR, \XMM4
500 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
501
502 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
503 vmovdqa \CTR, \XMM5
504 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
505
506 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
507 vmovdqa \CTR, \XMM6
508 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
509
510 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
511 vmovdqa \CTR, \XMM7
512 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
513
514 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
515 vmovdqa \CTR, \XMM8
516 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
517
518 vmovdqa (arg1), \T_key
519 vpxor \T_key, \XMM1, \XMM1
520 vpxor \T_key, \XMM2, \XMM2
521 vpxor \T_key, \XMM3, \XMM3
522 vpxor \T_key, \XMM4, \XMM4
523 vpxor \T_key, \XMM5, \XMM5
524 vpxor \T_key, \XMM6, \XMM6
525 vpxor \T_key, \XMM7, \XMM7
526 vpxor \T_key, \XMM8, \XMM8
527
528 i = 1
529 setreg
530.rep 9 # do 9 rounds
531 vmovdqa 16*i(arg1), \T_key
532 vaesenc \T_key, \XMM1, \XMM1
533 vaesenc \T_key, \XMM2, \XMM2
534 vaesenc \T_key, \XMM3, \XMM3
535 vaesenc \T_key, \XMM4, \XMM4
536 vaesenc \T_key, \XMM5, \XMM5
537 vaesenc \T_key, \XMM6, \XMM6
538 vaesenc \T_key, \XMM7, \XMM7
539 vaesenc \T_key, \XMM8, \XMM8
540 i = (i+1)
541 setreg
542.endr
543
544
545 vmovdqa 16*i(arg1), \T_key
546 vaesenclast \T_key, \XMM1, \XMM1
547 vaesenclast \T_key, \XMM2, \XMM2
548 vaesenclast \T_key, \XMM3, \XMM3
549 vaesenclast \T_key, \XMM4, \XMM4
550 vaesenclast \T_key, \XMM5, \XMM5
551 vaesenclast \T_key, \XMM6, \XMM6
552 vaesenclast \T_key, \XMM7, \XMM7
553 vaesenclast \T_key, \XMM8, \XMM8
554
555 vmovdqu (arg3, %r11), \T1
556 vpxor \T1, \XMM1, \XMM1
557 vmovdqu \XMM1, (arg2 , %r11)
558 .if \ENC_DEC == DEC
559 vmovdqa \T1, \XMM1
560 .endif
561
562 vmovdqu 16*1(arg3, %r11), \T1
563 vpxor \T1, \XMM2, \XMM2
564 vmovdqu \XMM2, 16*1(arg2 , %r11)
565 .if \ENC_DEC == DEC
566 vmovdqa \T1, \XMM2
567 .endif
568
569 vmovdqu 16*2(arg3, %r11), \T1
570 vpxor \T1, \XMM3, \XMM3
571 vmovdqu \XMM3, 16*2(arg2 , %r11)
572 .if \ENC_DEC == DEC
573 vmovdqa \T1, \XMM3
574 .endif
575
576 vmovdqu 16*3(arg3, %r11), \T1
577 vpxor \T1, \XMM4, \XMM4
578 vmovdqu \XMM4, 16*3(arg2 , %r11)
579 .if \ENC_DEC == DEC
580 vmovdqa \T1, \XMM4
581 .endif
582
583 vmovdqu 16*4(arg3, %r11), \T1
584 vpxor \T1, \XMM5, \XMM5
585 vmovdqu \XMM5, 16*4(arg2 , %r11)
586 .if \ENC_DEC == DEC
587 vmovdqa \T1, \XMM5
588 .endif
589
590 vmovdqu 16*5(arg3, %r11), \T1
591 vpxor \T1, \XMM6, \XMM6
592 vmovdqu \XMM6, 16*5(arg2 , %r11)
593 .if \ENC_DEC == DEC
594 vmovdqa \T1, \XMM6
595 .endif
596
597 vmovdqu 16*6(arg3, %r11), \T1
598 vpxor \T1, \XMM7, \XMM7
599 vmovdqu \XMM7, 16*6(arg2 , %r11)
600 .if \ENC_DEC == DEC
601 vmovdqa \T1, \XMM7
602 .endif
603
604 vmovdqu 16*7(arg3, %r11), \T1
605 vpxor \T1, \XMM8, \XMM8
606 vmovdqu \XMM8, 16*7(arg2 , %r11)
607 .if \ENC_DEC == DEC
608 vmovdqa \T1, \XMM8
609 .endif
610
611 add $128, %r11
612
613 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
614 vpxor TMP1(%rsp), \XMM1, \XMM1 # combine GHASHed value with the corresponding ciphertext
615 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
616 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
617 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
618 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
619 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
620 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
621 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
622
623###############################################################################
624
625_initial_blocks_done\@:
626
627.endm
628
629# encrypt 8 blocks at a time
630# ghash the 8 previously encrypted ciphertext blocks
631# arg1, arg2, arg3 are used as pointers only, not modified
632# r11 is the data offset value
633.macro GHASH_8_ENCRYPT_8_PARALLEL_AVX T1 T2 T3 T4 T5 T6 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T7 loop_idx ENC_DEC
634
635 vmovdqa \XMM1, \T2
636 vmovdqa \XMM2, TMP2(%rsp)
637 vmovdqa \XMM3, TMP3(%rsp)
638 vmovdqa \XMM4, TMP4(%rsp)
639 vmovdqa \XMM5, TMP5(%rsp)
640 vmovdqa \XMM6, TMP6(%rsp)
641 vmovdqa \XMM7, TMP7(%rsp)
642 vmovdqa \XMM8, TMP8(%rsp)
643
644.if \loop_idx == in_order
645 vpaddd ONE(%rip), \CTR, \XMM1 # INCR CNT
646 vpaddd ONE(%rip), \XMM1, \XMM2
647 vpaddd ONE(%rip), \XMM2, \XMM3
648 vpaddd ONE(%rip), \XMM3, \XMM4
649 vpaddd ONE(%rip), \XMM4, \XMM5
650 vpaddd ONE(%rip), \XMM5, \XMM6
651 vpaddd ONE(%rip), \XMM6, \XMM7
652 vpaddd ONE(%rip), \XMM7, \XMM8
653 vmovdqa \XMM8, \CTR
654
655 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
656 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
657 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
658 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
659 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
660 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
661 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
662 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
663.else
664 vpaddd ONEf(%rip), \CTR, \XMM1 # INCR CNT
665 vpaddd ONEf(%rip), \XMM1, \XMM2
666 vpaddd ONEf(%rip), \XMM2, \XMM3
667 vpaddd ONEf(%rip), \XMM3, \XMM4
668 vpaddd ONEf(%rip), \XMM4, \XMM5
669 vpaddd ONEf(%rip), \XMM5, \XMM6
670 vpaddd ONEf(%rip), \XMM6, \XMM7
671 vpaddd ONEf(%rip), \XMM7, \XMM8
672 vmovdqa \XMM8, \CTR
673.endif
674
675
676 #######################################################################
677
678 vmovdqu (arg1), \T1
679 vpxor \T1, \XMM1, \XMM1
680 vpxor \T1, \XMM2, \XMM2
681 vpxor \T1, \XMM3, \XMM3
682 vpxor \T1, \XMM4, \XMM4
683 vpxor \T1, \XMM5, \XMM5
684 vpxor \T1, \XMM6, \XMM6
685 vpxor \T1, \XMM7, \XMM7
686 vpxor \T1, \XMM8, \XMM8
687
688 #######################################################################
689
690
691
692
693
694 vmovdqu 16*1(arg1), \T1
695 vaesenc \T1, \XMM1, \XMM1
696 vaesenc \T1, \XMM2, \XMM2
697 vaesenc \T1, \XMM3, \XMM3
698 vaesenc \T1, \XMM4, \XMM4
699 vaesenc \T1, \XMM5, \XMM5
700 vaesenc \T1, \XMM6, \XMM6
701 vaesenc \T1, \XMM7, \XMM7
702 vaesenc \T1, \XMM8, \XMM8
703
704 vmovdqu 16*2(arg1), \T1
705 vaesenc \T1, \XMM1, \XMM1
706 vaesenc \T1, \XMM2, \XMM2
707 vaesenc \T1, \XMM3, \XMM3
708 vaesenc \T1, \XMM4, \XMM4
709 vaesenc \T1, \XMM5, \XMM5
710 vaesenc \T1, \XMM6, \XMM6
711 vaesenc \T1, \XMM7, \XMM7
712 vaesenc \T1, \XMM8, \XMM8
713
714
715 #######################################################################
716
717 vmovdqa HashKey_8(arg1), \T5
718 vpclmulqdq $0x11, \T5, \T2, \T4 # T4 = a1*b1
719 vpclmulqdq $0x00, \T5, \T2, \T7 # T7 = a0*b0
720
721 vpshufd $0b01001110, \T2, \T6
722 vpxor \T2, \T6, \T6
723
724 vmovdqa HashKey_8_k(arg1), \T5
725 vpclmulqdq $0x00, \T5, \T6, \T6
726
727 vmovdqu 16*3(arg1), \T1
728 vaesenc \T1, \XMM1, \XMM1
729 vaesenc \T1, \XMM2, \XMM2
730 vaesenc \T1, \XMM3, \XMM3
731 vaesenc \T1, \XMM4, \XMM4
732 vaesenc \T1, \XMM5, \XMM5
733 vaesenc \T1, \XMM6, \XMM6
734 vaesenc \T1, \XMM7, \XMM7
735 vaesenc \T1, \XMM8, \XMM8
736
737 vmovdqa TMP2(%rsp), \T1
738 vmovdqa HashKey_7(arg1), \T5
739 vpclmulqdq $0x11, \T5, \T1, \T3
740 vpxor \T3, \T4, \T4
741 vpclmulqdq $0x00, \T5, \T1, \T3
742 vpxor \T3, \T7, \T7
743
744 vpshufd $0b01001110, \T1, \T3
745 vpxor \T1, \T3, \T3
746 vmovdqa HashKey_7_k(arg1), \T5
747 vpclmulqdq $0x10, \T5, \T3, \T3
748 vpxor \T3, \T6, \T6
749
750 vmovdqu 16*4(arg1), \T1
751 vaesenc \T1, \XMM1, \XMM1
752 vaesenc \T1, \XMM2, \XMM2
753 vaesenc \T1, \XMM3, \XMM3
754 vaesenc \T1, \XMM4, \XMM4
755 vaesenc \T1, \XMM5, \XMM5
756 vaesenc \T1, \XMM6, \XMM6
757 vaesenc \T1, \XMM7, \XMM7
758 vaesenc \T1, \XMM8, \XMM8
759
760 #######################################################################
761
762 vmovdqa TMP3(%rsp), \T1
763 vmovdqa HashKey_6(arg1), \T5
764 vpclmulqdq $0x11, \T5, \T1, \T3
765 vpxor \T3, \T4, \T4
766 vpclmulqdq $0x00, \T5, \T1, \T3
767 vpxor \T3, \T7, \T7
768
769 vpshufd $0b01001110, \T1, \T3
770 vpxor \T1, \T3, \T3
771 vmovdqa HashKey_6_k(arg1), \T5
772 vpclmulqdq $0x10, \T5, \T3, \T3
773 vpxor \T3, \T6, \T6
774
775 vmovdqu 16*5(arg1), \T1
776 vaesenc \T1, \XMM1, \XMM1
777 vaesenc \T1, \XMM2, \XMM2
778 vaesenc \T1, \XMM3, \XMM3
779 vaesenc \T1, \XMM4, \XMM4
780 vaesenc \T1, \XMM5, \XMM5
781 vaesenc \T1, \XMM6, \XMM6
782 vaesenc \T1, \XMM7, \XMM7
783 vaesenc \T1, \XMM8, \XMM8
784
785 vmovdqa TMP4(%rsp), \T1
786 vmovdqa HashKey_5(arg1), \T5
787 vpclmulqdq $0x11, \T5, \T1, \T3
788 vpxor \T3, \T4, \T4
789 vpclmulqdq $0x00, \T5, \T1, \T3
790 vpxor \T3, \T7, \T7
791
792 vpshufd $0b01001110, \T1, \T3
793 vpxor \T1, \T3, \T3
794 vmovdqa HashKey_5_k(arg1), \T5
795 vpclmulqdq $0x10, \T5, \T3, \T3
796 vpxor \T3, \T6, \T6
797
798 vmovdqu 16*6(arg1), \T1
799 vaesenc \T1, \XMM1, \XMM1
800 vaesenc \T1, \XMM2, \XMM2
801 vaesenc \T1, \XMM3, \XMM3
802 vaesenc \T1, \XMM4, \XMM4
803 vaesenc \T1, \XMM5, \XMM5
804 vaesenc \T1, \XMM6, \XMM6
805 vaesenc \T1, \XMM7, \XMM7
806 vaesenc \T1, \XMM8, \XMM8
807
808
809 vmovdqa TMP5(%rsp), \T1
810 vmovdqa HashKey_4(arg1), \T5
811 vpclmulqdq $0x11, \T5, \T1, \T3
812 vpxor \T3, \T4, \T4
813 vpclmulqdq $0x00, \T5, \T1, \T3
814 vpxor \T3, \T7, \T7
815
816 vpshufd $0b01001110, \T1, \T3
817 vpxor \T1, \T3, \T3
818 vmovdqa HashKey_4_k(arg1), \T5
819 vpclmulqdq $0x10, \T5, \T3, \T3
820 vpxor \T3, \T6, \T6
821
822 vmovdqu 16*7(arg1), \T1
823 vaesenc \T1, \XMM1, \XMM1
824 vaesenc \T1, \XMM2, \XMM2
825 vaesenc \T1, \XMM3, \XMM3
826 vaesenc \T1, \XMM4, \XMM4
827 vaesenc \T1, \XMM5, \XMM5
828 vaesenc \T1, \XMM6, \XMM6
829 vaesenc \T1, \XMM7, \XMM7
830 vaesenc \T1, \XMM8, \XMM8
831
832 vmovdqa TMP6(%rsp), \T1
833 vmovdqa HashKey_3(arg1), \T5
834 vpclmulqdq $0x11, \T5, \T1, \T3
835 vpxor \T3, \T4, \T4
836 vpclmulqdq $0x00, \T5, \T1, \T3
837 vpxor \T3, \T7, \T7
838
839 vpshufd $0b01001110, \T1, \T3
840 vpxor \T1, \T3, \T3
841 vmovdqa HashKey_3_k(arg1), \T5
842 vpclmulqdq $0x10, \T5, \T3, \T3
843 vpxor \T3, \T6, \T6
844
845
846 vmovdqu 16*8(arg1), \T1
847 vaesenc \T1, \XMM1, \XMM1
848 vaesenc \T1, \XMM2, \XMM2
849 vaesenc \T1, \XMM3, \XMM3
850 vaesenc \T1, \XMM4, \XMM4
851 vaesenc \T1, \XMM5, \XMM5
852 vaesenc \T1, \XMM6, \XMM6
853 vaesenc \T1, \XMM7, \XMM7
854 vaesenc \T1, \XMM8, \XMM8
855
856 vmovdqa TMP7(%rsp), \T1
857 vmovdqa HashKey_2(arg1), \T5
858 vpclmulqdq $0x11, \T5, \T1, \T3
859 vpxor \T3, \T4, \T4
860 vpclmulqdq $0x00, \T5, \T1, \T3
861 vpxor \T3, \T7, \T7
862
863 vpshufd $0b01001110, \T1, \T3
864 vpxor \T1, \T3, \T3
865 vmovdqa HashKey_2_k(arg1), \T5
866 vpclmulqdq $0x10, \T5, \T3, \T3
867 vpxor \T3, \T6, \T6
868
869 #######################################################################
870
871 vmovdqu 16*9(arg1), \T5
872 vaesenc \T5, \XMM1, \XMM1
873 vaesenc \T5, \XMM2, \XMM2
874 vaesenc \T5, \XMM3, \XMM3
875 vaesenc \T5, \XMM4, \XMM4
876 vaesenc \T5, \XMM5, \XMM5
877 vaesenc \T5, \XMM6, \XMM6
878 vaesenc \T5, \XMM7, \XMM7
879 vaesenc \T5, \XMM8, \XMM8
880
881 vmovdqa TMP8(%rsp), \T1
882 vmovdqa HashKey(arg1), \T5
883 vpclmulqdq $0x11, \T5, \T1, \T3
884 vpxor \T3, \T4, \T4
885 vpclmulqdq $0x00, \T5, \T1, \T3
886 vpxor \T3, \T7, \T7
887
888 vpshufd $0b01001110, \T1, \T3
889 vpxor \T1, \T3, \T3
890 vmovdqa HashKey_k(arg1), \T5
891 vpclmulqdq $0x10, \T5, \T3, \T3
892 vpxor \T3, \T6, \T6
893
894 vpxor \T4, \T6, \T6
895 vpxor \T7, \T6, \T6
896
897 vmovdqu 16*10(arg1), \T5
898
899 i = 0
900 j = 1
901 setreg
902.rep 8
903 vpxor 16*i(arg3, %r11), \T5, \T2
904 .if \ENC_DEC == ENC
905 vaesenclast \T2, reg_j, reg_j
906 .else
907 vaesenclast \T2, reg_j, \T3
908 vmovdqu 16*i(arg3, %r11), reg_j
909 vmovdqu \T3, 16*i(arg2, %r11)
910 .endif
911 i = (i+1)
912 j = (j+1)
913 setreg
914.endr
915 #######################################################################
916
917
918 vpslldq $8, \T6, \T3 # shift-L T3 2 DWs
919 vpsrldq $8, \T6, \T6 # shift-R T2 2 DWs
920 vpxor \T3, \T7, \T7
921 vpxor \T4, \T6, \T6 # accumulate the results in T6:T7
922
923
924
925 #######################################################################
926 #first phase of the reduction
927 #######################################################################
928 vpslld $31, \T7, \T2 # packed right shifting << 31
929 vpslld $30, \T7, \T3 # packed right shifting shift << 30
930 vpslld $25, \T7, \T4 # packed right shifting shift << 25
931
932 vpxor \T3, \T2, \T2 # xor the shifted versions
933 vpxor \T4, \T2, \T2
934
935 vpsrldq $4, \T2, \T1 # shift-R T1 1 DW
936
937 vpslldq $12, \T2, \T2 # shift-L T2 3 DWs
938 vpxor \T2, \T7, \T7 # first phase of the reduction complete
939 #######################################################################
940 .if \ENC_DEC == ENC
941 vmovdqu \XMM1, 16*0(arg2,%r11) # Write to the Ciphertext buffer
942 vmovdqu \XMM2, 16*1(arg2,%r11) # Write to the Ciphertext buffer
943 vmovdqu \XMM3, 16*2(arg2,%r11) # Write to the Ciphertext buffer
944 vmovdqu \XMM4, 16*3(arg2,%r11) # Write to the Ciphertext buffer
945 vmovdqu \XMM5, 16*4(arg2,%r11) # Write to the Ciphertext buffer
946 vmovdqu \XMM6, 16*5(arg2,%r11) # Write to the Ciphertext buffer
947 vmovdqu \XMM7, 16*6(arg2,%r11) # Write to the Ciphertext buffer
948 vmovdqu \XMM8, 16*7(arg2,%r11) # Write to the Ciphertext buffer
949 .endif
950
951 #######################################################################
952 #second phase of the reduction
953 vpsrld $1, \T7, \T2 # packed left shifting >> 1
954 vpsrld $2, \T7, \T3 # packed left shifting >> 2
955 vpsrld $7, \T7, \T4 # packed left shifting >> 7
956 vpxor \T3, \T2, \T2 # xor the shifted versions
957 vpxor \T4, \T2, \T2
958
959 vpxor \T1, \T2, \T2
960 vpxor \T2, \T7, \T7
961 vpxor \T7, \T6, \T6 # the result is in T6
962 #######################################################################
963
964 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
965 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
966 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
967 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
968 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
969 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
970 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
971 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
972
973
974 vpxor \T6, \XMM1, \XMM1
975
976
977
978.endm
979
980
981# GHASH the last 4 ciphertext blocks.
982.macro GHASH_LAST_8_AVX T1 T2 T3 T4 T5 T6 T7 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8
983
984 ## Karatsuba Method
985
986
987 vpshufd $0b01001110, \XMM1, \T2
988 vpxor \XMM1, \T2, \T2
989 vmovdqa HashKey_8(arg1), \T5
990 vpclmulqdq $0x11, \T5, \XMM1, \T6
991 vpclmulqdq $0x00, \T5, \XMM1, \T7
992
993 vmovdqa HashKey_8_k(arg1), \T3
994 vpclmulqdq $0x00, \T3, \T2, \XMM1
995
996 ######################
997
998 vpshufd $0b01001110, \XMM2, \T2
999 vpxor \XMM2, \T2, \T2
1000 vmovdqa HashKey_7(arg1), \T5
1001 vpclmulqdq $0x11, \T5, \XMM2, \T4
1002 vpxor \T4, \T6, \T6
1003
1004 vpclmulqdq $0x00, \T5, \XMM2, \T4
1005 vpxor \T4, \T7, \T7
1006
1007 vmovdqa HashKey_7_k(arg1), \T3
1008 vpclmulqdq $0x00, \T3, \T2, \T2
1009 vpxor \T2, \XMM1, \XMM1
1010
1011 ######################
1012
1013 vpshufd $0b01001110, \XMM3, \T2
1014 vpxor \XMM3, \T2, \T2
1015 vmovdqa HashKey_6(arg1), \T5
1016 vpclmulqdq $0x11, \T5, \XMM3, \T4
1017 vpxor \T4, \T6, \T6
1018
1019 vpclmulqdq $0x00, \T5, \XMM3, \T4
1020 vpxor \T4, \T7, \T7
1021
1022 vmovdqa HashKey_6_k(arg1), \T3
1023 vpclmulqdq $0x00, \T3, \T2, \T2
1024 vpxor \T2, \XMM1, \XMM1
1025
1026 ######################
1027
1028 vpshufd $0b01001110, \XMM4, \T2
1029 vpxor \XMM4, \T2, \T2
1030 vmovdqa HashKey_5(arg1), \T5
1031 vpclmulqdq $0x11, \T5, \XMM4, \T4
1032 vpxor \T4, \T6, \T6
1033
1034 vpclmulqdq $0x00, \T5, \XMM4, \T4
1035 vpxor \T4, \T7, \T7
1036
1037 vmovdqa HashKey_5_k(arg1), \T3
1038 vpclmulqdq $0x00, \T3, \T2, \T2
1039 vpxor \T2, \XMM1, \XMM1
1040
1041 ######################
1042
1043 vpshufd $0b01001110, \XMM5, \T2
1044 vpxor \XMM5, \T2, \T2
1045 vmovdqa HashKey_4(arg1), \T5
1046 vpclmulqdq $0x11, \T5, \XMM5, \T4
1047 vpxor \T4, \T6, \T6
1048
1049 vpclmulqdq $0x00, \T5, \XMM5, \T4
1050 vpxor \T4, \T7, \T7
1051
1052 vmovdqa HashKey_4_k(arg1), \T3
1053 vpclmulqdq $0x00, \T3, \T2, \T2
1054 vpxor \T2, \XMM1, \XMM1
1055
1056 ######################
1057
1058 vpshufd $0b01001110, \XMM6, \T2
1059 vpxor \XMM6, \T2, \T2
1060 vmovdqa HashKey_3(arg1), \T5
1061 vpclmulqdq $0x11, \T5, \XMM6, \T4
1062 vpxor \T4, \T6, \T6
1063
1064 vpclmulqdq $0x00, \T5, \XMM6, \T4
1065 vpxor \T4, \T7, \T7
1066
1067 vmovdqa HashKey_3_k(arg1), \T3
1068 vpclmulqdq $0x00, \T3, \T2, \T2
1069 vpxor \T2, \XMM1, \XMM1
1070
1071 ######################
1072
1073 vpshufd $0b01001110, \XMM7, \T2
1074 vpxor \XMM7, \T2, \T2
1075 vmovdqa HashKey_2(arg1), \T5
1076 vpclmulqdq $0x11, \T5, \XMM7, \T4
1077 vpxor \T4, \T6, \T6
1078
1079 vpclmulqdq $0x00, \T5, \XMM7, \T4
1080 vpxor \T4, \T7, \T7
1081
1082 vmovdqa HashKey_2_k(arg1), \T3
1083 vpclmulqdq $0x00, \T3, \T2, \T2
1084 vpxor \T2, \XMM1, \XMM1
1085
1086 ######################
1087
1088 vpshufd $0b01001110, \XMM8, \T2
1089 vpxor \XMM8, \T2, \T2
1090 vmovdqa HashKey(arg1), \T5
1091 vpclmulqdq $0x11, \T5, \XMM8, \T4
1092 vpxor \T4, \T6, \T6
1093
1094 vpclmulqdq $0x00, \T5, \XMM8, \T4
1095 vpxor \T4, \T7, \T7
1096
1097 vmovdqa HashKey_k(arg1), \T3
1098 vpclmulqdq $0x00, \T3, \T2, \T2
1099
1100 vpxor \T2, \XMM1, \XMM1
1101 vpxor \T6, \XMM1, \XMM1
1102 vpxor \T7, \XMM1, \T2
1103
1104
1105
1106
1107 vpslldq $8, \T2, \T4
1108 vpsrldq $8, \T2, \T2
1109
1110 vpxor \T4, \T7, \T7
1111 vpxor \T2, \T6, \T6 # <T6:T7> holds the result of
1112 # the accumulated carry-less multiplications
1113
1114 #######################################################################
1115 #first phase of the reduction
1116 vpslld $31, \T7, \T2 # packed right shifting << 31
1117 vpslld $30, \T7, \T3 # packed right shifting shift << 30
1118 vpslld $25, \T7, \T4 # packed right shifting shift << 25
1119
1120 vpxor \T3, \T2, \T2 # xor the shifted versions
1121 vpxor \T4, \T2, \T2
1122
1123 vpsrldq $4, \T2, \T1 # shift-R T1 1 DW
1124
1125 vpslldq $12, \T2, \T2 # shift-L T2 3 DWs
1126 vpxor \T2, \T7, \T7 # first phase of the reduction complete
1127 #######################################################################
1128
1129
1130 #second phase of the reduction
1131 vpsrld $1, \T7, \T2 # packed left shifting >> 1
1132 vpsrld $2, \T7, \T3 # packed left shifting >> 2
1133 vpsrld $7, \T7, \T4 # packed left shifting >> 7
1134 vpxor \T3, \T2, \T2 # xor the shifted versions
1135 vpxor \T4, \T2, \T2
1136
1137 vpxor \T1, \T2, \T2
1138 vpxor \T2, \T7, \T7
1139 vpxor \T7, \T6, \T6 # the result is in T6
1140
1141.endm
1142
1143
1144# combined for GCM encrypt and decrypt functions
1145# clobbering all xmm registers
1146# clobbering r10, r11, r12, r13, r14, r15
1147.macro GCM_ENC_DEC_AVX ENC_DEC
1148
1149 #the number of pushes must equal STACK_OFFSET
1150 push %r12
1151 push %r13
1152 push %r14
1153 push %r15
1154
1155 mov %rsp, %r14
1156
1157
1158
1159
1160 sub $VARIABLE_OFFSET, %rsp
1161 and $~63, %rsp # align rsp to 64 bytes
1162
1163
1164 vmovdqu HashKey(arg1), %xmm13 # xmm13 = HashKey
1165
1166 mov arg4, %r13 # save the number of bytes of plaintext/ciphertext
1167 and $-16, %r13 # r13 = r13 - (r13 mod 16)
1168
1169 mov %r13, %r12
1170 shr $4, %r12
1171 and $7, %r12
1172 jz _initial_num_blocks_is_0\@
1173
1174 cmp $7, %r12
1175 je _initial_num_blocks_is_7\@
1176 cmp $6, %r12
1177 je _initial_num_blocks_is_6\@
1178 cmp $5, %r12
1179 je _initial_num_blocks_is_5\@
1180 cmp $4, %r12
1181 je _initial_num_blocks_is_4\@
1182 cmp $3, %r12
1183 je _initial_num_blocks_is_3\@
1184 cmp $2, %r12
1185 je _initial_num_blocks_is_2\@
1186
1187 jmp _initial_num_blocks_is_1\@
1188
1189_initial_num_blocks_is_7\@:
1190 INITIAL_BLOCKS_AVX 7, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1191 sub $16*7, %r13
1192 jmp _initial_blocks_encrypted\@
1193
1194_initial_num_blocks_is_6\@:
1195 INITIAL_BLOCKS_AVX 6, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1196 sub $16*6, %r13
1197 jmp _initial_blocks_encrypted\@
1198
1199_initial_num_blocks_is_5\@:
1200 INITIAL_BLOCKS_AVX 5, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1201 sub $16*5, %r13
1202 jmp _initial_blocks_encrypted\@
1203
1204_initial_num_blocks_is_4\@:
1205 INITIAL_BLOCKS_AVX 4, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1206 sub $16*4, %r13
1207 jmp _initial_blocks_encrypted\@
1208
1209_initial_num_blocks_is_3\@:
1210 INITIAL_BLOCKS_AVX 3, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1211 sub $16*3, %r13
1212 jmp _initial_blocks_encrypted\@
1213
1214_initial_num_blocks_is_2\@:
1215 INITIAL_BLOCKS_AVX 2, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1216 sub $16*2, %r13
1217 jmp _initial_blocks_encrypted\@
1218
1219_initial_num_blocks_is_1\@:
1220 INITIAL_BLOCKS_AVX 1, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1221 sub $16*1, %r13
1222 jmp _initial_blocks_encrypted\@
1223
1224_initial_num_blocks_is_0\@:
1225 INITIAL_BLOCKS_AVX 0, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
1226
1227
1228_initial_blocks_encrypted\@:
1229 cmp $0, %r13
1230 je _zero_cipher_left\@
1231
1232 sub $128, %r13
1233 je _eight_cipher_left\@
1234
1235
1236
1237
1238 vmovd %xmm9, %r15d
1239 and $255, %r15d
1240 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1241
1242
1243_encrypt_by_8_new\@:
1244 cmp $(255-8), %r15d
1245 jg _encrypt_by_8\@
1246
1247
1248
1249 add $8, %r15b
1250 GHASH_8_ENCRYPT_8_PARALLEL_AVX %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, out_order, \ENC_DEC
1251 add $128, %r11
1252 sub $128, %r13
1253 jne _encrypt_by_8_new\@
1254
1255 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1256 jmp _eight_cipher_left\@
1257
1258_encrypt_by_8\@:
1259 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1260 add $8, %r15b
1261 GHASH_8_ENCRYPT_8_PARALLEL_AVX %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, in_order, \ENC_DEC
1262 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1263 add $128, %r11
1264 sub $128, %r13
1265 jne _encrypt_by_8_new\@
1266
1267 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1268
1269
1270
1271
1272_eight_cipher_left\@:
1273 GHASH_LAST_8_AVX %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm15, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8
1274
1275
1276_zero_cipher_left\@:
1277 cmp $16, arg4
1278 jl _only_less_than_16\@
1279
1280 mov arg4, %r13
1281 and $15, %r13 # r13 = (arg4 mod 16)
1282
1283 je _multiple_of_16_bytes\@
1284
1285 # handle the last <16 Byte block seperately
1286
1287
1288 vpaddd ONE(%rip), %xmm9, %xmm9 # INCR CNT to get Yn
1289 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1290 ENCRYPT_SINGLE_BLOCK %xmm9 # E(K, Yn)
1291
1292 sub $16, %r11
1293 add %r13, %r11
1294 vmovdqu (arg3, %r11), %xmm1 # receive the last <16 Byte block
1295
1296 lea SHIFT_MASK+16(%rip), %r12
1297 sub %r13, %r12 # adjust the shuffle mask pointer to be
1298 # able to shift 16-r13 bytes (r13 is the
1299 # number of bytes in plaintext mod 16)
1300 vmovdqu (%r12), %xmm2 # get the appropriate shuffle mask
1301 vpshufb %xmm2, %xmm1, %xmm1 # shift right 16-r13 bytes
1302 jmp _final_ghash_mul\@
1303
1304_only_less_than_16\@:
1305 # check for 0 length
1306 mov arg4, %r13
1307 and $15, %r13 # r13 = (arg4 mod 16)
1308
1309 je _multiple_of_16_bytes\@
1310
1311 # handle the last <16 Byte block seperately
1312
1313
1314 vpaddd ONE(%rip), %xmm9, %xmm9 # INCR CNT to get Yn
1315 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1316 ENCRYPT_SINGLE_BLOCK %xmm9 # E(K, Yn)
1317
1318
1319 lea SHIFT_MASK+16(%rip), %r12
1320 sub %r13, %r12 # adjust the shuffle mask pointer to be
1321 # able to shift 16-r13 bytes (r13 is the
1322 # number of bytes in plaintext mod 16)
1323
1324_get_last_16_byte_loop\@:
1325 movb (arg3, %r11), %al
1326 movb %al, TMP1 (%rsp , %r11)
1327 add $1, %r11
1328 cmp %r13, %r11
1329 jne _get_last_16_byte_loop\@
1330
1331 vmovdqu TMP1(%rsp), %xmm1
1332
1333 sub $16, %r11
1334
1335_final_ghash_mul\@:
1336 .if \ENC_DEC == DEC
1337 vmovdqa %xmm1, %xmm2
1338 vpxor %xmm1, %xmm9, %xmm9 # Plaintext XOR E(K, Yn)
1339 vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1 # get the appropriate mask to
1340 # mask out top 16-r13 bytes of xmm9
1341 vpand %xmm1, %xmm9, %xmm9 # mask out top 16-r13 bytes of xmm9
1342 vpand %xmm1, %xmm2, %xmm2
1343 vpshufb SHUF_MASK(%rip), %xmm2, %xmm2
1344 vpxor %xmm2, %xmm14, %xmm14
1345 #GHASH computation for the last <16 Byte block
1346 GHASH_MUL_AVX %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
1347 sub %r13, %r11
1348 add $16, %r11
1349 .else
1350 vpxor %xmm1, %xmm9, %xmm9 # Plaintext XOR E(K, Yn)
1351 vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1 # get the appropriate mask to
1352 # mask out top 16-r13 bytes of xmm9
1353 vpand %xmm1, %xmm9, %xmm9 # mask out top 16-r13 bytes of xmm9
1354 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
1355 vpxor %xmm9, %xmm14, %xmm14
1356 #GHASH computation for the last <16 Byte block
1357 GHASH_MUL_AVX %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
1358 sub %r13, %r11
1359 add $16, %r11
1360 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9 # shuffle xmm9 back to output as ciphertext
1361 .endif
1362
1363
1364 #############################
1365 # output r13 Bytes
1366 vmovq %xmm9, %rax
1367 cmp $8, %r13
1368 jle _less_than_8_bytes_left\@
1369
1370 mov %rax, (arg2 , %r11)
1371 add $8, %r11
1372 vpsrldq $8, %xmm9, %xmm9
1373 vmovq %xmm9, %rax
1374 sub $8, %r13
1375
1376_less_than_8_bytes_left\@:
1377 movb %al, (arg2 , %r11)
1378 add $1, %r11
1379 shr $8, %rax
1380 sub $1, %r13
1381 jne _less_than_8_bytes_left\@
1382 #############################
1383
1384_multiple_of_16_bytes\@:
1385 mov arg7, %r12 # r12 = aadLen (number of bytes)
1386 shl $3, %r12 # convert into number of bits
1387 vmovd %r12d, %xmm15 # len(A) in xmm15
1388
1389 shl $3, arg4 # len(C) in bits (*128)
1390 vmovq arg4, %xmm1
1391 vpslldq $8, %xmm15, %xmm15 # xmm15 = len(A)|| 0x0000000000000000
1392 vpxor %xmm1, %xmm15, %xmm15 # xmm15 = len(A)||len(C)
1393
1394 vpxor %xmm15, %xmm14, %xmm14
1395 GHASH_MUL_AVX %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6 # final GHASH computation
1396 vpshufb SHUF_MASK(%rip), %xmm14, %xmm14 # perform a 16Byte swap
1397
1398 mov arg5, %rax # rax = *Y0
1399 vmovdqu (%rax), %xmm9 # xmm9 = Y0
1400
1401 ENCRYPT_SINGLE_BLOCK %xmm9 # E(K, Y0)
1402
1403 vpxor %xmm14, %xmm9, %xmm9
1404
1405
1406
1407_return_T\@:
1408 mov arg8, %r10 # r10 = authTag
1409 mov arg9, %r11 # r11 = auth_tag_len
1410
1411 cmp $16, %r11
1412 je _T_16\@
1413
1414 cmp $12, %r11
1415 je _T_12\@
1416
1417_T_8\@:
1418 vmovq %xmm9, %rax
1419 mov %rax, (%r10)
1420 jmp _return_T_done\@
1421_T_12\@:
1422 vmovq %xmm9, %rax
1423 mov %rax, (%r10)
1424 vpsrldq $8, %xmm9, %xmm9
1425 vmovd %xmm9, %eax
1426 mov %eax, 8(%r10)
1427 jmp _return_T_done\@
1428
1429_T_16\@:
1430 vmovdqu %xmm9, (%r10)
1431
1432_return_T_done\@:
1433 mov %r14, %rsp
1434
1435 pop %r15
1436 pop %r14
1437 pop %r13
1438 pop %r12
1439.endm
1440
1441
1442#############################################################
1443#void aesni_gcm_precomp_avx_gen2
1444# (gcm_data *my_ctx_data,
1445# u8 *hash_subkey)# /* H, the Hash sub key input. Data starts on a 16-byte boundary. */
1446#############################################################
1447ENTRY(aesni_gcm_precomp_avx_gen2)
1448 #the number of pushes must equal STACK_OFFSET
1449 push %r12
1450 push %r13
1451 push %r14
1452 push %r15
1453
1454 mov %rsp, %r14
1455
1456
1457
1458 sub $VARIABLE_OFFSET, %rsp
1459 and $~63, %rsp # align rsp to 64 bytes
1460
1461 vmovdqu (arg2), %xmm6 # xmm6 = HashKey
1462
1463 vpshufb SHUF_MASK(%rip), %xmm6, %xmm6
1464 ############### PRECOMPUTATION of HashKey<<1 mod poly from the HashKey
1465 vmovdqa %xmm6, %xmm2
1466 vpsllq $1, %xmm6, %xmm6
1467 vpsrlq $63, %xmm2, %xmm2
1468 vmovdqa %xmm2, %xmm1
1469 vpslldq $8, %xmm2, %xmm2
1470 vpsrldq $8, %xmm1, %xmm1
1471 vpor %xmm2, %xmm6, %xmm6
1472 #reduction
1473 vpshufd $0b00100100, %xmm1, %xmm2
1474 vpcmpeqd TWOONE(%rip), %xmm2, %xmm2
1475 vpand POLY(%rip), %xmm2, %xmm2
1476 vpxor %xmm2, %xmm6, %xmm6 # xmm6 holds the HashKey<<1 mod poly
1477 #######################################################################
1478 vmovdqa %xmm6, HashKey(arg1) # store HashKey<<1 mod poly
1479
1480
1481 PRECOMPUTE_AVX %xmm6, %xmm0, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5
1482
1483 mov %r14, %rsp
1484
1485 pop %r15
1486 pop %r14
1487 pop %r13
1488 pop %r12
1489 ret
1490ENDPROC(aesni_gcm_precomp_avx_gen2)
1491
1492###############################################################################
1493#void aesni_gcm_enc_avx_gen2(
1494# gcm_data *my_ctx_data, /* aligned to 16 Bytes */
1495# u8 *out, /* Ciphertext output. Encrypt in-place is allowed. */
1496# const u8 *in, /* Plaintext input */
1497# u64 plaintext_len, /* Length of data in Bytes for encryption. */
1498# u8 *iv, /* Pre-counter block j0: 4 byte salt
1499# (from Security Association) concatenated with 8 byte
1500# Initialisation Vector (from IPSec ESP Payload)
1501# concatenated with 0x00000001. 16-byte aligned pointer. */
1502# const u8 *aad, /* Additional Authentication Data (AAD)*/
1503# u64 aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
1504# u8 *auth_tag, /* Authenticated Tag output. */
1505# u64 auth_tag_len)# /* Authenticated Tag Length in bytes.
1506# Valid values are 16 (most likely), 12 or 8. */
1507###############################################################################
1508ENTRY(aesni_gcm_enc_avx_gen2)
1509 GCM_ENC_DEC_AVX ENC
1510 ret
1511ENDPROC(aesni_gcm_enc_avx_gen2)
1512
1513###############################################################################
1514#void aesni_gcm_dec_avx_gen2(
1515# gcm_data *my_ctx_data, /* aligned to 16 Bytes */
1516# u8 *out, /* Plaintext output. Decrypt in-place is allowed. */
1517# const u8 *in, /* Ciphertext input */
1518# u64 plaintext_len, /* Length of data in Bytes for encryption. */
1519# u8 *iv, /* Pre-counter block j0: 4 byte salt
1520# (from Security Association) concatenated with 8 byte
1521# Initialisation Vector (from IPSec ESP Payload)
1522# concatenated with 0x00000001. 16-byte aligned pointer. */
1523# const u8 *aad, /* Additional Authentication Data (AAD)*/
1524# u64 aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
1525# u8 *auth_tag, /* Authenticated Tag output. */
1526# u64 auth_tag_len)# /* Authenticated Tag Length in bytes.
1527# Valid values are 16 (most likely), 12 or 8. */
1528###############################################################################
1529ENTRY(aesni_gcm_dec_avx_gen2)
1530 GCM_ENC_DEC_AVX DEC
1531 ret
1532ENDPROC(aesni_gcm_dec_avx_gen2)
1533#endif /* CONFIG_AS_AVX */
1534
1535#ifdef CONFIG_AS_AVX2
1536###############################################################################
1537# GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0)
1538# Input: A and B (128-bits each, bit-reflected)
1539# Output: C = A*B*x mod poly, (i.e. >>1 )
1540# To compute GH = GH*HashKey mod poly, give HK = HashKey<<1 mod poly as input
1541# GH = GH * HK * x mod poly which is equivalent to GH*HashKey mod poly.
1542###############################################################################
1543.macro GHASH_MUL_AVX2 GH HK T1 T2 T3 T4 T5
1544
1545 vpclmulqdq $0x11,\HK,\GH,\T1 # T1 = a1*b1
1546 vpclmulqdq $0x00,\HK,\GH,\T2 # T2 = a0*b0
1547 vpclmulqdq $0x01,\HK,\GH,\T3 # T3 = a1*b0
1548 vpclmulqdq $0x10,\HK,\GH,\GH # GH = a0*b1
1549 vpxor \T3, \GH, \GH
1550
1551
1552 vpsrldq $8 , \GH, \T3 # shift-R GH 2 DWs
1553 vpslldq $8 , \GH, \GH # shift-L GH 2 DWs
1554
1555 vpxor \T3, \T1, \T1
1556 vpxor \T2, \GH, \GH
1557
1558 #######################################################################
1559 #first phase of the reduction
1560 vmovdqa POLY2(%rip), \T3
1561
1562 vpclmulqdq $0x01, \GH, \T3, \T2
1563 vpslldq $8, \T2, \T2 # shift-L T2 2 DWs
1564
1565 vpxor \T2, \GH, \GH # first phase of the reduction complete
1566 #######################################################################
1567 #second phase of the reduction
1568 vpclmulqdq $0x00, \GH, \T3, \T2
1569 vpsrldq $4, \T2, \T2 # shift-R T2 1 DW (Shift-R only 1-DW to obtain 2-DWs shift-R)
1570
1571 vpclmulqdq $0x10, \GH, \T3, \GH
1572 vpslldq $4, \GH, \GH # shift-L GH 1 DW (Shift-L 1-DW to obtain result with no shifts)
1573
1574 vpxor \T2, \GH, \GH # second phase of the reduction complete
1575 #######################################################################
1576 vpxor \T1, \GH, \GH # the result is in GH
1577
1578
1579.endm
1580
1581.macro PRECOMPUTE_AVX2 HK T1 T2 T3 T4 T5 T6
1582
1583 # Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
1584 vmovdqa \HK, \T5
1585 GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^2<<1 mod poly
1586 vmovdqa \T5, HashKey_2(arg1) # [HashKey_2] = HashKey^2<<1 mod poly
1587
1588 GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^3<<1 mod poly
1589 vmovdqa \T5, HashKey_3(arg1)
1590
1591 GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^4<<1 mod poly
1592 vmovdqa \T5, HashKey_4(arg1)
1593
1594 GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^5<<1 mod poly
1595 vmovdqa \T5, HashKey_5(arg1)
1596
1597 GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^6<<1 mod poly
1598 vmovdqa \T5, HashKey_6(arg1)
1599
1600 GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^7<<1 mod poly
1601 vmovdqa \T5, HashKey_7(arg1)
1602
1603 GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2 # T5 = HashKey^8<<1 mod poly
1604 vmovdqa \T5, HashKey_8(arg1)
1605
1606.endm
1607
1608
1609## if a = number of total plaintext bytes
1610## b = floor(a/16)
1611## num_initial_blocks = b mod 4#
1612## encrypt the initial num_initial_blocks blocks and apply ghash on the ciphertext
1613## r10, r11, r12, rax are clobbered
1614## arg1, arg2, arg3, r14 are used as a pointer only, not modified
1615
1616.macro INITIAL_BLOCKS_AVX2 num_initial_blocks T1 T2 T3 T4 T5 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T6 T_key ENC_DEC VER
1617 i = (8-\num_initial_blocks)
1618 setreg
1619
1620 mov arg6, %r10 # r10 = AAD
1621 mov arg7, %r12 # r12 = aadLen
1622
1623
1624 mov %r12, %r11
1625
1626 vpxor reg_i, reg_i, reg_i
1627_get_AAD_loop\@:
1628 vmovd (%r10), \T1
1629 vpslldq $12, \T1, \T1
1630 vpsrldq $4, reg_i, reg_i
1631 vpxor \T1, reg_i, reg_i
1632
1633 add $4, %r10
1634 sub $4, %r12
1635 jg _get_AAD_loop\@
1636
1637
1638 cmp $16, %r11
1639 je _get_AAD_loop2_done\@
1640 mov $16, %r12
1641
1642_get_AAD_loop2\@:
1643 vpsrldq $4, reg_i, reg_i
1644 sub $4, %r12
1645 cmp %r11, %r12
1646 jg _get_AAD_loop2\@
1647
1648_get_AAD_loop2_done\@:
1649
1650 #byte-reflect the AAD data
1651 vpshufb SHUF_MASK(%rip), reg_i, reg_i
1652
1653 # initialize the data pointer offset as zero
1654 xor %r11, %r11
1655
1656 # start AES for num_initial_blocks blocks
1657 mov arg5, %rax # rax = *Y0
1658 vmovdqu (%rax), \CTR # CTR = Y0
1659 vpshufb SHUF_MASK(%rip), \CTR, \CTR
1660
1661
1662 i = (9-\num_initial_blocks)
1663 setreg
1664.rep \num_initial_blocks
1665 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1666 vmovdqa \CTR, reg_i
1667 vpshufb SHUF_MASK(%rip), reg_i, reg_i # perform a 16Byte swap
1668 i = (i+1)
1669 setreg
1670.endr
1671
1672 vmovdqa (arg1), \T_key
1673 i = (9-\num_initial_blocks)
1674 setreg
1675.rep \num_initial_blocks
1676 vpxor \T_key, reg_i, reg_i
1677 i = (i+1)
1678 setreg
1679.endr
1680
1681 j = 1
1682 setreg
1683.rep 9
1684 vmovdqa 16*j(arg1), \T_key
1685 i = (9-\num_initial_blocks)
1686 setreg
1687.rep \num_initial_blocks
1688 vaesenc \T_key, reg_i, reg_i
1689 i = (i+1)
1690 setreg
1691.endr
1692
1693 j = (j+1)
1694 setreg
1695.endr
1696
1697
1698 vmovdqa 16*10(arg1), \T_key
1699 i = (9-\num_initial_blocks)
1700 setreg
1701.rep \num_initial_blocks
1702 vaesenclast \T_key, reg_i, reg_i
1703 i = (i+1)
1704 setreg
1705.endr
1706
1707 i = (9-\num_initial_blocks)
1708 setreg
1709.rep \num_initial_blocks
1710 vmovdqu (arg3, %r11), \T1
1711 vpxor \T1, reg_i, reg_i
1712 vmovdqu reg_i, (arg2 , %r11) # write back ciphertext for
1713 # num_initial_blocks blocks
1714 add $16, %r11
1715.if \ENC_DEC == DEC
1716 vmovdqa \T1, reg_i
1717.endif
1718 vpshufb SHUF_MASK(%rip), reg_i, reg_i # prepare ciphertext for GHASH computations
1719 i = (i+1)
1720 setreg
1721.endr
1722
1723
1724 i = (8-\num_initial_blocks)
1725 j = (9-\num_initial_blocks)
1726 setreg
1727 GHASH_MUL_AVX2 reg_i, \T2, \T1, \T3, \T4, \T5, \T6
1728
1729.rep \num_initial_blocks
1730 vpxor reg_i, reg_j, reg_j
1731 GHASH_MUL_AVX2 reg_j, \T2, \T1, \T3, \T4, \T5, \T6 # apply GHASH on num_initial_blocks blocks
1732 i = (i+1)
1733 j = (j+1)
1734 setreg
1735.endr
1736 # XMM8 has the combined result here
1737
1738 vmovdqa \XMM8, TMP1(%rsp)
1739 vmovdqa \XMM8, \T3
1740
1741 cmp $128, %r13
1742 jl _initial_blocks_done\@ # no need for precomputed constants
1743
1744###############################################################################
1745# Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
1746 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1747 vmovdqa \CTR, \XMM1
1748 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
1749
1750 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1751 vmovdqa \CTR, \XMM2
1752 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
1753
1754 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1755 vmovdqa \CTR, \XMM3
1756 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
1757
1758 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1759 vmovdqa \CTR, \XMM4
1760 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
1761
1762 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1763 vmovdqa \CTR, \XMM5
1764 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
1765
1766 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1767 vmovdqa \CTR, \XMM6
1768 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
1769
1770 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1771 vmovdqa \CTR, \XMM7
1772 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
1773
1774 vpaddd ONE(%rip), \CTR, \CTR # INCR Y0
1775 vmovdqa \CTR, \XMM8
1776 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
1777
1778 vmovdqa (arg1), \T_key
1779 vpxor \T_key, \XMM1, \XMM1
1780 vpxor \T_key, \XMM2, \XMM2
1781 vpxor \T_key, \XMM3, \XMM3
1782 vpxor \T_key, \XMM4, \XMM4
1783 vpxor \T_key, \XMM5, \XMM5
1784 vpxor \T_key, \XMM6, \XMM6
1785 vpxor \T_key, \XMM7, \XMM7
1786 vpxor \T_key, \XMM8, \XMM8
1787
1788 i = 1
1789 setreg
1790.rep 9 # do 9 rounds
1791 vmovdqa 16*i(arg1), \T_key
1792 vaesenc \T_key, \XMM1, \XMM1
1793 vaesenc \T_key, \XMM2, \XMM2
1794 vaesenc \T_key, \XMM3, \XMM3
1795 vaesenc \T_key, \XMM4, \XMM4
1796 vaesenc \T_key, \XMM5, \XMM5
1797 vaesenc \T_key, \XMM6, \XMM6
1798 vaesenc \T_key, \XMM7, \XMM7
1799 vaesenc \T_key, \XMM8, \XMM8
1800 i = (i+1)
1801 setreg
1802.endr
1803
1804
1805 vmovdqa 16*i(arg1), \T_key
1806 vaesenclast \T_key, \XMM1, \XMM1
1807 vaesenclast \T_key, \XMM2, \XMM2
1808 vaesenclast \T_key, \XMM3, \XMM3
1809 vaesenclast \T_key, \XMM4, \XMM4
1810 vaesenclast \T_key, \XMM5, \XMM5
1811 vaesenclast \T_key, \XMM6, \XMM6
1812 vaesenclast \T_key, \XMM7, \XMM7
1813 vaesenclast \T_key, \XMM8, \XMM8
1814
1815 vmovdqu (arg3, %r11), \T1
1816 vpxor \T1, \XMM1, \XMM1
1817 vmovdqu \XMM1, (arg2 , %r11)
1818 .if \ENC_DEC == DEC
1819 vmovdqa \T1, \XMM1
1820 .endif
1821
1822 vmovdqu 16*1(arg3, %r11), \T1
1823 vpxor \T1, \XMM2, \XMM2
1824 vmovdqu \XMM2, 16*1(arg2 , %r11)
1825 .if \ENC_DEC == DEC
1826 vmovdqa \T1, \XMM2
1827 .endif
1828
1829 vmovdqu 16*2(arg3, %r11), \T1
1830 vpxor \T1, \XMM3, \XMM3
1831 vmovdqu \XMM3, 16*2(arg2 , %r11)
1832 .if \ENC_DEC == DEC
1833 vmovdqa \T1, \XMM3
1834 .endif
1835
1836 vmovdqu 16*3(arg3, %r11), \T1
1837 vpxor \T1, \XMM4, \XMM4
1838 vmovdqu \XMM4, 16*3(arg2 , %r11)
1839 .if \ENC_DEC == DEC
1840 vmovdqa \T1, \XMM4
1841 .endif
1842
1843 vmovdqu 16*4(arg3, %r11), \T1
1844 vpxor \T1, \XMM5, \XMM5
1845 vmovdqu \XMM5, 16*4(arg2 , %r11)
1846 .if \ENC_DEC == DEC
1847 vmovdqa \T1, \XMM5
1848 .endif
1849
1850 vmovdqu 16*5(arg3, %r11), \T1
1851 vpxor \T1, \XMM6, \XMM6
1852 vmovdqu \XMM6, 16*5(arg2 , %r11)
1853 .if \ENC_DEC == DEC
1854 vmovdqa \T1, \XMM6
1855 .endif
1856
1857 vmovdqu 16*6(arg3, %r11), \T1
1858 vpxor \T1, \XMM7, \XMM7
1859 vmovdqu \XMM7, 16*6(arg2 , %r11)
1860 .if \ENC_DEC == DEC
1861 vmovdqa \T1, \XMM7
1862 .endif
1863
1864 vmovdqu 16*7(arg3, %r11), \T1
1865 vpxor \T1, \XMM8, \XMM8
1866 vmovdqu \XMM8, 16*7(arg2 , %r11)
1867 .if \ENC_DEC == DEC
1868 vmovdqa \T1, \XMM8
1869 .endif
1870
1871 add $128, %r11
1872
1873 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
1874 vpxor TMP1(%rsp), \XMM1, \XMM1 # combine GHASHed value with
1875 # the corresponding ciphertext
1876 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
1877 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
1878 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
1879 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
1880 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
1881 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
1882 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
1883
1884###############################################################################
1885
1886_initial_blocks_done\@:
1887
1888
1889.endm
1890
1891
1892
1893# encrypt 8 blocks at a time
1894# ghash the 8 previously encrypted ciphertext blocks
1895# arg1, arg2, arg3 are used as pointers only, not modified
1896# r11 is the data offset value
1897.macro GHASH_8_ENCRYPT_8_PARALLEL_AVX2 T1 T2 T3 T4 T5 T6 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T7 loop_idx ENC_DEC
1898
1899 vmovdqa \XMM1, \T2
1900 vmovdqa \XMM2, TMP2(%rsp)
1901 vmovdqa \XMM3, TMP3(%rsp)
1902 vmovdqa \XMM4, TMP4(%rsp)
1903 vmovdqa \XMM5, TMP5(%rsp)
1904 vmovdqa \XMM6, TMP6(%rsp)
1905 vmovdqa \XMM7, TMP7(%rsp)
1906 vmovdqa \XMM8, TMP8(%rsp)
1907
1908.if \loop_idx == in_order
1909 vpaddd ONE(%rip), \CTR, \XMM1 # INCR CNT
1910 vpaddd ONE(%rip), \XMM1, \XMM2
1911 vpaddd ONE(%rip), \XMM2, \XMM3
1912 vpaddd ONE(%rip), \XMM3, \XMM4
1913 vpaddd ONE(%rip), \XMM4, \XMM5
1914 vpaddd ONE(%rip), \XMM5, \XMM6
1915 vpaddd ONE(%rip), \XMM6, \XMM7
1916 vpaddd ONE(%rip), \XMM7, \XMM8
1917 vmovdqa \XMM8, \CTR
1918
1919 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
1920 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
1921 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
1922 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
1923 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
1924 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
1925 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
1926 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
1927.else
1928 vpaddd ONEf(%rip), \CTR, \XMM1 # INCR CNT
1929 vpaddd ONEf(%rip), \XMM1, \XMM2
1930 vpaddd ONEf(%rip), \XMM2, \XMM3
1931 vpaddd ONEf(%rip), \XMM3, \XMM4
1932 vpaddd ONEf(%rip), \XMM4, \XMM5
1933 vpaddd ONEf(%rip), \XMM5, \XMM6
1934 vpaddd ONEf(%rip), \XMM6, \XMM7
1935 vpaddd ONEf(%rip), \XMM7, \XMM8
1936 vmovdqa \XMM8, \CTR
1937.endif
1938
1939
1940 #######################################################################
1941
1942 vmovdqu (arg1), \T1
1943 vpxor \T1, \XMM1, \XMM1
1944 vpxor \T1, \XMM2, \XMM2
1945 vpxor \T1, \XMM3, \XMM3
1946 vpxor \T1, \XMM4, \XMM4
1947 vpxor \T1, \XMM5, \XMM5
1948 vpxor \T1, \XMM6, \XMM6
1949 vpxor \T1, \XMM7, \XMM7
1950 vpxor \T1, \XMM8, \XMM8
1951
1952 #######################################################################
1953
1954
1955
1956
1957
1958 vmovdqu 16*1(arg1), \T1
1959 vaesenc \T1, \XMM1, \XMM1
1960 vaesenc \T1, \XMM2, \XMM2
1961 vaesenc \T1, \XMM3, \XMM3
1962 vaesenc \T1, \XMM4, \XMM4
1963 vaesenc \T1, \XMM5, \XMM5
1964 vaesenc \T1, \XMM6, \XMM6
1965 vaesenc \T1, \XMM7, \XMM7
1966 vaesenc \T1, \XMM8, \XMM8
1967
1968 vmovdqu 16*2(arg1), \T1
1969 vaesenc \T1, \XMM1, \XMM1
1970 vaesenc \T1, \XMM2, \XMM2
1971 vaesenc \T1, \XMM3, \XMM3
1972 vaesenc \T1, \XMM4, \XMM4
1973 vaesenc \T1, \XMM5, \XMM5
1974 vaesenc \T1, \XMM6, \XMM6
1975 vaesenc \T1, \XMM7, \XMM7
1976 vaesenc \T1, \XMM8, \XMM8
1977
1978
1979 #######################################################################
1980
1981 vmovdqa HashKey_8(arg1), \T5
1982 vpclmulqdq $0x11, \T5, \T2, \T4 # T4 = a1*b1
1983 vpclmulqdq $0x00, \T5, \T2, \T7 # T7 = a0*b0
1984 vpclmulqdq $0x01, \T5, \T2, \T6 # T6 = a1*b0
1985 vpclmulqdq $0x10, \T5, \T2, \T5 # T5 = a0*b1
1986 vpxor \T5, \T6, \T6
1987
1988 vmovdqu 16*3(arg1), \T1
1989 vaesenc \T1, \XMM1, \XMM1
1990 vaesenc \T1, \XMM2, \XMM2
1991 vaesenc \T1, \XMM3, \XMM3
1992 vaesenc \T1, \XMM4, \XMM4
1993 vaesenc \T1, \XMM5, \XMM5
1994 vaesenc \T1, \XMM6, \XMM6
1995 vaesenc \T1, \XMM7, \XMM7
1996 vaesenc \T1, \XMM8, \XMM8
1997
1998 vmovdqa TMP2(%rsp), \T1
1999 vmovdqa HashKey_7(arg1), \T5
2000 vpclmulqdq $0x11, \T5, \T1, \T3
2001 vpxor \T3, \T4, \T4
2002
2003 vpclmulqdq $0x00, \T5, \T1, \T3
2004 vpxor \T3, \T7, \T7
2005
2006 vpclmulqdq $0x01, \T5, \T1, \T3
2007 vpxor \T3, \T6, \T6
2008
2009 vpclmulqdq $0x10, \T5, \T1, \T3
2010 vpxor \T3, \T6, \T6
2011
2012 vmovdqu 16*4(arg1), \T1
2013 vaesenc \T1, \XMM1, \XMM1
2014 vaesenc \T1, \XMM2, \XMM2
2015 vaesenc \T1, \XMM3, \XMM3
2016 vaesenc \T1, \XMM4, \XMM4
2017 vaesenc \T1, \XMM5, \XMM5
2018 vaesenc \T1, \XMM6, \XMM6
2019 vaesenc \T1, \XMM7, \XMM7
2020 vaesenc \T1, \XMM8, \XMM8
2021
2022 #######################################################################
2023
2024 vmovdqa TMP3(%rsp), \T1
2025 vmovdqa HashKey_6(arg1), \T5
2026 vpclmulqdq $0x11, \T5, \T1, \T3
2027 vpxor \T3, \T4, \T4
2028
2029 vpclmulqdq $0x00, \T5, \T1, \T3
2030 vpxor \T3, \T7, \T7
2031
2032 vpclmulqdq $0x01, \T5, \T1, \T3
2033 vpxor \T3, \T6, \T6
2034
2035 vpclmulqdq $0x10, \T5, \T1, \T3
2036 vpxor \T3, \T6, \T6
2037
2038 vmovdqu 16*5(arg1), \T1
2039 vaesenc \T1, \XMM1, \XMM1
2040 vaesenc \T1, \XMM2, \XMM2
2041 vaesenc \T1, \XMM3, \XMM3
2042 vaesenc \T1, \XMM4, \XMM4
2043 vaesenc \T1, \XMM5, \XMM5
2044 vaesenc \T1, \XMM6, \XMM6
2045 vaesenc \T1, \XMM7, \XMM7
2046 vaesenc \T1, \XMM8, \XMM8
2047
2048 vmovdqa TMP4(%rsp), \T1
2049 vmovdqa HashKey_5(arg1), \T5
2050 vpclmulqdq $0x11, \T5, \T1, \T3
2051 vpxor \T3, \T4, \T4
2052
2053 vpclmulqdq $0x00, \T5, \T1, \T3
2054 vpxor \T3, \T7, \T7
2055
2056 vpclmulqdq $0x01, \T5, \T1, \T3
2057 vpxor \T3, \T6, \T6
2058
2059 vpclmulqdq $0x10, \T5, \T1, \T3
2060 vpxor \T3, \T6, \T6
2061
2062 vmovdqu 16*6(arg1), \T1
2063 vaesenc \T1, \XMM1, \XMM1
2064 vaesenc \T1, \XMM2, \XMM2
2065 vaesenc \T1, \XMM3, \XMM3
2066 vaesenc \T1, \XMM4, \XMM4
2067 vaesenc \T1, \XMM5, \XMM5
2068 vaesenc \T1, \XMM6, \XMM6
2069 vaesenc \T1, \XMM7, \XMM7
2070 vaesenc \T1, \XMM8, \XMM8
2071
2072
2073 vmovdqa TMP5(%rsp), \T1
2074 vmovdqa HashKey_4(arg1), \T5
2075 vpclmulqdq $0x11, \T5, \T1, \T3
2076 vpxor \T3, \T4, \T4
2077
2078 vpclmulqdq $0x00, \T5, \T1, \T3
2079 vpxor \T3, \T7, \T7
2080
2081 vpclmulqdq $0x01, \T5, \T1, \T3
2082 vpxor \T3, \T6, \T6
2083
2084 vpclmulqdq $0x10, \T5, \T1, \T3
2085 vpxor \T3, \T6, \T6
2086
2087 vmovdqu 16*7(arg1), \T1
2088 vaesenc \T1, \XMM1, \XMM1
2089 vaesenc \T1, \XMM2, \XMM2
2090 vaesenc \T1, \XMM3, \XMM3
2091 vaesenc \T1, \XMM4, \XMM4
2092 vaesenc \T1, \XMM5, \XMM5
2093 vaesenc \T1, \XMM6, \XMM6
2094 vaesenc \T1, \XMM7, \XMM7
2095 vaesenc \T1, \XMM8, \XMM8
2096
2097 vmovdqa TMP6(%rsp), \T1
2098 vmovdqa HashKey_3(arg1), \T5
2099 vpclmulqdq $0x11, \T5, \T1, \T3
2100 vpxor \T3, \T4, \T4
2101
2102 vpclmulqdq $0x00, \T5, \T1, \T3
2103 vpxor \T3, \T7, \T7
2104
2105 vpclmulqdq $0x01, \T5, \T1, \T3
2106 vpxor \T3, \T6, \T6
2107
2108 vpclmulqdq $0x10, \T5, \T1, \T3
2109 vpxor \T3, \T6, \T6
2110
2111 vmovdqu 16*8(arg1), \T1
2112 vaesenc \T1, \XMM1, \XMM1
2113 vaesenc \T1, \XMM2, \XMM2
2114 vaesenc \T1, \XMM3, \XMM3
2115 vaesenc \T1, \XMM4, \XMM4
2116 vaesenc \T1, \XMM5, \XMM5
2117 vaesenc \T1, \XMM6, \XMM6
2118 vaesenc \T1, \XMM7, \XMM7
2119 vaesenc \T1, \XMM8, \XMM8
2120
2121 vmovdqa TMP7(%rsp), \T1
2122 vmovdqa HashKey_2(arg1), \T5
2123 vpclmulqdq $0x11, \T5, \T1, \T3
2124 vpxor \T3, \T4, \T4
2125
2126 vpclmulqdq $0x00, \T5, \T1, \T3
2127 vpxor \T3, \T7, \T7
2128
2129 vpclmulqdq $0x01, \T5, \T1, \T3
2130 vpxor \T3, \T6, \T6
2131
2132 vpclmulqdq $0x10, \T5, \T1, \T3
2133 vpxor \T3, \T6, \T6
2134
2135
2136 #######################################################################
2137
2138 vmovdqu 16*9(arg1), \T5
2139 vaesenc \T5, \XMM1, \XMM1
2140 vaesenc \T5, \XMM2, \XMM2
2141 vaesenc \T5, \XMM3, \XMM3
2142 vaesenc \T5, \XMM4, \XMM4
2143 vaesenc \T5, \XMM5, \XMM5
2144 vaesenc \T5, \XMM6, \XMM6
2145 vaesenc \T5, \XMM7, \XMM7
2146 vaesenc \T5, \XMM8, \XMM8
2147
2148 vmovdqa TMP8(%rsp), \T1
2149 vmovdqa HashKey(arg1), \T5
2150
2151 vpclmulqdq $0x00, \T5, \T1, \T3
2152 vpxor \T3, \T7, \T7
2153
2154 vpclmulqdq $0x01, \T5, \T1, \T3
2155 vpxor \T3, \T6, \T6
2156
2157 vpclmulqdq $0x10, \T5, \T1, \T3
2158 vpxor \T3, \T6, \T6
2159
2160 vpclmulqdq $0x11, \T5, \T1, \T3
2161 vpxor \T3, \T4, \T1
2162
2163
2164 vmovdqu 16*10(arg1), \T5
2165
2166 i = 0
2167 j = 1
2168 setreg
2169.rep 8
2170 vpxor 16*i(arg3, %r11), \T5, \T2
2171 .if \ENC_DEC == ENC
2172 vaesenclast \T2, reg_j, reg_j
2173 .else
2174 vaesenclast \T2, reg_j, \T3
2175 vmovdqu 16*i(arg3, %r11), reg_j
2176 vmovdqu \T3, 16*i(arg2, %r11)
2177 .endif
2178 i = (i+1)
2179 j = (j+1)
2180 setreg
2181.endr
2182 #######################################################################
2183
2184
2185 vpslldq $8, \T6, \T3 # shift-L T3 2 DWs
2186 vpsrldq $8, \T6, \T6 # shift-R T2 2 DWs
2187 vpxor \T3, \T7, \T7
2188 vpxor \T6, \T1, \T1 # accumulate the results in T1:T7
2189
2190
2191
2192 #######################################################################
2193 #first phase of the reduction
2194 vmovdqa POLY2(%rip), \T3
2195
2196 vpclmulqdq $0x01, \T7, \T3, \T2
2197 vpslldq $8, \T2, \T2 # shift-L xmm2 2 DWs
2198
2199 vpxor \T2, \T7, \T7 # first phase of the reduction complete
2200 #######################################################################
2201 .if \ENC_DEC == ENC
2202 vmovdqu \XMM1, 16*0(arg2,%r11) # Write to the Ciphertext buffer
2203 vmovdqu \XMM2, 16*1(arg2,%r11) # Write to the Ciphertext buffer
2204 vmovdqu \XMM3, 16*2(arg2,%r11) # Write to the Ciphertext buffer
2205 vmovdqu \XMM4, 16*3(arg2,%r11) # Write to the Ciphertext buffer
2206 vmovdqu \XMM5, 16*4(arg2,%r11) # Write to the Ciphertext buffer
2207 vmovdqu \XMM6, 16*5(arg2,%r11) # Write to the Ciphertext buffer
2208 vmovdqu \XMM7, 16*6(arg2,%r11) # Write to the Ciphertext buffer
2209 vmovdqu \XMM8, 16*7(arg2,%r11) # Write to the Ciphertext buffer
2210 .endif
2211
2212 #######################################################################
2213 #second phase of the reduction
2214 vpclmulqdq $0x00, \T7, \T3, \T2
2215 vpsrldq $4, \T2, \T2 # shift-R xmm2 1 DW (Shift-R only 1-DW to obtain 2-DWs shift-R)
2216
2217 vpclmulqdq $0x10, \T7, \T3, \T4
2218 vpslldq $4, \T4, \T4 # shift-L xmm0 1 DW (Shift-L 1-DW to obtain result with no shifts)
2219
2220 vpxor \T2, \T4, \T4 # second phase of the reduction complete
2221 #######################################################################
2222 vpxor \T4, \T1, \T1 # the result is in T1
2223
2224 vpshufb SHUF_MASK(%rip), \XMM1, \XMM1 # perform a 16Byte swap
2225 vpshufb SHUF_MASK(%rip), \XMM2, \XMM2 # perform a 16Byte swap
2226 vpshufb SHUF_MASK(%rip), \XMM3, \XMM3 # perform a 16Byte swap
2227 vpshufb SHUF_MASK(%rip), \XMM4, \XMM4 # perform a 16Byte swap
2228 vpshufb SHUF_MASK(%rip), \XMM5, \XMM5 # perform a 16Byte swap
2229 vpshufb SHUF_MASK(%rip), \XMM6, \XMM6 # perform a 16Byte swap
2230 vpshufb SHUF_MASK(%rip), \XMM7, \XMM7 # perform a 16Byte swap
2231 vpshufb SHUF_MASK(%rip), \XMM8, \XMM8 # perform a 16Byte swap
2232
2233
2234 vpxor \T1, \XMM1, \XMM1
2235
2236
2237
2238.endm
2239
2240
2241# GHASH the last 4 ciphertext blocks.
2242.macro GHASH_LAST_8_AVX2 T1 T2 T3 T4 T5 T6 T7 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8
2243
2244 ## Karatsuba Method
2245
2246 vmovdqa HashKey_8(arg1), \T5
2247
2248 vpshufd $0b01001110, \XMM1, \T2
2249 vpshufd $0b01001110, \T5, \T3
2250 vpxor \XMM1, \T2, \T2
2251 vpxor \T5, \T3, \T3
2252
2253 vpclmulqdq $0x11, \T5, \XMM1, \T6
2254 vpclmulqdq $0x00, \T5, \XMM1, \T7
2255
2256 vpclmulqdq $0x00, \T3, \T2, \XMM1
2257
2258 ######################
2259
2260 vmovdqa HashKey_7(arg1), \T5
2261 vpshufd $0b01001110, \XMM2, \T2
2262 vpshufd $0b01001110, \T5, \T3
2263 vpxor \XMM2, \T2, \T2
2264 vpxor \T5, \T3, \T3
2265
2266 vpclmulqdq $0x11, \T5, \XMM2, \T4
2267 vpxor \T4, \T6, \T6
2268
2269 vpclmulqdq $0x00, \T5, \XMM2, \T4
2270 vpxor \T4, \T7, \T7
2271
2272 vpclmulqdq $0x00, \T3, \T2, \T2
2273
2274 vpxor \T2, \XMM1, \XMM1
2275
2276 ######################
2277
2278 vmovdqa HashKey_6(arg1), \T5
2279 vpshufd $0b01001110, \XMM3, \T2
2280 vpshufd $0b01001110, \T5, \T3
2281 vpxor \XMM3, \T2, \T2
2282 vpxor \T5, \T3, \T3
2283
2284 vpclmulqdq $0x11, \T5, \XMM3, \T4
2285 vpxor \T4, \T6, \T6
2286
2287 vpclmulqdq $0x00, \T5, \XMM3, \T4
2288 vpxor \T4, \T7, \T7
2289
2290 vpclmulqdq $0x00, \T3, \T2, \T2
2291
2292 vpxor \T2, \XMM1, \XMM1
2293
2294 ######################
2295
2296 vmovdqa HashKey_5(arg1), \T5
2297 vpshufd $0b01001110, \XMM4, \T2
2298 vpshufd $0b01001110, \T5, \T3
2299 vpxor \XMM4, \T2, \T2
2300 vpxor \T5, \T3, \T3
2301
2302 vpclmulqdq $0x11, \T5, \XMM4, \T4
2303 vpxor \T4, \T6, \T6
2304
2305 vpclmulqdq $0x00, \T5, \XMM4, \T4
2306 vpxor \T4, \T7, \T7
2307
2308 vpclmulqdq $0x00, \T3, \T2, \T2
2309
2310 vpxor \T2, \XMM1, \XMM1
2311
2312 ######################
2313
2314 vmovdqa HashKey_4(arg1), \T5
2315 vpshufd $0b01001110, \XMM5, \T2
2316 vpshufd $0b01001110, \T5, \T3
2317 vpxor \XMM5, \T2, \T2
2318 vpxor \T5, \T3, \T3
2319
2320 vpclmulqdq $0x11, \T5, \XMM5, \T4
2321 vpxor \T4, \T6, \T6
2322
2323 vpclmulqdq $0x00, \T5, \XMM5, \T4
2324 vpxor \T4, \T7, \T7
2325
2326 vpclmulqdq $0x00, \T3, \T2, \T2
2327
2328 vpxor \T2, \XMM1, \XMM1
2329
2330 ######################
2331
2332 vmovdqa HashKey_3(arg1), \T5
2333 vpshufd $0b01001110, \XMM6, \T2
2334 vpshufd $0b01001110, \T5, \T3
2335 vpxor \XMM6, \T2, \T2
2336 vpxor \T5, \T3, \T3
2337
2338 vpclmulqdq $0x11, \T5, \XMM6, \T4
2339 vpxor \T4, \T6, \T6
2340
2341 vpclmulqdq $0x00, \T5, \XMM6, \T4
2342 vpxor \T4, \T7, \T7
2343
2344 vpclmulqdq $0x00, \T3, \T2, \T2
2345
2346 vpxor \T2, \XMM1, \XMM1
2347
2348 ######################
2349
2350 vmovdqa HashKey_2(arg1), \T5
2351 vpshufd $0b01001110, \XMM7, \T2
2352 vpshufd $0b01001110, \T5, \T3
2353 vpxor \XMM7, \T2, \T2
2354 vpxor \T5, \T3, \T3
2355
2356 vpclmulqdq $0x11, \T5, \XMM7, \T4
2357 vpxor \T4, \T6, \T6
2358
2359 vpclmulqdq $0x00, \T5, \XMM7, \T4
2360 vpxor \T4, \T7, \T7
2361
2362 vpclmulqdq $0x00, \T3, \T2, \T2
2363
2364 vpxor \T2, \XMM1, \XMM1
2365
2366 ######################
2367
2368 vmovdqa HashKey(arg1), \T5
2369 vpshufd $0b01001110, \XMM8, \T2
2370 vpshufd $0b01001110, \T5, \T3
2371 vpxor \XMM8, \T2, \T2
2372 vpxor \T5, \T3, \T3
2373
2374 vpclmulqdq $0x11, \T5, \XMM8, \T4
2375 vpxor \T4, \T6, \T6
2376
2377 vpclmulqdq $0x00, \T5, \XMM8, \T4
2378 vpxor \T4, \T7, \T7
2379
2380 vpclmulqdq $0x00, \T3, \T2, \T2
2381
2382 vpxor \T2, \XMM1, \XMM1
2383 vpxor \T6, \XMM1, \XMM1
2384 vpxor \T7, \XMM1, \T2
2385
2386
2387
2388
2389 vpslldq $8, \T2, \T4
2390 vpsrldq $8, \T2, \T2
2391
2392 vpxor \T4, \T7, \T7
2393 vpxor \T2, \T6, \T6 # <T6:T7> holds the result of the
2394 # accumulated carry-less multiplications
2395
2396 #######################################################################
2397 #first phase of the reduction
2398 vmovdqa POLY2(%rip), \T3
2399
2400 vpclmulqdq $0x01, \T7, \T3, \T2
2401 vpslldq $8, \T2, \T2 # shift-L xmm2 2 DWs
2402
2403 vpxor \T2, \T7, \T7 # first phase of the reduction complete
2404 #######################################################################
2405
2406
2407 #second phase of the reduction
2408 vpclmulqdq $0x00, \T7, \T3, \T2
2409 vpsrldq $4, \T2, \T2 # shift-R T2 1 DW (Shift-R only 1-DW to obtain 2-DWs shift-R)
2410
2411 vpclmulqdq $0x10, \T7, \T3, \T4
2412 vpslldq $4, \T4, \T4 # shift-L T4 1 DW (Shift-L 1-DW to obtain result with no shifts)
2413
2414 vpxor \T2, \T4, \T4 # second phase of the reduction complete
2415 #######################################################################
2416 vpxor \T4, \T6, \T6 # the result is in T6
2417.endm
2418
2419
2420
2421# combined for GCM encrypt and decrypt functions
2422# clobbering all xmm registers
2423# clobbering r10, r11, r12, r13, r14, r15
2424.macro GCM_ENC_DEC_AVX2 ENC_DEC
2425
2426 #the number of pushes must equal STACK_OFFSET
2427 push %r12
2428 push %r13
2429 push %r14
2430 push %r15
2431
2432 mov %rsp, %r14
2433
2434
2435
2436
2437 sub $VARIABLE_OFFSET, %rsp
2438 and $~63, %rsp # align rsp to 64 bytes
2439
2440
2441 vmovdqu HashKey(arg1), %xmm13 # xmm13 = HashKey
2442
2443 mov arg4, %r13 # save the number of bytes of plaintext/ciphertext
2444 and $-16, %r13 # r13 = r13 - (r13 mod 16)
2445
2446 mov %r13, %r12
2447 shr $4, %r12
2448 and $7, %r12
2449 jz _initial_num_blocks_is_0\@
2450
2451 cmp $7, %r12
2452 je _initial_num_blocks_is_7\@
2453 cmp $6, %r12
2454 je _initial_num_blocks_is_6\@
2455 cmp $5, %r12
2456 je _initial_num_blocks_is_5\@
2457 cmp $4, %r12
2458 je _initial_num_blocks_is_4\@
2459 cmp $3, %r12
2460 je _initial_num_blocks_is_3\@
2461 cmp $2, %r12
2462 je _initial_num_blocks_is_2\@
2463
2464 jmp _initial_num_blocks_is_1\@
2465
2466_initial_num_blocks_is_7\@:
2467 INITIAL_BLOCKS_AVX2 7, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2468 sub $16*7, %r13
2469 jmp _initial_blocks_encrypted\@
2470
2471_initial_num_blocks_is_6\@:
2472 INITIAL_BLOCKS_AVX2 6, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2473 sub $16*6, %r13
2474 jmp _initial_blocks_encrypted\@
2475
2476_initial_num_blocks_is_5\@:
2477 INITIAL_BLOCKS_AVX2 5, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2478 sub $16*5, %r13
2479 jmp _initial_blocks_encrypted\@
2480
2481_initial_num_blocks_is_4\@:
2482 INITIAL_BLOCKS_AVX2 4, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2483 sub $16*4, %r13
2484 jmp _initial_blocks_encrypted\@
2485
2486_initial_num_blocks_is_3\@:
2487 INITIAL_BLOCKS_AVX2 3, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2488 sub $16*3, %r13
2489 jmp _initial_blocks_encrypted\@
2490
2491_initial_num_blocks_is_2\@:
2492 INITIAL_BLOCKS_AVX2 2, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2493 sub $16*2, %r13
2494 jmp _initial_blocks_encrypted\@
2495
2496_initial_num_blocks_is_1\@:
2497 INITIAL_BLOCKS_AVX2 1, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2498 sub $16*1, %r13
2499 jmp _initial_blocks_encrypted\@
2500
2501_initial_num_blocks_is_0\@:
2502 INITIAL_BLOCKS_AVX2 0, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
2503
2504
2505_initial_blocks_encrypted\@:
2506 cmp $0, %r13
2507 je _zero_cipher_left\@
2508
2509 sub $128, %r13
2510 je _eight_cipher_left\@
2511
2512
2513
2514
2515 vmovd %xmm9, %r15d
2516 and $255, %r15d
2517 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2518
2519
2520_encrypt_by_8_new\@:
2521 cmp $(255-8), %r15d
2522 jg _encrypt_by_8\@
2523
2524
2525
2526 add $8, %r15b
2527 GHASH_8_ENCRYPT_8_PARALLEL_AVX2 %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, out_order, \ENC_DEC
2528 add $128, %r11
2529 sub $128, %r13
2530 jne _encrypt_by_8_new\@
2531
2532 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2533 jmp _eight_cipher_left\@
2534
2535_encrypt_by_8\@:
2536 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2537 add $8, %r15b
2538 GHASH_8_ENCRYPT_8_PARALLEL_AVX2 %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, in_order, \ENC_DEC
2539 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2540 add $128, %r11
2541 sub $128, %r13
2542 jne _encrypt_by_8_new\@
2543
2544 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2545
2546
2547
2548
2549_eight_cipher_left\@:
2550 GHASH_LAST_8_AVX2 %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm15, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8
2551
2552
2553_zero_cipher_left\@:
2554 cmp $16, arg4
2555 jl _only_less_than_16\@
2556
2557 mov arg4, %r13
2558 and $15, %r13 # r13 = (arg4 mod 16)
2559
2560 je _multiple_of_16_bytes\@
2561
2562 # handle the last <16 Byte block seperately
2563
2564
2565 vpaddd ONE(%rip), %xmm9, %xmm9 # INCR CNT to get Yn
2566 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2567 ENCRYPT_SINGLE_BLOCK %xmm9 # E(K, Yn)
2568
2569 sub $16, %r11
2570 add %r13, %r11
2571 vmovdqu (arg3, %r11), %xmm1 # receive the last <16 Byte block
2572
2573 lea SHIFT_MASK+16(%rip), %r12
2574 sub %r13, %r12 # adjust the shuffle mask pointer
2575 # to be able to shift 16-r13 bytes
2576 # (r13 is the number of bytes in plaintext mod 16)
2577 vmovdqu (%r12), %xmm2 # get the appropriate shuffle mask
2578 vpshufb %xmm2, %xmm1, %xmm1 # shift right 16-r13 bytes
2579 jmp _final_ghash_mul\@
2580
2581_only_less_than_16\@:
2582 # check for 0 length
2583 mov arg4, %r13
2584 and $15, %r13 # r13 = (arg4 mod 16)
2585
2586 je _multiple_of_16_bytes\@
2587
2588 # handle the last <16 Byte block seperately
2589
2590
2591 vpaddd ONE(%rip), %xmm9, %xmm9 # INCR CNT to get Yn
2592 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2593 ENCRYPT_SINGLE_BLOCK %xmm9 # E(K, Yn)
2594
2595
2596 lea SHIFT_MASK+16(%rip), %r12
2597 sub %r13, %r12 # adjust the shuffle mask pointer to be
2598 # able to shift 16-r13 bytes (r13 is the
2599 # number of bytes in plaintext mod 16)
2600
2601_get_last_16_byte_loop\@:
2602 movb (arg3, %r11), %al
2603 movb %al, TMP1 (%rsp , %r11)
2604 add $1, %r11
2605 cmp %r13, %r11
2606 jne _get_last_16_byte_loop\@
2607
2608 vmovdqu TMP1(%rsp), %xmm1
2609
2610 sub $16, %r11
2611
2612_final_ghash_mul\@:
2613 .if \ENC_DEC == DEC
2614 vmovdqa %xmm1, %xmm2
2615 vpxor %xmm1, %xmm9, %xmm9 # Plaintext XOR E(K, Yn)
2616 vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1 # get the appropriate mask to mask out top 16-r13 bytes of xmm9
2617 vpand %xmm1, %xmm9, %xmm9 # mask out top 16-r13 bytes of xmm9
2618 vpand %xmm1, %xmm2, %xmm2
2619 vpshufb SHUF_MASK(%rip), %xmm2, %xmm2
2620 vpxor %xmm2, %xmm14, %xmm14
2621 #GHASH computation for the last <16 Byte block
2622 GHASH_MUL_AVX2 %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
2623 sub %r13, %r11
2624 add $16, %r11
2625 .else
2626 vpxor %xmm1, %xmm9, %xmm9 # Plaintext XOR E(K, Yn)
2627 vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1 # get the appropriate mask to mask out top 16-r13 bytes of xmm9
2628 vpand %xmm1, %xmm9, %xmm9 # mask out top 16-r13 bytes of xmm9
2629 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
2630 vpxor %xmm9, %xmm14, %xmm14
2631 #GHASH computation for the last <16 Byte block
2632 GHASH_MUL_AVX2 %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
2633 sub %r13, %r11
2634 add $16, %r11
2635 vpshufb SHUF_MASK(%rip), %xmm9, %xmm9 # shuffle xmm9 back to output as ciphertext
2636 .endif
2637
2638
2639 #############################
2640 # output r13 Bytes
2641 vmovq %xmm9, %rax
2642 cmp $8, %r13
2643 jle _less_than_8_bytes_left\@
2644
2645 mov %rax, (arg2 , %r11)
2646 add $8, %r11
2647 vpsrldq $8, %xmm9, %xmm9
2648 vmovq %xmm9, %rax
2649 sub $8, %r13
2650
2651_less_than_8_bytes_left\@:
2652 movb %al, (arg2 , %r11)
2653 add $1, %r11
2654 shr $8, %rax
2655 sub $1, %r13
2656 jne _less_than_8_bytes_left\@
2657 #############################
2658
2659_multiple_of_16_bytes\@:
2660 mov arg7, %r12 # r12 = aadLen (number of bytes)
2661 shl $3, %r12 # convert into number of bits
2662 vmovd %r12d, %xmm15 # len(A) in xmm15
2663
2664 shl $3, arg4 # len(C) in bits (*128)
2665 vmovq arg4, %xmm1
2666 vpslldq $8, %xmm15, %xmm15 # xmm15 = len(A)|| 0x0000000000000000
2667 vpxor %xmm1, %xmm15, %xmm15 # xmm15 = len(A)||len(C)
2668
2669 vpxor %xmm15, %xmm14, %xmm14
2670 GHASH_MUL_AVX2 %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6 # final GHASH computation
2671 vpshufb SHUF_MASK(%rip), %xmm14, %xmm14 # perform a 16Byte swap
2672
2673 mov arg5, %rax # rax = *Y0
2674 vmovdqu (%rax), %xmm9 # xmm9 = Y0
2675
2676 ENCRYPT_SINGLE_BLOCK %xmm9 # E(K, Y0)
2677
2678 vpxor %xmm14, %xmm9, %xmm9
2679
2680
2681
2682_return_T\@:
2683 mov arg8, %r10 # r10 = authTag
2684 mov arg9, %r11 # r11 = auth_tag_len
2685
2686 cmp $16, %r11
2687 je _T_16\@
2688
2689 cmp $12, %r11
2690 je _T_12\@
2691
2692_T_8\@:
2693 vmovq %xmm9, %rax
2694 mov %rax, (%r10)
2695 jmp _return_T_done\@
2696_T_12\@:
2697 vmovq %xmm9, %rax
2698 mov %rax, (%r10)
2699 vpsrldq $8, %xmm9, %xmm9
2700 vmovd %xmm9, %eax
2701 mov %eax, 8(%r10)
2702 jmp _return_T_done\@
2703
2704_T_16\@:
2705 vmovdqu %xmm9, (%r10)
2706
2707_return_T_done\@:
2708 mov %r14, %rsp
2709
2710 pop %r15
2711 pop %r14
2712 pop %r13
2713 pop %r12
2714.endm
2715
2716
2717#############################################################
2718#void aesni_gcm_precomp_avx_gen4
2719# (gcm_data *my_ctx_data,
2720# u8 *hash_subkey)# /* H, the Hash sub key input.
2721# Data starts on a 16-byte boundary. */
2722#############################################################
2723ENTRY(aesni_gcm_precomp_avx_gen4)
2724 #the number of pushes must equal STACK_OFFSET
2725 push %r12
2726 push %r13
2727 push %r14
2728 push %r15
2729
2730 mov %rsp, %r14
2731
2732
2733
2734 sub $VARIABLE_OFFSET, %rsp
2735 and $~63, %rsp # align rsp to 64 bytes
2736
2737 vmovdqu (arg2), %xmm6 # xmm6 = HashKey
2738
2739 vpshufb SHUF_MASK(%rip), %xmm6, %xmm6
2740 ############### PRECOMPUTATION of HashKey<<1 mod poly from the HashKey
2741 vmovdqa %xmm6, %xmm2
2742 vpsllq $1, %xmm6, %xmm6
2743 vpsrlq $63, %xmm2, %xmm2
2744 vmovdqa %xmm2, %xmm1
2745 vpslldq $8, %xmm2, %xmm2
2746 vpsrldq $8, %xmm1, %xmm1
2747 vpor %xmm2, %xmm6, %xmm6
2748 #reduction
2749 vpshufd $0b00100100, %xmm1, %xmm2
2750 vpcmpeqd TWOONE(%rip), %xmm2, %xmm2
2751 vpand POLY(%rip), %xmm2, %xmm2
2752 vpxor %xmm2, %xmm6, %xmm6 # xmm6 holds the HashKey<<1 mod poly
2753 #######################################################################
2754 vmovdqa %xmm6, HashKey(arg1) # store HashKey<<1 mod poly
2755
2756
2757 PRECOMPUTE_AVX2 %xmm6, %xmm0, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5
2758
2759 mov %r14, %rsp
2760
2761 pop %r15
2762 pop %r14
2763 pop %r13
2764 pop %r12
2765 ret
2766ENDPROC(aesni_gcm_precomp_avx_gen4)
2767
2768
2769###############################################################################
2770#void aesni_gcm_enc_avx_gen4(
2771# gcm_data *my_ctx_data, /* aligned to 16 Bytes */
2772# u8 *out, /* Ciphertext output. Encrypt in-place is allowed. */
2773# const u8 *in, /* Plaintext input */
2774# u64 plaintext_len, /* Length of data in Bytes for encryption. */
2775# u8 *iv, /* Pre-counter block j0: 4 byte salt
2776# (from Security Association) concatenated with 8 byte
2777# Initialisation Vector (from IPSec ESP Payload)
2778# concatenated with 0x00000001. 16-byte aligned pointer. */
2779# const u8 *aad, /* Additional Authentication Data (AAD)*/
2780# u64 aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
2781# u8 *auth_tag, /* Authenticated Tag output. */
2782# u64 auth_tag_len)# /* Authenticated Tag Length in bytes.
2783# Valid values are 16 (most likely), 12 or 8. */
2784###############################################################################
2785ENTRY(aesni_gcm_enc_avx_gen4)
2786 GCM_ENC_DEC_AVX2 ENC
2787 ret
2788ENDPROC(aesni_gcm_enc_avx_gen4)
2789
2790###############################################################################
2791#void aesni_gcm_dec_avx_gen4(
2792# gcm_data *my_ctx_data, /* aligned to 16 Bytes */
2793# u8 *out, /* Plaintext output. Decrypt in-place is allowed. */
2794# const u8 *in, /* Ciphertext input */
2795# u64 plaintext_len, /* Length of data in Bytes for encryption. */
2796# u8 *iv, /* Pre-counter block j0: 4 byte salt
2797# (from Security Association) concatenated with 8 byte
2798# Initialisation Vector (from IPSec ESP Payload)
2799# concatenated with 0x00000001. 16-byte aligned pointer. */
2800# const u8 *aad, /* Additional Authentication Data (AAD)*/
2801# u64 aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
2802# u8 *auth_tag, /* Authenticated Tag output. */
2803# u64 auth_tag_len)# /* Authenticated Tag Length in bytes.
2804# Valid values are 16 (most likely), 12 or 8. */
2805###############################################################################
2806ENTRY(aesni_gcm_dec_avx_gen4)
2807 GCM_ENC_DEC_AVX2 DEC
2808 ret
2809ENDPROC(aesni_gcm_dec_avx_gen4)
2810
2811#endif /* CONFIG_AS_AVX2 */
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 835488b745ee..948ad0e77741 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -101,6 +101,9 @@ asmlinkage void aesni_cbc_dec(struct crypto_aes_ctx *ctx, u8 *out,
101int crypto_fpu_init(void); 101int crypto_fpu_init(void);
102void crypto_fpu_exit(void); 102void crypto_fpu_exit(void);
103 103
104#define AVX_GEN2_OPTSIZE 640
105#define AVX_GEN4_OPTSIZE 4096
106
104#ifdef CONFIG_X86_64 107#ifdef CONFIG_X86_64
105asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out, 108asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out,
106 const u8 *in, unsigned int len, u8 *iv); 109 const u8 *in, unsigned int len, u8 *iv);
@@ -150,6 +153,123 @@ asmlinkage void aesni_gcm_dec(void *ctx, u8 *out,
150 u8 *hash_subkey, const u8 *aad, unsigned long aad_len, 153 u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
151 u8 *auth_tag, unsigned long auth_tag_len); 154 u8 *auth_tag, unsigned long auth_tag_len);
152 155
156
157#ifdef CONFIG_AS_AVX
158/*
159 * asmlinkage void aesni_gcm_precomp_avx_gen2()
160 * gcm_data *my_ctx_data, context data
161 * u8 *hash_subkey, the Hash sub key input. Data starts on a 16-byte boundary.
162 */
163asmlinkage void aesni_gcm_precomp_avx_gen2(void *my_ctx_data, u8 *hash_subkey);
164
165asmlinkage void aesni_gcm_enc_avx_gen2(void *ctx, u8 *out,
166 const u8 *in, unsigned long plaintext_len, u8 *iv,
167 const u8 *aad, unsigned long aad_len,
168 u8 *auth_tag, unsigned long auth_tag_len);
169
170asmlinkage void aesni_gcm_dec_avx_gen2(void *ctx, u8 *out,
171 const u8 *in, unsigned long ciphertext_len, u8 *iv,
172 const u8 *aad, unsigned long aad_len,
173 u8 *auth_tag, unsigned long auth_tag_len);
174
175static void aesni_gcm_enc_avx(void *ctx, u8 *out,
176 const u8 *in, unsigned long plaintext_len, u8 *iv,
177 u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
178 u8 *auth_tag, unsigned long auth_tag_len)
179{
180 if (plaintext_len < AVX_GEN2_OPTSIZE) {
181 aesni_gcm_enc(ctx, out, in, plaintext_len, iv, hash_subkey, aad,
182 aad_len, auth_tag, auth_tag_len);
183 } else {
184 aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
185 aesni_gcm_enc_avx_gen2(ctx, out, in, plaintext_len, iv, aad,
186 aad_len, auth_tag, auth_tag_len);
187 }
188}
189
190static void aesni_gcm_dec_avx(void *ctx, u8 *out,
191 const u8 *in, unsigned long ciphertext_len, u8 *iv,
192 u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
193 u8 *auth_tag, unsigned long auth_tag_len)
194{
195 if (ciphertext_len < AVX_GEN2_OPTSIZE) {
196 aesni_gcm_dec(ctx, out, in, ciphertext_len, iv, hash_subkey, aad,
197 aad_len, auth_tag, auth_tag_len);
198 } else {
199 aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
200 aesni_gcm_dec_avx_gen2(ctx, out, in, ciphertext_len, iv, aad,
201 aad_len, auth_tag, auth_tag_len);
202 }
203}
204#endif
205
206#ifdef CONFIG_AS_AVX2
207/*
208 * asmlinkage void aesni_gcm_precomp_avx_gen4()
209 * gcm_data *my_ctx_data, context data
210 * u8 *hash_subkey, the Hash sub key input. Data starts on a 16-byte boundary.
211 */
212asmlinkage void aesni_gcm_precomp_avx_gen4(void *my_ctx_data, u8 *hash_subkey);
213
214asmlinkage void aesni_gcm_enc_avx_gen4(void *ctx, u8 *out,
215 const u8 *in, unsigned long plaintext_len, u8 *iv,
216 const u8 *aad, unsigned long aad_len,
217 u8 *auth_tag, unsigned long auth_tag_len);
218
219asmlinkage void aesni_gcm_dec_avx_gen4(void *ctx, u8 *out,
220 const u8 *in, unsigned long ciphertext_len, u8 *iv,
221 const u8 *aad, unsigned long aad_len,
222 u8 *auth_tag, unsigned long auth_tag_len);
223
224static void aesni_gcm_enc_avx2(void *ctx, u8 *out,
225 const u8 *in, unsigned long plaintext_len, u8 *iv,
226 u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
227 u8 *auth_tag, unsigned long auth_tag_len)
228{
229 if (plaintext_len < AVX_GEN2_OPTSIZE) {
230 aesni_gcm_enc(ctx, out, in, plaintext_len, iv, hash_subkey, aad,
231 aad_len, auth_tag, auth_tag_len);
232 } else if (plaintext_len < AVX_GEN4_OPTSIZE) {
233 aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
234 aesni_gcm_enc_avx_gen2(ctx, out, in, plaintext_len, iv, aad,
235 aad_len, auth_tag, auth_tag_len);
236 } else {
237 aesni_gcm_precomp_avx_gen4(ctx, hash_subkey);
238 aesni_gcm_enc_avx_gen4(ctx, out, in, plaintext_len, iv, aad,
239 aad_len, auth_tag, auth_tag_len);
240 }
241}
242
243static void aesni_gcm_dec_avx2(void *ctx, u8 *out,
244 const u8 *in, unsigned long ciphertext_len, u8 *iv,
245 u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
246 u8 *auth_tag, unsigned long auth_tag_len)
247{
248 if (ciphertext_len < AVX_GEN2_OPTSIZE) {
249 aesni_gcm_dec(ctx, out, in, ciphertext_len, iv, hash_subkey,
250 aad, aad_len, auth_tag, auth_tag_len);
251 } else if (ciphertext_len < AVX_GEN4_OPTSIZE) {
252 aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
253 aesni_gcm_dec_avx_gen2(ctx, out, in, ciphertext_len, iv, aad,
254 aad_len, auth_tag, auth_tag_len);
255 } else {
256 aesni_gcm_precomp_avx_gen4(ctx, hash_subkey);
257 aesni_gcm_dec_avx_gen4(ctx, out, in, ciphertext_len, iv, aad,
258 aad_len, auth_tag, auth_tag_len);
259 }
260}
261#endif
262
263static void (*aesni_gcm_enc_tfm)(void *ctx, u8 *out,
264 const u8 *in, unsigned long plaintext_len, u8 *iv,
265 u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
266 u8 *auth_tag, unsigned long auth_tag_len);
267
268static void (*aesni_gcm_dec_tfm)(void *ctx, u8 *out,
269 const u8 *in, unsigned long ciphertext_len, u8 *iv,
270 u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
271 u8 *auth_tag, unsigned long auth_tag_len);
272
153static inline struct 273static inline struct
154aesni_rfc4106_gcm_ctx *aesni_rfc4106_gcm_ctx_get(struct crypto_aead *tfm) 274aesni_rfc4106_gcm_ctx *aesni_rfc4106_gcm_ctx_get(struct crypto_aead *tfm)
155{ 275{
@@ -915,7 +1035,7 @@ static int __driver_rfc4106_encrypt(struct aead_request *req)
915 dst = src; 1035 dst = src;
916 } 1036 }
917 1037
918 aesni_gcm_enc(aes_ctx, dst, src, (unsigned long)req->cryptlen, iv, 1038 aesni_gcm_enc_tfm(aes_ctx, dst, src, (unsigned long)req->cryptlen, iv,
919 ctx->hash_subkey, assoc, (unsigned long)req->assoclen, dst 1039 ctx->hash_subkey, assoc, (unsigned long)req->assoclen, dst
920 + ((unsigned long)req->cryptlen), auth_tag_len); 1040 + ((unsigned long)req->cryptlen), auth_tag_len);
921 1041
@@ -996,12 +1116,12 @@ static int __driver_rfc4106_decrypt(struct aead_request *req)
996 dst = src; 1116 dst = src;
997 } 1117 }
998 1118
999 aesni_gcm_dec(aes_ctx, dst, src, tempCipherLen, iv, 1119 aesni_gcm_dec_tfm(aes_ctx, dst, src, tempCipherLen, iv,
1000 ctx->hash_subkey, assoc, (unsigned long)req->assoclen, 1120 ctx->hash_subkey, assoc, (unsigned long)req->assoclen,
1001 authTag, auth_tag_len); 1121 authTag, auth_tag_len);
1002 1122
1003 /* Compare generated tag with passed in tag. */ 1123 /* Compare generated tag with passed in tag. */
1004 retval = memcmp(src + tempCipherLen, authTag, auth_tag_len) ? 1124 retval = crypto_memneq(src + tempCipherLen, authTag, auth_tag_len) ?
1005 -EBADMSG : 0; 1125 -EBADMSG : 0;
1006 1126
1007 if (one_entry_in_sg) { 1127 if (one_entry_in_sg) {
@@ -1353,6 +1473,27 @@ static int __init aesni_init(void)
1353 1473
1354 if (!x86_match_cpu(aesni_cpu_id)) 1474 if (!x86_match_cpu(aesni_cpu_id))
1355 return -ENODEV; 1475 return -ENODEV;
1476#ifdef CONFIG_X86_64
1477#ifdef CONFIG_AS_AVX2
1478 if (boot_cpu_has(X86_FEATURE_AVX2)) {
1479 pr_info("AVX2 version of gcm_enc/dec engaged.\n");
1480 aesni_gcm_enc_tfm = aesni_gcm_enc_avx2;
1481 aesni_gcm_dec_tfm = aesni_gcm_dec_avx2;
1482 } else
1483#endif
1484#ifdef CONFIG_AS_AVX
1485 if (boot_cpu_has(X86_FEATURE_AVX)) {
1486 pr_info("AVX version of gcm_enc/dec engaged.\n");
1487 aesni_gcm_enc_tfm = aesni_gcm_enc_avx;
1488 aesni_gcm_dec_tfm = aesni_gcm_dec_avx;
1489 } else
1490#endif
1491 {
1492 pr_info("SSE version of gcm_enc/dec engaged.\n");
1493 aesni_gcm_enc_tfm = aesni_gcm_enc;
1494 aesni_gcm_dec_tfm = aesni_gcm_dec;
1495 }
1496#endif
1356 1497
1357 err = crypto_fpu_init(); 1498 err = crypto_fpu_init();
1358 if (err) 1499 if (err)
diff --git a/arch/x86/include/asm/dmi.h b/arch/x86/include/asm/dmi.h
index fd8f9e2ca35f..535192f6bfad 100644
--- a/arch/x86/include/asm/dmi.h
+++ b/arch/x86/include/asm/dmi.h
@@ -13,7 +13,9 @@ static __always_inline __init void *dmi_alloc(unsigned len)
13} 13}
14 14
15/* Use early IO mappings for DMI because it's initialized early */ 15/* Use early IO mappings for DMI because it's initialized early */
16#define dmi_ioremap early_ioremap 16#define dmi_early_remap early_ioremap
17#define dmi_iounmap early_iounmap 17#define dmi_early_unmap early_iounmap
18#define dmi_remap ioremap
19#define dmi_unmap iounmap
18 20
19#endif /* _ASM_X86_DMI_H */ 21#endif /* _ASM_X86_DMI_H */
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index e846225265ed..7252cd339175 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -175,64 +175,7 @@ static inline void __set_fixmap(enum fixed_addresses idx,
175} 175}
176#endif 176#endif
177 177
178#define set_fixmap(idx, phys) \ 178#include <asm-generic/fixmap.h>
179 __set_fixmap(idx, phys, PAGE_KERNEL)
180
181/*
182 * Some hardware wants to get fixmapped without caching.
183 */
184#define set_fixmap_nocache(idx, phys) \
185 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
186
187#define clear_fixmap(idx) \
188 __set_fixmap(idx, 0, __pgprot(0))
189
190#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
191#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
192
193extern void __this_fixmap_does_not_exist(void);
194
195/*
196 * 'index to address' translation. If anyone tries to use the idx
197 * directly without translation, we catch the bug with a NULL-deference
198 * kernel oops. Illegal ranges of incoming indices are caught too.
199 */
200static __always_inline unsigned long fix_to_virt(const unsigned int idx)
201{
202 /*
203 * this branch gets completely eliminated after inlining,
204 * except when someone tries to use fixaddr indices in an
205 * illegal way. (such as mixing up address types or using
206 * out-of-range indices).
207 *
208 * If it doesn't get removed, the linker will complain
209 * loudly with a reasonably clear error message..
210 */
211 if (idx >= __end_of_fixed_addresses)
212 __this_fixmap_does_not_exist();
213
214 return __fix_to_virt(idx);
215}
216
217static inline unsigned long virt_to_fix(const unsigned long vaddr)
218{
219 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
220 return __virt_to_fix(vaddr);
221}
222
223/* Return an pointer with offset calculated */
224static __always_inline unsigned long
225__set_fixmap_offset(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags)
226{
227 __set_fixmap(idx, phys, flags);
228 return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1));
229}
230
231#define set_fixmap_offset(idx, phys) \
232 __set_fixmap_offset(idx, phys, PAGE_KERNEL)
233
234#define set_fixmap_offset_nocache(idx, phys) \
235 __set_fixmap_offset(idx, phys, PAGE_KERNEL_NOCACHE)
236 179
237#endif /* !__ASSEMBLY__ */ 180#endif /* !__ASSEMBLY__ */
238#endif /* _ASM_X86_FIXMAP_H */ 181#endif /* _ASM_X86_FIXMAP_H */
diff --git a/arch/x86/include/asm/hash.h b/arch/x86/include/asm/hash.h
new file mode 100644
index 000000000000..e8c58f88b1d4
--- /dev/null
+++ b/arch/x86/include/asm/hash.h
@@ -0,0 +1,7 @@
1#ifndef _ASM_X86_HASH_H
2#define _ASM_X86_HASH_H
3
4struct fast_hash_ops;
5extern void setup_arch_fast_hash(struct fast_hash_ops *ops);
6
7#endif /* _ASM_X86_HASH_H */
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index ae5d7830855c..fdf83afbb7d9 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -605,6 +605,7 @@ struct kvm_arch {
605 /* fields used by HYPER-V emulation */ 605 /* fields used by HYPER-V emulation */
606 u64 hv_guest_os_id; 606 u64 hv_guest_os_id;
607 u64 hv_hypercall; 607 u64 hv_hypercall;
608 u64 hv_tsc_page;
608 609
609 #ifdef CONFIG_KVM_MMU_AUDIT 610 #ifdef CONFIG_KVM_MMU_AUDIT
610 int audit_point; 611 int audit_point;
@@ -699,6 +700,8 @@ struct kvm_x86_ops {
699 void (*set_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt); 700 void (*set_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
700 void (*get_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt); 701 void (*get_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
701 void (*set_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt); 702 void (*set_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
703 u64 (*get_dr6)(struct kvm_vcpu *vcpu);
704 void (*set_dr6)(struct kvm_vcpu *vcpu, unsigned long value);
702 void (*set_dr7)(struct kvm_vcpu *vcpu, unsigned long value); 705 void (*set_dr7)(struct kvm_vcpu *vcpu, unsigned long value);
703 void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg); 706 void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg);
704 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); 707 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index 1df115909758..c7678e43465b 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -85,28 +85,9 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
85 return ret; 85 return ret;
86} 86}
87 87
88static inline uint32_t kvm_cpuid_base(void)
89{
90 if (boot_cpu_data.cpuid_level < 0)
91 return 0; /* So we don't blow up on old processors */
92
93 if (cpu_has_hypervisor)
94 return hypervisor_cpuid_base("KVMKVMKVM\0\0\0", 0);
95
96 return 0;
97}
98
99static inline bool kvm_para_available(void)
100{
101 return kvm_cpuid_base() != 0;
102}
103
104static inline unsigned int kvm_arch_para_features(void)
105{
106 return cpuid_eax(KVM_CPUID_FEATURES);
107}
108
109#ifdef CONFIG_KVM_GUEST 88#ifdef CONFIG_KVM_GUEST
89bool kvm_para_available(void);
90unsigned int kvm_arch_para_features(void);
110void __init kvm_guest_init(void); 91void __init kvm_guest_init(void);
111void kvm_async_pf_task_wait(u32 token); 92void kvm_async_pf_task_wait(u32 token);
112void kvm_async_pf_task_wake(u32 token); 93void kvm_async_pf_task_wake(u32 token);
@@ -126,6 +107,16 @@ static inline void kvm_spinlock_init(void)
126#define kvm_async_pf_task_wait(T) do {} while(0) 107#define kvm_async_pf_task_wait(T) do {} while(0)
127#define kvm_async_pf_task_wake(T) do {} while(0) 108#define kvm_async_pf_task_wake(T) do {} while(0)
128 109
110static inline bool kvm_para_available(void)
111{
112 return 0;
113}
114
115static inline unsigned int kvm_arch_para_features(void)
116{
117 return 0;
118}
119
129static inline u32 kvm_read_and_reset_pf_reason(void) 120static inline u32 kvm_read_and_reset_pf_reason(void)
130{ 121{
131 return 0; 122 return 0;
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 401f350ef71b..cd6e1610e29e 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -781,9 +781,9 @@ static __always_inline void __ticket_unlock_kick(struct arch_spinlock *lock,
781 */ 781 */
782#define PV_CALLEE_SAVE_REGS_THUNK(func) \ 782#define PV_CALLEE_SAVE_REGS_THUNK(func) \
783 extern typeof(func) __raw_callee_save_##func; \ 783 extern typeof(func) __raw_callee_save_##func; \
784 static void *__##func##__ __used = func; \
785 \ 784 \
786 asm(".pushsection .text;" \ 785 asm(".pushsection .text;" \
786 ".globl __raw_callee_save_" #func " ; " \
787 "__raw_callee_save_" #func ": " \ 787 "__raw_callee_save_" #func ": " \
788 PV_SAVE_ALL_CALLER_REGS \ 788 PV_SAVE_ALL_CALLER_REGS \
789 "call " #func ";" \ 789 "call " #func ";" \
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index aab8f671b523..7549b8b369e4 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -388,10 +388,11 @@ extern struct pv_lock_ops pv_lock_ops;
388 _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]") 388 _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]")
389 389
390/* Simple instruction patching code. */ 390/* Simple instruction patching code. */
391#define DEF_NATIVE(ops, name, code) \ 391#define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t"
392 extern const char start_##ops##_##name[] __visible, \ 392
393 end_##ops##_##name[] __visible; \ 393#define DEF_NATIVE(ops, name, code) \
394 asm("start_" #ops "_" #name ": " code "; end_" #ops "_" #name ":") 394 __visible extern const char start_##ops##_##name[], end_##ops##_##name[]; \
395 asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name))
395 396
396unsigned paravirt_patch_nop(void); 397unsigned paravirt_patch_nop(void);
397unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len); 398unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len);
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 947b5c417e83..1ac6114c9ea5 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -104,7 +104,7 @@ extern void pci_iommu_alloc(void);
104struct msi_desc; 104struct msi_desc;
105int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 105int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
106void native_teardown_msi_irq(unsigned int irq); 106void native_teardown_msi_irq(unsigned int irq);
107void native_restore_msi_irqs(struct pci_dev *dev, int irq); 107void native_restore_msi_irqs(struct pci_dev *dev);
108int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, 108int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
109 unsigned int irq_base, unsigned int irq_offset); 109 unsigned int irq_base, unsigned int irq_offset);
110#else 110#else
@@ -125,7 +125,6 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
125 125
126/* generic pci stuff */ 126/* generic pci stuff */
127#include <asm-generic/pci.h> 127#include <asm-generic/pci.h>
128#define PCIBIOS_MAX_MEM_32 0xffffffff
129 128
130#ifdef CONFIG_NUMA 129#ifdef CONFIG_NUMA
131/* Returns the node based on pci bus */ 130/* Returns the node based on pci bus */
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index a83aa44bb1fb..1aa9ccd43223 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -121,7 +121,8 @@
121 121
122/* Set of bits not changed in pte_modify */ 122/* Set of bits not changed in pte_modify */
123#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ 123#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
124 _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY) 124 _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \
125 _PAGE_SOFT_DIRTY)
125#define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE) 126#define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE)
126 127
127#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT) 128#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT)
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 3ba3de457d05..e1940c06ed02 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -163,9 +163,11 @@ struct thread_info {
163 */ 163 */
164#ifndef __ASSEMBLY__ 164#ifndef __ASSEMBLY__
165 165
166 166#define current_stack_pointer ({ \
167/* how to get the current stack pointer from C */ 167 unsigned long sp; \
168register unsigned long current_stack_pointer asm("esp") __used; 168 asm("mov %%esp,%0" : "=g" (sp)); \
169 sp; \
170})
169 171
170/* how to get the thread information struct from C */ 172/* how to get the thread information struct from C */
171static inline struct thread_info *current_thread_info(void) 173static inline struct thread_info *current_thread_info(void)
diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h
index 6b964a0b86d1..062921ef34e9 100644
--- a/arch/x86/include/asm/uv/uv.h
+++ b/arch/x86/include/asm/uv/uv.h
@@ -12,7 +12,6 @@ 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);
16extern void uv_system_init(void); 15extern void uv_system_init(void);
17extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, 16extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
18 struct mm_struct *mm, 17 struct mm_struct *mm,
@@ -26,7 +25,6 @@ static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
26static inline int is_uv_system(void) { return 0; } 25static inline int is_uv_system(void) { return 0; }
27static inline void uv_cpu_init(void) { } 26static inline void uv_cpu_init(void) { }
28static inline void uv_system_init(void) { } 27static inline void uv_system_init(void) { }
29static inline void uv_register_nmi_notifier(void) { }
30static inline const struct cpumask * 28static inline const struct cpumask *
31uv_flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm, 29uv_flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm,
32 unsigned long start, unsigned long end, unsigned int cpu) 30 unsigned long start, unsigned long end, unsigned int cpu)
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 966502d4682e..2067264fb7f5 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -100,6 +100,7 @@
100 100
101#define VMX_MISC_PREEMPTION_TIMER_RATE_MASK 0x0000001f 101#define VMX_MISC_PREEMPTION_TIMER_RATE_MASK 0x0000001f
102#define VMX_MISC_SAVE_EFER_LMA 0x00000020 102#define VMX_MISC_SAVE_EFER_LMA 0x00000020
103#define VMX_MISC_ACTIVITY_HLT 0x00000040
103 104
104/* VMCS Encodings */ 105/* VMCS Encodings */
105enum vmcs_field { 106enum vmcs_field {
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index 0f1be11e43d2..e45e4da96bf1 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -181,7 +181,7 @@ struct x86_msi_ops {
181 u8 hpet_id); 181 u8 hpet_id);
182 void (*teardown_msi_irq)(unsigned int irq); 182 void (*teardown_msi_irq)(unsigned int irq);
183 void (*teardown_msi_irqs)(struct pci_dev *dev); 183 void (*teardown_msi_irqs)(struct pci_dev *dev);
184 void (*restore_msi_irqs)(struct pci_dev *dev, int irq); 184 void (*restore_msi_irqs)(struct pci_dev *dev);
185 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); 186 u32 (*msi_mask_irq)(struct msi_desc *desc, u32 mask, u32 flag);
187 u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag); 187 u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag);
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index b913915e8e63..787e1bb5aafc 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -52,7 +52,8 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s,
52extern int m2p_add_override(unsigned long mfn, struct page *page, 52extern int m2p_add_override(unsigned long mfn, struct page *page,
53 struct gnttab_map_grant_ref *kmap_op); 53 struct gnttab_map_grant_ref *kmap_op);
54extern int m2p_remove_override(struct page *page, 54extern int m2p_remove_override(struct page *page,
55 struct gnttab_map_grant_ref *kmap_op); 55 struct gnttab_map_grant_ref *kmap_op,
56 unsigned long mfn);
56extern struct page *m2p_find_override(unsigned long mfn); 57extern struct page *m2p_find_override(unsigned long mfn);
57extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); 58extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
58 59
@@ -121,7 +122,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
121 pfn = m2p_find_override_pfn(mfn, ~0); 122 pfn = m2p_find_override_pfn(mfn, ~0);
122 } 123 }
123 124
124 /* 125 /*
125 * pfn is ~0 if there are no entries in the m2p for mfn or if the 126 * pfn is ~0 if there are no entries in the m2p for mfn or if the
126 * entry doesn't map back to the mfn and m2p_override doesn't have a 127 * entry doesn't map back to the mfn and m2p_override doesn't have a
127 * valid entry for it. 128 * valid entry for it.
@@ -167,7 +168,12 @@ static inline xpaddr_t machine_to_phys(xmaddr_t machine)
167 */ 168 */
168static inline unsigned long mfn_to_local_pfn(unsigned long mfn) 169static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
169{ 170{
170 unsigned long pfn = mfn_to_pfn(mfn); 171 unsigned long pfn;
172
173 if (xen_feature(XENFEAT_auto_translated_physmap))
174 return mfn;
175
176 pfn = mfn_to_pfn(mfn);
171 if (get_phys_to_machine(pfn) != mfn) 177 if (get_phys_to_machine(pfn) != mfn)
172 return -1; /* force !pfn_valid() */ 178 return -1; /* force !pfn_valid() */
173 return pfn; 179 return pfn;
@@ -222,5 +228,6 @@ void make_lowmem_page_readonly(void *vaddr);
222void make_lowmem_page_readwrite(void *vaddr); 228void make_lowmem_page_readwrite(void *vaddr);
223 229
224#define xen_remap(cookie, size) ioremap((cookie), (size)); 230#define xen_remap(cookie, size) ioremap((cookie), (size));
231#define xen_unmap(cookie) iounmap((cookie))
225 232
226#endif /* _ASM_X86_XEN_PAGE_H */ 233#endif /* _ASM_X86_XEN_PAGE_H */
diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h
index b8f1c0176cbc..462efe746d77 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -28,6 +28,9 @@
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 30
31/* A partition's reference time stamp counter (TSC) page */
32#define HV_X64_MSR_REFERENCE_TSC 0x40000021
33
31/* 34/*
32 * There is a single feature flag that signifies the presence of the MSR 35 * 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 36 * that can be used to retrieve both the local APIC Timer frequency as
@@ -198,6 +201,9 @@
198#define HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_MASK \ 201#define HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_MASK \
199 (~((1ull << HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT) - 1)) 202 (~((1ull << HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT) - 1))
200 203
204#define HV_X64_MSR_TSC_REFERENCE_ENABLE 0x00000001
205#define HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT 12
206
201#define HV_PROCESSOR_POWER_STATE_C0 0 207#define HV_PROCESSOR_POWER_STATE_C0 0
202#define HV_PROCESSOR_POWER_STATE_C1 1 208#define HV_PROCESSOR_POWER_STATE_C1 1
203#define HV_PROCESSOR_POWER_STATE_C2 2 209#define HV_PROCESSOR_POWER_STATE_C2 2
@@ -210,4 +216,11 @@
210#define HV_STATUS_INVALID_ALIGNMENT 4 216#define HV_STATUS_INVALID_ALIGNMENT 4
211#define HV_STATUS_INSUFFICIENT_BUFFERS 19 217#define HV_STATUS_INSUFFICIENT_BUFFERS 19
212 218
219typedef struct _HV_REFERENCE_TSC_PAGE {
220 __u32 tsc_sequence;
221 __u32 res1;
222 __u64 tsc_scale;
223 __s64 tsc_offset;
224} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE;
225
213#endif 226#endif
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index 59cea185ad1d..c19fc60ff062 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -528,6 +528,7 @@
528#define MSR_IA32_VMX_TRUE_PROCBASED_CTLS 0x0000048e 528#define MSR_IA32_VMX_TRUE_PROCBASED_CTLS 0x0000048e
529#define MSR_IA32_VMX_TRUE_EXIT_CTLS 0x0000048f 529#define MSR_IA32_VMX_TRUE_EXIT_CTLS 0x0000048f
530#define MSR_IA32_VMX_TRUE_ENTRY_CTLS 0x00000490 530#define MSR_IA32_VMX_TRUE_ENTRY_CTLS 0x00000490
531#define MSR_IA32_VMX_VMFUNC 0x00000491
531 532
532/* VMX_BASIC bits and bitmasks */ 533/* VMX_BASIC bits and bitmasks */
533#define VMX_BASIC_VMCS_SIZE_SHIFT 32 534#define VMX_BASIC_VMCS_SIZE_SHIFT 32
diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h
index ee50c801f7b7..cc2d6a3aeae7 100644
--- a/arch/x86/include/uapi/asm/sembuf.h
+++ b/arch/x86/include/uapi/asm/sembuf.h
@@ -13,12 +13,12 @@
13struct semid64_ds { 13struct semid64_ds {
14 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 14 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
15 __kernel_time_t sem_otime; /* last semop time */ 15 __kernel_time_t sem_otime; /* last semop time */
16 unsigned long __unused1; 16 __kernel_ulong_t __unused1;
17 __kernel_time_t sem_ctime; /* last change time */ 17 __kernel_time_t sem_ctime; /* last change time */
18 unsigned long __unused2; 18 __kernel_ulong_t __unused2;
19 unsigned long sem_nsems; /* no. of semaphores in array */ 19 __kernel_ulong_t sem_nsems; /* no. of semaphores in array */
20 unsigned long __unused3; 20 __kernel_ulong_t __unused3;
21 unsigned long __unused4; 21 __kernel_ulong_t __unused4;
22}; 22};
23 23
24#endif /* _ASM_X86_SEMBUF_H */ 24#endif /* _ASM_X86_SEMBUF_H */
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 6c0b43bd024b..1dac94265b59 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -46,7 +46,6 @@
46 46
47#include "sleep.h" /* To include x86_acpi_suspend_lowlevel */ 47#include "sleep.h" /* To include x86_acpi_suspend_lowlevel */
48static int __initdata acpi_force = 0; 48static int __initdata acpi_force = 0;
49u32 acpi_rsdt_forced;
50int acpi_disabled; 49int acpi_disabled;
51EXPORT_SYMBOL(acpi_disabled); 50EXPORT_SYMBOL(acpi_disabled);
52 51
@@ -1034,9 +1033,7 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger,
1034 1033
1035 if (!acpi_ioapic) 1034 if (!acpi_ioapic)
1036 return 0; 1035 return 0;
1037 if (!dev) 1036 if (!dev || !dev_is_pci(dev))
1038 return 0;
1039 if (dev->bus != &pci_bus_type)
1040 return 0; 1037 return 0;
1041 1038
1042 pdev = to_pci_dev(dev); 1039 pdev = to_pci_dev(dev);
@@ -1564,7 +1561,7 @@ static int __init parse_acpi(char *arg)
1564 } 1561 }
1565 /* acpi=rsdt use RSDT instead of XSDT */ 1562 /* acpi=rsdt use RSDT instead of XSDT */
1566 else if (strcmp(arg, "rsdt") == 0) { 1563 else if (strcmp(arg, "rsdt") == 0) {
1567 acpi_rsdt_forced = 1; 1564 acpi_gbl_do_not_use_xsdt = TRUE;
1568 } 1565 }
1569 /* "acpi=noirq" disables ACPI interrupt routing */ 1566 /* "acpi=noirq" disables ACPI interrupt routing */
1570 else if (strcmp(arg, "noirq") == 0) { 1567 else if (strcmp(arg, "noirq") == 0) {
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 5d5b9eb2b7a4..2c621a6b901a 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -20,9 +20,7 @@
20#include <asm/apic.h> 20#include <asm/apic.h>
21#include <asm/ipi.h> 21#include <asm/ipi.h>
22 22
23#ifdef CONFIG_ACPI 23#include <linux/acpi.h>
24#include <acpi/acpi_bus.h>
25#endif
26 24
27static struct apic apic_physflat; 25static struct apic apic_physflat;
28static struct apic apic_flat; 26static struct apic apic_flat;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index a43f068ebec1..6ad4658de705 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -37,9 +37,6 @@
37#include <linux/kthread.h> 37#include <linux/kthread.h>
38#include <linux/jiffies.h> /* time_after() */ 38#include <linux/jiffies.h> /* time_after() */
39#include <linux/slab.h> 39#include <linux/slab.h>
40#ifdef CONFIG_ACPI
41#include <acpi/acpi_bus.h>
42#endif
43#include <linux/bootmem.h> 40#include <linux/bootmem.h>
44#include <linux/dmar.h> 41#include <linux/dmar.h>
45#include <linux/hpet.h> 42#include <linux/hpet.h>
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index ad0dc0428baf..d263b1307de1 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -980,7 +980,6 @@ void __init uv_system_init(void)
980 uv_nmi_setup(); 980 uv_nmi_setup();
981 uv_cpu_init(); 981 uv_cpu_init();
982 uv_scir_register_cpu_notifier(); 982 uv_scir_register_cpu_notifier();
983 uv_register_nmi_notifier();
984 proc_mkdir("sgi_uv", NULL); 983 proc_mkdir("sgi_uv", NULL);
985 984
986 /* register Legacy VGA I/O redirection handler */ 985 /* register Legacy VGA I/O redirection handler */
diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c
index e2dbcb7dabdd..83a7995625a6 100644
--- a/arch/x86/kernel/check.c
+++ b/arch/x86/kernel/check.c
@@ -91,7 +91,7 @@ void __init setup_bios_corruption_check(void)
91 91
92 corruption_check_size = round_up(corruption_check_size, PAGE_SIZE); 92 corruption_check_size = round_up(corruption_check_size, PAGE_SIZE);
93 93
94 for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL) { 94 for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL) {
95 start = clamp_t(phys_addr_t, round_up(start, PAGE_SIZE), 95 start = clamp_t(phys_addr_t, round_up(start, PAGE_SIZE),
96 PAGE_SIZE, corruption_check_size); 96 PAGE_SIZE, corruption_check_size);
97 end = clamp_t(phys_addr_t, round_down(end, PAGE_SIZE), 97 end = clamp_t(phys_addr_t, round_down(end, PAGE_SIZE),
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 4a6ff747aaad..8fffd845e22b 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -433,7 +433,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
433 if (c->x86 >= 0x15) 433 if (c->x86 >= 0x15)
434 snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86); 434 snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86);
435 435
436 if (request_firmware(&fw, (const char *)fw_name, device)) { 436 if (request_firmware_direct(&fw, (const char *)fw_name, device)) {
437 pr_debug("failed to load file %s\n", fw_name); 437 pr_debug("failed to load file %s\n", fw_name);
438 goto out; 438 goto out;
439 } 439 }
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 5fb2cebf556b..a276fa75d9b5 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -278,7 +278,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device,
278 sprintf(name, "intel-ucode/%02x-%02x-%02x", 278 sprintf(name, "intel-ucode/%02x-%02x-%02x",
279 c->x86, c->x86_model, c->x86_mask); 279 c->x86, c->x86_model, c->x86_mask);
280 280
281 if (request_firmware(&firmware, name, device)) { 281 if (request_firmware_direct(&firmware, name, device)) {
282 pr_debug("data file %s load failed\n", name); 282 pr_debug("data file %s load failed\n", name);
283 return UCODE_NFOUND; 283 return UCODE_NFOUND;
284 } 284 }
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 174da5fc5a7b..988c00a1f60d 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1120,7 +1120,7 @@ void __init memblock_find_dma_reserve(void)
1120 nr_pages += end_pfn - start_pfn; 1120 nr_pages += end_pfn - start_pfn;
1121 } 1121 }
1122 1122
1123 for_each_free_mem_range(u, MAX_NUMNODES, &start, &end, NULL) { 1123 for_each_free_mem_range(u, NUMA_NO_NODE, &start, &end, NULL) {
1124 start_pfn = min_t(unsigned long, PFN_UP(start), MAX_DMA_PFN); 1124 start_pfn = min_t(unsigned long, PFN_UP(start), MAX_DMA_PFN);
1125 end_pfn = min_t(unsigned long, PFN_DOWN(end), MAX_DMA_PFN); 1125 end_pfn = min_t(unsigned long, PFN_DOWN(end), MAX_DMA_PFN);
1126 if (start_pfn < end_pfn) 1126 if (start_pfn < end_pfn)
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 6dd802c6d780..713f1b3bad52 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -500,6 +500,38 @@ void __init kvm_guest_init(void)
500#endif 500#endif
501} 501}
502 502
503static noinline uint32_t __kvm_cpuid_base(void)
504{
505 if (boot_cpu_data.cpuid_level < 0)
506 return 0; /* So we don't blow up on old processors */
507
508 if (cpu_has_hypervisor)
509 return hypervisor_cpuid_base("KVMKVMKVM\0\0\0", 0);
510
511 return 0;
512}
513
514static inline uint32_t kvm_cpuid_base(void)
515{
516 static int kvm_cpuid_base = -1;
517
518 if (kvm_cpuid_base == -1)
519 kvm_cpuid_base = __kvm_cpuid_base();
520
521 return kvm_cpuid_base;
522}
523
524bool kvm_para_available(void)
525{
526 return kvm_cpuid_base() != 0;
527}
528EXPORT_SYMBOL_GPL(kvm_para_available);
529
530unsigned int kvm_arch_para_features(void)
531{
532 return cpuid_eax(kvm_cpuid_base() | KVM_CPUID_FEATURES);
533}
534
503static uint32_t __init kvm_detect(void) 535static uint32_t __init kvm_detect(void)
504{ 536{
505 return kvm_cpuid_base(); 537 return kvm_cpuid_base();
@@ -673,7 +705,7 @@ static cpumask_t waiting_cpus;
673/* Track spinlock on which a cpu is waiting */ 705/* Track spinlock on which a cpu is waiting */
674static DEFINE_PER_CPU(struct kvm_lock_waiting, klock_waiting); 706static DEFINE_PER_CPU(struct kvm_lock_waiting, klock_waiting);
675 707
676static void kvm_lock_spinning(struct arch_spinlock *lock, __ticket_t want) 708__visible void kvm_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
677{ 709{
678 struct kvm_lock_waiting *w; 710 struct kvm_lock_waiting *w;
679 int cpu; 711 int cpu;
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a3acbac2ee72..19e5adb49a27 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -180,7 +180,7 @@ static void cyc2ns_write_end(int cpu, struct cyc2ns_data *data)
180 180
181static void cyc2ns_data_init(struct cyc2ns_data *data) 181static void cyc2ns_data_init(struct cyc2ns_data *data)
182{ 182{
183 data->cyc2ns_mul = 1U << CYC2NS_SCALE_FACTOR; 183 data->cyc2ns_mul = 0;
184 data->cyc2ns_shift = CYC2NS_SCALE_FACTOR; 184 data->cyc2ns_shift = CYC2NS_SCALE_FACTOR;
185 data->cyc2ns_offset = 0; 185 data->cyc2ns_offset = 0;
186 data->__count = 0; 186 data->__count = 0;
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 992f890283e9..f6584a90aba3 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -33,7 +33,7 @@
33 * and vice versa. 33 * and vice versa.
34 */ 34 */
35 35
36static unsigned long vsmp_save_fl(void) 36asmlinkage unsigned long vsmp_save_fl(void)
37{ 37{
38 unsigned long flags = native_save_fl(); 38 unsigned long flags = native_save_fl();
39 39
@@ -43,7 +43,7 @@ static unsigned long vsmp_save_fl(void)
43} 43}
44PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl); 44PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
45 45
46static void vsmp_restore_fl(unsigned long flags) 46__visible void vsmp_restore_fl(unsigned long flags)
47{ 47{
48 if (flags & X86_EFLAGS_IF) 48 if (flags & X86_EFLAGS_IF)
49 flags &= ~X86_EFLAGS_AC; 49 flags &= ~X86_EFLAGS_AC;
@@ -53,7 +53,7 @@ static void vsmp_restore_fl(unsigned long flags)
53} 53}
54PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl); 54PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
55 55
56static void vsmp_irq_disable(void) 56asmlinkage void vsmp_irq_disable(void)
57{ 57{
58 unsigned long flags = native_save_fl(); 58 unsigned long flags = native_save_fl();
59 59
@@ -61,7 +61,7 @@ static void vsmp_irq_disable(void)
61} 61}
62PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable); 62PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
63 63
64static void vsmp_irq_enable(void) 64asmlinkage void vsmp_irq_enable(void)
65{ 65{
66 unsigned long flags = native_save_fl(); 66 unsigned long flags = native_save_fl();
67 67
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 021783b1f46a..e48b674639cc 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -136,9 +136,9 @@ void arch_teardown_msi_irq(unsigned int irq)
136 x86_msi.teardown_msi_irq(irq); 136 x86_msi.teardown_msi_irq(irq);
137} 137}
138 138
139void arch_restore_msi_irqs(struct pci_dev *dev, int irq) 139void arch_restore_msi_irqs(struct pci_dev *dev)
140{ 140{
141 x86_msi.restore_msi_irqs(dev, irq); 141 x86_msi.restore_msi_irqs(dev);
142} 142}
143u32 arch_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) 143u32 arch_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag)
144{ 144{
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index b89c5db2b832..287e4c85fff9 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -80,7 +80,7 @@ config KVM_MMU_AUDIT
80 depends on KVM && TRACEPOINTS 80 depends on KVM && TRACEPOINTS
81 ---help--- 81 ---help---
82 This option adds a R/W kVM module parameter 'mmu_audit', which allows 82 This option adds a R/W kVM module parameter 'mmu_audit', which allows
83 audit KVM MMU at runtime. 83 auditing of KVM MMU events at runtime.
84 84
85config KVM_DEVICE_ASSIGNMENT 85config KVM_DEVICE_ASSIGNMENT
86 bool "KVM legacy PCI device assignment support" 86 bool "KVM legacy PCI device assignment support"
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index f1e4895174b2..a2a1bb7ed8c1 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -72,4 +72,12 @@ static inline bool guest_cpuid_has_pcid(struct kvm_vcpu *vcpu)
72 return best && (best->ecx & bit(X86_FEATURE_PCID)); 72 return best && (best->ecx & bit(X86_FEATURE_PCID));
73} 73}
74 74
75static inline bool guest_cpuid_has_x2apic(struct kvm_vcpu *vcpu)
76{
77 struct kvm_cpuid_entry2 *best;
78
79 best = kvm_find_cpuid_entry(vcpu, 1, 0);
80 return best && (best->ecx & bit(X86_FEATURE_X2APIC));
81}
82
75#endif 83#endif
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 412a5aa0ef94..518d86471b76 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -37,6 +37,7 @@
37 37
38#include "irq.h" 38#include "irq.h"
39#include "i8254.h" 39#include "i8254.h"
40#include "x86.h"
40 41
41#ifndef CONFIG_X86_64 42#ifndef CONFIG_X86_64
42#define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) 43#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
@@ -349,6 +350,23 @@ static void create_pit_timer(struct kvm *kvm, u32 val, int is_period)
349 atomic_set(&ps->pending, 0); 350 atomic_set(&ps->pending, 0);
350 ps->irq_ack = 1; 351 ps->irq_ack = 1;
351 352
353 /*
354 * Do not allow the guest to program periodic timers with small
355 * interval, since the hrtimers are not throttled by the host
356 * scheduler.
357 */
358 if (ps->is_periodic) {
359 s64 min_period = min_timer_period_us * 1000LL;
360
361 if (ps->period < min_period) {
362 pr_info_ratelimited(
363 "kvm: requested %lld ns "
364 "i8254 timer period limited to %lld ns\n",
365 ps->period, min_period);
366 ps->period = min_period;
367 }
368 }
369
352 hrtimer_start(&ps->timer, ktime_add_ns(ktime_get(), interval), 370 hrtimer_start(&ps->timer, ktime_add_ns(ktime_get(), interval),
353 HRTIMER_MODE_ABS); 371 HRTIMER_MODE_ABS);
354} 372}
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 775702f649ca..9736529ade08 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -71,9 +71,6 @@
71#define VEC_POS(v) ((v) & (32 - 1)) 71#define VEC_POS(v) ((v) & (32 - 1))
72#define REG_POS(v) (((v) >> 5) << 4) 72#define REG_POS(v) (((v) >> 5) << 4)
73 73
74static unsigned int min_timer_period_us = 500;
75module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
76
77static inline void apic_set_reg(struct kvm_lapic *apic, int reg_off, u32 val) 74static inline void apic_set_reg(struct kvm_lapic *apic, int reg_off, u32 val)
78{ 75{
79 *((u32 *) (apic->regs + reg_off)) = val; 76 *((u32 *) (apic->regs + reg_off)) = val;
@@ -435,7 +432,7 @@ static bool pv_eoi_get_pending(struct kvm_vcpu *vcpu)
435 u8 val; 432 u8 val;
436 if (pv_eoi_get_user(vcpu, &val) < 0) 433 if (pv_eoi_get_user(vcpu, &val) < 0)
437 apic_debug("Can't read EOI MSR value: 0x%llx\n", 434 apic_debug("Can't read EOI MSR value: 0x%llx\n",
438 (unsigned long long)vcpi->arch.pv_eoi.msr_val); 435 (unsigned long long)vcpu->arch.pv_eoi.msr_val);
439 return val & 0x1; 436 return val & 0x1;
440} 437}
441 438
@@ -443,7 +440,7 @@ static void pv_eoi_set_pending(struct kvm_vcpu *vcpu)
443{ 440{
444 if (pv_eoi_put_user(vcpu, KVM_PV_EOI_ENABLED) < 0) { 441 if (pv_eoi_put_user(vcpu, KVM_PV_EOI_ENABLED) < 0) {
445 apic_debug("Can't set EOI MSR value: 0x%llx\n", 442 apic_debug("Can't set EOI MSR value: 0x%llx\n",
446 (unsigned long long)vcpi->arch.pv_eoi.msr_val); 443 (unsigned long long)vcpu->arch.pv_eoi.msr_val);
447 return; 444 return;
448 } 445 }
449 __set_bit(KVM_APIC_PV_EOI_PENDING, &vcpu->arch.apic_attention); 446 __set_bit(KVM_APIC_PV_EOI_PENDING, &vcpu->arch.apic_attention);
@@ -453,7 +450,7 @@ static void pv_eoi_clr_pending(struct kvm_vcpu *vcpu)
453{ 450{
454 if (pv_eoi_put_user(vcpu, KVM_PV_EOI_DISABLED) < 0) { 451 if (pv_eoi_put_user(vcpu, KVM_PV_EOI_DISABLED) < 0) {
455 apic_debug("Can't clear EOI MSR value: 0x%llx\n", 452 apic_debug("Can't clear EOI MSR value: 0x%llx\n",
456 (unsigned long long)vcpi->arch.pv_eoi.msr_val); 453 (unsigned long long)vcpu->arch.pv_eoi.msr_val);
457 return; 454 return;
458 } 455 }
459 __clear_bit(KVM_APIC_PV_EOI_PENDING, &vcpu->arch.apic_attention); 456 __clear_bit(KVM_APIC_PV_EOI_PENDING, &vcpu->arch.apic_attention);
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h
index c8b0d0d2da5c..6a11845fd8b9 100644
--- a/arch/x86/kvm/lapic.h
+++ b/arch/x86/kvm/lapic.h
@@ -65,7 +65,7 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
65 struct kvm_lapic_irq *irq, int *r, unsigned long *dest_map); 65 struct kvm_lapic_irq *irq, int *r, unsigned long *dest_map);
66 66
67u64 kvm_get_apic_base(struct kvm_vcpu *vcpu); 67u64 kvm_get_apic_base(struct kvm_vcpu *vcpu);
68void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data); 68int kvm_set_apic_base(struct kvm_vcpu *vcpu, struct msr_data *msr_info);
69void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, 69void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
70 struct kvm_lapic_state *s); 70 struct kvm_lapic_state *s);
71int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); 71int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 40772ef0f2b1..e50425d0f5f7 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2659,6 +2659,9 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
2659 int emulate = 0; 2659 int emulate = 0;
2660 gfn_t pseudo_gfn; 2660 gfn_t pseudo_gfn;
2661 2661
2662 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
2663 return 0;
2664
2662 for_each_shadow_entry(vcpu, (u64)gfn << PAGE_SHIFT, iterator) { 2665 for_each_shadow_entry(vcpu, (u64)gfn << PAGE_SHIFT, iterator) {
2663 if (iterator.level == level) { 2666 if (iterator.level == level) {
2664 mmu_set_spte(vcpu, iterator.sptep, ACC_ALL, 2667 mmu_set_spte(vcpu, iterator.sptep, ACC_ALL,
@@ -2829,6 +2832,9 @@ static bool fast_page_fault(struct kvm_vcpu *vcpu, gva_t gva, int level,
2829 bool ret = false; 2832 bool ret = false;
2830 u64 spte = 0ull; 2833 u64 spte = 0ull;
2831 2834
2835 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
2836 return false;
2837
2832 if (!page_fault_can_be_fast(error_code)) 2838 if (!page_fault_can_be_fast(error_code))
2833 return false; 2839 return false;
2834 2840
@@ -3224,6 +3230,9 @@ static u64 walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr)
3224 struct kvm_shadow_walk_iterator iterator; 3230 struct kvm_shadow_walk_iterator iterator;
3225 u64 spte = 0ull; 3231 u64 spte = 0ull;
3226 3232
3233 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
3234 return spte;
3235
3227 walk_shadow_page_lockless_begin(vcpu); 3236 walk_shadow_page_lockless_begin(vcpu);
3228 for_each_shadow_entry_lockless(vcpu, addr, iterator, spte) 3237 for_each_shadow_entry_lockless(vcpu, addr, iterator, spte)
3229 if (!is_shadow_present_pte(spte)) 3238 if (!is_shadow_present_pte(spte))
@@ -4510,6 +4519,9 @@ int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4])
4510 u64 spte; 4519 u64 spte;
4511 int nr_sptes = 0; 4520 int nr_sptes = 0;
4512 4521
4522 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
4523 return nr_sptes;
4524
4513 walk_shadow_page_lockless_begin(vcpu); 4525 walk_shadow_page_lockless_begin(vcpu);
4514 for_each_shadow_entry_lockless(vcpu, addr, iterator, spte) { 4526 for_each_shadow_entry_lockless(vcpu, addr, iterator, spte) {
4515 sptes[iterator.level-1] = spte; 4527 sptes[iterator.level-1] = spte;
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index ad75d77999d0..cba218a2f08d 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -569,6 +569,9 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
569 if (FNAME(gpte_changed)(vcpu, gw, top_level)) 569 if (FNAME(gpte_changed)(vcpu, gw, top_level))
570 goto out_gpte_changed; 570 goto out_gpte_changed;
571 571
572 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
573 goto out_gpte_changed;
574
572 for (shadow_walk_init(&it, vcpu, addr); 575 for (shadow_walk_init(&it, vcpu, addr);
573 shadow_walk_okay(&it) && it.level > gw->level; 576 shadow_walk_okay(&it) && it.level > gw->level;
574 shadow_walk_next(&it)) { 577 shadow_walk_next(&it)) {
@@ -820,6 +823,11 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
820 */ 823 */
821 mmu_topup_memory_caches(vcpu); 824 mmu_topup_memory_caches(vcpu);
822 825
826 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) {
827 WARN_ON(1);
828 return;
829 }
830
823 spin_lock(&vcpu->kvm->mmu_lock); 831 spin_lock(&vcpu->kvm->mmu_lock);
824 for_each_shadow_entry(vcpu, gva, iterator) { 832 for_each_shadow_entry(vcpu, gva, iterator) {
825 level = iterator.level; 833 level = iterator.level;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index c7168a5cff1b..e81df8fce027 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1671,6 +1671,19 @@ static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd)
1671 mark_dirty(svm->vmcb, VMCB_ASID); 1671 mark_dirty(svm->vmcb, VMCB_ASID);
1672} 1672}
1673 1673
1674static u64 svm_get_dr6(struct kvm_vcpu *vcpu)
1675{
1676 return to_svm(vcpu)->vmcb->save.dr6;
1677}
1678
1679static void svm_set_dr6(struct kvm_vcpu *vcpu, unsigned long value)
1680{
1681 struct vcpu_svm *svm = to_svm(vcpu);
1682
1683 svm->vmcb->save.dr6 = value;
1684 mark_dirty(svm->vmcb, VMCB_DR);
1685}
1686
1674static void svm_set_dr7(struct kvm_vcpu *vcpu, unsigned long value) 1687static void svm_set_dr7(struct kvm_vcpu *vcpu, unsigned long value)
1675{ 1688{
1676 struct vcpu_svm *svm = to_svm(vcpu); 1689 struct vcpu_svm *svm = to_svm(vcpu);
@@ -4286,6 +4299,8 @@ static struct kvm_x86_ops svm_x86_ops = {
4286 .set_idt = svm_set_idt, 4299 .set_idt = svm_set_idt,
4287 .get_gdt = svm_get_gdt, 4300 .get_gdt = svm_get_gdt,
4288 .set_gdt = svm_set_gdt, 4301 .set_gdt = svm_set_gdt,
4302 .get_dr6 = svm_get_dr6,
4303 .set_dr6 = svm_set_dr6,
4289 .set_dr7 = svm_set_dr7, 4304 .set_dr7 = svm_set_dr7,
4290 .cache_reg = svm_cache_reg, 4305 .cache_reg = svm_cache_reg,
4291 .get_rflags = svm_get_rflags, 4306 .get_rflags = svm_get_rflags,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index da7837e1349d..a06f101ef64b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -418,6 +418,8 @@ struct vcpu_vmx {
418 u64 msr_host_kernel_gs_base; 418 u64 msr_host_kernel_gs_base;
419 u64 msr_guest_kernel_gs_base; 419 u64 msr_guest_kernel_gs_base;
420#endif 420#endif
421 u32 vm_entry_controls_shadow;
422 u32 vm_exit_controls_shadow;
421 /* 423 /*
422 * loaded_vmcs points to the VMCS currently used in this vcpu. For a 424 * loaded_vmcs points to the VMCS currently used in this vcpu. For a
423 * non-nested (L1) guest, it always points to vmcs01. For a nested 425 * non-nested (L1) guest, it always points to vmcs01. For a nested
@@ -1056,7 +1058,9 @@ static inline bool is_exception(u32 intr_info)
1056 == (INTR_TYPE_HARD_EXCEPTION | INTR_INFO_VALID_MASK); 1058 == (INTR_TYPE_HARD_EXCEPTION | INTR_INFO_VALID_MASK);
1057} 1059}
1058 1060
1059static void nested_vmx_vmexit(struct kvm_vcpu *vcpu); 1061static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
1062 u32 exit_intr_info,
1063 unsigned long exit_qualification);
1060static void nested_vmx_entry_failure(struct kvm_vcpu *vcpu, 1064static void nested_vmx_entry_failure(struct kvm_vcpu *vcpu,
1061 struct vmcs12 *vmcs12, 1065 struct vmcs12 *vmcs12,
1062 u32 reason, unsigned long qualification); 1066 u32 reason, unsigned long qualification);
@@ -1326,6 +1330,62 @@ static void vmcs_set_bits(unsigned long field, u32 mask)
1326 vmcs_writel(field, vmcs_readl(field) | mask); 1330 vmcs_writel(field, vmcs_readl(field) | mask);
1327} 1331}
1328 1332
1333static inline void vm_entry_controls_init(struct vcpu_vmx *vmx, u32 val)
1334{
1335 vmcs_write32(VM_ENTRY_CONTROLS, val);
1336 vmx->vm_entry_controls_shadow = val;
1337}
1338
1339static inline void vm_entry_controls_set(struct vcpu_vmx *vmx, u32 val)
1340{
1341 if (vmx->vm_entry_controls_shadow != val)
1342 vm_entry_controls_init(vmx, val);
1343}
1344
1345static inline u32 vm_entry_controls_get(struct vcpu_vmx *vmx)
1346{
1347 return vmx->vm_entry_controls_shadow;
1348}
1349
1350
1351static inline void vm_entry_controls_setbit(struct vcpu_vmx *vmx, u32 val)
1352{
1353 vm_entry_controls_set(vmx, vm_entry_controls_get(vmx) | val);
1354}
1355
1356static inline void vm_entry_controls_clearbit(struct vcpu_vmx *vmx, u32 val)
1357{
1358 vm_entry_controls_set(vmx, vm_entry_controls_get(vmx) & ~val);
1359}
1360
1361static inline void vm_exit_controls_init(struct vcpu_vmx *vmx, u32 val)
1362{
1363 vmcs_write32(VM_EXIT_CONTROLS, val);
1364 vmx->vm_exit_controls_shadow = val;
1365}
1366
1367static inline void vm_exit_controls_set(struct vcpu_vmx *vmx, u32 val)
1368{
1369 if (vmx->vm_exit_controls_shadow != val)
1370 vm_exit_controls_init(vmx, val);
1371}
1372
1373static inline u32 vm_exit_controls_get(struct vcpu_vmx *vmx)
1374{
1375 return vmx->vm_exit_controls_shadow;
1376}
1377
1378
1379static inline void vm_exit_controls_setbit(struct vcpu_vmx *vmx, u32 val)
1380{
1381 vm_exit_controls_set(vmx, vm_exit_controls_get(vmx) | val);
1382}
1383
1384static inline void vm_exit_controls_clearbit(struct vcpu_vmx *vmx, u32 val)
1385{
1386 vm_exit_controls_set(vmx, vm_exit_controls_get(vmx) & ~val);
1387}
1388
1329static void vmx_segment_cache_clear(struct vcpu_vmx *vmx) 1389static void vmx_segment_cache_clear(struct vcpu_vmx *vmx)
1330{ 1390{
1331 vmx->segment_cache.bitmask = 0; 1391 vmx->segment_cache.bitmask = 0;
@@ -1410,11 +1470,11 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
1410 vmcs_write32(EXCEPTION_BITMAP, eb); 1470 vmcs_write32(EXCEPTION_BITMAP, eb);
1411} 1471}
1412 1472
1413static void clear_atomic_switch_msr_special(unsigned long entry, 1473static void clear_atomic_switch_msr_special(struct vcpu_vmx *vmx,
1414 unsigned long exit) 1474 unsigned long entry, unsigned long exit)
1415{ 1475{
1416 vmcs_clear_bits(VM_ENTRY_CONTROLS, entry); 1476 vm_entry_controls_clearbit(vmx, entry);
1417 vmcs_clear_bits(VM_EXIT_CONTROLS, exit); 1477 vm_exit_controls_clearbit(vmx, exit);
1418} 1478}
1419 1479
1420static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr) 1480static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr)
@@ -1425,14 +1485,15 @@ static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr)
1425 switch (msr) { 1485 switch (msr) {
1426 case MSR_EFER: 1486 case MSR_EFER:
1427 if (cpu_has_load_ia32_efer) { 1487 if (cpu_has_load_ia32_efer) {
1428 clear_atomic_switch_msr_special(VM_ENTRY_LOAD_IA32_EFER, 1488 clear_atomic_switch_msr_special(vmx,
1489 VM_ENTRY_LOAD_IA32_EFER,
1429 VM_EXIT_LOAD_IA32_EFER); 1490 VM_EXIT_LOAD_IA32_EFER);
1430 return; 1491 return;
1431 } 1492 }
1432 break; 1493 break;
1433 case MSR_CORE_PERF_GLOBAL_CTRL: 1494 case MSR_CORE_PERF_GLOBAL_CTRL:
1434 if (cpu_has_load_perf_global_ctrl) { 1495 if (cpu_has_load_perf_global_ctrl) {
1435 clear_atomic_switch_msr_special( 1496 clear_atomic_switch_msr_special(vmx,
1436 VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL, 1497 VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL,
1437 VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL); 1498 VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL);
1438 return; 1499 return;
@@ -1453,14 +1514,15 @@ static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr)
1453 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, m->nr); 1514 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, m->nr);
1454} 1515}
1455 1516
1456static void add_atomic_switch_msr_special(unsigned long entry, 1517static void add_atomic_switch_msr_special(struct vcpu_vmx *vmx,
1457 unsigned long exit, unsigned long guest_val_vmcs, 1518 unsigned long entry, unsigned long exit,
1458 unsigned long host_val_vmcs, u64 guest_val, u64 host_val) 1519 unsigned long guest_val_vmcs, unsigned long host_val_vmcs,
1520 u64 guest_val, u64 host_val)
1459{ 1521{
1460 vmcs_write64(guest_val_vmcs, guest_val); 1522 vmcs_write64(guest_val_vmcs, guest_val);
1461 vmcs_write64(host_val_vmcs, host_val); 1523 vmcs_write64(host_val_vmcs, host_val);
1462 vmcs_set_bits(VM_ENTRY_CONTROLS, entry); 1524 vm_entry_controls_setbit(vmx, entry);
1463 vmcs_set_bits(VM_EXIT_CONTROLS, exit); 1525 vm_exit_controls_setbit(vmx, exit);
1464} 1526}
1465 1527
1466static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, 1528static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
@@ -1472,7 +1534,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
1472 switch (msr) { 1534 switch (msr) {
1473 case MSR_EFER: 1535 case MSR_EFER:
1474 if (cpu_has_load_ia32_efer) { 1536 if (cpu_has_load_ia32_efer) {
1475 add_atomic_switch_msr_special(VM_ENTRY_LOAD_IA32_EFER, 1537 add_atomic_switch_msr_special(vmx,
1538 VM_ENTRY_LOAD_IA32_EFER,
1476 VM_EXIT_LOAD_IA32_EFER, 1539 VM_EXIT_LOAD_IA32_EFER,
1477 GUEST_IA32_EFER, 1540 GUEST_IA32_EFER,
1478 HOST_IA32_EFER, 1541 HOST_IA32_EFER,
@@ -1482,7 +1545,7 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
1482 break; 1545 break;
1483 case MSR_CORE_PERF_GLOBAL_CTRL: 1546 case MSR_CORE_PERF_GLOBAL_CTRL:
1484 if (cpu_has_load_perf_global_ctrl) { 1547 if (cpu_has_load_perf_global_ctrl) {
1485 add_atomic_switch_msr_special( 1548 add_atomic_switch_msr_special(vmx,
1486 VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL, 1549 VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL,
1487 VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL, 1550 VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL,
1488 GUEST_IA32_PERF_GLOBAL_CTRL, 1551 GUEST_IA32_PERF_GLOBAL_CTRL,
@@ -1906,7 +1969,9 @@ static int nested_vmx_check_exception(struct kvm_vcpu *vcpu, unsigned nr)
1906 if (!(vmcs12->exception_bitmap & (1u << nr))) 1969 if (!(vmcs12->exception_bitmap & (1u << nr)))
1907 return 0; 1970 return 0;
1908 1971
1909 nested_vmx_vmexit(vcpu); 1972 nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason,
1973 vmcs_read32(VM_EXIT_INTR_INFO),
1974 vmcs_readl(EXIT_QUALIFICATION));
1910 return 1; 1975 return 1;
1911} 1976}
1912 1977
@@ -2279,6 +2344,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2279 rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high); 2344 rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high);
2280 nested_vmx_misc_low &= VMX_MISC_PREEMPTION_TIMER_RATE_MASK | 2345 nested_vmx_misc_low &= VMX_MISC_PREEMPTION_TIMER_RATE_MASK |
2281 VMX_MISC_SAVE_EFER_LMA; 2346 VMX_MISC_SAVE_EFER_LMA;
2347 nested_vmx_misc_low |= VMX_MISC_ACTIVITY_HLT;
2282 nested_vmx_misc_high = 0; 2348 nested_vmx_misc_high = 0;
2283} 2349}
2284 2350
@@ -2295,32 +2361,10 @@ static inline u64 vmx_control_msr(u32 low, u32 high)
2295 return low | ((u64)high << 32); 2361 return low | ((u64)high << 32);
2296} 2362}
2297 2363
2298/* 2364/* Returns 0 on success, non-0 otherwise. */
2299 * If we allow our guest to use VMX instructions (i.e., nested VMX), we should
2300 * also let it use VMX-specific MSRs.
2301 * vmx_get_vmx_msr() and vmx_set_vmx_msr() return 1 when we handled a
2302 * VMX-specific MSR, or 0 when we haven't (and the caller should handle it
2303 * like all other MSRs).
2304 */
2305static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) 2365static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2306{ 2366{
2307 if (!nested_vmx_allowed(vcpu) && msr_index >= MSR_IA32_VMX_BASIC &&
2308 msr_index <= MSR_IA32_VMX_TRUE_ENTRY_CTLS) {
2309 /*
2310 * According to the spec, processors which do not support VMX
2311 * should throw a #GP(0) when VMX capability MSRs are read.
2312 */
2313 kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
2314 return 1;
2315 }
2316
2317 switch (msr_index) { 2367 switch (msr_index) {
2318 case MSR_IA32_FEATURE_CONTROL:
2319 if (nested_vmx_allowed(vcpu)) {
2320 *pdata = to_vmx(vcpu)->nested.msr_ia32_feature_control;
2321 break;
2322 }
2323 return 0;
2324 case MSR_IA32_VMX_BASIC: 2368 case MSR_IA32_VMX_BASIC:
2325 /* 2369 /*
2326 * This MSR reports some information about VMX support. We 2370 * This MSR reports some information about VMX support. We
@@ -2387,34 +2431,9 @@ static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2387 *pdata = nested_vmx_ept_caps; 2431 *pdata = nested_vmx_ept_caps;
2388 break; 2432 break;
2389 default: 2433 default:
2390 return 0;
2391 }
2392
2393 return 1;
2394}
2395
2396static int vmx_set_vmx_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2397{
2398 u32 msr_index = msr_info->index;
2399 u64 data = msr_info->data;
2400 bool host_initialized = msr_info->host_initiated;
2401
2402 if (!nested_vmx_allowed(vcpu))
2403 return 0;
2404
2405 if (msr_index == MSR_IA32_FEATURE_CONTROL) {
2406 if (!host_initialized &&
2407 to_vmx(vcpu)->nested.msr_ia32_feature_control
2408 & FEATURE_CONTROL_LOCKED)
2409 return 0;
2410 to_vmx(vcpu)->nested.msr_ia32_feature_control = data;
2411 return 1; 2434 return 1;
2412 } 2435 }
2413 2436
2414 /*
2415 * No need to treat VMX capability MSRs specially: If we don't handle
2416 * them, handle_wrmsr will #GP(0), which is correct (they are readonly)
2417 */
2418 return 0; 2437 return 0;
2419} 2438}
2420 2439
@@ -2460,13 +2479,20 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2460 case MSR_IA32_SYSENTER_ESP: 2479 case MSR_IA32_SYSENTER_ESP:
2461 data = vmcs_readl(GUEST_SYSENTER_ESP); 2480 data = vmcs_readl(GUEST_SYSENTER_ESP);
2462 break; 2481 break;
2482 case MSR_IA32_FEATURE_CONTROL:
2483 if (!nested_vmx_allowed(vcpu))
2484 return 1;
2485 data = to_vmx(vcpu)->nested.msr_ia32_feature_control;
2486 break;
2487 case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC:
2488 if (!nested_vmx_allowed(vcpu))
2489 return 1;
2490 return vmx_get_vmx_msr(vcpu, msr_index, pdata);
2463 case MSR_TSC_AUX: 2491 case MSR_TSC_AUX:
2464 if (!to_vmx(vcpu)->rdtscp_enabled) 2492 if (!to_vmx(vcpu)->rdtscp_enabled)
2465 return 1; 2493 return 1;
2466 /* Otherwise falls through */ 2494 /* Otherwise falls through */
2467 default: 2495 default:
2468 if (vmx_get_vmx_msr(vcpu, msr_index, pdata))
2469 return 0;
2470 msr = find_msr_entry(to_vmx(vcpu), msr_index); 2496 msr = find_msr_entry(to_vmx(vcpu), msr_index);
2471 if (msr) { 2497 if (msr) {
2472 data = msr->data; 2498 data = msr->data;
@@ -2479,6 +2505,8 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2479 return 0; 2505 return 0;
2480} 2506}
2481 2507
2508static void vmx_leave_nested(struct kvm_vcpu *vcpu);
2509
2482/* 2510/*
2483 * Writes msr value into into the appropriate "register". 2511 * Writes msr value into into the appropriate "register".
2484 * Returns 0 on success, non-0 otherwise. 2512 * Returns 0 on success, non-0 otherwise.
@@ -2533,6 +2561,17 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2533 case MSR_IA32_TSC_ADJUST: 2561 case MSR_IA32_TSC_ADJUST:
2534 ret = kvm_set_msr_common(vcpu, msr_info); 2562 ret = kvm_set_msr_common(vcpu, msr_info);
2535 break; 2563 break;
2564 case MSR_IA32_FEATURE_CONTROL:
2565 if (!nested_vmx_allowed(vcpu) ||
2566 (to_vmx(vcpu)->nested.msr_ia32_feature_control &
2567 FEATURE_CONTROL_LOCKED && !msr_info->host_initiated))
2568 return 1;
2569 vmx->nested.msr_ia32_feature_control = data;
2570 if (msr_info->host_initiated && data == 0)
2571 vmx_leave_nested(vcpu);
2572 break;
2573 case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC:
2574 return 1; /* they are read-only */
2536 case MSR_TSC_AUX: 2575 case MSR_TSC_AUX:
2537 if (!vmx->rdtscp_enabled) 2576 if (!vmx->rdtscp_enabled)
2538 return 1; 2577 return 1;
@@ -2541,8 +2580,6 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2541 return 1; 2580 return 1;
2542 /* Otherwise falls through */ 2581 /* Otherwise falls through */
2543 default: 2582 default:
2544 if (vmx_set_vmx_msr(vcpu, msr_info))
2545 break;
2546 msr = find_msr_entry(vmx, msr_index); 2583 msr = find_msr_entry(vmx, msr_index);
2547 if (msr) { 2584 if (msr) {
2548 msr->data = data; 2585 msr->data = data;
@@ -3182,14 +3219,10 @@ static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer)
3182 vmx_load_host_state(to_vmx(vcpu)); 3219 vmx_load_host_state(to_vmx(vcpu));
3183 vcpu->arch.efer = efer; 3220 vcpu->arch.efer = efer;
3184 if (efer & EFER_LMA) { 3221 if (efer & EFER_LMA) {
3185 vmcs_write32(VM_ENTRY_CONTROLS, 3222 vm_entry_controls_setbit(to_vmx(vcpu), VM_ENTRY_IA32E_MODE);
3186 vmcs_read32(VM_ENTRY_CONTROLS) |
3187 VM_ENTRY_IA32E_MODE);
3188 msr->data = efer; 3223 msr->data = efer;
3189 } else { 3224 } else {
3190 vmcs_write32(VM_ENTRY_CONTROLS, 3225 vm_entry_controls_clearbit(to_vmx(vcpu), VM_ENTRY_IA32E_MODE);
3191 vmcs_read32(VM_ENTRY_CONTROLS) &
3192 ~VM_ENTRY_IA32E_MODE);
3193 3226
3194 msr->data = efer & ~EFER_LME; 3227 msr->data = efer & ~EFER_LME;
3195 } 3228 }
@@ -3217,9 +3250,7 @@ static void enter_lmode(struct kvm_vcpu *vcpu)
3217 3250
3218static void exit_lmode(struct kvm_vcpu *vcpu) 3251static void exit_lmode(struct kvm_vcpu *vcpu)
3219{ 3252{
3220 vmcs_write32(VM_ENTRY_CONTROLS, 3253 vm_entry_controls_clearbit(to_vmx(vcpu), VM_ENTRY_IA32E_MODE);
3221 vmcs_read32(VM_ENTRY_CONTROLS)
3222 & ~VM_ENTRY_IA32E_MODE);
3223 vmx_set_efer(vcpu, vcpu->arch.efer & ~EFER_LMA); 3254 vmx_set_efer(vcpu, vcpu->arch.efer & ~EFER_LMA);
3224} 3255}
3225 3256
@@ -4346,10 +4377,11 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4346 ++vmx->nmsrs; 4377 ++vmx->nmsrs;
4347 } 4378 }
4348 4379
4349 vmcs_write32(VM_EXIT_CONTROLS, vmcs_config.vmexit_ctrl); 4380
4381 vm_exit_controls_init(vmx, vmcs_config.vmexit_ctrl);
4350 4382
4351 /* 22.2.1, 20.8.1 */ 4383 /* 22.2.1, 20.8.1 */
4352 vmcs_write32(VM_ENTRY_CONTROLS, vmcs_config.vmentry_ctrl); 4384 vm_entry_controls_init(vmx, vmcs_config.vmentry_ctrl);
4353 4385
4354 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL); 4386 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL);
4355 set_cr4_guest_host_mask(vmx); 4387 set_cr4_guest_host_mask(vmx);
@@ -4360,7 +4392,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4360static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) 4392static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4361{ 4393{
4362 struct vcpu_vmx *vmx = to_vmx(vcpu); 4394 struct vcpu_vmx *vmx = to_vmx(vcpu);
4363 u64 msr; 4395 struct msr_data apic_base_msr;
4364 4396
4365 vmx->rmode.vm86_active = 0; 4397 vmx->rmode.vm86_active = 0;
4366 4398
@@ -4368,10 +4400,11 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4368 4400
4369 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); 4401 vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val();
4370 kvm_set_cr8(&vmx->vcpu, 0); 4402 kvm_set_cr8(&vmx->vcpu, 0);
4371 msr = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; 4403 apic_base_msr.data = 0xfee00000 | MSR_IA32_APICBASE_ENABLE;
4372 if (kvm_vcpu_is_bsp(&vmx->vcpu)) 4404 if (kvm_vcpu_is_bsp(&vmx->vcpu))
4373 msr |= MSR_IA32_APICBASE_BSP; 4405 apic_base_msr.data |= MSR_IA32_APICBASE_BSP;
4374 kvm_set_apic_base(&vmx->vcpu, msr); 4406 apic_base_msr.host_initiated = true;
4407 kvm_set_apic_base(&vmx->vcpu, &apic_base_msr);
4375 4408
4376 vmx_segment_cache_clear(vmx); 4409 vmx_segment_cache_clear(vmx);
4377 4410
@@ -4588,15 +4621,12 @@ static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked)
4588static int vmx_nmi_allowed(struct kvm_vcpu *vcpu) 4621static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)
4589{ 4622{
4590 if (is_guest_mode(vcpu)) { 4623 if (is_guest_mode(vcpu)) {
4591 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
4592
4593 if (to_vmx(vcpu)->nested.nested_run_pending) 4624 if (to_vmx(vcpu)->nested.nested_run_pending)
4594 return 0; 4625 return 0;
4595 if (nested_exit_on_nmi(vcpu)) { 4626 if (nested_exit_on_nmi(vcpu)) {
4596 nested_vmx_vmexit(vcpu); 4627 nested_vmx_vmexit(vcpu, EXIT_REASON_EXCEPTION_NMI,
4597 vmcs12->vm_exit_reason = EXIT_REASON_EXCEPTION_NMI; 4628 NMI_VECTOR | INTR_TYPE_NMI_INTR |
4598 vmcs12->vm_exit_intr_info = NMI_VECTOR | 4629 INTR_INFO_VALID_MASK, 0);
4599 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK;
4600 /* 4630 /*
4601 * The NMI-triggered VM exit counts as injection: 4631 * The NMI-triggered VM exit counts as injection:
4602 * clear this one and block further NMIs. 4632 * clear this one and block further NMIs.
@@ -4618,15 +4648,11 @@ static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)
4618static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu) 4648static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu)
4619{ 4649{
4620 if (is_guest_mode(vcpu)) { 4650 if (is_guest_mode(vcpu)) {
4621 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
4622
4623 if (to_vmx(vcpu)->nested.nested_run_pending) 4651 if (to_vmx(vcpu)->nested.nested_run_pending)
4624 return 0; 4652 return 0;
4625 if (nested_exit_on_intr(vcpu)) { 4653 if (nested_exit_on_intr(vcpu)) {
4626 nested_vmx_vmexit(vcpu); 4654 nested_vmx_vmexit(vcpu, EXIT_REASON_EXTERNAL_INTERRUPT,
4627 vmcs12->vm_exit_reason = 4655 0, 0);
4628 EXIT_REASON_EXTERNAL_INTERRUPT;
4629 vmcs12->vm_exit_intr_info = 0;
4630 /* 4656 /*
4631 * fall through to normal code, but now in L1, not L2 4657 * fall through to normal code, but now in L1, not L2
4632 */ 4658 */
@@ -4812,7 +4838,8 @@ static int handle_exception(struct kvm_vcpu *vcpu)
4812 dr6 = vmcs_readl(EXIT_QUALIFICATION); 4838 dr6 = vmcs_readl(EXIT_QUALIFICATION);
4813 if (!(vcpu->guest_debug & 4839 if (!(vcpu->guest_debug &
4814 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) { 4840 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {
4815 vcpu->arch.dr6 = dr6 | DR6_FIXED_1; 4841 vcpu->arch.dr6 &= ~15;
4842 vcpu->arch.dr6 |= dr6;
4816 kvm_queue_exception(vcpu, DB_VECTOR); 4843 kvm_queue_exception(vcpu, DB_VECTOR);
4817 return 1; 4844 return 1;
4818 } 4845 }
@@ -5080,14 +5107,27 @@ static int handle_dr(struct kvm_vcpu *vcpu)
5080 reg = DEBUG_REG_ACCESS_REG(exit_qualification); 5107 reg = DEBUG_REG_ACCESS_REG(exit_qualification);
5081 if (exit_qualification & TYPE_MOV_FROM_DR) { 5108 if (exit_qualification & TYPE_MOV_FROM_DR) {
5082 unsigned long val; 5109 unsigned long val;
5083 if (!kvm_get_dr(vcpu, dr, &val)) 5110
5084 kvm_register_write(vcpu, reg, val); 5111 if (kvm_get_dr(vcpu, dr, &val))
5112 return 1;
5113 kvm_register_write(vcpu, reg, val);
5085 } else 5114 } else
5086 kvm_set_dr(vcpu, dr, vcpu->arch.regs[reg]); 5115 if (kvm_set_dr(vcpu, dr, vcpu->arch.regs[reg]))
5116 return 1;
5117
5087 skip_emulated_instruction(vcpu); 5118 skip_emulated_instruction(vcpu);
5088 return 1; 5119 return 1;
5089} 5120}
5090 5121
5122static u64 vmx_get_dr6(struct kvm_vcpu *vcpu)
5123{
5124 return vcpu->arch.dr6;
5125}
5126
5127static void vmx_set_dr6(struct kvm_vcpu *vcpu, unsigned long val)
5128{
5129}
5130
5091static void vmx_set_dr7(struct kvm_vcpu *vcpu, unsigned long val) 5131static void vmx_set_dr7(struct kvm_vcpu *vcpu, unsigned long val)
5092{ 5132{
5093 vmcs_writel(GUEST_DR7, val); 5133 vmcs_writel(GUEST_DR7, val);
@@ -6460,11 +6500,8 @@ static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu,
6460 int size; 6500 int size;
6461 u8 b; 6501 u8 b;
6462 6502
6463 if (nested_cpu_has(vmcs12, CPU_BASED_UNCOND_IO_EXITING))
6464 return 1;
6465
6466 if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS)) 6503 if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS))
6467 return 0; 6504 return nested_cpu_has(vmcs12, CPU_BASED_UNCOND_IO_EXITING);
6468 6505
6469 exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 6506 exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
6470 6507
@@ -6628,6 +6665,13 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6628 struct vmcs12 *vmcs12 = get_vmcs12(vcpu); 6665 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
6629 u32 exit_reason = vmx->exit_reason; 6666 u32 exit_reason = vmx->exit_reason;
6630 6667
6668 trace_kvm_nested_vmexit(kvm_rip_read(vcpu), exit_reason,
6669 vmcs_readl(EXIT_QUALIFICATION),
6670 vmx->idt_vectoring_info,
6671 intr_info,
6672 vmcs_read32(VM_EXIT_INTR_ERROR_CODE),
6673 KVM_ISA_VMX);
6674
6631 if (vmx->nested.nested_run_pending) 6675 if (vmx->nested.nested_run_pending)
6632 return 0; 6676 return 0;
6633 6677
@@ -6777,7 +6821,9 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
6777 return handle_invalid_guest_state(vcpu); 6821 return handle_invalid_guest_state(vcpu);
6778 6822
6779 if (is_guest_mode(vcpu) && nested_vmx_exit_handled(vcpu)) { 6823 if (is_guest_mode(vcpu) && nested_vmx_exit_handled(vcpu)) {
6780 nested_vmx_vmexit(vcpu); 6824 nested_vmx_vmexit(vcpu, exit_reason,
6825 vmcs_read32(VM_EXIT_INTR_INFO),
6826 vmcs_readl(EXIT_QUALIFICATION));
6781 return 1; 6827 return 1;
6782 } 6828 }
6783 6829
@@ -7332,8 +7378,8 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu)
7332 struct vcpu_vmx *vmx = to_vmx(vcpu); 7378 struct vcpu_vmx *vmx = to_vmx(vcpu);
7333 7379
7334 free_vpid(vmx); 7380 free_vpid(vmx);
7335 free_nested(vmx);
7336 free_loaded_vmcs(vmx->loaded_vmcs); 7381 free_loaded_vmcs(vmx->loaded_vmcs);
7382 free_nested(vmx);
7337 kfree(vmx->guest_msrs); 7383 kfree(vmx->guest_msrs);
7338 kvm_vcpu_uninit(vcpu); 7384 kvm_vcpu_uninit(vcpu);
7339 kmem_cache_free(kvm_vcpu_cache, vmx); 7385 kmem_cache_free(kvm_vcpu_cache, vmx);
@@ -7518,15 +7564,14 @@ static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
7518static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu, 7564static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu,
7519 struct x86_exception *fault) 7565 struct x86_exception *fault)
7520{ 7566{
7521 struct vmcs12 *vmcs12; 7567 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
7522 nested_vmx_vmexit(vcpu); 7568 u32 exit_reason;
7523 vmcs12 = get_vmcs12(vcpu);
7524 7569
7525 if (fault->error_code & PFERR_RSVD_MASK) 7570 if (fault->error_code & PFERR_RSVD_MASK)
7526 vmcs12->vm_exit_reason = EXIT_REASON_EPT_MISCONFIG; 7571 exit_reason = EXIT_REASON_EPT_MISCONFIG;
7527 else 7572 else
7528 vmcs12->vm_exit_reason = EXIT_REASON_EPT_VIOLATION; 7573 exit_reason = EXIT_REASON_EPT_VIOLATION;
7529 vmcs12->exit_qualification = vcpu->arch.exit_qualification; 7574 nested_vmx_vmexit(vcpu, exit_reason, 0, vcpu->arch.exit_qualification);
7530 vmcs12->guest_physical_address = fault->address; 7575 vmcs12->guest_physical_address = fault->address;
7531} 7576}
7532 7577
@@ -7564,7 +7609,9 @@ static void vmx_inject_page_fault_nested(struct kvm_vcpu *vcpu,
7564 7609
7565 /* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */ 7610 /* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */
7566 if (vmcs12->exception_bitmap & (1u << PF_VECTOR)) 7611 if (vmcs12->exception_bitmap & (1u << PF_VECTOR))
7567 nested_vmx_vmexit(vcpu); 7612 nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason,
7613 vmcs_read32(VM_EXIT_INTR_INFO),
7614 vmcs_readl(EXIT_QUALIFICATION));
7568 else 7615 else
7569 kvm_inject_page_fault(vcpu, fault); 7616 kvm_inject_page_fault(vcpu, fault);
7570} 7617}
@@ -7706,6 +7753,11 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7706 else 7753 else
7707 vmcs_write64(APIC_ACCESS_ADDR, 7754 vmcs_write64(APIC_ACCESS_ADDR,
7708 page_to_phys(vmx->nested.apic_access_page)); 7755 page_to_phys(vmx->nested.apic_access_page));
7756 } else if (vm_need_virtualize_apic_accesses(vmx->vcpu.kvm)) {
7757 exec_control |=
7758 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
7759 vmcs_write64(APIC_ACCESS_ADDR,
7760 page_to_phys(vcpu->kvm->arch.apic_access_page));
7709 } 7761 }
7710 7762
7711 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); 7763 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
@@ -7759,12 +7811,12 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7759 exit_control = vmcs_config.vmexit_ctrl; 7811 exit_control = vmcs_config.vmexit_ctrl;
7760 if (vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER) 7812 if (vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER)
7761 exit_control |= VM_EXIT_SAVE_VMX_PREEMPTION_TIMER; 7813 exit_control |= VM_EXIT_SAVE_VMX_PREEMPTION_TIMER;
7762 vmcs_write32(VM_EXIT_CONTROLS, exit_control); 7814 vm_exit_controls_init(vmx, exit_control);
7763 7815
7764 /* vmcs12's VM_ENTRY_LOAD_IA32_EFER and VM_ENTRY_IA32E_MODE are 7816 /* vmcs12's VM_ENTRY_LOAD_IA32_EFER and VM_ENTRY_IA32E_MODE are
7765 * emulated by vmx_set_efer(), below. 7817 * emulated by vmx_set_efer(), below.
7766 */ 7818 */
7767 vmcs_write32(VM_ENTRY_CONTROLS, 7819 vm_entry_controls_init(vmx,
7768 (vmcs12->vm_entry_controls & ~VM_ENTRY_LOAD_IA32_EFER & 7820 (vmcs12->vm_entry_controls & ~VM_ENTRY_LOAD_IA32_EFER &
7769 ~VM_ENTRY_IA32E_MODE) | 7821 ~VM_ENTRY_IA32E_MODE) |
7770 (vmcs_config.vmentry_ctrl & ~VM_ENTRY_IA32E_MODE)); 7822 (vmcs_config.vmentry_ctrl & ~VM_ENTRY_IA32E_MODE));
@@ -7882,7 +7934,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7882 return 1; 7934 return 1;
7883 } 7935 }
7884 7936
7885 if (vmcs12->guest_activity_state != GUEST_ACTIVITY_ACTIVE) { 7937 if (vmcs12->guest_activity_state != GUEST_ACTIVITY_ACTIVE &&
7938 vmcs12->guest_activity_state != GUEST_ACTIVITY_HLT) {
7886 nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD); 7939 nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD);
7887 return 1; 7940 return 1;
7888 } 7941 }
@@ -7994,8 +8047,6 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7994 8047
7995 enter_guest_mode(vcpu); 8048 enter_guest_mode(vcpu);
7996 8049
7997 vmx->nested.nested_run_pending = 1;
7998
7999 vmx->nested.vmcs01_tsc_offset = vmcs_read64(TSC_OFFSET); 8050 vmx->nested.vmcs01_tsc_offset = vmcs_read64(TSC_OFFSET);
8000 8051
8001 cpu = get_cpu(); 8052 cpu = get_cpu();
@@ -8011,6 +8062,11 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
8011 8062
8012 prepare_vmcs02(vcpu, vmcs12); 8063 prepare_vmcs02(vcpu, vmcs12);
8013 8064
8065 if (vmcs12->guest_activity_state == GUEST_ACTIVITY_HLT)
8066 return kvm_emulate_halt(vcpu);
8067
8068 vmx->nested.nested_run_pending = 1;
8069
8014 /* 8070 /*
8015 * Note no nested_vmx_succeed or nested_vmx_fail here. At this point 8071 * Note no nested_vmx_succeed or nested_vmx_fail here. At this point
8016 * we are no longer running L1, and VMLAUNCH/VMRESUME has not yet 8072 * we are no longer running L1, and VMLAUNCH/VMRESUME has not yet
@@ -8110,7 +8166,9 @@ static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu,
8110 * exit-information fields only. Other fields are modified by L1 with VMWRITE, 8166 * exit-information fields only. Other fields are modified by L1 with VMWRITE,
8111 * which already writes to vmcs12 directly. 8167 * which already writes to vmcs12 directly.
8112 */ 8168 */
8113static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) 8169static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
8170 u32 exit_reason, u32 exit_intr_info,
8171 unsigned long exit_qualification)
8114{ 8172{
8115 /* update guest state fields: */ 8173 /* update guest state fields: */
8116 vmcs12->guest_cr0 = vmcs12_guest_cr0(vcpu, vmcs12); 8174 vmcs12->guest_cr0 = vmcs12_guest_cr0(vcpu, vmcs12);
@@ -8162,6 +8220,10 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
8162 vmcs_read32(GUEST_INTERRUPTIBILITY_INFO); 8220 vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
8163 vmcs12->guest_pending_dbg_exceptions = 8221 vmcs12->guest_pending_dbg_exceptions =
8164 vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS); 8222 vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS);
8223 if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED)
8224 vmcs12->guest_activity_state = GUEST_ACTIVITY_HLT;
8225 else
8226 vmcs12->guest_activity_state = GUEST_ACTIVITY_ACTIVE;
8165 8227
8166 if ((vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER) && 8228 if ((vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER) &&
8167 (vmcs12->vm_exit_controls & VM_EXIT_SAVE_VMX_PREEMPTION_TIMER)) 8229 (vmcs12->vm_exit_controls & VM_EXIT_SAVE_VMX_PREEMPTION_TIMER))
@@ -8186,7 +8248,7 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
8186 8248
8187 vmcs12->vm_entry_controls = 8249 vmcs12->vm_entry_controls =
8188 (vmcs12->vm_entry_controls & ~VM_ENTRY_IA32E_MODE) | 8250 (vmcs12->vm_entry_controls & ~VM_ENTRY_IA32E_MODE) |
8189 (vmcs_read32(VM_ENTRY_CONTROLS) & VM_ENTRY_IA32E_MODE); 8251 (vm_entry_controls_get(to_vmx(vcpu)) & VM_ENTRY_IA32E_MODE);
8190 8252
8191 /* TODO: These cannot have changed unless we have MSR bitmaps and 8253 /* TODO: These cannot have changed unless we have MSR bitmaps and
8192 * the relevant bit asks not to trap the change */ 8254 * the relevant bit asks not to trap the change */
@@ -8201,10 +8263,10 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
8201 8263
8202 /* update exit information fields: */ 8264 /* update exit information fields: */
8203 8265
8204 vmcs12->vm_exit_reason = to_vmx(vcpu)->exit_reason; 8266 vmcs12->vm_exit_reason = exit_reason;
8205 vmcs12->exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 8267 vmcs12->exit_qualification = exit_qualification;
8206 8268
8207 vmcs12->vm_exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); 8269 vmcs12->vm_exit_intr_info = exit_intr_info;
8208 if ((vmcs12->vm_exit_intr_info & 8270 if ((vmcs12->vm_exit_intr_info &
8209 (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK)) == 8271 (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK)) ==
8210 (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK)) 8272 (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK))
@@ -8370,7 +8432,9 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
8370 * and modify vmcs12 to make it see what it would expect to see there if 8432 * and modify vmcs12 to make it see what it would expect to see there if
8371 * L2 was its real guest. Must only be called when in L2 (is_guest_mode()) 8433 * L2 was its real guest. Must only be called when in L2 (is_guest_mode())
8372 */ 8434 */
8373static void nested_vmx_vmexit(struct kvm_vcpu *vcpu) 8435static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
8436 u32 exit_intr_info,
8437 unsigned long exit_qualification)
8374{ 8438{
8375 struct vcpu_vmx *vmx = to_vmx(vcpu); 8439 struct vcpu_vmx *vmx = to_vmx(vcpu);
8376 int cpu; 8440 int cpu;
@@ -8380,7 +8444,15 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
8380 WARN_ON_ONCE(vmx->nested.nested_run_pending); 8444 WARN_ON_ONCE(vmx->nested.nested_run_pending);
8381 8445
8382 leave_guest_mode(vcpu); 8446 leave_guest_mode(vcpu);
8383 prepare_vmcs12(vcpu, vmcs12); 8447 prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info,
8448 exit_qualification);
8449
8450 trace_kvm_nested_vmexit_inject(vmcs12->vm_exit_reason,
8451 vmcs12->exit_qualification,
8452 vmcs12->idt_vectoring_info_field,
8453 vmcs12->vm_exit_intr_info,
8454 vmcs12->vm_exit_intr_error_code,
8455 KVM_ISA_VMX);
8384 8456
8385 cpu = get_cpu(); 8457 cpu = get_cpu();
8386 vmx->loaded_vmcs = &vmx->vmcs01; 8458 vmx->loaded_vmcs = &vmx->vmcs01;
@@ -8389,6 +8461,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
8389 vcpu->cpu = cpu; 8461 vcpu->cpu = cpu;
8390 put_cpu(); 8462 put_cpu();
8391 8463
8464 vm_entry_controls_init(vmx, vmcs_read32(VM_ENTRY_CONTROLS));
8465 vm_exit_controls_init(vmx, vmcs_read32(VM_EXIT_CONTROLS));
8392 vmx_segment_cache_clear(vmx); 8466 vmx_segment_cache_clear(vmx);
8393 8467
8394 /* if no vmcs02 cache requested, remove the one we used */ 8468 /* if no vmcs02 cache requested, remove the one we used */
@@ -8424,6 +8498,16 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
8424} 8498}
8425 8499
8426/* 8500/*
8501 * Forcibly leave nested mode in order to be able to reset the VCPU later on.
8502 */
8503static void vmx_leave_nested(struct kvm_vcpu *vcpu)
8504{
8505 if (is_guest_mode(vcpu))
8506 nested_vmx_vmexit(vcpu, -1, 0, 0);
8507 free_nested(to_vmx(vcpu));
8508}
8509
8510/*
8427 * L1's failure to enter L2 is a subset of a normal exit, as explained in 8511 * L1's failure to enter L2 is a subset of a normal exit, as explained in
8428 * 23.7 "VM-entry failures during or after loading guest state" (this also 8512 * 23.7 "VM-entry failures during or after loading guest state" (this also
8429 * lists the acceptable exit-reason and exit-qualification parameters). 8513 * lists the acceptable exit-reason and exit-qualification parameters).
@@ -8486,6 +8570,8 @@ static struct kvm_x86_ops vmx_x86_ops = {
8486 .set_idt = vmx_set_idt, 8570 .set_idt = vmx_set_idt,
8487 .get_gdt = vmx_get_gdt, 8571 .get_gdt = vmx_get_gdt,
8488 .set_gdt = vmx_set_gdt, 8572 .set_gdt = vmx_set_gdt,
8573 .get_dr6 = vmx_get_dr6,
8574 .set_dr6 = vmx_set_dr6,
8489 .set_dr7 = vmx_set_dr7, 8575 .set_dr7 = vmx_set_dr7,
8490 .cache_reg = vmx_cache_reg, 8576 .cache_reg = vmx_cache_reg,
8491 .get_rflags = vmx_get_rflags, 8577 .get_rflags = vmx_get_rflags,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5d004da1e35d..39c28f09dfd5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -94,6 +94,9 @@ EXPORT_SYMBOL_GPL(kvm_x86_ops);
94static bool ignore_msrs = 0; 94static bool ignore_msrs = 0;
95module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR); 95module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
96 96
97unsigned int min_timer_period_us = 500;
98module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
99
97bool kvm_has_tsc_control; 100bool kvm_has_tsc_control;
98EXPORT_SYMBOL_GPL(kvm_has_tsc_control); 101EXPORT_SYMBOL_GPL(kvm_has_tsc_control);
99u32 kvm_max_guest_tsc_khz; 102u32 kvm_max_guest_tsc_khz;
@@ -254,10 +257,26 @@ u64 kvm_get_apic_base(struct kvm_vcpu *vcpu)
254} 257}
255EXPORT_SYMBOL_GPL(kvm_get_apic_base); 258EXPORT_SYMBOL_GPL(kvm_get_apic_base);
256 259
257void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data) 260int kvm_set_apic_base(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
258{ 261{
259 /* TODO: reserve bits check */ 262 u64 old_state = vcpu->arch.apic_base &
260 kvm_lapic_set_base(vcpu, data); 263 (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE);
264 u64 new_state = msr_info->data &
265 (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE);
266 u64 reserved_bits = ((~0ULL) << cpuid_maxphyaddr(vcpu)) |
267 0x2ff | (guest_cpuid_has_x2apic(vcpu) ? 0 : X2APIC_ENABLE);
268
269 if (!msr_info->host_initiated &&
270 ((msr_info->data & reserved_bits) != 0 ||
271 new_state == X2APIC_ENABLE ||
272 (new_state == MSR_IA32_APICBASE_ENABLE &&
273 old_state == (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE)) ||
274 (new_state == (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE) &&
275 old_state == 0)))
276 return 1;
277
278 kvm_lapic_set_base(vcpu, msr_info->data);
279 return 0;
261} 280}
262EXPORT_SYMBOL_GPL(kvm_set_apic_base); 281EXPORT_SYMBOL_GPL(kvm_set_apic_base);
263 282
@@ -719,6 +738,12 @@ unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu)
719} 738}
720EXPORT_SYMBOL_GPL(kvm_get_cr8); 739EXPORT_SYMBOL_GPL(kvm_get_cr8);
721 740
741static void kvm_update_dr6(struct kvm_vcpu *vcpu)
742{
743 if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP))
744 kvm_x86_ops->set_dr6(vcpu, vcpu->arch.dr6);
745}
746
722static void kvm_update_dr7(struct kvm_vcpu *vcpu) 747static void kvm_update_dr7(struct kvm_vcpu *vcpu)
723{ 748{
724 unsigned long dr7; 749 unsigned long dr7;
@@ -747,6 +772,7 @@ static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
747 if (val & 0xffffffff00000000ULL) 772 if (val & 0xffffffff00000000ULL)
748 return -1; /* #GP */ 773 return -1; /* #GP */
749 vcpu->arch.dr6 = (val & DR6_VOLATILE) | DR6_FIXED_1; 774 vcpu->arch.dr6 = (val & DR6_VOLATILE) | DR6_FIXED_1;
775 kvm_update_dr6(vcpu);
750 break; 776 break;
751 case 5: 777 case 5:
752 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) 778 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE))
@@ -788,7 +814,10 @@ static int _kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val)
788 return 1; 814 return 1;
789 /* fall through */ 815 /* fall through */
790 case 6: 816 case 6:
791 *val = vcpu->arch.dr6; 817 if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)
818 *val = vcpu->arch.dr6;
819 else
820 *val = kvm_x86_ops->get_dr6(vcpu);
792 break; 821 break;
793 case 5: 822 case 5:
794 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) 823 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE))
@@ -836,11 +865,12 @@ EXPORT_SYMBOL_GPL(kvm_rdpmc);
836 * kvm-specific. Those are put in the beginning of the list. 865 * kvm-specific. Those are put in the beginning of the list.
837 */ 866 */
838 867
839#define KVM_SAVE_MSRS_BEGIN 10 868#define KVM_SAVE_MSRS_BEGIN 12
840static u32 msrs_to_save[] = { 869static u32 msrs_to_save[] = {
841 MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK, 870 MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
842 MSR_KVM_SYSTEM_TIME_NEW, MSR_KVM_WALL_CLOCK_NEW, 871 MSR_KVM_SYSTEM_TIME_NEW, MSR_KVM_WALL_CLOCK_NEW,
843 HV_X64_MSR_GUEST_OS_ID, HV_X64_MSR_HYPERCALL, 872 HV_X64_MSR_GUEST_OS_ID, HV_X64_MSR_HYPERCALL,
873 HV_X64_MSR_TIME_REF_COUNT, HV_X64_MSR_REFERENCE_TSC,
844 HV_X64_MSR_APIC_ASSIST_PAGE, MSR_KVM_ASYNC_PF_EN, MSR_KVM_STEAL_TIME, 874 HV_X64_MSR_APIC_ASSIST_PAGE, MSR_KVM_ASYNC_PF_EN, MSR_KVM_STEAL_TIME,
845 MSR_KVM_PV_EOI_EN, 875 MSR_KVM_PV_EOI_EN,
846 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP, 876 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP,
@@ -1275,8 +1305,6 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr)
1275 kvm->arch.last_tsc_write = data; 1305 kvm->arch.last_tsc_write = data;
1276 kvm->arch.last_tsc_khz = vcpu->arch.virtual_tsc_khz; 1306 kvm->arch.last_tsc_khz = vcpu->arch.virtual_tsc_khz;
1277 1307
1278 /* Reset of TSC must disable overshoot protection below */
1279 vcpu->arch.hv_clock.tsc_timestamp = 0;
1280 vcpu->arch.last_guest_tsc = data; 1308 vcpu->arch.last_guest_tsc = data;
1281 1309
1282 /* Keep track of which generation this VCPU has synchronized to */ 1310 /* Keep track of which generation this VCPU has synchronized to */
@@ -1484,7 +1512,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
1484 unsigned long flags, this_tsc_khz; 1512 unsigned long flags, this_tsc_khz;
1485 struct kvm_vcpu_arch *vcpu = &v->arch; 1513 struct kvm_vcpu_arch *vcpu = &v->arch;
1486 struct kvm_arch *ka = &v->kvm->arch; 1514 struct kvm_arch *ka = &v->kvm->arch;
1487 s64 kernel_ns, max_kernel_ns; 1515 s64 kernel_ns;
1488 u64 tsc_timestamp, host_tsc; 1516 u64 tsc_timestamp, host_tsc;
1489 struct pvclock_vcpu_time_info guest_hv_clock; 1517 struct pvclock_vcpu_time_info guest_hv_clock;
1490 u8 pvclock_flags; 1518 u8 pvclock_flags;
@@ -1543,37 +1571,6 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
1543 if (!vcpu->pv_time_enabled) 1571 if (!vcpu->pv_time_enabled)
1544 return 0; 1572 return 0;
1545 1573
1546 /*
1547 * Time as measured by the TSC may go backwards when resetting the base
1548 * tsc_timestamp. The reason for this is that the TSC resolution is
1549 * higher than the resolution of the other clock scales. Thus, many
1550 * possible measurments of the TSC correspond to one measurement of any
1551 * other clock, and so a spread of values is possible. This is not a
1552 * problem for the computation of the nanosecond clock; with TSC rates
1553 * around 1GHZ, there can only be a few cycles which correspond to one
1554 * nanosecond value, and any path through this code will inevitably
1555 * take longer than that. However, with the kernel_ns value itself,
1556 * the precision may be much lower, down to HZ granularity. If the
1557 * first sampling of TSC against kernel_ns ends in the low part of the
1558 * range, and the second in the high end of the range, we can get:
1559 *
1560 * (TSC - offset_low) * S + kns_old > (TSC - offset_high) * S + kns_new
1561 *
1562 * As the sampling errors potentially range in the thousands of cycles,
1563 * it is possible such a time value has already been observed by the
1564 * guest. To protect against this, we must compute the system time as
1565 * observed by the guest and ensure the new system time is greater.
1566 */
1567 max_kernel_ns = 0;
1568 if (vcpu->hv_clock.tsc_timestamp) {
1569 max_kernel_ns = vcpu->last_guest_tsc -
1570 vcpu->hv_clock.tsc_timestamp;
1571 max_kernel_ns = pvclock_scale_delta(max_kernel_ns,
1572 vcpu->hv_clock.tsc_to_system_mul,
1573 vcpu->hv_clock.tsc_shift);
1574 max_kernel_ns += vcpu->last_kernel_ns;
1575 }
1576
1577 if (unlikely(vcpu->hw_tsc_khz != this_tsc_khz)) { 1574 if (unlikely(vcpu->hw_tsc_khz != this_tsc_khz)) {
1578 kvm_get_time_scale(NSEC_PER_SEC / 1000, this_tsc_khz, 1575 kvm_get_time_scale(NSEC_PER_SEC / 1000, this_tsc_khz,
1579 &vcpu->hv_clock.tsc_shift, 1576 &vcpu->hv_clock.tsc_shift,
@@ -1581,14 +1578,6 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
1581 vcpu->hw_tsc_khz = this_tsc_khz; 1578 vcpu->hw_tsc_khz = this_tsc_khz;
1582 } 1579 }
1583 1580
1584 /* with a master <monotonic time, tsc value> tuple,
1585 * pvclock clock reads always increase at the (scaled) rate
1586 * of guest TSC - no need to deal with sampling errors.
1587 */
1588 if (!use_master_clock) {
1589 if (max_kernel_ns > kernel_ns)
1590 kernel_ns = max_kernel_ns;
1591 }
1592 /* With all the info we got, fill in the values */ 1581 /* With all the info we got, fill in the values */
1593 vcpu->hv_clock.tsc_timestamp = tsc_timestamp; 1582 vcpu->hv_clock.tsc_timestamp = tsc_timestamp;
1594 vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; 1583 vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
@@ -1826,6 +1815,8 @@ static bool kvm_hv_msr_partition_wide(u32 msr)
1826 switch (msr) { 1815 switch (msr) {
1827 case HV_X64_MSR_GUEST_OS_ID: 1816 case HV_X64_MSR_GUEST_OS_ID:
1828 case HV_X64_MSR_HYPERCALL: 1817 case HV_X64_MSR_HYPERCALL:
1818 case HV_X64_MSR_REFERENCE_TSC:
1819 case HV_X64_MSR_TIME_REF_COUNT:
1829 r = true; 1820 r = true;
1830 break; 1821 break;
1831 } 1822 }
@@ -1865,6 +1856,21 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1865 if (__copy_to_user((void __user *)addr, instructions, 4)) 1856 if (__copy_to_user((void __user *)addr, instructions, 4))
1866 return 1; 1857 return 1;
1867 kvm->arch.hv_hypercall = data; 1858 kvm->arch.hv_hypercall = data;
1859 mark_page_dirty(kvm, gfn);
1860 break;
1861 }
1862 case HV_X64_MSR_REFERENCE_TSC: {
1863 u64 gfn;
1864 HV_REFERENCE_TSC_PAGE tsc_ref;
1865 memset(&tsc_ref, 0, sizeof(tsc_ref));
1866 kvm->arch.hv_tsc_page = data;
1867 if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE))
1868 break;
1869 gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT;
1870 if (kvm_write_guest(kvm, data,
1871 &tsc_ref, sizeof(tsc_ref)))
1872 return 1;
1873 mark_page_dirty(kvm, gfn);
1868 break; 1874 break;
1869 } 1875 }
1870 default: 1876 default:
@@ -1879,19 +1885,21 @@ static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1879{ 1885{
1880 switch (msr) { 1886 switch (msr) {
1881 case HV_X64_MSR_APIC_ASSIST_PAGE: { 1887 case HV_X64_MSR_APIC_ASSIST_PAGE: {
1888 u64 gfn;
1882 unsigned long addr; 1889 unsigned long addr;
1883 1890
1884 if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) { 1891 if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) {
1885 vcpu->arch.hv_vapic = data; 1892 vcpu->arch.hv_vapic = data;
1886 break; 1893 break;
1887 } 1894 }
1888 addr = gfn_to_hva(vcpu->kvm, data >> 1895 gfn = data >> HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT;
1889 HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT); 1896 addr = gfn_to_hva(vcpu->kvm, gfn);
1890 if (kvm_is_error_hva(addr)) 1897 if (kvm_is_error_hva(addr))
1891 return 1; 1898 return 1;
1892 if (__clear_user((void __user *)addr, PAGE_SIZE)) 1899 if (__clear_user((void __user *)addr, PAGE_SIZE))
1893 return 1; 1900 return 1;
1894 vcpu->arch.hv_vapic = data; 1901 vcpu->arch.hv_vapic = data;
1902 mark_page_dirty(vcpu->kvm, gfn);
1895 break; 1903 break;
1896 } 1904 }
1897 case HV_X64_MSR_EOI: 1905 case HV_X64_MSR_EOI:
@@ -2017,8 +2025,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2017 case 0x200 ... 0x2ff: 2025 case 0x200 ... 0x2ff:
2018 return set_msr_mtrr(vcpu, msr, data); 2026 return set_msr_mtrr(vcpu, msr, data);
2019 case MSR_IA32_APICBASE: 2027 case MSR_IA32_APICBASE:
2020 kvm_set_apic_base(vcpu, data); 2028 return kvm_set_apic_base(vcpu, msr_info);
2021 break;
2022 case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff: 2029 case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
2023 return kvm_x2apic_msr_write(vcpu, msr, data); 2030 return kvm_x2apic_msr_write(vcpu, msr, data);
2024 case MSR_IA32_TSCDEADLINE: 2031 case MSR_IA32_TSCDEADLINE:
@@ -2291,6 +2298,14 @@ static int get_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
2291 case HV_X64_MSR_HYPERCALL: 2298 case HV_X64_MSR_HYPERCALL:
2292 data = kvm->arch.hv_hypercall; 2299 data = kvm->arch.hv_hypercall;
2293 break; 2300 break;
2301 case HV_X64_MSR_TIME_REF_COUNT: {
2302 data =
2303 div_u64(get_kernel_ns() + kvm->arch.kvmclock_offset, 100);
2304 break;
2305 }
2306 case HV_X64_MSR_REFERENCE_TSC:
2307 data = kvm->arch.hv_tsc_page;
2308 break;
2294 default: 2309 default:
2295 vcpu_unimpl(vcpu, "Hyper-V unhandled rdmsr: 0x%x\n", msr); 2310 vcpu_unimpl(vcpu, "Hyper-V unhandled rdmsr: 0x%x\n", msr);
2296 return 1; 2311 return 1;
@@ -2601,6 +2616,7 @@ int kvm_dev_ioctl_check_extension(long ext)
2601 case KVM_CAP_GET_TSC_KHZ: 2616 case KVM_CAP_GET_TSC_KHZ:
2602 case KVM_CAP_KVMCLOCK_CTRL: 2617 case KVM_CAP_KVMCLOCK_CTRL:
2603 case KVM_CAP_READONLY_MEM: 2618 case KVM_CAP_READONLY_MEM:
2619 case KVM_CAP_HYPERV_TIME:
2604#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT 2620#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
2605 case KVM_CAP_ASSIGN_DEV_IRQ: 2621 case KVM_CAP_ASSIGN_DEV_IRQ:
2606 case KVM_CAP_PCI_2_3: 2622 case KVM_CAP_PCI_2_3:
@@ -2972,8 +2988,11 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
2972static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu, 2988static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu,
2973 struct kvm_debugregs *dbgregs) 2989 struct kvm_debugregs *dbgregs)
2974{ 2990{
2991 unsigned long val;
2992
2975 memcpy(dbgregs->db, vcpu->arch.db, sizeof(vcpu->arch.db)); 2993 memcpy(dbgregs->db, vcpu->arch.db, sizeof(vcpu->arch.db));
2976 dbgregs->dr6 = vcpu->arch.dr6; 2994 _kvm_get_dr(vcpu, 6, &val);
2995 dbgregs->dr6 = val;
2977 dbgregs->dr7 = vcpu->arch.dr7; 2996 dbgregs->dr7 = vcpu->arch.dr7;
2978 dbgregs->flags = 0; 2997 dbgregs->flags = 0;
2979 memset(&dbgregs->reserved, 0, sizeof(dbgregs->reserved)); 2998 memset(&dbgregs->reserved, 0, sizeof(dbgregs->reserved));
@@ -2987,7 +3006,9 @@ static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu,
2987 3006
2988 memcpy(vcpu->arch.db, dbgregs->db, sizeof(vcpu->arch.db)); 3007 memcpy(vcpu->arch.db, dbgregs->db, sizeof(vcpu->arch.db));
2989 vcpu->arch.dr6 = dbgregs->dr6; 3008 vcpu->arch.dr6 = dbgregs->dr6;
3009 kvm_update_dr6(vcpu);
2990 vcpu->arch.dr7 = dbgregs->dr7; 3010 vcpu->arch.dr7 = dbgregs->dr7;
3011 kvm_update_dr7(vcpu);
2991 3012
2992 return 0; 3013 return 0;
2993} 3014}
@@ -5834,6 +5855,11 @@ static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
5834 kvm_apic_update_tmr(vcpu, tmr); 5855 kvm_apic_update_tmr(vcpu, tmr);
5835} 5856}
5836 5857
5858/*
5859 * Returns 1 to let __vcpu_run() continue the guest execution loop without
5860 * exiting to the userspace. Otherwise, the value will be returned to the
5861 * userspace.
5862 */
5837static int vcpu_enter_guest(struct kvm_vcpu *vcpu) 5863static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5838{ 5864{
5839 int r; 5865 int r;
@@ -6089,7 +6115,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
6089 } 6115 }
6090 if (need_resched()) { 6116 if (need_resched()) {
6091 srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); 6117 srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
6092 kvm_resched(vcpu); 6118 cond_resched();
6093 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); 6119 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
6094 } 6120 }
6095 } 6121 }
@@ -6401,6 +6427,7 @@ EXPORT_SYMBOL_GPL(kvm_task_switch);
6401int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 6427int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
6402 struct kvm_sregs *sregs) 6428 struct kvm_sregs *sregs)
6403{ 6429{
6430 struct msr_data apic_base_msr;
6404 int mmu_reset_needed = 0; 6431 int mmu_reset_needed = 0;
6405 int pending_vec, max_bits, idx; 6432 int pending_vec, max_bits, idx;
6406 struct desc_ptr dt; 6433 struct desc_ptr dt;
@@ -6424,7 +6451,9 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
6424 6451
6425 mmu_reset_needed |= vcpu->arch.efer != sregs->efer; 6452 mmu_reset_needed |= vcpu->arch.efer != sregs->efer;
6426 kvm_x86_ops->set_efer(vcpu, sregs->efer); 6453 kvm_x86_ops->set_efer(vcpu, sregs->efer);
6427 kvm_set_apic_base(vcpu, sregs->apic_base); 6454 apic_base_msr.data = sregs->apic_base;
6455 apic_base_msr.host_initiated = true;
6456 kvm_set_apic_base(vcpu, &apic_base_msr);
6428 6457
6429 mmu_reset_needed |= kvm_read_cr0(vcpu) != sregs->cr0; 6458 mmu_reset_needed |= kvm_read_cr0(vcpu) != sregs->cr0;
6430 kvm_x86_ops->set_cr0(vcpu, sregs->cr0); 6459 kvm_x86_ops->set_cr0(vcpu, sregs->cr0);
@@ -6717,6 +6746,7 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu)
6717 6746
6718 memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db)); 6747 memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db));
6719 vcpu->arch.dr6 = DR6_FIXED_1; 6748 vcpu->arch.dr6 = DR6_FIXED_1;
6749 kvm_update_dr6(vcpu);
6720 vcpu->arch.dr7 = DR7_FIXED_1; 6750 vcpu->arch.dr7 = DR7_FIXED_1;
6721 kvm_update_dr7(vcpu); 6751 kvm_update_dr7(vcpu);
6722 6752
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 587fb9ede436..8da5823bcde6 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -125,5 +125,7 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,
125#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM) 125#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM)
126extern u64 host_xcr0; 126extern u64 host_xcr0;
127 127
128extern unsigned int min_timer_period_us;
129
128extern struct static_key kvm_no_apic_vcpu; 130extern struct static_key kvm_no_apic_vcpu;
129#endif 131#endif
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index bdf8532494fe..ad1fb5f53925 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -233,13 +233,13 @@ static void lguest_end_context_switch(struct task_struct *next)
233 * flags word contains all kind of stuff, but in practice Linux only cares 233 * flags word contains all kind of stuff, but in practice Linux only cares
234 * about the interrupt flag. Our "save_flags()" just returns that. 234 * about the interrupt flag. Our "save_flags()" just returns that.
235 */ 235 */
236static unsigned long save_fl(void) 236asmlinkage unsigned long lguest_save_fl(void)
237{ 237{
238 return lguest_data.irq_enabled; 238 return lguest_data.irq_enabled;
239} 239}
240 240
241/* Interrupts go off... */ 241/* Interrupts go off... */
242static void irq_disable(void) 242asmlinkage void lguest_irq_disable(void)
243{ 243{
244 lguest_data.irq_enabled = 0; 244 lguest_data.irq_enabled = 0;
245} 245}
@@ -253,8 +253,8 @@ static void irq_disable(void)
253 * PV_CALLEE_SAVE_REGS_THUNK(), which pushes %eax onto the stack, calls the 253 * PV_CALLEE_SAVE_REGS_THUNK(), which pushes %eax onto the stack, calls the
254 * C function, then restores it. 254 * C function, then restores it.
255 */ 255 */
256PV_CALLEE_SAVE_REGS_THUNK(save_fl); 256PV_CALLEE_SAVE_REGS_THUNK(lguest_save_fl);
257PV_CALLEE_SAVE_REGS_THUNK(irq_disable); 257PV_CALLEE_SAVE_REGS_THUNK(lguest_irq_disable);
258/*:*/ 258/*:*/
259 259
260/* These are in i386_head.S */ 260/* These are in i386_head.S */
@@ -1291,9 +1291,9 @@ __init void lguest_init(void)
1291 */ 1291 */
1292 1292
1293 /* Interrupt-related operations */ 1293 /* Interrupt-related operations */
1294 pv_irq_ops.save_fl = PV_CALLEE_SAVE(save_fl); 1294 pv_irq_ops.save_fl = PV_CALLEE_SAVE(lguest_save_fl);
1295 pv_irq_ops.restore_fl = __PV_IS_CALLEE_SAVE(lg_restore_fl); 1295 pv_irq_ops.restore_fl = __PV_IS_CALLEE_SAVE(lg_restore_fl);
1296 pv_irq_ops.irq_disable = PV_CALLEE_SAVE(irq_disable); 1296 pv_irq_ops.irq_disable = PV_CALLEE_SAVE(lguest_irq_disable);
1297 pv_irq_ops.irq_enable = __PV_IS_CALLEE_SAVE(lg_irq_enable); 1297 pv_irq_ops.irq_enable = __PV_IS_CALLEE_SAVE(lg_irq_enable);
1298 pv_irq_ops.safe_halt = lguest_safe_halt; 1298 pv_irq_ops.safe_halt = lguest_safe_halt;
1299 1299
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 992d63bb154f..eabcb6e6a900 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -24,7 +24,7 @@ lib-$(CONFIG_SMP) += rwlock.o
24lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o 24lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
25lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o 25lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o
26 26
27obj-y += msr.o msr-reg.o msr-reg-export.o 27obj-y += msr.o msr-reg.o msr-reg-export.o hash.o
28 28
29ifeq ($(CONFIG_X86_32),y) 29ifeq ($(CONFIG_X86_32),y)
30 obj-y += atomic64_32.o 30 obj-y += atomic64_32.o
diff --git a/arch/x86/lib/hash.c b/arch/x86/lib/hash.c
new file mode 100644
index 000000000000..3056702e81fb
--- /dev/null
+++ b/arch/x86/lib/hash.c
@@ -0,0 +1,88 @@
1/*
2 * Some portions derived from code covered by the following notice:
3 *
4 * Copyright (c) 2010-2013 Intel Corporation. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include <linux/hash.h>
35
36#include <asm/processor.h>
37#include <asm/cpufeature.h>
38#include <asm/hash.h>
39
40static inline u32 crc32_u32(u32 crc, u32 val)
41{
42 asm ("crc32l %1,%0\n" : "+r" (crc) : "rm" (val));
43 return crc;
44}
45
46static u32 intel_crc4_2_hash(const void *data, u32 len, u32 seed)
47{
48 const u32 *p32 = (const u32 *) data;
49 u32 i, tmp = 0;
50
51 for (i = 0; i < len / 4; i++)
52 seed = crc32_u32(*p32++, seed);
53
54 switch (3 - (len & 0x03)) {
55 case 0:
56 tmp |= *((const u8 *) p32 + 2) << 16;
57 /* fallthrough */
58 case 1:
59 tmp |= *((const u8 *) p32 + 1) << 8;
60 /* fallthrough */
61 case 2:
62 tmp |= *((const u8 *) p32);
63 seed = crc32_u32(tmp, seed);
64 default:
65 break;
66 }
67
68 return seed;
69}
70
71static u32 intel_crc4_2_hash2(const u32 *data, u32 len, u32 seed)
72{
73 const u32 *p32 = (const u32 *) data;
74 u32 i;
75
76 for (i = 0; i < len; i++)
77 seed = crc32_u32(*p32++, seed);
78
79 return seed;
80}
81
82void setup_arch_fast_hash(struct fast_hash_ops *ops)
83{
84 if (cpu_has_xmm4_2) {
85 ops->hash = intel_crc4_2_hash;
86 ops->hash2 = intel_crc4_2_hash2;
87 }
88}
diff --git a/arch/x86/math-emu/errors.c b/arch/x86/math-emu/errors.c
index 59d353d2c599..a5449089cd9f 100644
--- a/arch/x86/math-emu/errors.c
+++ b/arch/x86/math-emu/errors.c
@@ -330,11 +330,6 @@ asmlinkage void FPU_exception(int n)
330 330
331 RE_ENTRANT_CHECK_OFF; 331 RE_ENTRANT_CHECK_OFF;
332 if ((~control_word & n & CW_Exceptions) || (n == EX_INTERNAL)) { 332 if ((~control_word & n & CW_Exceptions) || (n == EX_INTERNAL)) {
333#ifdef PRINT_MESSAGES
334 /* My message from the sponsor */
335 printk(FPU_VERSION " " __DATE__ " (C) W. Metzenthen.\n");
336#endif /* PRINT_MESSAGES */
337
338 /* Get a name string for error reporting */ 333 /* Get a name string for error reporting */
339 for (i = 0; exception_names[i].type; i++) 334 for (i = 0; exception_names[i].type; i++)
340 if ((exception_names[i].type & n) == 335 if ((exception_names[i].type & n) ==
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 0596e8e0cc19..207d9aef662d 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -108,8 +108,8 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
108 108
109static inline void get_head_page_multiple(struct page *page, int nr) 109static inline void get_head_page_multiple(struct page *page, int nr)
110{ 110{
111 VM_BUG_ON(page != compound_head(page)); 111 VM_BUG_ON_PAGE(page != compound_head(page), page);
112 VM_BUG_ON(page_count(page) == 0); 112 VM_BUG_ON_PAGE(page_count(page) == 0, page);
113 atomic_add(nr, &page->_count); 113 atomic_add(nr, &page->_count);
114 SetPageReferenced(page); 114 SetPageReferenced(page);
115} 115}
@@ -135,7 +135,7 @@ static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr,
135 head = pte_page(pte); 135 head = pte_page(pte);
136 page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT); 136 page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
137 do { 137 do {
138 VM_BUG_ON(compound_head(page) != head); 138 VM_BUG_ON_PAGE(compound_head(page) != head, page);
139 pages[*nr] = page; 139 pages[*nr] = page;
140 if (PageTail(page)) 140 if (PageTail(page))
141 get_huge_page_tail(page); 141 get_huge_page_tail(page);
@@ -212,7 +212,7 @@ static noinline int gup_huge_pud(pud_t pud, unsigned long addr,
212 head = pte_page(pte); 212 head = pte_page(pte);
213 page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT); 213 page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
214 do { 214 do {
215 VM_BUG_ON(compound_head(page) != head); 215 VM_BUG_ON_PAGE(compound_head(page) != head, page);
216 pages[*nr] = page; 216 pages[*nr] = page;
217 if (PageTail(page)) 217 if (PageTail(page))
218 get_huge_page_tail(page); 218 get_huge_page_tail(page);
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 5bdc5430597c..e39504878aec 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -665,7 +665,7 @@ void __init initmem_init(void)
665 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 665 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
666#endif 666#endif
667 667
668 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 668 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
669 sparse_memory_present_with_active_regions(0); 669 sparse_memory_present_with_active_regions(0);
670 670
671#ifdef CONFIG_FLATMEM 671#ifdef CONFIG_FLATMEM
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 104d56a9245f..f35c66c5959a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -643,7 +643,7 @@ kernel_physical_mapping_init(unsigned long start,
643#ifndef CONFIG_NUMA 643#ifndef CONFIG_NUMA
644void __init initmem_init(void) 644void __init initmem_init(void)
645{ 645{
646 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 646 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
647} 647}
648#endif 648#endif
649 649
diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
index 8dabbed409ee..1e9da795767a 100644
--- a/arch/x86/mm/memtest.c
+++ b/arch/x86/mm/memtest.c
@@ -74,7 +74,7 @@ static void __init do_one_pass(u64 pattern, u64 start, u64 end)
74 u64 i; 74 u64 i;
75 phys_addr_t this_start, this_end; 75 phys_addr_t this_start, this_end;
76 76
77 for_each_free_mem_range(i, MAX_NUMNODES, &this_start, &this_end, NULL) { 77 for_each_free_mem_range(i, NUMA_NO_NODE, &this_start, &this_end, NULL) {
78 this_start = clamp_t(phys_addr_t, this_start, start, end); 78 this_start = clamp_t(phys_addr_t, this_start, start, end);
79 this_end = clamp_t(phys_addr_t, this_end, start, end); 79 this_end = clamp_t(phys_addr_t, this_end, start, end);
80 if (this_start < this_end) { 80 if (this_start < this_end) {
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index c85da7bb6b60..81b2750f3666 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -491,7 +491,16 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
491 491
492 for (i = 0; i < mi->nr_blks; i++) { 492 for (i = 0; i < mi->nr_blks; i++) {
493 struct numa_memblk *mb = &mi->blk[i]; 493 struct numa_memblk *mb = &mi->blk[i];
494 memblock_set_node(mb->start, mb->end - mb->start, mb->nid); 494 memblock_set_node(mb->start, mb->end - mb->start,
495 &memblock.memory, mb->nid);
496
497 /*
498 * At this time, all memory regions reserved by memblock are
499 * used by the kernel. Set the nid in memblock.reserved will
500 * mark out all the nodes the kernel resides in.
501 */
502 memblock_set_node(mb->start, mb->end - mb->start,
503 &memblock.reserved, mb->nid);
495 } 504 }
496 505
497 /* 506 /*
@@ -553,6 +562,30 @@ static void __init numa_init_array(void)
553 } 562 }
554} 563}
555 564
565static void __init numa_clear_kernel_node_hotplug(void)
566{
567 int i, nid;
568 nodemask_t numa_kernel_nodes;
569 unsigned long start, end;
570 struct memblock_type *type = &memblock.reserved;
571
572 /* Mark all kernel nodes. */
573 for (i = 0; i < type->cnt; i++)
574 node_set(type->regions[i].nid, numa_kernel_nodes);
575
576 /* Clear MEMBLOCK_HOTPLUG flag for memory in kernel nodes. */
577 for (i = 0; i < numa_meminfo.nr_blks; i++) {
578 nid = numa_meminfo.blk[i].nid;
579 if (!node_isset(nid, numa_kernel_nodes))
580 continue;
581
582 start = numa_meminfo.blk[i].start;
583 end = numa_meminfo.blk[i].end;
584
585 memblock_clear_hotplug(start, end - start);
586 }
587}
588
556static int __init numa_init(int (*init_func)(void)) 589static int __init numa_init(int (*init_func)(void))
557{ 590{
558 int i; 591 int i;
@@ -565,7 +598,12 @@ static int __init numa_init(int (*init_func)(void))
565 nodes_clear(node_possible_map); 598 nodes_clear(node_possible_map);
566 nodes_clear(node_online_map); 599 nodes_clear(node_online_map);
567 memset(&numa_meminfo, 0, sizeof(numa_meminfo)); 600 memset(&numa_meminfo, 0, sizeof(numa_meminfo));
568 WARN_ON(memblock_set_node(0, ULLONG_MAX, MAX_NUMNODES)); 601 WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory,
602 MAX_NUMNODES));
603 WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.reserved,
604 MAX_NUMNODES));
605 /* In case that parsing SRAT failed. */
606 WARN_ON(memblock_clear_hotplug(0, ULLONG_MAX));
569 numa_reset_distance(); 607 numa_reset_distance();
570 608
571 ret = init_func(); 609 ret = init_func();
@@ -601,6 +639,16 @@ static int __init numa_init(int (*init_func)(void))
601 numa_clear_node(i); 639 numa_clear_node(i);
602 } 640 }
603 numa_init_array(); 641 numa_init_array();
642
643 /*
644 * At very early time, the kernel have to use some memory such as
645 * loading the kernel image. We cannot prevent this anyway. So any
646 * node the kernel resides in should be un-hotpluggable.
647 *
648 * And when we come here, numa_init() won't fail.
649 */
650 numa_clear_kernel_node_hotplug();
651
604 return 0; 652 return 0;
605} 653}
606 654
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 5ecf65117e6f..1953e9c9391a 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -191,6 +191,11 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
191 (unsigned long long) start, (unsigned long long) end - 1, 191 (unsigned long long) start, (unsigned long long) end - 1,
192 hotpluggable ? " hotplug" : ""); 192 hotpluggable ? " hotplug" : "");
193 193
194 /* Mark hotplug range in memblock. */
195 if (hotpluggable && memblock_mark_hotplug(start, ma->length))
196 pr_warn("SRAT: Failed to mark hotplug range [mem %#010Lx-%#010Lx] in memblock\n",
197 (unsigned long long)start, (unsigned long long)end - 1);
198
194 return 0; 199 return 0;
195out_err_bad_srat: 200out_err_bad_srat:
196 bad_srat(); 201 bad_srat();
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 082e88129712..248642f4bab7 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/acpi.h>
16#include <linux/sfi_acpi.h> 15#include <linux/sfi_acpi.h>
17#include <linux/bitmap.h> 16#include <linux/bitmap.h>
18#include <linux/dmi.h> 17#include <linux/dmi.h>
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c
index 5c90975cdf0f..43984bc1665a 100644
--- a/arch/x86/pci/mmconfig_32.c
+++ b/arch/x86/pci/mmconfig_32.c
@@ -14,7 +14,6 @@
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <asm/e820.h> 15#include <asm/e820.h>
16#include <asm/pci_x86.h> 16#include <asm/pci_x86.h>
17#include <acpi/acpi.h>
18 17
19/* Assume systems with more busses have correct MCFG */ 18/* Assume systems with more busses have correct MCFG */
20#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) 19#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 5eee4959785d..103e702ec5a7 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -337,7 +337,7 @@ out:
337 return ret; 337 return ret;
338} 338}
339 339
340static void xen_initdom_restore_msi_irqs(struct pci_dev *dev, int irq) 340static void xen_initdom_restore_msi_irqs(struct pci_dev *dev)
341{ 341{
342 int ret = 0; 342 int ret = 0;
343 343
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index 7145ec63c520..4df9591eadad 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -49,7 +49,8 @@ void __init efi_bgrt_init(void)
49 49
50 image = efi_lookup_mapped_addr(bgrt_tab->image_address); 50 image = efi_lookup_mapped_addr(bgrt_tab->image_address);
51 if (!image) { 51 if (!image) {
52 image = ioremap(bgrt_tab->image_address, sizeof(bmp_header)); 52 image = early_memremap(bgrt_tab->image_address,
53 sizeof(bmp_header));
53 ioremapped = true; 54 ioremapped = true;
54 if (!image) 55 if (!image)
55 return; 56 return;
@@ -57,7 +58,7 @@ void __init efi_bgrt_init(void)
57 58
58 memcpy_fromio(&bmp_header, image, sizeof(bmp_header)); 59 memcpy_fromio(&bmp_header, image, sizeof(bmp_header));
59 if (ioremapped) 60 if (ioremapped)
60 iounmap(image); 61 early_iounmap(image, sizeof(bmp_header));
61 bgrt_image_size = bmp_header.size; 62 bgrt_image_size = bmp_header.size;
62 63
63 bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL); 64 bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL);
@@ -65,7 +66,8 @@ void __init efi_bgrt_init(void)
65 return; 66 return;
66 67
67 if (ioremapped) { 68 if (ioremapped) {
68 image = ioremap(bgrt_tab->image_address, bmp_header.size); 69 image = early_memremap(bgrt_tab->image_address,
70 bmp_header.size);
69 if (!image) { 71 if (!image) {
70 kfree(bgrt_image); 72 kfree(bgrt_image);
71 bgrt_image = NULL; 73 bgrt_image = NULL;
@@ -75,5 +77,5 @@ void __init efi_bgrt_init(void)
75 77
76 memcpy_fromio(bgrt_image, image, bgrt_image_size); 78 memcpy_fromio(bgrt_image, image, bgrt_image_size);
77 if (ioremapped) 79 if (ioremapped)
78 iounmap(image); 80 early_iounmap(image, bmp_header.size);
79} 81}
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_ipc.h b/arch/x86/platform/intel-mid/device_libs/platform_ipc.h
index 8f568dd79605..79bb09d4f718 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_ipc.h
+++ b/arch/x86/platform/intel-mid/device_libs/platform_ipc.h
@@ -12,6 +12,7 @@
12#ifndef _PLATFORM_IPC_H_ 12#ifndef _PLATFORM_IPC_H_
13#define _PLATFORM_IPC_H_ 13#define _PLATFORM_IPC_H_
14 14
15extern void __init ipc_device_handler(struct sfi_device_table_entry *pentry, 15void __init
16 struct devs_id *dev) __attribute__((weak)); 16ipc_device_handler(struct sfi_device_table_entry *pentry, struct devs_id *dev);
17
17#endif 18#endif
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_msic.h b/arch/x86/platform/intel-mid/device_libs/platform_msic.h
index 917eb56d77da..b7be1d041da2 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_msic.h
+++ b/arch/x86/platform/intel-mid/device_libs/platform_msic.h
@@ -14,6 +14,6 @@
14 14
15extern struct intel_msic_platform_data msic_pdata; 15extern struct intel_msic_platform_data msic_pdata;
16 16
17extern void *msic_generic_platform_data(void *info, 17void *msic_generic_platform_data(void *info, enum intel_msic_block block);
18 enum intel_msic_block block) __attribute__((weak)); 18
19#endif 19#endif
diff --git a/arch/x86/platform/intel-mid/intel_mid_weak_decls.h b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h
index a537ffc16299..46aa25c8ce06 100644
--- a/arch/x86/platform/intel-mid/intel_mid_weak_decls.h
+++ b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h
@@ -14,6 +14,6 @@
14/* For every CPU addition a new get_<cpuname>_ops interface needs 14/* For every CPU addition a new get_<cpuname>_ops interface needs
15 * to be added. 15 * to be added.
16 */ 16 */
17extern void * __cpuinit get_penwell_ops(void) __attribute__((weak)); 17extern void *get_penwell_ops(void) __attribute__((weak));
18extern void * __cpuinit get_cloverview_ops(void) __attribute__((weak)); 18extern void *get_cloverview_ops(void) __attribute__((weak));
19extern void * __init get_tangier_ops(void) __attribute__((weak)); 19extern void *get_tangier_ops(void) __attribute__((weak));
diff --git a/arch/x86/platform/intel-mid/mfld.c b/arch/x86/platform/intel-mid/mfld.c
index 4f7884eebc14..23381d2174ae 100644
--- a/arch/x86/platform/intel-mid/mfld.c
+++ b/arch/x86/platform/intel-mid/mfld.c
@@ -58,18 +58,18 @@ static unsigned long __init mfld_calibrate_tsc(void)
58 return 0; 58 return 0;
59} 59}
60 60
61static void __init penwell_arch_setup() 61static void __init penwell_arch_setup(void)
62{ 62{
63 x86_platform.calibrate_tsc = mfld_calibrate_tsc; 63 x86_platform.calibrate_tsc = mfld_calibrate_tsc;
64 pm_power_off = mfld_power_off; 64 pm_power_off = mfld_power_off;
65} 65}
66 66
67void * __cpuinit get_penwell_ops() 67void *get_penwell_ops(void)
68{ 68{
69 return &penwell_ops; 69 return &penwell_ops;
70} 70}
71 71
72void * __cpuinit get_cloverview_ops() 72void *get_cloverview_ops(void)
73{ 73{
74 return &penwell_ops; 74 return &penwell_ops;
75} 75}
diff --git a/arch/x86/platform/intel-mid/mrfl.c b/arch/x86/platform/intel-mid/mrfl.c
index 09d10159e7b7..aaca91753d32 100644
--- a/arch/x86/platform/intel-mid/mrfl.c
+++ b/arch/x86/platform/intel-mid/mrfl.c
@@ -97,7 +97,7 @@ static struct intel_mid_ops tangier_ops = {
97 .arch_setup = tangier_arch_setup, 97 .arch_setup = tangier_arch_setup,
98}; 98};
99 99
100void * __cpuinit get_tangier_ops() 100void *get_tangier_ops(void)
101{ 101{
102 return &tangier_ops; 102 return &tangier_ops;
103} 103}
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 649a12befba9..08e350e757dc 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -15,8 +15,7 @@
15#include <linux/power_supply.h> 15#include <linux/power_supply.h>
16#include <linux/olpc-ec.h> 16#include <linux/olpc-ec.h>
17 17
18#include <acpi/acpi_bus.h> 18#include <linux/acpi.h>
19#include <acpi/acpi_drivers.h>
20#include <asm/olpc.h> 19#include <asm/olpc.h>
21 20
22#define DRV_NAME "olpc-xo15-sci" 21#define DRV_NAME "olpc-xo15-sci"
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index 8eeccba73130..be27da60dc8f 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -74,7 +74,6 @@ static atomic_t uv_in_nmi;
74static atomic_t uv_nmi_cpu = ATOMIC_INIT(-1); 74static atomic_t uv_nmi_cpu = ATOMIC_INIT(-1);
75static atomic_t uv_nmi_cpus_in_nmi = ATOMIC_INIT(-1); 75static atomic_t uv_nmi_cpus_in_nmi = ATOMIC_INIT(-1);
76static atomic_t uv_nmi_slave_continue; 76static atomic_t uv_nmi_slave_continue;
77static atomic_t uv_nmi_kexec_failed;
78static cpumask_var_t uv_nmi_cpu_mask; 77static cpumask_var_t uv_nmi_cpu_mask;
79 78
80/* Values for uv_nmi_slave_continue */ 79/* Values for uv_nmi_slave_continue */
@@ -149,7 +148,8 @@ module_param_named(retry_count, uv_nmi_retry_count, int, 0644);
149 * "dump" - dump process stack for each cpu 148 * "dump" - dump process stack for each cpu
150 * "ips" - dump IP info for each cpu 149 * "ips" - dump IP info for each cpu
151 * "kdump" - do crash dump 150 * "kdump" - do crash dump
152 * "kdb" - enter KDB/KGDB (default) 151 * "kdb" - enter KDB (default)
152 * "kgdb" - enter KGDB
153 */ 153 */
154static char uv_nmi_action[8] = "kdb"; 154static char uv_nmi_action[8] = "kdb";
155module_param_string(action, uv_nmi_action, sizeof(uv_nmi_action), 0644); 155module_param_string(action, uv_nmi_action, sizeof(uv_nmi_action), 0644);
@@ -504,6 +504,7 @@ static void uv_nmi_touch_watchdogs(void)
504} 504}
505 505
506#if defined(CONFIG_KEXEC) 506#if defined(CONFIG_KEXEC)
507static atomic_t uv_nmi_kexec_failed;
507static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs) 508static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
508{ 509{
509 /* Call crash to dump system state */ 510 /* Call crash to dump system state */
@@ -537,18 +538,45 @@ static inline void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
537} 538}
538#endif /* !CONFIG_KEXEC */ 539#endif /* !CONFIG_KEXEC */
539 540
541#ifdef CONFIG_KGDB
540#ifdef CONFIG_KGDB_KDB 542#ifdef CONFIG_KGDB_KDB
541/* Call KDB from NMI handler */ 543static inline int uv_nmi_kdb_reason(void)
542static void uv_call_kdb(int cpu, struct pt_regs *regs, int master)
543{ 544{
544 int ret; 545 return KDB_REASON_SYSTEM_NMI;
546}
547#else /* !CONFIG_KGDB_KDB */
548static inline int uv_nmi_kdb_reason(void)
549{
550 /* Insure user is expecting to attach gdb remote */
551 if (uv_nmi_action_is("kgdb"))
552 return 0;
553
554 pr_err("UV: NMI error: KDB is not enabled in this kernel\n");
555 return -1;
556}
557#endif /* CONFIG_KGDB_KDB */
545 558
559/*
560 * Call KGDB/KDB from NMI handler
561 *
562 * Note that if both KGDB and KDB are configured, then the action of 'kgdb' or
563 * 'kdb' has no affect on which is used. See the KGDB documention for further
564 * information.
565 */
566static void uv_call_kgdb_kdb(int cpu, struct pt_regs *regs, int master)
567{
546 if (master) { 568 if (master) {
569 int reason = uv_nmi_kdb_reason();
570 int ret;
571
572 if (reason < 0)
573 return;
574
547 /* call KGDB NMI handler as MASTER */ 575 /* call KGDB NMI handler as MASTER */
548 ret = kgdb_nmicallin(cpu, X86_TRAP_NMI, regs, 576 ret = kgdb_nmicallin(cpu, X86_TRAP_NMI, regs, reason,
549 &uv_nmi_slave_continue); 577 &uv_nmi_slave_continue);
550 if (ret) { 578 if (ret) {
551 pr_alert("KDB returned error, is kgdboc set?\n"); 579 pr_alert("KGDB returned error, is kgdboc set?\n");
552 atomic_set(&uv_nmi_slave_continue, SLAVE_EXIT); 580 atomic_set(&uv_nmi_slave_continue, SLAVE_EXIT);
553 } 581 }
554 } else { 582 } else {
@@ -567,12 +595,12 @@ static void uv_call_kdb(int cpu, struct pt_regs *regs, int master)
567 uv_nmi_sync_exit(master); 595 uv_nmi_sync_exit(master);
568} 596}
569 597
570#else /* !CONFIG_KGDB_KDB */ 598#else /* !CONFIG_KGDB */
571static inline void uv_call_kdb(int cpu, struct pt_regs *regs, int master) 599static inline void uv_call_kgdb_kdb(int cpu, struct pt_regs *regs, int master)
572{ 600{
573 pr_err("UV: NMI error: KGDB/KDB is not enabled in this kernel\n"); 601 pr_err("UV: NMI error: KGDB is not enabled in this kernel\n");
574} 602}
575#endif /* !CONFIG_KGDB_KDB */ 603#endif /* !CONFIG_KGDB */
576 604
577/* 605/*
578 * UV NMI handler 606 * UV NMI handler
@@ -606,9 +634,9 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
606 if (uv_nmi_action_is("ips") || uv_nmi_action_is("dump")) 634 if (uv_nmi_action_is("ips") || uv_nmi_action_is("dump"))
607 uv_nmi_dump_state(cpu, regs, master); 635 uv_nmi_dump_state(cpu, regs, master);
608 636
609 /* Call KDB if enabled */ 637 /* Call KGDB/KDB if enabled */
610 else if (uv_nmi_action_is("kdb")) 638 else if (uv_nmi_action_is("kdb") || uv_nmi_action_is("kgdb"))
611 uv_call_kdb(cpu, regs, master); 639 uv_call_kgdb_kdb(cpu, regs, master);
612 640
613 /* Clear per_cpu "in nmi" flag */ 641 /* Clear per_cpu "in nmi" flag */
614 atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_OUT); 642 atomic_set(&uv_cpu_nmi.state, UV_NMI_STATE_OUT);
@@ -634,7 +662,7 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
634/* 662/*
635 * NMI handler for pulling in CPUs when perf events are grabbing our NMI 663 * NMI handler for pulling in CPUs when perf events are grabbing our NMI
636 */ 664 */
637int uv_handle_nmi_ping(unsigned int reason, struct pt_regs *regs) 665static int uv_handle_nmi_ping(unsigned int reason, struct pt_regs *regs)
638{ 666{
639 int ret; 667 int ret;
640 668
@@ -651,7 +679,7 @@ int uv_handle_nmi_ping(unsigned int reason, struct pt_regs *regs)
651 return ret; 679 return ret;
652} 680}
653 681
654void uv_register_nmi_notifier(void) 682static void uv_register_nmi_notifier(void)
655{ 683{
656 if (register_nmi_handler(NMI_UNKNOWN, uv_handle_nmi, 0, "uv")) 684 if (register_nmi_handler(NMI_UNKNOWN, uv_handle_nmi, 0, "uv"))
657 pr_warn("UV: NMI handler failed to register\n"); 685 pr_warn("UV: NMI handler failed to register\n");
@@ -695,6 +723,5 @@ void uv_nmi_setup(void)
695 uv_hub_nmi_per(cpu) = uv_hub_nmi_list[nid]; 723 uv_hub_nmi_per(cpu) = uv_hub_nmi_list[nid];
696 } 724 }
697 BUG_ON(!alloc_cpumask_var(&uv_nmi_cpu_mask, GFP_KERNEL)); 725 BUG_ON(!alloc_cpumask_var(&uv_nmi_cpu_mask, GFP_KERNEL));
726 uv_register_nmi_notifier();
698} 727}
699
700
diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
index 9cac82588cbc..3497f14e4dea 100644
--- a/arch/x86/realmode/rm/Makefile
+++ b/arch/x86/realmode/rm/Makefile
@@ -64,20 +64,7 @@ $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
64 64
65# --------------------------------------------------------------------------- 65# ---------------------------------------------------------------------------
66 66
67# How to compile the 16-bit code. Note we always compile for -march=i386, 67KBUILD_CFLAGS := $(LINUXINCLUDE) $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
68# that way we can complain to the user if the CPU is insufficient. 68 -I$(srctree)/arch/x86/boot
69KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ -D_WAKEUP \
70 -I$(srctree)/arch/x86/boot \
71 -DDISABLE_BRANCH_PROFILING \
72 -Wall -Wstrict-prototypes \
73 -march=i386 -mregparm=3 \
74 -include $(srctree)/$(src)/../../boot/code16gcc.h \
75 -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
76 -mno-mmx -mno-sse \
77 $(call cc-option, -ffreestanding) \
78 $(call cc-option, -fno-toplevel-reorder,\
79 $(call cc-option, -fno-unit-at-a-time)) \
80 $(call cc-option, -fno-stack-protector) \
81 $(call cc-option, -mpreferred-stack-boundary=2)
82KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 69KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
83GCOV_PROFILE := n 70GCOV_PROFILE := n
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 11f9285a2ff6..cfbdbdb4e173 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -1025,6 +1025,29 @@ static void emit_relocs(int as_text, int use_real_mode)
1025 } 1025 }
1026} 1026}
1027 1027
1028/*
1029 * As an aid to debugging problems with different linkers
1030 * print summary information about the relocs.
1031 * Since different linkers tend to emit the sections in
1032 * different orders we use the section names in the output.
1033 */
1034static int do_reloc_info(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
1035 const char *symname)
1036{
1037 printf("%s\t%s\t%s\t%s\n",
1038 sec_name(sec->shdr.sh_info),
1039 rel_type(ELF_R_TYPE(rel->r_info)),
1040 symname,
1041 sec_name(sym->st_shndx));
1042 return 0;
1043}
1044
1045static void print_reloc_info(void)
1046{
1047 printf("reloc section\treloc type\tsymbol\tsymbol section\n");
1048 walk_relocs(do_reloc_info);
1049}
1050
1028#if ELF_BITS == 64 1051#if ELF_BITS == 64
1029# define process process_64 1052# define process process_64
1030#else 1053#else
@@ -1032,7 +1055,8 @@ static void emit_relocs(int as_text, int use_real_mode)
1032#endif 1055#endif
1033 1056
1034void process(FILE *fp, int use_real_mode, int as_text, 1057void process(FILE *fp, int use_real_mode, int as_text,
1035 int show_absolute_syms, int show_absolute_relocs) 1058 int show_absolute_syms, int show_absolute_relocs,
1059 int show_reloc_info)
1036{ 1060{
1037 regex_init(use_real_mode); 1061 regex_init(use_real_mode);
1038 read_ehdr(fp); 1062 read_ehdr(fp);
@@ -1050,5 +1074,9 @@ void process(FILE *fp, int use_real_mode, int as_text,
1050 print_absolute_relocs(); 1074 print_absolute_relocs();
1051 return; 1075 return;
1052 } 1076 }
1077 if (show_reloc_info) {
1078 print_reloc_info();
1079 return;
1080 }
1053 emit_relocs(as_text, use_real_mode); 1081 emit_relocs(as_text, use_real_mode);
1054} 1082}
diff --git a/arch/x86/tools/relocs.h b/arch/x86/tools/relocs.h
index 07cdb1eca4fa..f59590645b68 100644
--- a/arch/x86/tools/relocs.h
+++ b/arch/x86/tools/relocs.h
@@ -29,8 +29,9 @@ enum symtype {
29}; 29};
30 30
31void process_32(FILE *fp, int use_real_mode, int as_text, 31void process_32(FILE *fp, int use_real_mode, int as_text,
32 int show_absolute_syms, int show_absolute_relocs); 32 int show_absolute_syms, int show_absolute_relocs,
33 int show_reloc_info);
33void process_64(FILE *fp, int use_real_mode, int as_text, 34void process_64(FILE *fp, int use_real_mode, int as_text,
34 int show_absolute_syms, int show_absolute_relocs); 35 int show_absolute_syms, int show_absolute_relocs,
35 36 int show_reloc_info);
36#endif /* RELOCS_H */ 37#endif /* RELOCS_H */
diff --git a/arch/x86/tools/relocs_common.c b/arch/x86/tools/relocs_common.c
index 44d396823a53..acab636bcb34 100644
--- a/arch/x86/tools/relocs_common.c
+++ b/arch/x86/tools/relocs_common.c
@@ -11,12 +11,13 @@ void die(char *fmt, ...)
11 11
12static void usage(void) 12static void usage(void)
13{ 13{
14 die("relocs [--abs-syms|--abs-relocs|--text|--realmode] vmlinux\n"); 14 die("relocs [--abs-syms|--abs-relocs|--reloc-info|--text|--realmode]" \
15 " vmlinux\n");
15} 16}
16 17
17int main(int argc, char **argv) 18int main(int argc, char **argv)
18{ 19{
19 int show_absolute_syms, show_absolute_relocs; 20 int show_absolute_syms, show_absolute_relocs, show_reloc_info;
20 int as_text, use_real_mode; 21 int as_text, use_real_mode;
21 const char *fname; 22 const char *fname;
22 FILE *fp; 23 FILE *fp;
@@ -25,6 +26,7 @@ int main(int argc, char **argv)
25 26
26 show_absolute_syms = 0; 27 show_absolute_syms = 0;
27 show_absolute_relocs = 0; 28 show_absolute_relocs = 0;
29 show_reloc_info = 0;
28 as_text = 0; 30 as_text = 0;
29 use_real_mode = 0; 31 use_real_mode = 0;
30 fname = NULL; 32 fname = NULL;
@@ -39,6 +41,10 @@ int main(int argc, char **argv)
39 show_absolute_relocs = 1; 41 show_absolute_relocs = 1;
40 continue; 42 continue;
41 } 43 }
44 if (strcmp(arg, "--reloc-info") == 0) {
45 show_reloc_info = 1;
46 continue;
47 }
42 if (strcmp(arg, "--text") == 0) { 48 if (strcmp(arg, "--text") == 0) {
43 as_text = 1; 49 as_text = 1;
44 continue; 50 continue;
@@ -67,10 +73,12 @@ int main(int argc, char **argv)
67 rewind(fp); 73 rewind(fp);
68 if (e_ident[EI_CLASS] == ELFCLASS64) 74 if (e_ident[EI_CLASS] == ELFCLASS64)
69 process_64(fp, use_real_mode, as_text, 75 process_64(fp, use_real_mode, as_text,
70 show_absolute_syms, show_absolute_relocs); 76 show_absolute_syms, show_absolute_relocs,
77 show_reloc_info);
71 else 78 else
72 process_32(fp, use_real_mode, as_text, 79 process_32(fp, use_real_mode, as_text,
73 show_absolute_syms, show_absolute_relocs); 80 show_absolute_syms, show_absolute_relocs,
81 show_reloc_info);
74 fclose(fp); 82 fclose(fp);
75 return 0; 83 return 0;
76} 84}
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 1a3c76505649..01b90261fa38 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -51,3 +51,7 @@ config XEN_DEBUG_FS
51 Enable statistics output and various tuning options in debugfs. 51 Enable statistics output and various tuning options in debugfs.
52 Enabling this option may incur a significant performance overhead. 52 Enabling this option may incur a significant performance overhead.
53 53
54config XEN_PVH
55 bool "Support for running as a PVH guest"
56 depends on X86_64 && XEN && XEN_PVHVM
57 def_bool n
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fa6ade76ef3f..a4d7b647867f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -262,8 +262,9 @@ static void __init xen_banner(void)
262 struct xen_extraversion extra; 262 struct xen_extraversion extra;
263 HYPERVISOR_xen_version(XENVER_extraversion, &extra); 263 HYPERVISOR_xen_version(XENVER_extraversion, &extra);
264 264
265 printk(KERN_INFO "Booting paravirtualized kernel on %s\n", 265 pr_info("Booting paravirtualized kernel %son %s\n",
266 pv_info.name); 266 xen_feature(XENFEAT_auto_translated_physmap) ?
267 "with PVH extensions " : "", pv_info.name);
267 printk(KERN_INFO "Xen version: %d.%d%s%s\n", 268 printk(KERN_INFO "Xen version: %d.%d%s%s\n",
268 version >> 16, version & 0xffff, extra.extraversion, 269 version >> 16, version & 0xffff, extra.extraversion,
269 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); 270 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
@@ -433,7 +434,7 @@ static void __init xen_init_cpuid_mask(void)
433 434
434 ax = 1; 435 ax = 1;
435 cx = 0; 436 cx = 0;
436 xen_cpuid(&ax, &bx, &cx, &dx); 437 cpuid(1, &ax, &bx, &cx, &dx);
437 438
438 xsave_mask = 439 xsave_mask =
439 (1 << (X86_FEATURE_XSAVE % 32)) | 440 (1 << (X86_FEATURE_XSAVE % 32)) |
@@ -1142,8 +1143,9 @@ void xen_setup_vcpu_info_placement(void)
1142 xen_vcpu_setup(cpu); 1143 xen_vcpu_setup(cpu);
1143 1144
1144 /* xen_vcpu_setup managed to place the vcpu_info within the 1145 /* xen_vcpu_setup managed to place the vcpu_info within the
1145 percpu area for all cpus, so make use of it */ 1146 * percpu area for all cpus, so make use of it. Note that for
1146 if (have_vcpu_info_placement) { 1147 * PVH we want to use native IRQ mechanism. */
1148 if (have_vcpu_info_placement && !xen_pvh_domain()) {
1147 pv_irq_ops.save_fl = __PV_IS_CALLEE_SAVE(xen_save_fl_direct); 1149 pv_irq_ops.save_fl = __PV_IS_CALLEE_SAVE(xen_save_fl_direct);
1148 pv_irq_ops.restore_fl = __PV_IS_CALLEE_SAVE(xen_restore_fl_direct); 1150 pv_irq_ops.restore_fl = __PV_IS_CALLEE_SAVE(xen_restore_fl_direct);
1149 pv_irq_ops.irq_disable = __PV_IS_CALLEE_SAVE(xen_irq_disable_direct); 1151 pv_irq_ops.irq_disable = __PV_IS_CALLEE_SAVE(xen_irq_disable_direct);
@@ -1407,9 +1409,49 @@ static void __init xen_boot_params_init_edd(void)
1407 * Set up the GDT and segment registers for -fstack-protector. Until 1409 * Set up the GDT and segment registers for -fstack-protector. Until
1408 * we do this, we have to be careful not to call any stack-protected 1410 * we do this, we have to be careful not to call any stack-protected
1409 * function, which is most of the kernel. 1411 * function, which is most of the kernel.
1412 *
1413 * Note, that it is __ref because the only caller of this after init
1414 * is PVH which is not going to use xen_load_gdt_boot or other
1415 * __init functions.
1410 */ 1416 */
1411static void __init xen_setup_stackprotector(void) 1417static void __ref xen_setup_gdt(int cpu)
1412{ 1418{
1419 if (xen_feature(XENFEAT_auto_translated_physmap)) {
1420#ifdef CONFIG_X86_64
1421 unsigned long dummy;
1422
1423 load_percpu_segment(cpu); /* We need to access per-cpu area */
1424 switch_to_new_gdt(cpu); /* GDT and GS set */
1425
1426 /* We are switching of the Xen provided GDT to our HVM mode
1427 * GDT. The new GDT has __KERNEL_CS with CS.L = 1
1428 * and we are jumping to reload it.
1429 */
1430 asm volatile ("pushq %0\n"
1431 "leaq 1f(%%rip),%0\n"
1432 "pushq %0\n"
1433 "lretq\n"
1434 "1:\n"
1435 : "=&r" (dummy) : "0" (__KERNEL_CS));
1436
1437 /*
1438 * While not needed, we also set the %es, %ds, and %fs
1439 * to zero. We don't care about %ss as it is NULL.
1440 * Strictly speaking this is not needed as Xen zeros those
1441 * out (and also MSR_FS_BASE, MSR_GS_BASE, MSR_KERNEL_GS_BASE)
1442 *
1443 * Linux zeros them in cpu_init() and in secondary_startup_64
1444 * (for BSP).
1445 */
1446 loadsegment(es, 0);
1447 loadsegment(ds, 0);
1448 loadsegment(fs, 0);
1449#else
1450 /* PVH: TODO Implement. */
1451 BUG();
1452#endif
1453 return; /* PVH does not need any PV GDT ops. */
1454 }
1413 pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; 1455 pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot;
1414 pv_cpu_ops.load_gdt = xen_load_gdt_boot; 1456 pv_cpu_ops.load_gdt = xen_load_gdt_boot;
1415 1457
@@ -1420,6 +1462,46 @@ static void __init xen_setup_stackprotector(void)
1420 pv_cpu_ops.load_gdt = xen_load_gdt; 1462 pv_cpu_ops.load_gdt = xen_load_gdt;
1421} 1463}
1422 1464
1465/*
1466 * A PV guest starts with default flags that are not set for PVH, set them
1467 * here asap.
1468 */
1469static void xen_pvh_set_cr_flags(int cpu)
1470{
1471
1472 /* Some of these are setup in 'secondary_startup_64'. The others:
1473 * X86_CR0_TS, X86_CR0_PE, X86_CR0_ET are set by Xen for HVM guests
1474 * (which PVH shared codepaths), while X86_CR0_PG is for PVH. */
1475 write_cr0(read_cr0() | X86_CR0_MP | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM);
1476}
1477
1478/*
1479 * Note, that it is ref - because the only caller of this after init
1480 * is PVH which is not going to use xen_load_gdt_boot or other
1481 * __init functions.
1482 */
1483void __ref xen_pvh_secondary_vcpu_init(int cpu)
1484{
1485 xen_setup_gdt(cpu);
1486 xen_pvh_set_cr_flags(cpu);
1487}
1488
1489static void __init xen_pvh_early_guest_init(void)
1490{
1491 if (!xen_feature(XENFEAT_auto_translated_physmap))
1492 return;
1493
1494 if (!xen_feature(XENFEAT_hvm_callback_vector))
1495 return;
1496
1497 xen_have_vector_callback = 1;
1498 xen_pvh_set_cr_flags(0);
1499
1500#ifdef CONFIG_X86_32
1501 BUG(); /* PVH: Implement proper support. */
1502#endif
1503}
1504
1423/* First C function to be called on Xen boot */ 1505/* First C function to be called on Xen boot */
1424asmlinkage void __init xen_start_kernel(void) 1506asmlinkage void __init xen_start_kernel(void)
1425{ 1507{
@@ -1431,13 +1513,16 @@ asmlinkage void __init xen_start_kernel(void)
1431 1513
1432 xen_domain_type = XEN_PV_DOMAIN; 1514 xen_domain_type = XEN_PV_DOMAIN;
1433 1515
1516 xen_setup_features();
1517 xen_pvh_early_guest_init();
1434 xen_setup_machphys_mapping(); 1518 xen_setup_machphys_mapping();
1435 1519
1436 /* Install Xen paravirt ops */ 1520 /* Install Xen paravirt ops */
1437 pv_info = xen_info; 1521 pv_info = xen_info;
1438 pv_init_ops = xen_init_ops; 1522 pv_init_ops = xen_init_ops;
1439 pv_cpu_ops = xen_cpu_ops;
1440 pv_apic_ops = xen_apic_ops; 1523 pv_apic_ops = xen_apic_ops;
1524 if (!xen_pvh_domain())
1525 pv_cpu_ops = xen_cpu_ops;
1441 1526
1442 x86_init.resources.memory_setup = xen_memory_setup; 1527 x86_init.resources.memory_setup = xen_memory_setup;
1443 x86_init.oem.arch_setup = xen_arch_setup; 1528 x86_init.oem.arch_setup = xen_arch_setup;
@@ -1469,17 +1554,14 @@ asmlinkage void __init xen_start_kernel(void)
1469 /* Work out if we support NX */ 1554 /* Work out if we support NX */
1470 x86_configure_nx(); 1555 x86_configure_nx();
1471 1556
1472 xen_setup_features();
1473
1474 /* Get mfn list */ 1557 /* Get mfn list */
1475 if (!xen_feature(XENFEAT_auto_translated_physmap)) 1558 xen_build_dynamic_phys_to_machine();
1476 xen_build_dynamic_phys_to_machine();
1477 1559
1478 /* 1560 /*
1479 * Set up kernel GDT and segment registers, mainly so that 1561 * Set up kernel GDT and segment registers, mainly so that
1480 * -fstack-protector code can be executed. 1562 * -fstack-protector code can be executed.
1481 */ 1563 */
1482 xen_setup_stackprotector(); 1564 xen_setup_gdt(0);
1483 1565
1484 xen_init_irq_ops(); 1566 xen_init_irq_ops();
1485 xen_init_cpuid_mask(); 1567 xen_init_cpuid_mask();
@@ -1548,14 +1630,18 @@ asmlinkage void __init xen_start_kernel(void)
1548 /* set the limit of our address space */ 1630 /* set the limit of our address space */
1549 xen_reserve_top(); 1631 xen_reserve_top();
1550 1632
1551 /* We used to do this in xen_arch_setup, but that is too late on AMD 1633 /* PVH: runs at default kernel iopl of 0 */
1552 * were early_cpu_init (run before ->arch_setup()) calls early_amd_init 1634 if (!xen_pvh_domain()) {
1553 * which pokes 0xcf8 port. 1635 /*
1554 */ 1636 * We used to do this in xen_arch_setup, but that is too late
1555 set_iopl.iopl = 1; 1637 * on AMD were early_cpu_init (run before ->arch_setup()) calls
1556 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl); 1638 * early_amd_init which pokes 0xcf8 port.
1557 if (rc != 0) 1639 */
1558 xen_raw_printk("physdev_op failed %d\n", rc); 1640 set_iopl.iopl = 1;
1641 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
1642 if (rc != 0)
1643 xen_raw_printk("physdev_op failed %d\n", rc);
1644 }
1559 1645
1560#ifdef CONFIG_X86_32 1646#ifdef CONFIG_X86_32
1561 /* set up basic CPUID stuff */ 1647 /* set up basic CPUID stuff */
diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c
index 3a5f55d51907..c98583588580 100644
--- a/arch/x86/xen/grant-table.c
+++ b/arch/x86/xen/grant-table.c
@@ -125,3 +125,67 @@ void arch_gnttab_unmap(void *shared, unsigned long nr_gframes)
125 apply_to_page_range(&init_mm, (unsigned long)shared, 125 apply_to_page_range(&init_mm, (unsigned long)shared,
126 PAGE_SIZE * nr_gframes, unmap_pte_fn, NULL); 126 PAGE_SIZE * nr_gframes, unmap_pte_fn, NULL);
127} 127}
128#ifdef CONFIG_XEN_PVH
129#include <xen/balloon.h>
130#include <xen/events.h>
131#include <xen/xen.h>
132#include <linux/slab.h>
133static int __init xlated_setup_gnttab_pages(void)
134{
135 struct page **pages;
136 xen_pfn_t *pfns;
137 int rc;
138 unsigned int i;
139 unsigned long nr_grant_frames = gnttab_max_grant_frames();
140
141 BUG_ON(nr_grant_frames == 0);
142 pages = kcalloc(nr_grant_frames, sizeof(pages[0]), GFP_KERNEL);
143 if (!pages)
144 return -ENOMEM;
145
146 pfns = kcalloc(nr_grant_frames, sizeof(pfns[0]), GFP_KERNEL);
147 if (!pfns) {
148 kfree(pages);
149 return -ENOMEM;
150 }
151 rc = alloc_xenballooned_pages(nr_grant_frames, pages, 0 /* lowmem */);
152 if (rc) {
153 pr_warn("%s Couldn't balloon alloc %ld pfns rc:%d\n", __func__,
154 nr_grant_frames, rc);
155 kfree(pages);
156 kfree(pfns);
157 return rc;
158 }
159 for (i = 0; i < nr_grant_frames; i++)
160 pfns[i] = page_to_pfn(pages[i]);
161
162 rc = arch_gnttab_map_shared(pfns, nr_grant_frames, nr_grant_frames,
163 &xen_auto_xlat_grant_frames.vaddr);
164
165 if (rc) {
166 pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__,
167 nr_grant_frames, rc);
168 free_xenballooned_pages(nr_grant_frames, pages);
169 kfree(pages);
170 kfree(pfns);
171 return rc;
172 }
173 kfree(pages);
174
175 xen_auto_xlat_grant_frames.pfn = pfns;
176 xen_auto_xlat_grant_frames.count = nr_grant_frames;
177
178 return 0;
179}
180
181static int __init xen_pvh_gnttab_setup(void)
182{
183 if (!xen_pvh_domain())
184 return -ENODEV;
185
186 return xlated_setup_gnttab_pages();
187}
188/* Call it _before_ __gnttab_init as we need to initialize the
189 * xen_auto_xlat_grant_frames first. */
190core_initcall(xen_pvh_gnttab_setup);
191#endif
diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
index 0da7f863056f..08f763de26fe 100644
--- a/arch/x86/xen/irq.c
+++ b/arch/x86/xen/irq.c
@@ -5,6 +5,7 @@
5#include <xen/interface/xen.h> 5#include <xen/interface/xen.h>
6#include <xen/interface/sched.h> 6#include <xen/interface/sched.h>
7#include <xen/interface/vcpu.h> 7#include <xen/interface/vcpu.h>
8#include <xen/features.h>
8#include <xen/events.h> 9#include <xen/events.h>
9 10
10#include <asm/xen/hypercall.h> 11#include <asm/xen/hypercall.h>
@@ -22,7 +23,7 @@ void xen_force_evtchn_callback(void)
22 (void)HYPERVISOR_xen_version(0, NULL); 23 (void)HYPERVISOR_xen_version(0, NULL);
23} 24}
24 25
25static unsigned long xen_save_fl(void) 26asmlinkage unsigned long xen_save_fl(void)
26{ 27{
27 struct vcpu_info *vcpu; 28 struct vcpu_info *vcpu;
28 unsigned long flags; 29 unsigned long flags;
@@ -40,7 +41,7 @@ static unsigned long xen_save_fl(void)
40} 41}
41PV_CALLEE_SAVE_REGS_THUNK(xen_save_fl); 42PV_CALLEE_SAVE_REGS_THUNK(xen_save_fl);
42 43
43static void xen_restore_fl(unsigned long flags) 44__visible void xen_restore_fl(unsigned long flags)
44{ 45{
45 struct vcpu_info *vcpu; 46 struct vcpu_info *vcpu;
46 47
@@ -62,7 +63,7 @@ static void xen_restore_fl(unsigned long flags)
62} 63}
63PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl); 64PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl);
64 65
65static void xen_irq_disable(void) 66asmlinkage void xen_irq_disable(void)
66{ 67{
67 /* There's a one instruction preempt window here. We need to 68 /* There's a one instruction preempt window here. We need to
68 make sure we're don't switch CPUs between getting the vcpu 69 make sure we're don't switch CPUs between getting the vcpu
@@ -73,7 +74,7 @@ static void xen_irq_disable(void)
73} 74}
74PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable); 75PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
75 76
76static void xen_irq_enable(void) 77asmlinkage void xen_irq_enable(void)
77{ 78{
78 struct vcpu_info *vcpu; 79 struct vcpu_info *vcpu;
79 80
@@ -128,6 +129,8 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {
128 129
129void __init xen_init_irq_ops(void) 130void __init xen_init_irq_ops(void)
130{ 131{
131 pv_irq_ops = xen_irq_ops; 132 /* For PVH we use default pv_irq_ops settings. */
133 if (!xen_feature(XENFEAT_hvm_callback_vector))
134 pv_irq_ops = xen_irq_ops;
132 x86_init.irqs.intr_init = xen_init_IRQ; 135 x86_init.irqs.intr_init = xen_init_IRQ;
133} 136}
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index ce563be09cc1..2423ef04ffea 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -431,7 +431,7 @@ static pteval_t iomap_pte(pteval_t val)
431 return val; 431 return val;
432} 432}
433 433
434static pteval_t xen_pte_val(pte_t pte) 434__visible pteval_t xen_pte_val(pte_t pte)
435{ 435{
436 pteval_t pteval = pte.pte; 436 pteval_t pteval = pte.pte;
437#if 0 437#if 0
@@ -448,7 +448,7 @@ static pteval_t xen_pte_val(pte_t pte)
448} 448}
449PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val); 449PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val);
450 450
451static pgdval_t xen_pgd_val(pgd_t pgd) 451__visible pgdval_t xen_pgd_val(pgd_t pgd)
452{ 452{
453 return pte_mfn_to_pfn(pgd.pgd); 453 return pte_mfn_to_pfn(pgd.pgd);
454} 454}
@@ -479,7 +479,7 @@ void xen_set_pat(u64 pat)
479 WARN_ON(pat != 0x0007010600070106ull); 479 WARN_ON(pat != 0x0007010600070106ull);
480} 480}
481 481
482static pte_t xen_make_pte(pteval_t pte) 482__visible pte_t xen_make_pte(pteval_t pte)
483{ 483{
484 phys_addr_t addr = (pte & PTE_PFN_MASK); 484 phys_addr_t addr = (pte & PTE_PFN_MASK);
485#if 0 485#if 0
@@ -514,14 +514,14 @@ static pte_t xen_make_pte(pteval_t pte)
514} 514}
515PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte); 515PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte);
516 516
517static pgd_t xen_make_pgd(pgdval_t pgd) 517__visible pgd_t xen_make_pgd(pgdval_t pgd)
518{ 518{
519 pgd = pte_pfn_to_mfn(pgd); 519 pgd = pte_pfn_to_mfn(pgd);
520 return native_make_pgd(pgd); 520 return native_make_pgd(pgd);
521} 521}
522PV_CALLEE_SAVE_REGS_THUNK(xen_make_pgd); 522PV_CALLEE_SAVE_REGS_THUNK(xen_make_pgd);
523 523
524static pmdval_t xen_pmd_val(pmd_t pmd) 524__visible pmdval_t xen_pmd_val(pmd_t pmd)
525{ 525{
526 return pte_mfn_to_pfn(pmd.pmd); 526 return pte_mfn_to_pfn(pmd.pmd);
527} 527}
@@ -580,7 +580,7 @@ static void xen_pmd_clear(pmd_t *pmdp)
580} 580}
581#endif /* CONFIG_X86_PAE */ 581#endif /* CONFIG_X86_PAE */
582 582
583static pmd_t xen_make_pmd(pmdval_t pmd) 583__visible pmd_t xen_make_pmd(pmdval_t pmd)
584{ 584{
585 pmd = pte_pfn_to_mfn(pmd); 585 pmd = pte_pfn_to_mfn(pmd);
586 return native_make_pmd(pmd); 586 return native_make_pmd(pmd);
@@ -588,13 +588,13 @@ static pmd_t xen_make_pmd(pmdval_t pmd)
588PV_CALLEE_SAVE_REGS_THUNK(xen_make_pmd); 588PV_CALLEE_SAVE_REGS_THUNK(xen_make_pmd);
589 589
590#if PAGETABLE_LEVELS == 4 590#if PAGETABLE_LEVELS == 4
591static pudval_t xen_pud_val(pud_t pud) 591__visible pudval_t xen_pud_val(pud_t pud)
592{ 592{
593 return pte_mfn_to_pfn(pud.pud); 593 return pte_mfn_to_pfn(pud.pud);
594} 594}
595PV_CALLEE_SAVE_REGS_THUNK(xen_pud_val); 595PV_CALLEE_SAVE_REGS_THUNK(xen_pud_val);
596 596
597static pud_t xen_make_pud(pudval_t pud) 597__visible pud_t xen_make_pud(pudval_t pud)
598{ 598{
599 pud = pte_pfn_to_mfn(pud); 599 pud = pte_pfn_to_mfn(pud);
600 600
@@ -1198,44 +1198,40 @@ static void __init xen_cleanhighmap(unsigned long vaddr,
1198 * instead of somewhere later and be confusing. */ 1198 * instead of somewhere later and be confusing. */
1199 xen_mc_flush(); 1199 xen_mc_flush();
1200} 1200}
1201#endif 1201static void __init xen_pagetable_p2m_copy(void)
1202static void __init xen_pagetable_init(void)
1203{ 1202{
1204#ifdef CONFIG_X86_64
1205 unsigned long size; 1203 unsigned long size;
1206 unsigned long addr; 1204 unsigned long addr;
1207#endif 1205 unsigned long new_mfn_list;
1208 paging_init(); 1206
1209 xen_setup_shared_info(); 1207 if (xen_feature(XENFEAT_auto_translated_physmap))
1210#ifdef CONFIG_X86_64 1208 return;
1211 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 1209
1212 unsigned long new_mfn_list; 1210 size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long));
1213 1211
1214 size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long)); 1212 new_mfn_list = xen_revector_p2m_tree();
1215 1213 /* No memory or already called. */
1216 /* On 32-bit, we get zero so this never gets executed. */ 1214 if (!new_mfn_list || new_mfn_list == xen_start_info->mfn_list)
1217 new_mfn_list = xen_revector_p2m_tree(); 1215 return;
1218 if (new_mfn_list && new_mfn_list != xen_start_info->mfn_list) { 1216
1219 /* using __ka address and sticking INVALID_P2M_ENTRY! */ 1217 /* using __ka address and sticking INVALID_P2M_ENTRY! */
1220 memset((void *)xen_start_info->mfn_list, 0xff, size); 1218 memset((void *)xen_start_info->mfn_list, 0xff, size);
1221 1219
1222 /* We should be in __ka space. */ 1220 /* We should be in __ka space. */
1223 BUG_ON(xen_start_info->mfn_list < __START_KERNEL_map); 1221 BUG_ON(xen_start_info->mfn_list < __START_KERNEL_map);
1224 addr = xen_start_info->mfn_list; 1222 addr = xen_start_info->mfn_list;
1225 /* We roundup to the PMD, which means that if anybody at this stage is 1223 /* We roundup to the PMD, which means that if anybody at this stage is
1226 * using the __ka address of xen_start_info or xen_start_info->shared_info 1224 * using the __ka address of xen_start_info or xen_start_info->shared_info
1227 * they are in going to crash. Fortunatly we have already revectored 1225 * they are in going to crash. Fortunatly we have already revectored
1228 * in xen_setup_kernel_pagetable and in xen_setup_shared_info. */ 1226 * in xen_setup_kernel_pagetable and in xen_setup_shared_info. */
1229 size = roundup(size, PMD_SIZE); 1227 size = roundup(size, PMD_SIZE);
1230 xen_cleanhighmap(addr, addr + size); 1228 xen_cleanhighmap(addr, addr + size);
1231 1229
1232 size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long)); 1230 size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long));
1233 memblock_free(__pa(xen_start_info->mfn_list), size); 1231 memblock_free(__pa(xen_start_info->mfn_list), size);
1234 /* And revector! Bye bye old array */ 1232 /* And revector! Bye bye old array */
1235 xen_start_info->mfn_list = new_mfn_list; 1233 xen_start_info->mfn_list = new_mfn_list;
1236 } else 1234
1237 goto skip;
1238 }
1239 /* At this stage, cleanup_highmap has already cleaned __ka space 1235 /* At this stage, cleanup_highmap has already cleaned __ka space
1240 * from _brk_limit way up to the max_pfn_mapped (which is the end of 1236 * from _brk_limit way up to the max_pfn_mapped (which is the end of
1241 * the ramdisk). We continue on, erasing PMD entries that point to page 1237 * the ramdisk). We continue on, erasing PMD entries that point to page
@@ -1255,7 +1251,15 @@ static void __init xen_pagetable_init(void)
1255 * anything at this stage. */ 1251 * anything at this stage. */
1256 xen_cleanhighmap(MODULES_VADDR, roundup(MODULES_VADDR, PUD_SIZE) - 1); 1252 xen_cleanhighmap(MODULES_VADDR, roundup(MODULES_VADDR, PUD_SIZE) - 1);
1257#endif 1253#endif
1258skip: 1254}
1255#endif
1256
1257static void __init xen_pagetable_init(void)
1258{
1259 paging_init();
1260 xen_setup_shared_info();
1261#ifdef CONFIG_X86_64
1262 xen_pagetable_p2m_copy();
1259#endif 1263#endif
1260 xen_post_allocator_init(); 1264 xen_post_allocator_init();
1261} 1265}
@@ -1753,6 +1757,10 @@ static void set_page_prot_flags(void *addr, pgprot_t prot, unsigned long flags)
1753 unsigned long pfn = __pa(addr) >> PAGE_SHIFT; 1757 unsigned long pfn = __pa(addr) >> PAGE_SHIFT;
1754 pte_t pte = pfn_pte(pfn, prot); 1758 pte_t pte = pfn_pte(pfn, prot);
1755 1759
1760 /* For PVH no need to set R/O or R/W to pin them or unpin them. */
1761 if (xen_feature(XENFEAT_auto_translated_physmap))
1762 return;
1763
1756 if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, flags)) 1764 if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, flags))
1757 BUG(); 1765 BUG();
1758} 1766}
@@ -1863,6 +1871,7 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end,
1863 * but that's enough to get __va working. We need to fill in the rest 1871 * but that's enough to get __va working. We need to fill in the rest
1864 * of the physical mapping once some sort of allocator has been set 1872 * of the physical mapping once some sort of allocator has been set
1865 * up. 1873 * up.
1874 * NOTE: for PVH, the page tables are native.
1866 */ 1875 */
1867void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 1876void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1868{ 1877{
@@ -1884,17 +1893,18 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1884 /* Zap identity mapping */ 1893 /* Zap identity mapping */
1885 init_level4_pgt[0] = __pgd(0); 1894 init_level4_pgt[0] = __pgd(0);
1886 1895
1887 /* Pre-constructed entries are in pfn, so convert to mfn */ 1896 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
1888 /* L4[272] -> level3_ident_pgt 1897 /* Pre-constructed entries are in pfn, so convert to mfn */
1889 * L4[511] -> level3_kernel_pgt */ 1898 /* L4[272] -> level3_ident_pgt
1890 convert_pfn_mfn(init_level4_pgt); 1899 * L4[511] -> level3_kernel_pgt */
1891 1900 convert_pfn_mfn(init_level4_pgt);
1892 /* L3_i[0] -> level2_ident_pgt */ 1901
1893 convert_pfn_mfn(level3_ident_pgt); 1902 /* L3_i[0] -> level2_ident_pgt */
1894 /* L3_k[510] -> level2_kernel_pgt 1903 convert_pfn_mfn(level3_ident_pgt);
1895 * L3_i[511] -> level2_fixmap_pgt */ 1904 /* L3_k[510] -> level2_kernel_pgt
1896 convert_pfn_mfn(level3_kernel_pgt); 1905 * L3_i[511] -> level2_fixmap_pgt */
1897 1906 convert_pfn_mfn(level3_kernel_pgt);
1907 }
1898 /* We get [511][511] and have Xen's version of level2_kernel_pgt */ 1908 /* We get [511][511] and have Xen's version of level2_kernel_pgt */
1899 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); 1909 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);
1900 l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud); 1910 l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud);
@@ -1918,31 +1928,33 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1918 copy_page(level2_fixmap_pgt, l2); 1928 copy_page(level2_fixmap_pgt, l2);
1919 /* Note that we don't do anything with level1_fixmap_pgt which 1929 /* Note that we don't do anything with level1_fixmap_pgt which
1920 * we don't need. */ 1930 * we don't need. */
1931 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
1932 /* Make pagetable pieces RO */
1933 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
1934 set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);
1935 set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);
1936 set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO);
1937 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
1938 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
1939 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
1940
1941 /* Pin down new L4 */
1942 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,
1943 PFN_DOWN(__pa_symbol(init_level4_pgt)));
1944
1945 /* Unpin Xen-provided one */
1946 pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
1921 1947
1922 /* Make pagetable pieces RO */ 1948 /*
1923 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); 1949 * At this stage there can be no user pgd, and no page
1924 set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO); 1950 * structure to attach it to, so make sure we just set kernel
1925 set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO); 1951 * pgd.
1926 set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO); 1952 */
1927 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); 1953 xen_mc_batch();
1928 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); 1954 __xen_write_cr3(true, __pa(init_level4_pgt));
1929 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); 1955 xen_mc_issue(PARAVIRT_LAZY_CPU);
1930 1956 } else
1931 /* Pin down new L4 */ 1957 native_write_cr3(__pa(init_level4_pgt));
1932 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,
1933 PFN_DOWN(__pa_symbol(init_level4_pgt)));
1934
1935 /* Unpin Xen-provided one */
1936 pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
1937
1938 /*
1939 * At this stage there can be no user pgd, and no page
1940 * structure to attach it to, so make sure we just set kernel
1941 * pgd.
1942 */
1943 xen_mc_batch();
1944 __xen_write_cr3(true, __pa(init_level4_pgt));
1945 xen_mc_issue(PARAVIRT_LAZY_CPU);
1946 1958
1947 /* We can't that easily rip out L3 and L2, as the Xen pagetables are 1959 /* We can't that easily rip out L3 and L2, as the Xen pagetables are
1948 * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for 1960 * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for
@@ -2103,6 +2115,9 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2103 2115
2104static void __init xen_post_allocator_init(void) 2116static void __init xen_post_allocator_init(void)
2105{ 2117{
2118 if (xen_feature(XENFEAT_auto_translated_physmap))
2119 return;
2120
2106 pv_mmu_ops.set_pte = xen_set_pte; 2121 pv_mmu_ops.set_pte = xen_set_pte;
2107 pv_mmu_ops.set_pmd = xen_set_pmd; 2122 pv_mmu_ops.set_pmd = xen_set_pmd;
2108 pv_mmu_ops.set_pud = xen_set_pud; 2123 pv_mmu_ops.set_pud = xen_set_pud;
@@ -2207,6 +2222,15 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {
2207void __init xen_init_mmu_ops(void) 2222void __init xen_init_mmu_ops(void)
2208{ 2223{
2209 x86_init.paging.pagetable_init = xen_pagetable_init; 2224 x86_init.paging.pagetable_init = xen_pagetable_init;
2225
2226 /* Optimization - we can use the HVM one but it has no idea which
2227 * VCPUs are descheduled - which means that it will needlessly IPI
2228 * them. Xen knows so let it do the job.
2229 */
2230 if (xen_feature(XENFEAT_auto_translated_physmap)) {
2231 pv_mmu_ops.flush_tlb_others = xen_flush_tlb_others;
2232 return;
2233 }
2210 pv_mmu_ops = xen_mmu_ops; 2234 pv_mmu_ops = xen_mmu_ops;
2211 2235
2212 memset(dummy_mapping, 0xff, PAGE_SIZE); 2236 memset(dummy_mapping, 0xff, PAGE_SIZE);
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 2ae8699e8767..8009acbe41e4 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -280,6 +280,9 @@ void __ref xen_build_mfn_list_list(void)
280{ 280{
281 unsigned long pfn; 281 unsigned long pfn;
282 282
283 if (xen_feature(XENFEAT_auto_translated_physmap))
284 return;
285
283 /* Pre-initialize p2m_top_mfn to be completely missing */ 286 /* Pre-initialize p2m_top_mfn to be completely missing */
284 if (p2m_top_mfn == NULL) { 287 if (p2m_top_mfn == NULL) {
285 p2m_mid_missing_mfn = extend_brk(PAGE_SIZE, PAGE_SIZE); 288 p2m_mid_missing_mfn = extend_brk(PAGE_SIZE, PAGE_SIZE);
@@ -336,6 +339,9 @@ void __ref xen_build_mfn_list_list(void)
336 339
337void xen_setup_mfn_list_list(void) 340void xen_setup_mfn_list_list(void)
338{ 341{
342 if (xen_feature(XENFEAT_auto_translated_physmap))
343 return;
344
339 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info); 345 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
340 346
341 HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = 347 HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
@@ -346,10 +352,15 @@ void xen_setup_mfn_list_list(void)
346/* Set up p2m_top to point to the domain-builder provided p2m pages */ 352/* Set up p2m_top to point to the domain-builder provided p2m pages */
347void __init xen_build_dynamic_phys_to_machine(void) 353void __init xen_build_dynamic_phys_to_machine(void)
348{ 354{
349 unsigned long *mfn_list = (unsigned long *)xen_start_info->mfn_list; 355 unsigned long *mfn_list;
350 unsigned long max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages); 356 unsigned long max_pfn;
351 unsigned long pfn; 357 unsigned long pfn;
352 358
359 if (xen_feature(XENFEAT_auto_translated_physmap))
360 return;
361
362 mfn_list = (unsigned long *)xen_start_info->mfn_list;
363 max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages);
353 xen_max_p2m_pfn = max_pfn; 364 xen_max_p2m_pfn = max_pfn;
354 365
355 p2m_missing = extend_brk(PAGE_SIZE, PAGE_SIZE); 366 p2m_missing = extend_brk(PAGE_SIZE, PAGE_SIZE);
@@ -888,13 +899,6 @@ int m2p_add_override(unsigned long mfn, struct page *page,
888 "m2p_add_override: pfn %lx not mapped", pfn)) 899 "m2p_add_override: pfn %lx not mapped", pfn))
889 return -EINVAL; 900 return -EINVAL;
890 } 901 }
891 WARN_ON(PagePrivate(page));
892 SetPagePrivate(page);
893 set_page_private(page, mfn);
894 page->index = pfn_to_mfn(pfn);
895
896 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
897 return -ENOMEM;
898 902
899 if (kmap_op != NULL) { 903 if (kmap_op != NULL) {
900 if (!PageHighMem(page)) { 904 if (!PageHighMem(page)) {
@@ -933,19 +937,16 @@ int m2p_add_override(unsigned long mfn, struct page *page,
933} 937}
934EXPORT_SYMBOL_GPL(m2p_add_override); 938EXPORT_SYMBOL_GPL(m2p_add_override);
935int m2p_remove_override(struct page *page, 939int m2p_remove_override(struct page *page,
936 struct gnttab_map_grant_ref *kmap_op) 940 struct gnttab_map_grant_ref *kmap_op,
941 unsigned long mfn)
937{ 942{
938 unsigned long flags; 943 unsigned long flags;
939 unsigned long mfn;
940 unsigned long pfn; 944 unsigned long pfn;
941 unsigned long uninitialized_var(address); 945 unsigned long uninitialized_var(address);
942 unsigned level; 946 unsigned level;
943 pte_t *ptep = NULL; 947 pte_t *ptep = NULL;
944 948
945 pfn = page_to_pfn(page); 949 pfn = page_to_pfn(page);
946 mfn = get_phys_to_machine(pfn);
947 if (mfn == INVALID_P2M_ENTRY || !(mfn & FOREIGN_FRAME_BIT))
948 return -EINVAL;
949 950
950 if (!PageHighMem(page)) { 951 if (!PageHighMem(page)) {
951 address = (unsigned long)__va(pfn << PAGE_SHIFT); 952 address = (unsigned long)__va(pfn << PAGE_SHIFT);
@@ -959,10 +960,7 @@ int m2p_remove_override(struct page *page,
959 spin_lock_irqsave(&m2p_override_lock, flags); 960 spin_lock_irqsave(&m2p_override_lock, flags);
960 list_del(&page->lru); 961 list_del(&page->lru);
961 spin_unlock_irqrestore(&m2p_override_lock, flags); 962 spin_unlock_irqrestore(&m2p_override_lock, flags);
962 WARN_ON(!PagePrivate(page));
963 ClearPagePrivate(page);
964 963
965 set_phys_to_machine(pfn, page->index);
966 if (kmap_op != NULL) { 964 if (kmap_op != NULL) {
967 if (!PageHighMem(page)) { 965 if (!PageHighMem(page)) {
968 struct multicall_space mcs; 966 struct multicall_space mcs;
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 0a7852483ffe..a8261716d58d 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -30,10 +30,9 @@
30#define XEN_PLATFORM_ERR_PROTOCOL -2 30#define XEN_PLATFORM_ERR_PROTOCOL -2
31#define XEN_PLATFORM_ERR_BLACKLIST -3 31#define XEN_PLATFORM_ERR_BLACKLIST -3
32 32
33/* store the value of xen_emul_unplug after the unplug is done */
34int xen_platform_pci_unplug;
35EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
36#ifdef CONFIG_XEN_PVHVM 33#ifdef CONFIG_XEN_PVHVM
34/* store the value of xen_emul_unplug after the unplug is done */
35static int xen_platform_pci_unplug;
37static int xen_emul_unplug; 36static int xen_emul_unplug;
38 37
39static int check_platform_magic(void) 38static int check_platform_magic(void)
@@ -69,6 +68,80 @@ static int check_platform_magic(void)
69 return 0; 68 return 0;
70} 69}
71 70
71bool xen_has_pv_devices()
72{
73 if (!xen_domain())
74 return false;
75
76 /* PV domains always have them. */
77 if (xen_pv_domain())
78 return true;
79
80 /* And user has xen_platform_pci=0 set in guest config as
81 * driver did not modify the value. */
82 if (xen_platform_pci_unplug == 0)
83 return false;
84
85 if (xen_platform_pci_unplug & XEN_UNPLUG_NEVER)
86 return false;
87
88 if (xen_platform_pci_unplug & XEN_UNPLUG_ALL)
89 return true;
90
91 /* This is an odd one - we are going to run legacy
92 * and PV drivers at the same time. */
93 if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY)
94 return true;
95
96 /* And the caller has to follow with xen_pv_{disk,nic}_devices
97 * to be certain which driver can load. */
98 return false;
99}
100EXPORT_SYMBOL_GPL(xen_has_pv_devices);
101
102static bool __xen_has_pv_device(int state)
103{
104 /* HVM domains might or might not */
105 if (xen_hvm_domain() && (xen_platform_pci_unplug & state))
106 return true;
107
108 return xen_has_pv_devices();
109}
110
111bool xen_has_pv_nic_devices(void)
112{
113 return __xen_has_pv_device(XEN_UNPLUG_ALL_NICS | XEN_UNPLUG_ALL);
114}
115EXPORT_SYMBOL_GPL(xen_has_pv_nic_devices);
116
117bool xen_has_pv_disk_devices(void)
118{
119 return __xen_has_pv_device(XEN_UNPLUG_ALL_IDE_DISKS |
120 XEN_UNPLUG_AUX_IDE_DISKS | XEN_UNPLUG_ALL);
121}
122EXPORT_SYMBOL_GPL(xen_has_pv_disk_devices);
123
124/*
125 * This one is odd - it determines whether you want to run PV _and_
126 * legacy (IDE) drivers together. This combination is only possible
127 * under HVM.
128 */
129bool xen_has_pv_and_legacy_disk_devices(void)
130{
131 if (!xen_domain())
132 return false;
133
134 /* N.B. This is only ever used in HVM mode */
135 if (xen_pv_domain())
136 return false;
137
138 if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY)
139 return true;
140
141 return false;
142}
143EXPORT_SYMBOL_GPL(xen_has_pv_and_legacy_disk_devices);
144
72void xen_unplug_emulated_devices(void) 145void xen_unplug_emulated_devices(void)
73{ 146{
74 int r; 147 int r;
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 68c054f59de6..0982233b9b84 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -27,6 +27,7 @@
27#include <xen/interface/memory.h> 27#include <xen/interface/memory.h>
28#include <xen/interface/physdev.h> 28#include <xen/interface/physdev.h>
29#include <xen/features.h> 29#include <xen/features.h>
30#include "mmu.h"
30#include "xen-ops.h" 31#include "xen-ops.h"
31#include "vdso.h" 32#include "vdso.h"
32 33
@@ -34,7 +35,7 @@
34extern const char xen_hypervisor_callback[]; 35extern const char xen_hypervisor_callback[];
35extern const char xen_failsafe_callback[]; 36extern const char xen_failsafe_callback[];
36#ifdef CONFIG_X86_64 37#ifdef CONFIG_X86_64
37extern const char nmi[]; 38extern asmlinkage void nmi(void);
38#endif 39#endif
39extern void xen_sysenter_target(void); 40extern void xen_sysenter_target(void);
40extern void xen_syscall_target(void); 41extern void xen_syscall_target(void);
@@ -81,6 +82,9 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
81 82
82 memblock_reserve(start, size); 83 memblock_reserve(start, size);
83 84
85 if (xen_feature(XENFEAT_auto_translated_physmap))
86 return;
87
84 xen_max_p2m_pfn = PFN_DOWN(start + size); 88 xen_max_p2m_pfn = PFN_DOWN(start + size);
85 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { 89 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
86 unsigned long mfn = pfn_to_mfn(pfn); 90 unsigned long mfn = pfn_to_mfn(pfn);
@@ -103,6 +107,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
103 .domid = DOMID_SELF 107 .domid = DOMID_SELF
104 }; 108 };
105 unsigned long len = 0; 109 unsigned long len = 0;
110 int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap);
106 unsigned long pfn; 111 unsigned long pfn;
107 int ret; 112 int ret;
108 113
@@ -116,7 +121,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
116 continue; 121 continue;
117 frame = mfn; 122 frame = mfn;
118 } else { 123 } else {
119 if (mfn != INVALID_P2M_ENTRY) 124 if (!xlated_phys && mfn != INVALID_P2M_ENTRY)
120 continue; 125 continue;
121 frame = pfn; 126 frame = pfn;
122 } 127 }
@@ -154,6 +159,13 @@ static unsigned long __init xen_do_chunk(unsigned long start,
154static unsigned long __init xen_release_chunk(unsigned long start, 159static unsigned long __init xen_release_chunk(unsigned long start,
155 unsigned long end) 160 unsigned long end)
156{ 161{
162 /*
163 * Xen already ballooned out the E820 non RAM regions for us
164 * and set them up properly in EPT.
165 */
166 if (xen_feature(XENFEAT_auto_translated_physmap))
167 return end - start;
168
157 return xen_do_chunk(start, end, true); 169 return xen_do_chunk(start, end, true);
158} 170}
159 171
@@ -222,7 +234,13 @@ static void __init xen_set_identity_and_release_chunk(
222 * (except for the ISA region which must be 1:1 mapped) to 234 * (except for the ISA region which must be 1:1 mapped) to
223 * release the refcounts (in Xen) on the original frames. 235 * release the refcounts (in Xen) on the original frames.
224 */ 236 */
225 for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) { 237
238 /*
239 * PVH E820 matches the hypervisor's P2M which means we need to
240 * account for the proper values of *release and *identity.
241 */
242 for (pfn = start_pfn; !xen_feature(XENFEAT_auto_translated_physmap) &&
243 pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
226 pte_t pte = __pte_ma(0); 244 pte_t pte = __pte_ma(0);
227 245
228 if (pfn < PFN_UP(ISA_END_ADDRESS)) 246 if (pfn < PFN_UP(ISA_END_ADDRESS))
@@ -559,20 +577,17 @@ void xen_enable_syscall(void)
559void xen_enable_nmi(void) 577void xen_enable_nmi(void)
560{ 578{
561#ifdef CONFIG_X86_64 579#ifdef CONFIG_X86_64
562 if (register_callback(CALLBACKTYPE_nmi, nmi)) 580 if (register_callback(CALLBACKTYPE_nmi, (char *)nmi))
563 BUG(); 581 BUG();
564#endif 582#endif
565} 583}
566void __init xen_arch_setup(void) 584void __init xen_pvmmu_arch_setup(void)
567{ 585{
568 xen_panic_handler_init();
569
570 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); 586 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
571 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); 587 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
572 588
573 if (!xen_feature(XENFEAT_auto_translated_physmap)) 589 HYPERVISOR_vm_assist(VMASST_CMD_enable,
574 HYPERVISOR_vm_assist(VMASST_CMD_enable, 590 VMASST_TYPE_pae_extended_cr3);
575 VMASST_TYPE_pae_extended_cr3);
576 591
577 if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) || 592 if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) ||
578 register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback)) 593 register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback))
@@ -581,6 +596,15 @@ void __init xen_arch_setup(void)
581 xen_enable_sysenter(); 596 xen_enable_sysenter();
582 xen_enable_syscall(); 597 xen_enable_syscall();
583 xen_enable_nmi(); 598 xen_enable_nmi();
599}
600
601/* This function is not called for HVM domains */
602void __init xen_arch_setup(void)
603{
604 xen_panic_handler_init();
605 if (!xen_feature(XENFEAT_auto_translated_physmap))
606 xen_pvmmu_arch_setup();
607
584#ifdef CONFIG_ACPI 608#ifdef CONFIG_ACPI
585 if (!(xen_start_info->flags & SIF_INITDOMAIN)) { 609 if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
586 printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); 610 printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index c36b325abd83..a18eadd8bb40 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -73,9 +73,11 @@ static void cpu_bringup(void)
73 touch_softlockup_watchdog(); 73 touch_softlockup_watchdog();
74 preempt_disable(); 74 preempt_disable();
75 75
76 xen_enable_sysenter(); 76 /* PVH runs in ring 0 and allows us to do native syscalls. Yay! */
77 xen_enable_syscall(); 77 if (!xen_feature(XENFEAT_supervisor_mode_kernel)) {
78 78 xen_enable_sysenter();
79 xen_enable_syscall();
80 }
79 cpu = smp_processor_id(); 81 cpu = smp_processor_id();
80 smp_store_cpu_info(cpu); 82 smp_store_cpu_info(cpu);
81 cpu_data(cpu).x86_max_cores = 1; 83 cpu_data(cpu).x86_max_cores = 1;
@@ -97,8 +99,14 @@ static void cpu_bringup(void)
97 wmb(); /* make sure everything is out */ 99 wmb(); /* make sure everything is out */
98} 100}
99 101
100static void cpu_bringup_and_idle(void) 102/* Note: cpu parameter is only relevant for PVH */
103static void cpu_bringup_and_idle(int cpu)
101{ 104{
105#ifdef CONFIG_X86_64
106 if (xen_feature(XENFEAT_auto_translated_physmap) &&
107 xen_feature(XENFEAT_supervisor_mode_kernel))
108 xen_pvh_secondary_vcpu_init(cpu);
109#endif
102 cpu_bringup(); 110 cpu_bringup();
103 cpu_startup_entry(CPUHP_ONLINE); 111 cpu_startup_entry(CPUHP_ONLINE);
104} 112}
@@ -274,9 +282,10 @@ static void __init xen_smp_prepare_boot_cpu(void)
274 native_smp_prepare_boot_cpu(); 282 native_smp_prepare_boot_cpu();
275 283
276 if (xen_pv_domain()) { 284 if (xen_pv_domain()) {
277 /* We've switched to the "real" per-cpu gdt, so make sure the 285 if (!xen_feature(XENFEAT_writable_page_tables))
278 old memory can be recycled */ 286 /* We've switched to the "real" per-cpu gdt, so make
279 make_lowmem_page_readwrite(xen_initial_gdt); 287 * sure the old memory can be recycled. */
288 make_lowmem_page_readwrite(xen_initial_gdt);
280 289
281#ifdef CONFIG_X86_32 290#ifdef CONFIG_X86_32
282 /* 291 /*
@@ -360,22 +369,21 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
360 369
361 gdt = get_cpu_gdt_table(cpu); 370 gdt = get_cpu_gdt_table(cpu);
362 371
363 ctxt->flags = VGCF_IN_KERNEL;
364 ctxt->user_regs.ss = __KERNEL_DS;
365#ifdef CONFIG_X86_32 372#ifdef CONFIG_X86_32
373 /* Note: PVH is not yet supported on x86_32. */
366 ctxt->user_regs.fs = __KERNEL_PERCPU; 374 ctxt->user_regs.fs = __KERNEL_PERCPU;
367 ctxt->user_regs.gs = __KERNEL_STACK_CANARY; 375 ctxt->user_regs.gs = __KERNEL_STACK_CANARY;
368#else
369 ctxt->gs_base_kernel = per_cpu_offset(cpu);
370#endif 376#endif
371 ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle; 377 ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle;
372 378
373 memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt)); 379 memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
374 380
375 { 381 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
382 ctxt->flags = VGCF_IN_KERNEL;
376 ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */ 383 ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
377 ctxt->user_regs.ds = __USER_DS; 384 ctxt->user_regs.ds = __USER_DS;
378 ctxt->user_regs.es = __USER_DS; 385 ctxt->user_regs.es = __USER_DS;
386 ctxt->user_regs.ss = __KERNEL_DS;
379 387
380 xen_copy_trap_info(ctxt->trap_ctxt); 388 xen_copy_trap_info(ctxt->trap_ctxt);
381 389
@@ -396,18 +404,27 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
396#ifdef CONFIG_X86_32 404#ifdef CONFIG_X86_32
397 ctxt->event_callback_cs = __KERNEL_CS; 405 ctxt->event_callback_cs = __KERNEL_CS;
398 ctxt->failsafe_callback_cs = __KERNEL_CS; 406 ctxt->failsafe_callback_cs = __KERNEL_CS;
407#else
408 ctxt->gs_base_kernel = per_cpu_offset(cpu);
399#endif 409#endif
400 ctxt->event_callback_eip = 410 ctxt->event_callback_eip =
401 (unsigned long)xen_hypervisor_callback; 411 (unsigned long)xen_hypervisor_callback;
402 ctxt->failsafe_callback_eip = 412 ctxt->failsafe_callback_eip =
403 (unsigned long)xen_failsafe_callback; 413 (unsigned long)xen_failsafe_callback;
414 ctxt->user_regs.cs = __KERNEL_CS;
415 per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir);
416#ifdef CONFIG_X86_32
404 } 417 }
405 ctxt->user_regs.cs = __KERNEL_CS; 418#else
419 } else
420 /* N.B. The user_regs.eip (cpu_bringup_and_idle) is called with
421 * %rdi having the cpu number - which means are passing in
422 * as the first parameter the cpu. Subtle!
423 */
424 ctxt->user_regs.rdi = cpu;
425#endif
406 ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs); 426 ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs);
407
408 per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir);
409 ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(swapper_pg_dir)); 427 ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_mfn(swapper_pg_dir));
410
411 if (HYPERVISOR_vcpu_op(VCPUOP_initialise, cpu, ctxt)) 428 if (HYPERVISOR_vcpu_op(VCPUOP_initialise, cpu, ctxt))
412 BUG(); 429 BUG();
413 430
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 0e36cde12f7e..581521c843a5 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -106,7 +106,7 @@ static DEFINE_PER_CPU(struct xen_lock_waiting, lock_waiting);
106static cpumask_t waiting_cpus; 106static cpumask_t waiting_cpus;
107 107
108static bool xen_pvspin = true; 108static bool xen_pvspin = true;
109static void xen_lock_spinning(struct arch_spinlock *lock, __ticket_t want) 109__visible void xen_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
110{ 110{
111 int irq = __this_cpu_read(lock_kicker_irq); 111 int irq = __this_cpu_read(lock_kicker_irq);
112 struct xen_lock_waiting *w = &__get_cpu_var(lock_waiting); 112 struct xen_lock_waiting *w = &__get_cpu_var(lock_waiting);
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 12a1ca707b94..7b78f88c1707 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -446,6 +446,7 @@ void xen_setup_timer(int cpu)
446 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER| 446 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
447 IRQF_FORCE_RESUME, 447 IRQF_FORCE_RESUME,
448 name, NULL); 448 name, NULL);
449 (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
449 450
450 memcpy(evt, xen_clockevent, sizeof(*evt)); 451 memcpy(evt, xen_clockevent, sizeof(*evt));
451 452
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 7faed5869e5b..485b69585540 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -11,8 +11,28 @@
11#include <asm/page_types.h> 11#include <asm/page_types.h>
12 12
13#include <xen/interface/elfnote.h> 13#include <xen/interface/elfnote.h>
14#include <xen/interface/features.h>
14#include <asm/xen/interface.h> 15#include <asm/xen/interface.h>
15 16
17#ifdef CONFIG_XEN_PVH
18#define PVH_FEATURES_STR "|writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel"
19/* Note the lack of 'hvm_callback_vector'. Older hypervisor will
20 * balk at this being part of XEN_ELFNOTE_FEATURES, so we put it in
21 * XEN_ELFNOTE_SUPPORTED_FEATURES which older hypervisors will ignore.
22 */
23#define PVH_FEATURES ((1 << XENFEAT_writable_page_tables) | \
24 (1 << XENFEAT_auto_translated_physmap) | \
25 (1 << XENFEAT_supervisor_mode_kernel) | \
26 (1 << XENFEAT_hvm_callback_vector))
27/* The XENFEAT_writable_page_tables is not stricly neccessary as we set that
28 * up regardless whether this CONFIG option is enabled or not, but it
29 * clarifies what the right flags need to be.
30 */
31#else
32#define PVH_FEATURES_STR ""
33#define PVH_FEATURES (0)
34#endif
35
16 __INIT 36 __INIT
17ENTRY(startup_xen) 37ENTRY(startup_xen)
18 cld 38 cld
@@ -95,7 +115,10 @@ NEXT_HYPERCALL(arch_6)
95#endif 115#endif
96 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR startup_xen) 116 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR startup_xen)
97 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page) 117 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
98 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz "!writable_page_tables|pae_pgdir_above_4gb") 118 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "!writable_page_tables|pae_pgdir_above_4gb"; .asciz PVH_FEATURES_STR)
119 ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long (PVH_FEATURES) |
120 (1 << XENFEAT_writable_page_tables) |
121 (1 << XENFEAT_dom0))
99 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") 122 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
100 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") 123 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
101 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, 124 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 95f8c6142328..1cb6f4c37300 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -123,4 +123,5 @@ __visible void xen_adjust_exception_frame(void);
123 123
124extern int xen_panic_handler_init(void); 124extern int xen_panic_handler_init(void);
125 125
126void xen_pvh_secondary_vcpu_init(int cpu);
126#endif /* XEN_OPS_H */ 127#endif /* XEN_OPS_H */
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 8d24dcb7cdac..ba56e11cbf77 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -9,7 +9,6 @@ config XTENSA
9 select GENERIC_CLOCKEVENTS 9 select GENERIC_CLOCKEVENTS
10 select VIRT_TO_BUS 10 select VIRT_TO_BUS
11 select GENERIC_IRQ_SHOW 11 select GENERIC_IRQ_SHOW
12 select GENERIC_CPU_DEVICES
13 select GENERIC_SCHED_CLOCK 12 select GENERIC_SCHED_CLOCK
14 select MODULES_USE_ELF_RELA 13 select MODULES_USE_ELF_RELA
15 select GENERIC_PCI_IOMAP 14 select GENERIC_PCI_IOMAP
@@ -19,6 +18,8 @@ config XTENSA
19 select IRQ_DOMAIN 18 select IRQ_DOMAIN
20 select HAVE_OPROFILE 19 select HAVE_OPROFILE
21 select HAVE_FUNCTION_TRACER 20 select HAVE_FUNCTION_TRACER
21 select HAVE_IRQ_TIME_ACCOUNTING
22 select HAVE_PERF_EVENTS
22 help 23 help
23 Xtensa processors are 32-bit RISC machines designed by Tensilica 24 Xtensa processors are 32-bit RISC machines designed by Tensilica
24 primarily for embedded systems. These processors are both 25 primarily for embedded systems. These processors are both
@@ -64,6 +65,12 @@ config MMU
64config VARIANT_IRQ_SWITCH 65config VARIANT_IRQ_SWITCH
65 def_bool n 66 def_bool n
66 67
68config HAVE_XTENSA_GPIO32
69 def_bool n
70
71config MAY_HAVE_SMP
72 def_bool n
73
67menu "Processor type and features" 74menu "Processor type and features"
68 75
69choice 76choice
@@ -73,16 +80,19 @@ choice
73config XTENSA_VARIANT_FSF 80config XTENSA_VARIANT_FSF
74 bool "fsf - default (not generic) configuration" 81 bool "fsf - default (not generic) configuration"
75 select MMU 82 select MMU
83 select HAVE_XTENSA_GPIO32
76 84
77config XTENSA_VARIANT_DC232B 85config XTENSA_VARIANT_DC232B
78 bool "dc232b - Diamond 232L Standard Core Rev.B (LE)" 86 bool "dc232b - Diamond 232L Standard Core Rev.B (LE)"
79 select MMU 87 select MMU
88 select HAVE_XTENSA_GPIO32
80 help 89 help
81 This variant refers to Tensilica's Diamond 232L Standard core Rev.B (LE). 90 This variant refers to Tensilica's Diamond 232L Standard core Rev.B (LE).
82 91
83config XTENSA_VARIANT_DC233C 92config XTENSA_VARIANT_DC233C
84 bool "dc233c - Diamond 233L Standard Core Rev.C (LE)" 93 bool "dc233c - Diamond 233L Standard Core Rev.C (LE)"
85 select MMU 94 select MMU
95 select HAVE_XTENSA_GPIO32
86 help 96 help
87 This variant refers to Tensilica's Diamond 233L Standard core Rev.C (LE). 97 This variant refers to Tensilica's Diamond 233L Standard core Rev.C (LE).
88 98
@@ -104,6 +114,48 @@ config XTENSA_UNALIGNED_USER
104 114
105source "kernel/Kconfig.preempt" 115source "kernel/Kconfig.preempt"
106 116
117config HAVE_SMP
118 bool "System Supports SMP (MX)"
119 depends on MAY_HAVE_SMP
120 select XTENSA_MX
121 help
122 This option is use to indicate that the system-on-a-chip (SOC)
123 supports Multiprocessing. Multiprocessor support implemented above
124 the CPU core definition and currently needs to be selected manually.
125
126 Multiprocessor support in implemented with external cache and
127 interrupt controlers.
128
129 The MX interrupt distributer adds Interprocessor Interrupts
130 and causes the IRQ numbers to be increased by 4 for devices
131 like the open cores ethernet driver and the serial interface.
132
133 You still have to select "Enable SMP" to enable SMP on this SOC.
134
135config SMP
136 bool "Enable Symmetric multi-processing support"
137 depends on HAVE_SMP
138 select USE_GENERIC_SMP_HELPERS
139 select GENERIC_SMP_IDLE_THREAD
140 help
141 Enabled SMP Software; allows more than one CPU/CORE
142 to be activated during startup.
143
144config NR_CPUS
145 depends on SMP
146 int "Maximum number of CPUs (2-32)"
147 range 2 32
148 default "4"
149
150config HOTPLUG_CPU
151 bool "Enable CPU hotplug support"
152 depends on SMP
153 help
154 Say Y here to allow turning CPUs off and on. CPUs can be
155 controlled through /sys/devices/system/cpu.
156
157 Say N if you want to disable CPU hotplug.
158
107config MATH_EMULATION 159config MATH_EMULATION
108 bool "Math emulation" 160 bool "Math emulation"
109 help 161 help
@@ -150,9 +202,6 @@ config XTENSA_CALIBRATE_CCOUNT
150config SERIAL_CONSOLE 202config SERIAL_CONSOLE
151 def_bool n 203 def_bool n
152 204
153config XTENSA_ISS_NETWORK
154 def_bool n
155
156menu "Bus options" 205menu "Bus options"
157 206
158config PCI 207config PCI
@@ -179,7 +228,6 @@ config XTENSA_PLATFORM_ISS
179 depends on TTY 228 depends on TTY
180 select XTENSA_CALIBRATE_CCOUNT 229 select XTENSA_CALIBRATE_CCOUNT
181 select SERIAL_CONSOLE 230 select SERIAL_CONSOLE
182 select XTENSA_ISS_NETWORK
183 help 231 help
184 ISS is an acronym for Tensilica's Instruction Set Simulator. 232 ISS is an acronym for Tensilica's Instruction Set Simulator.
185 233
diff --git a/arch/xtensa/boot/dts/lx60.dts b/arch/xtensa/boot/dts/lx60.dts
index 2eab3658e1bd..a0f8b8ad3920 100644
--- a/arch/xtensa/boot/dts/lx60.dts
+++ b/arch/xtensa/boot/dts/lx60.dts
@@ -3,7 +3,7 @@
3/include/ "xtfpga-flash-4m.dtsi" 3/include/ "xtfpga-flash-4m.dtsi"
4 4
5/ { 5/ {
6 compatible = "xtensa,lx60"; 6 compatible = "cdns,xtensa-lx60";
7 memory@0 { 7 memory@0 {
8 device_type = "memory"; 8 device_type = "memory";
9 reg = <0x00000000 0x04000000>; 9 reg = <0x00000000 0x04000000>;
diff --git a/arch/xtensa/boot/dts/ml605.dts b/arch/xtensa/boot/dts/ml605.dts
index 6ed51d6554e6..905c3a5035e9 100644
--- a/arch/xtensa/boot/dts/ml605.dts
+++ b/arch/xtensa/boot/dts/ml605.dts
@@ -3,7 +3,7 @@
3/include/ "xtfpga-flash-16m.dtsi" 3/include/ "xtfpga-flash-16m.dtsi"
4 4
5/ { 5/ {
6 compatible = "xtensa,ml605"; 6 compatible = "cdns,xtensa-ml605";
7 memory@0 { 7 memory@0 {
8 device_type = "memory"; 8 device_type = "memory";
9 reg = <0x00000000 0x08000000>; 9 reg = <0x00000000 0x08000000>;
diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi
index 7eda6ecf7eef..46b4f5eab421 100644
--- a/arch/xtensa/boot/dts/xtfpga.dtsi
+++ b/arch/xtensa/boot/dts/xtfpga.dtsi
@@ -1,5 +1,5 @@
1/ { 1/ {
2 compatible = "xtensa,xtfpga"; 2 compatible = "cdns,xtensa-xtfpga";
3 #address-cells = <1>; 3 #address-cells = <1>;
4 #size-cells = <1>; 4 #size-cells = <1>;
5 interrupt-parent = <&pic>; 5 interrupt-parent = <&pic>;
@@ -17,7 +17,7 @@
17 #address-cells = <1>; 17 #address-cells = <1>;
18 #size-cells = <0>; 18 #size-cells = <0>;
19 cpu@0 { 19 cpu@0 {
20 compatible = "xtensa,cpu"; 20 compatible = "cdns,xtensa-cpu";
21 reg = <0>; 21 reg = <0>;
22 /* Filled in by platform_setup from FPGA register 22 /* Filled in by platform_setup from FPGA register
23 * clock-frequency = <100000000>; 23 * clock-frequency = <100000000>;
@@ -26,7 +26,7 @@
26 }; 26 };
27 27
28 pic: pic { 28 pic: pic {
29 compatible = "xtensa,pic"; 29 compatible = "cdns,xtensa-pic";
30 /* one cell: internal irq number, 30 /* one cell: internal irq number,
31 * two cells: second cell == 0: internal irq number 31 * two cells: second cell == 0: internal irq number
32 * second cell == 1: external irq number 32 * second cell == 1: external irq number
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 228d6aee3a16..0a337e4a8370 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -8,7 +8,6 @@ generic-y += emergency-restart.h
8generic-y += errno.h 8generic-y += errno.h
9generic-y += exec.h 9generic-y += exec.h
10generic-y += fcntl.h 10generic-y += fcntl.h
11generic-y += futex.h
12generic-y += hardirq.h 11generic-y += hardirq.h
13generic-y += ioctl.h 12generic-y += ioctl.h
14generic-y += irq_regs.h 13generic-y += irq_regs.h
@@ -29,3 +28,4 @@ generic-y += topology.h
29generic-y += trace_clock.h 28generic-y += trace_clock.h
30generic-y += xor.h 29generic-y += xor.h
31generic-y += preempt.h 30generic-y += preempt.h
31generic-y += hash.h
diff --git a/arch/xtensa/include/asm/barrier.h b/arch/xtensa/include/asm/barrier.h
index e1ee6b51dfc5..0a24b04d6b21 100644
--- a/arch/xtensa/include/asm/barrier.h
+++ b/arch/xtensa/include/asm/barrier.h
@@ -13,10 +13,6 @@
13#define rmb() barrier() 13#define rmb() barrier()
14#define wmb() mb() 14#define wmb() mb()
15 15
16#ifdef CONFIG_SMP
17#error smp_* not defined
18#endif
19
20#include <asm-generic/barrier.h> 16#include <asm-generic/barrier.h>
21 17
22#endif /* _XTENSA_SYSTEM_H */ 18#endif /* _XTENSA_SYSTEM_H */
diff --git a/arch/xtensa/include/asm/bitops.h b/arch/xtensa/include/asm/bitops.h
index 84afe58d5d37..7b6873ae84c2 100644
--- a/arch/xtensa/include/asm/bitops.h
+++ b/arch/xtensa/include/asm/bitops.h
@@ -22,12 +22,8 @@
22#include <asm/processor.h> 22#include <asm/processor.h>
23#include <asm/byteorder.h> 23#include <asm/byteorder.h>
24 24
25#ifdef CONFIG_SMP 25#define smp_mb__before_clear_bit() smp_mb()
26# error SMP not supported on this architecture 26#define smp_mb__after_clear_bit() smp_mb()
27#endif
28
29#define smp_mb__before_clear_bit() barrier()
30#define smp_mb__after_clear_bit() barrier()
31 27
32#include <asm-generic/bitops/non-atomic.h> 28#include <asm-generic/bitops/non-atomic.h>
33 29
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index 127cd48883c4..555a98a18453 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -1,18 +1,14 @@
1/* 1/*
2 * include/asm-xtensa/cacheflush.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public 2 * 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 3 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 4 * for more details.
7 * 5 *
8 * (C) 2001 - 2007 Tensilica Inc. 6 * (C) 2001 - 2013 Tensilica Inc.
9 */ 7 */
10 8
11#ifndef _XTENSA_CACHEFLUSH_H 9#ifndef _XTENSA_CACHEFLUSH_H
12#define _XTENSA_CACHEFLUSH_H 10#define _XTENSA_CACHEFLUSH_H
13 11
14#ifdef __KERNEL__
15
16#include <linux/mm.h> 12#include <linux/mm.h>
17#include <asm/processor.h> 13#include <asm/processor.h>
18#include <asm/page.h> 14#include <asm/page.h>
@@ -51,7 +47,6 @@ extern void __invalidate_icache_page(unsigned long);
51extern void __invalidate_icache_range(unsigned long, unsigned long); 47extern void __invalidate_icache_range(unsigned long, unsigned long);
52extern void __invalidate_dcache_range(unsigned long, unsigned long); 48extern void __invalidate_dcache_range(unsigned long, unsigned long);
53 49
54
55#if XCHAL_DCACHE_IS_WRITEBACK 50#if XCHAL_DCACHE_IS_WRITEBACK
56extern void __flush_invalidate_dcache_all(void); 51extern void __flush_invalidate_dcache_all(void);
57extern void __flush_dcache_page(unsigned long); 52extern void __flush_dcache_page(unsigned long);
@@ -87,9 +82,22 @@ static inline void __invalidate_icache_page_alias(unsigned long virt,
87 * (see also Documentation/cachetlb.txt) 82 * (see also Documentation/cachetlb.txt)
88 */ 83 */
89 84
90#if (DCACHE_WAY_SIZE > PAGE_SIZE) 85#if (DCACHE_WAY_SIZE > PAGE_SIZE) || defined(CONFIG_SMP)
86
87#ifdef CONFIG_SMP
88void flush_cache_all(void);
89void flush_cache_range(struct vm_area_struct*, ulong, ulong);
90void flush_icache_range(unsigned long start, unsigned long end);
91void flush_cache_page(struct vm_area_struct*,
92 unsigned long, unsigned long);
93#else
94#define flush_cache_all local_flush_cache_all
95#define flush_cache_range local_flush_cache_range
96#define flush_icache_range local_flush_icache_range
97#define flush_cache_page local_flush_cache_page
98#endif
91 99
92#define flush_cache_all() \ 100#define local_flush_cache_all() \
93 do { \ 101 do { \
94 __flush_invalidate_dcache_all(); \ 102 __flush_invalidate_dcache_all(); \
95 __invalidate_icache_all(); \ 103 __invalidate_icache_all(); \
@@ -103,9 +111,11 @@ static inline void __invalidate_icache_page_alias(unsigned long virt,
103 111
104#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 112#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
105extern void flush_dcache_page(struct page*); 113extern void flush_dcache_page(struct page*);
106extern void flush_cache_range(struct vm_area_struct*, ulong, ulong); 114
107extern void flush_cache_page(struct vm_area_struct*, 115void local_flush_cache_range(struct vm_area_struct *vma,
108 unsigned long, unsigned long); 116 unsigned long start, unsigned long end);
117void local_flush_cache_page(struct vm_area_struct *vma,
118 unsigned long address, unsigned long pfn);
109 119
110#else 120#else
111 121
@@ -119,13 +129,14 @@ extern void flush_cache_page(struct vm_area_struct*,
119#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 129#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
120#define flush_dcache_page(page) do { } while (0) 130#define flush_dcache_page(page) do { } while (0)
121 131
122#define flush_cache_page(vma,addr,pfn) do { } while (0) 132#define flush_icache_range local_flush_icache_range
123#define flush_cache_range(vma,start,end) do { } while (0) 133#define flush_cache_page(vma, addr, pfn) do { } while (0)
134#define flush_cache_range(vma, start, end) do { } while (0)
124 135
125#endif 136#endif
126 137
127/* Ensure consistency between data and instruction cache. */ 138/* Ensure consistency between data and instruction cache. */
128#define flush_icache_range(start,end) \ 139#define local_flush_icache_range(start, end) \
129 do { \ 140 do { \
130 __flush_dcache_range(start, (end) - (start)); \ 141 __flush_dcache_range(start, (end) - (start)); \
131 __invalidate_icache_range(start,(end) - (start)); \ 142 __invalidate_icache_range(start,(end) - (start)); \
@@ -253,5 +264,4 @@ static inline void flush_invalidate_dcache_unaligned(u32 addr, u32 size)
253 } 264 }
254} 265}
255 266
256#endif /* __KERNEL__ */
257#endif /* _XTENSA_CACHEFLUSH_H */ 267#endif /* _XTENSA_CACHEFLUSH_H */
diff --git a/arch/xtensa/include/asm/delay.h b/arch/xtensa/include/asm/delay.h
index 3899610c1dff..24304b39a5c7 100644
--- a/arch/xtensa/include/asm/delay.h
+++ b/arch/xtensa/include/asm/delay.h
@@ -19,23 +19,57 @@ extern unsigned long loops_per_jiffy;
19 19
20static inline void __delay(unsigned long loops) 20static inline void __delay(unsigned long loops)
21{ 21{
22 /* 2 cycles per loop. */ 22 if (__builtin_constant_p(loops) && loops < 2)
23 __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b" 23 __asm__ __volatile__ ("nop");
24 : "=r" (loops) : "0" (loops)); 24 else if (loops >= 2)
25 /* 2 cycles per loop. */
26 __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b"
27 : "+r" (loops));
25} 28}
26 29
27/* For SMP/NUMA systems, change boot_cpu_data to something like 30/* Undefined function to get compile-time error */
28 * local_cpu_data->... where local_cpu_data points to the current 31void __bad_udelay(void);
29 * cpu. */ 32void __bad_ndelay(void);
30 33
31static __inline__ void udelay (unsigned long usecs) 34#define __MAX_UDELAY 30000
35#define __MAX_NDELAY 30000
36
37static inline void __udelay(unsigned long usecs)
32{ 38{
33 unsigned long start = get_ccount(); 39 unsigned long start = get_ccount();
34 unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ)); 40 unsigned long cycles = (usecs * (ccount_freq >> 15)) >> 5;
35 41
36 /* Note: all variables are unsigned (can wrap around)! */ 42 /* Note: all variables are unsigned (can wrap around)! */
37 while (((unsigned long)get_ccount()) - start < cycles) 43 while (((unsigned long)get_ccount()) - start < cycles)
38 ; 44 cpu_relax();
45}
46
47static inline void udelay(unsigned long usec)
48{
49 if (__builtin_constant_p(usec) && usec >= __MAX_UDELAY)
50 __bad_udelay();
51 else
52 __udelay(usec);
53}
54
55static inline void __ndelay(unsigned long nsec)
56{
57 /*
58 * Inner shift makes sure multiplication doesn't overflow
59 * for legitimate nsec values
60 */
61 unsigned long cycles = (nsec * (ccount_freq >> 15)) >> 15;
62 __delay(cycles);
63}
64
65#define ndelay(n) ndelay(n)
66
67static inline void ndelay(unsigned long nsec)
68{
69 if (__builtin_constant_p(nsec) && nsec >= __MAX_NDELAY)
70 __bad_ndelay();
71 else
72 __ndelay(nsec);
39} 73}
40 74
41#endif 75#endif
diff --git a/arch/xtensa/include/asm/ftrace.h b/arch/xtensa/include/asm/ftrace.h
index 73cc3f482304..736b9d214d80 100644
--- a/arch/xtensa/include/asm/ftrace.h
+++ b/arch/xtensa/include/asm/ftrace.h
@@ -18,7 +18,7 @@
18 __asm__ __volatile__ ( \ 18 __asm__ __volatile__ ( \
19 "mov %0, a0\n" \ 19 "mov %0, a0\n" \
20 "mov %1, a1\n" \ 20 "mov %1, a1\n" \
21 : "=r"(a0), "=r"(a1) : : ); \ 21 : "=r"(a0), "=r"(a1)); \
22 MAKE_PC_FROM_RA(a0, a1); }) 22 MAKE_PC_FROM_RA(a0, a1); })
23#ifdef CONFIG_FRAME_POINTER 23#ifdef CONFIG_FRAME_POINTER
24extern unsigned long return_address(unsigned level); 24extern unsigned long return_address(unsigned level);
diff --git a/arch/xtensa/include/asm/futex.h b/arch/xtensa/include/asm/futex.h
new file mode 100644
index 000000000000..b39531babec0
--- /dev/null
+++ b/arch/xtensa/include/asm/futex.h
@@ -0,0 +1,147 @@
1/*
2 * Atomic futex routines
3 *
4 * Based on the PowerPC implementataion
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 * Copyright (C) 2013 TangoTec Ltd.
11 *
12 * Baruch Siach <baruch@tkos.co.il>
13 */
14
15#ifndef _ASM_XTENSA_FUTEX_H
16#define _ASM_XTENSA_FUTEX_H
17
18#ifdef __KERNEL__
19
20#include <linux/futex.h>
21#include <linux/uaccess.h>
22#include <linux/errno.h>
23
24#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
25 __asm__ __volatile( \
26 "1: l32i %0, %2, 0\n" \
27 insn "\n" \
28 " wsr %0, scompare1\n" \
29 "2: s32c1i %1, %2, 0\n" \
30 " bne %1, %0, 1b\n" \
31 " movi %1, 0\n" \
32 "3:\n" \
33 " .section .fixup,\"ax\"\n" \
34 " .align 4\n" \
35 "4: .long 3b\n" \
36 "5: l32r %0, 4b\n" \
37 " movi %1, %3\n" \
38 " jx %0\n" \
39 " .previous\n" \
40 " .section __ex_table,\"a\"\n" \
41 " .long 1b,5b,2b,5b\n" \
42 " .previous\n" \
43 : "=&r" (oldval), "=&r" (ret) \
44 : "r" (uaddr), "I" (-EFAULT), "r" (oparg) \
45 : "memory")
46
47static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
48{
49 int op = (encoded_op >> 28) & 7;
50 int cmp = (encoded_op >> 24) & 15;
51 int oparg = (encoded_op << 8) >> 20;
52 int cmparg = (encoded_op << 20) >> 20;
53 int oldval = 0, ret;
54 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
55 oparg = 1 << oparg;
56
57 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
58 return -EFAULT;
59
60#if !XCHAL_HAVE_S32C1I
61 return -ENOSYS;
62#endif
63
64 pagefault_disable();
65
66 switch (op) {
67 case FUTEX_OP_SET:
68 __futex_atomic_op("mov %1, %4", ret, oldval, uaddr, oparg);
69 break;
70 case FUTEX_OP_ADD:
71 __futex_atomic_op("add %1, %0, %4", ret, oldval, uaddr,
72 oparg);
73 break;
74 case FUTEX_OP_OR:
75 __futex_atomic_op("or %1, %0, %4", ret, oldval, uaddr,
76 oparg);
77 break;
78 case FUTEX_OP_ANDN:
79 __futex_atomic_op("and %1, %0, %4", ret, oldval, uaddr,
80 ~oparg);
81 break;
82 case FUTEX_OP_XOR:
83 __futex_atomic_op("xor %1, %0, %4", ret, oldval, uaddr,
84 oparg);
85 break;
86 default:
87 ret = -ENOSYS;
88 }
89
90 pagefault_enable();
91
92 if (ret)
93 return ret;
94
95 switch (cmp) {
96 case FUTEX_OP_CMP_EQ: return (oldval == cmparg);
97 case FUTEX_OP_CMP_NE: return (oldval != cmparg);
98 case FUTEX_OP_CMP_LT: return (oldval < cmparg);
99 case FUTEX_OP_CMP_GE: return (oldval >= cmparg);
100 case FUTEX_OP_CMP_LE: return (oldval <= cmparg);
101 case FUTEX_OP_CMP_GT: return (oldval > cmparg);
102 }
103
104 return -ENOSYS;
105}
106
107static inline int
108futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
109 u32 oldval, u32 newval)
110{
111 int ret = 0;
112 u32 prev;
113
114 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
115 return -EFAULT;
116
117#if !XCHAL_HAVE_S32C1I
118 return -ENOSYS;
119#endif
120
121 __asm__ __volatile__ (
122 " # futex_atomic_cmpxchg_inatomic\n"
123 "1: l32i %1, %3, 0\n"
124 " mov %0, %5\n"
125 " wsr %1, scompare1\n"
126 "2: s32c1i %0, %3, 0\n"
127 "3:\n"
128 " .section .fixup,\"ax\"\n"
129 " .align 4\n"
130 "4: .long 3b\n"
131 "5: l32r %1, 4b\n"
132 " movi %0, %6\n"
133 " jx %1\n"
134 " .previous\n"
135 " .section __ex_table,\"a\"\n"
136 " .long 1b,5b,2b,5b\n"
137 " .previous\n"
138 : "+r" (ret), "=&r" (prev), "+m" (*uaddr)
139 : "r" (uaddr), "r" (oldval), "r" (newval), "I" (-EFAULT)
140 : "memory");
141
142 *uval = prev;
143 return ret;
144}
145
146#endif /* __KERNEL__ */
147#endif /* _ASM_XTENSA_FUTEX_H */
diff --git a/arch/xtensa/include/asm/initialize_mmu.h b/arch/xtensa/include/asm/initialize_mmu.h
index 722553f17db3..600781edc8a3 100644
--- a/arch/xtensa/include/asm/initialize_mmu.h
+++ b/arch/xtensa/include/asm/initialize_mmu.h
@@ -26,6 +26,9 @@
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/vectors.h> 27#include <asm/vectors.h>
28 28
29#define CA_BYPASS (_PAGE_CA_BYPASS | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
30#define CA_WRITEBACK (_PAGE_CA_WB | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
31
29#ifdef __ASSEMBLY__ 32#ifdef __ASSEMBLY__
30 33
31#define XTENSA_HWVERSION_RC_2009_0 230000 34#define XTENSA_HWVERSION_RC_2009_0 230000
@@ -80,8 +83,6 @@
80 /* Step 2: map 0x40000000..0x47FFFFFF to paddr containing this code 83 /* Step 2: map 0x40000000..0x47FFFFFF to paddr containing this code
81 * and jump to the new mapping. 84 * and jump to the new mapping.
82 */ 85 */
83#define CA_BYPASS (_PAGE_CA_BYPASS | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
84#define CA_WRITEBACK (_PAGE_CA_WB | _PAGE_HW_WRITE | _PAGE_HW_EXEC)
85 86
86 srli a3, a0, 27 87 srli a3, a0, 27
87 slli a3, a3, 27 88 slli a3, a3, 27
@@ -123,13 +124,13 @@
123 wdtlb a4, a5 124 wdtlb a4, a5
124 witlb a4, a5 125 witlb a4, a5
125 126
126 movi a5, 0xe0000006 127 movi a5, XCHAL_KIO_CACHED_VADDR + 6
127 movi a4, 0xf0000000 + CA_WRITEBACK 128 movi a4, XCHAL_KIO_DEFAULT_PADDR + CA_WRITEBACK
128 wdtlb a4, a5 129 wdtlb a4, a5
129 witlb a4, a5 130 witlb a4, a5
130 131
131 movi a5, 0xf0000006 132 movi a5, XCHAL_KIO_BYPASS_VADDR + 6
132 movi a4, 0xf0000000 + CA_BYPASS 133 movi a4, XCHAL_KIO_DEFAULT_PADDR + CA_BYPASS
133 wdtlb a4, a5 134 wdtlb a4, a5
134 witlb a4, a5 135 witlb a4, a5
135 136
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 700c2e6f2d25..2a042d430c25 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -14,20 +14,26 @@
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15#include <asm/byteorder.h> 15#include <asm/byteorder.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/vectors.h>
17#include <linux/bug.h> 18#include <linux/bug.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19 20
20#include <linux/types.h> 21#include <linux/types.h>
21 22
22#define XCHAL_KIO_CACHED_VADDR 0xe0000000
23#define XCHAL_KIO_BYPASS_VADDR 0xf0000000
24#define XCHAL_KIO_PADDR 0xf0000000
25#define XCHAL_KIO_SIZE 0x10000000
26
27#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x)) 23#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
28#define IO_SPACE_LIMIT ~0 24#define IO_SPACE_LIMIT ~0
29 25
30#ifdef CONFIG_MMU 26#ifdef CONFIG_MMU
27
28#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF
29extern unsigned long xtensa_kio_paddr;
30
31static inline unsigned long xtensa_get_kio_paddr(void)
32{
33 return xtensa_kio_paddr;
34}
35#endif
36
31/* 37/*
32 * Return the virtual address for the specified bus memory. 38 * Return the virtual address for the specified bus memory.
33 * Note that we currently don't support any address outside the KIO segment. 39 * Note that we currently don't support any address outside the KIO segment.
diff --git a/arch/xtensa/include/asm/irq.h b/arch/xtensa/include/asm/irq.h
index 4c0ccc9c4f4c..f71f88ea7646 100644
--- a/arch/xtensa/include/asm/irq.h
+++ b/arch/xtensa/include/asm/irq.h
@@ -43,5 +43,14 @@ static __inline__ int irq_canonicalize(int irq)
43} 43}
44 44
45struct irqaction; 45struct irqaction;
46struct irq_domain;
47
48void migrate_irqs(void);
49int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
50 unsigned long int_irq, unsigned long ext_irq,
51 unsigned long *out_hwirq, unsigned int *out_type);
52int xtensa_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw);
53unsigned xtensa_map_ext_irq(unsigned ext_irq);
54unsigned xtensa_get_ext_irq_no(unsigned irq);
46 55
47#endif /* _XTENSA_IRQ_H */ 56#endif /* _XTENSA_IRQ_H */
diff --git a/arch/xtensa/include/asm/mmu.h b/arch/xtensa/include/asm/mmu.h
index 8554b2c8b17a..71afe418d0e5 100644
--- a/arch/xtensa/include/asm/mmu.h
+++ b/arch/xtensa/include/asm/mmu.h
@@ -1,11 +1,9 @@
1/* 1/*
2 * include/asm-xtensa/mmu.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public 2 * 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 3 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 4 * for more details.
7 * 5 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 6 * Copyright (C) 2001 - 2013 Tensilica Inc.
9 */ 7 */
10 8
11#ifndef _XTENSA_MMU_H 9#ifndef _XTENSA_MMU_H
@@ -15,8 +13,10 @@
15#include <asm-generic/mmu.h> 13#include <asm-generic/mmu.h>
16#else 14#else
17 15
18/* Default "unsigned long" context */ 16typedef struct {
19typedef unsigned long mm_context_t; 17 unsigned long asid[NR_CPUS];
18 unsigned int cpu;
19} mm_context_t;
20 20
21#endif /* CONFIG_MMU */ 21#endif /* CONFIG_MMU */
22#endif /* _XTENSA_MMU_H */ 22#endif /* _XTENSA_MMU_H */
diff --git a/arch/xtensa/include/asm/mmu_context.h b/arch/xtensa/include/asm/mmu_context.h
index d43525a286bb..d33c71a8c9ec 100644
--- a/arch/xtensa/include/asm/mmu_context.h
+++ b/arch/xtensa/include/asm/mmu_context.h
@@ -1,13 +1,11 @@
1/* 1/*
2 * include/asm-xtensa/mmu_context.h
3 *
4 * Switch an MMU context. 2 * Switch an MMU context.
5 * 3 *
6 * This file is subject to the terms and conditions of the GNU General Public 4 * 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 5 * License. See the file "COPYING" in the main directory of this archive
8 * for more details. 6 * for more details.
9 * 7 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2013 Tensilica Inc.
11 */ 9 */
12 10
13#ifndef _XTENSA_MMU_CONTEXT_H 11#ifndef _XTENSA_MMU_CONTEXT_H
@@ -20,22 +18,25 @@
20#include <linux/stringify.h> 18#include <linux/stringify.h>
21#include <linux/sched.h> 19#include <linux/sched.h>
22 20
23#include <variant/core.h> 21#include <asm/vectors.h>
24 22
25#include <asm/pgtable.h> 23#include <asm/pgtable.h>
26#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
27#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
28#include <asm-generic/mm_hooks.h> 26#include <asm-generic/mm_hooks.h>
27#include <asm-generic/percpu.h>
29 28
30#if (XCHAL_HAVE_TLBS != 1) 29#if (XCHAL_HAVE_TLBS != 1)
31# error "Linux must have an MMU!" 30# error "Linux must have an MMU!"
32#endif 31#endif
33 32
34extern unsigned long asid_cache; 33DECLARE_PER_CPU(unsigned long, asid_cache);
34#define cpu_asid_cache(cpu) per_cpu(asid_cache, cpu)
35 35
36/* 36/*
37 * NO_CONTEXT is the invalid ASID value that we don't ever assign to 37 * NO_CONTEXT is the invalid ASID value that we don't ever assign to
38 * any user or kernel context. 38 * any user or kernel context. We use the reserved values in the
39 * ASID_INSERT macro below.
39 * 40 *
40 * 0 invalid 41 * 0 invalid
41 * 1 kernel 42 * 1 kernel
@@ -49,6 +50,12 @@ extern unsigned long asid_cache;
49#define ASID_MASK ((1 << XCHAL_MMU_ASID_BITS) - 1) 50#define ASID_MASK ((1 << XCHAL_MMU_ASID_BITS) - 1)
50#define ASID_INSERT(x) (0x03020001 | (((x) & ASID_MASK) << 8)) 51#define ASID_INSERT(x) (0x03020001 | (((x) & ASID_MASK) << 8))
51 52
53#ifdef CONFIG_MMU
54void init_mmu(void);
55#else
56static inline void init_mmu(void) { }
57#endif
58
52static inline void set_rasid_register (unsigned long val) 59static inline void set_rasid_register (unsigned long val)
53{ 60{
54 __asm__ __volatile__ (" wsr %0, rasid\n\t" 61 __asm__ __volatile__ (" wsr %0, rasid\n\t"
@@ -62,64 +69,77 @@ static inline unsigned long get_rasid_register (void)
62 return tmp; 69 return tmp;
63} 70}
64 71
65static inline void 72static inline void get_new_mmu_context(struct mm_struct *mm, unsigned int cpu)
66__get_new_mmu_context(struct mm_struct *mm)
67{ 73{
68 extern void flush_tlb_all(void); 74 unsigned long asid = cpu_asid_cache(cpu);
69 if (! (++asid_cache & ASID_MASK) ) { 75 if ((++asid & ASID_MASK) == 0) {
70 flush_tlb_all(); /* start new asid cycle */ 76 /*
71 asid_cache += ASID_USER_FIRST; 77 * Start new asid cycle; continue counting with next
78 * incarnation bits; skipping over 0, 1, 2, 3.
79 */
80 local_flush_tlb_all();
81 asid += ASID_USER_FIRST;
72 } 82 }
73 mm->context = asid_cache; 83 cpu_asid_cache(cpu) = asid;
84 mm->context.asid[cpu] = asid;
85 mm->context.cpu = cpu;
74} 86}
75 87
76static inline void 88static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
77__load_mmu_context(struct mm_struct *mm)
78{ 89{
79 set_rasid_register(ASID_INSERT(mm->context)); 90 /*
91 * Check if our ASID is of an older version and thus invalid.
92 */
93
94 if (mm) {
95 unsigned long asid = mm->context.asid[cpu];
96
97 if (asid == NO_CONTEXT ||
98 ((asid ^ cpu_asid_cache(cpu)) & ~ASID_MASK))
99 get_new_mmu_context(mm, cpu);
100 }
101}
102
103static inline void activate_context(struct mm_struct *mm, unsigned int cpu)
104{
105 get_mmu_context(mm, cpu);
106 set_rasid_register(ASID_INSERT(mm->context.asid[cpu]));
80 invalidate_page_directory(); 107 invalidate_page_directory();
81} 108}
82 109
83/* 110/*
84 * Initialize the context related info for a new mm_struct 111 * Initialize the context related info for a new mm_struct
85 * instance. 112 * instance. Valid cpu values are 0..(NR_CPUS-1), so initializing
113 * to -1 says the process has never run on any core.
86 */ 114 */
87 115
88static inline int 116static inline int init_new_context(struct task_struct *tsk,
89init_new_context(struct task_struct *tsk, struct mm_struct *mm) 117 struct mm_struct *mm)
90{ 118{
91 mm->context = NO_CONTEXT; 119 int cpu;
120 for_each_possible_cpu(cpu) {
121 mm->context.asid[cpu] = NO_CONTEXT;
122 }
123 mm->context.cpu = -1;
92 return 0; 124 return 0;
93} 125}
94 126
95/*
96 * After we have set current->mm to a new value, this activates
97 * the context for the new mm so we see the new mappings.
98 */
99static inline void
100activate_mm(struct mm_struct *prev, struct mm_struct *next)
101{
102 /* Unconditionally get a new ASID. */
103
104 __get_new_mmu_context(next);
105 __load_mmu_context(next);
106}
107
108
109static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 127static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
110 struct task_struct *tsk) 128 struct task_struct *tsk)
111{ 129{
112 unsigned long asid = asid_cache; 130 unsigned int cpu = smp_processor_id();
113 131 int migrated = next->context.cpu != cpu;
114 /* Check if our ASID is of an older version and thus invalid */ 132 /* Flush the icache if we migrated to a new core. */
115 133 if (migrated) {
116 if (next->context == NO_CONTEXT || ((next->context^asid) & ~ASID_MASK)) 134 __invalidate_icache_all();
117 __get_new_mmu_context(next); 135 next->context.cpu = cpu;
118 136 }
119 __load_mmu_context(next); 137 if (migrated || prev != next)
138 activate_context(next, cpu);
120} 139}
121 140
122#define deactivate_mm(tsk, mm) do { } while(0) 141#define activate_mm(prev, next) switch_mm((prev), (next), NULL)
142#define deactivate_mm(tsk, mm) do { } while (0)
123 143
124/* 144/*
125 * Destroy context related info for an mm_struct that is about 145 * Destroy context related info for an mm_struct that is about
diff --git a/arch/xtensa/include/asm/mxregs.h b/arch/xtensa/include/asm/mxregs.h
new file mode 100644
index 000000000000..73dcc5456f68
--- /dev/null
+++ b/arch/xtensa/include/asm/mxregs.h
@@ -0,0 +1,46 @@
1/*
2 * Xtensa MX interrupt distributor
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 * Copyright (C) 2008 - 2013 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_MXREGS_H
12#define _XTENSA_MXREGS_H
13
14/*
15 * RER/WER at, as Read/write external register
16 * at: value
17 * as: address
18 *
19 * Address Value
20 * 00nn 0...0p..p Interrupt Routing, route IRQ n to processor p
21 * 01pp 0...0d..d 16 bits (d) 'ored' as single IPI to processor p
22 * 0180 0...0m..m Clear enable specified by mask (m)
23 * 0184 0...0m..m Set enable specified by mask (m)
24 * 0190 0...0x..x 8-bit IPI partition register
25 * VVVVVVVVPPPPUUUUUUUUUUUUUUUUU
26 * V (10-bit) Release/Version
27 * P ( 4-bit) Number of cores - 1
28 * U (18-bit) ID
29 * 01a0 i.......i 32-bit ConfigID
30 * 0200 0...0m..m RunStall core 'n'
31 * 0220 c Cache coherency enabled
32 */
33
34#define MIROUT(irq) (0x000 + (irq))
35#define MIPICAUSE(cpu) (0x100 + (cpu))
36#define MIPISET(cause) (0x140 + (cause))
37#define MIENG 0x180
38#define MIENGSET 0x184
39#define MIASG 0x188 /* Read Global Assert Register */
40#define MIASGSET 0x18c /* Set Global Addert Regiter */
41#define MIPIPART 0x190
42#define SYSCFGID 0x1a0
43#define MPSCORE 0x200
44#define CCON 0x220
45
46#endif /* _XTENSA_MXREGS_H */
diff --git a/arch/xtensa/include/asm/perf_event.h b/arch/xtensa/include/asm/perf_event.h
new file mode 100644
index 000000000000..5aa4590acaae
--- /dev/null
+++ b/arch/xtensa/include/asm/perf_event.h
@@ -0,0 +1,4 @@
1#ifndef __ASM_XTENSA_PERF_EVENT_H
2#define __ASM_XTENSA_PERF_EVENT_H
3
4#endif /* __ASM_XTENSA_PERF_EVENT_H */
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h
index 7e409a5b0ec5..abb59708a3b7 100644
--- a/arch/xtensa/include/asm/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -191,5 +191,25 @@ extern unsigned long get_wchan(struct task_struct *p);
191#define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);}) 191#define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);})
192#define get_sr(sr) ({unsigned int v; RSR(v,sr); v; }) 192#define get_sr(sr) ({unsigned int v; RSR(v,sr); v; })
193 193
194#ifndef XCHAL_HAVE_EXTERN_REGS
195#define XCHAL_HAVE_EXTERN_REGS 0
196#endif
197
198#if XCHAL_HAVE_EXTERN_REGS
199
200static inline void set_er(unsigned long value, unsigned long addr)
201{
202 asm volatile ("wer %0, %1" : : "a" (value), "a" (addr) : "memory");
203}
204
205static inline unsigned long get_er(unsigned long addr)
206{
207 register unsigned long value;
208 asm volatile ("rer %0, %1" : "=a" (value) : "a" (addr) : "memory");
209 return value;
210}
211
212#endif /* XCHAL_HAVE_EXTERN_REGS */
213
194#endif /* __ASSEMBLY__ */ 214#endif /* __ASSEMBLY__ */
195#endif /* _XTENSA_PROCESSOR_H */ 215#endif /* _XTENSA_PROCESSOR_H */
diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h
index 81f31bc9dde0..598e752dcbcd 100644
--- a/arch/xtensa/include/asm/ptrace.h
+++ b/arch/xtensa/include/asm/ptrace.h
@@ -59,9 +59,17 @@ struct pt_regs {
59 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1) 59 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
60# define user_mode(regs) (((regs)->ps & 0x00000020)!=0) 60# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
61# define instruction_pointer(regs) ((regs)->pc) 61# define instruction_pointer(regs) ((regs)->pc)
62# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
63 (regs)->areg[1]))
62 64
63# ifndef CONFIG_SMP 65# ifndef CONFIG_SMP
64# define profile_pc(regs) instruction_pointer(regs) 66# define profile_pc(regs) instruction_pointer(regs)
67# else
68# define profile_pc(regs) \
69 ({ \
70 in_lock_functions(instruction_pointer(regs)) ? \
71 return_pointer(regs) : instruction_pointer(regs); \
72 })
65# endif 73# endif
66 74
67#define user_stack_pointer(regs) ((regs)->areg[1]) 75#define user_stack_pointer(regs) ((regs)->areg[1])
diff --git a/arch/xtensa/include/asm/smp.h b/arch/xtensa/include/asm/smp.h
index 83c569e3bdbd..4e43f5643891 100644
--- a/arch/xtensa/include/asm/smp.h
+++ b/arch/xtensa/include/asm/smp.h
@@ -1,27 +1,43 @@
1/* 1/*
2 * include/asm-xtensa/smp.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public 2 * 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 3 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 4 * for more details.
7 * 5 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 6 * Copyright (C) 2001 - 2013 Tensilica Inc.
9 */ 7 */
10 8
11#ifndef _XTENSA_SMP_H 9#ifndef _XTENSA_SMP_H
12#define _XTENSA_SMP_H 10#define _XTENSA_SMP_H
13 11
14extern struct xtensa_cpuinfo boot_cpu_data; 12#ifdef CONFIG_SMP
15 13
16#define cpu_data (&boot_cpu_data) 14#define raw_smp_processor_id() (current_thread_info()->cpu)
17#define current_cpu_data boot_cpu_data 15#define cpu_logical_map(cpu) (cpu)
18 16
19struct xtensa_cpuinfo { 17struct start_info {
20 unsigned long *pgd_cache; 18 unsigned long stack;
21 unsigned long *pte_cache;
22 unsigned long pgtable_cache_sz;
23}; 19};
20extern struct start_info start_info;
24 21
25#define cpu_logical_map(cpu) (cpu) 22struct cpumask;
23void arch_send_call_function_ipi_mask(const struct cpumask *mask);
24void arch_send_call_function_single_ipi(int cpu);
25
26void smp_init_cpus(void);
27void secondary_init_irq(void);
28void ipi_init(void);
29struct seq_file;
30void show_ipi_list(struct seq_file *p, int prec);
31
32#ifdef CONFIG_HOTPLUG_CPU
33
34void __cpu_die(unsigned int cpu);
35int __cpu_disable(void);
36void cpu_die(void);
37void cpu_restart(void);
38
39#endif /* CONFIG_HOTPLUG_CPU */
40
41#endif /* CONFIG_SMP */
26 42
27#endif /* _XTENSA_SMP_H */ 43#endif /* _XTENSA_SMP_H */
diff --git a/arch/xtensa/include/asm/spinlock.h b/arch/xtensa/include/asm/spinlock.h
index 03975906b36f..1d95fa5dcd10 100644
--- a/arch/xtensa/include/asm/spinlock.h
+++ b/arch/xtensa/include/asm/spinlock.h
@@ -28,13 +28,13 @@
28 * 1 somebody owns the spinlock 28 * 1 somebody owns the spinlock
29 */ 29 */
30 30
31#define __raw_spin_is_locked(x) ((x)->slock != 0) 31#define arch_spin_is_locked(x) ((x)->slock != 0)
32#define __raw_spin_unlock_wait(lock) \ 32#define arch_spin_unlock_wait(lock) \
33 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 33 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
34 34
35#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 35#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
36 36
37static inline void __raw_spin_lock(raw_spinlock_t *lock) 37static inline void arch_spin_lock(arch_spinlock_t *lock)
38{ 38{
39 unsigned long tmp; 39 unsigned long tmp;
40 40
@@ -51,7 +51,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
51 51
52/* Returns 1 if the lock is obtained, 0 otherwise. */ 52/* Returns 1 if the lock is obtained, 0 otherwise. */
53 53
54static inline int __raw_spin_trylock(raw_spinlock_t *lock) 54static inline int arch_spin_trylock(arch_spinlock_t *lock)
55{ 55{
56 unsigned long tmp; 56 unsigned long tmp;
57 57
@@ -67,7 +67,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
67 return tmp == 0 ? 1 : 0; 67 return tmp == 0 ? 1 : 0;
68} 68}
69 69
70static inline void __raw_spin_unlock(raw_spinlock_t *lock) 70static inline void arch_spin_unlock(arch_spinlock_t *lock)
71{ 71{
72 unsigned long tmp; 72 unsigned long tmp;
73 73
@@ -96,9 +96,9 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
96 * 0x80000000 one writer owns the rwlock, no other writers, no readers 96 * 0x80000000 one writer owns the rwlock, no other writers, no readers
97 */ 97 */
98 98
99#define __raw_write_can_lock(x) ((x)->lock == 0) 99#define arch_write_can_lock(x) ((x)->lock == 0)
100 100
101static inline void __raw_write_lock(raw_rwlock_t *rw) 101static inline void arch_write_lock(arch_rwlock_t *rw)
102{ 102{
103 unsigned long tmp; 103 unsigned long tmp;
104 104
@@ -116,7 +116,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
116 116
117/* Returns 1 if the lock is obtained, 0 otherwise. */ 117/* Returns 1 if the lock is obtained, 0 otherwise. */
118 118
119static inline int __raw_write_trylock(raw_rwlock_t *rw) 119static inline int arch_write_trylock(arch_rwlock_t *rw)
120{ 120{
121 unsigned long tmp; 121 unsigned long tmp;
122 122
@@ -133,7 +133,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
133 return tmp == 0 ? 1 : 0; 133 return tmp == 0 ? 1 : 0;
134} 134}
135 135
136static inline void __raw_write_unlock(raw_rwlock_t *rw) 136static inline void arch_write_unlock(arch_rwlock_t *rw)
137{ 137{
138 unsigned long tmp; 138 unsigned long tmp;
139 139
@@ -145,7 +145,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
145 : "memory"); 145 : "memory");
146} 146}
147 147
148static inline void __raw_read_lock(raw_rwlock_t *rw) 148static inline void arch_read_lock(arch_rwlock_t *rw)
149{ 149{
150 unsigned long tmp; 150 unsigned long tmp;
151 unsigned long result; 151 unsigned long result;
@@ -164,7 +164,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
164 164
165/* Returns 1 if the lock is obtained, 0 otherwise. */ 165/* Returns 1 if the lock is obtained, 0 otherwise. */
166 166
167static inline int __raw_read_trylock(raw_rwlock_t *rw) 167static inline int arch_read_trylock(arch_rwlock_t *rw)
168{ 168{
169 unsigned long result; 169 unsigned long result;
170 unsigned long tmp; 170 unsigned long tmp;
@@ -184,7 +184,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
184 return result == 0; 184 return result == 0;
185} 185}
186 186
187static inline void __raw_read_unlock(raw_rwlock_t *rw) 187static inline void arch_read_unlock(arch_rwlock_t *rw)
188{ 188{
189 unsigned long tmp1, tmp2; 189 unsigned long tmp1, tmp2;
190 190
@@ -199,4 +199,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
199 : "memory"); 199 : "memory");
200} 200}
201 201
202#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
203#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
204
202#endif /* _XTENSA_SPINLOCK_H */ 205#endif /* _XTENSA_SPINLOCK_H */
diff --git a/arch/xtensa/include/asm/spinlock_types.h b/arch/xtensa/include/asm/spinlock_types.h
new file mode 100644
index 000000000000..7ec5ce10c9e9
--- /dev/null
+++ b/arch/xtensa/include/asm/spinlock_types.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int slock;
10} arch_spinlock_t;
11
12#define __ARCH_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} arch_rwlock_t;
17
18#define __ARCH_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/arch/xtensa/include/asm/timex.h b/arch/xtensa/include/asm/timex.h
index 27fa3c170662..ca929e6a38b5 100644
--- a/arch/xtensa/include/asm/timex.h
+++ b/arch/xtensa/include/asm/timex.h
@@ -1,18 +1,14 @@
1/* 1/*
2 * include/asm-xtensa/timex.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public 2 * 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 3 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 4 * for more details.
7 * 5 *
8 * Copyright (C) 2001 - 2008 Tensilica Inc. 6 * Copyright (C) 2001 - 2013 Tensilica Inc.
9 */ 7 */
10 8
11#ifndef _XTENSA_TIMEX_H 9#ifndef _XTENSA_TIMEX_H
12#define _XTENSA_TIMEX_H 10#define _XTENSA_TIMEX_H
13 11
14#ifdef __KERNEL__
15
16#include <asm/processor.h> 12#include <asm/processor.h>
17#include <linux/stringify.h> 13#include <linux/stringify.h>
18 14
@@ -39,14 +35,9 @@ extern unsigned long ccount_freq;
39 35
40typedef unsigned long long cycles_t; 36typedef unsigned long long cycles_t;
41 37
42/*
43 * Only used for SMP.
44 */
45
46extern cycles_t cacheflush_time;
47
48#define get_cycles() (0) 38#define get_cycles() (0)
49 39
40void local_timer_setup(unsigned cpu);
50 41
51/* 42/*
52 * Register access. 43 * Register access.
@@ -81,5 +72,4 @@ static inline void set_linux_timer (unsigned long ccompare)
81 WSR_CCOMPARE(LINUX_TIMER, ccompare); 72 WSR_CCOMPARE(LINUX_TIMER, ccompare);
82} 73}
83 74
84#endif /* __KERNEL__ */
85#endif /* _XTENSA_TIMEX_H */ 75#endif /* _XTENSA_TIMEX_H */
diff --git a/arch/xtensa/include/asm/tlbflush.h b/arch/xtensa/include/asm/tlbflush.h
index 43dd348a5a47..fc34274ce41b 100644
--- a/arch/xtensa/include/asm/tlbflush.h
+++ b/arch/xtensa/include/asm/tlbflush.h
@@ -1,18 +1,14 @@
1/* 1/*
2 * include/asm-xtensa/tlbflush.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public 2 * 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 3 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 4 * for more details.
7 * 5 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc. 6 * Copyright (C) 2001 - 2013 Tensilica Inc.
9 */ 7 */
10 8
11#ifndef _XTENSA_TLBFLUSH_H 9#ifndef _XTENSA_TLBFLUSH_H
12#define _XTENSA_TLBFLUSH_H 10#define _XTENSA_TLBFLUSH_H
13 11
14#ifdef __KERNEL__
15
16#include <linux/stringify.h> 12#include <linux/stringify.h>
17#include <asm/processor.h> 13#include <asm/processor.h>
18 14
@@ -34,12 +30,37 @@
34 * - flush_tlb_range(mm, start, end) flushes a range of pages 30 * - flush_tlb_range(mm, start, end) flushes a range of pages
35 */ 31 */
36 32
37extern void flush_tlb_all(void); 33void local_flush_tlb_all(void);
38extern void flush_tlb_mm(struct mm_struct*); 34void local_flush_tlb_mm(struct mm_struct *mm);
39extern void flush_tlb_page(struct vm_area_struct*,unsigned long); 35void local_flush_tlb_page(struct vm_area_struct *vma,
40extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long); 36 unsigned long page);
37void local_flush_tlb_range(struct vm_area_struct *vma,
38 unsigned long start, unsigned long end);
39
40#ifdef CONFIG_SMP
41
42void flush_tlb_all(void);
43void flush_tlb_mm(struct mm_struct *);
44void flush_tlb_page(struct vm_area_struct *, unsigned long);
45void flush_tlb_range(struct vm_area_struct *, unsigned long,
46 unsigned long);
47
48static inline void flush_tlb_kernel_range(unsigned long start,
49 unsigned long end)
50{
51 flush_tlb_all();
52}
53
54#else /* !CONFIG_SMP */
55
56#define flush_tlb_all() local_flush_tlb_all()
57#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
58#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
59#define flush_tlb_range(vma, vmaddr, end) local_flush_tlb_range(vma, vmaddr, \
60 end)
61#define flush_tlb_kernel_range(start, end) local_flush_tlb_all()
41 62
42#define flush_tlb_kernel_range(start,end) flush_tlb_all() 63#endif /* CONFIG_SMP */
43 64
44/* TLB operations. */ 65/* TLB operations. */
45 66
@@ -187,5 +208,4 @@ static inline unsigned long read_itlb_translation (int way)
187} 208}
188 209
189#endif /* __ASSEMBLY__ */ 210#endif /* __ASSEMBLY__ */
190#endif /* __KERNEL__ */
191#endif /* _XTENSA_TLBFLUSH_H */ 211#endif /* _XTENSA_TLBFLUSH_H */
diff --git a/arch/xtensa/include/asm/traps.h b/arch/xtensa/include/asm/traps.h
index 917488a0ab00..8c194f6af45e 100644
--- a/arch/xtensa/include/asm/traps.h
+++ b/arch/xtensa/include/asm/traps.h
@@ -19,6 +19,7 @@
19 */ 19 */
20extern void * __init trap_set_handler(int cause, void *handler); 20extern void * __init trap_set_handler(int cause, void *handler);
21extern void do_unhandled(struct pt_regs *regs, unsigned long exccause); 21extern void do_unhandled(struct pt_regs *regs, unsigned long exccause);
22void secondary_trap_init(void);
22 23
23static inline void spill_registers(void) 24static inline void spill_registers(void)
24{ 25{
diff --git a/arch/xtensa/include/asm/vectors.h b/arch/xtensa/include/asm/vectors.h
index c52b656d0310..5791b45d5a5d 100644
--- a/arch/xtensa/include/asm/vectors.h
+++ b/arch/xtensa/include/asm/vectors.h
@@ -20,6 +20,17 @@
20 20
21#include <variant/core.h> 21#include <variant/core.h>
22 22
23#define XCHAL_KIO_CACHED_VADDR 0xe0000000
24#define XCHAL_KIO_BYPASS_VADDR 0xf0000000
25#define XCHAL_KIO_DEFAULT_PADDR 0xf0000000
26#define XCHAL_KIO_SIZE 0x10000000
27
28#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF
29#define XCHAL_KIO_PADDR xtensa_get_kio_paddr()
30#else
31#define XCHAL_KIO_PADDR XCHAL_KIO_DEFAULT_PADDR
32#endif
33
23#if defined(CONFIG_MMU) 34#if defined(CONFIG_MMU)
24 35
25/* Will Become VECBASE */ 36/* Will Become VECBASE */
@@ -30,11 +41,9 @@
30 41
31#if defined(XCHAL_HAVE_PTP_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY 42#if defined(XCHAL_HAVE_PTP_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
32 /* MMU v3 - XCHAL_HAVE_PTP_MMU == 1 */ 43 /* MMU v3 - XCHAL_HAVE_PTP_MMU == 1 */
33 #define PHYSICAL_MEMORY_ADDRESS 0x00000000
34 #define LOAD_MEMORY_ADDRESS 0x00003000 44 #define LOAD_MEMORY_ADDRESS 0x00003000
35#else 45#else
36 /* MMU V2 - XCHAL_HAVE_PTP_MMU == 0 */ 46 /* MMU V2 - XCHAL_HAVE_PTP_MMU == 0 */
37 #define PHYSICAL_MEMORY_ADDRESS 0xD0000000
38 #define LOAD_MEMORY_ADDRESS 0xD0003000 47 #define LOAD_MEMORY_ADDRESS 0xD0003000
39#endif 48#endif
40 49
@@ -46,7 +55,6 @@
46 55
47 /* Location of the start of the kernel text, _start */ 56 /* Location of the start of the kernel text, _start */
48 #define KERNELOFFSET 0x00003000 57 #define KERNELOFFSET 0x00003000
49 #define PHYSICAL_MEMORY_ADDRESS 0x00000000
50 58
51 /* Loaded just above possibly live vectors */ 59 /* Loaded just above possibly live vectors */
52 #define LOAD_MEMORY_ADDRESS 0x00003000 60 #define LOAD_MEMORY_ADDRESS 0x00003000
@@ -54,7 +62,6 @@
54#endif /* CONFIG_MMU */ 62#endif /* CONFIG_MMU */
55 63
56#define XC_VADDR(offset) (VIRTUAL_MEMORY_ADDRESS + offset) 64#define XC_VADDR(offset) (VIRTUAL_MEMORY_ADDRESS + offset)
57#define XC_PADDR(offset) (PHYSICAL_MEMORY_ADDRESS + offset)
58 65
59/* Used to set VECBASE register */ 66/* Used to set VECBASE register */
60#define VECBASE_RESET_VADDR VIRTUAL_MEMORY_ADDRESS 67#define VECBASE_RESET_VADDR VIRTUAL_MEMORY_ADDRESS
@@ -67,7 +74,7 @@
67 VECBASE_RESET_VADDR) 74 VECBASE_RESET_VADDR)
68#define RESET_VECTOR1_VADDR XC_VADDR(RESET_VECTOR1_VECOFS) 75#define RESET_VECTOR1_VADDR XC_VADDR(RESET_VECTOR1_VECOFS)
69 76
70#if XCHAL_HAVE_VECBASE 77#if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE
71 78
72#define USER_VECTOR_VADDR XC_VADDR(XCHAL_USER_VECOFS) 79#define USER_VECTOR_VADDR XC_VADDR(XCHAL_USER_VECOFS)
73#define KERNEL_VECTOR_VADDR XC_VADDR(XCHAL_KERNEL_VECOFS) 80#define KERNEL_VECTOR_VADDR XC_VADDR(XCHAL_KERNEL_VECOFS)
@@ -81,11 +88,9 @@
81 88
82#define DEBUG_VECTOR_VADDR XC_VADDR(XCHAL_DEBUG_VECOFS) 89#define DEBUG_VECTOR_VADDR XC_VADDR(XCHAL_DEBUG_VECOFS)
83 90
84#undef XCHAL_NMI_VECTOR_VADDR 91#define NMI_VECTOR_VADDR XC_VADDR(XCHAL_NMI_VECOFS)
85#define XCHAL_NMI_VECTOR_VADDR XC_VADDR(XCHAL_NMI_VECOFS)
86 92
87#undef XCHAL_INTLEVEL7_VECTOR_VADDR 93#define INTLEVEL7_VECTOR_VADDR XC_VADDR(XCHAL_INTLEVEL7_VECOFS)
88#define XCHAL_INTLEVEL7_VECTOR_VADDR XC_VADDR(XCHAL_INTLEVEL7_VECOFS)
89 94
90/* 95/*
91 * These XCHAL_* #defines from varian/core.h 96 * These XCHAL_* #defines from varian/core.h
diff --git a/arch/xtensa/include/uapi/asm/socket.h b/arch/xtensa/include/uapi/asm/socket.h
index 7db5c22faa68..39acec0cf0b1 100644
--- a/arch/xtensa/include/uapi/asm/socket.h
+++ b/arch/xtensa/include/uapi/asm/socket.h
@@ -89,4 +89,6 @@
89 89
90#define SO_MAX_PACING_RATE 47 90#define SO_MAX_PACING_RATE 47
91 91
92#define SO_BPF_EXTENSIONS 48
93
92#endif /* _XTENSA_SOCKET_H */ 94#endif /* _XTENSA_SOCKET_H */
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index f90265ec1ccc..18d962a8c0c2 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_KGDB) += xtensa-stub.o
12obj-$(CONFIG_PCI) += pci.o 12obj-$(CONFIG_PCI) += pci.o
13obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o 13obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
14obj-$(CONFIG_FUNCTION_TRACER) += mcount.o 14obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
15obj-$(CONFIG_SMP) += smp.o mxhead.o
15 16
16AFLAGS_head.o += -mtext-section-literals 17AFLAGS_head.o += -mtext-section-literals
17 18
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index 7d740ebbe198..aeeb3cc8a410 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -19,6 +19,7 @@
19#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/cacheasm.h> 20#include <asm/cacheasm.h>
21#include <asm/initialize_mmu.h> 21#include <asm/initialize_mmu.h>
22#include <asm/mxregs.h>
22 23
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/linkage.h> 25#include <linux/linkage.h>
@@ -54,7 +55,7 @@ ENTRY(_start)
54 55
55 /* Preserve the pointer to the boot parameter list in EXCSAVE_1 */ 56 /* Preserve the pointer to the boot parameter list in EXCSAVE_1 */
56 wsr a2, excsave1 57 wsr a2, excsave1
57 _j _SetupMMU 58 _j _SetupOCD
58 59
59 .align 4 60 .align 4
60 .literal_position 61 .literal_position
@@ -62,6 +63,23 @@ ENTRY(_start)
62 .word _startup 63 .word _startup
63 64
64 .align 4 65 .align 4
66_SetupOCD:
67 /*
68 * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions).
69 * Set Interrupt Level just below XCHAL_DEBUGLEVEL to allow
70 * xt-gdb to single step via DEBUG exceptions received directly
71 * by ocd.
72 */
73 movi a1, 1
74 movi a0, 0
75 wsr a1, windowstart
76 wsr a0, windowbase
77 rsync
78
79 movi a1, LOCKLEVEL
80 wsr a1, ps
81 rsync
82
65 .global _SetupMMU 83 .global _SetupMMU
66_SetupMMU: 84_SetupMMU:
67 Offset = _SetupMMU - _start 85 Offset = _SetupMMU - _start
@@ -85,24 +103,11 @@ _SetupMMU:
85 103
86ENDPROC(_start) 104ENDPROC(_start)
87 105
88 __INIT 106 __REF
89 .literal_position 107 .literal_position
90 108
91ENTRY(_startup) 109ENTRY(_startup)
92 110
93 /* Disable interrupts and exceptions. */
94
95 movi a0, LOCKLEVEL
96 wsr a0, ps
97
98 /* Start with a fresh windowbase and windowstart. */
99
100 movi a1, 1
101 movi a0, 0
102 wsr a1, windowstart
103 wsr a0, windowbase
104 rsync
105
106 /* Set a0 to 0 for the remaining initialization. */ 111 /* Set a0 to 0 for the remaining initialization. */
107 112
108 movi a0, 0 113 movi a0, 0
@@ -154,17 +159,6 @@ ENTRY(_startup)
154 wsr a0, cpenable 159 wsr a0, cpenable
155#endif 160#endif
156 161
157 /* Set PS.INTLEVEL=LOCKLEVEL, PS.WOE=0, kernel stack, PS.EXCM=0
158 *
159 * Note: PS.EXCM must be cleared before using any loop
160 * instructions; otherwise, they are silently disabled, and
161 * at most one iteration of the loop is executed.
162 */
163
164 movi a1, LOCKLEVEL
165 wsr a1, ps
166 rsync
167
168 /* Initialize the caches. 162 /* Initialize the caches.
169 * a2, a3 are just working registers (clobbered). 163 * a2, a3 are just working registers (clobbered).
170 */ 164 */
@@ -182,6 +176,37 @@ ENTRY(_startup)
182 176
183 isync 177 isync
184 178
179#ifdef CONFIG_HAVE_SMP
180 movi a2, CCON # MX External Register to Configure Cache
181 movi a3, 1
182 wer a3, a2
183#endif
184
185 /* Setup stack and enable window exceptions (keep irqs disabled) */
186
187 movi a1, start_info
188 l32i a1, a1, 0
189
190 movi a2, (1 << PS_WOE_BIT) | LOCKLEVEL
191 # WOE=1, INTLEVEL=LOCKLEVEL, UM=0
192 wsr a2, ps # (enable reg-windows; progmode stack)
193 rsync
194
195 /* Set up EXCSAVE[DEBUGLEVEL] to point to the Debug Exception Handler.*/
196
197 movi a2, debug_exception
198 wsr a2, SREG_EXCSAVE + XCHAL_DEBUGLEVEL
199
200#ifdef CONFIG_SMP
201 /*
202 * Notice that we assume with SMP that cores have PRID
203 * supported by the cores.
204 */
205 rsr a2, prid
206 bnez a2, .Lboot_secondary
207
208#endif /* CONFIG_SMP */
209
185 /* Unpack data sections 210 /* Unpack data sections
186 * 211 *
187 * The linker script used to build the Linux kernel image 212 * The linker script used to build the Linux kernel image
@@ -234,24 +259,7 @@ ENTRY(_startup)
234 ___invalidate_icache_all a2 a3 259 ___invalidate_icache_all a2 a3
235 isync 260 isync
236 261
237 /* Setup stack and enable window exceptions (keep irqs disabled) */ 262 movi a6, 0
238
239 movi a1, init_thread_union
240 addi a1, a1, KERNEL_STACK_SIZE
241
242 movi a2, (1 << PS_WOE_BIT) | LOCKLEVEL
243 # WOE=1, INTLEVEL=LOCKLEVEL, UM=0
244 wsr a2, ps # (enable reg-windows; progmode stack)
245 rsync
246
247 /* Set up EXCSAVE[DEBUGLEVEL] to point to the Debug Exception Handler.*/
248
249 movi a2, debug_exception
250 wsr a2, SREG_EXCSAVE + XCHAL_DEBUGLEVEL
251
252 /* Set up EXCSAVE[1] to point to the exc_table. */
253
254 movi a6, exc_table
255 xsr a6, excsave1 263 xsr a6, excsave1
256 264
257 /* init_arch kick-starts the linux kernel */ 265 /* init_arch kick-starts the linux kernel */
@@ -265,8 +273,93 @@ ENTRY(_startup)
265should_never_return: 273should_never_return:
266 j should_never_return 274 j should_never_return
267 275
276#ifdef CONFIG_SMP
277.Lboot_secondary:
278
279 movi a2, cpu_start_ccount
2801:
281 l32i a3, a2, 0
282 beqi a3, 0, 1b
283 movi a3, 0
284 s32i a3, a2, 0
285 memw
2861:
287 l32i a3, a2, 0
288 beqi a3, 0, 1b
289 wsr a3, ccount
290 movi a3, 0
291 s32i a3, a2, 0
292 memw
293
294 movi a6, 0
295 wsr a6, excsave1
296
297 movi a4, secondary_start_kernel
298 callx4 a4
299 j should_never_return
300
301#endif /* CONFIG_SMP */
302
268ENDPROC(_startup) 303ENDPROC(_startup)
269 304
305#ifdef CONFIG_HOTPLUG_CPU
306
307ENTRY(cpu_restart)
308
309#if XCHAL_DCACHE_IS_WRITEBACK
310 ___flush_invalidate_dcache_all a2 a3
311#else
312 ___invalidate_dcache_all a2 a3
313#endif
314 memw
315 movi a2, CCON # MX External Register to Configure Cache
316 movi a3, 0
317 wer a3, a2
318 extw
319
320 rsr a0, prid
321 neg a2, a0
322 movi a3, cpu_start_id
323 s32i a2, a3, 0
324#if XCHAL_DCACHE_IS_WRITEBACK
325 dhwbi a3, 0
326#endif
3271:
328 l32i a2, a3, 0
329 dhi a3, 0
330 bne a2, a0, 1b
331
332 /*
333 * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions).
334 * Set Interrupt Level just below XCHAL_DEBUGLEVEL to allow
335 * xt-gdb to single step via DEBUG exceptions received directly
336 * by ocd.
337 */
338 movi a1, 1
339 movi a0, 0
340 wsr a1, windowstart
341 wsr a0, windowbase
342 rsync
343
344 movi a1, LOCKLEVEL
345 wsr a1, ps
346 rsync
347
348 j _startup
349
350ENDPROC(cpu_restart)
351
352#endif /* CONFIG_HOTPLUG_CPU */
353
354/*
355 * DATA section
356 */
357
358 .section ".data.init.refok"
359 .align 4
360ENTRY(start_info)
361 .long init_thread_union + KERNEL_STACK_SIZE
362
270/* 363/*
271 * BSS section 364 * BSS section
272 */ 365 */
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index 6f4f9749cff7..482868a2de6e 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -4,7 +4,7 @@
4 * Xtensa built-in interrupt controller and some generic functions copied 4 * Xtensa built-in interrupt controller and some generic functions copied
5 * from i386. 5 * from i386.
6 * 6 *
7 * Copyright (C) 2002 - 2006 Tensilica, Inc. 7 * Copyright (C) 2002 - 2013 Tensilica, Inc.
8 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 8 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
9 * 9 *
10 * 10 *
@@ -18,36 +18,27 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/kernel_stat.h> 20#include <linux/kernel_stat.h>
21#include <linux/irqchip.h>
22#include <linux/irqchip/xtensa-mx.h>
23#include <linux/irqchip/xtensa-pic.h>
21#include <linux/irqdomain.h> 24#include <linux/irqdomain.h>
22#include <linux/of.h> 25#include <linux/of.h>
23 26
27#include <asm/mxregs.h>
24#include <asm/uaccess.h> 28#include <asm/uaccess.h>
25#include <asm/platform.h> 29#include <asm/platform.h>
26 30
27static unsigned int cached_irq_mask;
28
29atomic_t irq_err_count; 31atomic_t irq_err_count;
30 32
31static struct irq_domain *root_domain;
32
33/*
34 * do_IRQ handles all normal device IRQ's (the special
35 * SMP cross-CPU interrupts have their own specific
36 * handlers).
37 */
38
39asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs) 33asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
40{ 34{
41 struct pt_regs *old_regs = set_irq_regs(regs); 35 int irq = irq_find_mapping(NULL, hwirq);
42 int irq = irq_find_mapping(root_domain, hwirq);
43 36
44 if (hwirq >= NR_IRQS) { 37 if (hwirq >= NR_IRQS) {
45 printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 38 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
46 __func__, hwirq); 39 __func__, hwirq);
47 } 40 }
48 41
49 irq_enter();
50
51#ifdef CONFIG_DEBUG_STACKOVERFLOW 42#ifdef CONFIG_DEBUG_STACKOVERFLOW
52 /* Debugging check for stack overflow: is there less than 1KB free? */ 43 /* Debugging check for stack overflow: is there less than 1KB free? */
53 { 44 {
@@ -62,95 +53,69 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
62 } 53 }
63#endif 54#endif
64 generic_handle_irq(irq); 55 generic_handle_irq(irq);
65
66 irq_exit();
67 set_irq_regs(old_regs);
68} 56}
69 57
70int arch_show_interrupts(struct seq_file *p, int prec) 58int arch_show_interrupts(struct seq_file *p, int prec)
71{ 59{
60#ifdef CONFIG_SMP
61 show_ipi_list(p, prec);
62#endif
72 seq_printf(p, "%*s: ", prec, "ERR"); 63 seq_printf(p, "%*s: ", prec, "ERR");
73 seq_printf(p, "%10u\n", atomic_read(&irq_err_count)); 64 seq_printf(p, "%10u\n", atomic_read(&irq_err_count));
74 return 0; 65 return 0;
75} 66}
76 67
77static void xtensa_irq_mask(struct irq_data *d) 68int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
78{ 69 unsigned long int_irq, unsigned long ext_irq,
79 cached_irq_mask &= ~(1 << d->hwirq); 70 unsigned long *out_hwirq, unsigned int *out_type)
80 set_sr (cached_irq_mask, intenable);
81}
82
83static void xtensa_irq_unmask(struct irq_data *d)
84{
85 cached_irq_mask |= 1 << d->hwirq;
86 set_sr (cached_irq_mask, intenable);
87}
88
89static void xtensa_irq_enable(struct irq_data *d)
90{
91 variant_irq_enable(d->hwirq);
92 xtensa_irq_unmask(d);
93}
94
95static void xtensa_irq_disable(struct irq_data *d)
96{
97 xtensa_irq_mask(d);
98 variant_irq_disable(d->hwirq);
99}
100
101static void xtensa_irq_ack(struct irq_data *d)
102{
103 set_sr(1 << d->hwirq, intclear);
104}
105
106static int xtensa_irq_retrigger(struct irq_data *d)
107{ 71{
108 set_sr(1 << d->hwirq, intset); 72 if (WARN_ON(intsize < 1 || intsize > 2))
109 return 1; 73 return -EINVAL;
74 if (intsize == 2 && intspec[1] == 1) {
75 int_irq = xtensa_map_ext_irq(ext_irq);
76 if (int_irq < XCHAL_NUM_INTERRUPTS)
77 *out_hwirq = int_irq;
78 else
79 return -EINVAL;
80 } else {
81 *out_hwirq = int_irq;
82 }
83 *out_type = IRQ_TYPE_NONE;
84 return 0;
110} 85}
111 86
112static struct irq_chip xtensa_irq_chip = { 87int xtensa_irq_map(struct irq_domain *d, unsigned int irq,
113 .name = "xtensa",
114 .irq_enable = xtensa_irq_enable,
115 .irq_disable = xtensa_irq_disable,
116 .irq_mask = xtensa_irq_mask,
117 .irq_unmask = xtensa_irq_unmask,
118 .irq_ack = xtensa_irq_ack,
119 .irq_retrigger = xtensa_irq_retrigger,
120};
121
122static int xtensa_irq_map(struct irq_domain *d, unsigned int irq,
123 irq_hw_number_t hw) 88 irq_hw_number_t hw)
124{ 89{
90 struct irq_chip *irq_chip = d->host_data;
125 u32 mask = 1 << hw; 91 u32 mask = 1 << hw;
126 92
127 if (mask & XCHAL_INTTYPE_MASK_SOFTWARE) { 93 if (mask & XCHAL_INTTYPE_MASK_SOFTWARE) {
128 irq_set_chip_and_handler_name(irq, &xtensa_irq_chip, 94 irq_set_chip_and_handler_name(irq, irq_chip,
129 handle_simple_irq, "level"); 95 handle_simple_irq, "level");
130 irq_set_status_flags(irq, IRQ_LEVEL); 96 irq_set_status_flags(irq, IRQ_LEVEL);
131 } else if (mask & XCHAL_INTTYPE_MASK_EXTERN_EDGE) { 97 } else if (mask & XCHAL_INTTYPE_MASK_EXTERN_EDGE) {
132 irq_set_chip_and_handler_name(irq, &xtensa_irq_chip, 98 irq_set_chip_and_handler_name(irq, irq_chip,
133 handle_edge_irq, "edge"); 99 handle_edge_irq, "edge");
134 irq_clear_status_flags(irq, IRQ_LEVEL); 100 irq_clear_status_flags(irq, IRQ_LEVEL);
135 } else if (mask & XCHAL_INTTYPE_MASK_EXTERN_LEVEL) { 101 } else if (mask & XCHAL_INTTYPE_MASK_EXTERN_LEVEL) {
136 irq_set_chip_and_handler_name(irq, &xtensa_irq_chip, 102 irq_set_chip_and_handler_name(irq, irq_chip,
137 handle_level_irq, "level"); 103 handle_level_irq, "level");
138 irq_set_status_flags(irq, IRQ_LEVEL); 104 irq_set_status_flags(irq, IRQ_LEVEL);
139 } else if (mask & XCHAL_INTTYPE_MASK_TIMER) { 105 } else if (mask & XCHAL_INTTYPE_MASK_TIMER) {
140 irq_set_chip_and_handler_name(irq, &xtensa_irq_chip, 106 irq_set_chip_and_handler_name(irq, irq_chip,
141 handle_edge_irq, "edge"); 107 handle_percpu_irq, "timer");
142 irq_clear_status_flags(irq, IRQ_LEVEL); 108 irq_clear_status_flags(irq, IRQ_LEVEL);
143 } else {/* XCHAL_INTTYPE_MASK_WRITE_ERROR */ 109 } else {/* XCHAL_INTTYPE_MASK_WRITE_ERROR */
144 /* XCHAL_INTTYPE_MASK_NMI */ 110 /* XCHAL_INTTYPE_MASK_NMI */
145 111 irq_set_chip_and_handler_name(irq, irq_chip,
146 irq_set_chip_and_handler_name(irq, &xtensa_irq_chip,
147 handle_level_irq, "level"); 112 handle_level_irq, "level");
148 irq_set_status_flags(irq, IRQ_LEVEL); 113 irq_set_status_flags(irq, IRQ_LEVEL);
149 } 114 }
150 return 0; 115 return 0;
151} 116}
152 117
153static unsigned map_ext_irq(unsigned ext_irq) 118unsigned xtensa_map_ext_irq(unsigned ext_irq)
154{ 119{
155 unsigned mask = XCHAL_INTTYPE_MASK_EXTERN_EDGE | 120 unsigned mask = XCHAL_INTTYPE_MASK_EXTERN_EDGE |
156 XCHAL_INTTYPE_MASK_EXTERN_LEVEL; 121 XCHAL_INTTYPE_MASK_EXTERN_LEVEL;
@@ -163,55 +128,77 @@ static unsigned map_ext_irq(unsigned ext_irq)
163 return XCHAL_NUM_INTERRUPTS; 128 return XCHAL_NUM_INTERRUPTS;
164} 129}
165 130
166/* 131unsigned xtensa_get_ext_irq_no(unsigned irq)
167 * Device Tree IRQ specifier translation function which works with one or
168 * two cell bindings. First cell value maps directly to the hwirq number.
169 * Second cell if present specifies whether hwirq number is external (1) or
170 * internal (0).
171 */
172int xtensa_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
173 const u32 *intspec, unsigned int intsize,
174 unsigned long *out_hwirq, unsigned int *out_type)
175{ 132{
176 if (WARN_ON(intsize < 1 || intsize > 2)) 133 unsigned mask = (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
177 return -EINVAL; 134 XCHAL_INTTYPE_MASK_EXTERN_LEVEL) &
178 if (intsize == 2 && intspec[1] == 1) { 135 ((1u << irq) - 1);
179 unsigned int_irq = map_ext_irq(intspec[0]); 136 return hweight32(mask);
180 if (int_irq < XCHAL_NUM_INTERRUPTS)
181 *out_hwirq = int_irq;
182 else
183 return -EINVAL;
184 } else {
185 *out_hwirq = intspec[0];
186 }
187 *out_type = IRQ_TYPE_NONE;
188 return 0;
189} 137}
190 138
191static const struct irq_domain_ops xtensa_irq_domain_ops = {
192 .xlate = xtensa_irq_domain_xlate,
193 .map = xtensa_irq_map,
194};
195
196void __init init_IRQ(void) 139void __init init_IRQ(void)
197{ 140{
198 struct device_node *intc = NULL;
199
200 cached_irq_mask = 0;
201 set_sr(~0, intclear);
202
203#ifdef CONFIG_OF 141#ifdef CONFIG_OF
204 /* The interrupt controller device node is mandatory */ 142 irqchip_init();
205 intc = of_find_compatible_node(NULL, NULL, "xtensa,pic"); 143#else
206 BUG_ON(!intc); 144#ifdef CONFIG_HAVE_SMP
207 145 xtensa_mx_init_legacy(NULL);
208 root_domain = irq_domain_add_linear(intc, NR_IRQS,
209 &xtensa_irq_domain_ops, NULL);
210#else 146#else
211 root_domain = irq_domain_add_legacy(intc, NR_IRQS, 0, 0, 147 xtensa_pic_init_legacy(NULL);
212 &xtensa_irq_domain_ops, NULL); 148#endif
213#endif 149#endif
214 irq_set_default_host(root_domain);
215 150
151#ifdef CONFIG_SMP
152 ipi_init();
153#endif
216 variant_init_irq(); 154 variant_init_irq();
217} 155}
156
157#ifdef CONFIG_HOTPLUG_CPU
158static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
159{
160 struct irq_desc *desc = irq_to_desc(irq);
161 struct irq_chip *chip = irq_data_get_irq_chip(data);
162 unsigned long flags;
163
164 raw_spin_lock_irqsave(&desc->lock, flags);
165 if (chip->irq_set_affinity)
166 chip->irq_set_affinity(data, cpumask_of(cpu), false);
167 raw_spin_unlock_irqrestore(&desc->lock, flags);
168}
169
170/*
171 * The CPU has been marked offline. Migrate IRQs off this CPU. If
172 * the affinity settings do not allow other CPUs, force them onto any
173 * available CPU.
174 */
175void migrate_irqs(void)
176{
177 unsigned int i, cpu = smp_processor_id();
178 struct irq_desc *desc;
179
180 for_each_irq_desc(i, desc) {
181 struct irq_data *data = irq_desc_get_irq_data(desc);
182 unsigned int newcpu;
183
184 if (irqd_is_per_cpu(data))
185 continue;
186
187 if (!cpumask_test_cpu(cpu, data->affinity))
188 continue;
189
190 newcpu = cpumask_any_and(data->affinity, cpu_online_mask);
191
192 if (newcpu >= nr_cpu_ids) {
193 pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n",
194 i, cpu);
195
196 cpumask_setall(data->affinity);
197 newcpu = cpumask_any_and(data->affinity,
198 cpu_online_mask);
199 }
200
201 route_irq(data, i, newcpu);
202 }
203}
204#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/xtensa/kernel/mxhead.S b/arch/xtensa/kernel/mxhead.S
new file mode 100644
index 000000000000..77a161a112c5
--- /dev/null
+++ b/arch/xtensa/kernel/mxhead.S
@@ -0,0 +1,85 @@
1/*
2 * Xtensa Secondary Processors startup code.
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 * Copyright (C) 2001 - 2013 Tensilica Inc.
9 *
10 * Joe Taylor <joe@tensilica.com>
11 * Chris Zankel <chris@zankel.net>
12 * Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca>
13 * Pete Delaney <piet@tensilica.com>
14 */
15
16#include <linux/linkage.h>
17
18#include <asm/cacheasm.h>
19#include <asm/initialize_mmu.h>
20#include <asm/mxregs.h>
21#include <asm/regs.h>
22
23
24 .section .SecondaryResetVector.text, "ax"
25
26
27ENTRY(_SecondaryResetVector)
28 _j _SetupOCD
29
30 .begin no-absolute-literals
31 .literal_position
32
33_SetupOCD:
34 /*
35 * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions).
36 * Set Interrupt Level just below XCHAL_DEBUGLEVEL to allow
37 * xt-gdb to single step via DEBUG exceptions received directly
38 * by ocd.
39 */
40 movi a1, 1
41 movi a0, 0
42 wsr a1, windowstart
43 wsr a0, windowbase
44 rsync
45
46 movi a1, LOCKLEVEL
47 wsr a1, ps
48 rsync
49
50_SetupMMU:
51 Offset = _SetupMMU - _SecondaryResetVector
52
53#ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
54 initialize_mmu
55#endif
56
57 /*
58 * Start Secondary Processors with NULL pointer to boot params.
59 */
60 movi a2, 0 # a2 == NULL
61 movi a3, _startup
62 jx a3
63
64 .end no-absolute-literals
65
66
67 .section .SecondaryResetVector.remapped_text, "ax"
68 .global _RemappedSecondaryResetVector
69
70 .org 0 # Need to do org before literals
71
72_RemappedSecondaryResetVector:
73 .begin no-absolute-literals
74 .literal_position
75
76 _j _RemappedSetupMMU
77 . = _RemappedSecondaryResetVector + Offset
78
79_RemappedSetupMMU:
80
81#ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
82 initialize_mmu
83#endif
84
85 .end no-absolute-literals
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 6e2b6638122d..7d12af1317f1 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -21,6 +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#include <linux/percpu.h>
25#include <linux/cpu.h>
24#include <linux/of_fdt.h> 26#include <linux/of_fdt.h>
25#include <linux/of_platform.h> 27#include <linux/of_platform.h>
26 28
@@ -37,6 +39,7 @@
37#endif 39#endif
38 40
39#include <asm/bootparam.h> 41#include <asm/bootparam.h>
42#include <asm/mmu_context.h>
40#include <asm/pgtable.h> 43#include <asm/pgtable.h>
41#include <asm/processor.h> 44#include <asm/processor.h>
42#include <asm/timex.h> 45#include <asm/timex.h>
@@ -45,6 +48,7 @@
45#include <asm/setup.h> 48#include <asm/setup.h>
46#include <asm/param.h> 49#include <asm/param.h>
47#include <asm/traps.h> 50#include <asm/traps.h>
51#include <asm/smp.h>
48 52
49#include <platform/hardware.h> 53#include <platform/hardware.h>
50 54
@@ -85,12 +89,6 @@ static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
85 89
86sysmem_info_t __initdata sysmem; 90sysmem_info_t __initdata sysmem;
87 91
88#ifdef CONFIG_MMU
89extern void init_mmu(void);
90#else
91static inline void init_mmu(void) { }
92#endif
93
94extern int mem_reserve(unsigned long, unsigned long, int); 92extern int mem_reserve(unsigned long, unsigned long, int);
95extern void bootmem_init(void); 93extern void bootmem_init(void);
96extern void zones_init(void); 94extern void zones_init(void);
@@ -214,6 +212,42 @@ static int __init parse_bootparam(const bp_tag_t* tag)
214#ifdef CONFIG_OF 212#ifdef CONFIG_OF
215bool __initdata dt_memory_scan = false; 213bool __initdata dt_memory_scan = false;
216 214
215#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
216unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR;
217EXPORT_SYMBOL(xtensa_kio_paddr);
218
219static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
220 int depth, void *data)
221{
222 const __be32 *ranges;
223 unsigned long len;
224
225 if (depth > 1)
226 return 0;
227
228 if (!of_flat_dt_is_compatible(node, "simple-bus"))
229 return 0;
230
231 ranges = of_get_flat_dt_prop(node, "ranges", &len);
232 if (!ranges)
233 return 1;
234 if (len == 0)
235 return 1;
236
237 xtensa_kio_paddr = of_read_ulong(ranges+1, 1);
238 /* round down to nearest 256MB boundary */
239 xtensa_kio_paddr &= 0xf0000000;
240
241 return 1;
242}
243#else
244static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
245 int depth, void *data)
246{
247 return 1;
248}
249#endif
250
217void __init early_init_dt_add_memory_arch(u64 base, u64 size) 251void __init early_init_dt_add_memory_arch(u64 base, u64 size)
218{ 252{
219 if (!dt_memory_scan) 253 if (!dt_memory_scan)
@@ -234,6 +268,7 @@ void __init early_init_devtree(void *params)
234 dt_memory_scan = true; 268 dt_memory_scan = true;
235 269
236 early_init_dt_scan(params); 270 early_init_dt_scan(params);
271 of_scan_flat_dt(xtensa_dt_io_area, NULL);
237 272
238 if (!command_line[0]) 273 if (!command_line[0])
239 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); 274 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
@@ -241,7 +276,7 @@ void __init early_init_devtree(void *params)
241 276
242static int __init xtensa_device_probe(void) 277static int __init xtensa_device_probe(void)
243{ 278{
244 of_platform_populate(NULL, NULL, NULL, NULL); 279 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
245 return 0; 280 return 0;
246} 281}
247 282
@@ -354,7 +389,8 @@ static inline int probed_compare_swap(int *v, int cmp, int set)
354 389
355/* Handle probed exception */ 390/* Handle probed exception */
356 391
357void __init do_probed_exception(struct pt_regs *regs, unsigned long exccause) 392static void __init do_probed_exception(struct pt_regs *regs,
393 unsigned long exccause)
358{ 394{
359 if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */ 395 if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */
360 regs->pc += 3; /* skip the s32c1i instruction */ 396 regs->pc += 3; /* skip the s32c1i instruction */
@@ -366,7 +402,7 @@ void __init do_probed_exception(struct pt_regs *regs, unsigned long exccause)
366 402
367/* Simple test of S32C1I (soc bringup assist) */ 403/* Simple test of S32C1I (soc bringup assist) */
368 404
369void __init check_s32c1i(void) 405static int __init check_s32c1i(void)
370{ 406{
371 int n, cause1, cause2; 407 int n, cause1, cause2;
372 void *handbus, *handdata, *handaddr; /* temporarily saved handlers */ 408 void *handbus, *handdata, *handaddr; /* temporarily saved handlers */
@@ -421,24 +457,21 @@ void __init check_s32c1i(void)
421 trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR, handbus); 457 trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR, handbus);
422 trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, handdata); 458 trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, handdata);
423 trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, handaddr); 459 trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, handaddr);
460 return 0;
424} 461}
425 462
426#else /* XCHAL_HAVE_S32C1I */ 463#else /* XCHAL_HAVE_S32C1I */
427 464
428/* This condition should not occur with a commercially deployed processor. 465/* This condition should not occur with a commercially deployed processor.
429 Display reminder for early engr test or demo chips / FPGA bitstreams */ 466 Display reminder for early engr test or demo chips / FPGA bitstreams */
430void __init check_s32c1i(void) 467static int __init check_s32c1i(void)
431{ 468{
432 pr_warn("Processor configuration lacks atomic compare-and-swap support!\n"); 469 pr_warn("Processor configuration lacks atomic compare-and-swap support!\n");
470 return 0;
433} 471}
434 472
435#endif /* XCHAL_HAVE_S32C1I */ 473#endif /* XCHAL_HAVE_S32C1I */
436#else /* CONFIG_S32C1I_SELFTEST */ 474early_initcall(check_s32c1i);
437
438void __init check_s32c1i(void)
439{
440}
441
442#endif /* CONFIG_S32C1I_SELFTEST */ 475#endif /* CONFIG_S32C1I_SELFTEST */
443 476
444 477
@@ -447,8 +480,6 @@ void __init setup_arch(char **cmdline_p)
447 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 480 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
448 *cmdline_p = command_line; 481 *cmdline_p = command_line;
449 482
450 check_s32c1i();
451
452 /* Reserve some memory regions */ 483 /* Reserve some memory regions */
453 484
454#ifdef CONFIG_BLK_DEV_INITRD 485#ifdef CONFIG_BLK_DEV_INITRD
@@ -505,6 +536,10 @@ void __init setup_arch(char **cmdline_p)
505 536
506 platform_setup(cmdline_p); 537 platform_setup(cmdline_p);
507 538
539#ifdef CONFIG_SMP
540 smp_init_cpus();
541#endif
542
508 paging_init(); 543 paging_init();
509 zones_init(); 544 zones_init();
510 545
@@ -521,6 +556,22 @@ void __init setup_arch(char **cmdline_p)
521#endif 556#endif
522} 557}
523 558
559static DEFINE_PER_CPU(struct cpu, cpu_data);
560
561static int __init topology_init(void)
562{
563 int i;
564
565 for_each_possible_cpu(i) {
566 struct cpu *cpu = &per_cpu(cpu_data, i);
567 cpu->hotpluggable = !!i;
568 register_cpu(cpu, i);
569 }
570
571 return 0;
572}
573subsys_initcall(topology_init);
574
524void machine_restart(char * cmd) 575void machine_restart(char * cmd)
525{ 576{
526 platform_restart(); 577 platform_restart();
@@ -546,21 +597,27 @@ void machine_power_off(void)
546static int 597static int
547c_show(struct seq_file *f, void *slot) 598c_show(struct seq_file *f, void *slot)
548{ 599{
600 char buf[NR_CPUS * 5];
601
602 cpulist_scnprintf(buf, sizeof(buf), cpu_online_mask);
549 /* high-level stuff */ 603 /* high-level stuff */
550 seq_printf(f,"processor\t: 0\n" 604 seq_printf(f, "CPU count\t: %u\n"
551 "vendor_id\t: Tensilica\n" 605 "CPU list\t: %s\n"
552 "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n" 606 "vendor_id\t: Tensilica\n"
553 "core ID\t\t: " XCHAL_CORE_ID "\n" 607 "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
554 "build ID\t: 0x%x\n" 608 "core ID\t\t: " XCHAL_CORE_ID "\n"
555 "byte order\t: %s\n" 609 "build ID\t: 0x%x\n"
556 "cpu MHz\t\t: %lu.%02lu\n" 610 "byte order\t: %s\n"
557 "bogomips\t: %lu.%02lu\n", 611 "cpu MHz\t\t: %lu.%02lu\n"
558 XCHAL_BUILD_UNIQUE_ID, 612 "bogomips\t: %lu.%02lu\n",
559 XCHAL_HAVE_BE ? "big" : "little", 613 num_online_cpus(),
560 ccount_freq/1000000, 614 buf,
561 (ccount_freq/10000) % 100, 615 XCHAL_BUILD_UNIQUE_ID,
562 loops_per_jiffy/(500000/HZ), 616 XCHAL_HAVE_BE ? "big" : "little",
563 (loops_per_jiffy/(5000/HZ)) % 100); 617 ccount_freq/1000000,
618 (ccount_freq/10000) % 100,
619 loops_per_jiffy/(500000/HZ),
620 (loops_per_jiffy/(5000/HZ)) % 100);
564 621
565 seq_printf(f,"flags\t\t: " 622 seq_printf(f,"flags\t\t: "
566#if XCHAL_HAVE_NMI 623#if XCHAL_HAVE_NMI
@@ -672,7 +729,7 @@ c_show(struct seq_file *f, void *slot)
672static void * 729static void *
673c_start(struct seq_file *f, loff_t *pos) 730c_start(struct seq_file *f, loff_t *pos)
674{ 731{
675 return (void *) ((*pos == 0) ? (void *)1 : NULL); 732 return (*pos == 0) ? (void *)1 : NULL;
676} 733}
677 734
678static void * 735static void *
@@ -688,10 +745,10 @@ c_stop(struct seq_file *f, void *v)
688 745
689const struct seq_operations cpuinfo_op = 746const struct seq_operations cpuinfo_op =
690{ 747{
691 start: c_start, 748 .start = c_start,
692 next: c_next, 749 .next = c_next,
693 stop: c_stop, 750 .stop = c_stop,
694 show: c_show 751 .show = c_show,
695}; 752};
696 753
697#endif /* CONFIG_PROC_FS */ 754#endif /* CONFIG_PROC_FS */
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
new file mode 100644
index 000000000000..aa8bd8717927
--- /dev/null
+++ b/arch/xtensa/kernel/smp.c
@@ -0,0 +1,592 @@
1/*
2 * Xtensa SMP support functions.
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 * Copyright (C) 2008 - 2013 Tensilica Inc.
9 *
10 * Chris Zankel <chris@zankel.net>
11 * Joe Taylor <joe@tensilica.com>
12 * Pete Delaney <piet@tensilica.com
13 */
14
15#include <linux/cpu.h>
16#include <linux/cpumask.h>
17#include <linux/delay.h>
18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/irqdomain.h>
21#include <linux/irq.h>
22#include <linux/kdebug.h>
23#include <linux/module.h>
24#include <linux/reboot.h>
25#include <linux/seq_file.h>
26#include <linux/smp.h>
27#include <linux/thread_info.h>
28
29#include <asm/cacheflush.h>
30#include <asm/kdebug.h>
31#include <asm/mmu_context.h>
32#include <asm/mxregs.h>
33#include <asm/platform.h>
34#include <asm/tlbflush.h>
35#include <asm/traps.h>
36
37#ifdef CONFIG_SMP
38# if XCHAL_HAVE_S32C1I == 0
39# error "The S32C1I option is required for SMP."
40# endif
41#endif
42
43static void system_invalidate_dcache_range(unsigned long start,
44 unsigned long size);
45static void system_flush_invalidate_dcache_range(unsigned long start,
46 unsigned long size);
47
48/* IPI (Inter Process Interrupt) */
49
50#define IPI_IRQ 0
51
52static irqreturn_t ipi_interrupt(int irq, void *dev_id);
53static struct irqaction ipi_irqaction = {
54 .handler = ipi_interrupt,
55 .flags = IRQF_PERCPU,
56 .name = "ipi",
57};
58
59void ipi_init(void)
60{
61 unsigned irq = irq_create_mapping(NULL, IPI_IRQ);
62 setup_irq(irq, &ipi_irqaction);
63}
64
65static inline unsigned int get_core_count(void)
66{
67 /* Bits 18..21 of SYSCFGID contain the core count minus 1. */
68 unsigned int syscfgid = get_er(SYSCFGID);
69 return ((syscfgid >> 18) & 0xf) + 1;
70}
71
72static inline int get_core_id(void)
73{
74 /* Bits 0...18 of SYSCFGID contain the core id */
75 unsigned int core_id = get_er(SYSCFGID);
76 return core_id & 0x3fff;
77}
78
79void __init smp_prepare_cpus(unsigned int max_cpus)
80{
81 unsigned i;
82
83 for (i = 0; i < max_cpus; ++i)
84 set_cpu_present(i, true);
85}
86
87void __init smp_init_cpus(void)
88{
89 unsigned i;
90 unsigned int ncpus = get_core_count();
91 unsigned int core_id = get_core_id();
92
93 pr_info("%s: Core Count = %d\n", __func__, ncpus);
94 pr_info("%s: Core Id = %d\n", __func__, core_id);
95
96 for (i = 0; i < ncpus; ++i)
97 set_cpu_possible(i, true);
98}
99
100void __init smp_prepare_boot_cpu(void)
101{
102 unsigned int cpu = smp_processor_id();
103 BUG_ON(cpu != 0);
104 cpu_asid_cache(cpu) = ASID_USER_FIRST;
105}
106
107void __init smp_cpus_done(unsigned int max_cpus)
108{
109}
110
111static int boot_secondary_processors = 1; /* Set with xt-gdb via .xt-gdb */
112static DECLARE_COMPLETION(cpu_running);
113
114void secondary_start_kernel(void)
115{
116 struct mm_struct *mm = &init_mm;
117 unsigned int cpu = smp_processor_id();
118
119 init_mmu();
120
121#ifdef CONFIG_DEBUG_KERNEL
122 if (boot_secondary_processors == 0) {
123 pr_debug("%s: boot_secondary_processors:%d; Hanging cpu:%d\n",
124 __func__, boot_secondary_processors, cpu);
125 for (;;)
126 __asm__ __volatile__ ("waiti " __stringify(LOCKLEVEL));
127 }
128
129 pr_debug("%s: boot_secondary_processors:%d; Booting cpu:%d\n",
130 __func__, boot_secondary_processors, cpu);
131#endif
132 /* Init EXCSAVE1 */
133
134 secondary_trap_init();
135
136 /* All kernel threads share the same mm context. */
137
138 atomic_inc(&mm->mm_users);
139 atomic_inc(&mm->mm_count);
140 current->active_mm = mm;
141 cpumask_set_cpu(cpu, mm_cpumask(mm));
142 enter_lazy_tlb(mm, current);
143
144 preempt_disable();
145 trace_hardirqs_off();
146
147 calibrate_delay();
148
149 notify_cpu_starting(cpu);
150
151 secondary_init_irq();
152 local_timer_setup(cpu);
153
154 set_cpu_online(cpu, true);
155
156 local_irq_enable();
157
158 complete(&cpu_running);
159
160 cpu_startup_entry(CPUHP_ONLINE);
161}
162
163static void mx_cpu_start(void *p)
164{
165 unsigned cpu = (unsigned)p;
166 unsigned long run_stall_mask = get_er(MPSCORE);
167
168 set_er(run_stall_mask & ~(1u << cpu), MPSCORE);
169 pr_debug("%s: cpu: %d, run_stall_mask: %lx ---> %lx\n",
170 __func__, cpu, run_stall_mask, get_er(MPSCORE));
171}
172
173static void mx_cpu_stop(void *p)
174{
175 unsigned cpu = (unsigned)p;
176 unsigned long run_stall_mask = get_er(MPSCORE);
177
178 set_er(run_stall_mask | (1u << cpu), MPSCORE);
179 pr_debug("%s: cpu: %d, run_stall_mask: %lx ---> %lx\n",
180 __func__, cpu, run_stall_mask, get_er(MPSCORE));
181}
182
183#ifdef CONFIG_HOTPLUG_CPU
184unsigned long cpu_start_id __cacheline_aligned;
185#endif
186unsigned long cpu_start_ccount;
187
188static int boot_secondary(unsigned int cpu, struct task_struct *ts)
189{
190 unsigned long timeout = jiffies + msecs_to_jiffies(1000);
191 unsigned long ccount;
192 int i;
193
194#ifdef CONFIG_HOTPLUG_CPU
195 cpu_start_id = cpu;
196 system_flush_invalidate_dcache_range(
197 (unsigned long)&cpu_start_id, sizeof(cpu_start_id));
198#endif
199 smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1);
200
201 for (i = 0; i < 2; ++i) {
202 do
203 ccount = get_ccount();
204 while (!ccount);
205
206 cpu_start_ccount = ccount;
207
208 while (time_before(jiffies, timeout)) {
209 mb();
210 if (!cpu_start_ccount)
211 break;
212 }
213
214 if (cpu_start_ccount) {
215 smp_call_function_single(0, mx_cpu_stop,
216 (void *)cpu, 1);
217 cpu_start_ccount = 0;
218 return -EIO;
219 }
220 }
221 return 0;
222}
223
224int __cpu_up(unsigned int cpu, struct task_struct *idle)
225{
226 int ret = 0;
227
228 if (cpu_asid_cache(cpu) == 0)
229 cpu_asid_cache(cpu) = ASID_USER_FIRST;
230
231 start_info.stack = (unsigned long)task_pt_regs(idle);
232 wmb();
233
234 pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n",
235 __func__, cpu, idle, start_info.stack);
236
237 ret = boot_secondary(cpu, idle);
238 if (ret == 0) {
239 wait_for_completion_timeout(&cpu_running,
240 msecs_to_jiffies(1000));
241 if (!cpu_online(cpu))
242 ret = -EIO;
243 }
244
245 if (ret)
246 pr_err("CPU %u failed to boot\n", cpu);
247
248 return ret;
249}
250
251#ifdef CONFIG_HOTPLUG_CPU
252
253/*
254 * __cpu_disable runs on the processor to be shutdown.
255 */
256int __cpu_disable(void)
257{
258 unsigned int cpu = smp_processor_id();
259
260 /*
261 * Take this CPU offline. Once we clear this, we can't return,
262 * and we must not schedule until we're ready to give up the cpu.
263 */
264 set_cpu_online(cpu, false);
265
266 /*
267 * OK - migrate IRQs away from this CPU
268 */
269 migrate_irqs();
270
271 /*
272 * Flush user cache and TLB mappings, and then remove this CPU
273 * from the vm mask set of all processes.
274 */
275 local_flush_cache_all();
276 local_flush_tlb_all();
277 invalidate_page_directory();
278
279 clear_tasks_mm_cpumask(cpu);
280
281 return 0;
282}
283
284static void platform_cpu_kill(unsigned int cpu)
285{
286 smp_call_function_single(0, mx_cpu_stop, (void *)cpu, true);
287}
288
289/*
290 * called on the thread which is asking for a CPU to be shutdown -
291 * waits until shutdown has completed, or it is timed out.
292 */
293void __cpu_die(unsigned int cpu)
294{
295 unsigned long timeout = jiffies + msecs_to_jiffies(1000);
296 while (time_before(jiffies, timeout)) {
297 system_invalidate_dcache_range((unsigned long)&cpu_start_id,
298 sizeof(cpu_start_id));
299 if (cpu_start_id == -cpu) {
300 platform_cpu_kill(cpu);
301 return;
302 }
303 }
304 pr_err("CPU%u: unable to kill\n", cpu);
305}
306
307void arch_cpu_idle_dead(void)
308{
309 cpu_die();
310}
311/*
312 * Called from the idle thread for the CPU which has been shutdown.
313 *
314 * Note that we disable IRQs here, but do not re-enable them
315 * before returning to the caller. This is also the behaviour
316 * of the other hotplug-cpu capable cores, so presumably coming
317 * out of idle fixes this.
318 */
319void __ref cpu_die(void)
320{
321 idle_task_exit();
322 local_irq_disable();
323 __asm__ __volatile__(
324 " movi a2, cpu_restart\n"
325 " jx a2\n");
326}
327
328#endif /* CONFIG_HOTPLUG_CPU */
329
330enum ipi_msg_type {
331 IPI_RESCHEDULE = 0,
332 IPI_CALL_FUNC,
333 IPI_CPU_STOP,
334 IPI_MAX
335};
336
337static const struct {
338 const char *short_text;
339 const char *long_text;
340} ipi_text[] = {
341 { .short_text = "RES", .long_text = "Rescheduling interrupts" },
342 { .short_text = "CAL", .long_text = "Function call interrupts" },
343 { .short_text = "DIE", .long_text = "CPU shutdown interrupts" },
344};
345
346struct ipi_data {
347 unsigned long ipi_count[IPI_MAX];
348};
349
350static DEFINE_PER_CPU(struct ipi_data, ipi_data);
351
352static void send_ipi_message(const struct cpumask *callmask,
353 enum ipi_msg_type msg_id)
354{
355 int index;
356 unsigned long mask = 0;
357
358 for_each_cpu(index, callmask)
359 if (index != smp_processor_id())
360 mask |= 1 << index;
361
362 set_er(mask, MIPISET(msg_id));
363}
364
365void arch_send_call_function_ipi_mask(const struct cpumask *mask)
366{
367 send_ipi_message(mask, IPI_CALL_FUNC);
368}
369
370void arch_send_call_function_single_ipi(int cpu)
371{
372 send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
373}
374
375void smp_send_reschedule(int cpu)
376{
377 send_ipi_message(cpumask_of(cpu), IPI_RESCHEDULE);
378}
379
380void smp_send_stop(void)
381{
382 struct cpumask targets;
383
384 cpumask_copy(&targets, cpu_online_mask);
385 cpumask_clear_cpu(smp_processor_id(), &targets);
386 send_ipi_message(&targets, IPI_CPU_STOP);
387}
388
389static void ipi_cpu_stop(unsigned int cpu)
390{
391 set_cpu_online(cpu, false);
392 machine_halt();
393}
394
395irqreturn_t ipi_interrupt(int irq, void *dev_id)
396{
397 unsigned int cpu = smp_processor_id();
398 struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
399 unsigned int msg;
400 unsigned i;
401
402 msg = get_er(MIPICAUSE(cpu));
403 for (i = 0; i < IPI_MAX; i++)
404 if (msg & (1 << i)) {
405 set_er(1 << i, MIPICAUSE(cpu));
406 ++ipi->ipi_count[i];
407 }
408
409 if (msg & (1 << IPI_RESCHEDULE))
410 scheduler_ipi();
411 if (msg & (1 << IPI_CALL_FUNC))
412 generic_smp_call_function_interrupt();
413 if (msg & (1 << IPI_CPU_STOP))
414 ipi_cpu_stop(cpu);
415
416 return IRQ_HANDLED;
417}
418
419void show_ipi_list(struct seq_file *p, int prec)
420{
421 unsigned int cpu;
422 unsigned i;
423
424 for (i = 0; i < IPI_MAX; ++i) {
425 seq_printf(p, "%*s:", prec, ipi_text[i].short_text);
426 for_each_online_cpu(cpu)
427 seq_printf(p, " %10lu",
428 per_cpu(ipi_data, cpu).ipi_count[i]);
429 seq_printf(p, " %s\n", ipi_text[i].long_text);
430 }
431}
432
433int setup_profiling_timer(unsigned int multiplier)
434{
435 pr_debug("setup_profiling_timer %d\n", multiplier);
436 return 0;
437}
438
439/* TLB flush functions */
440
441struct flush_data {
442 struct vm_area_struct *vma;
443 unsigned long addr1;
444 unsigned long addr2;
445};
446
447static void ipi_flush_tlb_all(void *arg)
448{
449 local_flush_tlb_all();
450}
451
452void flush_tlb_all(void)
453{
454 on_each_cpu(ipi_flush_tlb_all, NULL, 1);
455}
456
457static void ipi_flush_tlb_mm(void *arg)
458{
459 local_flush_tlb_mm(arg);
460}
461
462void flush_tlb_mm(struct mm_struct *mm)
463{
464 on_each_cpu(ipi_flush_tlb_mm, mm, 1);
465}
466
467static void ipi_flush_tlb_page(void *arg)
468{
469 struct flush_data *fd = arg;
470 local_flush_tlb_page(fd->vma, fd->addr1);
471}
472
473void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
474{
475 struct flush_data fd = {
476 .vma = vma,
477 .addr1 = addr,
478 };
479 on_each_cpu(ipi_flush_tlb_page, &fd, 1);
480}
481
482static void ipi_flush_tlb_range(void *arg)
483{
484 struct flush_data *fd = arg;
485 local_flush_tlb_range(fd->vma, fd->addr1, fd->addr2);
486}
487
488void flush_tlb_range(struct vm_area_struct *vma,
489 unsigned long start, unsigned long end)
490{
491 struct flush_data fd = {
492 .vma = vma,
493 .addr1 = start,
494 .addr2 = end,
495 };
496 on_each_cpu(ipi_flush_tlb_range, &fd, 1);
497}
498
499/* Cache flush functions */
500
501static void ipi_flush_cache_all(void *arg)
502{
503 local_flush_cache_all();
504}
505
506void flush_cache_all(void)
507{
508 on_each_cpu(ipi_flush_cache_all, NULL, 1);
509}
510
511static void ipi_flush_cache_page(void *arg)
512{
513 struct flush_data *fd = arg;
514 local_flush_cache_page(fd->vma, fd->addr1, fd->addr2);
515}
516
517void flush_cache_page(struct vm_area_struct *vma,
518 unsigned long address, unsigned long pfn)
519{
520 struct flush_data fd = {
521 .vma = vma,
522 .addr1 = address,
523 .addr2 = pfn,
524 };
525 on_each_cpu(ipi_flush_cache_page, &fd, 1);
526}
527
528static void ipi_flush_cache_range(void *arg)
529{
530 struct flush_data *fd = arg;
531 local_flush_cache_range(fd->vma, fd->addr1, fd->addr2);
532}
533
534void flush_cache_range(struct vm_area_struct *vma,
535 unsigned long start, unsigned long end)
536{
537 struct flush_data fd = {
538 .vma = vma,
539 .addr1 = start,
540 .addr2 = end,
541 };
542 on_each_cpu(ipi_flush_cache_range, &fd, 1);
543}
544
545static void ipi_flush_icache_range(void *arg)
546{
547 struct flush_data *fd = arg;
548 local_flush_icache_range(fd->addr1, fd->addr2);
549}
550
551void flush_icache_range(unsigned long start, unsigned long end)
552{
553 struct flush_data fd = {
554 .addr1 = start,
555 .addr2 = end,
556 };
557 on_each_cpu(ipi_flush_icache_range, &fd, 1);
558}
559
560/* ------------------------------------------------------------------------- */
561
562static void ipi_invalidate_dcache_range(void *arg)
563{
564 struct flush_data *fd = arg;
565 __invalidate_dcache_range(fd->addr1, fd->addr2);
566}
567
568static void system_invalidate_dcache_range(unsigned long start,
569 unsigned long size)
570{
571 struct flush_data fd = {
572 .addr1 = start,
573 .addr2 = size,
574 };
575 on_each_cpu(ipi_invalidate_dcache_range, &fd, 1);
576}
577
578static void ipi_flush_invalidate_dcache_range(void *arg)
579{
580 struct flush_data *fd = arg;
581 __flush_invalidate_dcache_range(fd->addr1, fd->addr2);
582}
583
584static void system_flush_invalidate_dcache_range(unsigned long start,
585 unsigned long size)
586{
587 struct flush_data fd = {
588 .addr1 = start,
589 .addr2 = size,
590 };
591 on_each_cpu(ipi_flush_invalidate_dcache_range, &fd, 1);
592}
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 9af3dd88ad7e..08b769d3b3a1 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -36,7 +36,7 @@ static cycle_t ccount_read(struct clocksource *cs)
36 return (cycle_t)get_ccount(); 36 return (cycle_t)get_ccount();
37} 37}
38 38
39static u32 notrace ccount_sched_clock_read(void) 39static u64 notrace ccount_sched_clock_read(void)
40{ 40{
41 return get_ccount(); 41 return get_ccount();
42} 42}
@@ -46,24 +46,19 @@ static struct clocksource ccount_clocksource = {
46 .rating = 200, 46 .rating = 200,
47 .read = ccount_read, 47 .read = ccount_read,
48 .mask = CLOCKSOURCE_MASK(32), 48 .mask = CLOCKSOURCE_MASK(32),
49 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
49}; 50};
50 51
51static int ccount_timer_set_next_event(unsigned long delta, 52static int ccount_timer_set_next_event(unsigned long delta,
52 struct clock_event_device *dev); 53 struct clock_event_device *dev);
53static void ccount_timer_set_mode(enum clock_event_mode mode, 54static void ccount_timer_set_mode(enum clock_event_mode mode,
54 struct clock_event_device *evt); 55 struct clock_event_device *evt);
55static struct ccount_timer_t { 56struct ccount_timer {
56 struct clock_event_device evt; 57 struct clock_event_device evt;
57 int irq_enabled; 58 int irq_enabled;
58} ccount_timer = { 59 char name[24];
59 .evt = {
60 .name = "ccount_clockevent",
61 .features = CLOCK_EVT_FEAT_ONESHOT,
62 .rating = 300,
63 .set_next_event = ccount_timer_set_next_event,
64 .set_mode = ccount_timer_set_mode,
65 },
66}; 60};
61static DEFINE_PER_CPU(struct ccount_timer, ccount_timer);
67 62
68static int ccount_timer_set_next_event(unsigned long delta, 63static int ccount_timer_set_next_event(unsigned long delta,
69 struct clock_event_device *dev) 64 struct clock_event_device *dev)
@@ -84,8 +79,8 @@ static int ccount_timer_set_next_event(unsigned long delta,
84static void ccount_timer_set_mode(enum clock_event_mode mode, 79static void ccount_timer_set_mode(enum clock_event_mode mode,
85 struct clock_event_device *evt) 80 struct clock_event_device *evt)
86{ 81{
87 struct ccount_timer_t *timer = 82 struct ccount_timer *timer =
88 container_of(evt, struct ccount_timer_t, evt); 83 container_of(evt, struct ccount_timer, evt);
89 84
90 /* 85 /*
91 * There is no way to disable the timer interrupt at the device level, 86 * There is no way to disable the timer interrupt at the device level,
@@ -117,9 +112,28 @@ static struct irqaction timer_irqaction = {
117 .handler = timer_interrupt, 112 .handler = timer_interrupt,
118 .flags = IRQF_TIMER, 113 .flags = IRQF_TIMER,
119 .name = "timer", 114 .name = "timer",
120 .dev_id = &ccount_timer,
121}; 115};
122 116
117void local_timer_setup(unsigned cpu)
118{
119 struct ccount_timer *timer = &per_cpu(ccount_timer, cpu);
120 struct clock_event_device *clockevent = &timer->evt;
121
122 timer->irq_enabled = 1;
123 clockevent->name = timer->name;
124 snprintf(timer->name, sizeof(timer->name), "ccount_clockevent_%u", cpu);
125 clockevent->features = CLOCK_EVT_FEAT_ONESHOT;
126 clockevent->rating = 300;
127 clockevent->set_next_event = ccount_timer_set_next_event;
128 clockevent->set_mode = ccount_timer_set_mode;
129 clockevent->cpumask = cpumask_of(cpu);
130 clockevent->irq = irq_create_mapping(NULL, LINUX_TIMER_INT);
131 if (WARN(!clockevent->irq, "error: can't map timer irq"))
132 return;
133 clockevents_config_and_register(clockevent, ccount_freq,
134 0xf, 0xffffffff);
135}
136
123void __init time_init(void) 137void __init time_init(void)
124{ 138{
125#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 139#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
@@ -131,28 +145,21 @@ void __init time_init(void)
131 ccount_freq = CONFIG_XTENSA_CPU_CLOCK*1000000UL; 145 ccount_freq = CONFIG_XTENSA_CPU_CLOCK*1000000UL;
132#endif 146#endif
133 clocksource_register_hz(&ccount_clocksource, ccount_freq); 147 clocksource_register_hz(&ccount_clocksource, ccount_freq);
134 148 local_timer_setup(0);
135 ccount_timer.evt.cpumask = cpumask_of(0); 149 setup_irq(this_cpu_ptr(&ccount_timer)->evt.irq, &timer_irqaction);
136 ccount_timer.evt.irq = irq_create_mapping(NULL, LINUX_TIMER_INT); 150 sched_clock_register(ccount_sched_clock_read, 32, ccount_freq);
137 if (WARN(!ccount_timer.evt.irq, "error: can't map timer irq")) 151 clocksource_of_init();
138 return;
139 clockevents_config_and_register(&ccount_timer.evt, ccount_freq, 0xf,
140 0xffffffff);
141 setup_irq(ccount_timer.evt.irq, &timer_irqaction);
142 ccount_timer.irq_enabled = 1;
143
144 setup_sched_clock(ccount_sched_clock_read, 32, ccount_freq);
145} 152}
146 153
147/* 154/*
148 * The timer interrupt is called HZ times per second. 155 * The timer interrupt is called HZ times per second.
149 */ 156 */
150 157
151irqreturn_t timer_interrupt (int irq, void *dev_id) 158irqreturn_t timer_interrupt(int irq, void *dev_id)
152{ 159{
153 struct ccount_timer_t *timer = dev_id; 160 struct clock_event_device *evt = &this_cpu_ptr(&ccount_timer)->evt;
154 struct clock_event_device *evt = &timer->evt;
155 161
162 set_linux_timer(get_linux_timer());
156 evt->event_handler(evt); 163 evt->event_handler(evt);
157 164
158 /* Allow platform to do something useful (Wdog). */ 165 /* Allow platform to do something useful (Wdog). */
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 3e8a05c874cd..eebbfd8c26fc 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -157,7 +157,7 @@ COPROCESSOR(7),
157 * 2. it is a temporary memory buffer for the exception handlers. 157 * 2. it is a temporary memory buffer for the exception handlers.
158 */ 158 */
159 159
160unsigned long exc_table[EXC_TABLE_SIZE/4]; 160DEFINE_PER_CPU(unsigned long, exc_table[EXC_TABLE_SIZE/4]);
161 161
162void die(const char*, struct pt_regs*, long); 162void die(const char*, struct pt_regs*, long);
163 163
@@ -212,6 +212,9 @@ void do_interrupt(struct pt_regs *regs)
212 XCHAL_INTLEVEL6_MASK, 212 XCHAL_INTLEVEL6_MASK,
213 XCHAL_INTLEVEL7_MASK, 213 XCHAL_INTLEVEL7_MASK,
214 }; 214 };
215 struct pt_regs *old_regs = set_irq_regs(regs);
216
217 irq_enter();
215 218
216 for (;;) { 219 for (;;) {
217 unsigned intread = get_sr(interrupt); 220 unsigned intread = get_sr(interrupt);
@@ -227,21 +230,13 @@ void do_interrupt(struct pt_regs *regs)
227 } 230 }
228 231
229 if (level == 0) 232 if (level == 0)
230 return; 233 break;
231 234
232 /* 235 do_IRQ(__ffs(int_at_level), regs);
233 * Clear the interrupt before processing, in case it's
234 * edge-triggered or software-generated
235 */
236 while (int_at_level) {
237 unsigned i = __ffs(int_at_level);
238 unsigned mask = 1 << i;
239
240 int_at_level ^= mask;
241 set_sr(mask, intclear);
242 do_IRQ(i, regs);
243 }
244 } 236 }
237
238 irq_exit();
239 set_irq_regs(old_regs);
245} 240}
246 241
247/* 242/*
@@ -318,17 +313,31 @@ do_debug(struct pt_regs *regs)
318} 313}
319 314
320 315
316static void set_handler(int idx, void *handler)
317{
318 unsigned int cpu;
319
320 for_each_possible_cpu(cpu)
321 per_cpu(exc_table, cpu)[idx] = (unsigned long)handler;
322}
323
321/* Set exception C handler - for temporary use when probing exceptions */ 324/* Set exception C handler - for temporary use when probing exceptions */
322 325
323void * __init trap_set_handler(int cause, void *handler) 326void * __init trap_set_handler(int cause, void *handler)
324{ 327{
325 unsigned long *entry = &exc_table[EXC_TABLE_DEFAULT / 4 + cause]; 328 void *previous = (void *)per_cpu(exc_table, 0)[
326 void *previous = (void *)*entry; 329 EXC_TABLE_DEFAULT / 4 + cause];
327 *entry = (unsigned long)handler; 330 set_handler(EXC_TABLE_DEFAULT / 4 + cause, handler);
328 return previous; 331 return previous;
329} 332}
330 333
331 334
335static void trap_init_excsave(void)
336{
337 unsigned long excsave1 = (unsigned long)this_cpu_ptr(exc_table);
338 __asm__ __volatile__("wsr %0, excsave1\n" : : "a" (excsave1));
339}
340
332/* 341/*
333 * Initialize dispatch tables. 342 * Initialize dispatch tables.
334 * 343 *
@@ -342,8 +351,6 @@ void * __init trap_set_handler(int cause, void *handler)
342 * See vectors.S for more details. 351 * See vectors.S for more details.
343 */ 352 */
344 353
345#define set_handler(idx,handler) (exc_table[idx] = (unsigned long) (handler))
346
347void __init trap_init(void) 354void __init trap_init(void)
348{ 355{
349 int i; 356 int i;
@@ -373,10 +380,15 @@ void __init trap_init(void)
373 } 380 }
374 381
375 /* Initialize EXCSAVE_1 to hold the address of the exception table. */ 382 /* Initialize EXCSAVE_1 to hold the address of the exception table. */
383 trap_init_excsave();
384}
376 385
377 i = (unsigned long)exc_table; 386#ifdef CONFIG_SMP
378 __asm__ __volatile__("wsr %0, excsave1\n" : : "a" (i)); 387void secondary_trap_init(void)
388{
389 trap_init_excsave();
379} 390}
391#endif
380 392
381/* 393/*
382 * This function dumps the current valid window frame and other base registers. 394 * This function dumps the current valid window frame and other base registers.
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 21acd11b5df2..ee32c0085dff 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -165,6 +165,13 @@ SECTIONS
165 .DoubleExceptionVector.text); 165 .DoubleExceptionVector.text);
166 RELOCATE_ENTRY(_DebugInterruptVector_text, 166 RELOCATE_ENTRY(_DebugInterruptVector_text,
167 .DebugInterruptVector.text); 167 .DebugInterruptVector.text);
168#if defined(CONFIG_SMP)
169 RELOCATE_ENTRY(_SecondaryResetVector_literal,
170 .SecondaryResetVector.literal);
171 RELOCATE_ENTRY(_SecondaryResetVector_text,
172 .SecondaryResetVector.text);
173#endif
174
168 175
169 __boot_reloc_table_end = ABSOLUTE(.) ; 176 __boot_reloc_table_end = ABSOLUTE(.) ;
170 177
@@ -272,6 +279,25 @@ SECTIONS
272 .DoubleExceptionVector.literal) 279 .DoubleExceptionVector.literal)
273 280
274 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; 281 . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
282
283#if defined(CONFIG_SMP)
284
285 SECTION_VECTOR (_SecondaryResetVector_literal,
286 .SecondaryResetVector.literal,
287 RESET_VECTOR1_VADDR - 4,
288 SIZEOF(.DoubleExceptionVector.text),
289 .DoubleExceptionVector.text)
290
291 SECTION_VECTOR (_SecondaryResetVector_text,
292 .SecondaryResetVector.text,
293 RESET_VECTOR1_VADDR,
294 4,
295 .SecondaryResetVector.literal)
296
297 . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
298
299#endif
300
275 . = ALIGN(PAGE_SIZE); 301 . = ALIGN(PAGE_SIZE);
276 302
277 __init_end = .; 303 __init_end = .;
diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c
index 81edeab82d17..ba4c47f291b1 100644
--- a/arch/xtensa/mm/cache.c
+++ b/arch/xtensa/mm/cache.c
@@ -118,7 +118,7 @@ void flush_dcache_page(struct page *page)
118 * For now, flush the whole cache. FIXME?? 118 * For now, flush the whole cache. FIXME??
119 */ 119 */
120 120
121void flush_cache_range(struct vm_area_struct* vma, 121void local_flush_cache_range(struct vm_area_struct *vma,
122 unsigned long start, unsigned long end) 122 unsigned long start, unsigned long end)
123{ 123{
124 __flush_invalidate_dcache_all(); 124 __flush_invalidate_dcache_all();
@@ -132,7 +132,7 @@ void flush_cache_range(struct vm_area_struct* vma,
132 * alias versions of the cache flush functions. 132 * alias versions of the cache flush functions.
133 */ 133 */
134 134
135void flush_cache_page(struct vm_area_struct* vma, unsigned long address, 135void local_flush_cache_page(struct vm_area_struct *vma, unsigned long address,
136 unsigned long pfn) 136 unsigned long pfn)
137{ 137{
138 /* Note that we have to use the 'alias' address to avoid multi-hit */ 138 /* Note that we have to use the 'alias' address to avoid multi-hit */
@@ -159,8 +159,7 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep)
159 159
160 /* Invalidate old entry in TLBs */ 160 /* Invalidate old entry in TLBs */
161 161
162 invalidate_itlb_mapping(addr); 162 flush_tlb_page(vma, addr);
163 invalidate_dtlb_mapping(addr);
164 163
165#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK 164#if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
166 165
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index 70fa7bc42b4a..b57c4f91f487 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -21,7 +21,7 @@
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/pgalloc.h> 22#include <asm/pgalloc.h>
23 23
24unsigned long asid_cache = ASID_USER_FIRST; 24DEFINE_PER_CPU(unsigned long, asid_cache) = ASID_USER_FIRST;
25void bad_page_fault(struct pt_regs*, unsigned long, int); 25void bad_page_fault(struct pt_regs*, unsigned long, int);
26 26
27#undef DEBUG_PAGE_FAULT 27#undef DEBUG_PAGE_FAULT
diff --git a/arch/xtensa/mm/misc.S b/arch/xtensa/mm/misc.S
index d97ed1ba7b0a..1f68558dbcc2 100644
--- a/arch/xtensa/mm/misc.S
+++ b/arch/xtensa/mm/misc.S
@@ -140,7 +140,7 @@ ENTRY(clear_user_page)
140 140
141 /* Setup a temporary DTLB with the color of the VPN */ 141 /* Setup a temporary DTLB with the color of the VPN */
142 142
143 movi a4, -PAGE_OFFSET + (PAGE_KERNEL | _PAGE_HW_WRITE) 143 movi a4, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff
144 movi a5, TLBTEMP_BASE_1 # virt 144 movi a5, TLBTEMP_BASE_1 # virt
145 add a6, a2, a4 # ppn 145 add a6, a2, a4 # ppn
146 add a2, a5, a3 # add 'color' 146 add a2, a5, a3 # add 'color'
@@ -194,7 +194,7 @@ ENTRY(copy_user_page)
194 or a9, a9, a8 194 or a9, a9, a8
195 slli a4, a4, PAGE_SHIFT 195 slli a4, a4, PAGE_SHIFT
196 s32i a9, a5, PAGE_FLAGS 196 s32i a9, a5, PAGE_FLAGS
197 movi a5, -PAGE_OFFSET + (PAGE_KERNEL | _PAGE_HW_WRITE) 197 movi a5, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff
198 198
199 beqz a6, 1f 199 beqz a6, 1f
200 200
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c
index c43771c974be..36ec171698b8 100644
--- a/arch/xtensa/mm/mmu.c
+++ b/arch/xtensa/mm/mmu.c
@@ -13,6 +13,8 @@
13#include <asm/tlbflush.h> 13#include <asm/tlbflush.h>
14#include <asm/mmu_context.h> 14#include <asm/mmu_context.h>
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/initialize_mmu.h>
17#include <asm/io.h>
16 18
17void __init paging_init(void) 19void __init paging_init(void)
18{ 20{
@@ -22,7 +24,7 @@ void __init paging_init(void)
22/* 24/*
23 * Flush the mmu and reset associated register to default values. 25 * Flush the mmu and reset associated register to default values.
24 */ 26 */
25void __init init_mmu(void) 27void init_mmu(void)
26{ 28{
27#if !(XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY) 29#if !(XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY)
28 /* 30 /*
@@ -37,7 +39,21 @@ void __init init_mmu(void)
37 set_itlbcfg_register(0); 39 set_itlbcfg_register(0);
38 set_dtlbcfg_register(0); 40 set_dtlbcfg_register(0);
39#endif 41#endif
40 flush_tlb_all(); 42#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF
43 /*
44 * Update the IO area mapping in case xtensa_kio_paddr has changed
45 */
46 write_dtlb_entry(__pte(xtensa_kio_paddr + CA_WRITEBACK),
47 XCHAL_KIO_CACHED_VADDR + 6);
48 write_itlb_entry(__pte(xtensa_kio_paddr + CA_WRITEBACK),
49 XCHAL_KIO_CACHED_VADDR + 6);
50 write_dtlb_entry(__pte(xtensa_kio_paddr + CA_BYPASS),
51 XCHAL_KIO_BYPASS_VADDR + 6);
52 write_itlb_entry(__pte(xtensa_kio_paddr + CA_BYPASS),
53 XCHAL_KIO_BYPASS_VADDR + 6);
54#endif
55
56 local_flush_tlb_all();
41 57
42 /* Set rasid register to a known value. */ 58 /* Set rasid register to a known value. */
43 59
diff --git a/arch/xtensa/mm/tlb.c b/arch/xtensa/mm/tlb.c
index ca9d2366bf12..ade623826788 100644
--- a/arch/xtensa/mm/tlb.c
+++ b/arch/xtensa/mm/tlb.c
@@ -48,7 +48,7 @@ static inline void __flush_dtlb_all (void)
48} 48}
49 49
50 50
51void flush_tlb_all (void) 51void local_flush_tlb_all(void)
52{ 52{
53 __flush_itlb_all(); 53 __flush_itlb_all();
54 __flush_dtlb_all(); 54 __flush_dtlb_all();
@@ -60,19 +60,23 @@ void flush_tlb_all (void)
60 * a new context will be assigned to it. 60 * a new context will be assigned to it.
61 */ 61 */
62 62
63void flush_tlb_mm(struct mm_struct *mm) 63void local_flush_tlb_mm(struct mm_struct *mm)
64{ 64{
65 int cpu = smp_processor_id();
66
65 if (mm == current->active_mm) { 67 if (mm == current->active_mm) {
66 unsigned long flags; 68 unsigned long flags;
67 local_irq_save(flags); 69 local_irq_save(flags);
68 __get_new_mmu_context(mm); 70 mm->context.asid[cpu] = NO_CONTEXT;
69 __load_mmu_context(mm); 71 activate_context(mm, cpu);
70 local_irq_restore(flags); 72 local_irq_restore(flags);
73 } else {
74 mm->context.asid[cpu] = NO_CONTEXT;
75 mm->context.cpu = -1;
71 } 76 }
72 else
73 mm->context = 0;
74} 77}
75 78
79
76#define _ITLB_ENTRIES (ITLB_ARF_WAYS << XCHAL_ITLB_ARF_ENTRIES_LOG2) 80#define _ITLB_ENTRIES (ITLB_ARF_WAYS << XCHAL_ITLB_ARF_ENTRIES_LOG2)
77#define _DTLB_ENTRIES (DTLB_ARF_WAYS << XCHAL_DTLB_ARF_ENTRIES_LOG2) 81#define _DTLB_ENTRIES (DTLB_ARF_WAYS << XCHAL_DTLB_ARF_ENTRIES_LOG2)
78#if _ITLB_ENTRIES > _DTLB_ENTRIES 82#if _ITLB_ENTRIES > _DTLB_ENTRIES
@@ -81,24 +85,26 @@ void flush_tlb_mm(struct mm_struct *mm)
81# define _TLB_ENTRIES _DTLB_ENTRIES 85# define _TLB_ENTRIES _DTLB_ENTRIES
82#endif 86#endif
83 87
84void flush_tlb_range (struct vm_area_struct *vma, 88void local_flush_tlb_range(struct vm_area_struct *vma,
85 unsigned long start, unsigned long end) 89 unsigned long start, unsigned long end)
86{ 90{
91 int cpu = smp_processor_id();
87 struct mm_struct *mm = vma->vm_mm; 92 struct mm_struct *mm = vma->vm_mm;
88 unsigned long flags; 93 unsigned long flags;
89 94
90 if (mm->context == NO_CONTEXT) 95 if (mm->context.asid[cpu] == NO_CONTEXT)
91 return; 96 return;
92 97
93#if 0 98#if 0
94 printk("[tlbrange<%02lx,%08lx,%08lx>]\n", 99 printk("[tlbrange<%02lx,%08lx,%08lx>]\n",
95 (unsigned long)mm->context, start, end); 100 (unsigned long)mm->context.asid[cpu], start, end);
96#endif 101#endif
97 local_irq_save(flags); 102 local_irq_save(flags);
98 103
99 if (end-start + (PAGE_SIZE-1) <= _TLB_ENTRIES << PAGE_SHIFT) { 104 if (end-start + (PAGE_SIZE-1) <= _TLB_ENTRIES << PAGE_SHIFT) {
100 int oldpid = get_rasid_register(); 105 int oldpid = get_rasid_register();
101 set_rasid_register (ASID_INSERT(mm->context)); 106
107 set_rasid_register(ASID_INSERT(mm->context.asid[cpu]));
102 start &= PAGE_MASK; 108 start &= PAGE_MASK;
103 if (vma->vm_flags & VM_EXEC) 109 if (vma->vm_flags & VM_EXEC)
104 while(start < end) { 110 while(start < end) {
@@ -114,24 +120,25 @@ void flush_tlb_range (struct vm_area_struct *vma,
114 120
115 set_rasid_register(oldpid); 121 set_rasid_register(oldpid);
116 } else { 122 } else {
117 flush_tlb_mm(mm); 123 local_flush_tlb_mm(mm);
118 } 124 }
119 local_irq_restore(flags); 125 local_irq_restore(flags);
120} 126}
121 127
122void flush_tlb_page (struct vm_area_struct *vma, unsigned long page) 128void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
123{ 129{
130 int cpu = smp_processor_id();
124 struct mm_struct* mm = vma->vm_mm; 131 struct mm_struct* mm = vma->vm_mm;
125 unsigned long flags; 132 unsigned long flags;
126 int oldpid; 133 int oldpid;
127 134
128 if(mm->context == NO_CONTEXT) 135 if (mm->context.asid[cpu] == NO_CONTEXT)
129 return; 136 return;
130 137
131 local_irq_save(flags); 138 local_irq_save(flags);
132 139
133 oldpid = get_rasid_register(); 140 oldpid = get_rasid_register();
134 set_rasid_register(ASID_INSERT(mm->context)); 141 set_rasid_register(ASID_INSERT(mm->context.asid[cpu]));
135 142
136 if (vma->vm_flags & VM_EXEC) 143 if (vma->vm_flags & VM_EXEC)
137 invalidate_itlb_mapping(page); 144 invalidate_itlb_mapping(page);
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index e9e1aad8c271..d05f8feeb8d7 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -38,7 +38,7 @@
38#define DRIVER_NAME "iss-netdev" 38#define DRIVER_NAME "iss-netdev"
39#define ETH_MAX_PACKET 1500 39#define ETH_MAX_PACKET 1500
40#define ETH_HEADER_OTHER 14 40#define ETH_HEADER_OTHER 14
41#define ISS_NET_TIMER_VALUE (2 * HZ) 41#define ISS_NET_TIMER_VALUE (HZ / 10)
42 42
43 43
44static DEFINE_SPINLOCK(opened_lock); 44static DEFINE_SPINLOCK(opened_lock);
@@ -56,8 +56,6 @@ static LIST_HEAD(devices);
56 56
57struct tuntap_info { 57struct tuntap_info {
58 char dev_name[IFNAMSIZ]; 58 char dev_name[IFNAMSIZ];
59 int fixed_config;
60 unsigned char gw[ETH_ALEN];
61 int fd; 59 int fd;
62}; 60};
63 61
@@ -67,7 +65,6 @@ struct tuntap_info {
67/* This structure contains out private information for the driver. */ 65/* This structure contains out private information for the driver. */
68 66
69struct iss_net_private { 67struct iss_net_private {
70
71 struct list_head device_list; 68 struct list_head device_list;
72 struct list_head opened_list; 69 struct list_head opened_list;
73 70
@@ -83,9 +80,6 @@ struct iss_net_private {
83 int index; 80 int index;
84 int mtu; 81 int mtu;
85 82
86 unsigned char mac[ETH_ALEN];
87 int have_mac;
88
89 struct { 83 struct {
90 union { 84 union {
91 struct tuntap_info tuntap; 85 struct tuntap_info tuntap;
@@ -118,68 +112,48 @@ static char *split_if_spec(char *str, ...)
118 *arg = str; 112 *arg = str;
119 if (end == NULL) 113 if (end == NULL)
120 return NULL; 114 return NULL;
121 *end ++ = '\0'; 115 *end++ = '\0';
122 str = end; 116 str = end;
123 } 117 }
124 va_end(ap); 118 va_end(ap);
125 return str; 119 return str;
126} 120}
127 121
122/* Set Ethernet address of the specified device. */
128 123
129#if 0 124static void setup_etheraddr(struct net_device *dev, char *str)
130/* Adjust SKB. */
131
132struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra)
133{ 125{
134 if ((skb != NULL) && (skb_tailroom(skb) < extra)) { 126 unsigned char *addr = dev->dev_addr;
135 struct sk_buff *skb2;
136
137 skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC);
138 dev_kfree_skb(skb);
139 skb = skb2;
140 }
141 if (skb != NULL)
142 skb_put(skb, extra);
143
144 return skb;
145}
146#endif
147 127
148/* Return the IP address as a string for a given device. */ 128 if (str == NULL)
129 goto random;
149 130
150static void dev_ip_addr(void *d, char *buf, char *bin_buf) 131 if (!mac_pton(str, addr)) {
151{ 132 pr_err("%s: failed to parse '%s' as an ethernet address\n",
152 struct net_device *dev = d; 133 dev->name, str);
153 struct in_device *ip = dev->ip_ptr; 134 goto random;
154 struct in_ifaddr *in;
155 __be32 addr;
156
157 if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) {
158 printk(KERN_WARNING "Device not assigned an IP address!\n");
159 return;
160 } 135 }
161 136 if (is_multicast_ether_addr(addr)) {
162 addr = in->ifa_address; 137 pr_err("%s: attempt to assign a multicast ethernet address\n",
163 sprintf(buf, "%d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff, 138 dev->name);
164 (addr >> 16) & 0xff, addr >> 24); 139 goto random;
165
166 if (bin_buf) {
167 bin_buf[0] = addr & 0xff;
168 bin_buf[1] = (addr >> 8) & 0xff;
169 bin_buf[2] = (addr >> 16) & 0xff;
170 bin_buf[3] = addr >> 24;
171 } 140 }
141 if (!is_valid_ether_addr(addr)) {
142 pr_err("%s: attempt to assign an invalid ethernet address\n",
143 dev->name);
144 goto random;
145 }
146 if (!is_local_ether_addr(addr))
147 pr_warn("%s: assigning a globally valid ethernet address\n",
148 dev->name);
149 return;
150
151random:
152 pr_info("%s: choosing a random ethernet address\n",
153 dev->name);
154 eth_hw_addr_random(dev);
172} 155}
173 156
174/* Set Ethernet address of the specified device. */
175
176static void inline set_ether_mac(void *d, unsigned char *addr)
177{
178 struct net_device *dev = d;
179 memcpy(dev->dev_addr, addr, ETH_ALEN);
180}
181
182
183/* ======================= TUNTAP TRANSPORT INTERFACE ====================== */ 157/* ======================= TUNTAP TRANSPORT INTERFACE ====================== */
184 158
185static int tuntap_open(struct iss_net_private *lp) 159static int tuntap_open(struct iss_net_private *lp)
@@ -189,24 +163,21 @@ static int tuntap_open(struct iss_net_private *lp)
189 int err = -EINVAL; 163 int err = -EINVAL;
190 int fd; 164 int fd;
191 165
192 /* We currently only support a fixed configuration. */ 166 fd = simc_open("/dev/net/tun", 02, 0); /* O_RDWR */
193 167 if (fd < 0) {
194 if (!lp->tp.info.tuntap.fixed_config) 168 pr_err("%s: failed to open /dev/net/tun, returned %d (errno = %d)\n",
195 return -EINVAL; 169 lp->dev->name, fd, errno);
196
197 if ((fd = simc_open("/dev/net/tun", 02, 0)) < 0) { /* O_RDWR */
198 printk("Failed to open /dev/net/tun, returned %d "
199 "(errno = %d)\n", fd, errno);
200 return fd; 170 return fd;
201 } 171 }
202 172
203 memset(&ifr, 0, sizeof ifr); 173 memset(&ifr, 0, sizeof(ifr));
204 ifr.ifr_flags = IFF_TAP | IFF_NO_PI; 174 ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
205 strlcpy(ifr.ifr_name, dev_name, sizeof ifr.ifr_name); 175 strlcpy(ifr.ifr_name, dev_name, sizeof(ifr.ifr_name));
206 176
207 if ((err = simc_ioctl(fd, TUNSETIFF, (void*) &ifr)) < 0) { 177 err = simc_ioctl(fd, TUNSETIFF, &ifr);
208 printk("Failed to set interface, returned %d " 178 if (err < 0) {
209 "(errno = %d)\n", err, errno); 179 pr_err("%s: failed to set interface %s, returned %d (errno = %d)\n",
180 lp->dev->name, dev_name, err, errno);
210 simc_close(fd); 181 simc_close(fd);
211 return err; 182 return err;
212 } 183 }
@@ -217,27 +188,17 @@ static int tuntap_open(struct iss_net_private *lp)
217 188
218static void tuntap_close(struct iss_net_private *lp) 189static void tuntap_close(struct iss_net_private *lp)
219{ 190{
220#if 0
221 if (lp->tp.info.tuntap.fixed_config)
222 iter_addresses(lp->tp.info.tuntap.dev, close_addr, lp->host.dev_name);
223#endif
224 simc_close(lp->tp.info.tuntap.fd); 191 simc_close(lp->tp.info.tuntap.fd);
225 lp->tp.info.tuntap.fd = -1; 192 lp->tp.info.tuntap.fd = -1;
226} 193}
227 194
228static int tuntap_read (struct iss_net_private *lp, struct sk_buff **skb) 195static int tuntap_read(struct iss_net_private *lp, struct sk_buff **skb)
229{ 196{
230#if 0
231 *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER);
232 if (*skb == NULL)
233 return -ENOMEM;
234#endif
235
236 return simc_read(lp->tp.info.tuntap.fd, 197 return simc_read(lp->tp.info.tuntap.fd,
237 (*skb)->data, (*skb)->dev->mtu + ETH_HEADER_OTHER); 198 (*skb)->data, (*skb)->dev->mtu + ETH_HEADER_OTHER);
238} 199}
239 200
240static int tuntap_write (struct iss_net_private *lp, struct sk_buff **skb) 201static int tuntap_write(struct iss_net_private *lp, struct sk_buff **skb)
241{ 202{
242 return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len); 203 return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len);
243} 204}
@@ -253,45 +214,45 @@ static int tuntap_poll(struct iss_net_private *lp)
253} 214}
254 215
255/* 216/*
256 * Currently only a device name is supported. 217 * ethX=tuntap,[mac address],device name
257 * ethX=tuntap[,[mac address][,[device name]]]
258 */ 218 */
259 219
260static int tuntap_probe(struct iss_net_private *lp, int index, char *init) 220static int tuntap_probe(struct iss_net_private *lp, int index, char *init)
261{ 221{
262 const int len = strlen(TRANSPORT_TUNTAP_NAME); 222 struct net_device *dev = lp->dev;
263 char *dev_name = NULL, *mac_str = NULL, *rem = NULL; 223 char *dev_name = NULL, *mac_str = NULL, *rem = NULL;
264 224
265 /* Transport should be 'tuntap': ethX=tuntap,mac,dev_name */ 225 /* Transport should be 'tuntap': ethX=tuntap,mac,dev_name */
266 226
267 if (strncmp(init, TRANSPORT_TUNTAP_NAME, len)) 227 if (strncmp(init, TRANSPORT_TUNTAP_NAME,
228 sizeof(TRANSPORT_TUNTAP_NAME) - 1))
268 return 0; 229 return 0;
269 230
270 if (*(init += strlen(TRANSPORT_TUNTAP_NAME)) == ',') { 231 init += sizeof(TRANSPORT_TUNTAP_NAME) - 1;
271 if ((rem=split_if_spec(init+1, &mac_str, &dev_name)) != NULL) { 232 if (*init == ',') {
272 printk("Extra garbage on specification : '%s'\n", rem); 233 rem = split_if_spec(init + 1, &mac_str, &dev_name);
234 if (rem != NULL) {
235 pr_err("%s: extra garbage on specification : '%s'\n",
236 dev->name, rem);
273 return 0; 237 return 0;
274 } 238 }
275 } else if (*init != '\0') { 239 } else if (*init != '\0') {
276 printk("Invalid argument: %s. Skipping device!\n", init); 240 pr_err("%s: invalid argument: %s. Skipping device!\n",
241 dev->name, init);
277 return 0; 242 return 0;
278 } 243 }
279 244
280 if (dev_name) { 245 if (!dev_name) {
281 strncpy(lp->tp.info.tuntap.dev_name, dev_name, 246 pr_err("%s: missing tuntap device name\n", dev->name);
282 sizeof lp->tp.info.tuntap.dev_name); 247 return 0;
283 lp->tp.info.tuntap.fixed_config = 1; 248 }
284 } else
285 strcpy(lp->tp.info.tuntap.dev_name, TRANSPORT_TUNTAP_NAME);
286 249
250 strlcpy(lp->tp.info.tuntap.dev_name, dev_name,
251 sizeof(lp->tp.info.tuntap.dev_name));
287 252
288#if 0 253 setup_etheraddr(dev, mac_str);
289 if (setup_etheraddr(mac_str, lp->mac))
290 lp->have_mac = 1;
291#endif
292 lp->mtu = TRANSPORT_TUNTAP_MTU;
293 254
294 //lp->info.tuntap.gate_addr = gate_addr; 255 lp->mtu = TRANSPORT_TUNTAP_MTU;
295 256
296 lp->tp.info.tuntap.fd = -1; 257 lp->tp.info.tuntap.fd = -1;
297 258
@@ -302,13 +263,6 @@ static int tuntap_probe(struct iss_net_private *lp, int index, char *init)
302 lp->tp.protocol = tuntap_protocol; 263 lp->tp.protocol = tuntap_protocol;
303 lp->tp.poll = tuntap_poll; 264 lp->tp.poll = tuntap_poll;
304 265
305 printk("TUN/TAP backend - ");
306#if 0
307 if (lp->host.gate_addr != NULL)
308 printk("IP = %s", lp->host.gate_addr);
309#endif
310 printk("\n");
311
312 return 1; 266 return 1;
313} 267}
314 268
@@ -327,7 +281,8 @@ static int iss_net_rx(struct net_device *dev)
327 281
328 /* Try to allocate memory, if it fails, try again next round. */ 282 /* Try to allocate memory, if it fails, try again next round. */
329 283
330 if ((skb = dev_alloc_skb(dev->mtu + 2 + ETH_HEADER_OTHER)) == NULL) { 284 skb = dev_alloc_skb(dev->mtu + 2 + ETH_HEADER_OTHER);
285 if (skb == NULL) {
331 lp->stats.rx_dropped++; 286 lp->stats.rx_dropped++;
332 return 0; 287 return 0;
333 } 288 }
@@ -347,7 +302,6 @@ static int iss_net_rx(struct net_device *dev)
347 302
348 lp->stats.rx_bytes += skb->len; 303 lp->stats.rx_bytes += skb->len;
349 lp->stats.rx_packets++; 304 lp->stats.rx_packets++;
350 // netif_rx(skb);
351 netif_rx_ni(skb); 305 netif_rx_ni(skb);
352 return pkt_len; 306 return pkt_len;
353 } 307 }
@@ -378,11 +332,11 @@ static int iss_net_poll(void)
378 spin_unlock(&lp->lock); 332 spin_unlock(&lp->lock);
379 333
380 if (err < 0) { 334 if (err < 0) {
381 printk(KERN_ERR "Device '%s' read returned %d, " 335 pr_err("Device '%s' read returned %d, shutting it down\n",
382 "shutting it down\n", lp->dev->name, err); 336 lp->dev->name, err);
383 dev_close(lp->dev); 337 dev_close(lp->dev);
384 } else { 338 } else {
385 // FIXME reactivate_fd(lp->fd, ISS_ETH_IRQ); 339 /* FIXME reactivate_fd(lp->fd, ISS_ETH_IRQ); */
386 } 340 }
387 } 341 }
388 342
@@ -393,14 +347,11 @@ static int iss_net_poll(void)
393 347
394static void iss_net_timer(unsigned long priv) 348static void iss_net_timer(unsigned long priv)
395{ 349{
396 struct iss_net_private* lp = (struct iss_net_private*) priv; 350 struct iss_net_private *lp = (struct iss_net_private *)priv;
397 351
398 spin_lock(&lp->lock); 352 spin_lock(&lp->lock);
399
400 iss_net_poll(); 353 iss_net_poll();
401
402 mod_timer(&lp->timer, jiffies + lp->timer_val); 354 mod_timer(&lp->timer, jiffies + lp->timer_val);
403
404 spin_unlock(&lp->lock); 355 spin_unlock(&lp->lock);
405} 356}
406 357
@@ -408,19 +359,14 @@ static void iss_net_timer(unsigned long priv)
408static int iss_net_open(struct net_device *dev) 359static int iss_net_open(struct net_device *dev)
409{ 360{
410 struct iss_net_private *lp = netdev_priv(dev); 361 struct iss_net_private *lp = netdev_priv(dev);
411 char addr[sizeof "255.255.255.255\0"];
412 int err; 362 int err;
413 363
414 spin_lock(&lp->lock); 364 spin_lock(&lp->lock);
415 365
416 if ((err = lp->tp.open(lp)) < 0) 366 err = lp->tp.open(lp);
367 if (err < 0)
417 goto out; 368 goto out;
418 369
419 if (!lp->have_mac) {
420 dev_ip_addr(dev, addr, &lp->mac[2]);
421 set_ether_mac(dev, lp->mac);
422 }
423
424 netif_start_queue(dev); 370 netif_start_queue(dev);
425 371
426 /* clear buffer - it can happen that the host side of the interface 372 /* clear buffer - it can happen that the host side of the interface
@@ -448,7 +394,6 @@ out:
448static int iss_net_close(struct net_device *dev) 394static int iss_net_close(struct net_device *dev)
449{ 395{
450 struct iss_net_private *lp = netdev_priv(dev); 396 struct iss_net_private *lp = netdev_priv(dev);
451printk("iss_net_close!\n");
452 netif_stop_queue(dev); 397 netif_stop_queue(dev);
453 spin_lock(&lp->lock); 398 spin_lock(&lp->lock);
454 399
@@ -490,7 +435,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
490 435
491 } else { 436 } else {
492 netif_start_queue(dev); 437 netif_start_queue(dev);
493 printk(KERN_ERR "iss_net_start_xmit: failed(%d)\n", len); 438 pr_err("%s: %s failed(%d)\n", dev->name, __func__, len);
494 } 439 }
495 440
496 spin_unlock_irqrestore(&lp->lock, flags); 441 spin_unlock_irqrestore(&lp->lock, flags);
@@ -508,56 +453,27 @@ static struct net_device_stats *iss_net_get_stats(struct net_device *dev)
508 453
509static void iss_net_set_multicast_list(struct net_device *dev) 454static void iss_net_set_multicast_list(struct net_device *dev)
510{ 455{
511#if 0
512 if (dev->flags & IFF_PROMISC)
513 return;
514 else if (!netdev_mc_empty(dev))
515 dev->flags |= IFF_ALLMULTI;
516 else
517 dev->flags &= ~IFF_ALLMULTI;
518#endif
519} 456}
520 457
521static void iss_net_tx_timeout(struct net_device *dev) 458static void iss_net_tx_timeout(struct net_device *dev)
522{ 459{
523#if 0
524 dev->trans_start = jiffies;
525 netif_wake_queue(dev);
526#endif
527} 460}
528 461
529static int iss_net_set_mac(struct net_device *dev, void *addr) 462static int iss_net_set_mac(struct net_device *dev, void *addr)
530{ 463{
531#if 0
532 struct iss_net_private *lp = netdev_priv(dev); 464 struct iss_net_private *lp = netdev_priv(dev);
533 struct sockaddr *hwaddr = addr; 465 struct sockaddr *hwaddr = addr;
534 466
467 if (!is_valid_ether_addr(hwaddr->sa_data))
468 return -EADDRNOTAVAIL;
535 spin_lock(&lp->lock); 469 spin_lock(&lp->lock);
536 memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN); 470 memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
537 spin_unlock(&lp->lock); 471 spin_unlock(&lp->lock);
538#endif
539
540 return 0; 472 return 0;
541} 473}
542 474
543static int iss_net_change_mtu(struct net_device *dev, int new_mtu) 475static int iss_net_change_mtu(struct net_device *dev, int new_mtu)
544{ 476{
545#if 0
546 struct iss_net_private *lp = netdev_priv(dev);
547 int err = 0;
548
549 spin_lock(&lp->lock);
550
551 // FIXME not needed new_mtu = transport_set_mtu(new_mtu, &lp->user);
552
553 if (new_mtu < 0)
554 err = new_mtu;
555 else
556 dev->mtu = new_mtu;
557
558 spin_unlock(&lp->lock);
559 return err;
560#endif
561 return -EINVAL; 477 return -EINVAL;
562} 478}
563 479
@@ -582,7 +498,6 @@ static const struct net_device_ops iss_netdev_ops = {
582 .ndo_validate_addr = eth_validate_addr, 498 .ndo_validate_addr = eth_validate_addr,
583 .ndo_change_mtu = iss_net_change_mtu, 499 .ndo_change_mtu = iss_net_change_mtu,
584 .ndo_set_mac_address = iss_net_set_mac, 500 .ndo_set_mac_address = iss_net_set_mac,
585 //.ndo_do_ioctl = iss_net_ioctl,
586 .ndo_tx_timeout = iss_net_tx_timeout, 501 .ndo_tx_timeout = iss_net_tx_timeout,
587 .ndo_set_rx_mode = iss_net_set_multicast_list, 502 .ndo_set_rx_mode = iss_net_set_multicast_list,
588}; 503};
@@ -593,24 +508,29 @@ static int iss_net_configure(int index, char *init)
593 struct iss_net_private *lp; 508 struct iss_net_private *lp;
594 int err; 509 int err;
595 510
596 if ((dev = alloc_etherdev(sizeof *lp)) == NULL) { 511 dev = alloc_etherdev(sizeof(*lp));
597 printk(KERN_ERR "eth_configure: failed to allocate device\n"); 512 if (dev == NULL) {
513 pr_err("eth_configure: failed to allocate device\n");
598 return 1; 514 return 1;
599 } 515 }
600 516
601 /* Initialize private element. */ 517 /* Initialize private element. */
602 518
603 lp = netdev_priv(dev); 519 lp = netdev_priv(dev);
604 *lp = ((struct iss_net_private) { 520 *lp = (struct iss_net_private) {
605 .device_list = LIST_HEAD_INIT(lp->device_list), 521 .device_list = LIST_HEAD_INIT(lp->device_list),
606 .opened_list = LIST_HEAD_INIT(lp->opened_list), 522 .opened_list = LIST_HEAD_INIT(lp->opened_list),
607 .lock = __SPIN_LOCK_UNLOCKED(lp.lock), 523 .lock = __SPIN_LOCK_UNLOCKED(lp.lock),
608 .dev = dev, 524 .dev = dev,
609 .index = index, 525 .index = index,
610 //.fd = -1, 526 };
611 .mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0 }, 527
612 .have_mac = 0, 528 /*
613 }); 529 * If this name ends up conflicting with an existing registered
530 * netdevice, that is OK, register_netdev{,ice}() will notice this
531 * and fail.
532 */
533 snprintf(dev->name, sizeof(dev->name), "eth%d", index);
614 534
615 /* 535 /*
616 * Try all transport protocols. 536 * Try all transport protocols.
@@ -618,14 +538,12 @@ static int iss_net_configure(int index, char *init)
618 */ 538 */
619 539
620 if (!tuntap_probe(lp, index, init)) { 540 if (!tuntap_probe(lp, index, init)) {
621 printk("Invalid arguments. Skipping device!\n"); 541 pr_err("%s: invalid arguments. Skipping device!\n",
542 dev->name);
622 goto errout; 543 goto errout;
623 } 544 }
624 545
625 printk(KERN_INFO "Netdevice %d ", index); 546 pr_info("Netdevice %d (%pM)\n", index, dev->dev_addr);
626 if (lp->have_mac)
627 printk("(%pM) ", lp->mac);
628 printk(": ");
629 547
630 /* sysfs register */ 548 /* sysfs register */
631 549
@@ -641,14 +559,7 @@ static int iss_net_configure(int index, char *init)
641 lp->pdev.id = index; 559 lp->pdev.id = index;
642 lp->pdev.name = DRIVER_NAME; 560 lp->pdev.name = DRIVER_NAME;
643 platform_device_register(&lp->pdev); 561 platform_device_register(&lp->pdev);
644 SET_NETDEV_DEV(dev,&lp->pdev.dev); 562 SET_NETDEV_DEV(dev, &lp->pdev.dev);
645
646 /*
647 * If this name ends up conflicting with an existing registered
648 * netdevice, that is OK, register_netdev{,ice}() will notice this
649 * and fail.
650 */
651 snprintf(dev->name, sizeof dev->name, "eth%d", index);
652 563
653 dev->netdev_ops = &iss_netdev_ops; 564 dev->netdev_ops = &iss_netdev_ops;
654 dev->mtu = lp->mtu; 565 dev->mtu = lp->mtu;
@@ -660,7 +571,7 @@ static int iss_net_configure(int index, char *init)
660 rtnl_unlock(); 571 rtnl_unlock();
661 572
662 if (err) { 573 if (err) {
663 printk("Error registering net device!\n"); 574 pr_err("%s: error registering net device!\n", dev->name);
664 /* XXX: should we call ->remove() here? */ 575 /* XXX: should we call ->remove() here? */
665 free_netdev(dev); 576 free_netdev(dev);
666 return 1; 577 return 1;
@@ -669,16 +580,11 @@ static int iss_net_configure(int index, char *init)
669 init_timer(&lp->tl); 580 init_timer(&lp->tl);
670 lp->tl.function = iss_net_user_timer_expire; 581 lp->tl.function = iss_net_user_timer_expire;
671 582
672#if 0
673 if (lp->have_mac)
674 set_ether_mac(dev, lp->mac);
675#endif
676 return 0; 583 return 0;
677 584
678errout: 585errout:
679 // FIXME: unregister; free, etc.. 586 /* FIXME: unregister; free, etc.. */
680 return -EIO; 587 return -EIO;
681
682} 588}
683 589
684/* ------------------------------------------------------------------------- */ 590/* ------------------------------------------------------------------------- */
@@ -706,21 +612,22 @@ static int __init iss_net_setup(char *str)
706 struct iss_net_init *new; 612 struct iss_net_init *new;
707 struct list_head *ele; 613 struct list_head *ele;
708 char *end; 614 char *end;
709 int n; 615 int rc;
616 unsigned n;
710 617
711 n = simple_strtoul(str, &end, 0); 618 end = strchr(str, '=');
712 if (end == str) { 619 if (!end) {
713 printk(ERR "Failed to parse '%s'\n", str); 620 printk(ERR "Expected '=' after device number\n");
714 return 1;
715 }
716 if (n < 0) {
717 printk(ERR "Device %d is negative\n", n);
718 return 1; 621 return 1;
719 } 622 }
720 if (*(str = end) != '=') { 623 *end = 0;
721 printk(ERR "Expected '=' after device number\n"); 624 rc = kstrtouint(str, 0, &n);
625 *end = '=';
626 if (rc < 0) {
627 printk(ERR "Failed to parse '%s'\n", str);
722 return 1; 628 return 1;
723 } 629 }
630 str = end;
724 631
725 spin_lock(&devices_lock); 632 spin_lock(&devices_lock);
726 633
@@ -733,13 +640,13 @@ static int __init iss_net_setup(char *str)
733 spin_unlock(&devices_lock); 640 spin_unlock(&devices_lock);
734 641
735 if (device && device->index == n) { 642 if (device && device->index == n) {
736 printk(ERR "Device %d already configured\n", n); 643 printk(ERR "Device %u already configured\n", n);
737 return 1; 644 return 1;
738 } 645 }
739 646
740 new = alloc_bootmem(sizeof(*new)); 647 new = alloc_bootmem(sizeof(*new));
741 if (new == NULL) { 648 if (new == NULL) {
742 printk("Alloc_bootmem failed\n"); 649 printk(ERR "Alloc_bootmem failed\n");
743 return 1; 650 return 1;
744 } 651 }
745 652
@@ -753,7 +660,7 @@ static int __init iss_net_setup(char *str)
753 660
754#undef ERR 661#undef ERR
755 662
756__setup("eth=", iss_net_setup); 663__setup("eth", iss_net_setup);
757 664
758/* 665/*
759 * Initialize all ISS Ethernet devices previously registered in iss_net_setup. 666 * Initialize all ISS Ethernet devices previously registered in iss_net_setup.
diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c
index 8c6e819cd8ed..48eebacdf5fe 100644
--- a/arch/xtensa/platforms/iss/simdisk.c
+++ b/arch/xtensa/platforms/iss/simdisk.c
@@ -103,18 +103,18 @@ static void simdisk_transfer(struct simdisk *dev, unsigned long sector,
103 103
104static int simdisk_xfer_bio(struct simdisk *dev, struct bio *bio) 104static int simdisk_xfer_bio(struct simdisk *dev, struct bio *bio)
105{ 105{
106 int i; 106 struct bio_vec bvec;
107 struct bio_vec *bvec; 107 struct bvec_iter iter;
108 sector_t sector = bio->bi_sector; 108 sector_t sector = bio->bi_iter.bi_sector;
109 109
110 bio_for_each_segment(bvec, bio, i) { 110 bio_for_each_segment(bvec, bio, iter) {
111 char *buffer = __bio_kmap_atomic(bio, i); 111 char *buffer = __bio_kmap_atomic(bio, iter);
112 unsigned len = bvec->bv_len >> SECTOR_SHIFT; 112 unsigned len = bvec.bv_len >> SECTOR_SHIFT;
113 113
114 simdisk_transfer(dev, sector, len, buffer, 114 simdisk_transfer(dev, sector, len, buffer,
115 bio_data_dir(bio) == WRITE); 115 bio_data_dir(bio) == WRITE);
116 sector += len; 116 sector += len;
117 __bio_kunmap_atomic(bio); 117 __bio_kunmap_atomic(buffer);
118 } 118 }
119 return 0; 119 return 0;
120} 120}
diff --git a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
index 4416773cbde5..aeb316b7ff88 100644
--- a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
+++ b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
@@ -15,10 +15,6 @@
15#ifndef __XTENSA_XTAVNET_HARDWARE_H 15#ifndef __XTENSA_XTAVNET_HARDWARE_H
16#define __XTENSA_XTAVNET_HARDWARE_H 16#define __XTENSA_XTAVNET_HARDWARE_H
17 17
18/* By default NO_IRQ is defined to 0 in Linux, but we use the
19 interrupt 0 for UART... */
20#define NO_IRQ -1
21
22/* Memory configuration. */ 18/* Memory configuration. */
23 19
24#define PLATFORM_DEFAULT_MEM_START 0x00000000 20#define PLATFORM_DEFAULT_MEM_START 0x00000000
@@ -30,7 +26,7 @@
30 26
31/* Default assignment of LX60 devices to external interrupts. */ 27/* Default assignment of LX60 devices to external interrupts. */
32 28
33#ifdef CONFIG_ARCH_HAS_SMP 29#ifdef CONFIG_XTENSA_MX
34#define DUART16552_INTNUM XCHAL_EXTINT3_NUM 30#define DUART16552_INTNUM XCHAL_EXTINT3_NUM
35#define OETH_IRQ XCHAL_EXTINT4_NUM 31#define OETH_IRQ XCHAL_EXTINT4_NUM
36#else 32#else
diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c
index 74bb74fa3f87..800227862fe8 100644
--- a/arch/xtensa/platforms/xtfpga/setup.c
+++ b/arch/xtensa/platforms/xtfpga/setup.c
@@ -168,7 +168,7 @@ void __init platform_calibrate_ccount(void)
168 long clk_freq = 0; 168 long clk_freq = 0;
169#ifdef CONFIG_OF 169#ifdef CONFIG_OF
170 struct device_node *cpu = 170 struct device_node *cpu =
171 of_find_compatible_node(NULL, NULL, "xtensa,cpu"); 171 of_find_compatible_node(NULL, NULL, "cdns,xtensa-cpu");
172 if (cpu) { 172 if (cpu) {
173 u32 freq; 173 u32 freq;
174 update_clock_frequency(cpu); 174 update_clock_frequency(cpu);
@@ -194,7 +194,7 @@ void __init platform_calibrate_ccount(void)
194 * Ethernet -- OpenCores Ethernet MAC (ethoc driver) 194 * Ethernet -- OpenCores Ethernet MAC (ethoc driver)
195 */ 195 */
196 196
197static struct resource ethoc_res[] __initdata = { 197static struct resource ethoc_res[] = {
198 [0] = { /* register space */ 198 [0] = { /* register space */
199 .start = OETH_REGS_PADDR, 199 .start = OETH_REGS_PADDR,
200 .end = OETH_REGS_PADDR + OETH_REGS_SIZE - 1, 200 .end = OETH_REGS_PADDR + OETH_REGS_SIZE - 1,
@@ -212,7 +212,7 @@ static struct resource ethoc_res[] __initdata = {
212 }, 212 },
213}; 213};
214 214
215static struct ethoc_platform_data ethoc_pdata __initdata = { 215static struct ethoc_platform_data ethoc_pdata = {
216 /* 216 /*
217 * The MAC address for these boards is 00:50:c2:13:6f:xx. 217 * The MAC address for these boards is 00:50:c2:13:6f:xx.
218 * The last byte (here as zero) is read from the DIP switches on the 218 * The last byte (here as zero) is read from the DIP switches on the
@@ -222,7 +222,7 @@ static struct ethoc_platform_data ethoc_pdata __initdata = {
222 .phy_id = -1, 222 .phy_id = -1,
223}; 223};
224 224
225static struct platform_device ethoc_device __initdata = { 225static struct platform_device ethoc_device = {
226 .name = "ethoc", 226 .name = "ethoc",
227 .id = -1, 227 .id = -1,
228 .num_resources = ARRAY_SIZE(ethoc_res), 228 .num_resources = ARRAY_SIZE(ethoc_res),
@@ -236,13 +236,13 @@ static struct platform_device ethoc_device __initdata = {
236 * UART 236 * UART
237 */ 237 */
238 238
239static struct resource serial_resource __initdata = { 239static struct resource serial_resource = {
240 .start = DUART16552_PADDR, 240 .start = DUART16552_PADDR,
241 .end = DUART16552_PADDR + 0x1f, 241 .end = DUART16552_PADDR + 0x1f,
242 .flags = IORESOURCE_MEM, 242 .flags = IORESOURCE_MEM,
243}; 243};
244 244
245static struct plat_serial8250_port serial_platform_data[] __initdata = { 245static struct plat_serial8250_port serial_platform_data[] = {
246 [0] = { 246 [0] = {
247 .mapbase = DUART16552_PADDR, 247 .mapbase = DUART16552_PADDR,
248 .irq = DUART16552_INTNUM, 248 .irq = DUART16552_INTNUM,
@@ -255,7 +255,7 @@ static struct plat_serial8250_port serial_platform_data[] __initdata = {
255 { }, 255 { },
256}; 256};
257 257
258static struct platform_device xtavnet_uart __initdata = { 258static struct platform_device xtavnet_uart = {
259 .name = "serial8250", 259 .name = "serial8250",
260 .id = PLAT8250_DEV_PLATFORM, 260 .id = PLAT8250_DEV_PLATFORM,
261 .dev = { 261 .dev = {
diff --git a/arch/xtensa/variants/s6000/include/variant/irq.h b/arch/xtensa/variants/s6000/include/variant/irq.h
index 97d6fc48deff..39ca751a6255 100644
--- a/arch/xtensa/variants/s6000/include/variant/irq.h
+++ b/arch/xtensa/variants/s6000/include/variant/irq.h
@@ -1,7 +1,6 @@
1#ifndef _XTENSA_S6000_IRQ_H 1#ifndef _XTENSA_S6000_IRQ_H
2#define _XTENSA_S6000_IRQ_H 2#define _XTENSA_S6000_IRQ_H
3 3
4#define NO_IRQ (-1)
5#define VARIANT_NR_IRQS 8 /* GPIO interrupts */ 4#define VARIANT_NR_IRQS 8 /* GPIO interrupts */
6 5
7extern void variant_irq_enable(unsigned int irq); 6extern void variant_irq_enable(unsigned int irq);